mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +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
c2bf0a3a23
commit
97bf62c74f
16 changed files with 27 additions and 191 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
|
||||
|
|
|
@ -619,6 +619,9 @@ plugin_init (GModule * module, GstPlugin * plugin)
|
|||
{
|
||||
GstElementFactory *factory;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
/* create an elementfactory for the a52dec element */
|
||||
factory = gst_element_factory_new ("a52dec", GST_TYPE_A52DEC, &gst_a52dec_details);
|
||||
g_return_val_if_fail (factory != NULL, FALSE);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -820,14 +820,16 @@ gst_mad_get_streaminfo (GstMad *mad)
|
|||
klass = g_type_class_ref (GST_TYPE_MAD_MODE);
|
||||
value = g_enum_get_value (klass,
|
||||
mad->header.mode);
|
||||
entry = gst_props_entry_new ("mode", GST_PROPS_STRING (value->value_nick));
|
||||
if (value)
|
||||
entry = gst_props_entry_new ("mode", GST_PROPS_STRING (value->value_nick));
|
||||
g_type_class_unref (klass);
|
||||
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
||||
|
||||
klass = g_type_class_ref (GST_TYPE_MAD_EMPHASIS);
|
||||
value = g_enum_get_value (klass,
|
||||
mad->header.emphasis);
|
||||
entry = gst_props_entry_new ("emphasis", GST_PROPS_STRING (value->value_nick));
|
||||
if (value)
|
||||
entry = gst_props_entry_new ("emphasis", GST_PROPS_STRING (value->value_nick));
|
||||
g_type_class_unref (klass);
|
||||
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
D2003.10.26.10.00.00
|
||||
2003-10-26 10:00 GMT
|
||||
|
|
|
@ -35,44 +35,6 @@ static GstElementDetails gst_asf_demux_details = {
|
|||
"(C) 2002",
|
||||
};
|
||||
|
||||
static GstCaps* asf_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
/* typefactory for 'asf' */
|
||||
static GstTypeDefinition asf_type_definition = {
|
||||
"asfdemux_video/asf",
|
||||
"video/x-ms-asf",
|
||||
/* note: asx/wax/wmx are XML files, we don't handle them */
|
||||
".asf .wma .wmv .wm",
|
||||
asf_type_find,
|
||||
};
|
||||
|
||||
static GstCaps*
|
||||
asf_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstCaps *new = NULL;
|
||||
GstBuffer *buf = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 16) == 16) {
|
||||
guint32 uid1 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[0]),
|
||||
uid2 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[1]),
|
||||
uid3 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[2]),
|
||||
uid4 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[3]);
|
||||
|
||||
if (uid1 == 0x75B22630 && uid2 == 0x11CF668E &&
|
||||
uid3 == 0xAA00D9A6 && uid4 == 0x6CCE6200) {
|
||||
new = GST_CAPS_NEW ("asf_type_find",
|
||||
"video/x-ms-asf",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
GST_PAD_TEMPLATE_FACTORY (sink_factory,
|
||||
"sink",
|
||||
GST_PAD_SINK,
|
||||
|
@ -1554,7 +1516,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[] = {
|
||||
|
@ -1583,14 +1544,13 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
-1 /* end */
|
||||
};
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
/* create an elementfactory for the asf_demux element */
|
||||
factory = gst_element_factory_new ("asfdemux",GST_TYPE_ASF_DEMUX,
|
||||
&gst_asf_demux_details);
|
||||
|
||||
/* type finding */
|
||||
type = gst_type_factory_new (&asf_type_definition);
|
||||
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||
|
||||
g_return_val_if_fail (factory != NULL, FALSE);
|
||||
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_NONE);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/riff/riff.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
#include "asfheaders.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define __MPEG_PARSE_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
#include "gstmpegpacketize.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -30,6 +30,9 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
* stack again and the first _init will be called more than once
|
||||
* and wtay wants to use dlclose at some point in the future */
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_mpeg_parse_plugin_init (module, plugin)) return FALSE;
|
||||
if (!gst_mpeg_demux_plugin_init (module, plugin)) return FALSE;
|
||||
if (!gst_rfc2250_enc_plugin_init (module, plugin)) return FALSE;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
#include "gstmpegpacketize.h"
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ enum GstRMDemuxStreamType {
|
|||
static GstElementDetails
|
||||
gst_rmdemux_details =
|
||||
{
|
||||
"QuickTime Demuxer",
|
||||
"RealMedia Demuxer",
|
||||
"Codec/Demuxer",
|
||||
"LGPL",
|
||||
"Demultiplex a RealMedia file into audio and video streams",
|
||||
|
@ -87,15 +87,6 @@ gst_rmdemux_details =
|
|||
"(C) 2003",
|
||||
};
|
||||
|
||||
static GstCaps* realmedia_type_find (GstByteStream *bs, gpointer private);
|
||||
|
||||
static GstTypeDefinition realmediadefinition = {
|
||||
"rmdemux_video/realmedia",
|
||||
"video/x-pn-realvideo",
|
||||
".ram .rm .ra",
|
||||
realmedia_type_find,
|
||||
};
|
||||
|
||||
enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -194,34 +185,13 @@ gst_rmdemux_init (GstRMDemux *rmdemux)
|
|||
gst_element_add_pad (GST_ELEMENT (rmdemux), rmdemux->sinkpad);
|
||||
}
|
||||
|
||||
static GstCaps*
|
||||
realmedia_type_find (GstByteStream *bs, gpointer private)
|
||||
{
|
||||
GstBuffer *buf = NULL;
|
||||
GstCaps *new = NULL;
|
||||
|
||||
if (gst_bytestream_peek (bs, &buf, 4) == 4) {
|
||||
gchar *data = GST_BUFFER_DATA (buf);
|
||||
|
||||
if (!strncmp (data, ".RMF", 4)) {
|
||||
new = GST_CAPS_NEW ("realmedia_type_find",
|
||||
"application/vnd.rn-realmedia",
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GModule *module, GstPlugin *plugin)
|
||||
{
|
||||
GstElementFactory *factory;
|
||||
GstTypeFactory *type;
|
||||
|
||||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
factory = gst_element_factory_new ("rmdemux", GST_TYPE_RMDEMUX,
|
||||
&gst_rmdemux_details);
|
||||
|
@ -232,9 +202,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
|
|||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_video_templ));
|
||||
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_audio_templ));
|
||||
|
||||
type = gst_type_factory_new (&realmediadefinition);
|
||||
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_RMDEMUX_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstbytestream.h>
|
||||
#include <gst/bytestream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
Loading…
Reference in a new issue