Frees the specified buffer list.
| 1035 | |
| 1036 | // Frees the specified buffer list. |
| 1037 | void hb_buffer_close( hb_buffer_t ** _b ) |
| 1038 | { |
| 1039 | hb_buffer_t * b = *_b; |
| 1040 | |
| 1041 | while( b ) |
| 1042 | { |
| 1043 | hb_buffer_t * next = b->next; |
| 1044 | hb_fifo_t *buffer_pool = size_to_pool( b->alloc ); |
| 1045 | |
| 1046 | b->next = NULL; |
| 1047 | |
| 1048 | #if defined(HB_BUFFER_DEBUG) |
| 1049 | hb_lock(buffers.lock); |
| 1050 | hb_list_rem(buffers.alloc_list, b); |
| 1051 | hb_unlock(buffers.lock); |
| 1052 | #endif |
| 1053 | |
| 1054 | free_buffer_resources(b); |
| 1055 | |
| 1056 | if (buffer_pool && !hb_fifo_is_full(buffer_pool)) |
| 1057 | { |
| 1058 | #if defined(HB_BUFFER_DEBUG) |
| 1059 | if (hb_fifo_contains(buffer_pool, b)) |
| 1060 | { |
| 1061 | hb_error("hb_buffer_close: buffer %p already freed", b); |
| 1062 | assert(0); |
| 1063 | } |
| 1064 | #endif |
| 1065 | hb_fifo_push_head( buffer_pool, b ); |
| 1066 | b = next; |
| 1067 | continue; |
| 1068 | } |
| 1069 | // either the pool is full or this size doesn't use a pool |
| 1070 | // free the buf |
| 1071 | if (b->data && b->storage_type == STANDARD) |
| 1072 | { |
| 1073 | av_free(b->data); |
| 1074 | hb_lock(buffers.lock); |
| 1075 | buffers.allocated -= b->alloc; |
| 1076 | hb_unlock(buffers.lock); |
| 1077 | } |
| 1078 | free( b ); |
| 1079 | b = next; |
| 1080 | } |
| 1081 | |
| 1082 | *_b = NULL; |
| 1083 | } |
| 1084 | |
| 1085 | hb_image_t * hb_image_init(int pix_fmt, int width, int height) |
| 1086 | { |
no test coverage detected