mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
actually recurse into sndfile if we are able big ladspa cleanups, mainly to comply with the buffer-frames caps proper...
Original commit message from CVS: * actually recurse into sndfile if we are able * big ladspa cleanups, mainly to comply with the buffer-frames caps property, but also general cleanups - the samplerate prop is gone, if you want to set it explicitly (as in for get-based plugins) you need to use a filtered connection, just like with buffer-frames * big float2int and int2float changes for buffer-frames compatibility - I think it's quite a bit simpler * make the ossclock general, add it to gstaudio, and use it in sndfile as well i need to update mimetypes, but that's coming soon. there are some other plugins that don't support buffer-frames, i guess i need to get around to fixing them as well.
This commit is contained in:
parent
8ab9120751
commit
9ee0b03986
7 changed files with 284 additions and 5 deletions
|
@ -273,7 +273,7 @@ SUBDIRS=$(A52DEC_DIR) $(AALIB_DIR) $(ALSA_DIR) \
|
||||||
$(MAD_DIR) $(MATROSKA_DIR) $(MIKMOD_DIR) \
|
$(MAD_DIR) $(MATROSKA_DIR) $(MIKMOD_DIR) \
|
||||||
$(MPEG2DEC_DIR) $(PANGO_DIR) $(RAW1394_DIR) \
|
$(MPEG2DEC_DIR) $(PANGO_DIR) $(RAW1394_DIR) \
|
||||||
$(SDL_DIR) $(SHOUT_DIR) $(SIDPLAY_DIR) \
|
$(SDL_DIR) $(SHOUT_DIR) $(SIDPLAY_DIR) \
|
||||||
$(SMOOTHWAVE_DIR) $(SWFDEC_DIR) $(TARKIN_DIR) \
|
$(SMOOTHWAVE_DIR) $(SNDFILE_DIR) $(SWFDEC_DIR) $(TARKIN_DIR) \
|
||||||
$(VORBIS_DIR) $(XVID_DIR) $(SNAPSHOT_DIR)
|
$(VORBIS_DIR) $(XVID_DIR) $(SNAPSHOT_DIR)
|
||||||
|
|
||||||
DIST_SUBDIRS=\
|
DIST_SUBDIRS=\
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2003-06-09 22:00 GMT
|
2003-07-05 22:00 GMT
|
||||||
|
|
|
@ -2,10 +2,10 @@ librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@
|
||||||
|
|
||||||
library_LTLIBRARIES = libgstaudio.la
|
library_LTLIBRARIES = libgstaudio.la
|
||||||
|
|
||||||
libgstaudio_la_SOURCES = audio.c
|
libgstaudio_la_SOURCES = audio.c audioclock.c
|
||||||
|
|
||||||
libgstaudioincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/audio
|
libgstaudioincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/audio
|
||||||
libgstaudioinclude_HEADERS = audio.h
|
libgstaudioinclude_HEADERS = audio.h audioclock.h
|
||||||
|
|
||||||
libgstaudio_la_LIBADD =
|
libgstaudio_la_LIBADD =
|
||||||
libgstaudio_la_CFLAGS = $(GST_CFLAGS) $(GST_OPT_CFLAGS)
|
libgstaudio_la_CFLAGS = $(GST_CFLAGS) $(GST_OPT_CFLAGS)
|
||||||
|
|
|
@ -177,7 +177,7 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf)
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GModule *module, GstPlugin *plugin)
|
plugin_init (GModule *module, GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
gst_plugin_set_longname (plugin, "Convenience routines for audio plugins");
|
gst_plugin_set_longname (plugin, "Support services for audio plugins");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include <gst/audio/audioclock.h>
|
||||||
|
|
||||||
/* For people that are looking at this source: the purpose of these defines is
|
/* 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
|
* 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
|
* properties that need to be defined. you can just use these macros. currently
|
||||||
|
|
194
gst-libs/gst/audio/audioclock.c
Normal file
194
gst-libs/gst/audio/audioclock.c
Normal file
|
@ -0,0 +1,194 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 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),
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
GTimeVal timeval;
|
||||||
|
GstClockTime time;
|
||||||
|
GstClockTime audiotime;
|
||||||
|
|
||||||
|
g_get_current_time (&timeval);
|
||||||
|
time = GST_TIMEVAL_TO_TIME (timeval);
|
||||||
|
audiotime = aclock->func ((GstClock*)aclock, aclock->user_data);
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
aclock->adjust = time - audiotime;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aclock->adjust = audiotime - time;
|
||||||
|
}
|
||||||
|
|
||||||
|
aclock->active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstClockTime
|
||||||
|
gst_audio_clock_get_internal_time (GstClock *clock)
|
||||||
|
{
|
||||||
|
GstAudioClock *aclock = GST_AUDIO_CLOCK (clock);
|
||||||
|
|
||||||
|
if (aclock->active) {
|
||||||
|
GstClockTime audiotime;
|
||||||
|
|
||||||
|
audiotime = aclock->func (clock, aclock->user_data) + aclock->adjust;
|
||||||
|
|
||||||
|
return audiotime;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GstClockTime time;
|
||||||
|
GTimeVal timeval;
|
||||||
|
|
||||||
|
g_get_current_time (&timeval);
|
||||||
|
time = GST_TIMEVAL_TO_TIME (timeval);
|
||||||
|
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 GstClockReturn
|
||||||
|
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);
|
||||||
|
}
|
83
gst-libs/gst/audio/audioclock.h
Normal file
83
gst-libs/gst/audio/audioclock.h
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
|
*
|
||||||
|
* 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 <gst/gstsystemclock.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GstAudioClockClass {
|
||||||
|
GstSystemClockClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GST_AUDIO_CLOCK_H__ */
|
Loading…
Reference in a new issue