From 83e6daf3ef44062eb330adc4f91a3f0022102ef0 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Thu, 26 Jun 2014 11:35:43 +0200 Subject: [PATCH] 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 --- gst-libs/gst/pbutils/codec-utils.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/codec-utils.c b/gst-libs/gst/pbutils/codec-utils.c index 517bbb2..5964975 100644 --- a/gst-libs/gst/pbutils/codec-utils.c +++ b/gst-libs/gst/pbutils/codec-utils.c @@ -427,7 +427,7 @@ const gchar * gst_codec_utils_h264_get_profile (const guint8 * sps, guint len) { const gchar *profile = NULL; - gint csf1, csf3; + gint csf1, csf3, csf5; 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; csf3 = (sps[1] & 0x10) >> 4; + csf5 = (sps[1] & 0x04) >> 2; switch (sps[0]) { case 66: @@ -482,6 +483,15 @@ gst_codec_utils_h264_get_profile (const guint8 * sps, guint len) case 128: profile = "stereo-high"; break; + case 83: + if (csf5) + profile = "scalable-constrained-baseline"; + else + profile = "scalable-baseline"; + break; + case 86: + profile = "scalable-high"; + break; default: return NULL; } @@ -540,6 +550,8 @@ gst_codec_utils_h264_get_level (const guint8 * sps, guint len) return "4.2"; case 51: return "5.1"; + case 52: + return "5.2"; default: return NULL; } @@ -591,6 +603,8 @@ gst_codec_utils_h264_get_level_idc (const gchar * level) return 50; else if (!strcmp (level, "5.1")) return 51; + else if (!strcmp (level, "5.2")) + return 52; GST_WARNING ("Invalid level %s", level); return 0; -- 2.7.4