diff options
Diffstat (limited to 'gst/modplug')
-rw-r--r-- | gst/modplug/Makefile.am | 4 | ||||
-rw-r--r-- | gst/modplug/gstmodplug.cc | 59 | ||||
-rw-r--r-- | gst/modplug/gstmodplug.h | 4 | ||||
-rw-r--r-- | gst/modplug/modplug_types.cc | 221 | ||||
-rw-r--r-- | gst/modplug/modplug_types.h | 44 |
5 files changed, 7 insertions, 325 deletions
diff --git a/gst/modplug/Makefile.am b/gst/modplug/Makefile.am index 52d9d408..ffbc56b0 100644 --- a/gst/modplug/Makefile.am +++ b/gst/modplug/Makefile.am @@ -2,9 +2,9 @@ SUBDIRS=libmodplug . plugin_LTLIBRARIES = libgstmodplug.la -libgstmodplug_la_SOURCES = modplug_types.cc gstmodplug.cc +libgstmodplug_la_SOURCES = gstmodplug.cc libgstmodplug_la_CXXFLAGS = $(GST_CFLAGS) libgstmodplug_la_LIBADD = $(top_builddir)/gst/modplug/libmodplug/libmodplug.la libgstmodplug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -noinst_HEADERS = gstmodplug.h modplug_types.h +noinst_HEADERS = gstmodplug.h diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 0401a6c6..c8d2555b 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -129,50 +129,6 @@ static GstElementStateReturn static GstElementClass *parent_class = NULL; -static GstCaps* -modplug_type_find (GstByteStream *bs, gpointer priv) -{ - GstBuffer *buf = NULL; - GstCaps *newc = NULL; - - if (gst_bytestream_peek (bs, &buf, 75) == 75) { - if (MOD_CheckType (buf) || - Mod_669_CheckType (buf) || - Amf_CheckType (buf) || - Dsm_CheckType (buf) || - Fam_CheckType (buf) || - Gdm_CheckType (buf) || - Imf_CheckType (buf) || - It_CheckType (buf) || - M15_CheckType (buf) || -#if 0 - Med_CheckType (buf) || /* FIXME */ -#endif - Mtm_CheckType (buf) || - Okt_CheckType (buf) || - S3m_CheckType (buf) || - Xm_CheckType (buf)) { - newc = GST_CAPS_NEW ("modplug_type_find", - "audio/x-mod", - NULL); - } - } - - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return newc; -} - -static GstTypeDefinition modplug_definitions[] = { - { "modplug_audio/mod", "audio/x-mod", - ".mod .sam .med .stm .mtm .669 .ult .far .amf " - ".dsm .imf .gdm .stx .okt .xm .it .s3m", - modplug_type_find }, - { NULL, NULL, NULL, NULL } -}; - GType gst_modplug_get_type(void) { static GType modplug_type = 0; @@ -858,12 +814,12 @@ gst_modplug_get_property (GObject *object, guint id, GValue *value, GParamSpec * static gboolean plugin_init (GModule *module, GstPlugin *plugin) { - GstElementFactory *factory; - guint i; + GstElementFactory *factory; + guint i; /* this filter needs the bytestream package */ -/* if (!gst_library_load ("gstbytestream")) - return FALSE;*/ + if (!gst_library_load ("gstbytestream")) + return FALSE; factory = gst_element_factory_new ("modplug", GST_TYPE_MODPLUG, &modplug_details); g_return_val_if_fail (factory != NULL, FALSE); @@ -874,13 +830,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (modplug_src_template_factory)); i = 0; - while (modplug_definitions[i].name) { - GstTypeFactory *type; - - type = gst_type_factory_new (&modplug_definitions[i]); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - i++; - } gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h index dcdbf062..86f815e3 100644 --- a/gst/modplug/gstmodplug.h +++ b/gst/modplug/gstmodplug.h @@ -28,10 +28,8 @@ extern "C" { #endif /* __cplusplus */ #include <gst/gst.h> -#include <gst/gstbytestream.h> +#include <gst/bytestream.h> -#include "modplug_types.h" - #define GST_TYPE_MODPLUG \ (gst_modplug_get_type()) diff --git a/gst/modplug/modplug_types.cc b/gst/modplug/modplug_types.cc deleted file mode 100644 index a6ca7874..00000000 --- a/gst/modplug/modplug_types.cc +++ /dev/null @@ -1,221 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include <gst/gst.h> -#include <string.h> /* memcmp */ -#include <ctype.h> /* isdigit */ - -#include "modplug_types.h" - -#define MODULEHEADERSIZE 0x438 - - -gboolean MOD_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + MODULEHEADERSIZE; - - /* Protracker and variants */ - if (( ! memcmp( data, "M.K.", 4 )) || ( ! memcmp( data, "M!K!", 4 ))) - return TRUE; - - /* Star Tracker */ - if ((( ! memcmp( data, "FLT", 3 )) || ( ! memcmp( data, "EXO", 3 ))) && ( isdigit( data[3] ))) - return TRUE; - - /* Oktalyzer (Amiga) */ - if (! memcmp( data, "OKTA", 4 )) - return TRUE; - - /* Oktalyser (Atari) */ - if ( ! memcmp( data, "CD81", 4 )) - return TRUE; - - /* Fasttracker */ - if (( ! memcmp( data + 1, "CHN", 3 )) && ( isdigit( data[0] ))) - return TRUE; - - /* Fasttracker or Taketracker */ - if ((( ! memcmp( data + 2, "CH", 2 )) || ( ! memcmp( data + 2, "CN", 2 ))) && ( isdigit( data[0] )) && ( isdigit( data[1] ))) - return TRUE; - - return FALSE; -} - -gboolean Mod_669_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "if", 2 ) || ! memcmp( data, "JN", 2 )) - return TRUE; - - return FALSE; -} - -gboolean Amf_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( memcmp( data, "AMF", 3) ) - return FALSE; - - data = GST_BUFFER_DATA( buf ) + 3; - - if (( (gint)*data >= 10 ) && ( (gint)*data <= 14 )) - return TRUE; - - return FALSE; -} - -gboolean Dsm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "RIFF", 4 ) && ! memcmp( data + 8, "DSMF", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Fam_CheckType( GstBuffer *buf ) -{ -guint8 *data; -static unsigned char FARSIG[4+3]={'F','A','R',0xfe,13,10,26}; - - data = GST_BUFFER_DATA( buf ); - - if(( memcmp( data, FARSIG, 4 )) || ( memcmp( data + 44, FARSIG + 4, 3 ))) - return FALSE; - - return 1; -} - -gboolean Gdm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if ( ! memcmp( data, "GDM\xfe", 4 ) && ! memcmp( data + 71, "GMFS", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Imf_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + 0x3c; - - if( ! memcmp( data, "IM10", 4)) - return TRUE; - - return FALSE; -} - -gboolean It_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "IMPM", 4 )) - return TRUE; - - return FALSE; -} - -gboolean M15_CheckType( GstBuffer *buf ) -{ - /* FIXME: M15 CheckType to do */ - return FALSE; -} - -gboolean Med_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if(( ! memcmp(data, "MMD0", 4 )) || ( memcmp( data, "MMD1", 4 ))) - return TRUE; - - return FALSE; -} - -gboolean Mtm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "MTM", 3 )) - return TRUE; - - return FALSE; -} - -gboolean Okt_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "OKTSONG", 8 )) - return TRUE; - - return FALSE; -} - -gboolean S3m_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + 0x2c; - - if( ! memcmp( data, "SCRM", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Xm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( memcmp( data, "Extended Module: ", 17 )) - return FALSE; - - if( data[ 37 ] == 0x1a ) - return TRUE; - - return FALSE; -} - - diff --git a/gst/modplug/modplug_types.h b/gst/modplug/modplug_types.h deleted file mode 100644 index 63b5a08c..00000000 --- a/gst/modplug/modplug_types.h +++ /dev/null @@ -1,44 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __MODPLUG_TYPES_H__ -#define __MODPLUG_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -gboolean MOD_CheckType (GstBuffer *buf); -gboolean Mod_669_CheckType (GstBuffer *buf); -gboolean Amf_CheckType (GstBuffer *buf); -gboolean Dsm_CheckType (GstBuffer *buf); -gboolean Fam_CheckType (GstBuffer *buf); -gboolean Gdm_CheckType (GstBuffer *buf); -gboolean Imf_CheckType (GstBuffer *buf); -gboolean It_CheckType (GstBuffer *buf); -gboolean M15_CheckType (GstBuffer *buf); -gboolean Mtm_CheckType (GstBuffer *buf); -gboolean Okt_CheckType (GstBuffer *buf); -gboolean S3m_CheckType (GstBuffer *buf); -gboolean Xm_CheckType (GstBuffer *buf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __MODPLUG_TYPES_H__ */ |