diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
commit | 7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch) | |
tree | f863b467dea9559a6ec9c48affbfae11f8104164 /gst-libs/gst/audio | |
parent | a19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff) | |
download | gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2 gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip |
gst-indent
Original commit message from CVS:
gst-indent
Diffstat (limited to 'gst-libs/gst/audio')
-rw-r--r-- | gst-libs/gst/audio/audio.c | 144 | ||||
-rw-r--r-- | gst-libs/gst/audio/audio.h | 44 | ||||
-rw-r--r-- | gst-libs/gst/audio/audioclock.c | 90 | ||||
-rw-r--r-- | gst-libs/gst/audio/audioclock.h | 22 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudiofilter.c | 188 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudiofilter.h | 29 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudiofiltertemplate.c | 112 |
7 files changed, 312 insertions, 317 deletions
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index d467af49..10a00142 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -26,7 +26,7 @@ #include <gst/gststructure.h> int -gst_audio_frame_byte_size (GstPad* pad) +gst_audio_frame_byte_size (GstPad * pad) { /* calculate byte size of an audio frame * this should be moved closer to the gstreamer core @@ -45,20 +45,20 @@ gst_audio_frame_byte_size (GstPad* pad) if (caps == NULL) { /* ERROR: could not get caps of pad */ - g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + g_warning ("gstaudio: could not get caps of pad %s:%s\n", + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0; } structure = gst_caps_get_structure (caps, 0); - gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "width", &width); gst_structure_get_int (structure, "channels", &channels); - return (width / 8) * channels; + return (width / 8) * channels; } long -gst_audio_frame_length (GstPad* pad, GstBuffer* buf) +gst_audio_frame_length (GstPad * pad, GstBuffer * buf) /* calculate length of buffer in frames * this should be moved closer to the gstreamer core * and be implemented for every mime type IMO @@ -72,13 +72,13 @@ gst_audio_frame_length (GstPad* pad, GstBuffer* buf) /* error */ return 0; /* FIXME: this function assumes the buffer size to be a whole multiple - * of the frame byte size + * of the frame byte size */ return GST_BUFFER_SIZE (buf) / frame_byte_size; } long -gst_audio_frame_rate (GstPad *pad) +gst_audio_frame_rate (GstPad * pad) /* * calculate frame rate (based on caps of pad) * returns 0 if failed, rate if success @@ -93,19 +93,18 @@ gst_audio_frame_rate (GstPad *pad) if (caps == NULL) { /* ERROR: could not get caps of pad */ - g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + g_warning ("gstaudio: could not get caps of pad %s:%s\n", + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0; - } - else { + } else { structure = gst_caps_get_structure (caps, 0); - gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_int (structure, "rate", &rate); return rate; } } -double -gst_audio_length (GstPad* pad, GstBuffer* buf) +double +gst_audio_length (GstPad * pad, GstBuffer * buf) { /* calculate length in seconds * of audio buffer buf @@ -125,20 +124,17 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) g_assert (GST_IS_BUFFER (buf)); /* get caps of pad */ caps = GST_PAD_CAPS (pad); - if (caps == NULL) - { + if (caps == NULL) { /* ERROR: could not get caps of pad */ - g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + g_warning ("gstaudio: could not get caps of pad %s:%s\n", + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); length = 0.0; - } - else - { + } else { structure = gst_caps_get_structure (caps, 0); bytes = GST_BUFFER_SIZE (buf); - gst_structure_get_int (structure, "width", &width); - gst_structure_get_int (structure, "channels", &channels); - gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "channels", &channels); + gst_structure_get_int (structure, "rate", &rate); g_assert (bytes != 0); g_assert (width != 0); @@ -150,8 +146,8 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) return length; } -long -gst_audio_highest_sample_value (GstPad* pad) +long +gst_audio_highest_sample_value (GstPad * pad) /* calculate highest possible sample value * based on capabilities of pad */ @@ -160,25 +156,25 @@ gst_audio_highest_sample_value (GstPad* pad) gint width = 0; const GstCaps *caps = NULL; GstStructure *structure; - + caps = GST_PAD_CAPS (pad); - if (caps == NULL) - { - g_warning ("gstaudio: could not get caps of pad %s:%s\n", - GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); + if (caps == NULL) { + g_warning ("gstaudio: could not get caps of pad %s:%s\n", + GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); } - + structure = gst_caps_get_structure (caps, 0); - gst_structure_get_int (structure, "width", &width); - gst_structure_get_boolean (structure, "signed", &is_signed); - - if (is_signed) --width; + gst_structure_get_int (structure, "width", &width); + gst_structure_get_boolean (structure, "signed", &is_signed); + + if (is_signed) + --width; /* example : 16 bit, signed : samples between -32768 and 32767 */ return ((long) (1 << width)); } -gboolean -gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf) +gboolean +gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf) /* check if the buffer size is a whole multiple of the frame size */ { if (GST_BUFFER_SIZE (buf) % gst_audio_frame_byte_size (pad) == 0) @@ -199,8 +195,8 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf) * number of list values, and each of the values, terminating with NULL */ static void -_gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname, - GType type, int number, ...) +_gst_audio_structure_set_list (GstStructure * structure, + const gchar * fieldname, GType type, int number, ...) { va_list varargs; GValue value = { 0 }; @@ -214,27 +210,27 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname, va_start (varargs, number); - for (j = 0; j < number; ++j) - { + for (j = 0; j < number; ++j) { int i; gboolean b; GValue list_value = { 0 }; - switch (type) - { + switch (type) { case G_TYPE_INT: - i = va_arg (varargs, int); - g_value_init (&list_value, G_TYPE_INT); - g_value_set_int (&list_value, i); - break; + i = va_arg (varargs, int); + + g_value_init (&list_value, G_TYPE_INT); + g_value_set_int (&list_value, i); + break; case G_TYPE_BOOLEAN: - b = va_arg (varargs, gboolean); - g_value_init (&list_value, G_TYPE_BOOLEAN); - g_value_set_boolean (&list_value, b); - break; - default: - g_warning ("_gst_audio_structure_set_list: LIST of given type not implemented."); + b = va_arg (varargs, gboolean); + g_value_init (&list_value, G_TYPE_BOOLEAN); + g_value_set_boolean (&list_value, b); + break; + default: + g_warning + ("_gst_audio_structure_set_list: LIST of given type not implemented."); } g_array_append_val (array, list_value); @@ -244,38 +240,38 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname, } void -gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag) +gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag) { if (flag & GST_AUDIO_FIELD_RATE) - gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, + NULL); if (flag & GST_AUDIO_FIELD_CHANNELS) - gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, + NULL); if (flag & GST_AUDIO_FIELD_ENDIANNESS) - _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2, G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL); + _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2, + G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL); if (flag & GST_AUDIO_FIELD_WIDTH) - _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32, NULL); + _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32, + NULL); if (flag & GST_AUDIO_FIELD_DEPTH) gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL); if (flag & GST_AUDIO_FIELD_SIGNED) - _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE, FALSE, NULL); + _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE, + FALSE, NULL); if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES) - gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, + G_MAXINT, NULL); } static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { return TRUE; } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstaudio", - "Support services for audio plugins", - plugin_init, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -); +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstaudio", + "Support services for audio plugins", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN); diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h index 4a3428dd..5f21e018 100644 --- a/gst-libs/gst/audio/audio.h +++ b/gst-libs/gst/audio/audio.h @@ -26,7 +26,6 @@ #define __GST_AUDIO_AUDIO_H__ G_BEGIN_DECLS - /* For people that are looking at this source: the purpose of these defines is * to make GstCaps a bit easier, in that you don't have to know all of the * properties that need to be defined. you can just use these macros. currently @@ -50,9 +49,7 @@ G_BEGIN_DECLS * * Andy Wingo, 18 August 2001 * Thomas, 6 September 2002 */ - #define GST_AUDIO_DEF_RATE 44100 - #define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \ "audio/x-raw-int, " \ "rate = (int) [ 1, MAX ], " \ @@ -60,9 +57,7 @@ G_BEGIN_DECLS "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \ "width = (int) { 8, 16, 32 }, " \ "depth = (int) [ 1, 32 ], " \ - "signed = (boolean) { true, false }" - - + "signed = (boolean) { true, false }" /* "standard" int audio is native order, 16 bit stereo. */ #define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \ "audio/x-raw-int, " \ @@ -71,8 +66,7 @@ G_BEGIN_DECLS "endianness = (int) BYTE_ORDER, " \ "width = (int) 16, " \ "depth = (int) 16, " \ - "signed = (boolean) true" - + "signed = (boolean) true" #define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \ "audio/x-raw-float, " \ "rate = (int) [ 1, MAX ], " \ @@ -80,7 +74,6 @@ G_BEGIN_DECLS "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \ "width = (int) { 32, 64 }, " \ "buffer-frames = (int) [ 1, MAX]" - /* "standard" float audio is native order, 32 bit mono. */ #define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \ "audio/x-raw-float, " \ @@ -88,43 +81,42 @@ G_BEGIN_DECLS "channels = (int) 1, " \ "endianness = (int) BYTE_ORDER, " \ "buffer-frames = (int) [ 1, MAX]" - /* * this library defines and implements some helper functions for audio * handling */ - /* get byte size of audio frame (based on caps of pad */ -int gst_audio_frame_byte_size (GstPad* pad); +int gst_audio_frame_byte_size (GstPad * pad); /* get length in frames of buffer */ -long gst_audio_frame_length (GstPad* pad, GstBuffer* buf); +long gst_audio_frame_length (GstPad * pad, GstBuffer * buf); /* get frame rate based on caps */ -long gst_audio_frame_rate (GstPad *pad); +long gst_audio_frame_rate (GstPad * pad); /* calculate length in seconds of audio buffer buf based on caps of pad */ -double gst_audio_length (GstPad* pad, GstBuffer* buf); +double gst_audio_length (GstPad * pad, GstBuffer * buf); /* calculate highest possible sample value based on capabilities of pad */ -long gst_audio_highest_sample_value (GstPad* pad); +long gst_audio_highest_sample_value (GstPad * pad); /* check if the buffer size is a whole multiple of the frame size */ -gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf); +gboolean gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf); /* functions useful for _getcaps functions */ -typedef enum { - GST_AUDIO_FIELD_RATE = (1 << 0), - GST_AUDIO_FIELD_CHANNELS = (1 << 1), - GST_AUDIO_FIELD_ENDIANNESS = (1 << 2), - GST_AUDIO_FIELD_WIDTH = (1 << 3), - GST_AUDIO_FIELD_DEPTH = (1 << 4), - GST_AUDIO_FIELD_SIGNED = (1 << 5), +typedef enum +{ + GST_AUDIO_FIELD_RATE = (1 << 0), + GST_AUDIO_FIELD_CHANNELS = (1 << 1), + GST_AUDIO_FIELD_ENDIANNESS = (1 << 2), + GST_AUDIO_FIELD_WIDTH = (1 << 3), + GST_AUDIO_FIELD_DEPTH = (1 << 4), + GST_AUDIO_FIELD_SIGNED = (1 << 5), GST_AUDIO_FIELD_BUFFER_FRAMES = (1 << 6) } GstAudioFieldFlag; -void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag); +void gst_audio_structure_set_int (GstStructure * structure, + GstAudioFieldFlag flag); G_END_DECLS - #endif /* __GST_AUDIO_AUDIO_H__ */ diff --git a/gst-libs/gst/audio/audioclock.c b/gst-libs/gst/audio/audioclock.c index 77c7e576..d6d1da45 100644 --- a/gst-libs/gst/audio/audioclock.c +++ b/gst-libs/gst/audio/audioclock.c @@ -26,23 +26,24 @@ #include "audioclock.h" -static void gst_audio_clock_class_init (GstAudioClockClass *klass); -static void gst_audio_clock_init (GstAudioClock *clock); +static void gst_audio_clock_class_init (GstAudioClockClass * klass); +static void gst_audio_clock_init (GstAudioClock * clock); -static GstClockTime gst_audio_clock_get_internal_time (GstClock *clock); -static GstClockReturn gst_audio_clock_id_wait_async (GstClock *clock, - GstClockEntry *entry); -static void gst_audio_clock_id_unschedule (GstClock *clock, - GstClockEntry *entry); +static GstClockTime gst_audio_clock_get_internal_time (GstClock * clock); +static GstClockReturn gst_audio_clock_id_wait_async (GstClock * clock, + GstClockEntry * entry); +static void gst_audio_clock_id_unschedule (GstClock * clock, + GstClockEntry * entry); static GstSystemClockClass *parent_class = NULL; + /* static guint gst_audio_clock_signals[LAST_SIGNAL] = { 0 }; */ - + GType gst_audio_clock_get_type (void) -{ +{ static GType clock_type = 0; - + if (!clock_type) { static const GTypeInfo clock_info = { sizeof (GstAudioClockClass), @@ -57,32 +58,32 @@ gst_audio_clock_get_type (void) NULL }; clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock", - &clock_info, 0); + &clock_info, 0); } return clock_type; } static void -gst_audio_clock_class_init (GstAudioClockClass *klass) +gst_audio_clock_class_init (GstAudioClockClass * klass) { GObjectClass *gobject_class; GstObjectClass *gstobject_class; GstClockClass *gstclock_class; - gobject_class = (GObjectClass*) klass; - gstobject_class = (GstObjectClass*) klass; - gstclock_class = (GstClockClass*) klass; + gobject_class = (GObjectClass *) klass; + gstobject_class = (GstObjectClass *) klass; + gstclock_class = (GstClockClass *) klass; parent_class = g_type_class_ref (GST_TYPE_SYSTEM_CLOCK); - gstclock_class->get_internal_time = gst_audio_clock_get_internal_time; - gstclock_class->wait_async = gst_audio_clock_id_wait_async; - gstclock_class->unschedule = gst_audio_clock_id_unschedule; + gstclock_class->get_internal_time = gst_audio_clock_get_internal_time; + gstclock_class->wait_async = gst_audio_clock_id_wait_async; + gstclock_class->unschedule = gst_audio_clock_id_unschedule; } static void -gst_audio_clock_init (GstAudioClock *clock) +gst_audio_clock_init (GstAudioClock * clock) { gst_object_set_name (GST_OBJECT (clock), "GstAudioClock"); @@ -90,20 +91,22 @@ gst_audio_clock_init (GstAudioClock *clock) clock->prev2 = 0; } -GstClock* -gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, gpointer user_data) +GstClock * +gst_audio_clock_new (gchar * name, GstAudioClockGetTimeFunc func, + gpointer user_data) { - GstAudioClock *aclock = GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL)); + GstAudioClock *aclock = + GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL)); aclock->func = func; aclock->user_data = user_data; aclock->adjust = 0; - return (GstClock*)aclock; + return (GstClock *) aclock; } void -gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active) +gst_audio_clock_set_active (GstAudioClock * aclock, gboolean active) { GstClockTime time; GstClock *clock; @@ -117,8 +120,9 @@ gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active) aclock->adjust = time - aclock->func (clock, aclock->user_data); } else { GTimeVal timeval; + g_get_current_time (&timeval); - + aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time; } @@ -126,22 +130,22 @@ gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active) } static GstClockTime -gst_audio_clock_get_internal_time (GstClock *clock) +gst_audio_clock_get_internal_time (GstClock * clock) { GstAudioClock *aclock = GST_AUDIO_CLOCK (clock); - + if (aclock->active) { return aclock->func (clock, aclock->user_data) + aclock->adjust; } else { GTimeVal timeval; - + g_get_current_time (&timeval); return GST_TIMEVAL_TO_TIME (timeval); } } void -gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time) +gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time) { /* I don't know of a purpose in updating these; perhaps they can be removed */ aclock->prev2 = aclock->prev1; @@ -150,43 +154,41 @@ gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time) /* FIXME: the wait_async subsystem should be made threadsafe, but I don't want * to lock and unlock a mutex on every iteration... */ while (aclock->async_entries) { - GstClockEntry *entry = (GstClockEntry*)aclock->async_entries->data; - + GstClockEntry *entry = (GstClockEntry *) aclock->async_entries->data; + if (entry->time > time) break; - entry->func ((GstClock*)aclock, time, entry, entry->user_data); + entry->func ((GstClock *) aclock, time, entry, entry->user_data); aclock->async_entries = g_slist_delete_link (aclock->async_entries, - aclock->async_entries); + aclock->async_entries); /* do I need to free the entry? */ } } static gint -compare_clock_entries (GstClockEntry *entry1, GstClockEntry *entry2) +compare_clock_entries (GstClockEntry * entry1, GstClockEntry * entry2) { return entry1->time - entry2->time; } static GstClockReturn -gst_audio_clock_id_wait_async (GstClock *clock, GstClockEntry *entry) +gst_audio_clock_id_wait_async (GstClock * clock, GstClockEntry * entry) { - GstAudioClock *aclock = (GstAudioClock*)clock; - + GstAudioClock *aclock = (GstAudioClock *) clock; + aclock->async_entries = g_slist_insert_sorted (aclock->async_entries, - entry, - (GCompareFunc)compare_clock_entries); + entry, (GCompareFunc) compare_clock_entries); /* is this the proper return val? */ return GST_CLOCK_EARLY; } static void -gst_audio_clock_id_unschedule (GstClock *clock, GstClockEntry *entry) +gst_audio_clock_id_unschedule (GstClock * clock, GstClockEntry * entry) { - GstAudioClock *aclock = (GstAudioClock*)clock; - - aclock->async_entries = g_slist_remove (aclock->async_entries, - entry); + GstAudioClock *aclock = (GstAudioClock *) clock; + + aclock->async_entries = g_slist_remove (aclock->async_entries, entry); } diff --git a/gst-libs/gst/audio/audioclock.h b/gst-libs/gst/audio/audioclock.h index 17439242..abb07541 100644 --- a/gst-libs/gst/audio/audioclock.h +++ b/gst-libs/gst/audio/audioclock.h @@ -27,7 +27,6 @@ #include <gst/gstsystemclock.h> G_BEGIN_DECLS - #define GST_TYPE_AUDIO_CLOCK \ (gst_audio_clock_get_type()) #define GST_AUDIO_CLOCK(obj) \ @@ -38,14 +37,15 @@ G_BEGIN_DECLS (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK)) #define GST_IS_AUDIO_CLOCK_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK)) - typedef struct _GstAudioClock GstAudioClock; typedef struct _GstAudioClockClass GstAudioClockClass; -typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data); +typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock * clock, + gpointer user_data); -struct _GstAudioClock { +struct _GstAudioClock +{ GstSystemClock clock; GstClockTime prev1, prev2; @@ -63,19 +63,19 @@ struct _GstAudioClock { gpointer _gst_reserved[GST_PADDING]; }; -struct _GstAudioClockClass { +struct _GstAudioClockClass +{ GstSystemClockClass parent_class; gpointer _gst_reserved[GST_PADDING]; }; -GType gst_audio_clock_get_type (void); -GstClock* gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, - gpointer user_data); -void gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active); +GType gst_audio_clock_get_type (void); +GstClock *gst_audio_clock_new (gchar * name, GstAudioClockGetTimeFunc func, + gpointer user_data); +void gst_audio_clock_set_active (GstAudioClock * aclock, gboolean active); -void gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time); +void gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time); G_END_DECLS - #endif /* __GST_AUDIO_CLOCK_H__ */ diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c index 35ed4875..ad491bb6 100644 --- a/gst-libs/gst/audio/gstaudiofilter.c +++ b/gst-libs/gst/audio/gstaudiofilter.c @@ -29,26 +29,30 @@ /* GstAudiofilter signals and args */ -enum { +enum +{ /* FILL ME */ LAST_SIGNAL }; -enum { +enum +{ ARG_0, ARG_METHOD, /* FILL ME */ }; -static void gst_audiofilter_base_init (gpointer g_class); -static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data); -static void gst_audiofilter_init (GTypeInstance *instance, gpointer g_class); +static void gst_audiofilter_base_init (gpointer g_class); +static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data); +static void gst_audiofilter_init (GTypeInstance * instance, gpointer g_class); -static void gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_audiofilter_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_audiofilter_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); -static void gst_audiofilter_chain (GstPad *pad, GstData *_data); -GstCaps * gst_audiofilter_class_get_capslist(GstAudiofilterClass *klass); +static void gst_audiofilter_chain (GstPad * pad, GstData * _data); +GstCaps *gst_audiofilter_class_get_capslist (GstAudiofilterClass * klass); static GstElementClass *parent_class = NULL; @@ -59,23 +63,24 @@ gst_audiofilter_get_type (void) if (!audiofilter_type) { static const GTypeInfo audiofilter_info = { - sizeof(GstAudiofilterClass), + sizeof (GstAudiofilterClass), gst_audiofilter_base_init, NULL, gst_audiofilter_class_init, NULL, NULL, - sizeof(GstAudiofilter), + sizeof (GstAudiofilter), 0, gst_audiofilter_init, }; - audiofilter_type = g_type_register_static(GST_TYPE_ELEMENT, + audiofilter_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT); } return audiofilter_type; } -static void gst_audiofilter_base_init (gpointer g_class) +static void +gst_audiofilter_base_init (gpointer g_class) { static GstElementDetails audiofilter_details = { "Audio filter base class", @@ -89,24 +94,25 @@ static void gst_audiofilter_base_init (gpointer g_class) gst_element_class_set_details (element_class, &audiofilter_details); } -static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data) +static void +gst_audiofilter_class_init (gpointer g_class, gpointer class_data) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstAudiofilterClass *klass; - klass = (GstAudiofilterClass *)g_class; - gobject_class = (GObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; + klass = (GstAudiofilterClass *) g_class; + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; - parent_class = g_type_class_ref(GST_TYPE_ELEMENT); + parent_class = g_type_class_ref (GST_TYPE_ELEMENT); gobject_class->set_property = gst_audiofilter_set_property; gobject_class->get_property = gst_audiofilter_get_property; } static GstPadLinkReturn -gst_audiofilter_link (GstPad *pad, const GstCaps *caps) +gst_audiofilter_link (GstPad * pad, const GstCaps * caps) { GstAudiofilter *audiofilter; GstPadLinkReturn ret; @@ -114,11 +120,10 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps) GstStructure *structure; GstAudiofilterClass *audiofilter_class; - GST_DEBUG("gst_audiofilter_link"); + GST_DEBUG ("gst_audiofilter_link"); audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad)); - audiofilter_class = GST_AUDIOFILTER_CLASS ( - G_OBJECT_GET_CLASS (audiofilter)); - + audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter)); + if (pad == audiofilter->srcpad) { link_ret = gst_pad_try_set_caps (audiofilter->sinkpad, caps); @@ -135,53 +140,55 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps) if (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0) { ret = gst_structure_get_int (structure, "depth", &audiofilter->depth); ret &= gst_structure_get_int (structure, "width", &audiofilter->width); - ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels); + ret &= + gst_structure_get_int (structure, "channels", &audiofilter->channels); } else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") == 0) { } else { - g_assert_not_reached(); + g_assert_not_reached (); } ret &= gst_structure_get_int (structure, "rate", &audiofilter->rate); - audiofilter->bytes_per_sample = (audiofilter->width/8) * - audiofilter->channels; + audiofilter->bytes_per_sample = (audiofilter->width / 8) * + audiofilter->channels; - if (audiofilter_class->setup) (audiofilter_class->setup) (audiofilter); + if (audiofilter_class->setup) + (audiofilter_class->setup) (audiofilter); return GST_PAD_LINK_OK; } static void -gst_audiofilter_init (GTypeInstance *instance, gpointer g_class) +gst_audiofilter_init (GTypeInstance * instance, gpointer g_class) { GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance); GstPadTemplate *pad_template; - GST_DEBUG("gst_audiofilter_init"); - - pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class), - "sink"); - g_return_if_fail(pad_template != NULL); - audiofilter->sinkpad = gst_pad_new_from_template(pad_template, "sink"); - gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->sinkpad); - gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain); - gst_pad_set_link_function(audiofilter->sinkpad,gst_audiofilter_link); - gst_pad_set_getcaps_function(audiofilter->sinkpad,gst_pad_proxy_getcaps); - - pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class), - "src"); - g_return_if_fail(pad_template != NULL); - audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src"); - gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad); - gst_pad_set_link_function(audiofilter->srcpad,gst_audiofilter_link); - gst_pad_set_getcaps_function(audiofilter->srcpad,gst_pad_proxy_getcaps); + GST_DEBUG ("gst_audiofilter_init"); + + pad_template = + gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink"); + g_return_if_fail (pad_template != NULL); + audiofilter->sinkpad = gst_pad_new_from_template (pad_template, "sink"); + gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->sinkpad); + gst_pad_set_chain_function (audiofilter->sinkpad, gst_audiofilter_chain); + gst_pad_set_link_function (audiofilter->sinkpad, gst_audiofilter_link); + gst_pad_set_getcaps_function (audiofilter->sinkpad, gst_pad_proxy_getcaps); + + pad_template = + gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src"); + g_return_if_fail (pad_template != NULL); + audiofilter->srcpad = gst_pad_new_from_template (pad_template, "src"); + gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->srcpad); + gst_pad_set_link_function (audiofilter->srcpad, gst_audiofilter_link); + gst_pad_set_getcaps_function (audiofilter->srcpad, gst_pad_proxy_getcaps); audiofilter->inited = FALSE; } static void -gst_audiofilter_chain (GstPad *pad, GstData *data) +gst_audiofilter_chain (GstPad * pad, GstData * data) { GstBuffer *inbuf = GST_BUFFER (data); GstAudiofilter *audiofilter; @@ -196,60 +203,60 @@ gst_audiofilter_chain (GstPad *pad, GstData *data) audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad)); //g_return_if_fail (audiofilter->inited); - audiofilter_class = GST_AUDIOFILTER_CLASS ( - G_OBJECT_GET_CLASS (audiofilter)); + audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter)); GST_DEBUG ("gst_audiofilter_chain: got buffer of %d bytes in '%s'", - GST_BUFFER_SIZE(inbuf), GST_OBJECT_NAME (audiofilter)); - - if(audiofilter->passthru){ - gst_pad_push(audiofilter->srcpad, data); + GST_BUFFER_SIZE (inbuf), GST_OBJECT_NAME (audiofilter)); + + if (audiofilter->passthru) { + gst_pad_push (audiofilter->srcpad, data); return; } audiofilter->size = GST_BUFFER_SIZE (inbuf); audiofilter->n_samples = audiofilter->size / audiofilter->bytes_per_sample; - if (gst_data_is_writable(data)) { + if (gst_data_is_writable (data)) { if (audiofilter_class->filter_inplace) { (audiofilter_class->filter_inplace) (audiofilter, inbuf); outbuf = inbuf; } else { - outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf)); - GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf); - GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf); + outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf)); + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf); + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf); (audiofilter_class->filter) (audiofilter, outbuf, inbuf); - gst_buffer_unref(inbuf); + gst_buffer_unref (inbuf); } } else { - outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf)); - GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf); - GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf); + outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf)); + GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf); + GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf); if (audiofilter_class->filter) { (audiofilter_class->filter) (audiofilter, outbuf, inbuf); } else { - memcpy(GST_BUFFER_DATA(outbuf), GST_BUFFER_DATA(inbuf), - GST_BUFFER_SIZE(inbuf)); + memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), + GST_BUFFER_SIZE (inbuf)); (audiofilter_class->filter_inplace) (audiofilter, outbuf); } - gst_buffer_unref(inbuf); + gst_buffer_unref (inbuf); } - gst_pad_push(audiofilter->srcpad, GST_DATA (outbuf)); + gst_pad_push (audiofilter->srcpad, GST_DATA (outbuf)); } static void -gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +gst_audiofilter_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { GstAudiofilter *src; /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_AUDIOFILTER(object)); - src = GST_AUDIOFILTER(object); + g_return_if_fail (GST_IS_AUDIOFILTER (object)); + src = GST_AUDIOFILTER (object); - GST_DEBUG("gst_audiofilter_set_property"); + GST_DEBUG ("gst_audiofilter_set_property"); switch (prop_id) { default: break; @@ -257,13 +264,14 @@ gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *valu } static void -gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +gst_audiofilter_get_property (GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec) { GstAudiofilter *src; /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_AUDIOFILTER(object)); - src = GST_AUDIOFILTER(object); + g_return_if_fail (GST_IS_AUDIOFILTER (object)); + src = GST_AUDIOFILTER (object); switch (prop_id) { default: @@ -272,37 +280,31 @@ gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GPa } } -void gst_audiofilter_class_add_pad_templates ( - GstAudiofilterClass *audiofilter_class, const GstCaps *caps) +void +gst_audiofilter_class_add_pad_templates (GstAudiofilterClass * + audiofilter_class, const GstCaps * caps) { GstElementClass *element_class = GST_ELEMENT_CLASS (audiofilter_class); - audiofilter_class->caps = gst_caps_copy(caps); + audiofilter_class->caps = gst_caps_copy (caps); gst_element_class_add_pad_template (element_class, - gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS, - gst_caps_copy(caps))); + gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, + gst_caps_copy (caps))); gst_element_class_add_pad_template (element_class, - gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - gst_caps_copy(caps))); + gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, + gst_caps_copy (caps))); } static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { return TRUE; } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstaudiofilter", - "Audio filter parent class", - plugin_init, - VERSION, - "LGPL", - GST_PACKAGE, - GST_ORIGIN -) - +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstaudiofilter", + "Audio filter parent class", + plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN) diff --git a/gst-libs/gst/audio/gstaudiofilter.h b/gst-libs/gst/audio/gstaudiofilter.h index 9786e16c..534d4c6b 100644 --- a/gst-libs/gst/audio/gstaudiofilter.h +++ b/gst-libs/gst/audio/gstaudiofilter.h @@ -25,17 +25,15 @@ #include <gst/gst.h> -G_BEGIN_DECLS - -typedef struct _GstAudiofilter GstAudiofilter; +G_BEGIN_DECLS typedef struct _GstAudiofilter GstAudiofilter; typedef struct _GstAudiofilterClass GstAudiofilterClass; -typedef void (*GstAudiofilterFilterFunc)(GstAudiofilter *filter, - GstBuffer *outbuf, GstBuffer *inbuf); -typedef void (*GstAudiofilterInplaceFilterFunc)(GstAudiofilter *filter, - GstBuffer *buffer); +typedef void (*GstAudiofilterFilterFunc) (GstAudiofilter * filter, + GstBuffer * outbuf, GstBuffer * inbuf); +typedef void (*GstAudiofilterInplaceFilterFunc) (GstAudiofilter * filter, + GstBuffer * buffer); -typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter); +typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter * filter); #define GST_TYPE_AUDIOFILTER \ @@ -49,10 +47,11 @@ typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter); #define GST_IS_AUDIOFILTER_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER)) -struct _GstAudiofilter { +struct _GstAudiofilter +{ GstElement element; - GstPad *sinkpad,*srcpad; + GstPad *sinkpad, *srcpad; /* audio state */ gboolean inited; @@ -68,7 +67,8 @@ struct _GstAudiofilter { int bytes_per_sample; }; -struct _GstAudiofilterClass { +struct _GstAudiofilterClass +{ GstElementClass parent_class; GstCaps *caps; @@ -77,11 +77,10 @@ struct _GstAudiofilterClass { GstAudiofilterFilterFunc filter; }; -GType gst_audiofilter_get_type(void); +GType gst_audiofilter_get_type (void); -void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *audiofilterclass, const GstCaps *caps); +void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass * + audiofilterclass, const GstCaps * caps); G_END_DECLS - #endif /* __GST_AUDIOFILTER_H__ */ - diff --git a/gst-libs/gst/audio/gstaudiofiltertemplate.c b/gst-libs/gst/audio/gstaudiofiltertemplate.c index c7c0ce2b..994fdc59 100644 --- a/gst-libs/gst/audio/gstaudiofiltertemplate.c +++ b/gst-libs/gst/audio/gstaudiofiltertemplate.c @@ -48,37 +48,47 @@ typedef struct _GstAudiofilterTemplateClass GstAudiofilterTemplateClass; #define GST_IS_AUDIOFILTER_TEMPLATE_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER_TEMPLATE)) -struct _GstAudiofilterTemplate { +struct _GstAudiofilterTemplate +{ GstAudiofilter audiofilter; }; -struct _GstAudiofilterTemplateClass { +struct _GstAudiofilterTemplateClass +{ GstAudiofilterClass parent_class; }; -enum { +enum +{ /* FILL ME */ LAST_SIGNAL }; -enum { +enum +{ ARG_0, /* FILL ME */ }; -static void gst_audiofilter_template_base_init (gpointer g_class); -static void gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data); -static void gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class); +static void gst_audiofilter_template_base_init (gpointer g_class); +static void gst_audiofilter_template_class_init (gpointer g_class, + gpointer class_data); +static void gst_audiofilter_template_init (GTypeInstance * instance, + gpointer g_class); -static void gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_audiofilter_template_set_property (GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec); +static void gst_audiofilter_template_get_property (GObject * object, + guint prop_id, GValue * value, GParamSpec * pspec); -static void gst_audiofilter_template_setup (GstAudiofilter *audiofilter); -static void gst_audiofilter_template_filter (GstAudiofilter *audiofilter, GstBuffer *outbuf, GstBuffer *inbuf); -static void gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter, GstBuffer *buf); +static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter); +static void gst_audiofilter_template_filter (GstAudiofilter * audiofilter, + GstBuffer * outbuf, GstBuffer * inbuf); +static void gst_audiofilter_template_filter_inplace (GstAudiofilter * + audiofilter, GstBuffer * buf); GType gst_audiofilter_template_get_type (void) @@ -87,23 +97,24 @@ gst_audiofilter_template_get_type (void) if (!audiofilter_template_type) { static const GTypeInfo audiofilter_template_info = { - sizeof(GstAudiofilterTemplateClass), + sizeof (GstAudiofilterTemplateClass), gst_audiofilter_template_base_init, NULL, gst_audiofilter_template_class_init, NULL, gst_audiofilter_template_init, - sizeof(GstAudiofilterTemplate), + sizeof (GstAudiofilterTemplate), 0, NULL, }; - audiofilter_template_type = g_type_register_static(GST_TYPE_AUDIOFILTER, + audiofilter_template_type = g_type_register_static (GST_TYPE_AUDIOFILTER, "GstAudiofilterTemplate", &audiofilter_template_info, 0); } return audiofilter_template_type; } -static void gst_audiofilter_template_base_init (gpointer g_class) +static void +gst_audiofilter_template_base_init (gpointer g_class) { static GstElementDetails audiofilter_template_details = { "Audio filter template", @@ -128,16 +139,16 @@ gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data) GstAudiofilterTemplateClass *klass; GstAudiofilterClass *audiofilter_class; - klass = (GstAudiofilterTemplateClass *)g_class; - gobject_class = (GObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; - audiofilter_class = (GstAudiofilterClass *)g_class; + klass = (GstAudiofilterTemplateClass *) g_class; + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + audiofilter_class = (GstAudiofilterClass *) g_class; #if 0 - g_object_class_install_property(gobject_class, ARG_METHOD, - g_param_spec_enum("method","method","method", - GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1, - G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_METHOD, + g_param_spec_enum ("method", "method", "method", + GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1, + G_PARAM_READWRITE)); #endif gobject_class->set_property = gst_audiofilter_template_set_property; @@ -146,11 +157,11 @@ gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data) audiofilter_class->setup = gst_audiofilter_template_setup; audiofilter_class->filter = gst_audiofilter_template_filter; audiofilter_class->filter_inplace = gst_audiofilter_template_filter_inplace; -audiofilter_class->filter = NULL; + audiofilter_class->filter = NULL; } static void -gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class) +gst_audiofilter_template_init (GTypeInstance * instance, gpointer g_class) { //GstAudiofilterTemplate *audiofilter_template = GST_AUDIOFILTER_TEMPLATE (instance); //GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance); @@ -162,15 +173,16 @@ gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class) } static void -gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +gst_audiofilter_template_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) { GstAudiofilterTemplate *src; /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_AUDIOFILTER_TEMPLATE(object)); - src = GST_AUDIOFILTER_TEMPLATE(object); + g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (object)); + src = GST_AUDIOFILTER_TEMPLATE (object); - GST_DEBUG("gst_audiofilter_template_set_property"); + GST_DEBUG ("gst_audiofilter_template_set_property"); switch (prop_id) { default: break; @@ -178,13 +190,14 @@ gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GVa } static void -gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +gst_audiofilter_template_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) { GstAudiofilterTemplate *src; /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_AUDIOFILTER_TEMPLATE(object)); - src = GST_AUDIOFILTER_TEMPLATE(object); + g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (object)); + src = GST_AUDIOFILTER_TEMPLATE (object); switch (prop_id) { default: @@ -194,7 +207,7 @@ gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *v } static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { if (!gst_library_load ("gstaudiofilter")) return FALSE; @@ -203,20 +216,13 @@ plugin_init (GstPlugin *plugin) GST_TYPE_AUDIOFILTER_TEMPLATE); } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstaudiofilter_template", - "Audio filter template", - plugin_init, - VERSION, - "LGPL", - GST_PACKAGE, - GST_ORIGIN -) +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gstaudiofilter_template", + "Audio filter template", + plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN) -static void -gst_audiofilter_template_setup (GstAudiofilter *audiofilter) + static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter) { GstAudiofilterTemplate *audiofilter_template; @@ -234,8 +240,8 @@ gst_audiofilter_template_setup (GstAudiofilter *audiofilter) * with a minimum of memory copies. */ static void -gst_audiofilter_template_filter (GstAudiofilter *audiofilter, - GstBuffer *outbuf, GstBuffer *inbuf) +gst_audiofilter_template_filter (GstAudiofilter * audiofilter, + GstBuffer * outbuf, GstBuffer * inbuf) { GstAudiofilterTemplate *audiofilter_template; @@ -245,13 +251,12 @@ gst_audiofilter_template_filter (GstAudiofilter *audiofilter, /* do something interesting here. This simply copies the source * to the destination. */ - memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), - audiofilter->size); + memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), audiofilter->size); } static void -gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter, - GstBuffer *buf) +gst_audiofilter_template_filter_inplace (GstAudiofilter * audiofilter, + GstBuffer * buf) { GstAudiofilterTemplate *audiofilter_template; @@ -262,4 +267,3 @@ gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter, * to the destination. */ } - |