summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2010-03-10 13:32:53 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-04-12 15:04:23 +0100
commit34dcb8458e2dfee37f83e0a3bf37195a4d503bb2 (patch)
tree4a8a78e8b3866a557288ba446b52da8f3fd26463
parent57cc1150a9f8ded33f7d0f47dd713b9eda05dc88 (diff)
typefinding: add AAC profile to ADTS caps
This looks at the AAC profile for ADTS streams and adds the profile as a string in the corresponding caps. Profile is the actual profile, base-profile denotes the minimum codec requirements to decode this stream. In this case they're always the same, but they may differ e.g. in case of certain HE-AAC streams that can be partially decoded by LC decoders (with loss of quality of course) if no suitable HE-AAC decoder is available. Fixes #612312.
-rw-r--r--gst/typefind/gsttypefindfunctions.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c
index fecf7bf43..887dc2fae 100644
--- a/gst/typefind/gsttypefindfunctions.c
+++ b/gst/typefind/gsttypefindfunctions.c
@@ -650,6 +650,8 @@ static GstStaticCaps aac_caps = GST_STATIC_CAPS ("audio/mpeg, "
static void
aac_type_find (GstTypeFind * tf, gpointer unused)
{
+ /* LUT to convert the AudioObjectType from the ADTS header to a string */
+ static const gchar profile_to_string[][5] = { "main", "lc", "ssr", "ltp" };
DataScanCtx c = { 0, NULL, 0 };
while (c.offset < AAC_AMOUNT) {
@@ -680,14 +682,17 @@ aac_type_find (GstTypeFind * tf, gpointer unused)
snc = GST_READ_UINT16_BE (c.data + len);
if ((snc & 0xfff6) == 0xfff0) {
- gint mpegversion;
+ gint mpegversion, profile;
mpegversion = (c.data[1] & 0x08) ? 2 : 4;
+ profile = c.data[2] >> 6;
GST_DEBUG ("Found second ADTS-%d syncpoint at offset 0x%"
G_GINT64_MODIFIER "x, framelen %u", mpegversion, c.offset, len);
gst_type_find_suggest_simple (tf, GST_TYPE_FIND_LIKELY, "audio/mpeg",
"framed", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, mpegversion,
+ "base-profile", G_TYPE_STRING, profile_to_string[profile],
+ "profile", G_TYPE_STRING, profile_to_string[profile],
"stream-type", G_TYPE_STRING, "adts", NULL);
break;
}