diff options
author | James Almer <jamrial@gmail.com> | 2016-11-22 15:50:28 -0500 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-11-23 10:37:46 -0500 |
commit | 12ab667e219e7fbf8e9aef3731039b75c822df25 (patch) | |
tree | 0119dbe4e7162421dc87657089646cf9beee1d98 | |
parent | 1893495e1d023365b4aa24e5e1bd1b24ad5d34fd (diff) | |
download | ffmpeg-12ab667e219e7fbf8e9aef3731039b75c822df25.tar.gz |
matroska: use av_stream_add_side_data() for stereo3d side data
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
-rw-r--r-- | libavformat/matroska.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 8842d7c464..a8f5e981b5 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -115,26 +115,13 @@ const AVMetadataConv ff_mkv_metadata_conv[] = { 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: @@ -172,5 +159,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 ret; + } + return 0; } |