Commit 12ab667e authored by James Almer's avatar James Almer Committed by Vittorio Giovara

matroska: use av_stream_add_side_data() for stereo3d side data

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 1893495e
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment