summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2016-03-07 13:04:08 +0100
committerEdward Hervey <bilboed@bilboed.com>2016-03-09 15:18:42 +0100
commit5ebf1d477de44a45ce3a8e320a86cc3bf83c2a8e (patch)
treee0e14b8fd5ce72dde77c2d601e5be33647ae29a1
parent1f32d6aff71b5183626a85e6c761a1db1c6ee07c (diff)
downloadgstreamer-plugins-bad-5ebf1d477de44a45ce3a8e320a86cc3bf83c2a8e.tar.gz
mpegvideoparser: Handle non-hierarchical profiles again
This is a regression from since mpegvideoparser was switched to use the codecparsing library. The problem is that the high bit of the profile_and_level is used to specify non-hierarchical profiles and levels. Unfortunately we were discarding that information. Expose that escape bit, and use it in the element https://bugzilla.gnome.org/show_bug.cgi?id=763220
-rw-r--r--gst-libs/gst/codecparsers/gstmpegvideoparser.c3
-rw-r--r--gst-libs/gst/codecparsers/gstmpegvideoparser.h4
-rw-r--r--gst/videoparsers/gstmpegvideoparse.c20
3 files changed, 16 insertions, 11 deletions
diff --git a/gst-libs/gst/codecparsers/gstmpegvideoparser.c b/gst-libs/gst/codecparsers/gstmpegvideoparser.c
index 6384105e6..debafa094 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 35f7c6fc2..1298ed78f 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 5fa7165bf..bf71a3e7c 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);