[FFmpeg-devel] [PATCH 3/3] avformat/matroska: use av_stream_add_side_data() for stereo3d side data

Michael Niedermayer michael at niedermayer.cc
Sat Nov 19 12:35:57 EET 2016


On Thu, Nov 17, 2016 at 02:41:15AM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavformat/matroska.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/libavformat/matroska.c b/libavformat/matroska.c
> index c592fb0..7a3d233 100644
> --- a/libavformat/matroska.c
> +++ b/libavformat/matroska.c
> @@ -150,26 +150,13 @@ const char * const ff_matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_PLANE_CO
>  
>  int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode)
>  {
> -    AVPacketSideData *sd, *tmp;
>      AVStereo3D *stereo;
> +    int ret;
>  
>      stereo = av_stereo3d_alloc();
>      if (!stereo)
>          return AVERROR(ENOMEM);
>  
> -    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));
> -    if (!tmp) {
> -        av_freep(&stereo);
> -        return AVERROR(ENOMEM);
> -    }
> -    st->side_data = tmp;
> -    st->nb_side_data++;
> -
> -    sd = &st->side_data[st->nb_side_data - 1];
> -    sd->type = AV_PKT_DATA_STEREO3D;
> -    sd->data = (uint8_t *)stereo;
> -    sd->size = sizeof(*stereo);
> -
>      // note: the missing breaks are intentional
>      switch (stereo_mode) {
>      case MATROSKA_VIDEO_STEREOMODE_TYPE_MONO:
> @@ -207,5 +194,12 @@ int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode)
>          break;
>      }
>  
> +    ret = av_stream_add_side_data(st, AV_PKT_DATA_STEREO3D, (uint8_t *)stereo,
> +                                  sizeof(*stereo));
> +    if (ret < 0) {
> +        av_freep(&stereo);
> +        return AVERROR(ENOMEM);

this probably was intended to be return ret; too


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

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161119/d924bf39/attachment.sig>


More information about the ffmpeg-devel mailing list