From a9b906528ec607400ee2427354bcd84a6a1ce51e Mon Sep 17 00:00:00 2001 From: Karl Dietz Date: Mon, 22 Apr 2013 13:17:22 +0200 Subject: [PATCH] update mythtranscode to work with ac3 with newer ffmpeg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ffmpeg has moved the duration/size of the audio frame to another place, so look there links used to figure it out how to move forward http://ffmpeg.org/trac/ffmpeg/ticket/1240 http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=364c71c80e9124a2624e3bfeb8e84c5cddeda222 http://code.mythtv.org/trac/ticket/2077#comment:42 thanks to Nicolas Pöhlmann for finding the commit that broke it Refs: #2077 --- mythtv/programs/mythtranscode/mpeg2fix.cpp | 7 ++++--- mythtv/programs/mythtranscode/mpeg2fix.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mythtv/programs/mythtranscode/mpeg2fix.cpp b/mythtv/programs/mythtranscode/mpeg2fix.cpp index a659f7f62e7..c2edc72010b 100644 --- a/mythtv/programs/mythtranscode/mpeg2fix.cpp +++ b/mythtv/programs/mythtranscode/mpeg2fix.cpp @@ -2359,13 +2359,14 @@ int MPEG2fixup::Start() { FrameList *af = (*it); AVCodecContext *CC = getCodecContext(it.key()); + AVCodecParserContext *CPC = getCodecParserContext(it.key()); bool backwardsPTS = false; while (af->count()) { // What to do if the CC is corrupt? // Just wait and hope it repairs itself - if (CC->sample_rate == 0 || CC->frame_size == 0) + if (CC->sample_rate == 0 || CPC->duration == 0) break; // The order of processing frames is critical to making @@ -2381,7 +2382,7 @@ int MPEG2fixup::Start() // the audio frame int64_t nextPTS, tmpPTS; int64_t incPTS = - 90000LL * (int64_t)CC->frame_size / CC->sample_rate; + 90000LL * (int64_t)CPC->duration / CC->sample_rate; if (poq.UpdateOrigPTS(it.key(), origaPTS[it.key()], af->first()->pkt) < 0) @@ -2450,7 +2451,7 @@ int MPEG2fixup::Start() } nextPTS = add2x33(af->first()->pkt.pts, - 90000LL * (int64_t)CC->frame_size / CC->sample_rate); + 90000LL * (int64_t)CPC->duration / CC->sample_rate); if ((cutState[it.key()] == 1 && cmp2x33(nextPTS, cutStartPTS) > 0) || diff --git a/mythtv/programs/mythtranscode/mpeg2fix.h b/mythtv/programs/mythtranscode/mpeg2fix.h index 41f9731d48e..42cdefb525a 100644 --- a/mythtv/programs/mythtranscode/mpeg2fix.h +++ b/mythtv/programs/mythtranscode/mpeg2fix.h @@ -220,6 +220,10 @@ class MPEG2fixup { return inputFC->streams[id]->codec; } + AVCodecParserContext *getCodecParserContext(int id) + { + return inputFC->streams[id]->parser; + } void dumpList(FrameList *list);