Commit 719a9f57 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

codec utils: populate mpeg4 caps "level" field with level, not profile

Call the right function to get the level. Also add some more debug
logging.
parent bcf7a734
......@@ -111,6 +111,8 @@ gst_codec_utils_aac_get_profile (const guint8 * audio_config, guint len)
if (len < 1)
return NULL;
GST_MEMDUMP ("audio config", audio_config, len);
profile = audio_config[0] >> 3;
switch (profile) {
case 1:
......@@ -181,6 +183,8 @@ gst_codec_utils_aac_get_level (const guint8 * audio_config, guint len)
if (len < 2)
return NULL;
GST_MEMDUMP ("audio config", audio_config, len);
profile = audio_config[0] >> 3;
/* FIXME: add support for sr_idx = 0xf */
sr_idx = ((audio_config[0] & 0x7) << 1) | ((audio_config[1] & 0x80) >> 7);
......@@ -365,6 +369,9 @@ gst_codec_utils_aac_caps_set_level_and_profile (GstCaps * caps,
}
}
GST_LOG ("profile : %s", (profile) ? profile : "---");
GST_LOG ("level : %s", (level) ? level : "---");
return (level != NULL && profile != NULL);
}
......@@ -403,6 +410,8 @@ gst_codec_utils_h264_get_profile (const guint8 * sps, guint len)
if (len < 2)
return NULL;
GST_MEMDUMP ("SPS", sps, len);
csf1 = (sps[1] & 0x40) >> 6;
csf3 = (sps[1] & 0x10) >> 4;
......@@ -473,6 +482,8 @@ gst_codec_utils_h264_get_level (const guint8 * sps, guint len)
if (len < 3)
return NULL;
GST_MEMDUMP ("SPS", sps, len);
csf3 = (sps[1] & 0x10) >> 4;
if (sps[2] == 11 && csf3)
......@@ -542,6 +553,9 @@ gst_codec_utils_h264_caps_set_level_and_profile (GstCaps * caps,
if (profile != NULL)
gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL);
GST_LOG ("profile : %s", (profile) ? profile : "---");
GST_LOG ("level : %s", (level) ? level : "---");
return (level != NULL && profile != NULL);
}
......@@ -580,9 +594,13 @@ gst_codec_utils_mpeg4video_get_profile (const guint8 * vis_obj_seq, guint len)
if (len < 1)
return NULL;
GST_MEMDUMP ("VOS", vis_obj_seq, len);
profile_id = vis_obj_seq[0] >> 4;
level_id = vis_obj_seq[0] & 0xf;
GST_LOG ("profile_id = %d, level_id = %d", profile_id, level_id);
if (profile_id != 6 && profile_id < 0xe)
return profiles[profile_id];
......@@ -648,9 +666,13 @@ gst_codec_utils_mpeg4video_get_level (const guint8 * vis_obj_seq, guint len)
if (len < 1)
return NULL;
GST_MEMDUMP ("VOS", vis_obj_seq, len);
profile_id = vis_obj_seq[0] >> 4;
level_id = vis_obj_seq[0] & 0xf;
GST_LOG ("profile_id = %d, level_id = %d", profile_id, level_id);
if (profile_id != 0xf && level_id == 0)
return NULL;
......@@ -725,10 +747,13 @@ gst_codec_utils_mpeg4video_caps_set_level_and_profile (GstCaps * caps,
if (profile != NULL)
gst_caps_set_simple (caps, "profile", G_TYPE_STRING, profile, NULL);
level = gst_codec_utils_mpeg4video_get_profile (vis_obj_seq, len);
level = gst_codec_utils_mpeg4video_get_level (vis_obj_seq, len);
if (level != NULL)
gst_caps_set_simple (caps, "level", G_TYPE_STRING, level, NULL);
GST_LOG ("profile : %s", (profile) ? profile : "---");
GST_LOG ("level : %s", (level) ? level : "---");
return (profile != NULL && level != NULL);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment