MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_buffer_close

Function hb_buffer_close

libhb/fifo.c:1037–1083  ·  view source on GitHub ↗

Frees the specified buffer list.

Source from the content-addressed store, hash-verified

1035
1036// Frees the specified buffer list.
1037void 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
1085hb_image_t * hb_image_init(int pix_fmt, int width, int height)
1086{

Callers 15

hb_buffer_close_callbackFunction · 0.85
process_filterFunction · 0.85
hb_get_previewFunction · 0.85
hb_dvdnav_readFunction · 0.85
decsrtWorkFunction · 0.85
muxWorkFunction · 0.85
muxCloseFunction · 0.85
render_vobsubsFunction · 0.85
vobsub_workFunction · 0.85
ssa_workFunction · 0.85

Calls 9

size_to_poolFunction · 0.85
hb_lockFunction · 0.85
hb_list_remFunction · 0.85
hb_unlockFunction · 0.85
free_buffer_resourcesFunction · 0.85
hb_fifo_is_fullFunction · 0.85
hb_fifo_containsFunction · 0.85
hb_errorFunction · 0.85
hb_fifo_push_headFunction · 0.85

Tested by

no test coverage detected