diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ext/ivorbis/vorbis.c | 10 | ||||
-rw-r--r-- | ext/ivorbis/vorbisenc.h | 2 | ||||
-rw-r--r-- | ext/ivorbis/vorbisfile.c | 165 |
4 files changed, 98 insertions, 86 deletions
@@ -1,3 +1,10 @@ +2003-12-27 Amaury Jacquot <sxpert@esitcom.org> + + * ext/ivorbis/vorbis.c: + * ext/ivorbis/vorbisenc.h: + * ext/ivorbis/vorbisfile.c: + Modify so that it uses the new caps things + 2003-12-27 Benjamin Otte <in7y118@public.uni-hamburg.de> * testsuite/spider/spider1.c: (main): diff --git a/ext/ivorbis/vorbis.c b/ext/ivorbis/vorbis.c index b104ec66..27087002 100644 --- a/ext/ivorbis/vorbis.c +++ b/ext/ivorbis/vorbis.c @@ -17,13 +17,11 @@ * Boston, MA 02111-1307, USA. */ -#include <string.h> -#include <gst/gst.h> -#include <tremor/ivorbiscodec.h> -#include <tremor/ivorbisfile.h> -#include <gst/bytestream/bytestream.h> - +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + +#include <vorbisenc.h> extern GType ivorbisfile_get_type(void); diff --git a/ext/ivorbis/vorbisenc.h b/ext/ivorbis/vorbisenc.h index d31d8374..60fdf670 100644 --- a/ext/ivorbis/vorbisenc.h +++ b/ext/ivorbis/vorbisenc.h @@ -24,7 +24,7 @@ #include <gst/gst.h> -#include <tremor/codec.h> +#include <tremor/ivorbiscodec.h> #ifdef __cplusplus extern "C" { diff --git a/ext/ivorbis/vorbisfile.c b/ext/ivorbis/vorbisfile.c index 8e0ee73e..548405a4 100644 --- a/ext/ivorbis/vorbisfile.c +++ b/ext/ivorbis/vorbisfile.c @@ -26,6 +26,9 @@ #include <tremor/ivorbisfile.h> #include <gst/bytestream/bytestream.h> +GST_DEBUG_CATEGORY_STATIC (ivorbisfile_debug); +#define GST_CAT_DEFAULT ivorbisfile_debug + #define GST_TYPE_IVORBISFILE \ (ivorbisfile_get_type()) #define GST_IVORBISFILE(obj) \ @@ -41,28 +44,29 @@ typedef struct _Ivorbisfile Ivorbisfile; typedef struct _IvorbisfileClass IvorbisfileClass; struct _Ivorbisfile { - GstElement element; + GstElement element; - GstPad *sinkpad,*srcpad; + GstPad *sinkpad, + *srcpad; GstByteStream *bs; OggVorbis_File vf; - gint current_link; - - gboolean restart; - gboolean need_discont; - gboolean eos; - gboolean seek_pending; - gint64 seek_value; - GstFormat seek_format; - gboolean seek_accurate; - - gboolean may_eos; - guint64 total_bytes; - guint64 offset; - - GstCaps *metadata; - GstCaps *streaminfo; + gint current_link; + + gboolean restart; + gboolean need_discont; + gboolean eos; + gboolean seek_pending; + gint64 seek_value; + GstFormat seek_format; + gboolean seek_accurate; + + gboolean may_eos; + guint64 total_bytes; + guint64 offset; + + GstCaps *metadata; + GstCaps *streaminfo; }; struct _IvorbisfileClass { @@ -81,7 +85,8 @@ GstElementDetails ivorbisfile_details = "Codec/Audio/Decoder", "Decodes OGG Vorbis audio using the Tremor vorbisfile API", "Monty <monty@xiph.org>\n" - "Wim Taymans <wim.taymans@chello.be>", + "Wim Taymans <wim.taymans@chello.be>\n" + "Amaury Jacquot <sxpert@esitcom.org>", }; /* Ivorbisfile signals and args */ @@ -144,48 +149,6 @@ static GstElementClass *parent_class = NULL; static GstFormat logical_stream_format; -static GstCaps* -vorbis_caps_factory (void) -{ - return - gst_caps_new ( - "tremor_tremor", - "application/ogg", - NULL); -} - -static GstCaps* -raw_caps_factory (void) -{ - return - gst_caps_new ( - "tremor_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 ( - "tremor_raw_float", - "audio/x-raw-float", - gst_props_new ( - "depth", GST_PROPS_INT (32), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT (2), /* ?? */ - NULL)); -} - GType ivorbisfile_get_type (void) { @@ -205,10 +168,52 @@ ivorbisfile_get_type (void) &ivorbisfile_info, 0); logical_stream_format = gst_format_register ("logical_stream", "The logical stream"); + + GST_DEBUG_CATEGORY_INIT (ivorbisfile_debug, "ivorbisfile", 0, + "vorbis in ogg decoding element (integer arithmetic)"); } return ivorbisfile_type; } +static GstCaps* +vorbis_caps_factory (void) +{ + return + gst_caps_new_simple ( + "application/ogg", + NULL); + +} + +static GstCaps* +raw_caps_factory (void) +{ + return + gst_caps_new_simple ( + "audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 11025, 48000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); +} + +static GstCaps* +raw_caps2_factory (void) +{ + return + gst_caps_new_simple ( + "audio/x-raw-float", + "depth", G_TYPE_INT, 32, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "rate", GST_TYPE_INT_RANGE, 11025, 48000, + "channels", G_TYPE_INT, 2, + NULL); +} + + static void gst_ivorbisfile_base_init (gpointer g_class) { @@ -222,12 +227,12 @@ gst_ivorbisfile_base_init (gpointer g_class) /* 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); + vorbis_caps); + gst_caps_append (raw_caps2, raw_caps); /* register src pads */ gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - raw_caps, NULL); + raw_caps2); 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, &ivorbisfile_details); @@ -420,6 +425,7 @@ ov_callbacks ivorbisfile_ov_callbacks = gst_ivorbisfile_tell, }; +#if 0 /* retrieve the comment field (or tags) and put in metadata GstCaps * returns TRUE if caps could be set, * FALSE if they couldn't be read somehow */ @@ -509,32 +515,33 @@ gst_ivorbisfile_update_streaminfo (Ivorbisfile *ivorbisfile, gint link) return TRUE; } +#endif static gboolean gst_ivorbisfile_new_link (Ivorbisfile *ivorbisfile, gint link) { vorbis_info *vi = ov_info (&ivorbisfile->vf, link); - GstCaps *newcaps; + GstCaps *caps; + gboolean res = TRUE; /* new logical bitstream */ ivorbisfile->current_link = link; - gst_ivorbisfile_update_metadata (ivorbisfile, link); - gst_ivorbisfile_update_streaminfo (ivorbisfile, link); - - newcaps = GST_CAPS_NEW ("vorbisdec_src", - "audio/x-raw-int", - "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 (vi->rate), - "channels", GST_PROPS_INT (vi->channels) - ); - if (gst_pad_try_set_caps (ivorbisfile->srcpad, newcaps) <= 0) { - return FALSE; + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, vi->rate, + "channels", G_TYPE_INT, vi->channels, + NULL); + + if (gst_pad_try_set_caps (ivorbisfile->srcpad, caps) <= 0) { + res = FALSE; } + gst_caps_free (caps); + return TRUE; } |