From 0444aa33747e0f8c2a59d682668b4b41b7ac23e3 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 20 May 2009 16:46:49 +0200 Subject: mpegvideoparse: Detect interlaced content and set it on outgoing caps. I also added the parsing of all the other bits in the sequence extension header in case we need it later. --- gst/mpegvideoparse/mpegpacketiser.c | 7 +++++++ gst/mpegvideoparse/mpegpacketiser.h | 2 ++ gst/mpegvideoparse/mpegvideoparse.c | 1 + 3 files changed, 10 insertions(+) (limited to 'gst/mpegvideoparse') diff --git a/gst/mpegvideoparse/mpegpacketiser.c b/gst/mpegvideoparse/mpegpacketiser.c index 447c50ae..0312680e 100644 --- a/gst/mpegvideoparse/mpegpacketiser.c +++ b/gst/mpegvideoparse/mpegpacketiser.c @@ -498,6 +498,9 @@ mpeg_util_parse_extension_packet (MPEGSeqHdr * hdr, guint8 * data, guint8 * end) case MPEG_PACKET_EXT_SEQUENCE: { /* Parse a Sequence Extension */ + guint8 profile_level; + gboolean low_delay; + guint8 chroma_format; guint8 horiz_size_ext, vert_size_ext; guint8 fps_n_ext, fps_d_ext; @@ -505,8 +508,12 @@ mpeg_util_parse_extension_packet (MPEGSeqHdr * hdr, guint8 * data, guint8 * end) /* need at least 10 bytes, minus 4 for the start code 000001b5 */ return FALSE; + profile_level = ((data[0] << 4) & 0xf0) | ((data[1]) >> 4); + hdr->progressive = data[1] & 0x08; + chroma_format = (data[1] >> 2) & 0x03; horiz_size_ext = ((data[1] << 1) & 0x02) | ((data[2] >> 7) & 0x01); vert_size_ext = (data[2] >> 5) & 0x03; + low_delay = data[5] >> 7; fps_n_ext = (data[5] >> 5) & 0x03; fps_d_ext = data[5] & 0x1f; diff --git a/gst/mpegvideoparse/mpegpacketiser.h b/gst/mpegvideoparse/mpegpacketiser.h index 426b13aa..549ca621 100644 --- a/gst/mpegvideoparse/mpegpacketiser.h +++ b/gst/mpegvideoparse/mpegpacketiser.h @@ -76,6 +76,8 @@ struct MPEGSeqHdr gint width, height; /* Framerate */ gint fps_n, fps_d; + + gboolean progressive; }; struct MPEGPictureHdr diff --git a/gst/mpegvideoparse/mpegvideoparse.c b/gst/mpegvideoparse/mpegvideoparse.c index 3c930179..2a7f9153 100644 --- a/gst/mpegvideoparse/mpegvideoparse.c +++ b/gst/mpegvideoparse/mpegvideoparse.c @@ -261,6 +261,7 @@ mpegvideoparse_handle_sequence (MpegVideoParse * mpegvideoparse, "height", G_TYPE_INT, new_hdr.height, "framerate", GST_TYPE_FRACTION, new_hdr.fps_n, new_hdr.fps_d, "pixel-aspect-ratio", GST_TYPE_FRACTION, new_hdr.par_w, new_hdr.par_h, + "interlaced", G_TYPE_BOOLEAN, !new_hdr.progressive, "codec_data", GST_TYPE_BUFFER, seq_buf, NULL); GST_DEBUG ("New mpegvideoparse caps: %" GST_PTR_FORMAT, caps); -- cgit v1.2.1