diff options
author | Lin YANG <oxcsnicho@gmail.com> | 2009-08-17 17:56:26 +0800 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-08-31 09:15:08 +0200 |
commit | 550f60111cc6fc14c181ab9cde86eb4493bac98a (patch) | |
tree | 004163f5ec7e7c9b5682d93073fdc8e1ec4adc5c /gst/h264parse | |
parent | d0273eec2c8dc5677132c488fe0937e37bf304bf (diff) |
h264parse: parser init & finalize
Diffstat (limited to 'gst/h264parse')
-rw-r--r-- | gst/h264parse/gsth264parse.c | 30 | ||||
-rw-r--r-- | gst/h264parse/gsth264parse.h | 18 |
2 files changed, 48 insertions, 0 deletions
diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index 26e602aa2..d7dcd6b01 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -810,6 +810,7 @@ gst_h264_parse_class_init (GstH264ParseClass * klass) static void gst_h264_parse_init (GstH264Parse * h264parse, GstH264ParseClass * g_class) { + gint i; h264parse->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); gst_pad_set_chain_function (h264parse->sinkpad, GST_DEBUG_FUNCPTR (gst_h264_parse_chain)); @@ -824,17 +825,46 @@ gst_h264_parse_init (GstH264Parse * h264parse, GstH264ParseClass * g_class) h264parse->split_packetized = DEFAULT_SPLIT_PACKETIZED; h264parse->adapter = gst_adapter_new (); + + for (i = 0; i < MAX_SPS_COUNT; i++) + h264parse->sps_buffers[i] = NULL; + h264parse->sps = NULL; + + h264parse->first_mb_in_slice = -1; + h264parse->slice_type = -1; + h264parse->pps_id = -1; + h264parse->frame_num = -1; + h264parse->field_pic_flag = FALSE; + h264parse->bottom_field_flag = FALSE; + + for (i = 0; i < 32; i++) + h264parse->initial_cpb_removal_delay[i] = -1; + h264parse->sei_cpb_removal_delay = 0; + h264parse->sei_dpb_output_delay = 0; + h264parse->sei_pic_struct = -1; + h264parse->sei_ct_type = -1; + + h264parse->dts = GST_CLOCK_TIME_NONE; + h264parse->ts_trn_nb = GST_CLOCK_TIME_NONE; + h264parse->cur_duration = 0; + h264parse->last_outbuf_dts = GST_CLOCK_TIME_NONE; } static void gst_h264_parse_finalize (GObject * object) { GstH264Parse *h264parse; + gint i; h264parse = GST_H264PARSE (object); g_object_unref (h264parse->adapter); + for (i = 0; i < MAX_SPS_COUNT; i++) { + if (h264parse->sps_buffers[i] != NULL) + g_slice_free (GstH264Sps, h264parse->sps_buffers[i]); + } + G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gst/h264parse/gsth264parse.h b/gst/h264parse/gsth264parse.h index 787f5ad75..2958ad1bc 100644 --- a/gst/h264parse/gsth264parse.h +++ b/gst/h264parse/gsth264parse.h @@ -49,6 +49,15 @@ typedef struct _GstH264Pps GstH264Pps; #define MAX_SPS_COUNT 32 #define MAX_PPS_COUNT 32 + +#define CLOCK_BASE 9LL +#define CLOCK_FREQ (CLOCK_BASE * 10000) + +#define MPEGTIME_TO_GSTTIME(time) (gst_util_uint64_scale ((time), \ + GST_MSECOND/10, CLOCK_BASE)) +#define GSTTIME_TO_MPEGTIME(time) (gst_util_uint64_scale ((time), \ + CLOCK_BASE, GST_MSECOND/10)) + struct _GstH264Parse { GstElement element; @@ -98,6 +107,15 @@ struct _GstH264Parse guint8 sei_pic_struct; guint8 sei_ct_type; /* And more... */ + + /* cached timestamps */ + GstClockTime dts; + GstClockTime last_outbuf_dts; + GstClockTime ts_trn_nb; /* dts of last buffering period */ + GstClockTime cur_duration; /* duration of the current access unit */ + + /* for debug purpose */ + guint32 frame_cnt; }; struct _GstH264ParseClass |