From e1cfd384d64088724643c2094ee52603c1832f8f Mon Sep 17 00:00:00 2001 From: Lin YANG Date: Mon, 17 Aug 2009 17:43:51 +0800 Subject: [PATCH] h264parse: Start SEI parsing work --- gst/h264parse/gsth264parse.c | 29 +++++++++++++++++++++++++++++ gst/h264parse/gsth264parse.h | 10 ++++++++++ 2 files changed, 39 insertions(+) diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index 3fbd44ebd1..cd3f8e7687 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -210,6 +210,35 @@ gst_nal_bs_read_ue (GstNalBs * bs) return ((1 << i) - 1 + gst_nal_bs_read (bs, i)); } +/* SEI type */ +typedef enum +{ + SEI_BUF_PERIOD = 0, + SEI_PIC_TIMING = 1 + /* and more... */ +} GstSeiPayloadType; + +/* SEI pic_struct type */ +typedef enum +{ + SEI_PIC_STRUCT_FRAME = 0, /* 0: %frame */ + SEI_PIC_STRUCT_TOP_FIELD = 1, /* 1: top field */ + SEI_PIC_STRUCT_BOTTOM_FIELD = 2, /* 2: bottom field */ + SEI_PIC_STRUCT_TOP_BOTTOM = 3, /* 3: top field, bottom field, in that order */ + SEI_PIC_STRUCT_BOTTOM_TOP = 4, /* 4: bottom field, top field, in that order */ + SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, /* 5: top field, bottom field, top field repeated, in that order */ + SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, /* 6: bottom field, top field, bottom field repeated, in that order */ + SEI_PIC_STRUCT_FRAME_DOUBLING = 7, /* 7: %frame doubling */ + SEI_PIC_STRUCT_FRAME_TRIPLING = 8 /* 8: %frame tripling */ +} GstSeiPicStructType; + +/* pic_struct to NumClockTS lookup table */ +static const guint8 sei_num_clock_ts_table[9] = { + 1, 1, 1, 2, 2, 3, 3, 2, 3 +}; + +#define Extended_SAR 255 + /* SPS: sequential parameter sets */ struct _GstH264Sps { diff --git a/gst/h264parse/gsth264parse.h b/gst/h264parse/gsth264parse.h index 6aea198cae..8e07a0e66e 100644 --- a/gst/h264parse/gsth264parse.h +++ b/gst/h264parse/gsth264parse.h @@ -80,6 +80,16 @@ struct _GstH264Parse /* PPS: sequential parameter set */ GstH264Pps *pps_buffers[MAX_PPS_COUNT]; GstH264Pps *pps; /* Current PPS */ + + /* SEI: supplemental enhancement messages */ + /* buffering period */ + guint32 initial_cpb_removal_delay[32]; + /* picture timing */ + guint32 sei_cpb_removal_delay; + guint32 sei_dpb_output_delay; + guint8 sei_pic_struct; + guint8 sei_ct_type; + /* And more... */ }; struct _GstH264ParseClass