diff options
author | John Stebbins <[email protected]> | 2018-05-31 10:27:35 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2018-05-31 10:28:19 -0700 |
commit | f70380a7b1c99f919712cb69b28bfc48eeb0b83d (patch) | |
tree | ddb9cc966be4d3591047f07e545babc2d5edceb6 /libhb | |
parent | 6e72950e6c5f1cf9bef0ad446fe5cb7b80e26062 (diff) |
avfilter: fix flushing final frame
Fixes https://github.com/HandBrake/HandBrake/issues/1357
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/avfilter.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libhb/avfilter.c b/libhb/avfilter.c index b82621426..91b571301 100644 --- a/libhb/avfilter.c +++ b/libhb/avfilter.c @@ -406,8 +406,15 @@ static hb_buffer_t* filterFrame( hb_filter_private_t * pv, hb_buffer_t * in ) int result; hb_buffer_list_t list; - fill_frame(pv, pv->frame, in); - result = av_buffersrc_add_frame(pv->input, pv->frame); + if (in != NULL) + { + fill_frame(pv, pv->frame, in); + result = av_buffersrc_add_frame(pv->input, pv->frame); + } + else + { + result = av_buffersrc_add_frame(pv->input, NULL); + } if (result < 0) { return NULL; @@ -444,11 +451,13 @@ static int avfilter_work( hb_filter_object_t * filter, if (in->s.flags & HB_BUF_FLAG_EOF) { + hb_buffer_t * out = filterFrame(pv, NULL); hb_buffer_t * last = hb_buffer_list_tail(&pv->list); if (last != NULL && last->s.start != AV_NOPTS_VALUE) { last->s.stop = last->s.start + last->s.duration; } + hb_buffer_list_prepend(&pv->list, out); hb_buffer_list_append(&pv->list, in); *buf_out = hb_buffer_list_clear(&pv->list); *buf_in = NULL; |