[FFmpeg-devel] [PATCH] doc/examples/extract_mvs: switch to codecpar

Matthieu Bouron matthieu.bouron at gmail.com
Tue Mar 28 13:53:48 EEST 2017


On Tue, Mar 28, 2017 at 1:48 PM, Matthieu Bouron <matthieu.bouron at gmail.com>
wrote:

> ---
>  doc/examples/extract_mvs.c | 33 ++++++++++++++++++++++-----------
>  1 file changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
> index 975189c77d..09c3d32389 100644
> --- a/doc/examples/extract_mvs.c
> +++ b/doc/examples/extract_mvs.c
> @@ -69,8 +69,7 @@ static int decode_packet(int *got_frame, int cached)
>      return decoded;
>  }
>
> -static int open_codec_context(int *stream_idx,
> -                              AVFormatContext *fmt_ctx, enum AVMediaType
> type)
> +static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType
> type)
>  {
>      int ret;
>      AVStream *st;
> @@ -84,18 +83,29 @@ static int open_codec_context(int *stream_idx,
>                  av_get_media_type_string(type), src_filename);
>          return ret;
>      } else {
> -        *stream_idx = ret;
> -        st = fmt_ctx->streams[*stream_idx];
> +        int stream_idx = ret;
> +        st = fmt_ctx->streams[stream_idx];
>
>          /* find decoder for the stream */
> -        dec_ctx = st->codec;
> -        dec = avcodec_find_decoder(dec_ctx->codec_id);
> +        dec = avcodec_find_decoder(st->codecpar->codec_id);
>

avcodec_find_decoder call removed locally and replaced by the codec
returned by avformat_find_best_stream.

[...]


More information about the ffmpeg-devel mailing list