From 4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 15 Mar 2004 19:32:27 +0000 Subject: don't mix tabs and spaces Original commit message from CVS: don't mix tabs and spaces --- ext/audiofile/gstafparse.c | 119 +++++++++++++++++++++++---------------------- ext/audiofile/gstafsink.c | 51 +++++++++---------- ext/audiofile/gstafsrc.c | 55 +++++++++++---------- 3 files changed, 114 insertions(+), 111 deletions(-) (limited to 'ext/audiofile') diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c index 00c9fd81..ddc61e0c 100644 --- a/ext/audiofile/gstafparse.c +++ b/ext/audiofile/gstafparse.c @@ -57,13 +57,13 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); static GstStaticPadTemplate afparse_sink_factory = @@ -112,9 +112,10 @@ gst_afparse_get_type (void) 0, (GInstanceInitFunc) gst_afparse_init, }; + afparse_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info, - 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFParse", &afparse_info, + 0); } return afparse_type; } @@ -151,13 +152,13 @@ gst_afparse_init (GstAFParse * afparse) { afparse->srcpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afparse), "src"), "src"); + (afparse), "src"), "src"); gst_pad_use_explicit_caps (afparse->srcpad); gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad); afparse->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afparse), "sink"), "sink"); + (afparse), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (afparse), afparse->sinkpad); gst_element_set_loop_function (GST_ELEMENT (afparse), gst_afparse_loop); @@ -217,8 +218,8 @@ gst_afparse_loop (GstElement * element) &v_width); if (afGetCompression != AF_COMPRESSION_NONE || afGetByteOrder (afparse->file, - AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file, - AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) { + AF_DEFAULT_TRACK) != afGetVirtualByteOrder (afparse->file, + AF_DEFAULT_TRACK) || s_format != v_format || s_width != v_width) { bypass_afread = FALSE; } @@ -241,24 +242,24 @@ gst_afparse_loop (GstElement * element) got_bytes = gst_bytestream_read (bs, &buf, bytes_per_read); if (got_bytes == 0) { - /* we need to check for an event. */ - gst_bytestream_get_status (bs, &waiting, &event); - if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { - gst_pad_push (afparse->srcpad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - gst_element_set_eos (GST_ELEMENT (afparse)); - break; - } + /* we need to check for an event. */ + gst_bytestream_get_status (bs, &waiting, &event); + if (event && GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + gst_pad_push (afparse->srcpad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (GST_ELEMENT (afparse)); + break; + } } else { - GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; - gst_pad_push (afparse->srcpad, GST_DATA (buf)); - if (got_bytes != bytes_per_read) { - /* this shouldn't happen very often */ - /* FIXME calculate the timestamps based on the fewer bytes received */ - - } else { - afparse->timestamp += frames_per_read * 1E9 / afparse->rate; - } + GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; + gst_pad_push (afparse->srcpad, GST_DATA (buf)); + if (got_bytes != bytes_per_read) { + /* this shouldn't happen very often */ + /* FIXME calculate the timestamps based on the fewer bytes received */ + + } else { + afparse->timestamp += frames_per_read * 1E9 / afparse->rate; + } } } while (TRUE); @@ -269,17 +270,17 @@ gst_afparse_loop (GstElement * element) GST_BUFFER_TIMESTAMP (buf) = afparse->timestamp; data = GST_BUFFER_DATA (buf); numframes = - afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read); + afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read); /* events are handled in gst_afparse_vf_read so if there are no * frames it must be EOS */ if (numframes < 1) { - gst_buffer_unref (buf); + gst_buffer_unref (buf); - gst_pad_push (afparse->srcpad, - GST_DATA (gst_event_new (GST_EVENT_EOS))); - gst_element_set_eos (GST_ELEMENT (afparse)); - break; + gst_pad_push (afparse->srcpad, + GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (GST_ELEMENT (afparse)); + break; } GST_BUFFER_SIZE (buf) = numframes * frames_to_bytes; gst_pad_push (afparse->srcpad, GST_DATA (buf)); @@ -334,7 +335,7 @@ gst_afparse_plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "afparse", GST_RANK_NONE, - GST_TYPE_AFPARSE)) + GST_TYPE_AFPARSE)) return FALSE; return TRUE; @@ -363,35 +364,35 @@ gst_afparse_open_file (GstAFParse * afparse) afparse->channels = afGetChannels (afparse->file, AF_DEFAULT_TRACK); afGetSampleFormat (afparse->file, AF_DEFAULT_TRACK, - &sampleFormat, &sampleWidth); + &sampleFormat, &sampleWidth); switch (sampleFormat) { case AF_SAMPFMT_TWOSCOMP: - afparse->is_signed = TRUE; - break; + afparse->is_signed = TRUE; + break; case AF_SAMPFMT_UNSIGNED: - afparse->is_signed = FALSE; - break; + afparse->is_signed = FALSE; + break; case AF_SAMPFMT_FLOAT: case AF_SAMPFMT_DOUBLE: - GST_DEBUG ("ERROR: float data not supported yet !\n"); + GST_DEBUG ("ERROR: float data not supported yet !\n"); } afparse->rate = (guint) afGetRate (afparse->file, AF_DEFAULT_TRACK); afparse->width = sampleWidth; GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n", - afparse->channels, afparse->width, afparse->rate, - afparse->is_signed ? "yes" : "no"); + afparse->channels, afparse->width, afparse->rate, + afparse->is_signed ? "yes" : "no"); } /* set caps on src */ /*FIXME: add all the possible formats, especially float ! */ gst_pad_set_explicit_caps (afparse->srcpad, gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, afparse->is_signed, - "width", G_TYPE_INT, afparse->width, - "depth", G_TYPE_INT, afparse->width, - "rate", G_TYPE_INT, afparse->rate, - "channels", G_TYPE_INT, afparse->channels, NULL)); + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, afparse->is_signed, + "width", G_TYPE_INT, afparse->width, + "depth", G_TYPE_INT, afparse->width, + "rate", G_TYPE_INT, afparse->rate, + "channels", G_TYPE_INT, afparse->channels, NULL)); GST_FLAG_SET (afparse, GST_AFPARSE_OPEN); @@ -433,17 +434,17 @@ gst_afparse_vf_read (AFvirtualfile * vfile, void *data, size_t nbytes) } switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - return 0; + return 0; case GST_EVENT_FLUSH: - GST_DEBUG ("flush"); - break; + GST_DEBUG ("flush"); + break; case GST_EVENT_DISCONTINUOUS: - GST_DEBUG ("seek done"); - got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); - break; + GST_DEBUG ("seek done"); + got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); + break; default: - g_warning ("unknown event %d", GST_EVENT_TYPE (event)); - got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); + g_warning ("unknown event %d", GST_EVENT_TYPE (event)); + got_bytes = gst_bytestream_peek_bytes (bs, &bytes, nbytes); } } diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c index eeac509f..a24991d1 100644 --- a/ext/audiofile/gstafsink.c +++ b/ext/audiofile/gstafsink.c @@ -65,13 +65,13 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, 2 ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, 2 ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); /* we use an enum for the output type arg */ @@ -93,7 +93,7 @@ gst_afsink_types_get_type (void) if (!afsink_types_type) { afsink_types_type = - g_enum_register_static ("GstAudiosinkTypes", afsink_types); + g_enum_register_static ("GstAudiosinkTypes", afsink_types); } return afsink_types_type; } @@ -136,8 +136,9 @@ gst_afsink_get_type (void) 0, (GInstanceInitFunc) gst_afsink_init, }; + afsink_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFSink", &afsink_info, 0); } return afsink_type; } @@ -166,8 +167,8 @@ gst_afsink_class_init (GstAFSinkClass * klass) gst_element_class_install_std_props (GST_ELEMENT_CLASS (klass), "location", ARG_LOCATION, G_PARAM_READWRITE, NULL); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE, g_param_spec_enum ("type", "type", "type", GST_TYPE_AFSINK_TYPES, 0, G_PARAM_READWRITE)); /* CHECKME! */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_OUTPUT_ENDIANNESS, g_param_spec_int ("endianness", "endianness", "endianness", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */ gst_afsink_signals[SIGNAL_HANDOFF] = g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -188,7 +189,7 @@ gst_afsink_init (GstAFSink * afsink) afsink->sinkpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afsink), "sink"), "sink"); + (afsink), "sink"), "sink"); gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad); gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain); @@ -217,14 +218,14 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value, case ARG_LOCATION: /* the element must be stopped or paused in order to do this */ g_return_if_fail ((GST_STATE (sink) < GST_STATE_PLAYING) - || (GST_STATE (sink) == GST_STATE_PAUSED)); + || (GST_STATE (sink) == GST_STATE_PAUSED)); if (sink->filename) - g_free (sink->filename); + g_free (sink->filename); sink->filename = g_strdup (g_value_get_string (value)); if ((GST_STATE (sink) == GST_STATE_PAUSED) - && (sink->filename != NULL)) { - gst_afsink_close_file (sink); - gst_afsink_open_file (sink); + && (sink->filename != NULL)) { + gst_afsink_close_file (sink); + gst_afsink_open_file (sink); } break; @@ -236,7 +237,7 @@ gst_afsink_set_property (GObject * object, guint prop_id, const GValue * value, int end = g_value_get_int (value); if (end == 1234 || end == 4321) - sink->endianness_output = end; + sink->endianness_output = end; } break; default: @@ -291,8 +292,8 @@ gst_afsink_open_file (GstAFSink * sink) AFfilesetup outfilesetup; const GstCaps *caps; GstStructure *structure; - int sample_format; /* audiofile's sample format, look in audiofile.h */ - int byte_order = 0; /* audiofile's byte order defines */ + int sample_format; /* audiofile's sample format, look in audiofile.h */ + int byte_order = 0; /* audiofile's byte order defines */ g_return_val_if_fail (!GST_FLAG_IS_SET (sink, GST_AFSINK_OPEN), FALSE); @@ -342,8 +343,8 @@ gst_afsink_open_file (GstAFSink * sink) sink->file = afOpenFile (sink->filename, "w", outfilesetup); if (sink->file == AF_NULL_FILEHANDLE) { GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open file \"%s\" for writing."), sink->filename), - ("system error: %s", strerror (errno))); + (_("Could not open file \"%s\" for writing."), sink->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -364,7 +365,7 @@ gst_afsink_close_file (GstAFSink * sink) /* if (fclose (sink->file) != 0) */ if (afCloseFile (sink->file) != 0) { GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM); + (_("Error closing file \"%s\"."), sink->filename), GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (sink, GST_AFSINK_OPEN); } @@ -417,10 +418,10 @@ gst_afsink_chain (GstPad * pad, GstData * _data) int frameCount = 0; frameCount = - GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels); + GST_BUFFER_SIZE (buf) / ((afsink->width / 8) * afsink->channels); /* g_print ("DEBUG: writing %d frames ", frameCount); */ ret = afWriteFrames (afsink->file, AF_DEFAULT_TRACK, - GST_BUFFER_DATA (buf), frameCount); + GST_BUFFER_DATA (buf), frameCount); if (ret == AF_BAD_WRITE || ret == AF_BAD_LSEEK) { printf ("afsink : Warning : afWriteFrames returned an error (%d)\n", ret); } diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index 98a2d38b..d0ce73f9 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -62,13 +62,13 @@ static GstStaticPadTemplate afsrc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/x-raw-int, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "signed = (boolean) { true, false }, " - "buffer-frames = (int) [ 1, MAX ]") + "rate = (int) [ 1, MAX ], " + "channels = (int) [ 1, MAX ], " + "endianness = (int) BYTE_ORDER, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "signed = (boolean) { true, false }, " + "buffer-frames = (int) [ 1, MAX ]") ); /* we use an enum for the output type arg */ @@ -133,8 +133,9 @@ gst_afsrc_get_type (void) 0, (GInstanceInitFunc) gst_afsrc_init, }; + afsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAFSrc", &afsrc_info, 0); } return afsrc_type; } @@ -181,7 +182,7 @@ gst_afsrc_init (GstAFSrc * afsrc) /* no need for a template, caps are set based on file, right ? */ afsrc->srcpad = gst_pad_new_from_template (gst_element_get_pad_template (GST_ELEMENT - (afsrc), "src"), "src"); + (afsrc), "src"), "src"); gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad); gst_pad_use_explicit_caps (afsrc->srcpad); gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get); @@ -258,7 +259,7 @@ gst_afsrc_set_property (GObject * object, guint prop_id, const GValue * value, switch (prop_id) { case ARG_LOCATION: if (src->filename) - g_free (src->filename); + g_free (src->filename); src->filename = g_strdup (g_value_get_string (value)); break; default: @@ -316,8 +317,8 @@ gst_afsrc_open_file (GstAFSrc * src) src->file = afOpenFile (src->filename, "r", AF_NULL_FILESETUP); if (src->file == AF_NULL_FILEHANDLE) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, - (_("Could not open file \"%s\" for reading."), src->filename), - ("system error: %s", strerror (errno))); + (_("Could not open file \"%s\" for reading."), src->filename), + ("system error: %s", strerror (errno))); return FALSE; } @@ -327,33 +328,33 @@ gst_afsrc_open_file (GstAFSrc * src) src->channels = afGetChannels (src->file, AF_DEFAULT_TRACK); afGetSampleFormat (src->file, AF_DEFAULT_TRACK, - &sampleFormat, &sampleWidth); + &sampleFormat, &sampleWidth); switch (sampleFormat) { case AF_SAMPFMT_TWOSCOMP: - src->is_signed = TRUE; - break; + src->is_signed = TRUE; + break; case AF_SAMPFMT_UNSIGNED: - src->is_signed = FALSE; - break; + src->is_signed = FALSE; + break; case AF_SAMPFMT_FLOAT: case AF_SAMPFMT_DOUBLE: - GST_DEBUG ("ERROR: float data not supported yet !\n"); + GST_DEBUG ("ERROR: float data not supported yet !\n"); } src->rate = (guint) afGetRate (src->file, AF_DEFAULT_TRACK); src->width = sampleWidth; GST_DEBUG ("input file: %d channels, %d width, %d rate, signed %s\n", - src->channels, src->width, src->rate, src->is_signed ? "yes" : "no"); + src->channels, src->width, src->rate, src->is_signed ? "yes" : "no"); } /* set caps on src */ gst_pad_set_explicit_caps (src->srcpad, gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, src->is_signed, - "width", G_TYPE_INT, src->width, - "depth", G_TYPE_INT, src->width, - "rate", G_TYPE_INT, src->rate, - "channels", G_TYPE_INT, src->channels, NULL)); + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, src->is_signed, + "width", G_TYPE_INT, src->width, + "depth", G_TYPE_INT, src->width, + "rate", G_TYPE_INT, src->rate, + "channels", G_TYPE_INT, src->channels, NULL)); GST_FLAG_SET (src, GST_AFSRC_OPEN); @@ -369,7 +370,7 @@ gst_afsrc_close_file (GstAFSrc * src) /* if (fclose (src->file) != 0) */ if (afCloseFile (src->file) != 0) { GST_ELEMENT_ERROR (src, RESOURCE, CLOSE, - (_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM); + (_("Error closing file \"%s\"."), src->filename), GST_ERROR_SYSTEM); } else { GST_FLAG_UNSET (src, GST_AFSRC_OPEN); } @@ -393,7 +394,7 @@ gst_afsrc_change_state (GstElement * element) /* g_print ("DEBUG: GST_AFSRC_OPEN not set\n"); */ if (!gst_afsrc_open_file (GST_AFSRC (element))) { /* g_print ("DEBUG: element tries to open file\n"); */ - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; } } } -- cgit v1.2.1