mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
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.
This commit is contained in:
parent
57cc1150a9
commit
34dcb8458e
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue