gst/typefind/gsttypefindfunctions.c: In case we can't find the required number of consecutive mpeg audio frames to po...

Original commit message from CVS:
* gst/typefind/gsttypefindfunctions.c: (mp3_type_find):
In case we can't find the required number of consecutive
mpeg audio frames to positively identify an MPEG audio
stream, check if there's at least a valid mpeg audio
frame right at offset 0 and if so suggest mpeg/audio
caps with a very low probability (#153004).
This commit is contained in:
Tim-Philipp Müller 2006-02-07 16:16:41 +00:00
parent b067983614
commit 0475a8b14c
2 changed files with 31 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2006-02-07 Tim-Philipp Müller <tim at centricular dot net>
* gst/typefind/gsttypefindfunctions.c: (mp3_type_find):
In case we can't find the required number of consecutive
mpeg audio frames to positively identify an MPEG audio
stream, check if there's at least a valid mpeg audio
frame right at offset 0 and if so suggest mpeg/audio
caps with a very low probability (#153004).
2006-02-07 Andy Wingo <wingo@pobox.com>
* gst/tcp/gsttcpclientsrc.c (gst_tcp_client_src_create): Switch to

View file

@ -553,7 +553,7 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
guint64 start_off = (try == 0) ? 0 : length / 2;
if (try != 0 && start_off == 0)
return;
break;
size = 0;
skipped = 0;
@ -660,8 +660,9 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
G_TYPE_INT, layer, NULL);
gst_type_find_suggest (tf, probability, caps);
gst_caps_unref (caps);
return;
}
return;
goto no_luck;
}
}
data++;
@ -669,6 +670,25 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
size--;
}
}
no_luck:
/* no luck so far, let's see if there's a valid header right at the start */
data = gst_type_find_peek (tf, 0, 4); /* use min. frame size? */
if (data) {
GstCaps *caps;
guint layer;
if (mp3_type_frame_length_from_header (GST_READ_UINT32_BE (data),
&layer, NULL, NULL, NULL, NULL, 0) != 0) {
caps = gst_caps_copy (MP3_CAPS);
gst_structure_set (gst_caps_get_structure (caps, 0), "layer",
G_TYPE_INT, layer, NULL);
GST_LOG ("possible mpeg audio layer %u frame at offset 0", layer);
gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE - 10, caps);
gst_caps_unref (caps);
}
}
}
/*** audio/x-ac3 ***/