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 = {
32 "Parse a .avi file into audio and video",
34 "Erik Walthinsen <omega@cse.ogi.edu>\n"
35 "Wim Taymans <wim.taymans@tvd.be>",
39 /* AviAudioDecoder signals and args */
50 GST_PADTEMPLATE_FACTORY (sink_templ,
57 "format", GST_PROPS_STRING ("strf_auds")
61 GST_PADTEMPLATE_FACTORY (src_audio_templ,
68 "format", GST_PROPS_STRING ("int"),
69 "law", GST_PROPS_INT (0),
70 "endianness", GST_PROPS_INT (G_BYTE_ORDER),
71 "signed", GST_PROPS_BOOLEAN (TRUE),
72 "width", GST_PROPS_INT (16),
73 "depth", GST_PROPS_INT (16),
74 "rate", GST_PROPS_INT_RANGE (11025, 44100),
75 "channels", GST_PROPS_INT_RANGE (1, 2)
79 static void gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass);
80 static void gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder);
82 static void gst_avi_audio_decoder_chain (GstPad *pad, GstBuffer *buf);
84 static void gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
88 static GstElementClass *parent_class = NULL;
89 //static guint gst_avi_audio_decoder_signals[LAST_SIGNAL] = { 0 };
92 gst_avi_audio_decoder_get_type(void)
94 static GType avi_audio_decoder_type = 0;
96 if (!avi_audio_decoder_type) {
97 static const GTypeInfo avi_audio_decoder_info = {
98 sizeof(GstAviAudioDecoderClass),
101 (GClassInitFunc)gst_avi_audio_decoder_class_init,
104 sizeof(GstAviAudioDecoder),
106 (GInstanceInitFunc)gst_avi_audio_decoder_init,
108 avi_audio_decoder_type = g_type_register_static(GST_TYPE_ELEMENT, "GstAviAudioDecoder", &avi_audio_decoder_info, 0);
110 return avi_audio_decoder_type;
114 gst_avi_audio_decoder_class_init (GstAviAudioDecoderClass *klass)
116 GObjectClass *gobject_class;
117 GstElementClass *gstelement_class;
119 gobject_class = (GObjectClass*)klass;
120 gstelement_class = (GstElementClass*)klass;
122 parent_class = g_type_class_ref (GST_TYPE_BIN);
124 gobject_class->get_property = gst_avi_audio_decoder_get_property;
128 gst_avi_audio_decoder_init (GstAviAudioDecoder *avi_audio_decoder)
133 gst_avi_audio_decoder_chain (GstPad *pad,
136 GstAviAudioDecoder *avi_audio_decoder;
140 g_return_if_fail (pad != NULL);
141 g_return_if_fail (GST_IS_PAD(pad));
142 g_return_if_fail (buf != NULL);
143 g_return_if_fail (GST_BUFFER_DATA(buf) != NULL);
145 avi_audio_decoder = GST_AVI_AUDIO_DECODER (gst_pad_get_parent (pad));
146 GST_DEBUG (0,"gst_avi_audio_decoder_chain: got buffer in %u\n", GST_BUFFER_OFFSET (buf));
147 g_print ("gst_avi_audio_decoder_chain: got buffer in %u\n", GST_BUFFER_OFFSET (buf));
148 data = (guchar *)GST_BUFFER_DATA (buf);
149 size = GST_BUFFER_SIZE (buf);
151 gst_buffer_unref (buf);
155 gst_avi_audio_decoder_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
157 GstAviAudioDecoder *src;
159 g_return_if_fail (GST_IS_AVI_AUDIO_DECODER (object));
161 src = GST_AVI_AUDIO_DECODER (object);
165 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
172 plugin_init (GModule *module, GstPlugin *plugin)
174 GstElementFactory *factory;
176 /* create an elementfactory for the avi_audio_decoder element */
177 factory = gst_elementfactory_new ("aviaudiodecoder",GST_TYPE_AVI_AUDIO_DECODER,
178 &gst_avi_audio_decoder_details);
179 g_return_val_if_fail (factory != NULL, FALSE);
181 gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sink_templ));
182 gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (src_audio_templ));
184 gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
189 GstPluginDesc plugin_desc = {