[FFmpeg-devel] [PATCH] avformat/mpegts: recognizes and export private streams

Wolfgang Lorenz wl-chmw at gmx.de
Thu Jun 11 22:59:23 CEST 2015


Hi Micheal,

Am Wed, 10 Jun 2015 23:40:10 +0200
schrieb Michael Niedermayer <michaelni at gmx.at>:

> Based on patch by Wolfgang Lorenz <wl-chmw at gmx.de>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/mpegts.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index eff6819..7b35d7f 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -835,6 +835,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
>          st->codec->codec_id  = old_codec_id;
>          st->codec->codec_type = old_codec_type;
>      }
> +    if ((st->codec->codec_id == AV_CODEC_ID_NONE || st->request_probe == 1) &&
> +        !avcodec_is_open(st->codec) &&
> +        stream_type ==  6) {
> +        st->codec->codec_type = AVMEDIA_TYPE_DATA;
> +        st->codec->codec_id   = AV_CODEC_ID_BIN_DATA;
> +        st->request_probe = 1;
> +    }
>  
>      return 0;
>  }

First things first: It's breaking fate-acodec-s302m for me.

===Excerpt from tests/data/fate/acodec-s302m.err===
Input #0, mpegts, from '/home/wolfgang/noBackup/sources/ffmpeg-git/tests/data/fate/acodec-s302m.mpegts':
  Duration: 00:00:05.99, start: 1.400000, bitrate: 2122 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Audio: aac (SSR) (BSSD / 0x44535342), stereo, fltp, 2 kb/s
===End of excerpt===

Now to my test case: Yes, this is working – kind of... For me... If I
test for the data streams, after opening the input file and before
finding the stream info, and set request_probe to 0,
avformat_find_stream_info() wont overwrite the codec type and id:

    avformat_open_input(&formatContext,
                        fileName,
                        NULL,
                        &dict);
    
    for(s = 0; s < formatContext->nb_streams; ++s)
    {
        if(formatContext->streams[s]->codec->codec_type == AVMEDIA_TYPE_DATA &&
           formatContext->streams[s]->codec->codec_id == AV_CODEC_ID_BIN_DATA)
        {
            formatContext->streams[s]->request_probe = 0;
        }
    }
    
    avformat_find_stream_info(formatContext,
                              NULL);

If I don't do this, everything behaves like before: During the
avformat_find_stream_info() call some audio codec is chosen, a lot of
warning messages are written out and the packages are not given back,
as they were put in. I'm not sure, that this is what you intended.

If in your patch the request_probe value is set to a higher value, like
e.g. 10, avformat_find_stream_info() behaves nicely and I do not need
to reset the value manually. fate-acodec-s302m is still broken, though.


Greetings,
  Wolfgang

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150611/7474e52f/attachment.asc>


More information about the ffmpeg-devel mailing list