[FFmpeg-devel] [PATCH 3/5] avformat/utils: Use coded_side_data

Michael Niedermayer michael at niedermayer.cc
Tue Dec 17 23:34:18 EET 2019


On Mon, Dec 16, 2019 at 06:39:20PM +0100, Nicolas Gaullier wrote:
> Make find_stream_info get side data from the codec context.
> ---
>  fftools/ffmpeg.c       | 16 +++-------------
>  libavformat/avformat.h | 11 +++++++++++
>  libavformat/utils.c    | 18 ++++++++++++++++++
>  3 files changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 9af2bc2fb5..232c8f5fd8 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -3537,19 +3537,9 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
>          if (ret < 0)
>              return ret;
>  
> -        if (ost->enc_ctx->nb_coded_side_data) {
> -            int i;
> -
> -            for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
> -                const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i];
> -                uint8_t *dst_data;
> -
> -                dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size);
> -                if (!dst_data)
> -                    return AVERROR(ENOMEM);
> -                memcpy(dst_data, sd_src->data, sd_src->size);
> -            }
> -        }
> +        ret = av_stream_add_coded_side_data(ost->st, ost->enc_ctx);
> +        if (ret < 0)
> +            return ret;
>  
>          /*
>           * Add global input side data. For now this is naive, and copies it
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index d4d9a3b06e..8e0d0df55e 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -2191,6 +2191,17 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
>   */
>  uint8_t *av_stream_new_side_data(AVStream *stream,
>                                   enum AVPacketSideDataType type, int size);
> +
> +/**
> ++ * Add stream side_data from the coded_side_data of the supplied context.
> ++ *
> ++ * @param stream stream
> ++ * @param avctx the codec context that may contain coded_side_data
> ++ * @return >= 0 in case of success, a negative AVERROR code in case of
> ++ * failure
> ++ */
> +int av_stream_add_coded_side_data(AVStream *stream, AVCodecContext *avctx);

iam thinking this has more "+" than i expect  to see but more important
adding public API needs updates to APIchanges and minor version bump

also changes to the tool and lib used by the tool should be in seperate
patches

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191217/d744025b/attachment.sig>


More information about the ffmpeg-devel mailing list