From dc967942797f8d709aa71204ca858688b4b76498 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 30 Jan 2002 10:20:58 +0000 Subject: [PATCH] taaz's virtual patch Original commit message from CVS: taaz's virtual patch --- gst/wavparse/gstwavparse.c | 146 ++++++++++++++++++------------------- gst/wavparse/gstwavparse.h | 48 ++++++------ 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index fc0e0984c6..d3e01f0333 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -22,15 +22,15 @@ #include -static void gst_parsewav_class_init (GstParseWavClass *klass); -static void gst_parsewav_init (GstParseWav *parsewav); +static void gst_wavparse_class_init (GstWavParseClass *klass); +static void gst_wavparse_init (GstWavParse *wavparse); static GstCaps* wav_typefind (GstBuffer *buf, gpointer private); -static void gst_parsewav_chain (GstPad *pad, GstBuffer *buf); +static void gst_wavparse_chain (GstPad *pad, GstBuffer *buf); /* elementfactory information */ -static GstElementDetails gst_parsewav_details = { +static GstElementDetails gst_wavparse_details = { ".wav parser", "Parser/Audio", "Parse a .wav file into raw audio", @@ -40,22 +40,22 @@ static GstElementDetails gst_parsewav_details = { }; GST_PADTEMPLATE_FACTORY (sink_template_factory, - "parsewav_sink", + "wavparse_sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_CAPS_NEW ( - "parsewav_wav", + "wavparse_wav", "audio/wav", NULL ) ) GST_PADTEMPLATE_FACTORY (src_template_factory, - "parsewav_src", + "wavparse_src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_NEW ( - "parsewav_raw", + "wavparse_raw", "audio/raw", "format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0), @@ -78,14 +78,14 @@ GST_PADTEMPLATE_FACTORY (src_template_factory, static GstTypeDefinition wavdefinition = { - "parsewav_audio/wav", + "wavparse_audio/wav", "audio/wav", ".wav", wav_typefind, }; -/* ParseWav signals and args */ +/* WavParse signals and args */ enum { /* FILL ME */ LAST_SIGNAL @@ -97,31 +97,31 @@ enum { }; static GstElementClass *parent_class = NULL; -//static guint gst_parsewav_signals[LAST_SIGNAL] = { 0 }; +//static guint gst_wavparse_signals[LAST_SIGNAL] = { 0 }; GType -gst_parsewav_get_type (void) +gst_wavparse_get_type (void) { - static GType parsewav_type = 0; + static GType wavparse_type = 0; - if (!parsewav_type) { - static const GTypeInfo parsewav_info = { - sizeof(GstParseWavClass), NULL, + if (!wavparse_type) { + static const GTypeInfo wavparse_info = { + sizeof(GstWavParseClass), NULL, NULL, - (GClassInitFunc) gst_parsewav_class_init, + (GClassInitFunc) gst_wavparse_class_init, NULL, NULL, - sizeof(GstParseWav), + sizeof(GstWavParse), 0, - (GInstanceInitFunc) gst_parsewav_init, + (GInstanceInitFunc) gst_wavparse_init, }; - parsewav_type = g_type_register_static (GST_TYPE_ELEMENT, "GstParseWav", &parsewav_info, 0); + wavparse_type = g_type_register_static (GST_TYPE_ELEMENT, "GstWavParse", &wavparse_info, 0); } - return parsewav_type; + return wavparse_type; } static void -gst_parsewav_class_init (GstParseWavClass *klass) +gst_wavparse_class_init (GstWavParseClass *klass) { GstElementClass *gstelement_class; @@ -131,22 +131,22 @@ gst_parsewav_class_init (GstParseWavClass *klass) } static void -gst_parsewav_init (GstParseWav *parsewav) +gst_wavparse_init (GstWavParse *wavparse) { - parsewav->sinkpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (sink_template_factory), "sink"); - gst_element_add_pad (GST_ELEMENT (parsewav), parsewav->sinkpad); - gst_pad_set_chain_function (parsewav->sinkpad, gst_parsewav_chain); + wavparse->sinkpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (sink_template_factory), "sink"); + gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->sinkpad); + gst_pad_set_chain_function (wavparse->sinkpad, gst_wavparse_chain); - parsewav->srcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (src_template_factory), "src"); - gst_element_add_pad (GST_ELEMENT (parsewav), parsewav->srcpad); + wavparse->srcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (src_template_factory), "src"); + gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->srcpad); - parsewav->riff = NULL; + wavparse->riff = NULL; - parsewav->state = GST_PARSEWAV_UNKNOWN; - parsewav->riff = NULL; - parsewav->riff_nextlikely = 0; - parsewav->size = 0; - parsewav->bps = 0; + wavparse->state = GST_WAVPARSE_UNKNOWN; + wavparse->riff = NULL; + wavparse->riff_nextlikely = 0; + wavparse->size = 0; + wavparse->bps = 0; } static GstCaps* @@ -162,9 +162,9 @@ wav_typefind (GstBuffer *buf, gpointer private) static void -gst_parsewav_chain (GstPad *pad, GstBuffer *buf) +gst_wavparse_chain (GstPad *pad, GstBuffer *buf) { - GstParseWav *parsewav; + GstWavParse *wavparse; gboolean buffer_riffed = FALSE; /* so we don't parse twice */ gchar *data; gulong size; @@ -174,29 +174,29 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) g_return_if_fail (buf != NULL); g_return_if_fail (GST_BUFFER_DATA (buf) != NULL); - parsewav = GST_PARSEWAV (gst_pad_get_parent (pad)); - GST_DEBUG (0, "gst_parsewav_chain: got buffer in '%s'\n", - gst_object_get_name (GST_OBJECT (parsewav))); + wavparse = GST_WAVPARSE (gst_pad_get_parent (pad)); + GST_DEBUG (0, "gst_wavparse_chain: got buffer in '%s'\n", + gst_object_get_name (GST_OBJECT (wavparse))); data = (guchar *) GST_BUFFER_DATA (buf); size = GST_BUFFER_SIZE (buf); /* walk through the states in priority order */ /* we're in the data region */ - if (parsewav->state == GST_PARSEWAV_DATA) { + if (wavparse->state == GST_WAVPARSE_DATA) { /* if we're expected to see a new chunk in this buffer */ - if ((parsewav->riff_nextlikely - GST_BUFFER_OFFSET (buf)) < GST_BUFFER_SIZE (buf)) { + if ((wavparse->riff_nextlikely - GST_BUFFER_OFFSET (buf)) < GST_BUFFER_SIZE (buf)) { - GST_BUFFER_SIZE (buf) = parsewav->riff_nextlikely - GST_BUFFER_OFFSET (buf); + GST_BUFFER_SIZE (buf) = wavparse->riff_nextlikely - GST_BUFFER_OFFSET (buf); - parsewav->state = GST_PARSEWAV_OTHER; + wavparse->state = GST_WAVPARSE_OTHER; /* I suppose we could signal an EOF at this point, but that may be premature. We've stopped data flow, that's the main thing. */ } - gst_pad_push (parsewav->srcpad, buf); + gst_pad_push (wavparse->srcpad, buf); return; } - if (parsewav->state == GST_PARSEWAV_OTHER) { + if (wavparse->state == GST_WAVPARSE_OTHER) { GST_DEBUG (0, "we're in unknown territory here, not passing on\n"); return; } @@ -207,16 +207,16 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) fmt, data) will fire in sequence, as they should */ /* we're in null state now, look for the RIFF header, start parsing */ - if (parsewav->state == GST_PARSEWAV_UNKNOWN) { + if (wavparse->state == GST_WAVPARSE_UNKNOWN) { gint retval; - GST_DEBUG (0, "GstParseWav: checking for RIFF format\n"); + GST_DEBUG (0, "GstWavParse: checking for RIFF format\n"); /* create a new RIFF parser */ - parsewav->riff = gst_riff_new (); + wavparse->riff = gst_riff_new (); /* give it the current buffer to start parsing */ - retval = gst_riff_next_buffer (parsewav->riff, buf, 0); + retval = gst_riff_next_buffer (wavparse->riff, buf, 0); buffer_riffed = TRUE; if (retval < 0) { GST_DEBUG (0, "sorry, isn't RIFF\n"); @@ -224,41 +224,41 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) } /* this has to be a file of form WAVE for us to deal with it */ - if (parsewav->riff->form != gst_riff_fourcc_to_id ("WAVE")) { + if (wavparse->riff->form != gst_riff_fourcc_to_id ("WAVE")) { GST_DEBUG (0, "sorry, isn't WAVE\n"); return; } /* at this point we're waiting for the 'fmt ' chunk */ - parsewav->state = GST_PARSEWAV_CHUNK_FMT; + wavparse->state = GST_WAVPARSE_CHUNK_FMT; } /* we're now looking for the 'fmt ' chunk to get the audio info */ - if (parsewav->state == GST_PARSEWAV_CHUNK_FMT) { + if (wavparse->state == GST_WAVPARSE_CHUNK_FMT) { GstRiffChunk *fmt; - GstParseWavFormat *format; + GstWavParseFormat *format; - GST_DEBUG (0, "GstParseWav: looking for fmt chunk\n"); + GST_DEBUG (0, "GstWavParse: looking for fmt chunk\n"); /* there's a good possibility we may not have parsed this buffer */ if (buffer_riffed == FALSE) { - gst_riff_next_buffer (parsewav->riff, buf, GST_BUFFER_OFFSET (buf)); + gst_riff_next_buffer (wavparse->riff, buf, GST_BUFFER_OFFSET (buf)); buffer_riffed = TRUE; } /* see if the fmt chunk is available yet */ - fmt = gst_riff_get_chunk (parsewav->riff, "fmt "); + fmt = gst_riff_get_chunk (wavparse->riff, "fmt "); /* if we've got something, deal with it */ if (fmt != NULL) { /* we can gather format information now */ - format = (GstParseWavFormat *)((guchar *) GST_BUFFER_DATA (buf) + fmt->offset); + format = (GstWavParseFormat *)((guchar *) GST_BUFFER_DATA (buf) + fmt->offset); /* set the caps on the src pad */ - gst_pad_try_set_caps (parsewav->srcpad, + gst_pad_try_set_caps (wavparse->srcpad, GST_CAPS_NEW ( - "parsewav_src", + "wavparse_src", "audio/raw", "format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0), //FIXME @@ -270,12 +270,12 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) "channels", GST_PROPS_INT (format->wChannels) )); - parsewav->bps = format->wBlockAlign; + wavparse->bps = format->wBlockAlign; GST_DEBUG (0, "frequency %d, channels %d\n", format->dwSamplesPerSec, format->wChannels); /* we're now looking for the data chunk */ - parsewav->state = GST_PARSEWAV_CHUNK_DATA; + wavparse->state = GST_WAVPARSE_CHUNK_DATA; } else { /* otherwise we just sort of give up for this buffer */ gst_buffer_unref (buf); @@ -284,19 +284,19 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) } /* now we look for the data chunk */ - if (parsewav->state == GST_PARSEWAV_CHUNK_DATA) { + if (wavparse->state == GST_WAVPARSE_CHUNK_DATA) { GstBuffer *newbuf; GstRiffChunk *datachunk; - GST_DEBUG (0, "GstParseWav: looking for data chunk\n"); + GST_DEBUG (0, "GstWavParse: looking for data chunk\n"); /* again, we might need to parse the buffer */ if (buffer_riffed == FALSE) { - gst_riff_next_buffer (parsewav->riff, buf, GST_BUFFER_OFFSET (buf)); + gst_riff_next_buffer (wavparse->riff, buf, GST_BUFFER_OFFSET (buf)); buffer_riffed = TRUE; } - datachunk = gst_riff_get_chunk (parsewav->riff, "data"); + datachunk = gst_riff_get_chunk (wavparse->riff, "data"); if (datachunk != NULL) { gulong subsize; @@ -304,7 +304,7 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) GST_DEBUG (0, "data begins at %ld\n", datachunk->offset); /* at this point we can ACK that we have data */ - parsewav->state = GST_PARSEWAV_DATA; + wavparse->state = GST_WAVPARSE_DATA; /* now we construct a new buffer for the remainder */ subsize = size - datachunk->offset; @@ -318,13 +318,13 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) gst_buffer_unref (buf); - gst_pad_push (parsewav->srcpad, newbuf); + gst_pad_push (wavparse->srcpad, newbuf); /* now we're ready to go, the next buffer should start data */ - parsewav->state = GST_PARSEWAV_DATA; + wavparse->state = GST_WAVPARSE_DATA; /* however, we may be expecting another chunk at some point */ - parsewav->riff_nextlikely = gst_riff_get_nextlikely (parsewav->riff); + wavparse->riff_nextlikely = gst_riff_get_nextlikely (wavparse->riff); } else { /* otherwise we just sort of give up for this buffer */ gst_buffer_unref (buf); @@ -340,9 +340,9 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; - /* create an elementfactory for the parsewav element */ - factory = gst_elementfactory_new ("parsewav", GST_TYPE_PARSEWAV, - &gst_parsewav_details); + /* create an elementfactory for the wavparse element */ + factory = gst_elementfactory_new ("wavparse", GST_TYPE_WAVPARSE, + &gst_wavparse_details); g_return_val_if_fail(factory != NULL, FALSE); /* register src pads */ @@ -360,6 +360,6 @@ plugin_init (GModule *module, GstPlugin *plugin) GstPluginDesc plugin_desc = { GST_VERSION_MAJOR, GST_VERSION_MINOR, - "parsewav", + "wavparse", plugin_init }; diff --git a/gst/wavparse/gstwavparse.h b/gst/wavparse/gstwavparse.h index 55cb4913c3..d6c94e3164 100644 --- a/gst/wavparse/gstwavparse.h +++ b/gst/wavparse/gstwavparse.h @@ -18,8 +18,8 @@ */ -#ifndef __GST_PARSEWAV_H__ -#define __GST_PARSEWAV_H__ +#ifndef __GST_WAVPARSE_H__ +#define __GST_WAVPARSE_H__ #include @@ -32,28 +32,28 @@ extern "C" { #endif /* __cplusplus */ -#define GST_TYPE_PARSEWAV \ - (gst_parsewav_get_type()) -#define GST_PARSEWAV(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PARSEWAV,GstParseWav)) -#define GST_PARSEWAV_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PARSEWAV,GstParseWav)) -#define GST_IS_PARSEWAV(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PARSEWAV)) -#define GST_IS_PARSEWAV_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PARSEWAV)) +#define GST_TYPE_WAVPARSE \ + (gst_wavparse_get_type()) +#define GST_WAVPARSE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WAVPARSE,GstWavParse)) +#define GST_WAVPARSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WAVPARSE,GstWavParse)) +#define GST_IS_WAVPARSE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WAVPARSE)) +#define GST_IS_WAVPARSE_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WAVPARSE)) -#define GST_PARSEWAV_UNKNOWN 0 /* initialized state */ -#define GST_PARSEWAV_CHUNK_FMT 1 /* searching for fmt */ -#define GST_PARSEWAV_CHUNK_DATA 2 /* searching for data */ -#define GST_PARSEWAV_DATA 3 /* in data region */ -#define GST_PARSEWAV_OTHER 4 /* in unknown region */ +#define GST_WAVPARSE_UNKNOWN 0 /* initialized state */ +#define GST_WAVPARSE_CHUNK_FMT 1 /* searching for fmt */ +#define GST_WAVPARSE_CHUNK_DATA 2 /* searching for data */ +#define GST_WAVPARSE_DATA 3 /* in data region */ +#define GST_WAVPARSE_OTHER 4 /* in unknown region */ -typedef struct _GstParseWav GstParseWav; -typedef struct _GstParseWavClass GstParseWavClass; +typedef struct _GstWavParse GstWavParse; +typedef struct _GstWavParseClass GstWavParseClass; -struct _GstParseWav { +struct _GstWavParse { GstElement element; /* pads */ @@ -74,15 +74,15 @@ struct _GstParseWav { }; -struct _GstParseWavClass { +struct _GstWavParseClass { GstElementClass parent_class; }; -GType gst_parsewav_get_type(void); +GType gst_wavparse_get_type(void); -typedef struct _GstParseWavFormat GstParseWavFormat; +typedef struct _GstWavParseFormat GstWavParseFormat; -struct _GstParseWavFormat { +struct _GstWavParseFormat { gint16 wFormatTag; guint16 wChannels; guint32 dwSamplesPerSec;