[vlc-devel] [PATCH 08/14] avformat: retrieve container-level 3D stereo format if available
Felix Abecassis
felix.abecassis at gmail.com
Tue Sep 9 19:08:27 CEST 2014
---
modules/demux/avformat/demux.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index e424fbd..0bbd0e3 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -46,6 +46,7 @@
#include "../vobsub.h"
#include <libavformat/avformat.h>
+#include <libavutil/stereo3d.h>
#if ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 53, 15, 0) ) || \
(LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 52, 85, 100 ) ) )
@@ -153,6 +154,45 @@ static void get_rotation(es_format_t *fmt, AVStream *s)
#endif
}
+static void get_stereo3d(es_format_t *fmt, AVStream *s)
+{
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 56, 1, 0 )
+ AVStereo3D *stereo = (AVStereo3D *)av_stream_get_side_data(s, AV_PKT_DATA_STEREO3D, NULL);
+ if (!stereo)
+ return;
+
+ vlc_stereo3d_mode stereo_mode;
+ switch( stereo->type )
+ {
+ case AV_STEREO3D_SIDEBYSIDE:
+ stereo_mode = VLC_STEREO3D_SBS;
+ break;
+ case AV_STEREO3D_TOPBOTTOM:
+ stereo_mode = VLC_STEREO3D_TB;
+ break;
+ case AV_STEREO3D_FRAMESEQUENCE:
+ stereo_mode = VLC_STEREO3D_FRAME;
+ break;
+ case AV_STEREO3D_CHECKERBOARD:
+ stereo_mode = VLC_STEREO3D_CHECKERBOARD;
+ break;
+ case AV_STEREO3D_LINES:
+ stereo_mode = VLC_STEREO3D_ROW;
+ break;
+ case AV_STEREO3D_COLUMNS:
+ stereo_mode = VLC_STEREO3D_COL;
+ break;
+ default:
+ stereo_mode = VLC_STEREO3D_2D;
+ break;
+ }
+ fmt->video.stereo.mode = stereo_mode;
+
+ if( stereo->flags & AV_STEREO3D_FLAG_INVERT )
+ fmt->video.stereo.flags = VLC_STEREO3D_SWAP_EYES;
+#endif
+}
+
int OpenDemux( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
@@ -387,6 +427,7 @@ int OpenDemux( vlc_object_t *p_this )
fmt.video.i_height = cc->height;
get_rotation(&fmt, s);
+ get_stereo3d(&fmt, s);
#if LIBAVCODEC_VERSION_MAJOR < 54
if( cc->palctrl )
--
1.9.1
More information about the vlc-devel
mailing list