2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 /*#define GST_DEBUG_ENABLED */
24 #include "gstaviaudiodecoder.h"
28 /* elementfactory information */
29 static GstElementDetails gst_avi_audio_decoder_details = {
33 "Parse a .avi file into audio and video",
35 "Erik Walthinsen <omega@cse.ogi.edu>\n"
36 "Wim Taymans <wim.taymans@tvd.be>",
40 /* AviAudioDecoder signals and args */
51 GST_PAD_TEMPLATE_FACTORY (sink_templ,
58 "format", GST_PROPS_STRING ("strf_auds")
62 GST_PAD_TEMPLATE_FACTORY (src_audio_templ,
69 "format", GST_PROPS_STRING ("int"),
70 "law", GST_PROPS_INT (0),
71 "endianness", GST_PROPS_INT (G_BYTE_ORDER),
72 "signed", GST_PROPS_BOOLEAN (TRUE),
73 "width", GST_PROPS_INT (16),
74 "depth", GST_PROPS_INT (16),
75 "rate", GST_PROPS_INT_RANGE (11025, 44100),
76 "channels", GST_PROPS_INT_RANGE (1, 2)
80 static void gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass);
81 static void gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder);
83 static void gst_avi_audio_decoder_chain (GstPad *pad, GstBuffer *buf);
85 static void gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
89 static GstElementClass *parent_class = NULL;
90 /*static guint gst_avi_audio_decoder_signals[LAST_SIGNAL] = { 0 }; */
93 gst_avi_audio_decoder_get_type(void)
95 static GType avi_audio_decoder_type = 0;
97 if (!avi_audio_decoder_type) {
98 static const GTypeInfo avi_audio_decoder_info = {
99 sizeof(GstAviAudioDecoderClass),
102 (GClassInitFunc)gst_avi_audio_decoder_class_init,
105 sizeof(GstAviAudioDecoder),
107 (GInstanceInitFunc)gst_avi_audio_decoder_init,
109 avi_audio_decoder_type = g_type_register_static(GST_TYPE_ELEMENT, "GstAviAudioDecoder", &avi_audio_decoder_info, 0);
111 return avi_audio_decoder_type;
115 gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass)
117 GObjectClass *gobject_class;
118 GstElementClass *gstelement_class;
120 gobject_class = (GObjectClass*)klass;
121 gstelement_class = (GstElementClass*)klass;
123 parent_class = g_type_class_ref (GST_TYPE_BIN);
125 gobject_class->get_property = gst_avi_audio_decoder_get_property;
129 gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder)
134 gst_avi_audio_decoder_chain (GstPad *pad,
137 GstAviAudioDecoder *avi_audio_decoder;
141 g_return_if_fail (pad != NULL);
142 g_return_if_fail (GST_IS_PAD(pad));
143 g_return_if_fail (buf != NULL);
144 g_return_if_fail (GST_BUFFER_DATA(buf) != NULL);
146 avi_audio_decoder = GST_AVI_AUDIO_DECODER (gst_pad_get_parent (pad));
147 GST_DEBUG (0,"gst_avi_audio_decoder_chain: got buffer in %u", GST_BUFFER_OFFSET (buf));
148 g_print ("gst_avi_audio_decoder_chain: got buffer in %u\n", GST_BUFFER_OFFSET (buf));
149 data = (guchar *)GST_BUFFER_DATA (buf);
150 size = GST_BUFFER_SIZE (buf);
152 gst_buffer_unref (buf);
156 gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
158 GstAviAudioDecoder *src;
160 g_return_if_fail (GST_IS_AVI_AUDIO_DECODER (object));
162 src = GST_AVI_AUDIO_DECODER (object);
166 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
173 plugin_init (GModule *module, GstPlugin *plugin)
175 GstElementFactory *factory;
177 /* create an elementfactory for the avi_audio_decoder element */
178 factory = gst_element_factory_new ("aviaudiodecoder",GST_TYPE_AVI_AUDIO_DECODER,
179 &gst_avi_audio_decoder_details);
180 g_return_val_if_fail (factory != NULL, FALSE);
181 gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
183 gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
184 gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_audio_templ));
186 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
191 GstPluginDesc plugin_desc = {