mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
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.
This commit is contained in:
parent
e8423da78e
commit
0444aa3374
3 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ struct MPEGSeqHdr
|
|||
gint width, height;
|
||||
/* Framerate */
|
||||
gint fps_n, fps_d;
|
||||
|
||||
gboolean progressive;
|
||||
};
|
||||
|
||||
struct MPEGPictureHdr
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue