diff --git a/gst-libs/gst/codecparsers/gstmpegvideoparser.c b/gst-libs/gst/codecparsers/gstmpegvideoparser.c index 6384105e6f..debafa0942 100644 --- a/gst-libs/gst/codecparsers/gstmpegvideoparser.c +++ b/gst-libs/gst/codecparsers/gstmpegvideoparser.c @@ -408,7 +408,8 @@ gst_mpeg_video_packet_parse_sequence_extension (const GstMpegVideoPacket * } /* skip profile and level escape bit */ - gst_bit_reader_skip_unchecked (&br, 1); + seqext->profile_level_escape_bit = + gst_bit_reader_get_bits_uint8_unchecked (&br, 1); seqext->profile = gst_bit_reader_get_bits_uint8_unchecked (&br, 3); seqext->level = gst_bit_reader_get_bits_uint8_unchecked (&br, 4); diff --git a/gst-libs/gst/codecparsers/gstmpegvideoparser.h b/gst-libs/gst/codecparsers/gstmpegvideoparser.h index 35f7c6fc23..1298ed78f4 100644 --- a/gst-libs/gst/codecparsers/gstmpegvideoparser.h +++ b/gst-libs/gst/codecparsers/gstmpegvideoparser.h @@ -249,6 +249,8 @@ struct _GstMpegVideoSequenceHdr * otherwise * @fps_n_ext: Framerate nominator code * @fps_d_ext: Framerate denominator code + * @profile_level_escape_bit: Escape bit. If set, the meaning of the + * @profile and @level fields is different. * * The Mpeg2 Video Sequence Extension structure. **/ @@ -269,6 +271,8 @@ struct _GstMpegVideoSequenceExt guint8 low_delay; guint8 fps_n_ext, fps_d_ext; + /* Additional information */ + guint8 profile_level_escape_bit; }; /** diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c index 5fa7165bf4..bf71a3e7cf 100644 --- a/gst/videoparsers/gstmpegvideoparse.c +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -815,6 +815,7 @@ gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) } if (mpvparse->config_flags & FLAG_SEQUENCE_EXT) { + guint8 escape = mpvparse->sequenceext.profile_level_escape_bit; const guint profile_c = mpvparse->sequenceext.profile; const guint level_c = mpvparse->sequenceext.level; const gchar *profile = NULL, *level = NULL; @@ -824,20 +825,14 @@ gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) * 4:2:2 and Multi-view have profile = 0, with the escape bit set to 1 */ const gchar *const profiles[] = - { "high", "spatial", "snr", "main", "simple" }; + { "4:2:2", "high", "spatial", "snr", "main", "simple" }; /* * Level indication - 4 => High, 6 => High-1440, 8 => Main, 10 => Low, * except in the case of profile = 0 */ const gchar *const levels[] = { "high", "high-1440", "main", "low" }; - if (profile_c > 0 && profile_c < 6) - profile = profiles[profile_c - 1]; - - if ((level_c > 3) && (level_c < 11) && (level_c % 2 == 0)) - level = levels[(level_c >> 1) - 2]; - - if (profile_c == 8) { + if (escape) { /* Non-hierarchical profile */ switch (level_c) { case 2: @@ -863,9 +858,14 @@ gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) default: break; } - } - /* FIXME does it make sense to expose profile/level in the caps ? */ + } else { + if (profile_c < 6) + profile = profiles[profile_c]; + + if ((level_c > 3) && (level_c < 11) && (level_c % 2 == 0)) + level = levels[(level_c >> 1) - 2]; + } GST_DEBUG_OBJECT (mpvparse, "profile:'%s' level:'%s'", profile, level);