Skip to content

Commit

Permalink
update mythtranscode to work with ac3 with newer ffmpeg
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dekarl committed Apr 22, 2013
1 parent 86c2376 commit a9b9065
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mythtv/programs/mythtranscode/mpeg2fix.cpp
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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) ||
Expand Down
4 changes: 4 additions & 0 deletions mythtv/programs/mythtranscode/mpeg2fix.h
Expand Up @@ -220,6 +220,10 @@ class MPEG2fixup
{
return inputFC->streams[id]->codec;
}
AVCodecParserContext *getCodecParserContext(int id)
{
return inputFC->streams[id]->parser;
}

void dumpList(FrameList *list);

Expand Down

0 comments on commit a9b9065

Please sign in to comment.