return uri;
}
-/*
- * XXX: This code is duplicated in gst/mastroska/matroska-demux.c. Please
- * replicate any changes you make over there as well.
- */
-static gchar *
-avc_profile_idc_to_string (guint profile_idc, guint constraint_set_flags)
-{
- const gchar *profile = NULL;
- gint csf1, csf3;
-
- csf1 = (constraint_set_flags & 0x40) >> 6;
- csf3 = (constraint_set_flags & 0x10) >> 4;
-
- switch (profile_idc) {
- case 66:
- if (csf1)
- profile = "constrained-baseline";
- else
- profile = "baseline";
- break;
- case 77:
- profile = "main";
- break;
- case 88:
- profile = "extended";
- break;
- case 100:
- profile = "high";
- break;
- case 110:
- if (csf3)
- profile = "high-10-intra";
- else
- profile = "high-10";
- break;
- case 122:
- if (csf3)
- profile = "high-4:2:2-intra";
- else
- profile = "high-4:2:2";
- break;
- case 244:
- if (csf3)
- profile = "high-4:4:4-intra";
- else
- profile = "high-4:4:4";
- break;
- case 44:
- profile = "cavlc-4:4:4-intra";
- break;
- default:
- return NULL;
- }
-
- return g_strdup (profile);
-}
-
-static gchar *
-avc_level_idc_to_string (guint level_idc, guint constraint_set_flags)
-{
- gint csf3;
-
- csf3 = (constraint_set_flags & 0x10) >> 4;
-
- if (level_idc == 11 && csf3)
- return g_strdup ("1b");
- else if (level_idc % 10 == 0)
- return g_strdup_printf ("%u", level_idc / 10);
- else
- return g_strdup_printf ("%u.%u", level_idc / 10, level_idc % 10);
-}
-
-static void
-avc_get_profile_and_level_string (const guint8 * avc_data, gint size,
- gchar ** profile, gchar ** level)
-{
- if (size >= 3)
- /* First byte is the version, second is the profile indication,
- * and third is the 5 contraint_set_flags and 3 reserved bits */
- *profile = avc_profile_idc_to_string (QT_UINT8 (avc_data + 1),
- QT_UINT8 (avc_data + 2));
-
- if (size >= 4)
- /* Fourth byte is the level indication */
- *level = avc_level_idc_to_string (QT_UINT8 (avc_data + 3),
- QT_UINT8 (avc_data + 2));
-}
-
-
static gint
less_than (gconstpointer a, gconstpointer b)
{
{
/* parse, if found */
GstBuffer *buf;
- gchar *profile = NULL, *level = NULL;
-
- avc_get_profile_and_level_string (avc_data + 0x8, size,
- &profile, &level);
- if (profile) {
- gst_caps_set_simple (stream->caps, "profile", G_TYPE_STRING,
- profile, NULL);
- g_free (profile);
- }
- if (level) {
- gst_caps_set_simple (stream->caps, "level", G_TYPE_STRING,
- level, NULL);
- g_free (level);
- }
GST_DEBUG_OBJECT (qtdemux, "found avcC codec_data in stsd");
+ /* First 4 bytes are the length of the atom, the next 4 bytes
+ * are the fourcc, the next 1 byte is the version, and the
+ * subsequent bytes are sequence parameter set like data. */
+ gst_codec_utils_h264_caps_set_level_and_profile (stream->caps,
+ avc_data + 8 + 1, size - 1);
+
buf = gst_buffer_new_and_alloc (size);
memcpy (GST_BUFFER_DATA (buf), avc_data + 0x8, size);
gst_caps_set_simple (stream->caps,