codecparsers: h264: add support for Stereo Video Information SEI message.

Add the necessary payload parsing support for stereo_video_info.

https://bugzilla.gnome.org/show_bug.cgi?id=685215

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
This commit is contained in:
Sreerenj Balachandran 2013-03-08 18:17:16 +02:00 committed by Jan Schmidt
parent 8911a80662
commit 51f003e469
3 changed files with 47 additions and 0 deletions

View file

@ -1052,6 +1052,30 @@ error:
return GST_H264_PARSER_ERROR;
}
/* Parse SEI stereo_video_info() message */
static GstH264ParserResult
gst_h264_parser_parse_stereo_video_info (GstH264NalParser * nalparser,
GstH264StereoVideoInfo * info, NalReader * nr)
{
GST_DEBUG ("parsing \"Stereo Video info\"");
READ_UINT8 (nr, info->field_views_flag, 1);
if (info->field_views_flag) {
READ_UINT8 (nr, info->top_field_is_left_view_flag, 1);
} else {
READ_UINT8 (nr, info->current_frame_is_left_view_flag, 1);
READ_UINT8 (nr, info->next_frame_is_second_view_flag, 1);
}
READ_UINT8 (nr, info->left_view_self_contained_flag, 1);
READ_UINT8 (nr, info->right_view_self_contained_flag, 1);
return GST_H264_PARSER_OK;
error:
GST_WARNING ("error parsing \"Stereo Video info\"");
return GST_H264_PARSER_ERROR;
}
static GstH264ParserResult
gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
NalReader * nr, GstH264SEIMessage * sei)
@ -1097,6 +1121,10 @@ gst_h264_parser_parse_sei_message (GstH264NalParser * nalparser,
res = gst_h264_parser_parse_recovery_point (nalparser,
&sei->payload.recovery_point, nr);
break;
case GST_H264_SEI_STEREO_VIDEO_INFO:
res = gst_h264_parser_parse_stereo_video_info (nalparser,
&sei->payload.stereo_video_info, nr);
break;
default:
/* Just consume payloadSize bytes, which does not account for
emulation prevention bytes */

View file

@ -184,6 +184,7 @@ typedef enum
GST_H264_SEI_BUF_PERIOD = 0,
GST_H264_SEI_PIC_TIMING = 1,
GST_H264_SEI_RECOVERY_POINT = 6,
GST_H264_SEI_STEREO_VIDEO_INFO = 21
/* and more... */
} GstH264SEIPayloadType;
@ -261,6 +262,7 @@ typedef struct _GstH264ClockTimestamp GstH264ClockTimestamp;
typedef struct _GstH264PicTiming GstH264PicTiming;
typedef struct _GstH264BufferingPeriod GstH264BufferingPeriod;
typedef struct _GstH264RecoveryPoint GstH264RecoveryPoint;
typedef struct _GstH264StereoVideoInfo GstH264StereoVideoInfo;
typedef struct _GstH264SEIMessage GstH264SEIMessage;
/**
@ -842,6 +844,16 @@ struct _GstH264ClockTimestamp
guint32 time_offset;
};
struct _GstH264StereoVideoInfo
{
guint8 field_views_flag;
guint8 top_field_is_left_view_flag;
guint8 current_frame_is_left_view_flag;
guint8 next_frame_is_second_view_flag;
guint8 left_view_self_contained_flag;
guint8 right_view_self_contained_flag;
};
struct _GstH264PicTiming
{
guint32 cpb_removal_delay;
@ -884,6 +896,7 @@ struct _GstH264SEIMessage
GstH264BufferingPeriod buffering_period;
GstH264PicTiming pic_timing;
GstH264RecoveryPoint recovery_point;
GstH264StereoVideoInfo stereo_video_info;
/* ... could implement more */
} payload;
};

View file

@ -528,6 +528,12 @@ gst_h264_parse_process_sei (GstH264Parse * h264parse, GstH264NalUnit * nalu)
sei.payload.recovery_point.broken_link_flag,
sei.payload.recovery_point.changing_slice_group_idc);
break;
/* Additional messages that are not innerly useful to the
* element but for debugging purposes */
case GST_H264_SEI_STEREO_VIDEO_INFO:
GST_LOG_OBJECT (h264parse, "stereo video information message");
break;
}
}
g_array_free (messages, TRUE);