h264parse: Start PPS parsing work

This commit is contained in:
Lin YANG 2009-08-17 17:42:06 +08:00 committed by Sebastian Dröge
parent 196b8240e2
commit 397abd5741
2 changed files with 33 additions and 0 deletions

View file

@ -246,6 +246,12 @@ struct _GstH264Sps
gboolean pic_struct_present_flag;
/* And more... */
};
/* PPS: pic parameter sets */
struct _GstH264Pps
{
guint8 pps_id;
guint8 sps_id;
};
static GstH264Sps *
gst_h264_parse_get_sps (GstH264Parse * h, guint8 sps_id)
@ -269,6 +275,28 @@ gst_h264_parse_get_sps (GstH264Parse * h, guint8 sps_id)
h->sps = h->sps_buffers[sps_id] = sps;
return sps;
}
static GstH264Pps *
gst_h264_parse_get_pps (GstH264Parse * h, guint8 pps_id)
{
GstH264Pps *pps;
g_return_val_if_fail (h != NULL, NULL);
if (pps_id >= MAX_PPS_COUNT) {
GST_DEBUG_OBJECT (h, "requested pps_id=%04x out of range", pps_id);
return NULL;
}
pps = h->pps_buffers[pps_id];
if (pps == NULL) {
GST_DEBUG_OBJECT (h, "Creating pps with pps_id=%04x", pps_id);
pps = g_slice_new0 (GstH264Pps);
if (pps == NULL) {
GST_DEBUG_OBJECT (h, "Failed!");
}
}
h->pps = h->pps_buffers[pps_id] = pps;
return pps;
}
GST_BOILERPLATE (GstH264Parse, gst_h264_parse, GstElement, GST_TYPE_ELEMENT);

View file

@ -45,8 +45,10 @@ typedef struct _GstH264ParseClass GstH264ParseClass;
typedef struct _GstNalList GstNalList;
typedef struct _GstH264Sps GstH264Sps;
typedef struct _GstH264Pps GstH264Pps;
#define MAX_SPS_COUNT 32
#define MAX_PPS_COUNT 32
struct _GstH264Parse
{
GstElement element;
@ -75,6 +77,9 @@ struct _GstH264Parse
/* SPS: sequential parameter set */
GstH264Sps *sps_buffers[MAX_SPS_COUNT];
GstH264Sps *sps; /* Current SPS */
/* PPS: sequential parameter set */
GstH264Pps *pps_buffers[MAX_PPS_COUNT];
GstH264Pps *pps; /* Current PPS */
};
struct _GstH264ParseClass