summaryrefslogtreecommitdiffstats
path: root/libhb/render.c
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2009-03-31 16:46:59 +0000
committerjbrjake <[email protected]>2009-03-31 16:46:59 +0000
commit276345b4d92a23bd125215f07786fee9449ce3cf (patch)
tree1c7ca20ed03d533307e3cb880da4dba2e7aed4cc /libhb/render.c
parent56e15a46f9cd4ee630b45036ab9a034204e3b850 (diff)
Flush frames from the delay queue in render. This should add an extra couple of frames to the end of output when using same as source fps or vfr detelecine. Thanks, eddyg!
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2285 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/render.c')
-rw-r--r--libhb/render.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/libhb/render.c b/libhb/render.c
index 55295a4c2..5c7809dc3 100644
--- a/libhb/render.c
+++ b/libhb/render.c
@@ -208,11 +208,43 @@ int renderWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
if( in->size <= 0 )
{
+ hb_buffer_t *head = NULL, *tail = NULL, *next;
+ int counter = 2;
+
/* If the input buffer is end of stream, send out an empty one
- * to the next stage as well. Note that this will result in us
- * losing the current contents of the delay queue.
- */
- *buf_out = in;
+ * to the next stage as well. To avoid losing the contents of
+ * the delay queue connect the buffers in the delay queue in
+ * the correct order, and add the end of stream buffer to the
+ * end.
+ */
+ while( next = hb_fifo_get( pv->delay_queue ) )
+ {
+
+ /* We can't use the given time stamps. Previous frames
+ might already have been extended, throwing off the
+ raw values fed to render.c. Instead, their
+ stop and start times are stored in arrays.
+ The 4th cached frame will be the to use.
+ If it needed its duration extended to make up
+ lost time, it will have happened above. */
+ next->start = pv->last_start[counter];
+ next->stop = pv->last_stop[counter--];
+
+ if( !head && !tail )
+ {
+ head = tail = next;
+ } else {
+ tail->next = next;
+ tail = next;
+ }
+ }
+ if( tail )
+ {
+ tail->next = in;
+ *buf_out = head;
+ } else {
+ *buf_out = in;
+ }
*buf_in = NULL;
return HB_WORK_DONE;
}