mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
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
This commit is contained in:
parent
1f32d6aff7
commit
5ebf1d477d
3 changed files with 16 additions and 11 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue