summaryrefslogtreecommitdiffstats
path: root/gst/mpegaudioparse
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2003-10-28 20:52:41 +0000
committerBenjamin Otte <otte@gnome.org>2003-10-28 20:52:41 +0000
commit5bb80c9f5359a446d52ad7824095ae4c67bf3cdf (patch)
tree389f062ecc5627e362c48b89fda7257d10fa8d8c /gst/mpegaudioparse
parent680f08e33306ff907e31b3c9db70e132fc9a5158 (diff)
downloadgst-plugins-bad-5bb80c9f5359a446d52ad7824095ae4c67bf3cdf.tar.gz
gst-plugins-bad-5bb80c9f5359a446d52ad7824095ae4c67bf3cdf.tar.bz2
gst-plugins-bad-5bb80c9f5359a446d52ad7824095ae4c67bf3cdf.zip
merge TYPEFIND branch. Major changes:
Original commit message from CVS: merge TYPEFIND branch. Major changes: - totally reworked type(find) system - all typefind functions are in gst/typefind now - more typefind functions then before - some plugins might fail to compile now because I don't have them installed and they a) require bytestream or b) haven't had their typefind fixed. Please fix those plugins and put the typefind functions into gst/typefind if they don't have dependencies
Diffstat (limited to 'gst/mpegaudioparse')
-rw-r--r--gst/mpegaudioparse/Makefile.am1
-rw-r--r--gst/mpegaudioparse/README12
-rw-r--r--gst/mpegaudioparse/gstmpegaudioparse.c86
3 files changed, 0 insertions, 99 deletions
diff --git a/gst/mpegaudioparse/Makefile.am b/gst/mpegaudioparse/Makefile.am
index cb06727f..02f8a2ee 100644
--- a/gst/mpegaudioparse/Makefile.am
+++ b/gst/mpegaudioparse/Makefile.am
@@ -6,4 +6,3 @@ libgstmpegaudioparse_la_LIBADD =
libgstmpegaudioparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstmpegaudioparse.h
-EXTRA_DIST = README
diff --git a/gst/mpegaudioparse/README b/gst/mpegaudioparse/README
deleted file mode 100644
index 8a803d3e..00000000
--- a/gst/mpegaudioparse/README
+++ /dev/null
@@ -1,12 +0,0 @@
-MP3 Audio Parser
-================
-
-This element acts as a parser for mpeg audio data. It's called 'mp3' but
-in reality will work for any MPEG-1, MPEG-2, or MPEG-2.5 elemental audio
-stream of any of Layers I, II, and III. It will not (currently, ever?)
-handle MPEG-2 BC or NBC streams, as those have rather specialized needs
-best served be a different filter.
-
-It will take an mpeg audio stream in any form on its 'src' input, with any
-buffer size, and split it into buffers containing a single frame each.
-NOTE: ancillary data is not dealt with right now.
diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c
index b0a30806..a4d7a849 100644
--- a/gst/mpegaudioparse/gstmpegaudioparse.c
+++ b/gst/mpegaudioparse/gstmpegaudioparse.c
@@ -35,15 +35,6 @@ static GstElementDetails mp3parse_details = {
"(C) 1999",
};
-static GstCaps * mp3_type_find (GstByteStream *bs, gpointer data);
-
-static GstTypeDefinition mp3type_definition = {
- "mp3_audio/mpeg",
- "audio/mpeg",
- ".mp3 .mp2 .mp1 .mpga",
- mp3_type_find,
-};
-
static GstPadTemplate*
mp3_src_factory (void)
{
@@ -267,78 +258,6 @@ mp3_caps_create (guint layer, guint channels,
return new;
}
-static GstCaps *
-mp3_type_find (GstByteStream *bs, gpointer private)
-{
- GstBuffer *buf = NULL;
- GstCaps *new = NULL;
- guint8 *data;
- guint size;
- guint32 head;
- guint layer = 0, bitrate = 0, samplerate = 0, channels = 0;
-
- /* note that even if we don't get the requested size,
- * it might still be a (very small) mp3 */
- gst_bytestream_peek (bs, &buf, GST_MP3_TYPEFIND_MIN_DATA);
- if (!buf) {
- goto done;
- }
-
- data = GST_BUFFER_DATA (buf);
- size = GST_BUFFER_SIZE (buf);
-
- while (size >= 4) {
- head = GUINT32_FROM_BE(*((guint32 *)data));
- if ((head & 0xffe00000) == 0xffe00000) {
- guint length;
- guint prev_layer = 0, prev_bitrate = 0,
- prev_channels = 0, prev_samplerate = 0;
- guint found = 0; /* number of valid headers found */
- guint pos = 0;
-
- do {
- if (!(length = mp3_type_frame_length_from_header (head, &layer,
- &channels, &bitrate,
- &samplerate))) {
- break;
- }
- if ((prev_layer && prev_layer != layer) || !layer ||
- (prev_bitrate && prev_bitrate != bitrate) || !bitrate ||
- (prev_samplerate && prev_samplerate != samplerate) || !samplerate ||
- (prev_channels && prev_channels != channels) || !channels) {
- /* this means an invalid property, or a change, which likely
- * indicates that this is not a mp3 but just a random bytestream */
- break;
- }
- prev_layer = layer;
- prev_bitrate = bitrate;
- prev_channels = channels;
- prev_samplerate = samplerate;
- pos += length;
- if (++found >= GST_MP3_TYPEFIND_MIN_HEADERS) {
- /* we're pretty sure that this is mp3 now */
- new = mp3_caps_create (layer, channels, bitrate, samplerate);
- goto done;
- }
-
- /* and now, find a new head */
- head = GUINT32_FROM_BE(*((guint32 *) &(data[pos])));
- if ((head & 0xffe00000) != 0xffe00000)
- break;
- } while (TRUE);
- }
- data++;
- size--;
- }
-
-done:
- if (buf != NULL) {
- gst_buffer_unref (buf);
- }
-
- return new;
-}
-
static void
gst_mp3parse_class_init (GstMPEGAudioParseClass *klass)
{
@@ -658,7 +577,6 @@ static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
- GstTypeFactory *type;
/* create an elementfactory for the mp3parse element */
factory = gst_element_factory_new ("mp3parse",
@@ -674,10 +592,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
- /* type finding */
- type = gst_type_factory_new (&mp3type_definition);
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
-
return TRUE;
}