mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01: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
c4aacdb8e5
commit
c9ae463a4f
14 changed files with 23 additions and 248 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
|
||||
|
|
|
@ -1006,6 +1006,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
/* We need to create an ElementFactory for each element we provide.
|
||||
* This consists of the name of the element, the GType identifier,
|
||||
* and a pointer to the details structure at the top of the file.
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
|
||||
|
||||
#include <libdv/dv.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
|
||||
/* This is the definition of the element's object structure. */
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
extern GstElementDetails flacenc_details;
|
||||
extern GstElementDetails flacdec_details;
|
||||
|
||||
static GstCaps* flac_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
GstPadTemplate *gst_flacdec_src_template, *gst_flacdec_sink_template;
|
||||
GstPadTemplate *gst_flacenc_src_template, *gst_flacenc_sink_template;
|
||||
|
||||
|
@ -61,45 +59,15 @@ raw_caps_factory (void)
|
|||
NULL));
|
||||
}
|
||||
|
||||
static GstTypeDefinition flacdefinition = {
|
||||
"flac_audio/x-flac",
|
||||
"audio/x-flac",
|
||||
".flac",
|
||||
flac_type_find,
|
||||
};
|
||||
|
||||
|
||||
static GstCaps*
|
||||
flac_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 4) == 4) {
|
||||
guint32 head = GUINT32_FROM_BE (*((guint32 *) GST_BUFFER_DATA (buf)));
|
||||
|
||||
if (head == 0x664C6143) {
|
||||
new = GST_CAPS_NEW ("flac_type_find",
|
||||
"application/x-flac",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *enc, *dec;
|
||||
GstTypeFactory *type;
|
||||
GstCaps *raw_caps, *flac_caps;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
gst_plugin_set_longname (plugin, "The FLAC Lossless compressor Codec");
|
||||
|
||||
/* create an elementfactory for the flacenc element */
|
||||
|
@ -144,9 +112,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
|
||||
|
||||
type = gst_type_factory_new (&flacdefinition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#include <FLAC/all.h>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#include "ladspa.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <gstauparse.h>
|
||||
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails gst_auparse_details = {
|
||||
".au parser",
|
||||
|
@ -41,36 +40,6 @@ static GstElementDetails gst_auparse_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
static GstCaps*
|
||||
au_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 4) == 4) {
|
||||
guint32 head = * (guint32 *) GST_BUFFER_DATA (buf);
|
||||
if (head == 0x2e736e64 || head == 0x646e732e) {
|
||||
new = gst_caps_new ("au_type_find",
|
||||
"audio/x-au",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
/* typefactory for 'au' */
|
||||
static GstTypeDefinition audefinition = {
|
||||
"auparse_audio/au",
|
||||
"audio/x-au",
|
||||
".au",
|
||||
au_type_find,
|
||||
};
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
|
||||
"sink",
|
||||
GST_PAD_SINK,
|
||||
|
@ -318,7 +287,6 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
/* create the plugin structure */
|
||||
/* create an elementfactory for the auparse element and list it */
|
||||
|
@ -330,10 +298,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory_templ));
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory_templ));
|
||||
|
||||
type = gst_type_factory_new (&audefinition);
|
||||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -38,16 +38,6 @@ static GstElementDetails gst_avi_demux_details = {
|
|||
"(C) 1999",
|
||||
};
|
||||
|
||||
static GstCaps* avi_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
/* typefactory for 'avi' */
|
||||
static GstTypeDefinition avidefinition = {
|
||||
"avidemux_video/avi",
|
||||
"video/avi",
|
||||
".avi",
|
||||
avi_type_find,
|
||||
};
|
||||
|
||||
/* AviDemux signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -172,33 +162,6 @@ gst_avi_demux_init (GstAviDemux *avi_demux)
|
|||
gst_element_set_loop_function (GST_ELEMENT (avi_demux), gst_avi_demux_loop);
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
avi_type_find (GstByteStream *bs,
|
||||
gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
GST_DEBUG ("avi_demux: 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_AVI) {
|
||||
new = GST_CAPS_NEW ("avi_type_find",
|
||||
"video/avi",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_avi_demux_avih (GstAviDemux *avi_demux)
|
||||
{
|
||||
|
@ -1932,7 +1895,6 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
gint i = 0;
|
||||
GstCaps *audcaps = NULL, *vidcaps = NULL, *temp;
|
||||
guint32 vid_list[] = {
|
||||
|
@ -1965,6 +1927,8 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
-1 /* end */
|
||||
};
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
if (!gst_library_load ("gstriff"))
|
||||
return FALSE;
|
||||
|
||||
|
@ -1997,9 +1961,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory,
|
||||
GST_PAD_TEMPLATE_GET (sink_templ));
|
||||
|
||||
type = gst_type_factory_new (&avidefinition);
|
||||
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>
|
||||
#include <gst/riff/riff.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" {
|
||||
|
|
|
@ -31,9 +31,6 @@ static void gst_wavparse_init (GstWavParse *wavparse);
|
|||
static GstElementStateReturn
|
||||
gst_wavparse_change_state (GstElement *element);
|
||||
|
||||
static GstCaps* wav_type_find (GstByteStream *bs,
|
||||
gpointer private);
|
||||
|
||||
static const GstFormat* gst_wavparse_get_formats (GstPad *pad);
|
||||
static const GstQueryType *
|
||||
gst_wavparse_get_query_types (GstPad *pad);
|
||||
|
@ -119,17 +116,6 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory,
|
|||
)
|
||||
)
|
||||
|
||||
/* typefactory for 'wav' */
|
||||
static GstTypeDefinition
|
||||
wavdefinition =
|
||||
{
|
||||
"wavparse_audio/x-wav",
|
||||
"audio/x-wav",
|
||||
".wav",
|
||||
wav_type_find,
|
||||
};
|
||||
|
||||
|
||||
/* WavParse signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
|
@ -243,30 +229,6 @@ gst_wavparse_get_property (GObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
wav_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstCaps *new = NULL;
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 12) == 12) {
|
||||
gchar *data = GST_BUFFER_DATA (buf);
|
||||
|
||||
if (!strncmp (&data[0], "RIFF", 4) &&
|
||||
!strncmp (&data[8], "WAVE", 4)) {
|
||||
new = GST_CAPS_NEW ("wav_type_find",
|
||||
"audio/x-wav",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static void
|
||||
demux_metadata (GstWavParse *wavparse,
|
||||
const char *data,
|
||||
|
@ -880,7 +842,6 @@ static gboolean
|
|||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
if(!gst_library_load("gstriff")){
|
||||
return FALSE;
|
||||
|
@ -898,9 +859,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
|
||||
|
||||
type = gst_type_factory_new (&wavdefinition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue