aiff: gratuitious clean-ups: canonicalise function names, structs and defines

This commit is contained in:
Tim-Philipp Müller 2009-10-31 19:37:08 +00:00
parent d65d288844
commit 57cce4754c
4 changed files with 158 additions and 159 deletions

View file

@ -49,7 +49,7 @@ plugin_init (GstPlugin * plugin)
#endif #endif
ret = gst_element_register (plugin, "aiffparse", GST_RANK_PRIMARY, ret = gst_element_register (plugin, "aiffparse", GST_RANK_PRIMARY,
TYPE_AIFFPARSE); GST_TYPE_AIFF_PARSE);
ret &= gst_element_register (plugin, "aiffmux", GST_RANK_NONE, ret &= gst_element_register (plugin, "aiffmux", GST_RANK_NONE,
GST_TYPE_AIFF_MUX); GST_TYPE_AIFF_MUX);

View file

@ -107,9 +107,8 @@ gst_aiff_mux_base_init (gpointer gclass)
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
gst_element_class_set_details_simple (element_class, gst_element_class_set_details_simple (element_class,
"Audio Interchange File Format multiplexer", "AIFF audio muxer", "Muxer/Audio", "Multiplex raw audio into AIFF",
"Muxer/Audio", "Robert Swain <robert.swain@gmail.com>");
"Multiplex raw audio into AIFF", "Robert Swain <robert.swain@gmail.com>");
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory)); gst_static_pad_template_get (&src_factory));

View file

@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ /* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* GStreamer /* GStreamer AIFF parser
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* <2006> Nokia Corporation, Stefan Kost <stefan.kost@nokia.com>. * <2006> Nokia Corporation, Stefan Kost <stefan.kost@nokia.com>.
* <2008> Pioneers of the Inevitable <songbird@songbirdnest.com> * <2008> Pioneers of the Inevitable <songbird@songbirdnest.com>
@ -59,34 +59,28 @@
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#include <gst/gst-i18n-plugin.h> #include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY (aiffparse_debug); GST_DEBUG_CATEGORY (aiff_parse_debug);
#define GST_CAT_DEFAULT (aiffparse_debug) #define GST_CAT_DEFAULT (aiff_parse_debug)
static void gst_aiffparse_dispose (GObject * object); static void gst_aiff_parse_dispose (GObject * object);
static gboolean gst_aiffparse_sink_activate (GstPad * sinkpad); static gboolean gst_aiff_parse_sink_activate (GstPad * sinkpad);
static gboolean gst_aiffparse_sink_activate_pull (GstPad * sinkpad, static gboolean gst_aiff_parse_sink_activate_pull (GstPad * sinkpad,
gboolean active); gboolean active);
static gboolean gst_aiffparse_send_event (GstElement * element, static gboolean gst_aiff_parse_send_event (GstElement * element,
GstEvent * event); GstEvent * event);
static GstStateChangeReturn gst_aiffparse_change_state (GstElement * element, static GstStateChangeReturn gst_aiff_parse_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static const GstQueryType *gst_aiffparse_get_query_types (GstPad * pad); static const GstQueryType *gst_aiff_parse_get_query_types (GstPad * pad);
static gboolean gst_aiffparse_pad_query (GstPad * pad, GstQuery * query); static gboolean gst_aiff_parse_pad_query (GstPad * pad, GstQuery * query);
static gboolean gst_aiffparse_pad_convert (GstPad * pad, static gboolean gst_aiff_parse_pad_convert (GstPad * pad,
GstFormat src_format, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value); gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
static GstFlowReturn gst_aiffparse_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_aiff_parse_chain (GstPad * pad, GstBuffer * buf);
static void gst_aiffparse_loop (GstPad * pad); static void gst_aiff_parse_loop (GstPad * pad);
static gboolean gst_aiffparse_srcpad_event (GstPad * pad, GstEvent * event); static gboolean gst_aiff_parse_srcpad_event (GstPad * pad, GstEvent * event);
static const GstElementDetails gst_aiffparse_details =
GST_ELEMENT_DETAILS ("AIFF audio demuxer",
"Codec/Demuxer/Audio",
"Parse a .aiff file into raw audio",
"Pioneers of the Inevitable <songbird@songbirdnest.com>");
static GstStaticPadTemplate sink_template_factory = static GstStaticPadTemplate sink_template_factory =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
@ -102,23 +96,26 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS) GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
); );
GST_BOILERPLATE (AIFFParse, gst_aiffparse, GstElement, GST_TYPE_ELEMENT); GST_BOILERPLATE (GstAiffParse, gst_aiff_parse, GstElement, GST_TYPE_ELEMENT);
static void static void
gst_aiffparse_base_init (gpointer g_class) gst_aiff_parse_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register pads */
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template_factory)); gst_static_pad_template_get (&sink_template_factory));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template_factory)); gst_static_pad_template_get (&src_template_factory));
gst_element_class_set_details (element_class, &gst_aiffparse_details); gst_element_class_set_details_simple (element_class,
"AIFF audio demuxer", "Codec/Demuxer/Audio",
"Parse a .aiff file into raw audio",
"Pioneers of the Inevitable <songbird@songbirdnest.com>");
} }
static void static void
gst_aiffparse_class_init (AIFFParseClass * klass) gst_aiff_parse_class_init (GstAiffParseClass * klass)
{ {
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
GObjectClass *object_class; GObjectClass *object_class;
@ -128,16 +125,17 @@ gst_aiffparse_class_init (AIFFParseClass * klass)
parent_class = g_type_class_peek_parent (klass); parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gst_aiffparse_dispose; object_class->dispose = gst_aiff_parse_dispose;
gstelement_class->change_state = gst_aiffparse_change_state; gstelement_class->change_state =
gstelement_class->send_event = gst_aiffparse_send_event; GST_DEBUG_FUNCPTR (gst_aiff_parse_change_state);
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_aiff_parse_send_event);
} }
static void static void
gst_aiffparse_reset (AIFFParse * aiff) gst_aiff_parse_reset (GstAiffParse * aiff)
{ {
aiff->state = AIFFPARSE_START; aiff->state = AIFF_PARSE_START;
/* These will all be set correctly in the fmt chunk */ /* These will all be set correctly in the fmt chunk */
aiff->rate = 0; aiff->rate = 0;
@ -167,30 +165,30 @@ gst_aiffparse_reset (AIFFParse * aiff)
} }
static void static void
gst_aiffparse_dispose (GObject * object) gst_aiff_parse_dispose (GObject * object)
{ {
AIFFParse *aiff = AIFFPARSE (object); GstAiffParse *aiff = GST_AIFF_PARSE (object);
GST_DEBUG_OBJECT (aiff, "AIFF: Dispose"); GST_DEBUG_OBJECT (aiff, "AIFF: Dispose");
gst_aiffparse_reset (aiff); gst_aiff_parse_reset (aiff);
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
static void static void
gst_aiffparse_init (AIFFParse * aiffparse, AIFFParseClass * g_class) gst_aiff_parse_init (GstAiffParse * aiffparse, GstAiffParseClass * g_class)
{ {
gst_aiffparse_reset (aiffparse); gst_aiff_parse_reset (aiffparse);
/* sink */ /* sink */
aiffparse->sinkpad = aiffparse->sinkpad =
gst_pad_new_from_static_template (&sink_template_factory, "sink"); gst_pad_new_from_static_template (&sink_template_factory, "sink");
gst_pad_set_activate_function (aiffparse->sinkpad, gst_pad_set_activate_function (aiffparse->sinkpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_sink_activate)); GST_DEBUG_FUNCPTR (gst_aiff_parse_sink_activate));
gst_pad_set_activatepull_function (aiffparse->sinkpad, gst_pad_set_activatepull_function (aiffparse->sinkpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_sink_activate_pull)); GST_DEBUG_FUNCPTR (gst_aiff_parse_sink_activate_pull));
gst_pad_set_chain_function (aiffparse->sinkpad, gst_pad_set_chain_function (aiffparse->sinkpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_chain)); GST_DEBUG_FUNCPTR (gst_aiff_parse_chain));
gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->sinkpad); gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->sinkpad);
/* source */ /* source */
@ -198,11 +196,11 @@ gst_aiffparse_init (AIFFParse * aiffparse, AIFFParseClass * g_class)
gst_pad_new_from_static_template (&src_template_factory, "src"); gst_pad_new_from_static_template (&src_template_factory, "src");
gst_pad_use_fixed_caps (aiffparse->srcpad); gst_pad_use_fixed_caps (aiffparse->srcpad);
gst_pad_set_query_type_function (aiffparse->srcpad, gst_pad_set_query_type_function (aiffparse->srcpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_get_query_types)); GST_DEBUG_FUNCPTR (gst_aiff_parse_get_query_types));
gst_pad_set_query_function (aiffparse->srcpad, gst_pad_set_query_function (aiffparse->srcpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_pad_query)); GST_DEBUG_FUNCPTR (gst_aiff_parse_pad_query));
gst_pad_set_event_function (aiffparse->srcpad, gst_pad_set_event_function (aiffparse->srcpad,
GST_DEBUG_FUNCPTR (gst_aiffparse_srcpad_event)); GST_DEBUG_FUNCPTR (gst_aiff_parse_srcpad_event));
gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->srcpad); gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->srcpad);
} }
@ -226,7 +224,7 @@ uint64_ceiling_scale (guint64 val, guint64 num, guint64 denom)
static gboolean static gboolean
gst_aiffparse_parse_file_header (AIFFParse * aiff, GstBuffer * buf) gst_aiff_parse_parse_file_header (GstAiffParse * aiff, GstBuffer * buf)
{ {
guint8 *data; guint8 *data;
guint32 header, type = 0; guint32 header, type = 0;
@ -266,7 +264,7 @@ not_aiff:
} }
static GstFlowReturn static GstFlowReturn
gst_aiffparse_stream_init (AIFFParse * aiff) gst_aiff_parse_stream_init (GstAiffParse * aiff)
{ {
GstFlowReturn res; GstFlowReturn res;
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
@ -274,7 +272,7 @@ gst_aiffparse_stream_init (AIFFParse * aiff)
if ((res = gst_pad_pull_range (aiff->sinkpad, if ((res = gst_pad_pull_range (aiff->sinkpad,
aiff->offset, 12, &buf)) != GST_FLOW_OK) aiff->offset, 12, &buf)) != GST_FLOW_OK)
return res; return res;
else if (!gst_aiffparse_parse_file_header (aiff, buf)) else if (!gst_aiff_parse_parse_file_header (aiff, buf))
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
aiff->offset += 12; aiff->offset += 12;
@ -291,7 +289,7 @@ gst_aiffparse_stream_init (AIFFParse * aiff)
* READY. * READY.
*/ */
static gboolean static gboolean
gst_aiffparse_perform_seek (AIFFParse * aiff, GstEvent * event) gst_aiff_parse_perform_seek (GstAiffParse * aiff, GstEvent * event)
{ {
gboolean res; gboolean res;
gdouble rate; gdouble rate;
@ -488,7 +486,7 @@ gst_aiffparse_perform_seek (AIFFParse * aiff, GstEvent * event)
/* and start the streaming task again */ /* and start the streaming task again */
aiff->segment_running = TRUE; aiff->segment_running = TRUE;
if (!aiff->streaming) { if (!aiff->streaming) {
gst_pad_start_task (aiff->sinkpad, (GstTaskFunction) gst_aiffparse_loop, gst_pad_start_task (aiff->sinkpad, (GstTaskFunction) gst_aiff_parse_loop,
aiff->sinkpad); aiff->sinkpad);
} }
@ -510,7 +508,7 @@ no_format:
} }
/* /*
* gst_aiffparse_peek_chunk_info: * gst_aiff_parse_peek_chunk_info:
* @aiff AIFFparse object * @aiff AIFFparse object
* @tag holder for tag * @tag holder for tag
* @size holder for tag size * @size holder for tag size
@ -520,7 +518,8 @@ no_format:
* Returns: %TRUE when the chunk info (header) is available * Returns: %TRUE when the chunk info (header) is available
*/ */
static gboolean static gboolean
gst_aiffparse_peek_chunk_info (AIFFParse * aiff, guint32 * tag, guint32 * size) gst_aiff_parse_peek_chunk_info (GstAiffParse * aiff, guint32 * tag,
guint32 * size)
{ {
const guint8 *data = NULL; const guint8 *data = NULL;
@ -538,7 +537,7 @@ gst_aiffparse_peek_chunk_info (AIFFParse * aiff, guint32 * tag, guint32 * size)
} }
/* /*
* gst_aiffparse_peek_chunk: * gst_aiff_parse_peek_chunk:
* @aiff AIFFparse object * @aiff AIFFparse object
* @tag holder for tag * @tag holder for tag
* @size holder for tag size * @size holder for tag size
@ -548,12 +547,12 @@ gst_aiffparse_peek_chunk_info (AIFFParse * aiff, guint32 * tag, guint32 * size)
* Returns: %TRUE when the full chunk is available * Returns: %TRUE when the full chunk is available
*/ */
static gboolean static gboolean
gst_aiffparse_peek_chunk (AIFFParse * aiff, guint32 * tag, guint32 * size) gst_aiff_parse_peek_chunk (GstAiffParse * aiff, guint32 * tag, guint32 * size)
{ {
guint32 peek_size = 0; guint32 peek_size = 0;
guint available; guint available;
if (!gst_aiffparse_peek_chunk_info (aiff, tag, size)) if (!gst_aiff_parse_peek_chunk_info (aiff, tag, size))
return FALSE; return FALSE;
GST_DEBUG ("Need to peek chunk of %d bytes", *size); GST_DEBUG ("Need to peek chunk of %d bytes", *size);
@ -569,7 +568,8 @@ gst_aiffparse_peek_chunk (AIFFParse * aiff, guint32 * tag, guint32 * size)
} }
static gboolean static gboolean
gst_aiffparse_peek_data (AIFFParse * aiff, guint32 size, const guint8 ** data) gst_aiff_parse_peek_data (GstAiffParse * aiff, guint32 size,
const guint8 ** data)
{ {
if (gst_adapter_available (aiff->adapter) < size) if (gst_adapter_available (aiff->adapter) < size)
return FALSE; return FALSE;
@ -579,7 +579,7 @@ gst_aiffparse_peek_data (AIFFParse * aiff, guint32 size, const guint8 ** data)
} }
/* /*
* gst_aiffparse_calculate_duration: * gst_aiff_parse_calculate_duration:
* @aiff: aiffparse object * @aiff: aiffparse object
* *
* Calculate duration on demand and store in @aiff. * Calculate duration on demand and store in @aiff.
@ -587,7 +587,7 @@ gst_aiffparse_peek_data (AIFFParse * aiff, guint32 size, const guint8 ** data)
* Returns: %TRUE if duration is available. * Returns: %TRUE if duration is available.
*/ */
static gboolean static gboolean
gst_aiffparse_calculate_duration (AIFFParse * aiff) gst_aiff_parse_calculate_duration (GstAiffParse * aiff)
{ {
if (aiff->duration > 0) if (aiff->duration > 0)
return TRUE; return TRUE;
@ -603,13 +603,13 @@ gst_aiffparse_calculate_duration (AIFFParse * aiff)
} }
static void static void
gst_aiffparse_ignore_chunk (AIFFParse * aiff, GstBuffer * buf, guint32 tag, gst_aiff_parse_ignore_chunk (GstAiffParse * aiff, GstBuffer * buf, guint32 tag,
guint32 size) guint32 size)
{ {
guint flush; guint flush;
if (aiff->streaming) { if (aiff->streaming) {
if (!gst_aiffparse_peek_chunk (aiff, &tag, &size)) if (!gst_aiff_parse_peek_chunk (aiff, &tag, &size))
return; return;
} }
GST_DEBUG_OBJECT (aiff, "Ignoring tag %" GST_FOURCC_FORMAT, GST_DEBUG_OBJECT (aiff, "Ignoring tag %" GST_FOURCC_FORMAT,
@ -624,7 +624,7 @@ gst_aiffparse_ignore_chunk (AIFFParse * aiff, GstBuffer * buf, guint32 tag,
} }
static double static double
gst_aiffparse_read_IEEE80 (guint8 * buf) gst_aiff_parse_read_IEEE80 (guint8 * buf)
{ {
int s = buf[0] & 0xff; int s = buf[0] & 0xff;
int e = ((buf[0] & 0x7f) << 8) | (buf[1] & 0xff); int e = ((buf[0] & 0x7f) << 8) | (buf[1] & 0xff);
@ -650,7 +650,7 @@ gst_aiffparse_read_IEEE80 (guint8 * buf)
} }
static gboolean static gboolean
gst_aiffparse_parse_comm (AIFFParse * aiff, GstBuffer * buf) gst_aiff_parse_parse_comm (GstAiffParse * aiff, GstBuffer * buf)
{ {
guint8 *data; guint8 *data;
int size; int size;
@ -671,7 +671,7 @@ gst_aiffparse_parse_comm (AIFFParse * aiff, GstBuffer * buf)
aiff->total_frames = GST_READ_UINT32_BE (data + 2); aiff->total_frames = GST_READ_UINT32_BE (data + 2);
aiff->depth = GST_READ_UINT16_BE (data + 6); aiff->depth = GST_READ_UINT16_BE (data + 6);
aiff->width = GST_ROUND_UP_8 (aiff->depth); aiff->width = GST_ROUND_UP_8 (aiff->depth);
aiff->rate = (int) gst_aiffparse_read_IEEE80 (data + 8); aiff->rate = (int) gst_aiff_parse_read_IEEE80 (data + 8);
if (aiff->is_aifc) { if (aiff->is_aifc) {
/* We only support the 'trivial' uncompressed AIFC, but it can be /* We only support the 'trivial' uncompressed AIFC, but it can be
@ -694,7 +694,7 @@ gst_aiffparse_parse_comm (AIFFParse * aiff, GstBuffer * buf)
} }
static GstFlowReturn static GstFlowReturn
gst_aiffparse_read_chunk (AIFFParse * aiff, guint64 * offset, guint32 * tag, gst_aiff_parse_read_chunk (GstAiffParse * aiff, guint64 * offset, guint32 * tag,
GstBuffer ** data) GstBuffer ** data)
{ {
guint size; guint size;
@ -733,7 +733,7 @@ too_small:
} }
static GstCaps * static GstCaps *
gst_aiffparse_create_caps (AIFFParse * aiff) gst_aiff_parse_create_caps (GstAiffParse * aiff)
{ {
GstCaps *caps; GstCaps *caps;
@ -749,7 +749,7 @@ gst_aiffparse_create_caps (AIFFParse * aiff)
} }
static GstFlowReturn static GstFlowReturn
gst_aiffparse_stream_headers (AIFFParse * aiff) gst_aiff_parse_stream_headers (GstAiffParse * aiff)
{ {
GstFlowReturn res; GstFlowReturn res;
GstBuffer *buf; GstBuffer *buf;
@ -767,7 +767,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* loop headers until we get data */ /* loop headers until we get data */
while (!done) { while (!done) {
if (aiff->streaming) { if (aiff->streaming) {
if (!gst_aiffparse_peek_chunk_info (aiff, &tag, &size)) if (!gst_aiff_parse_peek_chunk_info (aiff, &tag, &size))
return GST_FLOW_OK; return GST_FLOW_OK;
} else { } else {
if ((res = if ((res =
@ -787,7 +787,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
switch (tag) { switch (tag) {
case GST_MAKE_FOURCC ('C', 'O', 'M', 'M'):{ case GST_MAKE_FOURCC ('C', 'O', 'M', 'M'):{
if (aiff->streaming) { if (aiff->streaming) {
if (!gst_aiffparse_peek_chunk (aiff, &tag, &size)) if (!gst_aiff_parse_peek_chunk (aiff, &tag, &size))
return GST_FLOW_OK; return GST_FLOW_OK;
gst_adapter_flush (aiff->adapter, 8); gst_adapter_flush (aiff->adapter, 8);
@ -795,12 +795,12 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
buf = gst_adapter_take_buffer (aiff->adapter, size); buf = gst_adapter_take_buffer (aiff->adapter, size);
} else { } else {
if ((res = gst_aiffparse_read_chunk (aiff, if ((res = gst_aiff_parse_read_chunk (aiff,
&aiff->offset, &tag, &buf)) != GST_FLOW_OK) &aiff->offset, &tag, &buf)) != GST_FLOW_OK)
return res; return res;
} }
if (!gst_aiffparse_parse_comm (aiff, buf)) { if (!gst_aiff_parse_parse_comm (aiff, buf)) {
gst_buffer_unref (buf); gst_buffer_unref (buf);
goto parse_header_error; goto parse_header_error;
} }
@ -815,7 +815,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
GST_DEBUG_OBJECT (aiff, "creating the caps"); GST_DEBUG_OBJECT (aiff, "creating the caps");
aiff->caps = gst_aiffparse_create_caps (aiff); aiff->caps = gst_aiff_parse_create_caps (aiff);
if (!aiff->caps) if (!aiff->caps)
goto unknown_format; goto unknown_format;
@ -840,7 +840,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* Now, read the 8-byte header in the SSND chunk */ /* Now, read the 8-byte header in the SSND chunk */
if (aiff->streaming) { if (aiff->streaming) {
if (!gst_aiffparse_peek_data (aiff, 16, &ssnddata)) if (!gst_aiff_parse_peek_data (aiff, 16, &ssnddata))
return GST_FLOW_OK; return GST_FLOW_OK;
} else { } else {
gst_buffer_unref (buf); gst_buffer_unref (buf);
@ -886,7 +886,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
break; break;
} }
default: default:
gst_aiffparse_ignore_chunk (aiff, buf, tag, size); gst_aiff_parse_ignore_chunk (aiff, buf, tag, size);
} }
if (upstream_size && (aiff->offset >= upstream_size)) { if (upstream_size && (aiff->offset >= upstream_size)) {
@ -910,7 +910,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
GST_DEBUG_OBJECT (aiff, "Finished parsing headers"); GST_DEBUG_OBJECT (aiff, "Finished parsing headers");
if (gst_aiffparse_calculate_duration (aiff)) { if (gst_aiff_parse_calculate_duration (aiff)) {
gst_segment_init (&aiff->segment, GST_FORMAT_TIME); gst_segment_init (&aiff->segment, GST_FORMAT_TIME);
gst_segment_set_duration (&aiff->segment, GST_FORMAT_TIME, aiff->duration); gst_segment_set_duration (&aiff->segment, GST_FORMAT_TIME, aiff->duration);
} else { } else {
@ -922,7 +922,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* now we have all the info to perform a pending seek if any, if no /* now we have all the info to perform a pending seek if any, if no
* event, this will still do the right thing and it will also send * event, this will still do the right thing and it will also send
* the right newsegment event downstream. */ * the right newsegment event downstream. */
gst_aiffparse_perform_seek (aiff, aiff->seek_event); gst_aiff_parse_perform_seek (aiff, aiff->seek_event);
/* remove pending event */ /* remove pending event */
event_p = &aiff->seek_event; event_p = &aiff->seek_event;
gst_event_replace (event_p, NULL); gst_event_replace (event_p, NULL);
@ -930,7 +930,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* we just started, we are discont */ /* we just started, we are discont */
aiff->discont = TRUE; aiff->discont = TRUE;
aiff->state = AIFFPARSE_DATA; aiff->state = AIFF_PARSE_DATA;
return GST_FLOW_OK; return GST_FLOW_OK;
@ -990,7 +990,7 @@ header_read_error:
* Read AIFF file tag when streaming * Read AIFF file tag when streaming
*/ */
static GstFlowReturn static GstFlowReturn
gst_aiffparse_parse_stream_init (AIFFParse * aiff) gst_aiff_parse_parse_stream_init (GstAiffParse * aiff)
{ {
if (gst_adapter_available (aiff->adapter) >= 12) { if (gst_adapter_available (aiff->adapter) >= 12) {
GstBuffer *tmp; GstBuffer *tmp;
@ -999,12 +999,12 @@ gst_aiffparse_parse_stream_init (AIFFParse * aiff)
tmp = gst_adapter_take_buffer (aiff->adapter, 12); tmp = gst_adapter_take_buffer (aiff->adapter, 12);
GST_DEBUG ("Parsing aiff header"); GST_DEBUG ("Parsing aiff header");
if (!gst_aiffparse_parse_file_header (aiff, tmp)) if (!gst_aiff_parse_parse_file_header (aiff, tmp))
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
aiff->offset += 12; aiff->offset += 12;
/* Go to next state */ /* Go to next state */
aiff->state = AIFFPARSE_HEADER; aiff->state = AIFF_PARSE_HEADER;
} }
return GST_FLOW_OK; return GST_FLOW_OK;
} }
@ -1017,15 +1017,15 @@ gst_aiffparse_parse_stream_init (AIFFParse * aiff)
* *
* In the READY state we can only store the event and try to * In the READY state we can only store the event and try to
* respect it when going to PAUSED. We assume we are in the * respect it when going to PAUSED. We assume we are in the
* READY state when our parsing state != AIFFPARSE_DATA. * READY state when our parsing state != AIFF_PARSE_DATA.
* *
* When we are steaming, we can simply perform the seek right * When we are steaming, we can simply perform the seek right
* away. * away.
*/ */
static gboolean static gboolean
gst_aiffparse_send_event (GstElement * element, GstEvent * event) gst_aiff_parse_send_event (GstElement * element, GstEvent * event)
{ {
AIFFParse *aiff = AIFFPARSE (element); GstAiffParse *aiff = GST_AIFF_PARSE (element);
gboolean res = FALSE; gboolean res = FALSE;
GstEvent **event_p; GstEvent **event_p;
@ -1033,9 +1033,9 @@ gst_aiffparse_send_event (GstElement * element, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
if (aiff->state == AIFFPARSE_DATA) { if (aiff->state == AIFF_PARSE_DATA) {
/* we can handle the seek directly when streaming data */ /* we can handle the seek directly when streaming data */
res = gst_aiffparse_perform_seek (aiff, event); res = gst_aiff_parse_perform_seek (aiff, event);
} else { } else {
GST_DEBUG_OBJECT (aiff, "queuing seek for later"); GST_DEBUG_OBJECT (aiff, "queuing seek for later");
@ -1056,7 +1056,7 @@ gst_aiffparse_send_event (GstElement * element, GstEvent * event)
#define MAX_BUFFER_SIZE 4096 #define MAX_BUFFER_SIZE 4096
static GstFlowReturn static GstFlowReturn
gst_aiffparse_stream_data (AIFFParse * aiff) gst_aiff_parse_stream_data (GstAiffParse * aiff)
{ {
GstBuffer *buf = NULL; GstBuffer *buf = NULL;
GstFlowReturn res = GST_FLOW_OK; GstFlowReturn res = GST_FLOW_OK;
@ -1204,33 +1204,33 @@ push_error:
} }
static void static void
gst_aiffparse_loop (GstPad * pad) gst_aiff_parse_loop (GstPad * pad)
{ {
GstFlowReturn ret; GstFlowReturn ret;
AIFFParse *aiff = AIFFPARSE (GST_PAD_PARENT (pad)); GstAiffParse *aiff = GST_AIFF_PARSE (GST_PAD_PARENT (pad));
GST_LOG_OBJECT (aiff, "process data"); GST_LOG_OBJECT (aiff, "process data");
switch (aiff->state) { switch (aiff->state) {
case AIFFPARSE_START: case AIFF_PARSE_START:
GST_INFO_OBJECT (aiff, "AIFFPARSE_START"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_START");
if ((ret = gst_aiffparse_stream_init (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_stream_init (aiff)) != GST_FLOW_OK)
goto pause; goto pause;
aiff->state = AIFFPARSE_HEADER; aiff->state = AIFF_PARSE_HEADER;
/* fall-through */ /* fall-through */
case AIFFPARSE_HEADER: case AIFF_PARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFFPARSE_HEADER"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_HEADER");
if ((ret = gst_aiffparse_stream_headers (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_stream_headers (aiff)) != GST_FLOW_OK)
goto pause; goto pause;
aiff->state = AIFFPARSE_DATA; aiff->state = AIFF_PARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFFPARSE_DATA"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_DATA");
/* fall-through */ /* fall-through */
case AIFFPARSE_DATA: case AIFF_PARSE_DATA:
if ((ret = gst_aiffparse_stream_data (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_stream_data (aiff)) != GST_FLOW_OK)
goto pause; goto pause;
break; break;
default: default:
@ -1276,39 +1276,39 @@ pause:
} }
static GstFlowReturn static GstFlowReturn
gst_aiffparse_chain (GstPad * pad, GstBuffer * buf) gst_aiff_parse_chain (GstPad * pad, GstBuffer * buf)
{ {
GstFlowReturn ret; GstFlowReturn ret;
AIFFParse *aiff = AIFFPARSE (GST_PAD_PARENT (pad)); GstAiffParse *aiff = GST_AIFF_PARSE (GST_PAD_PARENT (pad));
GST_LOG_OBJECT (aiff, "adapter_push %u bytes", GST_BUFFER_SIZE (buf)); GST_LOG_OBJECT (aiff, "adapter_push %u bytes", GST_BUFFER_SIZE (buf));
gst_adapter_push (aiff->adapter, buf); gst_adapter_push (aiff->adapter, buf);
switch (aiff->state) { switch (aiff->state) {
case AIFFPARSE_START: case AIFF_PARSE_START:
GST_INFO_OBJECT (aiff, "AIFFPARSE_START"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_START");
if ((ret = gst_aiffparse_parse_stream_init (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_parse_stream_init (aiff)) != GST_FLOW_OK)
goto done; goto done;
if (aiff->state != AIFFPARSE_HEADER) if (aiff->state != AIFF_PARSE_HEADER)
break; break;
/* otherwise fall-through */ /* otherwise fall-through */
case AIFFPARSE_HEADER: case AIFF_PARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFFPARSE_HEADER"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_HEADER");
if ((ret = gst_aiffparse_stream_headers (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_stream_headers (aiff)) != GST_FLOW_OK)
goto done; goto done;
if (!aiff->got_comm || aiff->datastart == 0) if (!aiff->got_comm || aiff->datastart == 0)
break; break;
aiff->state = AIFFPARSE_DATA; aiff->state = AIFF_PARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFFPARSE_DATA"); GST_INFO_OBJECT (aiff, "AIFF_PARSE_DATA");
/* fall-through */ /* fall-through */
case AIFFPARSE_DATA: case AIFF_PARSE_DATA:
if ((ret = gst_aiffparse_stream_data (aiff)) != GST_FLOW_OK) if ((ret = gst_aiff_parse_stream_data (aiff)) != GST_FLOW_OK)
goto done; goto done;
break; break;
default: default:
@ -1319,14 +1319,14 @@ done:
} }
static gboolean static gboolean
gst_aiffparse_pad_convert (GstPad * pad, gst_aiff_parse_pad_convert (GstPad * pad,
GstFormat src_format, gint64 src_value, GstFormat src_format, gint64 src_value,
GstFormat * dest_format, gint64 * dest_value) GstFormat * dest_format, gint64 * dest_value)
{ {
AIFFParse *aiffparse; GstAiffParse *aiffparse;
gboolean res = TRUE; gboolean res = TRUE;
aiffparse = AIFFPARSE (GST_PAD_PARENT (pad)); aiffparse = GST_AIFF_PARSE (GST_PAD_PARENT (pad));
if (*dest_format == src_format) { if (*dest_format == src_format) {
*dest_value = src_value; *dest_value = src_value;
@ -1404,7 +1404,7 @@ done:
} }
static const GstQueryType * static const GstQueryType *
gst_aiffparse_get_query_types (GstPad * pad) gst_aiff_parse_get_query_types (GstPad * pad)
{ {
static const GstQueryType types[] = { static const GstQueryType types[] = {
GST_QUERY_DURATION, GST_QUERY_DURATION,
@ -1418,13 +1418,13 @@ gst_aiffparse_get_query_types (GstPad * pad)
/* handle queries for location and length in requested format */ /* handle queries for location and length in requested format */
static gboolean static gboolean
gst_aiffparse_pad_query (GstPad * pad, GstQuery * query) gst_aiff_parse_pad_query (GstPad * pad, GstQuery * query)
{ {
gboolean res = TRUE; gboolean res = TRUE;
AIFFParse *aiff = AIFFPARSE (gst_pad_get_parent (pad)); GstAiffParse *aiff = GST_AIFF_PARSE (gst_pad_get_parent (pad));
/* only if we know */ /* only if we know */
if (aiff->state != AIFFPARSE_DATA) { if (aiff->state != AIFF_PARSE_DATA) {
gst_object_unref (aiff); gst_object_unref (aiff);
return FALSE; return FALSE;
} }
@ -1439,7 +1439,7 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
switch (format) { switch (format) {
case GST_FORMAT_TIME:{ case GST_FORMAT_TIME:{
if ((res = gst_aiffparse_calculate_duration (aiff))) { if ((res = gst_aiff_parse_calculate_duration (aiff))) {
duration = aiff->duration; duration = aiff->duration;
} }
break; break;
@ -1459,7 +1459,7 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
gst_query_parse_convert (query, &srcformat, &srcvalue, gst_query_parse_convert (query, &srcformat, &srcvalue,
&dstformat, &dstvalue); &dstformat, &dstvalue);
res = gst_aiffparse_pad_convert (pad, srcformat, srcvalue, res = gst_aiff_parse_pad_convert (pad, srcformat, srcvalue,
&dstformat, &dstvalue); &dstformat, &dstvalue);
if (res) if (res)
gst_query_set_convert (query, srcformat, srcvalue, dstformat, dstvalue); gst_query_set_convert (query, srcformat, srcvalue, dstformat, dstvalue);
@ -1472,7 +1472,7 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
if (fmt == GST_FORMAT_TIME) { if (fmt == GST_FORMAT_TIME) {
gboolean seekable = TRUE; gboolean seekable = TRUE;
if (!gst_aiffparse_calculate_duration (aiff)) { if (!gst_aiff_parse_calculate_duration (aiff)) {
seekable = FALSE; seekable = FALSE;
} }
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
@ -1490,9 +1490,9 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
} }
static gboolean static gboolean
gst_aiffparse_srcpad_event (GstPad * pad, GstEvent * event) gst_aiff_parse_srcpad_event (GstPad * pad, GstEvent * event)
{ {
AIFFParse *aiffparse = AIFFPARSE (gst_pad_get_parent (pad)); GstAiffParse *aiffparse = GST_AIFF_PARSE (gst_pad_get_parent (pad));
gboolean res = FALSE; gboolean res = FALSE;
GST_DEBUG_OBJECT (aiffparse, "%s event", GST_EVENT_TYPE_NAME (event)); GST_DEBUG_OBJECT (aiffparse, "%s event", GST_EVENT_TYPE_NAME (event));
@ -1500,8 +1500,8 @@ gst_aiffparse_srcpad_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
/* can only handle events when we are in the data state */ /* can only handle events when we are in the data state */
if (aiffparse->state == AIFFPARSE_DATA) { if (aiffparse->state == AIFF_PARSE_DATA) {
res = gst_aiffparse_perform_seek (aiffparse, event); res = gst_aiff_parse_perform_seek (aiffparse, event);
} }
gst_event_unref (event); gst_event_unref (event);
break; break;
@ -1514,9 +1514,9 @@ gst_aiffparse_srcpad_event (GstPad * pad, GstEvent * event)
} }
static gboolean static gboolean
gst_aiffparse_sink_activate (GstPad * sinkpad) gst_aiff_parse_sink_activate (GstPad * sinkpad)
{ {
AIFFParse *aiff = AIFFPARSE (gst_pad_get_parent (sinkpad)); GstAiffParse *aiff = GST_AIFF_PARSE (gst_pad_get_parent (sinkpad));
gboolean res; gboolean res;
if (aiff->adapter) if (aiff->adapter)
@ -1539,13 +1539,13 @@ gst_aiffparse_sink_activate (GstPad * sinkpad)
static gboolean static gboolean
gst_aiffparse_sink_activate_pull (GstPad * sinkpad, gboolean active) gst_aiff_parse_sink_activate_pull (GstPad * sinkpad, gboolean active)
{ {
AIFFParse *aiff = AIFFPARSE (GST_OBJECT_PARENT (sinkpad)); GstAiffParse *aiff = GST_AIFF_PARSE (GST_OBJECT_PARENT (sinkpad));
if (active) { if (active) {
aiff->segment_running = TRUE; aiff->segment_running = TRUE;
return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_aiffparse_loop, return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_aiff_parse_loop,
sinkpad); sinkpad);
} else { } else {
aiff->segment_running = FALSE; aiff->segment_running = FALSE;
@ -1554,16 +1554,16 @@ gst_aiffparse_sink_activate_pull (GstPad * sinkpad, gboolean active)
}; };
static GstStateChangeReturn static GstStateChangeReturn
gst_aiffparse_change_state (GstElement * element, GstStateChange transition) gst_aiff_parse_change_state (GstElement * element, GstStateChange transition)
{ {
GstStateChangeReturn ret; GstStateChangeReturn ret;
AIFFParse *aiff = AIFFPARSE (element); GstAiffParse *aiff = GST_AIFF_PARSE (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
break; break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_aiffparse_reset (aiff); gst_aiff_parse_reset (aiff);
break; break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break; break;
@ -1577,7 +1577,7 @@ gst_aiffparse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break; break;
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_aiffparse_reset (aiff); gst_aiff_parse_reset (aiff);
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
break; break;

View file

@ -1,4 +1,4 @@
/* GStreamer /* GStreamer AIFF parser
* Copyright (C) <2008> Pioneers of the Inevitable <songbird@songbirdnest.com> * Copyright (C) <2008> Pioneers of the Inevitable <songbird@songbirdnest.com>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -18,8 +18,8 @@
*/ */
#ifndef __GST_AIFFPARSE_H__ #ifndef __GST_AIFF_PARSE_H__
#define __GST_AIFFPARSE_H__ #define __GST_AIFF_PARSE_H__
#include <gst/gst.h> #include <gst/gst.h>
@ -27,32 +27,32 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define TYPE_AIFFPARSE \ #define GST_TYPE_AIFF_PARSE \
(gst_aiffparse_get_type()) (gst_aiff_parse_get_type())
#define AIFFPARSE(obj) \ #define GST_AIFF_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),TYPE_AIFFPARSE,AIFFParse)) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AIFF_PARSE,GstAiffParse))
#define AIFFPARSE_CLASS(klass) \ #define GST_AIFF_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),TYPE_AIFFPARSE,AIFFParseClass)) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AIFF_PARSE,GstAiffParseClass))
#define IS_AIFFPARSE(obj) \ #define GST_IS_AIFF_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),TYPE_AIFFPARSE)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AIFF_PARSE))
#define IS_AIFFPARSE_CLASS(klass) \ #define GST_IS_AIFF_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),TYPE_AIFFPARSE)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AIFF_PARSE))
typedef enum { typedef enum {
AIFFPARSE_START, AIFF_PARSE_START,
AIFFPARSE_HEADER, AIFF_PARSE_HEADER,
AIFFPARSE_DATA AIFF_PARSE_DATA
} AIFFParseState; } GstAiffParseState;
typedef struct _AIFFParse AIFFParse; typedef struct _GstAiffParse GstAiffParse;
typedef struct _AIFFParseClass AIFFParseClass; typedef struct _GstAiffParseClass GstAiffParseClass;
/** /**
* AIFFParse: * GstAiffParse:
* *
* Opaque data structure. * Opaque data structure.
*/ */
struct _AIFFParse { struct _GstAiffParse {
GstElement parent; GstElement parent;
/* pads */ /* pads */
@ -63,7 +63,7 @@ struct _AIFFParse {
GstEvent *start_segment; GstEvent *start_segment;
/* AIFF decoding state */ /* AIFF decoding state */
AIFFParseState state; GstAiffParseState state;
/* format of audio, see defines below */ /* format of audio, see defines below */
gint format; gint format;
@ -113,12 +113,12 @@ struct _AIFFParse {
gboolean discont; gboolean discont;
}; };
struct _AIFFParseClass { struct _GstAiffParseClass {
GstElementClass parent_class; GstElementClass parent_class;
}; };
GType gst_aiffparse_get_type(void); GType gst_aiff_parse_get_type(void);
G_END_DECLS G_END_DECLS
#endif /* __GST_AIFFPARSE_H__ */ #endif /* __GST_AIFF_PARSE_H__ */