mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
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
This commit is contained in:
parent
680f08e333
commit
5bb80c9f53
28 changed files with 41 additions and 648 deletions
|
@ -264,10 +264,10 @@ GST_PLUGINS_ALL="\
|
|||
cutter debug deinterlace effectv festival \
|
||||
filter flx goom id3 intfloat law level median mixmatrix \
|
||||
mpeg1sys mpeg1videoparse mpeg2enc mpeg2sub \
|
||||
mpegaudio mpegaudioparse mpegstream mpegtypes \
|
||||
mpegaudio mpegaudioparse mpegstream \
|
||||
monoscope oneton overlay passthrough playondemand qtdemux \
|
||||
realmedia rtp rtjpeg silence sine smooth smpte \
|
||||
spectrum speed stereo synaesthesia tcp udp vbidec \
|
||||
spectrum speed stereo synaesthesia tcp typefind udp vbidec \
|
||||
videocrop videodrop videofilter videoflip videoscale \
|
||||
videotestsrc volenv volume wavenc wavparse y4m"
|
||||
|
||||
|
@ -1193,7 +1193,6 @@ gst/mpeg2sub/Makefile
|
|||
gst/mpegaudio/Makefile
|
||||
gst/mpegaudioparse/Makefile
|
||||
gst/mpegstream/Makefile
|
||||
gst/mpegtypes/Makefile
|
||||
gst/modplug/Makefile
|
||||
gst/modplug/libmodplug/Makefile
|
||||
gst/monoscope/Makefile
|
||||
|
@ -1214,6 +1213,7 @@ gst/speed/Makefile
|
|||
gst/stereo/Makefile
|
||||
gst/synaesthesia/Makefile
|
||||
gst/tcp/Makefile
|
||||
gst/typefind/Makefile
|
||||
gst/udp/Makefile
|
||||
gst/vbidec/Makefile
|
||||
gst/videocrop/Makefile
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
gst_afsink_plugin_init (module, plugin);
|
||||
gst_afsrc_plugin_init (module, plugin);
|
||||
gst_afparse_plugin_init (module, plugin);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
#include <audiofile.h> /* what else are we to do */
|
||||
#include <af_vfs.h>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <tremor/ivorbiscodec.h>
|
||||
#include <tremor/ivorbisfile.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
extern GType ivorbisfile_get_type(void);
|
||||
|
||||
|
@ -104,6 +104,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
GstTypeFactory *type;
|
||||
GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
gst_plugin_set_longname (plugin, "The OGG Vorbis Codec");
|
||||
|
||||
raw_caps = raw_caps_factory ();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <gst/gst.h>
|
||||
#include <tremor/ivorbiscodec.h>
|
||||
#include <tremor/ivorbisfile.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#define GST_TYPE_IVORBISFILE \
|
||||
(ivorbisfile_get_type())
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <jack/jack.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
//#define JACK_DEBUG(str, a...) g_message (str, ##a)
|
||||
#define JACK_DEBUG(str, a...)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#include "ladspa.h"
|
||||
|
||||
|
|
|
@ -578,8 +578,8 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
GstElementFactory *factory;
|
||||
|
||||
/* this filter needs the bytestream package */
|
||||
/* if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;*/
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
/* create an elementfactory for the avi_demux element */
|
||||
factory = gst_element_factory_new ("mplex",GST_TYPE_MPLEX,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#include "outputstream.hh"
|
||||
#include "bits.hh"
|
||||
|
|
|
@ -626,34 +626,10 @@ gst_swfdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
|
|||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
swf_type_find(GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
gchar *data;
|
||||
|
||||
gst_bytestream_peek (bs, &buf, 4);
|
||||
data = GST_BUFFER_DATA(buf);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 4)
|
||||
return NULL;
|
||||
|
||||
if((data[0] != 'F' && data[0] != 'C') ||
|
||||
data[1] != 'W' || data[2] != 'S')return NULL;
|
||||
|
||||
return gst_caps_new("swf_type_find","application/x-shockwave-flash",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GstTypeDefinition swftype_definition =
|
||||
{ "swfdecode/x-shockwave-flash", "application/x-shockwave-flash",
|
||||
".swf .swfl", swf_type_find };
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
/* create an elementfactory for the swfdec element */
|
||||
factory = gst_element_factory_new("swfdec",GST_TYPE_SWFDEC,
|
||||
|
@ -670,9 +646,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
type = gst_type_factory_new(&swftype_definition);
|
||||
gst_plugin_add_feature(plugin, GST_PLUGIN_FEATURE(type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
D2003.10.26.10.00.00
|
||||
2003-10-26 10:00 GMT
|
||||
|
|
|
@ -50,16 +50,6 @@ static GstElementDetails gst_cdxa_parse_details = {
|
|||
"(C) 2002",
|
||||
};
|
||||
|
||||
static GstCaps* cdxa_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
/* typefactory for 'cdxa' */
|
||||
static GstTypeDefinition cdxadefinition = {
|
||||
"cdxaparse_video",
|
||||
"video/x-cdxa",
|
||||
".dat",
|
||||
cdxa_type_find,
|
||||
};
|
||||
|
||||
/* CDXAParse signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -158,33 +148,6 @@ gst_cdxa_parse_init (GstCDXAParse *cdxa_parse)
|
|||
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
cdxa_type_find (GstByteStream *bs,
|
||||
gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
GST_DEBUG ("cdxa_parse: typefind");
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 12) == 12) {
|
||||
guint32 head1 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[0]),
|
||||
head2 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[2]);
|
||||
|
||||
if (head1 == GST_RIFF_TAG_RIFF && head2 == GST_RIFF_RIFF_CDXA) {
|
||||
new = GST_CAPS_NEW ("cdxa_type_find",
|
||||
"video/x-cdxa",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_cdxa_parse_handle_event (GstCDXAParse *cdxa_parse)
|
||||
{
|
||||
|
@ -343,7 +306,9 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
/* create an elementfactory for the cdxa_parse element */
|
||||
factory = gst_element_factory_new ("cdxaparse", GST_TYPE_CDXA_PARSE,
|
||||
|
@ -353,9 +318,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_templ));
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
|
||||
|
||||
type = gst_type_factory_new (&cdxadefinition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
static void gst_festival_class_init (GstFestivalClass *klass);
|
||||
static void gst_festival_init (GstFestival *festival);
|
||||
|
||||
static GstCaps* text_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
static void gst_festival_chain (GstPad *pad, GstData *_data);
|
||||
static GstElementStateReturn
|
||||
gst_festival_change_state (GstElement *element);
|
||||
|
@ -123,17 +121,6 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory,
|
|||
)
|
||||
)
|
||||
|
||||
/* typefactory for 'wav' */
|
||||
static GstTypeDefinition
|
||||
textdefinition =
|
||||
{
|
||||
"festival_text/plain",
|
||||
"text/plain",
|
||||
".txt",
|
||||
text_type_find,
|
||||
};
|
||||
|
||||
|
||||
/* Festival signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -197,40 +184,6 @@ gst_festival_init (GstFestival *festival)
|
|||
festival->info = festival_default_info();
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
text_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
#define TEXT_SIZE 32
|
||||
|
||||
/* read arbitrary number and see if it's textual */
|
||||
if (gst_bytestream_peek (bs, &buf, TEXT_SIZE) == TEXT_SIZE) {
|
||||
gchar *data = GST_BUFFER_DATA (buf);
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < TEXT_SIZE; i++) {
|
||||
if (!isprint (data[i]) && data[i] != '\n') {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* well, we found something that looks like text... */
|
||||
new = gst_caps_new ("text_type_find",
|
||||
"text/plain",
|
||||
NULL);
|
||||
}
|
||||
out:
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_festival_chain (GstPad *pad, GstData *_data)
|
||||
{
|
||||
|
@ -484,7 +437,6 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
/* create an elementfactory for the festival element */
|
||||
factory = gst_element_factory_new ("festival", GST_TYPE_FESTIVAL,
|
||||
|
@ -495,9 +447,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_template_factory));
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_template_factory));
|
||||
|
||||
type = gst_type_factory_new (&textdefinition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
|
||||
#define JIFFIE (GST_SECOND/70)
|
||||
|
||||
static GstCaps* flxdec_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
/* flx element information */
|
||||
static GstElementDetails flxdec_details = {
|
||||
"FLX Decoder",
|
||||
|
@ -41,13 +39,6 @@ static GstElementDetails flxdec_details = {
|
|||
"(C) 2001",
|
||||
};
|
||||
|
||||
static GstTypeDefinition flxdec_definition = {
|
||||
"flxdec_video/fli",
|
||||
"video/fli",
|
||||
".flc .fli",
|
||||
flxdec_type_find,
|
||||
};
|
||||
|
||||
/* Flx signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -112,37 +103,6 @@ static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *);
|
|||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static GstCaps*
|
||||
flxdec_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 134) == 134) {
|
||||
guint8 *data = GST_BUFFER_DATA (buf);
|
||||
|
||||
/* check magic */
|
||||
if ((data[4] == 0x11 || data[4] == 0x12 ||
|
||||
data[4] == 0x30 || data[4] == 0x44) &&
|
||||
data[5] == 0xaf) {
|
||||
/* check the frame type of the first frame */
|
||||
if ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1) {
|
||||
GST_DEBUG ("GstFlxDec: found supported flx format");
|
||||
new = gst_caps_new ("flxdec_type_find",
|
||||
"video/x-fli",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
gst_flxdec_get_type(void)
|
||||
{
|
||||
|
@ -688,7 +648,9 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
factory = gst_element_factory_new("flxdec", GST_TYPE_FLXDEC, &flxdec_details);
|
||||
g_return_val_if_fail(factory != NULL, FALSE);
|
||||
|
@ -699,9 +661,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
type = gst_type_factory_new (&flxdec_definition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#include "flx_color.h"
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#endif
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -500,6 +500,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
factory = gst_element_factory_new ("mixmatrix", GST_TYPE_MIXMATRIX,
|
||||
&mixmatrix_details);
|
||||
g_return_val_if_fail (factory != NULL, FALSE);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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__ */
|
|
@ -6,4 +6,3 @@ libgstmpegaudioparse_la_LIBADD =
|
|||
libgstmpegaudioparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = gstmpegaudioparse.h
|
||||
EXTRA_DIST = README
|
||||
|
|
|
@ -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.
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,15 +104,6 @@ gst_qtdemux_details =
|
|||
"(C) 2003",
|
||||
};
|
||||
|
||||
static GstCaps* quicktime_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
static GstTypeDefinition quicktimedefinition = {
|
||||
"qtdemux_video/quicktime",
|
||||
"video/quicktime",
|
||||
".mov",
|
||||
quicktime_type_find,
|
||||
};
|
||||
|
||||
enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -186,37 +177,10 @@ gst_qtdemux_init (GstQTDemux *qtdemux)
|
|||
gst_element_add_pad (GST_ELEMENT (qtdemux), qtdemux->sinkpad);
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
quicktime_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 8) == 8) {
|
||||
gchar *data = GST_BUFFER_DATA (buf);
|
||||
|
||||
if (!strncmp (&data[4], "wide", 4) ||
|
||||
!strncmp (&data[4], "moov", 4) ||
|
||||
!strncmp (&data[4], "mdat", 4) ||
|
||||
!strncmp (&data[4], "free", 4)) {
|
||||
new = GST_CAPS_NEW ("quicktime_type_find",
|
||||
"video/quicktime",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
GstCaps *audiocaps = NULL, *videocaps = NULL, *temp;
|
||||
const guint32 audio_fcc[] = {
|
||||
/* FILLME */
|
||||
|
@ -227,6 +191,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
};
|
||||
gint i;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
factory = gst_element_factory_new ("qtdemux", GST_TYPE_QTDEMUX,
|
||||
&gst_qtdemux_details);
|
||||
g_return_val_if_fail(factory != NULL, FALSE);
|
||||
|
@ -254,9 +221,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory, videosrctempl);
|
||||
gst_element_factory_add_pad_template (factory, audiosrctempl);
|
||||
|
||||
type = gst_type_factory_new (&quicktimedefinition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define __GST_QTDEMUX_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -25,13 +25,6 @@
|
|||
extern GstElementDetails gst_rtjpegenc_details;
|
||||
extern GstElementDetails gst_rtjpegdec_details;
|
||||
|
||||
GstTypeDefinition rtjpegdefinition = {
|
||||
"rtjpeg_video/rtjpeg",
|
||||
"video/x-rtjpeg",
|
||||
".rtj",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue