From 086b25d40a8fc3606d70c32af7f6af178e2d804d Mon Sep 17 00:00:00 2001 From: Christian Schaller Date: Fri, 6 May 2005 11:41:28 +0000 Subject: remove gst-libs from gst-plugins module as it is in gst-plugins-base now Original commit message from CVS: remove gst-libs from gst-plugins module as it is in gst-plugins-base now --- gst-libs/gst/audio/Makefile.am | 53 --- gst-libs/gst/audio/audio.c | 280 ------------ gst-libs/gst/audio/audio.def | 5 - gst-libs/gst/audio/audio.h | 131 ------ gst-libs/gst/audio/audio.vcproj | 153 ------- gst-libs/gst/audio/audioclock.c | 205 --------- gst-libs/gst/audio/audioclock.h | 81 ---- gst-libs/gst/audio/audiofilter.vcproj | 144 ------- gst-libs/gst/audio/gstaudiofilter.c | 313 -------------- gst-libs/gst/audio/gstaudiofilter.h | 87 ---- gst-libs/gst/audio/gstaudiofiltertemplate.c | 270 ------------ gst-libs/gst/audio/make_filter | 42 -- gst-libs/gst/audio/multichannel.c | 634 ---------------------------- gst-libs/gst/audio/multichannel.h | 90 ---- gst-libs/gst/audio/testchannels.c | 55 --- 15 files changed, 2543 deletions(-) delete mode 100644 gst-libs/gst/audio/Makefile.am delete mode 100644 gst-libs/gst/audio/audio.c delete mode 100644 gst-libs/gst/audio/audio.def delete mode 100644 gst-libs/gst/audio/audio.h delete mode 100644 gst-libs/gst/audio/audio.vcproj delete mode 100644 gst-libs/gst/audio/audioclock.c delete mode 100644 gst-libs/gst/audio/audioclock.h delete mode 100644 gst-libs/gst/audio/audiofilter.vcproj delete mode 100644 gst-libs/gst/audio/gstaudiofilter.c delete mode 100644 gst-libs/gst/audio/gstaudiofilter.h delete mode 100644 gst-libs/gst/audio/gstaudiofiltertemplate.c delete mode 100755 gst-libs/gst/audio/make_filter delete mode 100644 gst-libs/gst/audio/multichannel.c delete mode 100644 gst-libs/gst/audio/multichannel.h delete mode 100644 gst-libs/gst/audio/testchannels.c (limited to 'gst-libs/gst/audio') diff --git a/gst-libs/gst/audio/Makefile.am b/gst-libs/gst/audio/Makefile.am deleted file mode 100644 index f00717b1..00000000 --- a/gst-libs/gst/audio/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -# variables used for enum/marshal generation -glib_enum_headers=multichannel.h -glib_enum_define=GST_AUDIO -glib_enum_prefix=gst_audio - -built_sources = multichannel-enumtypes.c -built_headers = multichannel-enumtypes.h -BUILT_SOURCES = $(built_sources) $(built_headers) - -librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@ - -library_LTLIBRARIES = libgstaudio.la libgstaudiofilter.la -noinst_LTLIBRARIES = libgstaudiofilterexample.la - -EXTRA_DIST = gstaudiofiltertemplate.c make_filter -CLEANFILES = gstaudiofilterexample.c \ - $(BUILT_SOURCES) - -libgstaudio_la_SOURCES = audio.c audioclock.c \ - multichannel.c -nodist_libgstaudio_la_SOURCES = $(built_sources) - -libgstaudioincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/audio -libgstaudioinclude_HEADERS = \ - audio.h \ - audioclock.h \ - gstaudiofilter.h \ - multichannel.h - -nodist_libgstaudioinclude_HEADERS = \ - multichannel-enumtypes.h - -libgstaudio_la_LIBADD = -libgstaudio_la_CFLAGS = $(GST_CFLAGS) -libgstaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -libgstaudiofilter_la_SOURCES = gstaudiofilter.c gstaudiofilter.h -libgstaudiofilter_la_CFLAGS = $(GST_CFLAGS) -libgstaudiofilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -libgstaudiofilterexample_la_SOURCES = gstaudiofilterexample.c -libgstaudiofilterexample_la_CFLAGS = $(GST_CFLAGS) -libgstaudiofilterexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) - -gstaudiofilterexample.c: $(srcdir)/make_filter $(srcdir)/gstaudiofiltertemplate.c - $(srcdir)/make_filter AudiofilterExample $(srcdir)/gstaudiofiltertemplate.c - -noinst_PROGRAMS = testchannels -testchannels_SOURCES = testchannels.c -testchannels_CFLAGS = $(GST_CFLAGS) -testchannels_LDFLAGS = $(GST_LIBS) - -include $(top_srcdir)/common/glib-gen.mak diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c deleted file mode 100644 index b6a1edb5..00000000 --- a/gst-libs/gst/audio/audio.c +++ /dev/null @@ -1,280 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "audio.h" -#include "multichannel-enumtypes.h" - -#include - -int -gst_audio_frame_byte_size (GstPad * pad) -{ -/* calculate byte size of an audio frame - * this should be moved closer to the gstreamer core - * and be implemented for every mime type IMO - * returns -1 if there's an error (to avoid division by zero), - * or the byte size if everything's ok - */ - - int width = 0; - int channels = 0; - const GstCaps *caps = NULL; - GstStructure *structure; - - /* get caps of pad */ - caps = GST_PAD_CAPS (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)); - return 0; - } - - structure = gst_caps_get_structure (caps, 0); - - gst_structure_get_int (structure, "width", &width); - gst_structure_get_int (structure, "channels", &channels); - return (width / 8) * channels; -} - -long -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 - * returns 0 if there's an error, or the number of frames if everything's ok - */ -{ - int frame_byte_size = 0; - - frame_byte_size = gst_audio_frame_byte_size (pad); - if (frame_byte_size == 0) - /* error */ - return 0; - /* FIXME: this function assumes the buffer size to be a whole multiple - * of the frame byte size - */ - return GST_BUFFER_SIZE (buf) / frame_byte_size; -} - -long -gst_audio_frame_rate (GstPad * pad) -/* - * calculate frame rate (based on caps of pad) - * returns 0 if failed, rate if success - */ -{ - const GstCaps *caps = NULL; - gint rate; - GstStructure *structure; - - /* get caps of pad */ - caps = GST_PAD_CAPS (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)); - return 0; - } else { - structure = gst_caps_get_structure (caps, 0); - gst_structure_get_int (structure, "rate", &rate); - return rate; - } -} - -double -gst_audio_length (GstPad * pad, GstBuffer * buf) -{ -/* calculate length in seconds - * of audio buffer buf - * based on capabilities of pad - */ - - long bytes = 0; - int width = 0; - int channels = 0; - int rate = 0; - - double length; - - const GstCaps *caps = NULL; - GstStructure *structure; - - g_assert (GST_IS_BUFFER (buf)); - /* get caps of pad */ - caps = GST_PAD_CAPS (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)); - length = 0.0; - } 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); - - g_assert (bytes != 0); - g_assert (width != 0); - g_assert (channels != 0); - g_assert (rate != 0); - length = (bytes * 8.0) / (double) (rate * channels * width); - } - /* g_print ("DEBUG: audio: returning length of %f\n", length); */ - return length; -} - -long -gst_audio_highest_sample_value (GstPad * pad) -/* calculate highest possible sample value - * based on capabilities of pad - */ -{ - gboolean is_signed = FALSE; - 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)); - } - - 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; - /* example : 16 bit, signed : samples between -32768 and 32767 */ - return ((long) (1 << width)); -} - -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) - return TRUE; - else - return FALSE; -} - -/* _getcaps helper functions - * sets structure fields to default for audio type - * flag determines which structure fields to set to default - * keep these functions in sync with the templates in audio.h - */ - -/* private helper function - * sets a list on the structure - * pass in structure, fieldname for the list, type of the list values, - * 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, ...) -{ - va_list varargs; - GValue value = { 0 }; - GArray *array; - int j; - - g_return_if_fail (structure != NULL); - - g_value_init (&value, GST_TYPE_LIST); - array = g_value_peek_pointer (&value); - - va_start (varargs, number); - - for (j = 0; j < number; ++j) { - int i; - gboolean b; - - GValue list_value = { 0 }; - - 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; - 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."); - } - g_array_append_val (array, list_value); - - } - gst_structure_set_value (structure, fieldname, &value); - va_end (varargs); -} - -void -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); - if (flag & GST_AUDIO_FIELD_CHANNELS) - 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); - if (flag & GST_AUDIO_FIELD_WIDTH) - _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); - if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES) - gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, - G_MAXINT, NULL); -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - gst_audio_channel_position_get_type (); - - 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); diff --git a/gst-libs/gst/audio/audio.def b/gst-libs/gst/audio/audio.def deleted file mode 100644 index 96a3ac06..00000000 --- a/gst-libs/gst/audio/audio.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - gst_plugin_desc - gst_audio_length - gst_audio_is_buffer_framed - gst_audio_highest_sample_value diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h deleted file mode 100644 index 8556ce1f..00000000 --- a/gst-libs/gst/audio/audio.h +++ /dev/null @@ -1,131 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * Library <2001> Thomas Vander Stichele - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include - -#ifndef __GST_AUDIO_AUDIO_H__ -#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 - * (8/01) the only plugins that use these are the passthrough, speed, volume, - * adder, and [de]interleave plugins. These are for convenience only, and do not - * specify the 'limits' of GStreamer. you might also use these definitions as a - * base for making your own caps, if need be. - * - * For example, to make a source pad that can output streams of either mono - * float or any channel int: - * - * template = gst_pad_template_new - * ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - * gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int", - * GST_AUDIO_INT_PAD_TEMPLATE_PROPS), - * gst_caps_new ("sink_float", "audio/x-raw-float", - * GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)), - * NULL); - * - * sinkpad = gst_pad_new_from_template(template, "sink"); - * - * 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 ], " \ - "channels = (int) [ 1, MAX ], " \ - "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \ - "width = (int) { 8, 16, 24, 32 }, " \ - "depth = (int) [ 1, 32 ], " \ - "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, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) 2, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 16, " \ - "depth = (int) 16, " \ - "signed = (boolean) true" - -#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \ - "audio/x-raw-float, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, MAX ], " \ - "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, " \ - "width = (int) 32, " \ - "rate = (int) [ 1, MAX ], " \ - "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); - -/* get length in frames of buffer */ -long gst_audio_frame_length (GstPad* pad, GstBuffer* buf); - -/* get frame rate based on caps */ -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); - -/* calculate highest possible sample value based on capabilities of 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); - -/* 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), - GST_AUDIO_FIELD_BUFFER_FRAMES = (1 << 6) -} GstAudioFieldFlag; - -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/audio.vcproj b/gst-libs/gst/audio/audio.vcproj deleted file mode 100644 index 21115317..00000000 --- a/gst-libs/gst/audio/audio.vcproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gst-libs/gst/audio/audioclock.c b/gst-libs/gst/audio/audioclock.c deleted file mode 100644 index 65d2694f..00000000 --- a/gst-libs/gst/audio/audioclock.c +++ /dev/null @@ -1,205 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * audioclock.c: Clock for use by audio plugins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "audioclock.h" - -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 GstClockEntryStatus 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), - NULL, - NULL, - (GClassInitFunc) gst_audio_clock_class_init, - NULL, - NULL, - sizeof (GstAudioClock), - 4, - (GInstanceInitFunc) gst_audio_clock_init, - NULL - }; - - clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock", - &clock_info, 0); - } - return clock_type; -} - - -static void -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; - - 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; -} - -static void -gst_audio_clock_init (GstAudioClock * clock) -{ - gst_object_set_name (GST_OBJECT (clock), "GstAudioClock"); - - clock->prev1 = 0; - clock->prev2 = 0; -} - -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)); - - aclock->func = func; - aclock->user_data = user_data; - aclock->adjust = 0; - - return (GstClock *) aclock; -} - -void -gst_audio_clock_set_active (GstAudioClock * aclock, gboolean active) -{ - GstClockTime audio_time, system_time; - GstClock *clock; - GTimeVal timeval; - - g_return_if_fail (GST_IS_AUDIO_CLOCK (aclock)); - clock = GST_CLOCK (aclock); - - if (active == aclock->active) { - /* Nothing to do. */ - return; - } - - audio_time = aclock->func (clock, aclock->user_data); - - g_get_current_time (&timeval); - system_time = GST_TIMEVAL_TO_TIME (timeval); - - /* Set the new adjust value in such a way that there's no abrupt - discontinuity, i.e. if gst_audio_clock_get_internal_time is - invoked right before and right after (de)activating the clock, - the values returned will be close to each other, and the second - value will be greater than or equal than the first. */ - if (active) { - aclock->adjust = aclock->adjust + system_time - audio_time; - } else { - aclock->adjust = aclock->adjust + audio_time - system_time; - } - - aclock->active = active; -} - -static GstClockTime -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) + aclock->adjust; - } -} - -void -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; - aclock->prev1 = 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; - - if (entry->time > time) - break; - - entry->func ((GstClock *) aclock, time, entry, entry->user_data); - - aclock->async_entries = g_slist_delete_link (aclock->async_entries, - aclock->async_entries); - /* do I need to free the entry? */ - } -} - -static gint -compare_clock_entries (GstClockEntry * entry1, GstClockEntry * entry2) -{ - return entry1->time - entry2->time; -} - -static GstClockEntryStatus -gst_audio_clock_id_wait_async (GstClock * clock, GstClockEntry * entry) -{ - GstAudioClock *aclock = (GstAudioClock *) clock; - - aclock->async_entries = g_slist_insert_sorted (aclock->async_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) -{ - 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 deleted file mode 100644 index 17439242..00000000 --- a/gst-libs/gst/audio/audioclock.h +++ /dev/null @@ -1,81 +0,0 @@ -/* GStreamer - * Copyright (C) 1999,2000 Erik Walthinsen - * 2000 Wim Taymans - * - * audioclock.h: Clock for use by audio plugins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_AUDIO_CLOCK_H__ -#define __GST_AUDIO_CLOCK_H__ - -#include - -G_BEGIN_DECLS - -#define GST_TYPE_AUDIO_CLOCK \ - (gst_audio_clock_get_type()) -#define GST_AUDIO_CLOCK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_CLOCK,GstAudioClock)) -#define GST_AUDIO_CLOCK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_CLOCK,GstAudioClockClass)) -#define GST_IS_AUDIO_CLOCK(obj) \ - (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); - - -struct _GstAudioClock { - GstSystemClock clock; - - GstClockTime prev1, prev2; - - /* --- protected --- */ - GstAudioClockGetTimeFunc func; - gpointer user_data; - - GstClockTimeDiff adjust; - - GSList *async_entries; - - gboolean active; - - gpointer _gst_reserved[GST_PADDING]; -}; - -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); - -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/audiofilter.vcproj b/gst-libs/gst/audio/audiofilter.vcproj deleted file mode 100644 index d5512606..00000000 --- a/gst-libs/gst/audio/audiofilter.vcproj +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c deleted file mode 100644 index 70ae6bf9..00000000 --- a/gst-libs/gst/audio/gstaudiofilter.c +++ /dev/null @@ -1,313 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * Copyright (C) <2003> David Schleef - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -/*#define DEBUG_ENABLED */ -#include "gstaudiofilter.h" - -#include - - -/* GstAudiofilter signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -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_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 GstElementClass *parent_class = NULL; - -GType -gst_audiofilter_get_type (void) -{ - static GType audiofilter_type = 0; - - if (!audiofilter_type) { - static const GTypeInfo audiofilter_info = { - sizeof (GstAudiofilterClass), - gst_audiofilter_base_init, - NULL, - gst_audiofilter_class_init, - NULL, - NULL, - sizeof (GstAudiofilter), - 0, - gst_audiofilter_init, - }; - - 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 GstElementDetails audiofilter_details = { - "Audio filter base class", - "Filter/Effect/Audio", - "Filters audio", - "David Schleef " - }; - GstAudiofilterClass *klass = (GstAudiofilterClass *) g_class; - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_set_details (element_class, &audiofilter_details); -} - -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; - - 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) -{ - GstAudiofilter *audiofilter; - GstPadLinkReturn ret; - GstPadLinkReturn link_ret; - GstStructure *structure; - GstAudiofilterClass *audiofilter_class; - - GST_DEBUG ("gst_audiofilter_link"); - audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad)); - audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter)); - - ret = GST_PAD_LINK_DELAYED; /* intialise with dummy value */ - if (pad == audiofilter->srcpad) { - link_ret = gst_pad_try_set_caps (audiofilter->sinkpad, caps); - } else { - link_ret = gst_pad_try_set_caps (audiofilter->srcpad, caps); - } - - if (GST_PAD_LINK_FAILED (link_ret)) { - return link_ret; - } - - structure = gst_caps_get_structure (caps, 0); - - 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); - } else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") - == 0) { - ret &= gst_structure_get_int (structure, "width", &audiofilter->width); - } else { - g_assert_not_reached (); - } - ret &= gst_structure_get_int (structure, "rate", &audiofilter->rate); - ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels); - - if (!ret) - return GST_PAD_LINK_REFUSED; - - audiofilter->bytes_per_sample = (audiofilter->width / 8) * - audiofilter->channels; - - if (audiofilter_class->setup) - (audiofilter_class->setup) (audiofilter); - - return GST_PAD_LINK_OK; -} - -static void -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); - - audiofilter->inited = FALSE; -} - -static void -gst_audiofilter_chain (GstPad * pad, GstData * data) -{ - GstBuffer *inbuf = GST_BUFFER (data); - GstAudiofilter *audiofilter; - GstBuffer *outbuf; - GstAudiofilterClass *audiofilter_class; - - GST_DEBUG ("gst_audiofilter_chain"); - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (inbuf != NULL); - - audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad)); - //g_return_if_fail (audiofilter->inited); - 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); - return; - } - - audiofilter->size = GST_BUFFER_SIZE (inbuf); - audiofilter->n_samples = audiofilter->size / audiofilter->bytes_per_sample; - - 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); - - (audiofilter_class->filter) (audiofilter, outbuf, 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); - if (audiofilter_class->filter) { - (audiofilter_class->filter) (audiofilter, outbuf, inbuf); - } else { - memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), - GST_BUFFER_SIZE (inbuf)); - - (audiofilter_class->filter_inplace) (audiofilter, outbuf); - } - gst_buffer_unref (inbuf); - } - - gst_pad_push (audiofilter->srcpad, GST_DATA (outbuf)); -} - -static void -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); - - GST_DEBUG ("gst_audiofilter_set_property"); - switch (prop_id) { - default: - break; - } -} - -static void -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); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -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); - - gst_element_class_add_pad_template (element_class, - 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))); -} - -static gboolean -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) diff --git a/gst-libs/gst/audio/gstaudiofilter.h b/gst-libs/gst/audio/gstaudiofilter.h deleted file mode 100644 index 9786e16c..00000000 --- a/gst-libs/gst/audio/gstaudiofilter.h +++ /dev/null @@ -1,87 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_AUDIOFILTER_H__ -#define __GST_AUDIOFILTER_H__ - - -#include - - -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 (*GstAudiofilterSetupFunc) (GstAudiofilter *filter); - - -#define GST_TYPE_AUDIOFILTER \ - (gst_audiofilter_get_type()) -#define GST_AUDIOFILTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFILTER,GstAudiofilter)) -#define GST_AUDIOFILTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFILTER,GstAudiofilterClass)) -#define GST_IS_AUDIOFILTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFILTER)) -#define GST_IS_AUDIOFILTER_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER)) - -struct _GstAudiofilter { - GstElement element; - - GstPad *sinkpad,*srcpad; - - /* audio state */ - gboolean inited; - gboolean passthru; - - int rate; - int width; - int channels; - int depth; - - int n_samples; - int size; - int bytes_per_sample; -}; - -struct _GstAudiofilterClass { - GstElementClass parent_class; - - GstCaps *caps; - GstAudiofilterSetupFunc setup; - GstAudiofilterInplaceFilterFunc filter_inplace; - GstAudiofilterFilterFunc filter; -}; - -GType gst_audiofilter_get_type(void); - -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 deleted file mode 100644 index f1852037..00000000 --- a/gst-libs/gst/audio/gstaudiofiltertemplate.c +++ /dev/null @@ -1,270 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * Copyright (C) <2003> David Schleef - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * This file was (probably) generated from - * $Id$ - * and - * MAKEFILTERVERSION - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -typedef struct _GstAudiofilterTemplate GstAudiofilterTemplate; -typedef struct _GstAudiofilterTemplateClass GstAudiofilterTemplateClass; - -#define GST_TYPE_AUDIOFILTER_TEMPLATE \ - (gst_audiofilter_template_get_type()) -#define GST_AUDIOFILTER_TEMPLATE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFILTER_TEMPLATE,GstAudiofilterTemplate)) -#define GST_AUDIOFILTER_TEMPLATE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFILTER_TEMPLATE,GstAudiofilterTemplateClass)) -#define GST_IS_AUDIOFILTER_TEMPLATE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFILTER_TEMPLATE)) -#define GST_IS_AUDIOFILTER_TEMPLATE_CLASS(obj) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER_TEMPLATE)) - -struct _GstAudiofilterTemplate -{ - GstAudiofilter audiofilter; - -}; - -struct _GstAudiofilterTemplateClass -{ - GstAudiofilterClass parent_class; - -}; - - -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -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_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); - -GType -gst_audiofilter_template_get_type (void) -{ - static GType audiofilter_template_type = 0; - - if (!audiofilter_template_type) { - static const GTypeInfo audiofilter_template_info = { - sizeof (GstAudiofilterTemplateClass), - gst_audiofilter_template_base_init, - NULL, - gst_audiofilter_template_class_init, - NULL, - gst_audiofilter_template_init, - sizeof (GstAudiofilterTemplate), - 0, - NULL, - }; - - 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 GstElementDetails audiofilter_template_details = { - "Audio filter template", - "Filter/Effect/Audio", - "Filters audio", - "David Schleef " - }; - GstAudiofilterTemplateClass *klass = (GstAudiofilterTemplateClass *) g_class; - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_set_details (element_class, &audiofilter_template_details); - - gst_audiofilter_class_add_pad_templates (GST_AUDIOFILTER_CLASS (g_class), - gst_caps_from_string (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS)); -} - -static void -gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - GstAudiofilterTemplateClass *klass; - GstAudiofilterClass *audiofilter_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)); -#endif - - gobject_class->set_property = gst_audiofilter_template_set_property; - gobject_class->get_property = gst_audiofilter_template_get_property; - - 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; -} - -static void -gst_audiofilter_template_init (GTypeInstance * instance, gpointer g_class) -{ - //GstAudiofilterTemplate *audiofilter_template = GST_AUDIOFILTER_TEMPLATE (instance); - //GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance); - - GST_DEBUG ("gst_audiofilter_template_init"); - - /* do stuff */ - -} - -static void -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); - - GST_DEBUG ("gst_audiofilter_template_set_property"); - switch (prop_id) { - default: - break; - } -} - -static void -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); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_library_load ("gstaudiofilter")) - return FALSE; - - return gst_element_register (plugin, "audiofiltertemplate", GST_RANK_NONE, - 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) - - static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter) -{ - GstAudiofilterTemplate *audiofilter_template; - - g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (audiofilter)); - audiofilter_template = GST_AUDIOFILTER_TEMPLATE (audiofilter); - - /* if any setup needs to be done, do it here */ - -} - -/* You may choose to implement either a copying filter or an - * in-place filter (or both). Implementing only one will give - * full functionality, however, implementing both will cause - * audiofilter to use the optimal function in every situation, - * with a minimum of memory copies. */ - -static void -gst_audiofilter_template_filter (GstAudiofilter * audiofilter, - GstBuffer * outbuf, GstBuffer * inbuf) -{ - GstAudiofilterTemplate *audiofilter_template; - - g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (audiofilter)); - audiofilter_template = GST_AUDIOFILTER_TEMPLATE (audiofilter); - - /* do something interesting here. This simply copies the source - * to the destination. */ - - memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), audiofilter->size); -} - -static void -gst_audiofilter_template_filter_inplace (GstAudiofilter * audiofilter, - GstBuffer * buf) -{ - GstAudiofilterTemplate *audiofilter_template; - - g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (audiofilter)); - audiofilter_template = GST_AUDIOFILTER_TEMPLATE (audiofilter); - - /* do something interesting here. This simply copies the source - * to the destination. */ - -} diff --git a/gst-libs/gst/audio/make_filter b/gst-libs/gst/audio/make_filter deleted file mode 100755 index eaeaa060..00000000 --- a/gst-libs/gst/audio/make_filter +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -LANG=C -LC_COLLATE=C -export LANG -export LC_COLLATE - -Template=$1; -srcfile=$2; - -if test x"$1" = x ; then - echo "$0 Objectname [srcfile]\n"; - echo " creates gstobjectname.{c,h} implementing GstObjectname,\n"; - echo " subclassing GstAudiofilter.\n"; - exit 1; -fi - -if test x"$2" = x ; then - srcfile="gstaudiofiltertemplate.c" -fi - -id=`echo '$Id$' | sed \ - -e 's/\$I[d]: \([^$]*\)\$/\1/g'` -echo $id - -TEMPLATE=`echo $Template | tr [:lower:] [:upper:]` -template=`echo $Template | tr [:upper:] [:lower:]` - -echo TEMPLATE $TEMPLATE -echo template $template - -# remember to break up the Id: in the line below -sed \ - -e 's/gstaudiofiltertemplate\.c/SOURCEFILE/g' \ - -e "s/AudiofilterTemplate/$Template/g" \ - -e "s/audiofiltertemplate/$template/g" \ - -e "s/VIDEOFILTERTEMPLATE/$TEMPLATE/g" \ - -e 's/\$I[d]: \([^$]*\)\$/\1/g' \ - -e 's/SOURCEFILE/gstaudiofiltertemplate\.c/g' \ - -e "s%MAKEFILTERVERSION%$id%g" \ - $srcfile >gst$template.c.tmp && mv gst$template.c.tmp gst$template.c - diff --git a/gst-libs/gst/audio/multichannel.c b/gst-libs/gst/audio/multichannel.c deleted file mode 100644 index 67c055d9..00000000 --- a/gst-libs/gst/audio/multichannel.c +++ /dev/null @@ -1,634 +0,0 @@ -/* GStreamer Multichannel-Audio helper functions - * (c) 2004 Ronald Bultje - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "multichannel.h" - -#define GST_AUDIO_CHANNEL_POSITIONS_PROPERTY_NAME "channel-positions" - -/* - * This function checks if basic assumptions apply: - * - does each position occur at most once? - * - do conflicting positions occur? - * + front_mono vs. front_left/right - * + front_center vs. front_left/right_of_center - * + rear_center vs. rear_left/right - * It also adds some hacks that 0.8.x needs for compatibility: - * - if channels == 1, are we really mono? - * - if channels == 2, are we really stereo? - */ - -static gboolean -gst_audio_check_channel_positions (const GstAudioChannelPosition * pos, - gint channels) -{ - gint i, n; - struct - { - GstAudioChannelPosition pos1[2]; - GstAudioChannelPosition pos2[1]; - } conf[] = { - /* front: mono <-> stereo */ - { { - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { - GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}}, - /* front center: 2 <-> 1 */ - { { - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { - GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}}, - /* rear: 2 <-> 1 */ - { { - GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, - GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { - GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}}, { { - GST_AUDIO_CHANNEL_POSITION_INVALID}} - }; - - /* check for invalid channel positions */ - for (n = 0; n < channels; n++) { - if (pos[n] == GST_AUDIO_CHANNEL_POSITION_INVALID) { - g_warning ("Position %d is invalid, not allowed", n); - return FALSE; - } - } - - /* check for multiple position occurrences */ - for (i = GST_AUDIO_CHANNEL_POSITION_INVALID + 1; - i < GST_AUDIO_CHANNEL_POSITION_NUM; i++) { - gint count = 0; - - for (n = 0; n < channels; n++) { - if (pos[n] == i) - count++; - } - - if (count > 1) { - g_warning ("Channel position %d occurred %d times, not allowed", - i, count); - return FALSE; - } - } - - /* check for position conflicts */ - for (i = 0; conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID; i++) { - gboolean found1 = FALSE, found2 = FALSE; - - for (n = 0; n < channels; n++) { - if (pos[n] == conf[i].pos1[0] || pos[n] == conf[i].pos1[1]) - found1 = TRUE; - else if (pos[n] == conf[i].pos2[0]) - found2 = TRUE; - } - - if (found1 && found2) { - g_warning ("Found conflicting channel positions %d/%d and %d", - conf[i].pos1[0], conf[i].pos1[1], conf[i].pos2[0]); - return FALSE; - } - } - - /* 0.8.x evilry */ - if ((channels == 1 && pos[0] != GST_AUDIO_CHANNEL_POSITION_FRONT_MONO) || - (channels == 2 && (pos[0] != GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT || - pos[1] != GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT))) { - g_warning ("0.8.x: channels=1 implies mono; channels=2 implies stereo"); - return FALSE; - } - - return TRUE; -} - -/** - * gst_audio_get_channel_positions: - * @str: A #GstStructure to retrieve channel positions from. - * - * Retrieves a number of (fixed!) audio channel positions from - * the provided #GstStructure and returns it as a newly allocated - * array. The caller should g_free () this array. The caller - * should also check that the members in this #GstStructure are - * indeed "fixed" before calling this function. - * - * Returns: a newly allocated array containing the channel - * positions as provided in the given #GstStructure. Returns - * NULL on error. - */ - -GstAudioChannelPosition * -gst_audio_get_channel_positions (GstStructure * str) -{ - GstAudioChannelPosition *pos; - gint channels, n; - const GValue *pos_val_arr, *pos_val_entry; - gboolean res; - GType t; - - /* get number of channels, general type checkups */ - g_return_val_if_fail (str != NULL, NULL); - res = gst_structure_get_int (str, "channels", &channels); - g_return_val_if_fail (res, NULL); - g_return_val_if_fail (channels > 0, NULL); - pos_val_arr = gst_structure_get_value (str, - GST_AUDIO_CHANNEL_POSITIONS_PROPERTY_NAME); - - /* The following checks are here to retain compatibility for plugins not - * implementing this property. They expect that channels=1 implies mono - * and channels=2 implies stereo, so we follow that. - * This might be removed during 0.9.x. */ - if (!pos_val_arr && (channels == 1 || channels == 2)) { - pos = g_new (GstAudioChannelPosition, channels); - if (channels == 1) { - pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO; - } else { - pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; - pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; - } - return pos; - } - g_return_val_if_fail (pos_val_arr != NULL, NULL); - g_return_val_if_fail (gst_value_list_get_size (pos_val_arr) == channels, - NULL); - for (n = 0; n < channels; n++) { - t = G_VALUE_TYPE (gst_value_list_get_value (pos_val_arr, n)); - g_return_val_if_fail (t == GST_TYPE_AUDIO_CHANNEL_POSITION, NULL); - } - - /* ... and fill array */ - pos = g_new (GstAudioChannelPosition, channels); - for (n = 0; n < channels; n++) { - pos_val_entry = gst_value_list_get_value (pos_val_arr, n); - pos[n] = g_value_get_enum (pos_val_entry); - } - - if (!gst_audio_check_channel_positions (pos, channels)) { - g_free (pos); - return NULL; - } - - return pos; -} - -/** - * gst_audio_set_channel_positions: - * @str: A #GstStructure to retrieve channel positions from. - * @pos: an array of channel positions. The number of members - * in this array should be equal to the (fixed!) number - * of the "channels" property in the given #GstStructure. - * - * Adds a "channel-positions" property to the given #GstStructure, - * which will represent the channel positions as given in the - * provided #GstAudioChannelPosition array. - */ - -void -gst_audio_set_channel_positions (GstStructure * str, - const GstAudioChannelPosition * pos) -{ - GValue pos_val_arr = { 0 }, pos_val_entry = { - 0}; - gint channels, n; - gboolean res; - - /* get number of channels, checkups */ - g_return_if_fail (str != NULL); - g_return_if_fail (pos != NULL); - res = gst_structure_get_int (str, "channels", &channels); - g_return_if_fail (res); - g_return_if_fail (channels > 0); - if (!gst_audio_check_channel_positions (pos, channels)) - return; - - /* build gvaluearray from positions */ - g_value_init (&pos_val_entry, GST_TYPE_AUDIO_CHANNEL_POSITION); - g_value_init (&pos_val_arr, GST_TYPE_FIXED_LIST); - for (n = 0; n < channels; n++) { - g_value_set_enum (&pos_val_entry, pos[n]); - gst_value_list_append_value (&pos_val_arr, &pos_val_entry); - } - g_value_unset (&pos_val_entry); - - /* add to structure */ - gst_structure_set_value (str, - GST_AUDIO_CHANNEL_POSITIONS_PROPERTY_NAME, &pos_val_arr); - g_value_unset (&pos_val_arr); -} - -/** - * gst_audio_set_structure_channel_positions_list: - * @str: #GstStructure to set the list of channel positions - * on. - * @pos: the array containing one or more possible audio - * channel positions that we should add in each value - * of the array in the given structure. - * @num_positions: the number of values in pos. - * - * Sets a (possibly non-fixed) list of possible audio channel - * positions (given in pos) on the given structure. The - * structure, after this function has been called, will contain - * a "channel-positions" property with an array of the size of - * the "channels" property value in the given structure (note - * that this means that the channels property in the provided - * structure should be fixed!). Each value in the array will - * contain each of the values given in the pos array. - */ - -void -gst_audio_set_structure_channel_positions_list (GstStructure * str, - const GstAudioChannelPosition * pos, gint num_positions) -{ - gint channels, n, c; - GValue pos_val_arr = { 0 }, pos_val_list = { - 0}, pos_val_entry = { - 0}; - gboolean res; - - /* get number of channels, general type checkups */ - g_return_if_fail (str != NULL); - g_return_if_fail (num_positions > 0); - g_return_if_fail (pos != NULL); - res = gst_structure_get_int (str, "channels", &channels); - g_return_if_fail (res); - g_return_if_fail (channels > 0); - - /* 0.8.x: channels=1 or channels=2 is mono/stereo, no positions needed - * there (we discard them anyway) */ - if (channels == 1 || channels == 2) - return; - - /* create the array of lists */ - g_value_init (&pos_val_arr, GST_TYPE_FIXED_LIST); - g_value_init (&pos_val_entry, GST_TYPE_AUDIO_CHANNEL_POSITION); - for (n = 0; n < channels; n++) { - g_value_init (&pos_val_list, GST_TYPE_LIST); - for (c = 0; c < num_positions; c++) { - g_value_set_enum (&pos_val_entry, pos[c]); - gst_value_list_append_value (&pos_val_list, &pos_val_entry); - } - gst_value_list_append_value (&pos_val_arr, &pos_val_list); - g_value_unset (&pos_val_list); - } - g_value_unset (&pos_val_entry); - gst_structure_set_value (str, GST_AUDIO_CHANNEL_POSITIONS_PROPERTY_NAME, - &pos_val_arr); - g_value_unset (&pos_val_arr); -} - -/* - * Helper function for below. The structure will be conserved, - * but might be cut down. Any additional structures that were - * created will be stored in the returned caps. - */ - -static GstCaps * -add_list_to_struct (GstStructure * str, - const GstAudioChannelPosition * pos, gint num_positions) -{ - GstCaps *caps = gst_caps_new_empty (); - const GValue *chan_val; - - chan_val = gst_structure_get_value (str, "channels"); - if (G_VALUE_TYPE (chan_val) == G_TYPE_INT) { - gst_audio_set_structure_channel_positions_list (str, pos, num_positions); - } else if (G_VALUE_TYPE (chan_val) == GST_TYPE_LIST) { - gint size; - const GValue *sub_val; - - size = gst_value_list_get_size (chan_val); - sub_val = gst_value_list_get_value (chan_val, 0); - gst_structure_set_value (str, "channels", sub_val); - gst_caps_append (caps, add_list_to_struct (str, pos, num_positions)); - while (--size > 0) { - str = gst_structure_copy (str); - sub_val = gst_value_list_get_value (chan_val, size); - gst_structure_set_value (str, "channels", sub_val); - gst_caps_append (caps, add_list_to_struct (str, pos, num_positions)); - gst_caps_append_structure (caps, str); - } - } else if (G_VALUE_TYPE (chan_val) == GST_TYPE_INT_RANGE) { - gint min, max; - - min = gst_value_get_int_range_min (chan_val); - max = gst_value_get_int_range_max (chan_val); - - gst_structure_set (str, "channels", G_TYPE_INT, min, NULL); - gst_audio_set_structure_channel_positions_list (str, pos, num_positions); - for (++min; min < max; min++) { - str = gst_structure_copy (str); - gst_structure_set (str, "channels", G_TYPE_INT, min, NULL); - gst_audio_set_structure_channel_positions_list (str, pos, num_positions); - gst_caps_append_structure (caps, str); - } - } else { - g_warning ("Unknown value type for channels property"); - } - - return caps; -} - -/** - * gst_audio_set_caps_channel_positions_list: - * @caps: #GstCaps to set the list of channel positions on. - * @pos: the array containing one or more possible audio - * channel positions that we should add in each value - * of the array in the given structure. - * @num_positions: the number of values in pos. - * - * Sets a (possibly non-fixed) list of possible audio channel - * positions (given in pos) on the given caps. Each of the - * structures of the caps, after this function has been called, - * will contain a "channel-positions" property with an array. - * Each value in the array will contain each of the values given - * in the pos array. Note that the size of the caps might be - * increased by this, since each structure with a "channel- - * positions" property needs to have a fixed "channels" property. - * The input caps is not required to have this. - */ - -void -gst_audio_set_caps_channel_positions_list (GstCaps * caps, - const GstAudioChannelPosition * pos, gint num_positions) -{ - gint size, n; - - /* get number of channels, general type checkups */ - g_return_if_fail (caps != NULL); - g_return_if_fail (num_positions > 0); - g_return_if_fail (pos != NULL); - - size = gst_caps_get_size (caps); - for (n = 0; n < size; n++) { - gst_caps_append (caps, add_list_to_struct (gst_caps_get_structure (caps, - n), pos, num_positions)); - } -} - -/** - * gst_audio_fixate_channel_positions: - * @str: a #GstStructure containing a (possibly unfixed) - * "channel-positions" property. - * - * Custom fixate function. Elements that implement some sort of - * channel conversion algorhithm should use this function for - * fixating on GstAudioChannelPosition properties. It will take - * care of equal channel positioning (left/right). Caller g_free()s - * the return value. The input properties may be (and are supposed - * to be) unfixed. - * Note that this function is mostly a hack because we currently - * have no way to add default fixation functions for new GTypes. - * - * Returns: fixed values that the caller could use as a fixed - * set of #GstAudioChannelPosition values. - */ - -GstAudioChannelPosition * -gst_audio_fixate_channel_positions (GstStructure * str) -{ - GstAudioChannelPosition *pos; - gint channels, n, num_unfixed = 0, i, c; - const GValue *pos_val_arr, *pos_val_entry, *pos_val; - gboolean res, is_stereo = TRUE; - GType t; - - /* - * We're going to do this cluelessly. We'll make an array of values that - * conflict with each other and, for each iteration in this array, pick - * either one until all unknown values are filled. This might not work in - * corner cases but should work OK for the general case. - */ - struct - { - GstAudioChannelPosition pos1[2]; - GstAudioChannelPosition pos2[1]; - } conf[] = { - /* front: mono <-> stereo */ - { { - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { - GST_AUDIO_CHANNEL_POSITION_FRONT_MONO}}, - /* front center: 2 <-> 1 */ - { { - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { - GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}}, - /* rear: 2 <-> 1 */ - { { - GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, - GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { - GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}}, { { - GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, { - GST_AUDIO_CHANNEL_POSITION_LFE}}, { { - GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, - GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { - GST_AUDIO_CHANNEL_POSITION_INVALID}}, { { - GST_AUDIO_CHANNEL_POSITION_INVALID, GST_AUDIO_CHANNEL_POSITION_INVALID}, { - GST_AUDIO_CHANNEL_POSITION_INVALID}} - }; - struct - { - gint num_opt[3]; - guint num_opts[3]; - gboolean is_fixed[3]; - gint choice; /* -1 is none, 0 is the two, 1 is the one */ - } opt; - - /* get number of channels, general type checkups */ - g_return_val_if_fail (str != NULL, NULL); - res = gst_structure_get_int (str, "channels", &channels); - g_return_val_if_fail (res, NULL); - g_return_val_if_fail (channels > 0, NULL); - - /* 0.8.x mono/stereo checks */ - pos_val_arr = gst_structure_get_value (str, - GST_AUDIO_CHANNEL_POSITIONS_PROPERTY_NAME); - if (!pos_val_arr && (channels == 1 || channels == 2)) { - pos = g_new (GstAudioChannelPosition, channels); - if (channels == 1) { - pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO; - } else { - pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; - pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; - } - return pos; - } - g_return_val_if_fail (pos_val_arr != NULL, NULL); - g_return_val_if_fail (gst_value_list_get_size (pos_val_arr) == channels, - NULL); - for (n = 0; n < channels; n++) { - t = G_VALUE_TYPE (gst_value_list_get_value (pos_val_arr, n)); - g_return_val_if_fail (t == GST_TYPE_LIST || - t == GST_TYPE_AUDIO_CHANNEL_POSITION, NULL); - } - - /* all unknown, to start with */ - pos = g_new (GstAudioChannelPosition, channels); - for (n = 0; n < channels; n++) - pos[n] = GST_AUDIO_CHANNEL_POSITION_INVALID; - num_unfixed = channels; - - /* Iterate the array of conflicting values */ - for (i = 0; conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID || - conf[i].pos2[0] != GST_AUDIO_CHANNEL_POSITION_INVALID; i++) { - /* front/center only important if not mono (obviously) */ - if (conf[i].pos1[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER && - !is_stereo) - continue; - - /* init values */ - for (n = 0; n < 3; n++) { - opt.num_opt[n] = -1; - opt.num_opts[n] = -1; - opt.is_fixed[n] = FALSE; - } - - /* Now, we'll see for each channel if it allows for any of the values in - * the set of conflicting audio channel positions and keep scores. */ - for (n = 0; n < channels; n++) { - /* if the channel is already taken, don't bother */ - if (pos[n] != GST_AUDIO_CHANNEL_POSITION_INVALID) - continue; - - pos_val_entry = gst_value_list_get_value (pos_val_arr, n); - t = G_VALUE_TYPE (pos_val_entry); - if (t == GST_TYPE_LIST) { - /* This algorhythm is suboptimal. */ - for (c = 0; c < gst_value_list_get_size (pos_val_entry); c++) { - pos_val = gst_value_list_get_value (pos_val_entry, c); - if (g_value_get_enum (pos_val) == conf[i].pos1[0] && - opt.num_opts[0] > gst_value_list_get_size (pos_val_entry) && - !opt.is_fixed[0]) { - /* Now test if the old position of num_opt[0] also allows for - * the other channel (which was skipped previously). If so, - * keep score. */ - if (opt.num_opt[0] != -1) { - gint c1; - - pos_val_entry = gst_value_list_get_value (pos_val_arr, - opt.num_opt[0]); - if (G_VALUE_TYPE (pos_val_entry) == GST_TYPE_LIST) { - for (c1 = 0; c1 < gst_value_list_get_size (pos_val_entry); c1++) { - pos_val = gst_value_list_get_value (pos_val_entry, c1); - if (g_value_get_enum (pos_val) == conf[i].pos1[1] && - opt.num_opts[1] > opt.num_opts[0] && !opt.is_fixed[1]) { - opt.num_opts[1] = opt.num_opts[0]; - opt.num_opt[1] = opt.num_opt[0]; - } - } - pos_val = gst_value_list_get_value (pos_val_entry, c); - } - pos_val_entry = gst_value_list_get_value (pos_val_arr, n); - } - - /* and save values */ - opt.num_opts[0] = gst_value_list_get_size (pos_val_entry); - opt.num_opt[0] = n; - } else if (g_value_get_enum (pos_val) == conf[i].pos1[1] && - opt.num_opts[1] > gst_value_list_get_size (pos_val_entry) && - !opt.is_fixed[1] && n != opt.num_opt[0]) { - opt.num_opts[1] = gst_value_list_get_size (pos_val_entry); - opt.num_opt[1] = n; - } - - /* 2 goes separately, because 0/1 vs. 2 are separate */ - if (g_value_get_enum (pos_val) == conf[i].pos2[0] && - opt.num_opts[2] > gst_value_list_get_size (pos_val_entry) && - !opt.is_fixed[2]) { - opt.num_opts[2] = gst_value_list_get_size (pos_val_entry); - opt.num_opt[2] = n; - } - } - } else { - if (g_value_get_enum (pos_val_entry) == conf[i].pos1[0]) { - opt.num_opt[0] = n; - opt.is_fixed[0] = TRUE; - } else if (g_value_get_enum (pos_val_entry) == conf[i].pos1[1]) { - opt.num_opt[1] = n; - opt.is_fixed[1] = TRUE; - } else if (g_value_get_enum (pos_val_entry) == conf[i].pos2[0]) { - opt.num_opt[2] = n; - opt.is_fixed[2] = TRUE; - } - } - } - - /* check our results and choose either one */ - if ((opt.is_fixed[0] || opt.is_fixed[1]) && opt.is_fixed[2]) { - g_warning ("Pre-fixated on both %d/%d and %d - conflict!", - conf[i].pos1[0], conf[i].pos1[1], conf[i].pos2[0]); - g_free (pos); - return NULL; - } else if ((opt.is_fixed[0] && opt.num_opt[1] == -1) || - (opt.is_fixed[1] && opt.num_opt[0] == -1)) { - g_warning ("Pre-fixated one side, but other side n/a of %d/%d", - conf[i].pos1[0], conf[i].pos1[1]); - g_free (pos); - return NULL; - } else if (opt.is_fixed[0] || opt.is_fixed[1]) { - opt.choice = 0; - } else if (opt.is_fixed[2]) { - opt.choice = 1; - } else if (opt.num_opt[0] != -1 && opt.num_opt[1] != -1) { - opt.choice = 0; - } else if (opt.num_opt[2] != -1) { - opt.choice = 1; - } else { - opt.choice = -1; - } - - /* stereo? Note that we keep is_stereo to TRUE if we didn't decide on - * any arrangement. The mono/stereo channels might be handled elsewhere - * which is clearly outside the scope of this element, so we cannot - * know and expect the application to handle that then. */ - if (conf[i].pos2[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_MONO && - opt.choice == 1) { - is_stereo = FALSE; - } - - /* now actually decide what we'll do and fixate on that */ - if (opt.choice == 0) { - g_assert (conf[i].pos1[0] != GST_AUDIO_CHANNEL_POSITION_INVALID && - conf[i].pos1[1] != GST_AUDIO_CHANNEL_POSITION_INVALID); - pos[opt.num_opt[0]] = conf[i].pos1[0]; - pos[opt.num_opt[1]] = conf[i].pos1[1]; - num_unfixed -= 2; - } else if (opt.choice == 1) { - g_assert (conf[i].pos2[0] != GST_AUDIO_CHANNEL_POSITION_INVALID); - pos[opt.num_opt[2]] = conf[i].pos2[0]; - num_unfixed--; - } - } - - /* safety check */ - if (num_unfixed > 0) { - g_warning ("%d unfixed channel positions left after fixation!", - num_unfixed); - g_free (pos); - return NULL; - } - - if (!gst_audio_check_channel_positions (pos, channels)) { - g_free (pos); - return NULL; - } - - return pos; -} diff --git a/gst-libs/gst/audio/multichannel.h b/gst-libs/gst/audio/multichannel.h deleted file mode 100644 index 3b322224..00000000 --- a/gst-libs/gst/audio/multichannel.h +++ /dev/null @@ -1,90 +0,0 @@ -/* GStreamer Multichannel-Audio helper functions - * (c) 2004 Ronald Bultje - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_AUDIO_MULTICHANNEL_H__ -#define __GST_AUDIO_MULTICHANNEL_H__ - -#include -#include - -G_BEGIN_DECLS - -typedef enum { - GST_AUDIO_CHANNEL_POSITION_INVALID = -1, - - /* Main front speakers. Mono and left/right are mututally exclusive! */ - GST_AUDIO_CHANNEL_POSITION_FRONT_MONO, - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, - - /* rear. Left/right and center are mututally exclusive! */ - GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, - GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, - GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, - - /* subwoofer/low-frequency */ - GST_AUDIO_CHANNEL_POSITION_LFE, - - /* Center front speakers. Center and left/right_of_center cannot be - * used together! */ - GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, - GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, - - /* sides */ - GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, - GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, - - /* don't use - counter */ - GST_AUDIO_CHANNEL_POSITION_NUM -} GstAudioChannelPosition; - -/* Retrieves or sets the positions from/to a GstStructure. Only - * works with fixed caps, caller should check for that! Caller - * g_free()s result of the getter. */ -GstAudioChannelPosition * - gst_audio_get_channel_positions (GstStructure *str); -void gst_audio_set_channel_positions (GstStructure *str, - const GstAudioChannelPosition *pos); - -/* Sets a (non-fixed) list of possible audio channel positions - * on a structure (this requires the "channels" property to - * be fixed!) or on a caps (here, the "channels" property may be - * unfixed and the caps may even contain multiple structures). */ -void gst_audio_set_structure_channel_positions_list - (GstStructure *str, - const GstAudioChannelPosition *pos, - gint num_positions); -void gst_audio_set_caps_channel_positions_list - (GstCaps *caps, - const GstAudioChannelPosition *pos, - gint num_positions); - -/* Custom fixate function. Elements that implement some sort of - * channel conversion algorhithm should use this function for - * fixating on GstAudioChannelPosition properties. It will take - * care of equal channel positioning (left/right). Caller g_free()s - * the return value. The input properties may be (and are supposed - * to be) unfixed. */ -GstAudioChannelPosition * - gst_audio_fixate_channel_positions (GstStructure *str); - -G_END_DECLS - -#endif /* __GST_AUDIO_MULTICHANNEL_H__ */ diff --git a/gst-libs/gst/audio/testchannels.c b/gst-libs/gst/audio/testchannels.c deleted file mode 100644 index b886c820..00000000 --- a/gst-libs/gst/audio/testchannels.c +++ /dev/null @@ -1,55 +0,0 @@ -/* GStreamer Multichannel Test - * (c) 2004 Ronald Bultje - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#include -#include - -gint -main (gint argc, gchar * argv[]) -{ - gchar *str; - GstCaps *caps; - GstAudioChannelPosition pos[2] = { GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, - GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT - }; - - /* register multichannel type */ - gst_init (&argc, &argv); - gst_audio_channel_position_get_type (); - - /* test some caps-string conversions */ - caps = gst_caps_new_simple ("audio/x-raw-int", - "channels", G_TYPE_INT, 2, NULL); - str = gst_caps_to_string (caps); - g_print ("Test caps #1: %s\n", str); - g_free (str); - gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos); - str = gst_caps_to_string (caps); - g_print ("Test caps #2: %s\n", str); - g_free (str); - gst_caps_free (caps); - - return 0; -} -- cgit v1.2.1