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
ret = gst_element_register (plugin, "aiffparse", GST_RANK_PRIMARY,
TYPE_AIFFPARSE);
GST_TYPE_AIFF_PARSE);
ret &= gst_element_register (plugin, "aiffmux", GST_RANK_NONE,
GST_TYPE_AIFF_MUX);

View file

@ -107,9 +107,8 @@ gst_aiff_mux_base_init (gpointer gclass)
GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
gst_element_class_set_details_simple (element_class,
"Audio Interchange File Format multiplexer",
"Muxer/Audio",
"Multiplex raw audio into AIFF", "Robert Swain <robert.swain@gmail.com>");
"AIFF audio muxer", "Muxer/Audio", "Multiplex raw audio into AIFF",
"Robert Swain <robert.swain@gmail.com>");
gst_element_class_add_pad_template (element_class,
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 -*- */
/* GStreamer
/* GStreamer AIFF parser
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* <2006> Nokia Corporation, Stefan Kost <stefan.kost@nokia.com>.
* <2008> Pioneers of the Inevitable <songbird@songbirdnest.com>
@ -59,34 +59,28 @@
#include <gst/audio/audio.h>
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY (aiffparse_debug);
#define GST_CAT_DEFAULT (aiffparse_debug)
GST_DEBUG_CATEGORY (aiff_parse_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_aiffparse_sink_activate_pull (GstPad * sinkpad,
static gboolean gst_aiff_parse_sink_activate (GstPad * sinkpad);
static gboolean gst_aiff_parse_sink_activate_pull (GstPad * sinkpad,
gboolean active);
static gboolean gst_aiffparse_send_event (GstElement * element,
static gboolean gst_aiff_parse_send_event (GstElement * element,
GstEvent * event);
static GstStateChangeReturn gst_aiffparse_change_state (GstElement * element,
static GstStateChangeReturn gst_aiff_parse_change_state (GstElement * element,
GstStateChange transition);
static const GstQueryType *gst_aiffparse_get_query_types (GstPad * pad);
static gboolean gst_aiffparse_pad_query (GstPad * pad, GstQuery * query);
static gboolean gst_aiffparse_pad_convert (GstPad * pad,
static const GstQueryType *gst_aiff_parse_get_query_types (GstPad * pad);
static gboolean gst_aiff_parse_pad_query (GstPad * pad, GstQuery * query);
static gboolean gst_aiff_parse_pad_convert (GstPad * pad,
GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
static GstFlowReturn gst_aiffparse_chain (GstPad * pad, GstBuffer * buf);
static void gst_aiffparse_loop (GstPad * pad);
static gboolean gst_aiffparse_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 GstFlowReturn gst_aiff_parse_chain (GstPad * pad, GstBuffer * buf);
static void gst_aiff_parse_loop (GstPad * pad);
static gboolean gst_aiff_parse_srcpad_event (GstPad * pad, GstEvent * event);
static GstStaticPadTemplate sink_template_factory =
GST_STATIC_PAD_TEMPLATE ("sink",
@ -102,23 +96,26 @@ GST_STATIC_PAD_TEMPLATE ("src",
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
gst_aiffparse_base_init (gpointer g_class)
gst_aiff_parse_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register pads */
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template_factory));
gst_element_class_add_pad_template (element_class,
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
gst_aiffparse_class_init (AIFFParseClass * klass)
gst_aiff_parse_class_init (GstAiffParseClass * klass)
{
GstElementClass *gstelement_class;
GObjectClass *object_class;
@ -128,16 +125,17 @@ gst_aiffparse_class_init (AIFFParseClass * 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->send_event = gst_aiffparse_send_event;
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_aiff_parse_change_state);
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_aiff_parse_send_event);
}
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 */
aiff->rate = 0;
@ -167,30 +165,30 @@ gst_aiffparse_reset (AIFFParse * aiff)
}
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_aiffparse_reset (aiff);
gst_aiff_parse_reset (aiff);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
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 */
aiffparse->sinkpad =
gst_pad_new_from_static_template (&sink_template_factory, "sink");
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_DEBUG_FUNCPTR (gst_aiffparse_sink_activate_pull));
GST_DEBUG_FUNCPTR (gst_aiff_parse_sink_activate_pull));
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);
/* 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_use_fixed_caps (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_DEBUG_FUNCPTR (gst_aiffparse_pad_query));
GST_DEBUG_FUNCPTR (gst_aiff_parse_pad_query));
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);
}
@ -226,7 +224,7 @@ uint64_ceiling_scale (guint64 val, guint64 num, guint64 denom)
static gboolean
gst_aiffparse_parse_file_header (AIFFParse * aiff, GstBuffer * buf)
gst_aiff_parse_parse_file_header (GstAiffParse * aiff, GstBuffer * buf)
{
guint8 *data;
guint32 header, type = 0;
@ -266,7 +264,7 @@ not_aiff:
}
static GstFlowReturn
gst_aiffparse_stream_init (AIFFParse * aiff)
gst_aiff_parse_stream_init (GstAiffParse * aiff)
{
GstFlowReturn res;
GstBuffer *buf = NULL;
@ -274,7 +272,7 @@ gst_aiffparse_stream_init (AIFFParse * aiff)
if ((res = gst_pad_pull_range (aiff->sinkpad,
aiff->offset, 12, &buf)) != GST_FLOW_OK)
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;
aiff->offset += 12;
@ -291,7 +289,7 @@ gst_aiffparse_stream_init (AIFFParse * aiff)
* READY.
*/
static gboolean
gst_aiffparse_perform_seek (AIFFParse * aiff, GstEvent * event)
gst_aiff_parse_perform_seek (GstAiffParse * aiff, GstEvent * event)
{
gboolean res;
gdouble rate;
@ -488,7 +486,7 @@ gst_aiffparse_perform_seek (AIFFParse * aiff, GstEvent * event)
/* and start the streaming task again */
aiff->segment_running = TRUE;
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);
}
@ -510,7 +508,7 @@ no_format:
}
/*
* gst_aiffparse_peek_chunk_info:
* gst_aiff_parse_peek_chunk_info:
* @aiff AIFFparse object
* @tag holder for tag
* @size holder for tag size
@ -520,7 +518,8 @@ no_format:
* Returns: %TRUE when the chunk info (header) is available
*/
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;
@ -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
* @tag holder for tag
* @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
*/
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;
guint available;
if (!gst_aiffparse_peek_chunk_info (aiff, tag, size))
if (!gst_aiff_parse_peek_chunk_info (aiff, tag, size))
return FALSE;
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
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)
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
*
* 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.
*/
static gboolean
gst_aiffparse_calculate_duration (AIFFParse * aiff)
gst_aiff_parse_calculate_duration (GstAiffParse * aiff)
{
if (aiff->duration > 0)
return TRUE;
@ -603,13 +603,13 @@ gst_aiffparse_calculate_duration (AIFFParse * aiff)
}
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)
{
guint flush;
if (aiff->streaming) {
if (!gst_aiffparse_peek_chunk (aiff, &tag, &size))
if (!gst_aiff_parse_peek_chunk (aiff, &tag, &size))
return;
}
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
gst_aiffparse_read_IEEE80 (guint8 * buf)
gst_aiff_parse_read_IEEE80 (guint8 * buf)
{
int s = buf[0] & 0xff;
int e = ((buf[0] & 0x7f) << 8) | (buf[1] & 0xff);
@ -650,7 +650,7 @@ gst_aiffparse_read_IEEE80 (guint8 * buf)
}
static gboolean
gst_aiffparse_parse_comm (AIFFParse * aiff, GstBuffer * buf)
gst_aiff_parse_parse_comm (GstAiffParse * aiff, GstBuffer * buf)
{
guint8 *data;
int size;
@ -671,7 +671,7 @@ gst_aiffparse_parse_comm (AIFFParse * aiff, GstBuffer * buf)
aiff->total_frames = GST_READ_UINT32_BE (data + 2);
aiff->depth = GST_READ_UINT16_BE (data + 6);
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) {
/* 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
gst_aiffparse_read_chunk (AIFFParse * aiff, guint64 * offset, guint32 * tag,
gst_aiff_parse_read_chunk (GstAiffParse * aiff, guint64 * offset, guint32 * tag,
GstBuffer ** data)
{
guint size;
@ -733,7 +733,7 @@ too_small:
}
static GstCaps *
gst_aiffparse_create_caps (AIFFParse * aiff)
gst_aiff_parse_create_caps (GstAiffParse * aiff)
{
GstCaps *caps;
@ -749,7 +749,7 @@ gst_aiffparse_create_caps (AIFFParse * aiff)
}
static GstFlowReturn
gst_aiffparse_stream_headers (AIFFParse * aiff)
gst_aiff_parse_stream_headers (GstAiffParse * aiff)
{
GstFlowReturn res;
GstBuffer *buf;
@ -767,7 +767,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* loop headers until we get data */
while (!done) {
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;
} else {
if ((res =
@ -787,7 +787,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
switch (tag) {
case GST_MAKE_FOURCC ('C', 'O', 'M', 'M'):{
if (aiff->streaming) {
if (!gst_aiffparse_peek_chunk (aiff, &tag, &size))
if (!gst_aiff_parse_peek_chunk (aiff, &tag, &size))
return GST_FLOW_OK;
gst_adapter_flush (aiff->adapter, 8);
@ -795,12 +795,12 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
buf = gst_adapter_take_buffer (aiff->adapter, size);
} else {
if ((res = gst_aiffparse_read_chunk (aiff,
if ((res = gst_aiff_parse_read_chunk (aiff,
&aiff->offset, &tag, &buf)) != GST_FLOW_OK)
return res;
}
if (!gst_aiffparse_parse_comm (aiff, buf)) {
if (!gst_aiff_parse_parse_comm (aiff, buf)) {
gst_buffer_unref (buf);
goto parse_header_error;
}
@ -815,7 +815,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
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)
goto unknown_format;
@ -840,7 +840,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* Now, read the 8-byte header in the SSND chunk */
if (aiff->streaming) {
if (!gst_aiffparse_peek_data (aiff, 16, &ssnddata))
if (!gst_aiff_parse_peek_data (aiff, 16, &ssnddata))
return GST_FLOW_OK;
} else {
gst_buffer_unref (buf);
@ -886,7 +886,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
break;
}
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)) {
@ -910,7 +910,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
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_set_duration (&aiff->segment, GST_FORMAT_TIME, aiff->duration);
} 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
* event, this will still do the right thing and it will also send
* 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 */
event_p = &aiff->seek_event;
gst_event_replace (event_p, NULL);
@ -930,7 +930,7 @@ gst_aiffparse_stream_headers (AIFFParse * aiff)
/* we just started, we are discont */
aiff->discont = TRUE;
aiff->state = AIFFPARSE_DATA;
aiff->state = AIFF_PARSE_DATA;
return GST_FLOW_OK;
@ -990,7 +990,7 @@ header_read_error:
* Read AIFF file tag when streaming
*/
static GstFlowReturn
gst_aiffparse_parse_stream_init (AIFFParse * aiff)
gst_aiff_parse_parse_stream_init (GstAiffParse * aiff)
{
if (gst_adapter_available (aiff->adapter) >= 12) {
GstBuffer *tmp;
@ -999,12 +999,12 @@ gst_aiffparse_parse_stream_init (AIFFParse * aiff)
tmp = gst_adapter_take_buffer (aiff->adapter, 12);
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;
aiff->offset += 12;
/* Go to next state */
aiff->state = AIFFPARSE_HEADER;
aiff->state = AIFF_PARSE_HEADER;
}
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
* 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
* away.
*/
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;
GstEvent **event_p;
@ -1033,9 +1033,9 @@ gst_aiffparse_send_event (GstElement * element, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
if (aiff->state == AIFFPARSE_DATA) {
if (aiff->state == AIFF_PARSE_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 {
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
static GstFlowReturn
gst_aiffparse_stream_data (AIFFParse * aiff)
gst_aiff_parse_stream_data (GstAiffParse * aiff)
{
GstBuffer *buf = NULL;
GstFlowReturn res = GST_FLOW_OK;
@ -1204,33 +1204,33 @@ push_error:
}
static void
gst_aiffparse_loop (GstPad * pad)
gst_aiff_parse_loop (GstPad * pad)
{
GstFlowReturn ret;
AIFFParse *aiff = AIFFPARSE (GST_PAD_PARENT (pad));
GstAiffParse *aiff = GST_AIFF_PARSE (GST_PAD_PARENT (pad));
GST_LOG_OBJECT (aiff, "process data");
switch (aiff->state) {
case AIFFPARSE_START:
GST_INFO_OBJECT (aiff, "AIFFPARSE_START");
if ((ret = gst_aiffparse_stream_init (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_START:
GST_INFO_OBJECT (aiff, "AIFF_PARSE_START");
if ((ret = gst_aiff_parse_stream_init (aiff)) != GST_FLOW_OK)
goto pause;
aiff->state = AIFFPARSE_HEADER;
aiff->state = AIFF_PARSE_HEADER;
/* fall-through */
case AIFFPARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFFPARSE_HEADER");
if ((ret = gst_aiffparse_stream_headers (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFF_PARSE_HEADER");
if ((ret = gst_aiff_parse_stream_headers (aiff)) != GST_FLOW_OK)
goto pause;
aiff->state = AIFFPARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFFPARSE_DATA");
aiff->state = AIFF_PARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFF_PARSE_DATA");
/* fall-through */
case AIFFPARSE_DATA:
if ((ret = gst_aiffparse_stream_data (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_DATA:
if ((ret = gst_aiff_parse_stream_data (aiff)) != GST_FLOW_OK)
goto pause;
break;
default:
@ -1276,39 +1276,39 @@ pause:
}
static GstFlowReturn
gst_aiffparse_chain (GstPad * pad, GstBuffer * buf)
gst_aiff_parse_chain (GstPad * pad, GstBuffer * buf)
{
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_adapter_push (aiff->adapter, buf);
switch (aiff->state) {
case AIFFPARSE_START:
GST_INFO_OBJECT (aiff, "AIFFPARSE_START");
if ((ret = gst_aiffparse_parse_stream_init (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_START:
GST_INFO_OBJECT (aiff, "AIFF_PARSE_START");
if ((ret = gst_aiff_parse_parse_stream_init (aiff)) != GST_FLOW_OK)
goto done;
if (aiff->state != AIFFPARSE_HEADER)
if (aiff->state != AIFF_PARSE_HEADER)
break;
/* otherwise fall-through */
case AIFFPARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFFPARSE_HEADER");
if ((ret = gst_aiffparse_stream_headers (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_HEADER:
GST_INFO_OBJECT (aiff, "AIFF_PARSE_HEADER");
if ((ret = gst_aiff_parse_stream_headers (aiff)) != GST_FLOW_OK)
goto done;
if (!aiff->got_comm || aiff->datastart == 0)
break;
aiff->state = AIFFPARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFFPARSE_DATA");
aiff->state = AIFF_PARSE_DATA;
GST_INFO_OBJECT (aiff, "AIFF_PARSE_DATA");
/* fall-through */
case AIFFPARSE_DATA:
if ((ret = gst_aiffparse_stream_data (aiff)) != GST_FLOW_OK)
case AIFF_PARSE_DATA:
if ((ret = gst_aiff_parse_stream_data (aiff)) != GST_FLOW_OK)
goto done;
break;
default:
@ -1319,14 +1319,14 @@ done:
}
static gboolean
gst_aiffparse_pad_convert (GstPad * pad,
gst_aiff_parse_pad_convert (GstPad * pad,
GstFormat src_format, gint64 src_value,
GstFormat * dest_format, gint64 * dest_value)
{
AIFFParse *aiffparse;
GstAiffParse *aiffparse;
gboolean res = TRUE;
aiffparse = AIFFPARSE (GST_PAD_PARENT (pad));
aiffparse = GST_AIFF_PARSE (GST_PAD_PARENT (pad));
if (*dest_format == src_format) {
*dest_value = src_value;
@ -1404,7 +1404,7 @@ done:
}
static const GstQueryType *
gst_aiffparse_get_query_types (GstPad * pad)
gst_aiff_parse_get_query_types (GstPad * pad)
{
static const GstQueryType types[] = {
GST_QUERY_DURATION,
@ -1418,13 +1418,13 @@ gst_aiffparse_get_query_types (GstPad * pad)
/* handle queries for location and length in requested format */
static gboolean
gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
gst_aiff_parse_pad_query (GstPad * pad, GstQuery * query)
{
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 */
if (aiff->state != AIFFPARSE_DATA) {
if (aiff->state != AIFF_PARSE_DATA) {
gst_object_unref (aiff);
return FALSE;
}
@ -1439,7 +1439,7 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
switch (format) {
case GST_FORMAT_TIME:{
if ((res = gst_aiffparse_calculate_duration (aiff))) {
if ((res = gst_aiff_parse_calculate_duration (aiff))) {
duration = aiff->duration;
}
break;
@ -1459,7 +1459,7 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
gst_query_parse_convert (query, &srcformat, &srcvalue,
&dstformat, &dstvalue);
res = gst_aiffparse_pad_convert (pad, srcformat, srcvalue,
res = gst_aiff_parse_pad_convert (pad, srcformat, srcvalue,
&dstformat, &dstvalue);
if (res)
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) {
gboolean seekable = TRUE;
if (!gst_aiffparse_calculate_duration (aiff)) {
if (!gst_aiff_parse_calculate_duration (aiff)) {
seekable = FALSE;
}
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
@ -1490,9 +1490,9 @@ gst_aiffparse_pad_query (GstPad * pad, GstQuery * query)
}
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;
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)) {
case GST_EVENT_SEEK:
/* can only handle events when we are in the data state */
if (aiffparse->state == AIFFPARSE_DATA) {
res = gst_aiffparse_perform_seek (aiffparse, event);
if (aiffparse->state == AIFF_PARSE_DATA) {
res = gst_aiff_parse_perform_seek (aiffparse, event);
}
gst_event_unref (event);
break;
@ -1514,9 +1514,9 @@ gst_aiffparse_srcpad_event (GstPad * pad, GstEvent * event)
}
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;
if (aiff->adapter)
@ -1539,13 +1539,13 @@ gst_aiffparse_sink_activate (GstPad * sinkpad)
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) {
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);
} else {
aiff->segment_running = FALSE;
@ -1554,16 +1554,16 @@ gst_aiffparse_sink_activate_pull (GstPad * sinkpad, gboolean active)
};
static GstStateChangeReturn
gst_aiffparse_change_state (GstElement * element, GstStateChange transition)
gst_aiff_parse_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret;
AIFFParse *aiff = AIFFPARSE (element);
GstAiffParse *aiff = GST_AIFF_PARSE (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_aiffparse_reset (aiff);
gst_aiff_parse_reset (aiff);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
@ -1577,7 +1577,7 @@ gst_aiffparse_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_aiffparse_reset (aiff);
gst_aiff_parse_reset (aiff);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
break;

View file

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