On Tue, Mar 15, 2016 at 08:36:41AM -0500, Rodger Combs wrote:
> This allows avformat_find_stream_info to finish without opening a decoder in
> more cases.
> 
> Since decoders still export some information that the corresponding parsers
> don't, this causes some fields to be unset in ffprobe output where the
> decoder would previously have only been called in avformat_find_stream_info.
> If this is a problem, the parsers should be updated to report that information
> as well.
> ---
>  libavcodec/parser.c                                | 12 +++++++
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf    |  2 +-
>  .../ref/fate/concat-demuxer-extended-lavf-mxf_d10  |  2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf     |  2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 |  2 +-
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts      |  2 +-
>  tests/ref/seek/vsynth_lena-mpeg1                   | 38 
> +++++++++++-----------
>  7 files changed, 36 insertions(+), 24 deletions(-)
> 
> diff --git a/libavcodec/parser.c b/libavcodec/parser.c
> index d25d261..34b2c86 100644
> --- a/libavcodec/parser.c
> +++ b/libavcodec/parser.c
> @@ -180,6 +180,18 @@ int av_parser_parse2(AVCodecParserContext *s, 
> AVCodecContext *avctx,
>      index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
>                                      poutbuf_size, buf, buf_size);
>      av_assert0(index > -0x20000000); // The API does not allow returning 
> AVERROR codes
> +#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
> +    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> +        FILL(coded_width);
> +        FILL(coded_height);
> +        FILL(width);
> +        FILL(height);
> +        if (s->format >= 0 && avctx->pix_fmt < 0)
> +            avctx->pix_fmt = s->format;
> +    } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
> +        if (s->format >= 0 && avctx->sample_fmt < 0)
> +            avctx->sample_fmt = s->format;
> +    }
>      /* update the file pointer */
>      if (*poutbuf_size) {
>          /* fill the data for the current frame */
[...]
> --- a/tests/ref/seek/vsynth_lena-mpeg1
> +++ b/tests/ref/seek/vsynth_lena-mpeg1
> @@ -1,46 +1,46 @@
>  ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  
> 9779
>  ret: 0         st:-1 flags:0  ts:-1.000000
> -ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  
> 9779
> +ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  
> 9779
>  ret: 0         st:-1 flags:1  ts: 1.894167
> -ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 124255 size: 
> 11796
> +ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 124255 size: 
> 11796
>  ret: 0         st: 0 flags:0  ts: 0.788334
> -ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  76706 size: 
> 10792
> +ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  76706 size: 
> 10792

i suspect these pts values are wrong mpeg1/2 generally has dts != pts
the parsers have to initialize at least the timestamp / timebase /
delay related stuff

in case of b frames this will result in timestamps being out of
order before the libavformat core realizes it got a wrong values
from the parser/decoder


[...]
0,          0,          0,    48000,     9779, 0xf74ad5eb
0,      48000,      48000,    48000,     2676, 0x0ba8d970, F=0x0
0,      96000,      96000,    48000,     1098, 0x0a75192d, F=0x0
0,     144000, -9223372036854775808,    48000,     2920, 0xecf9526c, F=0x0
0,     192000,     192000,    48000,     1375, 0x65a69783, F=0x0
0,     240000, -9223372036854775808,    48000,     2952, 0x1110633b, F=0x0



-
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to