From d061c0a0d198db53b609db9711808fc8d7b2d008 Mon Sep 17 00:00:00 2001 From: Lin YANG Date: Mon, 17 Aug 2009 17:52:12 +0800 Subject: [PATCH] h264parse: decode SEI: buffering period --- gst/h264parse/gsth264parse.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index 3eedb7c..3cfb070 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -571,6 +571,51 @@ gst_nal_decode_pps (GstH264Parse * h, GstNalBs * bs) return TRUE; } +/* decode buffering periods */ +static gboolean +gst_sei_decode_buffering_period (GstH264Parse * h, GstNalBs * bs) +{ + guint8 sps_id; + gint sched_sel_idx; + GstH264Sps *sps; + + sps_id = gst_nal_bs_read_ue (bs); + sps = gst_h264_parse_get_sps (h, sps_id); + if (!sps) + return FALSE; + + if (sps->nal_hrd_parameters_present_flag) { + for (sched_sel_idx = 0; sched_sel_idx <= sps->cpb_cnt_minus1; + sched_sel_idx++) { + h->initial_cpb_removal_delay[sched_sel_idx] + = gst_nal_bs_read (bs, + sps->initial_cpb_removal_delay_length_minus1 + 1); + gst_nal_bs_read (bs, sps->initial_cpb_removal_delay_length_minus1 + 1); /* initial_cpb_removal_delay_offset */ + } + } + if (sps->vcl_hrd_parameters_present_flag) { + for (sched_sel_idx = 0; sched_sel_idx <= sps->cpb_cnt_minus1; + sched_sel_idx++) { + h->initial_cpb_removal_delay[sched_sel_idx] + = gst_nal_bs_read (bs, + sps->initial_cpb_removal_delay_length_minus1 + 1); + gst_nal_bs_read (bs, sps->initial_cpb_removal_delay_length_minus1 + 1); /* initial_cpb_removal_delay_offset */ + } + } +#if 0 + h->ts_trn_nb = MPEGTIME_TO_GSTTIME (h->initial_cpb_removal_delay[0]); /* Assuming SchedSelIdx=0 */ +#endif + if (h->ts_trn_nb == GST_CLOCK_TIME_NONE || h->dts == GST_CLOCK_TIME_NONE) + h->ts_trn_nb = 0; + else + h->ts_trn_nb = h->dts; + + GST_DEBUG_OBJECT (h, "h->ts_trn_nb updated: %" GST_TIME_FORMAT, + GST_TIME_ARGS (h->ts_trn_nb)); + + return 0; +} + GST_BOILERPLATE (GstH264Parse, gst_h264_parse, GstElement, GST_TYPE_ELEMENT); -- 2.7.4