From 125bbb807ec04115061bdb4ed94c58c7510ab341 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sat, 24 Apr 2010 21:39:44 +0000 Subject: fix decoding of qtrle codec and possibly others we rely on ffmpeg calling context->get_buffer, which we override to point to our get_frame_buf(), to stuff our pts values into frames it is decoding. but some decoders call context->reget_buffer instead. So I added an override for this callback as well. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3262 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/decavcodec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libhb') diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index 0f367da90..91949fb40 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -525,6 +525,14 @@ static int get_frame_buf( AVCodecContext *context, AVFrame *frame ) return avcodec_default_get_buffer( context, frame ); } +static int reget_frame_buf( AVCodecContext *context, AVFrame *frame ) +{ + hb_work_private_t *pv = context->opaque; + frame->pts = pv->pts; + pv->pts = -1; + return avcodec_default_reget_buffer( context, frame ); +} + static void log_chapter( hb_work_private_t *pv, int chap_num, int64_t pts ) { hb_chapter_t *c = hb_list_item( pv->job->title->list_chapter, chap_num - 1 ); @@ -754,6 +762,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job ) /* we have to wrap ffmpeg's get_buffer to be able to set the pts (?!) */ pv->context->opaque = pv; pv->context->get_buffer = get_frame_buf; + pv->context->reget_buffer = reget_frame_buf; return 0; } @@ -1041,6 +1050,7 @@ static void init_ffmpeg_context( hb_work_object_t *w ) // we have to wrap ffmpeg's get_buffer to be able to set the pts (?!) pv->context->opaque = pv; pv->context->get_buffer = get_frame_buf; + pv->context->reget_buffer = reget_frame_buf; // avi, mkv and possibly mp4 containers can contain the M$ VFW packed // b-frames abortion that messes up frame ordering and timestamps. -- cgit v1.2.3