summaryrefslogtreecommitdiffstats
path: root/libhb/fifo.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-11-14 23:50:18 +0000
committerjstebbins <[email protected]>2011-11-14 23:50:18 +0000
commitc557fe3d54da7141e898aae7f57f9897d92ba64c (patch)
treea5f6658d3817adf92f56e7fe0d358cc41ab6e429 /libhb/fifo.c
parentcc95c30563cae17eff94e974f3e3dd07f1e2b309 (diff)
Fix interleaving of subtitles in muxer
Specifically, this affects closed captions which are pushed into the pipeline very late. CC's are dribbled in 2 bytes per video frame. The entire CC that we put into a subtitle frame isn't available till we see the signal for the end of the CC. This can be several seconds after it began. So I have established a minimum buffer size that the muxer accumulates before it outputs any data. This allows CCs to get into the pipeline before the muxer outputs the interleave interval that they belong in. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4351 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/fifo.c')
-rw-r--r--libhb/fifo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 42af6d9eb..7b5660673 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -196,6 +196,21 @@ void hb_buffer_realloc( hb_buffer_t * b, int size )
}
}
+void hb_buffer_reduce( hb_buffer_t * b, int size )
+{
+ if ( size < b->alloc / 8 || b->data == NULL )
+ {
+ uint32_t orig = b->alloc;
+ size = size_to_pool( size )->buffer_size;
+ b->data = realloc( b->data, size );
+ b->alloc = size;
+
+ hb_lock(buffers.lock);
+ buffers.allocated += size - orig;
+ hb_unlock(buffers.lock);
+ }
+}
+
// Frees the specified buffer list.
void hb_buffer_close( hb_buffer_t ** _b )
{