From ba3674603258b9bd9662af2b8f2225f9e9395ca1 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Sun, 30 Jun 2013 20:44:21 +0000 Subject: libhb: add experimental avformat muxer for mkv and mp4 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5620 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/encavcodecaudio.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'libhb/encavcodecaudio.c') diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c index e24eaca32..44c3be75d 100644 --- a/libhb/encavcodecaudio.c +++ b/libhb/encavcodecaudio.c @@ -243,6 +243,9 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) w->config->extradata.length = context->extradata_size; } + audio->config.out.delay = av_rescale_q(context->delay, context->time_base, + (AVRational){1, 90000}); + return 0; } @@ -388,21 +391,14 @@ static hb_buffer_t* Encode(hb_work_object_t *w) if (got_packet && pkt.size) { out->size = pkt.size; - // The output pts from libav is in context->time_base. Convert it back // to our timebase. - // - // Also account for the "delay" factor that libav seems to arbitrarily - // subtract from the packet. Not sure WTH they think they are doing by - // offsetting the value in a negative direction. - out->s.start = av_rescale_q(pv->context->delay + pkt.pts, - pv->context->time_base, - (AVRational){1, 90000}); - - out->s.stop = out->s.start + (90000 * pv->samples_per_frame / - audio->config.out.samplerate); - - out->s.type = AUDIO_BUF; + out->s.start = av_rescale_q(pkt.pts, pv->context->time_base, + (AVRational){1, 90000}); + out->s.duration = (double)90000 * pv->samples_per_frame / + audio->config.out.samplerate; + out->s.stop = out->s.start + out->s.duration; + out->s.type = AUDIO_BUF; out->s.frametype = HB_FRAME_AUDIO; } else -- cgit v1.2.3