summaryrefslogtreecommitdiffstats
path: root/gst/mpegvideoparse
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-05-20 16:46:49 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-05-22 17:19:26 +0200
commit0444aa33747e0f8c2a59d682668b4b41b7ac23e3 (patch)
tree91d86645651cf7f71190516d4c1a1821745ed8b9 /gst/mpegvideoparse
parente8423da78eea949f8223da5c27ea36544a3a6c5b (diff)
downloadgst-plugins-bad-0444aa33747e0f8c2a59d682668b4b41b7ac23e3.tar.gz
gst-plugins-bad-0444aa33747e0f8c2a59d682668b4b41b7ac23e3.tar.bz2
gst-plugins-bad-0444aa33747e0f8c2a59d682668b4b41b7ac23e3.zip
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.
Diffstat (limited to 'gst/mpegvideoparse')
-rw-r--r--gst/mpegvideoparse/mpegpacketiser.c7
-rw-r--r--gst/mpegvideoparse/mpegpacketiser.h2
-rw-r--r--gst/mpegvideoparse/mpegvideoparse.c1
3 files changed, 10 insertions, 0 deletions
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);