Commit 69277f05 authored by David Schleef's avatar David Schleef
Browse files

Merge plugins. Update to new plugin init code

Original commit message from CVS:
Merge plugins.  Update to new plugin init code
parent 36884b6d
plugin_LTLIBRARIES = \
libgstavimux.la \
libgstavidemux.la
plugin_LTLIBRARIES = libgstavi.la
libgstavidemux_la_SOURCES = gstavidemux.c
libgstavimux_la_SOURCES = gstavimux.c
libgstavi_la_SOURCES = gstavidemux.c gstavimux.c
noinst_HEADERS = \
gstavimux.h \
gstavidemux.h
libgstavidemux_la_CFLAGS = $(GST_CFLAGS)
libgstavidemux_la_LIBADD =
libgstavidemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstavimux_la_CFLAGS = $(GST_CFLAGS)
libgstavimux_la_LIBADD =
libgstavimux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstavi_la_CFLAGS = $(GST_CFLAGS)
libgstavi_la_LIBADD =
libgstavi_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
EXTRA_DIST = README
......@@ -25,18 +25,7 @@
#include <string.h>
#include "gstavidemux.h"
/* elementfactory information */
static GstElementDetails gst_avi_demux_details = {
"Avi demuxer",
"Codec/Demuxer",
"LGPL",
"Demultiplex an avi file into audio and video",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
};
#include "gstavimux.h"
/* AviDemux signals and args */
enum {
......@@ -63,6 +52,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_templ,
)
);
static void gst_avi_demux_base_init (gpointer g_class);
static void gst_avi_demux_class_init (GstAviDemuxClass *klass);
static void gst_avi_demux_init (GstAviDemux *avi_demux);
......@@ -97,6 +87,13 @@ static void gst_avi_demux_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static GstCaps * gst_avi_demux_audio_caps (guint16 codec_id,
gst_riff_strf_auds *strf, GstAviDemux *avi_demux);
static GstCaps * gst_avi_demux_video_caps (guint32 codec_fcc,
gst_riff_strh *strh, gst_riff_strf_vids *strf,
GstAviDemux *avi_demux);
static GstCaps * gst_avi_demux_iavs_caps (void);
static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
/*static guint gst_avi_demux_signals[LAST_SIGNAL] = { 0 }; */
......@@ -109,7 +106,7 @@ gst_avi_demux_get_type(void)
if (!avi_demux_type) {
static const GTypeInfo avi_demux_info = {
sizeof(GstAviDemuxClass),
NULL,
gst_avi_demux_base_init,
NULL,
(GClassInitFunc)gst_avi_demux_class_init,
NULL,
......@@ -123,6 +120,75 @@ gst_avi_demux_get_type(void)
return avi_demux_type;
}
static void
gst_avi_demux_base_init (gpointer g_class)
{
static GstElementDetails gst_avi_demux_details = GST_ELEMENT_DETAILS (
"Avi demuxer",
"Codec/Demuxer",
"Demultiplex an avi file into audio and video",
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>"
);
static guint32 vid_list[] = {
GST_MAKE_FOURCC('I','4','2','0'),
GST_MAKE_FOURCC('Y','U','Y','2'),
GST_MAKE_FOURCC('M','J','P','G'),
GST_MAKE_FOURCC('D','V','S','D'),
GST_MAKE_FOURCC('W','M','V','1'),
GST_MAKE_FOURCC('W','M','V','2'),
GST_MAKE_FOURCC('M','P','G','4'),
GST_MAKE_FOURCC('M','P','4','2'),
GST_MAKE_FOURCC('M','P','4','3'),
GST_MAKE_FOURCC('H','F','Y','U'),
GST_MAKE_FOURCC('D','I','V','3'),
GST_MAKE_FOURCC('M','P','E','G'),
GST_MAKE_FOURCC('H','2','6','3'),
GST_MAKE_FOURCC('D','I','V','X'),
GST_MAKE_FOURCC('X','V','I','D'),
GST_MAKE_FOURCC('3','I','V','1'),
0 /* end */
};
static gint aud_list[] = {
GST_RIFF_WAVE_FORMAT_MPEGL3,
GST_RIFF_WAVE_FORMAT_MPEGL12,
GST_RIFF_WAVE_FORMAT_PCM,
GST_RIFF_WAVE_FORMAT_VORBIS1,
GST_RIFF_WAVE_FORMAT_A52,
GST_RIFF_WAVE_FORMAT_ALAW,
GST_RIFF_WAVE_FORMAT_MULAW,
-1 /* end */
};
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gint i = 0;
GstCaps *audcaps = NULL, *vidcaps = NULL, *temp;
for (i = 0; aud_list[i] != -1; i++) {
temp = gst_avi_demux_audio_caps (aud_list[i], NULL, NULL);
audcaps = gst_caps_append (audcaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
audcaps, NULL);
for (i = 0; vid_list[i] != 0; i++) {
temp = gst_avi_demux_video_caps (vid_list[i], NULL, NULL, NULL);
vidcaps = gst_caps_append (vidcaps, temp);
}
vidcaps = gst_caps_append (vidcaps,
gst_avi_demux_iavs_caps ());
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
vidcaps, NULL);
gst_element_class_add_pad_template (element_class, audiosrctempl);
gst_element_class_add_pad_template (element_class, videosrctempl);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (sink_templ));
gst_element_class_set_details (element_class, &gst_avi_demux_details);
}
static void
gst_avi_demux_class_init (GstAviDemuxClass *klass)
{
......@@ -1892,83 +1958,39 @@ gst_avi_demux_get_property (GObject *object, guint prop_id, GValue *value,
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
GstElementFactory *factory;
gint i = 0;
GstCaps *audcaps = NULL, *vidcaps = NULL, *temp;
guint32 vid_list[] = {
GST_MAKE_FOURCC('I','4','2','0'),
GST_MAKE_FOURCC('Y','U','Y','2'),
GST_MAKE_FOURCC('M','J','P','G'),
GST_MAKE_FOURCC('D','V','S','D'),
GST_MAKE_FOURCC('W','M','V','1'),
GST_MAKE_FOURCC('W','M','V','2'),
GST_MAKE_FOURCC('M','P','G','4'),
GST_MAKE_FOURCC('M','P','4','2'),
GST_MAKE_FOURCC('M','P','4','3'),
GST_MAKE_FOURCC('H','F','Y','U'),
GST_MAKE_FOURCC('D','I','V','3'),
GST_MAKE_FOURCC('M','P','E','G'),
GST_MAKE_FOURCC('H','2','6','3'),
GST_MAKE_FOURCC('D','I','V','X'),
GST_MAKE_FOURCC('X','V','I','D'),
GST_MAKE_FOURCC('3','I','V','1'),
0 /* end */
};
gint aud_list[] = {
GST_RIFF_WAVE_FORMAT_MPEGL3,
GST_RIFF_WAVE_FORMAT_MPEGL12,
GST_RIFF_WAVE_FORMAT_PCM,
GST_RIFF_WAVE_FORMAT_VORBIS1,
GST_RIFF_WAVE_FORMAT_A52,
GST_RIFF_WAVE_FORMAT_ALAW,
GST_RIFF_WAVE_FORMAT_MULAW,
-1 /* end */
};
if (!gst_library_load ("gstbytestream"))
return FALSE;
if (!gst_library_load ("gstriff"))
return FALSE;
if (!gst_library_load("gstvideo"))
return FALSE;
/* create an elementfactory for the avi_demux element */
factory = gst_element_factory_new ("avidemux", GST_TYPE_AVI_DEMUX,
&gst_avi_demux_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
for (i = 0; aud_list[i] != -1; i++) {
temp = gst_avi_demux_audio_caps (aud_list[i], NULL, NULL);
audcaps = gst_caps_append (audcaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
audcaps, NULL);
for (i = 0; vid_list[i] != 0; i++) {
temp = gst_avi_demux_video_caps (vid_list[i], NULL, NULL, NULL);
vidcaps = gst_caps_append (vidcaps, temp);
if (!gst_element_register (plugin, "avidemux", GST_RANK_PRIMARY,
GST_TYPE_AVI_DEMUX)) {
return FALSE;
}
vidcaps = gst_caps_append (vidcaps,
gst_avi_demux_iavs_caps ());
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
vidcaps, NULL);
gst_element_factory_add_pad_template (factory, audiosrctempl);
gst_element_factory_add_pad_template (factory, videosrctempl);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (sink_templ));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
if (!gst_element_register (plugin, "avimux", GST_RANK_PRIMARY,
GST_TYPE_AVIMUX)) {
return FALSE;
}
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"avidemux",
plugin_init
};
"avimux",
"AVI stream handling",
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -44,19 +44,6 @@
#define LE_FROM_GUINT32 GUINT32_FROM_LE
#endif
/* elementfactory information */
static GstElementDetails
gst_avimux_details =
{
"Avi multiplexer",
"Codec/Muxer",
"LGPL",
"Muxes audio and video into an avi stream",
VERSION,
"Ronald Bultje <rbultje@ronald.bitfreak.net>",
"(C) 2002",
};
/* AviMux signals and args */
enum {
/* FILL ME */
......@@ -202,6 +189,7 @@ GST_PAD_TEMPLATE_FACTORY (audio_sink_factory,
)
static void gst_avimux_base_init (gpointer g_class);
static void gst_avimux_class_init (GstAviMuxClass *klass);
static void gst_avimux_init (GstAviMux *avimux);
......@@ -232,7 +220,7 @@ gst_avimux_get_type (void)
if (!avimux_type) {
static const GTypeInfo avimux_info = {
sizeof(GstAviMuxClass),
NULL,
gst_avimux_base_init,
NULL,
(GClassInitFunc)gst_avimux_class_init,
NULL,
......@@ -246,6 +234,27 @@ gst_avimux_get_type (void)
return avimux_type;
}
static void
gst_avimux_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
static GstElementDetails gst_avimux_details = GST_ELEMENT_DETAILS (
"Avi multiplexer",
"Codec/Muxer",
"Muxes audio and video into an avi stream",
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
);
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (src_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (audio_sink_factory));
gst_element_class_add_pad_template (element_class,
GST_PAD_TEMPLATE_GET (video_sink_factory));
gst_element_class_set_details (element_class, &gst_avimux_details);
}
static void
gst_avimux_class_init (GstAviMuxClass *klass)
{
......@@ -1381,31 +1390,3 @@ gst_avimux_change_state (GstElement *element)
return GST_STATE_SUCCESS;
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
if (!gst_library_load("gstvideo"))
return FALSE;
/* create an elementfactory for the avimux element */
factory = gst_element_factory_new ("avimux", GST_TYPE_AVIMUX,
&gst_avimux_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (audio_sink_factory));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (video_sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"avimux",
plugin_init
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment