[mythtv] libavformat doesn't handle multi-audio PS stream correctly

Geoffrey Hausheer mythtv0368 at phracturedblue.com
Wed Oct 4 03:25:42 UTC 2006


I've been looking at a ticket about mythtranscode dropping audio
streams when transcoding (input is TS 1 video+2 audio, output is
reported as 1video+1audio even though all the streams are present).
Looking at it, it appears to be a problem with libavformat parsing PS
streams.
It appears that as soon as av_find_stream_info locates 1 video and 1
audio, it exits.  I would have expected it to be gated by either the
availability of a PSM (program stream map) which is similar to the PMT
in a TS stream (which the transcoder doesn't generate, but I have code
to do so), or by the sum of the audio_bound + video_bound values from
the system header (which are set correctly by the transocder already).
 Fixing this would seem to require quite a bit of surgery to mpeg.c,
or by forcing a read of a minimum set of frames in
av_find_stream_info.

This is the piece of code that seems to be causing the issue:
            if (!(ic->ctx_flags & AVFMTCTX_NOHEADER) ||
                (read_size >= MAX_READ_SIZE || read_packets >= MAX_FRAMES) ||
                (hasvideo && hasaudio)) {
specifically that last part (hasvideo && hasaudio)

Is this code myth specific?  I don't see it in other libavformat repositories.


More information about the mythtv-dev mailing list