[vlc-devel] [PATCH 07/14] h264: parse 3D stereo information from frame_packing_arrangement SEI message
Felix Abecassis
felix.abecassis at gmail.com
Tue Sep 9 19:08:26 CEST 2014
---
modules/packetizer/h264.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index c029171..4a5c774 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -151,7 +151,8 @@ enum nal_unit_type_e
enum sei_type_e
{
SEI_USER_DATA_REGISTERED = 4,
- SEI_RECOVERY_POINT = 6
+ SEI_RECOVERY_POINT = 6,
+ SEI_FRAME_PACKING = 45
};
#define BLOCK_FLAG_PRIVATE_AUD (1 << BLOCK_FLAG_PRIVATE_SHIFT)
@@ -1175,6 +1176,54 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag )
}
}
+ /* Frame packing arrangement */
+ if( i_type == SEI_FRAME_PACKING )
+ {
+ const int i_packing = i_size;
+ const uint8_t *p_packing = &pb_dec[i_used];
+
+ bs_t s;
+ bs_init( &s, p_packing, i_packing );
+ bs_read_ue( &s ); /* frame_packing_arrangement_id */
+ if( !bs_read( &s, 1 ) ) /* frame_packing_arrangement_cancel_flag */
+ {
+ int frame_packing_arrangement_type = bs_read( &s, 7 );
+ bs_read( &s, 1 ); /* quincunx_sampling_flag */
+ int content_interpretation_type = bs_read( &s, 6 );
+
+ stereo3d_format_t stereo = { 0 };
+ switch( frame_packing_arrangement_type )
+ {
+ case 0:
+ stereo.mode = VLC_STEREO3D_CHECKERBOARD;
+ break;
+ case 1:
+ stereo.mode = VLC_STEREO3D_COL;
+ break;
+ case 2:
+ stereo.mode = VLC_STEREO3D_ROW;
+ break;
+ case 3:
+ stereo.mode = VLC_STEREO3D_SBS;
+ break;
+ case 4:
+ stereo.mode = VLC_STEREO3D_TB;
+ break;
+ case 5:
+ stereo.mode = VLC_STEREO3D_FRAME;
+ break;
+ case 6:
+ stereo.mode = VLC_STEREO3D_2D;
+ break;
+ }
+
+ if( content_interpretation_type == 2 )
+ stereo.flags = VLC_STEREO3D_SWAP_EYES;
+
+ p_dec->fmt_out.video.stereo = stereo;
+ }
+ }
+
i_used += i_size;
}
--
1.9.1
More information about the vlc-devel
mailing list