summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin YANG <oxcsnicho@gmail.com>2009-08-17 17:38:59 +0800
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-08-31 09:15:05 +0200
commit196b8240e2226f38e32aea88e06f014c8bff16fb (patch)
treee68be725275a7d872a3f5f9b2c1aeb7253fe317b
parentadb4130e65fab0a34ec9dec7b0484dbf932efc53 (diff)
h264parse: Start SPS parsing work
-rw-r--r--gst/h264parse/gsth264parse.c59
-rw-r--r--gst/h264parse/gsth264parse.h7
2 files changed, 66 insertions, 0 deletions
diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c
index ebc4360d9..86ff0afaf 100644
--- a/gst/h264parse/gsth264parse.c
+++ b/gst/h264parse/gsth264parse.c
@@ -210,6 +210,65 @@ gst_nal_bs_read_ue (GstNalBs * bs)
return ((1 << i) - 1 + gst_nal_bs_read (bs, i));
}
+/* SPS: sequential parameter sets */
+struct _GstH264Sps
+{
+ guint8 profile_idc;
+ guint8 level_idc;
+
+ guint8 sps_id;
+
+ guint8 pic_order_cnt_type;
+
+ guint8 log2_max_frame_num_minus4;
+ gboolean frame_mbs_only_flag;
+ guint8 log2_max_pic_order_cnt_lsb_minus4;
+
+ gboolean frame_cropping_flag;
+
+ /* VUI parameters */
+ gboolean vui_parameters_present_flag;
+
+ gboolean timing_info_present_flag;
+ guint32 num_units_in_tick;
+ guint32 time_scale;
+ gboolean fixed_frame_rate_flag;
+
+ gboolean nal_hrd_parameters_present_flag;
+ gboolean vcl_hrd_parameters_present_flag;
+ /* hrd parameters */
+ guint8 cpb_cnt_minus1;
+ gint initial_cpb_removal_delay_length_minus1; /* initial_cpb_removal_delay_length_minus1 */
+ gint cpb_removal_delay_length_minus1; /* cpb_removal_delay_length_minus1 */
+ gint dpb_output_delay_length_minus1; /* dpb_output_delay_length_minus1 */
+ gboolean time_offset_length_minus1;
+
+ gboolean pic_struct_present_flag;
+ /* And more... */
+};
+
+static GstH264Sps *
+gst_h264_parse_get_sps (GstH264Parse * h, guint8 sps_id)
+{
+ GstH264Sps *sps;
+ g_return_val_if_fail (h != NULL, NULL);
+
+ if (sps_id >= MAX_SPS_COUNT) {
+ GST_DEBUG_OBJECT (h, "requested sps_id=%04x out of range", sps_id);
+ return NULL;
+ }
+ sps = h->sps_buffers[sps_id];
+ if (sps == NULL) {
+ GST_DEBUG_OBJECT (h, "Creating sps with sps_id=%04x", sps_id);
+ sps = h->sps_buffers[sps_id] = g_slice_new0 (GstH264Sps);
+ if (sps == NULL) {
+ GST_DEBUG_OBJECT (h, "Allocation failed!");
+ }
+ }
+
+ h->sps = h->sps_buffers[sps_id] = sps;
+ return sps;
+}
GST_BOILERPLATE (GstH264Parse, gst_h264_parse, GstElement, GST_TYPE_ELEMENT);
diff --git a/gst/h264parse/gsth264parse.h b/gst/h264parse/gsth264parse.h
index 2bae3f8c0..2fcda2370 100644
--- a/gst/h264parse/gsth264parse.h
+++ b/gst/h264parse/gsth264parse.h
@@ -44,6 +44,9 @@ typedef struct _GstH264ParseClass GstH264ParseClass;
typedef struct _GstNalList GstNalList;
+typedef struct _GstH264Sps GstH264Sps;
+
+#define MAX_SPS_COUNT 32
struct _GstH264Parse
{
GstElement element;
@@ -68,6 +71,10 @@ struct _GstH264Parse
gboolean have_i_frame;
GstAdapter *adapter;
+
+ /* SPS: sequential parameter set */
+ GstH264Sps *sps_buffers[MAX_SPS_COUNT];
+ GstH264Sps *sps; /* Current SPS */
};
struct _GstH264ParseClass