Vorbis compiles once more

Original commit message from CVS:
Vorbis compiles once more
This commit is contained in:
Iain Holmes 2003-11-02 02:20:36 +00:00
parent a61b34b883
commit 87d8e8b181
3 changed files with 133 additions and 110 deletions

View file

@ -22,117 +22,30 @@
extern GType vorbisfile_get_type(void);
extern GstElementDetails vorbisfile_details;
extern GstElementDetails vorbisenc_details;
GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
GstPadTemplate *gst_vorbisenc_src_template, *gst_vorbisenc_sink_template;
static GstCaps*
vorbis_caps_factory (void)
{
return
gst_caps_new (
"vorbis_vorbis",
"application/ogg",
NULL);
}
static GstCaps*
raw_caps_factory (void)
{
return
gst_caps_new (
"vorbis_raw",
"audio/x-raw-int",
gst_props_new (
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}
static GstCaps*
raw_caps2_factory (void)
{
return
gst_caps_new (
"vorbis_raw_float",
"audio/x-raw-float",
gst_props_new (
"width", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
"buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),
NULL));
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
GstElementFactory *enc, *file;
GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
if (!gst_library_load ("gstbytestream"))
return FALSE;
gst_plugin_set_longname (plugin, "The OGG Vorbis Codec");
if (!gst_element_register (plugin, "vorbisenc", GST_RANK_NONE, GST_TYPE_VORBISENC))
return FALSE;
/* create an elementfactory for the vorbisenc element */
enc = gst_element_factory_new ("vorbisenc", GST_TYPE_VORBISENC,
&vorbisenc_details);
g_return_val_if_fail (enc != NULL, FALSE);
raw_caps = raw_caps_factory ();
raw_caps2 = raw_caps2_factory ();
vorbis_caps = vorbis_caps_factory ();
/* register sink pads */
gst_vorbisenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_factory_add_pad_template (enc, gst_vorbisenc_sink_template);
/* register src pads */
gst_vorbisenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
vorbis_caps, NULL);
gst_element_factory_add_pad_template (enc, gst_vorbisenc_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
/* register sink pads */
gst_vorbisdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
vorbis_caps, NULL);
raw_caps = gst_caps_prepend (raw_caps, raw_caps2);
/* register src pads */
gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
/* create an elementfactory for the vorbisfile element */
file = gst_element_factory_new ("vorbisfile", vorbisfile_get_type(),
&vorbisfile_details);
g_return_val_if_fail(file != NULL, FALSE);
gst_element_factory_set_rank (file, GST_ELEMENT_RANK_PRIMARY);
/* register sink pads */
gst_element_factory_add_pad_template (file, gst_vorbisdec_sink_template);
/* register src pads */
gst_element_factory_add_pad_template (file, gst_vorbisdec_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (file));
if (!gst_element_register (plugin, "vorbisfile", GST_RANK_PRIMARY, vorbisfile_get_type ()))
return FALSE;
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"vorbis",
plugin_init
};
"Vorbis plugin library",
plugin_init,
VERSION,
"LGPL",
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN)

View file

@ -28,18 +28,15 @@
#include "vorbisenc.h"
extern GstPadTemplate *gst_vorbisenc_src_template, *gst_vorbisenc_sink_template;
static GstPadTemplate *gst_vorbisenc_src_template, *gst_vorbisenc_sink_template;
/* elementfactory information */
GstElementDetails vorbisenc_details = {
"Ogg Vorbis encoder",
"Codec/Audio/Encoder",
"LGPL",
"Encodes audio in OGG Vorbis format",
VERSION,
"Monty <monty@xiph.org>, "
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
};
/* VorbisEnc signals and args */
@ -85,6 +82,7 @@ gst_vorbisenc_get_formats (GstPad *pad)
#define MIN_BITRATE_DEFAULT -1
#define QUALITY_DEFAULT 0.3
static void gst_vorbisenc_base_init (gpointer g_class);
static void gst_vorbisenc_class_init (VorbisEncClass *klass);
static void gst_vorbisenc_init (VorbisEnc *vorbisenc);
@ -109,7 +107,7 @@ vorbisenc_get_type (void)
if (!vorbisenc_type) {
static const GTypeInfo vorbisenc_info = {
sizeof (VorbisEncClass),
NULL,
gst_vorbisenc_base_init,
NULL,
(GClassInitFunc) gst_vorbisenc_class_init,
NULL,
@ -124,6 +122,53 @@ vorbisenc_get_type (void)
return vorbisenc_type;
}
static GstCaps*
vorbis_caps_factory (void)
{
return
gst_caps_new (
"vorbis_vorbis",
"application/ogg",
NULL);
}
static GstCaps*
raw_caps_factory (void)
{
return
gst_caps_new (
"vorbis_raw",
"audio/x-raw-int",
gst_props_new (
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}
static void
gst_vorbisenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *vorbis_caps;
raw_caps = raw_caps_factory ();
vorbis_caps = vorbis_caps_factory ();
gst_vorbisenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_vorbisenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
vorbis_caps, NULL);
gst_element_class_add_pad_template (element_class, gst_vorbisenc_sink_template);
gst_element_class_add_pad_template (element_class, gst_vorbisenc_src_template);
gst_element_class_set_details (element_class, &vorbisenc_details);
}
static void
gst_vorbisenc_class_init (VorbisEncClass * klass)
{

View file

@ -77,19 +77,16 @@ struct _VorbisFileClass {
GType vorbisfile_get_type (void);
extern GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
/* elementfactory information */
GstElementDetails vorbisfile_details =
{
"Ogg Vorbis decoder",
"Codec/Audio/Decoder",
"LGPL",
"Decodes OGG Vorbis audio using the vorbisfile API",
VERSION,
"Monty <monty@xiph.org>, "
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2000",
};
/* VorbisFile signals and args */
@ -108,6 +105,7 @@ enum
ARG_STREAMINFO
};
static void gst_vorbisfile_base_init (gpointer g_class);
static void
gst_vorbisfile_class_init (VorbisFileClass *klass);
static void gst_vorbisfile_init (VorbisFile *vorbisfile);
@ -161,7 +159,9 @@ vorbisfile_get_type (void)
if (!vorbisfile_type) {
static const GTypeInfo vorbisfile_info = {
sizeof (VorbisFileClass), NULL, NULL,
sizeof (VorbisFileClass),
gst_vorbisfile_base_init,
NULL,
(GClassInitFunc) gst_vorbisfile_class_init, NULL, NULL,
sizeof (VorbisFile), 0,
(GInstanceInitFunc) gst_vorbisfile_init,
@ -177,6 +177,71 @@ vorbisfile_get_type (void)
return vorbisfile_type;
}
static GstCaps*
vorbis_caps_factory (void)
{
return
gst_caps_new (
"vorbis_vorbis",
"application/ogg",
NULL);
}
static GstCaps*
raw_caps_factory (void)
{
return
gst_caps_new (
"vorbis_raw",
"audio/x-raw-int",
gst_props_new (
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}
static GstCaps*
raw_caps2_factory (void)
{
return
gst_caps_new (
"vorbis_raw_float",
"audio/x-raw-float",
gst_props_new (
"width", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
"buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),
NULL));
}
static void
gst_vorbisfile_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
raw_caps = raw_caps_factory ();
raw_caps2 = raw_caps2_factory ();
vorbis_caps = vorbis_caps_factory ();
gst_vorbisdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
vorbis_caps, NULL);
raw_caps = gst_caps_prepend (raw_caps, raw_caps2);
gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
raw_caps, NULL);
gst_element_class_add_pad_template (element_class, gst_vorbisdec_sink_template);
gst_element_class_add_pad_template (element_class, gst_vorbisdec_src_template);
gst_element_class_set_details (element_class, &vorbisfile_details);
}
static void
gst_vorbisfile_class_init (VorbisFileClass * klass)
{