Commit ff1264aa authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/matroskaenc: Use av_stream_get_side_data() instead of loop

in mkv_write_stereo_mode(). Also check the size of the AVStereo3D
side data.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent b921d4d0
...@@ -1029,6 +1029,8 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb, ...@@ -1029,6 +1029,8 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
int ret = 0; int ret = 0;
const AVDictionaryEntry *tag; const AVDictionaryEntry *tag;
MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB; MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB;
const AVStereo3D *stereo;
int side_data_size = 0;
*h_width = 1; *h_width = 1;
*h_height = 1; *h_height = 1;
...@@ -1051,12 +1053,9 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb, ...@@ -1051,12 +1053,9 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
} }
} }
// iterate to find the stereo3d side data stereo = (const AVStereo3D*)av_stream_get_side_data(st, AV_PKT_DATA_STEREO3D,
for (i = 0; i < st->nb_side_data; i++) { &side_data_size);
AVPacketSideData sd = st->side_data[i]; if (side_data_size >= sizeof(AVStereo3D)) {
if (sd.type == AV_PKT_DATA_STEREO3D) {
AVStereo3D *stereo = (AVStereo3D *)sd.data;
switch (stereo->type) { switch (stereo->type) {
case AV_STEREO3D_2D: case AV_STEREO3D_2D:
format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO; format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO;
...@@ -1096,8 +1095,6 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb, ...@@ -1096,8 +1095,6 @@ static int mkv_write_stereo_mode(AVFormatContext *s, AVIOContext *pb,
format++; format++;
break; break;
} }
break;
}
} }
if (format == MATROSKA_VIDEO_STEREOMODE_TYPE_NB) if (format == MATROSKA_VIDEO_STEREOMODE_TYPE_NB)
......
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