pbutils: handle more H.264 profiles and levels.

Recognize H.264 Level 5.2, as exposed by modern 2160p30+ streams,
i.e. commonly known as 4K. Also add initial support for handling
Annex.G (SVC) profiles.

https://bugzilla.gnome.org/show_bug.cgi?id=732269

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Gwenole Beauchesne 2014-06-26 11:35:43 +02:00
parent 4d076b060a
commit 83e6daf3ef

View File

@ -427,7 +427,7 @@ const gchar *
gst_codec_utils_h264_get_profile (const guint8 * sps, guint len) gst_codec_utils_h264_get_profile (const guint8 * sps, guint len)
{ {
const gchar *profile = NULL; const gchar *profile = NULL;
gint csf1, csf3; gint csf1, csf3, csf5;
g_return_val_if_fail (sps != NULL, NULL); g_return_val_if_fail (sps != NULL, NULL);
@ -438,6 +438,7 @@ gst_codec_utils_h264_get_profile (const guint8 * sps, guint len)
csf1 = (sps[1] & 0x40) >> 6; csf1 = (sps[1] & 0x40) >> 6;
csf3 = (sps[1] & 0x10) >> 4; csf3 = (sps[1] & 0x10) >> 4;
csf5 = (sps[1] & 0x04) >> 2;
switch (sps[0]) { switch (sps[0]) {
case 66: case 66:
@ -482,6 +483,15 @@ gst_codec_utils_h264_get_profile (const guint8 * sps, guint len)
case 128: case 128:
profile = "stereo-high"; profile = "stereo-high";
break; break;
case 83:
if (csf5)
profile = "scalable-constrained-baseline";
else
profile = "scalable-baseline";
break;
case 86:
profile = "scalable-high";
break;
default: default:
return NULL; return NULL;
} }
@ -540,6 +550,8 @@ gst_codec_utils_h264_get_level (const guint8 * sps, guint len)
return "4.2"; return "4.2";
case 51: case 51:
return "5.1"; return "5.1";
case 52:
return "5.2";
default: default:
return NULL; return NULL;
} }
@ -591,6 +603,8 @@ gst_codec_utils_h264_get_level_idc (const gchar * level)
return 50; return 50;
else if (!strcmp (level, "5.1")) else if (!strcmp (level, "5.1"))
return 51; return 51;
else if (!strcmp (level, "5.2"))
return 52;
GST_WARNING ("Invalid level %s", level); GST_WARNING ("Invalid level %s", level);
return 0; return 0;