[vlc-devel] [PATCH 05/14] avcodec: retrieve decoded 3D stereo format if available
Vittorio Giovara
vittorio.giovara at gmail.com
Wed Sep 10 13:18:17 CEST 2014
On Tue, Sep 9, 2014 at 6:08 PM, Felix Abecassis
<felix.abecassis at gmail.com> wrote:
> ---
> modules/codec/avcodec/video.c | 44 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index d20276b..88fed49 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -727,6 +729,48 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
> }
> }
>
> + /* Forward the 3D stereo format in case it changed (e.g. modified by the packetizer) */
> + if( p_dec->fmt_in.video.stereo.mode )
> + p_dec->fmt_out.video.stereo = p_dec->fmt_in.video.stereo;
> +
> +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 52, 20, 0 )
> + AVFrameSideData *side_data = av_frame_get_side_data( p_sys->p_ff_pic, AV_FRAME_DATA_STEREO3D );
> + if( side_data )
> + {
> + AVStereo3D *stereo = (AVStereo3D*)side_data->data;
> + vlc_stereo3d_mode stereo_mode;
> + switch( stereo->type )
> + {
> + case AV_STEREO3D_SIDEBYSIDE_QUINCUNX:
> + case AV_STEREO3D_SIDEBYSIDE:
Nope, despite having a similar name, they are two completely different
formats. Mixing them is definitely not advised.
> + 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;
I am still not sure about this, you mark any unknown/unsupported 3d
mode as 2d, but on the other hand there are not a lot of other 3d
modes around. Maybe just print a warning? Thoughts?
> + break;
> + }
> + p_dec->fmt_out.video.stereo.mode = stereo_mode;
> +
> + if( stereo->flags & AV_STEREO3D_FLAG_INVERT )
> + p_dec->fmt_out.video.stereo.flags = VLC_STEREO3D_SWAP_EYES;
> + }
> +#endif
> +
> /* Send decoded frame to vout */
> if( i_pts > VLC_TS_INVALID)
> {
--
Vittorio
More information about the vlc-devel
mailing list