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
This commit is contained in:
Christian Schaller 2005-05-06 11:41:28 +00:00
parent 4cb81e7ecb
commit 086b25d40a
113 changed files with 6 additions and 17715 deletions

View file

@ -1,3 +1,8 @@
2005-05-06 Christian Schaller <uraeus@gnome.org>
* gst-libs: Remove all files as this is in gst-plugins-base now
* gst-libs/README: add a remove informing of this move
2005-05-06 Christian Schaller <uraeus@gnome.org>
* PORTED_09: update to add videofilter

View file

@ -1,3 +0,0 @@
SUBDIRS = gst ext
DIST_SUBDIRS = gst ext

1
gst-libs/README Normal file
View file

@ -0,0 +1 @@
Everything that used to be here is now in gst-plugins-base module

View file

@ -1,2 +0,0 @@
SUBDIRS =
DIST_SUBDIRS =

View file

@ -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

View file

@ -1,280 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <gst/gststructure.h>
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);

View file

@ -1,5 +0,0 @@
EXPORTS
gst_plugin_desc
gst_audio_length
gst_audio_is_buffer_framed
gst_audio_highest_sample_value

View file

@ -1,131 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2001> Thomas Vander Stichele <thomas@apestaart.org>
*
* 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 <gst/gst.h>
#include <gst/audio/audioclock.h>
#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__ */

View file

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="audio"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67893}"
RootNamespace="audio"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;AUDIO_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstaudio.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="audio.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/audio.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstaudio.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;AUDIO_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstaudio.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="audio.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstaudio.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\audio.c">
</File>
<File
RelativePath=".\audio.def">
</File>
<File
RelativePath=".\audioclock.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\audio.h">
</File>
<File
RelativePath=".\audioclock.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,205 +0,0 @@
/* 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.
*/
#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);
}

View file

@ -1,81 +0,0 @@
/* 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>
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__ */

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="audiofilter"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67894}"
RootNamespace="audiofilter"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;AUDIOFILTER_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstaudiofilter.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="audio.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/audiofilter.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstaudiofilter.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;AUDIOFILTER_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstaudiofilter.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="audio.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstaudiofilter.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\gstaudiofilter.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\gstaudiofilter.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,313 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
*
* 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 <string.h>
/* 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 <ds@schleef.org>"
};
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)

View file

@ -1,87 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <gst/gst.h>
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__ */

View file

@ -1,270 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
*
* 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 <gst/gst.h>
#include <gst/audio/audio.h>
#include <gst/audio/gstaudiofilter.h>
#include <string.h>
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 <ds@schleef.org>"
};
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. */
}

View file

@ -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

View file

@ -1,634 +0,0 @@
/* GStreamer Multichannel-Audio helper functions
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* 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 "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;
}

View file

@ -1,90 +0,0 @@
/* GStreamer Multichannel-Audio helper functions
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* 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 <gst/audio/audio.h>
#include <gst/audio/multichannel-enumtypes.h>
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__ */

View file

@ -1,55 +0,0 @@
/* GStreamer Multichannel Test
* (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* 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 <gst/gst.h>
#include <multichannel.c>
#include <multichannel-enumtypes.c>
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;
}

View file

@ -1,47 +0,0 @@
# variables used for enum/marshal generation
glib_enum_headers=$(colorbalance_headers)
glib_enum_define=GST_COLOR_BALANCE
glib_enum_prefix=gst_color_balance
libgstcolorbalanceincludedir = \
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/colorbalance
colorbalance_headers = \
colorbalance.h \
colorbalancechannel.h
built_sources = \
colorbalance-marshal.c \
colorbalance-enumtypes.c
built_headers = \
colorbalance-marshal.h \
colorbalance-enumtypes.h
libgstcolorbalanceinclude_HEADERS = \
$(colorbalance_headers)
nodist_libgstcolorbalanceinclude_HEADERS = \
colorbalance-enumtypes.h
noinst_LTLIBRARIES = libgstcolorbalance.la
libgstcolorbalance_la_SOURCES = \
colorbalance.c \
colorbalancechannel.c
nodist_libgstcolorbalance_la_SOURCES = \
$(built_sources) \
colorbalance-marshal.h
libgstcolorbalance_la_CFLAGS = $(GST_CFLAGS)
BUILT_SOURCES = \
$(built_sources) \
$(built_headers)
EXTRA_DIST = colorbalance-marshal.list
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/glib-gen.mak

View file

@ -1 +0,0 @@
VOID:OBJECT,INT

View file

@ -1,136 +0,0 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* colorbalance.c: image color balance interface design
* virtual class function wrappers
*
* 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 "colorbalance.h"
#include "colorbalance-marshal.h"
enum
{
VALUE_CHANGED,
LAST_SIGNAL
};
static void gst_color_balance_class_init (GstColorBalanceClass * klass);
static guint gst_color_balance_signals[LAST_SIGNAL] = { 0 };
GType
gst_color_balance_get_type (void)
{
static GType gst_color_balance_type = 0;
if (!gst_color_balance_type) {
static const GTypeInfo gst_color_balance_info = {
sizeof (GstColorBalanceClass),
(GBaseInitFunc) gst_color_balance_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
"GstColorBalance", &gst_color_balance_info, 0);
g_type_interface_add_prerequisite (gst_color_balance_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_color_balance_type;
}
static void
gst_color_balance_class_init (GstColorBalanceClass * klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_color_balance_signals[VALUE_CHANGED] =
g_signal_new ("value-changed",
GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
NULL, NULL,
gst_color_balance_marshal_VOID__OBJECT_INT,
G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}
klass->balance_type = GST_COLOR_BALANCE_SOFTWARE;
/* default virtual functions */
klass->list_channels = NULL;
klass->set_value = NULL;
klass->get_value = NULL;
}
const GList *
gst_color_balance_list_channels (GstColorBalance * balance)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
if (klass->list_channels) {
return klass->list_channels (balance);
}
return NULL;
}
void
gst_color_balance_set_value (GstColorBalance * balance,
GstColorBalanceChannel * channel, gint value)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
if (klass->set_value) {
klass->set_value (balance, channel, value);
}
}
gint
gst_color_balance_get_value (GstColorBalance * balance,
GstColorBalanceChannel * channel)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
if (klass->get_value) {
return klass->get_value (balance, channel);
}
return channel->min_value;
}
void
gst_color_balance_value_changed (GstColorBalance * balance,
GstColorBalanceChannel * channel, gint value)
{
g_signal_emit (G_OBJECT (balance),
gst_color_balance_signals[VALUE_CHANGED], 0, channel, value);
g_signal_emit_by_name (G_OBJECT (channel), "value_changed", value);
}

View file

@ -1,96 +0,0 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* color-balance.h: image color balance interface design
*
* 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_COLOR_BALANCE_H__
#define __GST_COLOR_BALANCE_H__
#include <gst/gst.h>
#include <gst/colorbalance/colorbalancechannel.h>
#include <gst/colorbalance/colorbalance-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_COLOR_BALANCE \
(gst_color_balance_get_type ())
#define GST_COLOR_BALANCE(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE, \
GstColorBalance))
#define GST_COLOR_BALANCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE, \
GstColorBalanceClass))
#define GST_IS_COLOR_BALANCE(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE))
#define GST_IS_COLOR_BALANCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
#define GST_COLOR_BALANCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
#define GST_COLOR_BALANCE_TYPE(klass) (klass->balance_type)
typedef struct _GstColorBalance GstColorBalance;
typedef enum
{
GST_COLOR_BALANCE_HARDWARE,
GST_COLOR_BALANCE_SOFTWARE
} GstColorBalanceType;
typedef struct _GstColorBalanceClass {
GTypeInterface klass;
GstColorBalanceType balance_type;
/* virtual functions */
const GList * (* list_channels) (GstColorBalance *balance);
void (* set_value) (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gint (* get_value) (GstColorBalance *balance,
GstColorBalanceChannel *channel);
/* signals */
void (* value_changed) (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceClass;
GType gst_color_balance_get_type (void);
/* virtual class function wrappers */
const GList *
gst_color_balance_list_channels (GstColorBalance *balance);
void gst_color_balance_set_value (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
gint gst_color_balance_get_value (GstColorBalance *balance,
GstColorBalanceChannel *channel);
/* trigger signal */
void gst_color_balance_value_changed (GstColorBalance *balance,
GstColorBalanceChannel *channel,
gint value);
G_END_DECLS
#endif /* __GST_COLOR_BALANCE_H__ */

View file

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="colorbalance"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67894}"
RootNamespace="colorbalance"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstcolorbalance.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="colorbalance.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/colorbalance.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstcolorbalance.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstcolorbalance.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="colorbalance.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstcolorbalance.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\colorbalance.c">
</File>
<File
RelativePath=".\colorbalancechannel.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\colorbalance.h">
</File>
<File
RelativePath=".\colorbalancechannel.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,106 +0,0 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* colorbalancechannel.c: colorbalance channel object design
*
* 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 "colorbalancechannel.h"
enum
{
/* FILL ME */
SIGNAL_VALUE_CHANGED,
LAST_SIGNAL
};
static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
klass);
static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
static void gst_color_balance_channel_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
gst_color_balance_channel_get_type (void)
{
static GType gst_color_balance_channel_type = 0;
if (!gst_color_balance_channel_type) {
static const GTypeInfo color_balance_channel_info = {
sizeof (GstColorBalanceChannelClass),
NULL,
NULL,
(GClassInitFunc) gst_color_balance_channel_class_init,
NULL,
NULL,
sizeof (GstColorBalanceChannel),
0,
(GInstanceInitFunc) gst_color_balance_channel_init,
NULL
};
gst_color_balance_channel_type =
g_type_register_static (G_TYPE_OBJECT,
"GstColorBalanceChannel", &color_balance_channel_info, 0);
}
return gst_color_balance_channel_type;
}
static void
gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
signals[SIGNAL_VALUE_CHANGED] =
g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstColorBalanceChannelClass,
value_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_color_balance_channel_dispose;
}
static void
gst_color_balance_channel_init (GstColorBalanceChannel * channel)
{
channel->label = NULL;
channel->min_value = channel->max_value = 0;
}
static void
gst_color_balance_channel_dispose (GObject * object)
{
GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
if (channel->label)
g_free (channel->label);
channel->label = NULL;
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,64 +0,0 @@
/* GStreamer Color Balance
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* colorbalancechannel.h: individual channel object
*
* 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_COLOR_BALANCE_CHANNEL_H__
#define __GST_COLOR_BALANCE_CHANNEL_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_COLOR_BALANCE_CHANNEL \
(gst_color_balance_channel_get_type ())
#define GST_COLOR_BALANCE_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL, \
GstColorBalanceChannel))
#define GST_COLOR_BALANCE_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL, \
GstColorBalanceChannelClass))
#define GST_IS_COLOR_BALANCE_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL))
#define GST_IS_COLOR_BALANCE_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL))
typedef struct _GstColorBalanceChannel {
GObject parent;
gchar *label;
gint min_value,
max_value;
} GstColorBalanceChannel;
typedef struct _GstColorBalanceChannelClass {
GObjectClass parent;
/* signals */
void (* value_changed) (GstColorBalanceChannel *channel,
gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceChannelClass;
GType gst_color_balance_channel_get_type (void);
G_END_DECLS
#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */

View file

@ -1,2 +0,0 @@
floatcastincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/floatcast
floatcastinclude_HEADERS = floatcast.h

View file

@ -1,106 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Library <2002> Steve Baker <stevebaker_org@yahoo.co.uk>
*
* 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 __FLOATCAST_H__
#define __FLOATCAST_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include <glib/gtypes.h>
G_BEGIN_DECLS
#if (HAVE_LRINT && HAVE_LRINTF)
/* These defines enable functionality introduced with the 1999 ISO C
** standard. They must be defined before the inclusion of math.h to
** engage them. If optimisation is enabled, these functions will be
** inlined. With optimisation switched off, you have to link in the
** maths library using -lm.
*/
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC9X 1
#define __USE_ISOC99 1
#include <math.h>
#define gst_cast_float(x) ((gint)lrintf(x))
#define gst_cast_double(x) ((gint)lrint(x))
#else
/* use a standard c cast, but do rounding correctly */
#define gst_cast_float(x) ((gint)floor((x)+0.5))
#define gst_cast_double(x) ((gint)floor((x)+0.5))
#endif
inline static gfloat
GFLOAT_SWAP_LE_BE(gfloat in)
{
gint32 swap;
gfloat out;
memcpy(&swap, &in, 4);
swap = GUINT32_SWAP_LE_BE_CONSTANT (swap);
memcpy(&out, &swap, 4);
return out;
}
inline static gdouble
GDOUBLE_SWAP_LE_BE(gdouble in)
{
gint64 swap;
gdouble out;
memcpy(&swap, &in, 8);
swap = GUINT64_SWAP_LE_BE_CONSTANT (swap);
memcpy(&out, &swap, 8);
return out;
}
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define GFLOAT_TO_LE(val) ((gfloat) (val))
#define GFLOAT_TO_BE(val) (GFLOAT_SWAP_LE_BE (val))
#define GDOUBLE_TO_LE(val) ((gdouble) (val))
#define GDOUBLE_TO_BE(val) (GDOUBLE_SWAP_LE_BE (val))
#elif G_BYTE_ORDER == G_BIG_ENDIAN
#define GFLOAT_TO_LE(val) (GFLOAT_SWAP_LE_BE (val))
#define GFLOAT_TO_BE(val) ((gfloat) (val))
#define GDOUBLE_TO_LE(val) (GDOUBLE_SWAP_LE_BE (val))
#define GDOUBLE_TO_BE(val) ((gdouble) (val))
#else /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
#error unknown ENDIAN type
#endif /* !G_LITTLE_ENDIAN && !G_BIG_ENDIAN */
#define GFLOAT_FROM_LE(val) (GFLOAT_TO_LE (val))
#define GFLOAT_FROM_BE(val) (GDOUBLE_TO_BE (val))
#define GDOUBLE_FROM_LE(val) (GFLOAT_TO_LE (val))
#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
G_END_DECLS
#endif /* __FLOATCAST_H__ */

View file

@ -1,20 +0,0 @@
librarydir = $(libdir)
library_LTLIBRARIES = libgstgconf-@GST_MAJORMINOR@.la
libgstgconf_@GST_MAJORMINOR@_la_SOURCES = gconf.c
libgstgconf_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/gconf
libgstgconf_@GST_MAJORMINOR@include_HEADERS = gconf.h
noinst_PROGRAMS = test-gconf
# add define for GST_GCONF_DIR
DIR_CFLAGS=-DGST_GCONF_DIR=\"/system/gstreamer/@GST_MAJORMINOR@\"
test_gconf_CFLAGS = $(GST_CFLAGS) $(GCONF_CFLAGS) $(DIR_CFLAGS)
test_gconf_LDADD = $(GST_LIBS) $(GCONF_LIBS) libgstgconf-@GST_MAJORMINOR@.la
libgstgconf_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(GCONF_LIBS)
libgstgconf_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GCONF_CFLAGS) $(DIR_CFLAGS)
libgstgconf_@GST_MAJORMINOR@_la_LDFLAGS = @GST_PLUGINS_LT_LDFLAGS@ -version-info @GST_PLUGINS_LIBVERSION@

View file

@ -1,318 +0,0 @@
/* GStreamer
* Copyright (C) <2002> Thomas Vander Stichele <thomas@apestaart.org>
*
* 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 library handles interaction with GConf
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gconf.h"
#ifndef GST_GCONF_DIR
#error "GST_GCONF_DIR is not defined !"
#endif
static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
/* internal functions */
static GConfClient *
gst_gconf_get_client (void)
{
if (!_gst_gconf_client)
_gst_gconf_client = gconf_client_get_default ();
return _gst_gconf_client;
}
/* go through a bin, finding the one pad that is unconnected in the given
* * direction, and return that pad */
static GstPad *
gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
{
GstPad *pad = NULL;
GList *elements = NULL;
const GList *pads = NULL;
GstElement *element = NULL;
elements = (GList *) gst_bin_get_list (bin);
/* traverse all elements looking for unconnected pads */
while (elements && pad == NULL) {
element = GST_ELEMENT (elements->data);
pads = gst_element_get_pad_list (element);
while (pads) {
/* check if the direction matches */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
/* found it ! */
pad = GST_PAD (pads->data);
}
}
if (pad)
break; /* found one already */
pads = g_list_next (pads);
}
elements = g_list_next (elements);
}
return pad;
}
/* external functions */
/**
* gst_gconf_get_string:
* @key: a #gchar corresponding to the key you want to get.
*
* Get GConf key @key's string value.
*
* Returns: a newly allocated #gchar string containing @key's value,
* or NULL in the case of an error..
*/
gchar *
gst_gconf_get_string (const gchar * key)
{
GError *error = NULL;
gchar *value = NULL;
gchar *full_key = g_strdup_printf ("%s/%s", GST_GCONF_DIR, key);
value = gconf_client_get_string (gst_gconf_get_client (), full_key, &error);
g_free (full_key);
if (error) {
g_warning ("gst_gconf_get_string: error: %s\n", error->message);
g_error_free (error);
return NULL;
}
return value;
}
/**
* gst_gconf_set_string:
* @key: a #gchar corresponding to the key you want to set.
* @value: a #gchar containing key value.
*
* Set GConf key @key to string value @value.
*/
void
gst_gconf_set_string (const gchar * key, const gchar * value)
{
GError *error = NULL;
gchar *full_key = g_strdup_printf ("%s/%s", GST_GCONF_DIR, key);
gconf_client_set_string (gst_gconf_get_client (), full_key, value, &error);
if (error) {
GST_ERROR ("gst_gconf_set_string: error: %s\n", error->message);
g_error_free (error);
}
g_free (full_key);
}
/**
* gst_gconf_render_bin_from_description:
* @description: a #gchar string describing the bin.
*
* Render bin from description @description.
*
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
gst_gconf_render_bin_from_description (const gchar * description)
{
GstElement *bin = NULL;
GstPad *pad = NULL;
GError *error = NULL;
gchar *desc = NULL;
/* parse the pipeline to a bin */
desc = g_strdup_printf ("bin.( %s )", description);
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
g_free (desc);
if (error) {
GST_ERROR ("gstgconf: error parsing pipeline %s\n%s\n",
description, error->message);
g_error_free (error);
return NULL;
}
/* find pads and ghost them if necessary */
if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
gst_element_add_ghost_pad (bin, pad, "src");
}
if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))) {
gst_element_add_ghost_pad (bin, pad, "sink");
}
return bin;
}
/**
* gst_gconf_render_bin_from_key:
* @key: a #gchar string corresponding to a GConf key.
*
* Render bin from GConf key @key.
*
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
gst_gconf_render_bin_from_key (const gchar * key)
{
GstElement *bin = NULL;
gchar *value;
value = gst_gconf_get_string (key);
if (value)
bin = gst_gconf_render_bin_from_description (value);
g_free (value);
return bin;
}
/**
* gst_gconf_get_default_audio_sink:
*
* Render audio output bin from GStreamer GConf key : "default/audiosink".
* If key is invalid, the default audio sink for the platform is used
* (typically osssink or sunaudiosink).
*
* Returns: a #GstElement containing the audio output bin, or NULL if
* everything failed.
*/
GstElement *
gst_gconf_get_default_audio_sink (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosink");
if (!ret) {
ret = gst_element_factory_make (DEFAULT_AUDIOSINK, NULL);
if (!ret)
g_warning ("No GConf default audio sink key and %s doesn't work",
DEFAULT_AUDIOSINK);
}
return ret;
}
/**
* gst_gconf_get_default_video_sink:
*
* Render video output bin from GStreamer GConf key : "default/videosink".
* If key is invalid, the default video sink for the platform is used
* (typically xvimagesink or ximagesink).
*
* Returns: a #GstElement containing the video output bin, or NULL if
* everything failed.
*/
GstElement *
gst_gconf_get_default_video_sink (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/videosink");
if (!ret) {
ret = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL);
if (!ret)
g_warning ("No GConf default video sink key and %s doesn't work",
DEFAULT_VIDEOSINK);
}
return ret;
}
/**
* gst_gconf_get_default_audio_src:
*
* Render audio acquisition bin from GStreamer GConf key : "default/audiosrc".
* If key is invalid, the default audio source for the plaform is used.
* (typically osssrc or sunaudiosrc).
*
* Returns: a #GstElement containing the audio source bin, or NULL if
* everything failed.
*/
GstElement *
gst_gconf_get_default_audio_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosrc");
if (!ret) {
ret = gst_element_factory_make (DEFAULT_AUDIOSRC, NULL);
if (!ret)
g_warning ("No GConf default audio src key and %s doesn't work",
DEFAULT_AUDIOSRC);
}
return ret;
}
/**
* gst_gconf_get_default_video_src:
*
* Render video acquisition bin from GStreamer GConf key :
* "default/videosrc". If key is invalid, the default video source
* for the platform is used (typically videotestsrc).
*
* Returns: a #GstElement containing the video source bin, or NULL if
* everything failed.
*/
GstElement *
gst_gconf_get_default_video_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/videosrc");
if (!ret) {
ret = gst_element_factory_make (DEFAULT_VIDEOSRC, NULL);
if (!ret)
g_warning ("No GConf default video src key and %s doesn't work",
DEFAULT_VIDEOSRC);
}
return ret;
}
/**
* gst_gconf_get_default_visualization_element:
*
* Render visualization bin from GStreamer GConf key : "default/visualization".
* If key is invalid, the default visualization element is used.
*
* Returns: a #GstElement containing the visualization bin, or NULL if
* everything failed.
*/
GstElement *
gst_gconf_get_default_visualization_element (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/visualization");
if (!ret) {
ret = gst_element_factory_make (DEFAULT_VISUALIZER, NULL);
if (!ret)
g_warning
("No GConf default visualization plugin key and %s doesn't work",
DEFAULT_VISUALIZER);
}
return ret;
}

View file

@ -1,47 +0,0 @@
/* GStreamer
* Copyright (C) <2002> Thomas Vander Stichele <thomas@apestaart.org>
*
* 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_GCONF_H
#define GST_GCONF_H
/*
* this library handles interaction with GConf
*/
#include <gst/gst.h>
#include <gconf/gconf-client.h>
G_BEGIN_DECLS
gchar * gst_gconf_get_string (const gchar *key);
void gst_gconf_set_string (const gchar *key,
const gchar *value);
GstElement * gst_gconf_render_bin_from_key (const gchar *key);
GstElement * gst_gconf_render_bin_from_description (const gchar *description);
GstElement * gst_gconf_get_default_video_sink (void);
GstElement * gst_gconf_get_default_audio_sink (void);
GstElement * gst_gconf_get_default_video_src (void);
GstElement * gst_gconf_get_default_audio_src (void);
GstElement * gst_gconf_get_default_visualization_element (void);
G_END_DECLS
#endif /* GST_GCONF_H */

View file

@ -1,36 +0,0 @@
/* GStreamer
* Copyright (C) <2002> Thomas Vander Stichele <thomas@apestaart.org>
*
* 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 "gconf.h"
int
main (int argc, char *argv[])
{
gst_init (&argc, &argv);
printf ("Default video sink : %s\n",
gst_gconf_get_string ("default/videosink"));
printf ("Default audio sink : %s\n",
gst_gconf_get_string ("default/audiosink"));
printf ("Default video src : %s\n",
gst_gconf_get_string ("default/videosrc"));
printf ("Default audio src : %s\n",
gst_gconf_get_string ("default/audiosrc"));
return 0;
}

View file

@ -1,26 +0,0 @@
librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@
library_LTLIBRARIES = libgstidct.la
libgstidct_la_SOURCES = \
fastintidct.c \
floatidct.c \
idct.c \
intidct.c
libgstidctincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/idct
libgstidctinclude_HEADERS = idct.h
noinst_HEADERS = dct.h
## check_PROGRAMS = ieeetest
## ieeetest_SOURCES = ieeetest.c
## ieeetest_LDADD = libgstidct.la
## ieeetest_CFLAGS = $(GST_CFLAGS)
## ieeetest_LDFLAGS = $(GST_LIBS)
libgstidct_la_LIBADD =
libgstidct_la_CFLAGS = $(GST_CFLAGS)
libgstidct_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -1,48 +0,0 @@
This archive contains a quick & dirty implementation of the IEEE Standard
1180-1990 accuracy test for inverse DCT. It is not guaranteed to be
correct ... but if you find any bugs, please let me know (by email to
tgl@cs.cmu.edu).
The test harness consists of the C program ieeetest.c and shell script
doieee. For comparison purposes I have also supplied a copy of jrevdct.c,
the inverse DCT routine from release 4 of the Independent JPEG Group's
free JPEG software. (jrevdct.c is slightly modified from the IJG release
so that it will compile without the IJG include files.) jrevdct.c passes
the 1180 test --- or at least, this program thinks so. jrevdct.out is
the output from a test run.
Note that numerical results may vary somewhat across machines. This appears
to be mostly due to differing results from the cosine function.
INSTALLATION:
Check the Makefile, change CC and CFLAGS if needed. Then say "make".
If your C compiler is non-ANSI, you may need to change includes and/or
function headers.
To test a different IDCT routine, link with that routine instead of
jrevdct.o. You will need to modify dct.h and/or ieeetest.c if your
routine's calling convention is not in-place modification of an array
of 64 "short"s.
USAGE:
The standard test procedure is
doieee ieeetest >outputfile
Expect it to take a while (almost 80 minutes on my old 68030 box).
Each of the six passes will emit a row of 100 dots as it runs.
You can grep the output for the word FAILS if you just want to know
yea or nay.
LEGAL MUMBO-JUMBO:
I hereby release the test harness to the public domain.
Thomas G. Lane, 22 Nov 1993
IMPORTANT: jrevdct.c is NOT public domain, but is copyrighted free software
(not the same thing at all). It is subject to IJG's distribution terms, which
primarily state that if you incorporate it into a program you must acknowledge
IJG's contribution in your program documentation. For more details and the
complete IJG software, see the IJG FTP archive at ftp.uu.net, in directory
/graphics/jpeg.

View file

@ -1,26 +0,0 @@
/* define DCT types */
/*
* DCTSIZE underlying (1d) transform size
* DCTSIZE2 DCTSIZE squared
*/
#define DCTSIZE (8)
#define DCTSIZE2 (DCTSIZE*DCTSIZE)
#define EIGHT_BIT_SAMPLES /* needed in jrevdct.c */
typedef short DCTELEM; /* must be at least 16 bits */
typedef DCTELEM DCTBLOCK[DCTSIZE2];
typedef long INT32; /* must be at least 32 bits */
extern void gst_idct_int_idct();
extern void gst_idct_init_fast_int_idct (void);
extern void gst_idct_fast_int_idct (short *block);
extern void gst_idct_init_float_idct(void);
extern void gst_idct_float_idct (short *block);

View file

@ -1,15 +0,0 @@
# perform IEEE 1180 test series
# Typical usage:
# doieee >outfile
# where progname is ieeetest or a variant
for i in 1 2 3 4 5;
do
time ./ieeetest $i -256 255 1 10000
time ./ieeetest $i -5 5 1 10000
time ./ieeetest $i -300 300 1 10000
time ./ieeetest $i -256 255 -1 10000
time ./ieeetest $i -5 5 -1 10000
time ./ieeetest $i -300 300 -1 10000
done

View file

@ -1,215 +0,0 @@
/* idct.c, inverse fast discrete cosine transform */
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
/*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee or
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
* any and all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and user's
* customers, employees, agents, transferees, successors, and assigns.
*
* The MPEG Software Simulation Group does not represent or warrant that the
* programs furnished hereunder are free of infringement of any third-party
* patents.
*
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
* are subject to royalty fees to patent holders. Many of these patents are
* general enough such that they are unavoidable regardless of implementation
* design.
*
*/
/**********************************************************/
/* inverse two dimensional DCT, Chen-Wang algorithm */
/* (cf. IEEE ASSP-32, pp. 803-816, Aug. 1984) */
/* 32-bit integer arithmetic (8 bit coefficients) */
/* 11 mults, 29 adds per DCT */
/* sE, 18.8.91 */
/**********************************************************/
/* coefficients extended to 12 bit for IEEE1180-1990 */
/* compliance sE, 2.1.94 */
/**********************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* this code assumes >> to be a two's-complement arithmetic */
/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */
#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#include "dct.h"
/* private data */
static short iclip[1024]; /* clipping table */
static short *iclp;
/* private prototypes */
static void idctrow (short *blk);
static void idctcol (short *blk);
/* row (horizontal) IDCT
*
* 7 pi 1
* dst[k] = sum c[l] * src[l] * cos( -- * ( k + - ) * l )
* l=0 8 2
*
* where: c[0] = 128
* c[1..7] = 128*sqrt(2)
*/
static void
idctrow (blk)
short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
(x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] =
blk[0] << 3;
return;
}
x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
/* first stage */
x8 = W7 * (x4 + x5);
x4 = x8 + (W1 - W7) * x4;
x5 = x8 - (W1 + W7) * x5;
x8 = W3 * (x6 + x7);
x6 = x8 - (W3 - W5) * x6;
x7 = x8 - (W3 + W5) * x7;
/* second stage */
x8 = x0 + x1;
x0 -= x1;
x1 = W6 * (x3 + x2);
x2 = x1 - (W2 + W6) * x2;
x3 = x1 + (W2 - W6) * x3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
x2 = (181 * (x4 + x5) + 128) >> 8;
x4 = (181 * (x4 - x5) + 128) >> 8;
/* fourth stage */
blk[0] = (x7 + x1) >> 8;
blk[1] = (x3 + x2) >> 8;
blk[2] = (x0 + x4) >> 8;
blk[3] = (x8 + x6) >> 8;
blk[4] = (x8 - x6) >> 8;
blk[5] = (x0 - x4) >> 8;
blk[6] = (x3 - x2) >> 8;
blk[7] = (x7 - x1) >> 8;
}
/* column (vertical) IDCT
*
* 7 pi 1
* dst[8*k] = sum c[l] * src[8*l] * cos( -- * ( k + - ) * l )
* l=0 8 2
*
* where: c[0] = 1/1024
* c[1..7] = (1/1024)*sqrt(2)
*/
static void
idctcol (blk)
short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
(x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
blk[8 * 3]))) {
blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =
blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
return;
}
x0 = (blk[8 * 0] << 8) + 8192;
/* first stage */
x8 = W7 * (x4 + x5) + 4;
x4 = (x8 + (W1 - W7) * x4) >> 3;
x5 = (x8 - (W1 + W7) * x5) >> 3;
x8 = W3 * (x6 + x7) + 4;
x6 = (x8 - (W3 - W5) * x6) >> 3;
x7 = (x8 - (W3 + W5) * x7) >> 3;
/* second stage */
x8 = x0 + x1;
x0 -= x1;
x1 = W6 * (x3 + x2) + 4;
x2 = (x1 - (W2 + W6) * x2) >> 3;
x3 = (x1 + (W2 - W6) * x3) >> 3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
x2 = (181 * (x4 + x5) + 128) >> 8;
x4 = (181 * (x4 - x5) + 128) >> 8;
/* fourth stage */
blk[8 * 0] = iclp[(x7 + x1) >> 14];
blk[8 * 1] = iclp[(x3 + x2) >> 14];
blk[8 * 2] = iclp[(x0 + x4) >> 14];
blk[8 * 3] = iclp[(x8 + x6) >> 14];
blk[8 * 4] = iclp[(x8 - x6) >> 14];
blk[8 * 5] = iclp[(x0 - x4) >> 14];
blk[8 * 6] = iclp[(x3 - x2) >> 14];
blk[8 * 7] = iclp[(x7 - x1) >> 14];
}
/* two dimensional inverse discrete cosine transform */
void
gst_idct_fast_int_idct (block)
short *block;
{
int i;
for (i = 0; i < 8; i++)
idctrow (block + 8 * i);
for (i = 0; i < 8; i++)
idctcol (block + i);
}
void
gst_idct_init_fast_int_idct ()
{
int i;
iclp = iclip + 512;
for (i = -512; i < 512; i++)
iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
}

View file

@ -1,106 +0,0 @@
/* Reference_IDCT.c, Inverse Discrete Fourier Transform, double precision */
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
/*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license fee or
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
* any and all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and user's
* customers, employees, agents, transferees, successors, and assigns.
*
* The MPEG Software Simulation Group does not represent or warrant that the
* programs furnished hereunder are free of infringement of any third-party
* patents.
*
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
* are subject to royalty fees to patent holders. Many of these patents are
* general enough such that they are unavoidable regardless of implementation
* design.
*
*/
/* Perform IEEE 1180 reference (64-bit floating point, separable 8x1
* direct matrix multiply) Inverse Discrete Cosine Transform
*/
/* Here we use math.h to generate constants. Compiler results may
vary a little */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#ifndef PI
# ifdef M_PI
# define PI M_PI
# else
# define PI 3.14159265358979323846
# endif
#endif
/* private data */
/* cosine transform matrix for 8x1 IDCT */
static double gst_idct_float_c[8][8];
/* initialize DCT coefficient matrix */
void
gst_idct_init_float_idct ()
{
int freq, time;
double scale;
for (freq = 0; freq < 8; freq++) {
scale = (freq == 0) ? sqrt (0.125) : 0.5;
for (time = 0; time < 8; time++)
gst_idct_float_c[freq][time] =
scale * cos ((PI / 8.0) * freq * (time + 0.5));
}
}
/* perform IDCT matrix multiply for 8x8 coefficient block */
void
gst_idct_float_idct (block)
short *block;
{
int i, j, k, v;
double partial_product;
double tmp[64];
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++) {
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][j] * block[8 * i + k];
tmp[8 * i + j] = partial_product;
}
/* Transpose operation is integrated into address mapping by switching
loop order of i and j */
for (j = 0; j < 8; j++)
for (i = 0; i < 8; i++) {
partial_product = 0.0;
for (k = 0; k < 8; k++)
partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j];
v = (int) floor (partial_product + 0.5);
block[8 * i + j] = (v < -256) ? -256 : ((v > 255) ? 255 : v);
}
}

View file

@ -1,136 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <gst/gst.h>
#include <gst/idct/idct.h>
#include "dct.h"
static void gst_idct_int_sparse_idct (short *data);
GstIDCT *
gst_idct_new (GstIDCTMethod method)
{
GstIDCT *new = g_malloc (sizeof (GstIDCT));
new->need_transpose = FALSE;
if (method == GST_IDCT_DEFAULT) {
method = GST_IDCT_FAST_INT;
}
new->convert_sparse = gst_idct_int_sparse_idct;
switch (method) {
case GST_IDCT_FAST_INT:
GST_INFO ("using fast_int_idct");
gst_idct_init_fast_int_idct ();
new->convert = gst_idct_fast_int_idct;
break;
case GST_IDCT_INT:
GST_INFO ("using int_idct");
new->convert = gst_idct_int_idct;
break;
case GST_IDCT_FLOAT:
GST_INFO ("using float_idct");
gst_idct_init_float_idct ();
new->convert = gst_idct_float_idct;
break;
default:
GST_INFO ("method not supported");
g_free (new);
return NULL;
}
return new;
}
static void
gst_idct_int_sparse_idct (short *data)
{
short val;
gint32 v, *dp = (guint32 *) data;
v = *data;
if (v < 0) {
val = -v;
val += (8 >> 1);
val /= 8;
val = -val;
} else {
val = (v + (8 >> 1)) / 8;
}
v = ((val & 0xffff) | (val << 16));
dp[0] = v;
dp[1] = v;
dp[2] = v;
dp[3] = v;
dp[4] = v;
dp[5] = v;
dp[6] = v;
dp[7] = v;
dp[8] = v;
dp[9] = v;
dp[10] = v;
dp[11] = v;
dp[12] = v;
dp[13] = v;
dp[14] = v;
dp[15] = v;
dp[16] = v;
dp[17] = v;
dp[18] = v;
dp[19] = v;
dp[20] = v;
dp[21] = v;
dp[22] = v;
dp[23] = v;
dp[24] = v;
dp[25] = v;
dp[26] = v;
dp[27] = v;
dp[28] = v;
dp[29] = v;
dp[30] = v;
dp[31] = v;
}
void
gst_idct_destroy (GstIDCT * idct)
{
g_return_if_fail (idct != NULL);
g_free (idct);
}
static gboolean
plugin_init (GstPlugin * plugin)
{
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gstidct",
"Accelerated IDCT routines",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)

View file

@ -1,55 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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_IDCT_H__
#define __GST_IDCT_H__
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
GST_IDCT_DEFAULT,
GST_IDCT_INT,
GST_IDCT_FAST_INT,
GST_IDCT_FLOAT,
} GstIDCTMethod;
typedef struct _GstIDCT GstIDCT;
typedef void (*GstIDCTFunction) (gshort *block);
#define GST_IDCT_TRANSPOSE(idct) ((idct)->need_transpose)
struct _GstIDCT {
/* private */
GstIDCTFunction convert;
GstIDCTFunction convert_sparse;
gboolean need_transpose;
};
GstIDCT *gst_idct_new(GstIDCTMethod method);
#define gst_idct_convert(idct, blocks) (idct)->convert((blocks))
#define gst_idct_convert_sparse(idct, blocks) (idct)->convert_sparse((blocks))
void gst_idct_destroy(GstIDCT *idct);
G_END_DECLS
#endif /* __GST_IDCT_H__ */

View file

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="idtc"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67895}"
RootNamespace="idtc"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstidtc.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/idtc.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstidtc.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstidtc.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstidtc.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\fastintidct.c">
</File>
<File
RelativePath=".\floatidct.c">
</File>
<File
RelativePath=".\idct.c">
</File>
<File
RelativePath=".\intidct.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\dct.h">
</File>
<File
RelativePath=".\idtc.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,366 +0,0 @@
/*
* ieeetest.c --- test IDCT code against the IEEE Std 1180-1990 spec
*
* Note that this does only one pass of the test.
* Six invocations of ieeetest are needed to complete the entire spec.
* The shell script "doieee" performs the complete test.
*
* Written by Tom Lane (tgl@cs.cmu.edu).
* Released to public domain 11/22/93.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <gst/gst.h>
#include <gst/idct/idct.h>
#include "dct.h"
/* prototypes */
void usage (char *msg);
long ieeerand (long L, long H);
void dct_init (void);
void ref_fdct (DCTELEM block[8][8]);
void ref_idct (DCTELEM block[8][8]);
/* error stat accumulators -- assume initialized to 0 */
long sumerrs[DCTSIZE2];
long sumsqerrs[DCTSIZE2];
int maxerr[DCTSIZE2];
char *
meets (double val, double limit)
{
return ((fabs (val) <= limit) ? "meets" : "FAILS");
}
int
main (int argc, char **argv)
{
long minpix, maxpix, sign;
long curiter, niters;
int i, j;
double max, total;
int method;
DCTELEM block[DCTSIZE2]; /* random source data */
DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */
DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */
DCTELEM testout[DCTSIZE2]; /* output from test IDCT */
GstIDCT *idct;
guint64 tscstart, tscmin = ~0, tscmax = 0;
guint64 tscstop;
/* Argument parsing --- not very bulletproof at all */
if (argc != 6)
usage (NULL);
method = atoi (argv[1]);
minpix = atoi (argv[2]);
maxpix = atoi (argv[3]);
sign = atoi (argv[4]);
niters = atol (argv[5]);
gst_library_load ("gstidct");
idct = gst_idct_new (method);
if (idct == 0) {
printf ("method not available\n\n\n");
return 0;
}
dct_init ();
/* Loop once per generated random-data block */
for (curiter = 0; curiter < niters; curiter++) {
/* generate a pseudo-random block of data */
for (i = 0; i < DCTSIZE2; i++)
block[i] = (DCTELEM) (ieeerand (-minpix, maxpix) * sign);
/* perform reference FDCT */
memcpy (refcoefs, block, sizeof (DCTELEM) * DCTSIZE2);
ref_fdct ((DCTELEM **) & refcoefs);
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (refcoefs[i] < -2048)
refcoefs[i] = -2048;
else if (refcoefs[i] > 2047)
refcoefs[i] = 2047;
}
/* perform reference IDCT */
memcpy (refout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
ref_idct (refout);
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (refout[i] < -256)
refout[i] = -256;
else if (refout[i] > 255)
refout[i] = 255;
}
/* perform test IDCT */
if (GST_IDCT_TRANSPOSE (idct)) {
for (j = 0; j < DCTSIZE; j++) {
for (i = 0; i < DCTSIZE; i++) {
testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i];
}
}
} else {
memcpy (testout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
}
gst_trace_read_tsc (&tscstart);
gst_idct_convert (idct, testout);
gst_trace_read_tsc (&tscstop);
/*printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart); */
if (tscstop - tscstart < tscmin)
tscmin = tscstop - tscstart;
if (tscstop - tscstart > tscmax)
tscmax = tscstop - tscstart;
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
if (testout[i] < -256)
testout[i] = -256;
else if (testout[i] > 255)
testout[i] = 255;
}
/* accumulate error stats */
for (i = 0; i < DCTSIZE2; i++) {
register int err = testout[i] - refout[i];
sumerrs[i] += err;
sumsqerrs[i] += err * err;
if (err < 0)
err = -err;
if (maxerr[i] < err)
maxerr[i] = err;
}
if (curiter % 100 == 99) {
fprintf (stderr, ".");
fflush (stderr);
}
}
fprintf (stderr, "\n");
/* print results */
printf
("IEEE test conditions: -L = %ld, +H = %ld, sign = %ld, #iters = %ld\n",
minpix, maxpix, sign, niters);
printf ("Speed, min time %lld, max %lld\n", tscmin, tscmax);
printf ("Peak absolute values of errors:\n");
for (i = 0, j = 0; i < DCTSIZE2; i++) {
if (j < maxerr[i])
j = maxerr[i];
printf ("%4d", maxerr[i]);
if ((i % DCTSIZE) == DCTSIZE - 1)
printf ("\n");
}
printf ("Worst peak error = %d (%s spec limit 1)\n\n", j,
meets ((double) j, 1.0));
printf ("Mean square errors:\n");
max = total = 0.0;
for (i = 0; i < DCTSIZE2; i++) {
double err = (double) sumsqerrs[i] / ((double) niters);
total += (double) sumsqerrs[i];
if (max < err)
max = err;
printf (" %8.4f", err);
if ((i % DCTSIZE) == DCTSIZE - 1)
printf ("\n");
}
printf ("Worst pmse = %.6f (%s spec limit 0.06)\n", max, meets (max, 0.06));
total /= (double) (64 * niters);
printf ("Overall mse = %.6f (%s spec limit 0.02)\n\n", total,
meets (total, 0.02));
printf ("Mean errors:\n");
max = total = 0.0;
for (i = 0; i < DCTSIZE2; i++) {
double err = (double) sumerrs[i] / ((double) niters);
total += (double) sumerrs[i];
printf (" %8.4f", err);
if (err < 0.0)
err = -err;
if (max < err)
max = err;
if ((i % DCTSIZE) == DCTSIZE - 1)
printf ("\n");
}
printf ("Worst mean error = %.6f (%s spec limit 0.015)\n", max,
meets (max, 0.015));
total /= (double) (64 * niters);
printf ("Overall mean error = %.6f (%s spec limit 0.0015)\n\n", total,
meets (total, 0.0015));
/* test for 0 input giving 0 output */
memset (testout, 0, sizeof (DCTELEM) * DCTSIZE2);
gst_idct_convert (idct, testout);
for (i = 0, j = 0; i < DCTSIZE2; i++) {
if (testout[i]) {
printf ("Position %d of IDCT(0) = %d (FAILS)\n", i, testout[i]);
j++;
}
}
printf ("%d elements of IDCT(0) were not zero\n\n\n", j);
exit (0);
return 0;
}
void
usage (char *msg)
{
if (msg != NULL)
fprintf (stderr, "\nerror: %s\n", msg);
fprintf (stderr, "\n");
fprintf (stderr, "usage: ieeetest minpix maxpix sign niters\n");
fprintf (stderr, "\n");
fprintf (stderr, " test = 1 - 5\n");
fprintf (stderr, " minpix = -L value per IEEE spec\n");
fprintf (stderr, " maxpix = H value per IEEE spec\n");
fprintf (stderr, " sign = +1 for normal, -1 to run negated test\n");
fprintf (stderr, " niters = # iterations (10000 for full test)\n");
fprintf (stderr, "\n");
exit (1);
}
/* Pseudo-random generator specified by IEEE 1180 */
long
ieeerand (long L, long H)
{
static long randx = 1;
static double z = (double) 0x7fffffff;
long i, j;
double x;
randx = (randx * 1103515245) + 12345;
i = randx & 0x7ffffffe;
x = ((double) i) / z;
x *= (L + H + 1);
j = x;
return j - L;
}
/* Reference double-precision FDCT and IDCT */
/* The cosine lookup table */
/* coslu[a][b] = C(b)/2 * cos[(2a+1)b*pi/16] */
double coslu[8][8];
/* Routine to initialise the cosine lookup table */
void
dct_init (void)
{
int a, b;
double tmp;
for (a = 0; a < 8; a++)
for (b = 0; b < 8; b++) {
tmp = cos ((double) ((a + a + 1) * b) * (3.14159265358979323846 / 16.0));
if (b == 0)
tmp /= sqrt (2.0);
coslu[a][b] = tmp * 0.5;
}
}
void
ref_fdct (DCTELEM block[8][8])
{
int x, y, u, v;
double tmp, tmp2;
double res[8][8];
for (v = 0; v < 8; v++) {
for (u = 0; u < 8; u++) {
tmp = 0.0;
for (y = 0; y < 8; y++) {
tmp2 = 0.0;
for (x = 0; x < 8; x++) {
tmp2 += (double) block[y][x] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
}
res[v][u] = tmp;
}
}
for (v = 0; v < 8; v++) {
for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
}
block[v][u] = (DCTELEM) x;
}
}
}
void
ref_idct (DCTELEM block[8][8])
{
int x, y, u, v;
double tmp, tmp2;
double res[8][8];
for (y = 0; y < 8; y++) {
for (x = 0; x < 8; x++) {
tmp = 0.0;
for (v = 0; v < 8; v++) {
tmp2 = 0.0;
for (u = 0; u < 8; u++) {
tmp2 += (double) block[v][u] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
}
res[y][x] = tmp;
}
}
for (v = 0; v < 8; v++) {
for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
}
block[v][u] = (DCTELEM) x;
}
}
}

View file

@ -1,380 +0,0 @@
/*
* jrevdct.c
*
* Copyright (C) 1991, 1992, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains the basic inverse-DCT transformation subroutine.
*
* This implementation is based on an algorithm described in
* C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
* Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
* Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
* The primary algorithm described there uses 11 multiplies and 29 adds.
* We use their alternate method with 12 multiplies and 32 adds.
* The advantage of this method is that no data path contains more than one
* multiplication; this allows a very simple and accurate implementation in
* scaled fixed-point arithmetic, with a minimal number of shifts.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "dct.h"
/* We assume that right shift corresponds to signed division by 2 with
* rounding towards minus infinity. This is correct for typical "arithmetic
* shift" instructions that shift in copies of the sign bit. But some
* C compilers implement >> with an unsigned shift. For these machines you
* must define RIGHT_SHIFT_IS_UNSIGNED.
* RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
* It is only applied with constant shift counts. SHIFT_TEMPS must be
* included in the variables of any routine using RIGHT_SHIFT.
*/
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define SHIFT_TEMPS INT32 shift_temp;
#define RIGHT_SHIFT(x,shft) \
((shift_temp = (x)) < 0 ? \
(shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
(shift_temp >> (shft)))
#else
#define SHIFT_TEMPS
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
#endif
/*
* This routine is specialized to the case DCTSIZE = 8.
*/
#if DCTSIZE != 8
Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
#endif
/*
* A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
* on each column. Direct algorithms are also available, but they are
* much more complex and seem not to be any faster when reduced to code.
*
* The poop on this scaling stuff is as follows:
*
* Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
* larger than the true IDCT outputs. The final outputs are therefore
* a factor of N larger than desired; since N=8 this can be cured by
* a simple right shift at the end of the algorithm. The advantage of
* this arrangement is that we save two multiplications per 1-D IDCT,
* because the y0 and y4 inputs need not be divided by sqrt(N).
*
* We have to do addition and subtraction of the integer inputs, which
* is no problem, and multiplication by fractional constants, which is
* a problem to do in integer arithmetic. We multiply all the constants
* by CONST_SCALE and convert them to integer constants (thus retaining
* CONST_BITS bits of precision in the constants). After doing a
* multiplication we have to divide the product by CONST_SCALE, with proper
* rounding, to produce the correct output. This division can be done
* cheaply as a right shift of CONST_BITS bits. We postpone shifting
* as long as possible so that partial sums can be added together with
* full fractional precision.
*
* The outputs of the first pass are scaled up by PASS1_BITS bits so that
* they are represented to better-than-integral precision. These outputs
* require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
* with the recommended scaling. (To scale up 12-bit sample data further, an
* intermediate INT32 array would be needed.)
*
* To avoid overflow of the 32-bit intermediate results in pass 2, we must
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
* shows that the values given below are the most effective.
*/
#ifdef EIGHT_BIT_SAMPLES
#define CONST_BITS 13
#define PASS1_BITS 2
#else
#define CONST_BITS 13
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
#define ONE ((INT32) 1)
#define CONST_SCALE (ONE << CONST_BITS)
/* Convert a positive real constant to an integer scaled by CONST_SCALE. */
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
* causing a lot of useless floating-point operations at run time.
* To get around this we use the following pre-calculated constants.
* If you change CONST_BITS you may want to add appropriate values.
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
*/
#if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */
#else
#define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644)
#define FIX_0_541196100 FIX(0.541196100)
#define FIX_0_765366865 FIX(0.765366865)
#define FIX_0_899976223 FIX(0.899976223)
#define FIX_1_175875602 FIX(1.175875602)
#define FIX_1_501321110 FIX(1.501321110)
#define FIX_1_847759065 FIX(1.847759065)
#define FIX_1_961570560 FIX(1.961570560)
#define FIX_2_053119869 FIX(2.053119869)
#define FIX_2_562915447 FIX(2.562915447)
#define FIX_3_072711026 FIX(3.072711026)
#endif
/* Descale and correctly round an INT32 value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
* the fudge factor is correct for either sign of X.
*/
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
* For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
* this provides a useful speedup on many machines.
* There is no way to specify a 16x16->32 multiply in portable C, but
* some C compilers will do the right thing if you provide the correct
* combination of casts.
* NB: for 12-bit samples, a full 32-bit multiplication will be needed.
*/
#ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
#endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
#endif
#endif
#ifndef MULTIPLY /* default definition */
#define MULTIPLY(var,const) ((var) * (const))
#endif
/*
* Perform the inverse DCT on one block of coefficients.
*/
void
gst_idct_int_idct (DCTBLOCK data)
{
INT32 tmp0, tmp1, tmp2, tmp3;
INT32 tmp10, tmp11, tmp12, tmp13;
INT32 z1, z2, z3, z4, z5;
register DCTELEM *dataptr;
int rowctr;
SHIFT_TEMPS
/* Pass 1: process rows. */
/* Note results are scaled up by sqrt(8) compared to a true IDCT; */
/* furthermore, we scale the results by 2**PASS1_BITS. */
dataptr = data;
for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/* Due to quantization, we will usually find that many of the input
* coefficients are zero, especially the AC terms. We can exploit this
* by short-circuiting the IDCT calculation for any row in which all
* the AC terms are zero. In that case each output is equal to the
* DC coefficient (with scale factor as needed).
* With typical images and quantization tables, half or more of the
* row DCT calculations can be simplified this way.
*/
if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
/* AC terms all zero */
DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS);
dataptr[0] = dcval;
dataptr[1] = dcval;
dataptr[2] = dcval;
dataptr[3] = dcval;
dataptr[4] = dcval;
dataptr[5] = dcval;
dataptr[6] = dcval;
dataptr[7] = dcval;
dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
z2 = (INT32) dataptr[2];
z3 = (INT32) dataptr[6];
z1 = MULTIPLY (z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY (z3, -FIX_1_847759065);
tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS;
tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
tmp0 = (INT32) dataptr[7];
tmp1 = (INT32) dataptr[5];
tmp2 = (INT32) dataptr[3];
tmp3 = (INT32) dataptr[1];
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[0] = (DCTELEM) DESCALE (tmp10 + tmp3, CONST_BITS - PASS1_BITS);
dataptr[7] = (DCTELEM) DESCALE (tmp10 - tmp3, CONST_BITS - PASS1_BITS);
dataptr[1] = (DCTELEM) DESCALE (tmp11 + tmp2, CONST_BITS - PASS1_BITS);
dataptr[6] = (DCTELEM) DESCALE (tmp11 - tmp2, CONST_BITS - PASS1_BITS);
dataptr[2] = (DCTELEM) DESCALE (tmp12 + tmp1, CONST_BITS - PASS1_BITS);
dataptr[5] = (DCTELEM) DESCALE (tmp12 - tmp1, CONST_BITS - PASS1_BITS);
dataptr[3] = (DCTELEM) DESCALE (tmp13 + tmp0, CONST_BITS - PASS1_BITS);
dataptr[4] = (DCTELEM) DESCALE (tmp13 - tmp0, CONST_BITS - PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
}
/* Pass 2: process columns. */
/* Note that we must descale the results by a factor of 8 == 2**3, */
/* and also undo the PASS1_BITS scaling. */
dataptr = data;
for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/* Columns of zeroes can be exploited in the same way as we did with rows.
* However, the row calculation has created many nonzero AC terms, so the
* simplification applies less often (typically 5% to 10% of the time).
* On machines with very fast multiplication, it's possible that the
* test takes more time than it's worth. In that case this section
* may be commented out.
*/
#ifndef NO_ZERO_COLUMN_TEST
if ((dataptr[DCTSIZE * 1] | dataptr[DCTSIZE * 2] | dataptr[DCTSIZE * 3] |
dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] |
dataptr[DCTSIZE * 7]) == 0) {
/* AC terms all zero */
DCTELEM dcval = (DCTELEM) DESCALE ((INT32) dataptr[0], PASS1_BITS + 3);
dataptr[DCTSIZE * 0] = dcval;
dataptr[DCTSIZE * 1] = dcval;
dataptr[DCTSIZE * 2] = dcval;
dataptr[DCTSIZE * 3] = dcval;
dataptr[DCTSIZE * 4] = dcval;
dataptr[DCTSIZE * 5] = dcval;
dataptr[DCTSIZE * 6] = dcval;
dataptr[DCTSIZE * 7] = dcval;
dataptr++; /* advance pointer to next column */
continue;
}
#endif
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
z2 = (INT32) dataptr[DCTSIZE * 2];
z3 = (INT32) dataptr[DCTSIZE * 6];
z1 = MULTIPLY (z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY (z3, -FIX_1_847759065);
tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
tmp0 =
((INT32) dataptr[DCTSIZE * 0] +
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
tmp1 =
((INT32) dataptr[DCTSIZE * 0] -
(INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
tmp0 = (INT32) dataptr[DCTSIZE * 7];
tmp1 = (INT32) dataptr[DCTSIZE * 5];
tmp2 = (INT32) dataptr[DCTSIZE * 3];
tmp3 = (INT32) dataptr[DCTSIZE * 1];
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[DCTSIZE * 0] = (DCTELEM) DESCALE (tmp10 + tmp3,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 7] = (DCTELEM) DESCALE (tmp10 - tmp3,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 1] = (DCTELEM) DESCALE (tmp11 + tmp2,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 6] = (DCTELEM) DESCALE (tmp11 - tmp2,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 2] = (DCTELEM) DESCALE (tmp12 + tmp1,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 5] = (DCTELEM) DESCALE (tmp12 - tmp1,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 3] = (DCTELEM) DESCALE (tmp13 + tmp0,
CONST_BITS + PASS1_BITS + 3);
dataptr[DCTSIZE * 4] = (DCTELEM) DESCALE (tmp13 - tmp0,
CONST_BITS + PASS1_BITS + 3);
dataptr++; /* advance pointer to next column */
}
}

View file

@ -1,20 +0,0 @@
lib_LTLIBRARIES = libgstmedia-info-@GST_MAJORMINOR@.la
libgstmedia_info_@GST_MAJORMINOR@_la_SOURCES = media-info.c media-info-priv.c
libgstmedia_info_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGIN_CFLAGS)
libgstmedia_info_@GST_MAJORMINOR@_la_LIBADD = \
$(GST_LIBS) $(GST_PLUGIN_LIBS)
libgstmedia_info_@GST_MAJORMINOR@_la_LDFLAGS = \
-version-info @GST_PLUGINS_LIBVERSION@
libincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/media-info
libinclude_HEADERS = media-info.h
noinst_PROGRAMS = media-info-test
noinst_HEADERS = media-info-priv.h
media_info_test_SOURCES = media-info-test.c
media_info_test_CFLAGS = $(GST_CFLAGS)
media_info_test_LDADD = $(GST_LIBS) libgstmedia-info-@GST_MAJORMINOR@.la

View file

@ -1,30 +0,0 @@
* media-info is a library to collect metadata and streaminfo from media
files
* the current implementation is idler-based.
* you create a new media_info object
* you set the string name of a source element to use using g_object_set or
gst_media_info_set_source
* you declare you'll read a given file by using gst_media_info_read_with_idler
* you loop gst_media_info_read_idler (info, &stream) as long as it returns TRUE
and as long as stream is still NULL
* INTERNALS:
- instance_init sets up the media info reader, its elements, and connects
the deep_notify callback
- read_with_idler resets the media info reader object,
and sets location and flags
- read_idler runs through a state machine:
NULL - TYPEFIND - STREAM - METADATA - STREAMINFO - FORMAT
- NULL: just returns find_type_pre, which moves state to TYPEFIND
- TYPEFIND:
- iterates as long as it can until it has priv->type
- find_type_post
- call gmi_set_mime which creates a pipeline to decode stuff
- move to STREAM
- STREAM

View file

@ -1,775 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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.
*/
/* media-info-priv.c - handling of internal stuff */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <string.h>
#include "media-info.h"
#include "media-info-priv.h"
/* helper structs bits */
GstMediaInfoStream *
gmi_stream_new (void)
{
GstMediaInfoStream *stream;
stream = (GstMediaInfoStream *) g_malloc (sizeof (GstMediaInfoStream));
stream->length_tracks = 0;
stream->length_time = 0;
stream->bitrate = 0;
stream->seekable = FALSE;
stream->path = NULL;
stream->mime = NULL;
stream->tracks = NULL;
return stream;
}
void
gmi_stream_free (GstMediaInfoStream * stream)
{
if (stream->mime)
g_free (stream->mime);
/* FIXME: free tracks */
g_free (stream);
}
GstMediaInfoTrack *
gmi_track_new (void)
{
GstMediaInfoTrack *track;
track = g_malloc (sizeof (GstMediaInfoTrack));
track->metadata = NULL;
track->streaminfo = NULL;
track->format = NULL;
track->length_time = 0;
track->con_streams = NULL;
return track;
}
/**
* private functions
*/
/* callbacks */
static void
have_type_callback (GstElement * typefind, guint probability, GstCaps * type,
GstMediaInfoPriv * priv)
{
GstStructure *str;
const gchar *mime;
priv->type = gst_caps_copy (type);
str = gst_caps_get_structure (type, 0);
mime = gst_structure_get_name (str);
GST_DEBUG ("caps %p, mime %s", type, mime);
/* FIXME: this code doesn't yet work, test it later */
#ifdef DONTWORK
if (strcmp (mime, "application/x-id3") == 0) {
/* dig a little deeper */
GST_DEBUG ("dealing with id3, digging deeper");
gst_element_set_state (priv->pipeline, GST_STATE_READY);
gst_element_unlink (priv->source, priv->typefind);
g_assert (priv->decontainer == NULL);
priv->decontainer = gst_element_factory_make ("id3tag", "decontainer");
gst_bin_add (GST_BIN (priv->pipeline), priv->decontainer);
if (priv->decontainer == NULL)
/* FIXME: signal error */
g_warning ("Couldn't create id3tag");
if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind,
NULL));
g_warning ("Couldn't link in id3tag");
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE)
g_warning ("Couldn't set to playing");
}
#endif
}
void
deep_notify_callback (GObject * object, GstObject * origin,
GParamSpec * pspec, GstMediaInfoPriv * priv)
{
GValue value = { 0, };
/* we only care about pad notifies */
if (!GST_IS_PAD (origin))
return;
/*
GST_DEBUG ("DEBUG: deep_notify: have notify of %s from object %s:%s !",
pspec->name, gst_element_get_name (gst_pad_get_parent (GST_PAD (origin))),
gst_object_get_name (origin));
*/
else if (strcmp (pspec->name, "caps") == 0) {
/* check if we're getting it from fakesink */
if (GST_IS_PAD (origin) && GST_PAD_PARENT (origin) == priv->fakesink) {
GST_DEBUG ("have caps on fakesink pad !");
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->format = g_value_peek_pointer (&value);
GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format);
} else
GST_DEBUG ("ignoring caps on object %s:%s",
gst_object_get_name (gst_object_get_parent (origin)),
gst_object_get_name (origin));
} else if (strcmp (pspec->name, "offset") == 0) {
/* we REALLY ignore offsets, we hate them */
}
//else GST_DEBUG ("ignoring notify of %s", pspec->name);
}
typedef struct
{
guint meta;
guint encoded;
}
TagFlagScore;
static void
tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data)
{
TagFlagScore *score = (TagFlagScore *) user_data;
GstTagFlag flag;
flag = gst_tag_get_flag (tag);
if (flag == GST_TAG_FLAG_META)
score->meta++;
if (flag == GST_TAG_FLAG_ENCODED)
score->encoded++;
}
void
found_tag_callback (GObject * pipeline, GstElement * source, GstTagList * tags,
GstMediaInfoPriv * priv)
{
TagFlagScore score;
score.meta = 0;
score.encoded = 0;
GST_DEBUG ("element %s found tag", GST_STR_NULL (GST_ELEMENT_NAME (source)));
/* decide if it's likely to be metadata or streaminfo */
/* FIXME: this is a hack, there must be a better way,
but as long as elements can report both mixed we need to do this */
gst_tag_list_foreach (tags, tag_flag_score, &score);
if (score.meta > score.encoded) {
GST_DEBUG ("found tags from decoder, adding them as metadata");
priv->metadata = gst_tag_list_copy (tags);
} else {
GST_DEBUG ("found tags, adding them as streaminfo");
priv->streaminfo = gst_tag_list_copy (tags);
}
}
void
error_callback (GObject * element, GstElement * source, GError * error,
gchar * debug, GstMediaInfoPriv * priv)
{
g_print ("ERROR: %s\n", error->message);
g_error_free (error);
}
/* helpers */
/* General GError creation */
static void
gst_media_info_error_create (GError ** error, const gchar * message)
{
/* check if caller wanted an error reported */
if (error == NULL)
return;
*error = g_error_new (GST_MEDIA_INFO_ERROR, 0, message);
return;
}
/* GError creation when element is missing */
static void
gst_media_info_error_element (const gchar * element, GError ** error)
{
gchar *message;
message = g_strdup_printf ("The %s element could not be found. "
"This element is essential for reading. "
"Please install the right plug-in and verify "
"that it works by running 'gst-inspect %s'", element, element);
gst_media_info_error_create (error, message);
g_free (message);
return;
}
/* initialise priv; done the first time */
gboolean
gmip_init (GstMediaInfoPriv * priv, GError ** error)
{
#define GST_MEDIA_INFO_MAKE_OR_ERROR(el, factory, name, error) \
G_STMT_START { \
el = gst_element_factory_make (factory, name); \
if (!GST_IS_ELEMENT (el)) \
{ \
gst_media_info_error_element (factory, error); \
return FALSE; \
} \
} G_STMT_END
/* create the typefind element and make sure it stays around by reffing */
GST_MEDIA_INFO_MAKE_OR_ERROR (priv->typefind, "typefind", "typefind", error);
gst_object_ref (GST_OBJECT (priv->typefind));
/* create the fakesink element and make sure it stays around by reffing */
GST_MEDIA_INFO_MAKE_OR_ERROR (priv->fakesink, "fakesink", "fakesink", error);
gst_object_ref (GST_OBJECT (priv->fakesink));
/* source element for media info reading */
priv->source = NULL;
priv->source_name = NULL;
return TRUE;
}
/* called at the beginning of each use cycle */
/* reset info to a state where it can be used to query for media info */
void
gmip_reset (GstMediaInfoPriv * priv)
{
#define STRING_RESET(string) \
G_STMT_START { \
if (string) g_free (string); \
string = NULL; \
} G_STMT_END
STRING_RESET (priv->pipeline_desc);
STRING_RESET (priv->location);
#undef STRING_RESET
#define CAPS_RESET(target) \
G_STMT_START { \
if (target) gst_caps_free (target); \
target = NULL; \
} G_STMT_END
CAPS_RESET (priv->type);
CAPS_RESET (priv->format);
#undef CAPS_RESET
#define TAGS_RESET(target) \
G_STMT_START { \
if (target) \
gst_tag_list_free (target); \
target = NULL; \
} G_STMT_END
TAGS_RESET (priv->metadata);
TAGS_RESET (priv->streaminfo);
#undef TAGS_RESET
if (priv->stream) {
gmi_stream_free (priv->stream);
priv->stream = NULL;
}
priv->flags = 0;
priv->state = GST_MEDIA_INFO_STATE_NULL;
priv->error = NULL;
}
/* seek to a track and reset metadata and streaminfo structs */
gboolean
gmi_seek_to_track (GstMediaInfo * info, long track)
{
GstEvent *event;
GstFormat track_format = 0;
GstMediaInfoPriv *priv = info->priv;
gboolean res;
/* FIXME: consider more nicks as "track" */
track_format = gst_format_get_by_nick ("logical_stream");
if (track_format == 0)
return FALSE;
GST_DEBUG ("Track format: %d", track_format);
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE)
g_warning ("Couldn't set to play");
g_assert (GST_IS_PAD (info->priv->decoder_pad));
event = gst_event_new_seek (track_format |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, track);
res = gst_pad_send_event (info->priv->decoder_pad, event);
if (!res) {
g_warning ("seek to logical track on pad %s:%s failed",
GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
return FALSE;
}
/* clear structs because of the seek */
if (priv->metadata) {
gst_tag_list_free (priv->metadata);
priv->metadata = NULL;
}
if (priv->streaminfo) {
gst_tag_list_free (priv->streaminfo);
priv->streaminfo = NULL;
}
return TRUE;
}
/* set the mime type on the media info getter */
gboolean
gmi_set_mime (GstMediaInfo * info, const char *mime)
{
gchar *desc = NULL;
GError *error = NULL;
GstMediaInfoPriv *priv = info->priv;
/* FIXME: please figure out proper mp3 mimetypes */
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
desc =
g_strdup_printf
("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "audio/mpeg") == 0)
|| (strcmp (mime, "audio/x-mp3") == 0)
|| (strcmp (mime, "audio/mp3") == 0)
|| (strcmp (mime, "application/x-id3") == 0)
|| (strcmp (mime, "audio/x-id3") == 0))
desc =
g_strdup_printf
("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "application/x-flac") == 0)
|| (strcmp (mime, "audio/x-flac") == 0))
desc =
g_strdup_printf
("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if ((strcmp (mime, "audio/wav") == 0)
|| (strcmp (mime, "audio/x-wav") == 0))
desc =
g_strdup_printf
("%s name=source ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else if (strcmp (mime, "audio/x-mod") == 0
|| strcmp (mime, "audio/x-s3m") == 0 || strcmp (mime, "audio/x-xm") == 0
|| strcmp (mime, "audio/x-it") == 0)
desc =
g_strdup_printf
("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
priv->source_name);
else
return FALSE;
GST_DEBUG ("using description %s", desc);
priv->pipeline_desc = desc;
priv->pipeline = gst_parse_launch (desc, &error);
if (error) {
g_warning ("Error parsing pipeline description: %s\n", error->message);
g_error_free (error);
return FALSE;
}
/* get a bunch of elements from the bin */
priv->source = gst_bin_get_by_name (GST_BIN (priv->pipeline), "source");
if (!GST_IS_ELEMENT (priv->source))
g_error ("Could not create source element '%s'", priv->source_name);
g_assert (GST_IS_ELEMENT (priv->source));
g_object_set (G_OBJECT (priv->source), "location", priv->location, NULL);
priv->decoder = gst_bin_get_by_name (GST_BIN (priv->pipeline), "decoder");
g_assert (GST_IS_ELEMENT (priv->decoder));
priv->fakesink = gst_bin_get_by_name (GST_BIN (priv->pipeline), "sink");
g_assert (GST_IS_ELEMENT (priv->fakesink));
/* get the "source " source pad */
priv->source_pad = gst_element_get_pad (priv->source, "src");
g_assert (GST_IS_PAD (priv->source_pad));
/* get the "decoder" source pad */
priv->decoder_pad = gst_element_get_pad (priv->decoder, "src");
g_assert (GST_IS_PAD (priv->decoder_pad));
GST_DEBUG ("decoder pad: %s:%s",
gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->
decoder_pad))), gst_pad_get_name (priv->decoder_pad));
/* attach notify handler */
g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify",
G_CALLBACK (deep_notify_callback), info->priv);
g_signal_connect (G_OBJECT (info->priv->pipeline), "found-tag",
G_CALLBACK (found_tag_callback), info->priv);
g_signal_connect (G_OBJECT (info->priv->pipeline), "error",
G_CALLBACK (error_callback), info->priv);
return TRUE;
}
/* clear the decoding pipeline */
void
gmi_clear_decoder (GstMediaInfo * info)
{
if (info->priv->pipeline) {
GST_DEBUG ("Unreffing pipeline");
gst_object_unref (GST_OBJECT (info->priv->pipeline));
}
info->priv->pipeline = NULL;
}
/****
* typefind functions
* find the type of a file and store it in the caps of the info
* FIXME: we might better return GstCaps instead of storing them
* internally */
/* prepare for typefind, move from NULL to TYPEFIND */
gboolean
gmip_find_type_pre (GstMediaInfoPriv * priv, GError ** error)
{
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
GST_DEBUG ("gmip_find_type_pre: start");
/* find out type */
/* FIXME: we could move caps for typefind out of struct and
* just use it through this function only */
priv->pipeline = gst_pipeline_new ("pipeline-typefind");
if (!GST_IS_PIPELINE (priv->pipeline)) {
gst_media_info_error_create (error, "Internal GStreamer error.");
return FALSE;
}
gst_bin_add (GST_BIN (priv->pipeline), priv->typefind);
GST_MEDIA_INFO_MAKE_OR_ERROR (priv->source, priv->source_name, "source",
error);
g_object_set (G_OBJECT (priv->source), "location", priv->location, NULL);
gst_bin_add (GST_BIN (priv->pipeline), priv->source);
if (!gst_element_link (priv->source, priv->typefind))
g_warning ("Couldn't connect source and typefind\n");
g_signal_connect (G_OBJECT (priv->typefind), "have-type",
G_CALLBACK (have_type_callback), priv);
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
GST_DEBUG ("moving to STATE_TYPEFIND\n");
priv->state = GST_MEDIA_INFO_STATE_TYPEFIND;
return TRUE;
}
/* finish off typefind */
gboolean
gmip_find_type_post (GstMediaInfoPriv * priv)
{
/*clear up typefind */
gst_element_set_state (priv->pipeline, GST_STATE_READY);
if (priv->decontainer) {
gst_element_unlink (priv->source, priv->decontainer);
gst_element_unlink (priv->decontainer, priv->typefind);
gst_bin_remove (GST_BIN (priv->pipeline), priv->decontainer);
} else {
gst_element_unlink (priv->source, priv->typefind);
}
gst_bin_remove (GST_BIN (priv->pipeline), priv->typefind);
if (priv->type == NULL) {
g_warning ("iteration ended, type not found !\n");
return FALSE;
}
GST_DEBUG ("moving to STATE_STREAM\n");
priv->state = GST_MEDIA_INFO_STATE_STREAM;
return TRUE;
}
/* complete version */
gboolean
gmip_find_type (GstMediaInfoPriv * priv, GError ** error)
{
if (!gmip_find_type_pre (priv, error))
return FALSE;
GST_DEBUG ("gmip_find_type: iterating");
while ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
return gmip_find_type_post (priv);
}
/* FIXME: why not have these functions work on priv types ? */
gboolean
gmip_find_stream_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
priv->state = GST_MEDIA_INFO_STATE_STREAM;
return TRUE;
}
gboolean
gmip_find_stream_post (GstMediaInfoPriv * priv)
{
GstMediaInfoStream *stream = priv->stream;
const GstFormat *formats;
GstFormat track_format = 0;
GstFormat format;
gint64 value;
gboolean res;
glong bytes = 0;
GST_DEBUG ("gmip_find_stream_post: start");
/* find a format that matches the "track" concept */
/* FIXME: this is used in vorbis, but we might have to loop when
* more codecs have tracks */
track_format = gst_format_get_by_nick ("logical_stream");
/* get supported formats on decoder pad */
formats = gst_pad_get_formats (priv->decoder_pad);
while (*formats) {
const GstFormatDefinition *definition;
format = *formats;
g_assert (GST_IS_PAD (priv->decoder_pad));
definition = gst_format_get_details (*formats);
GST_DEBUG ("trying to figure out length for format %s", definition->nick);
res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL, &format, &value);
if (res) {
switch (format) {
case GST_FORMAT_TIME:
stream->length_time = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
break;
default:
/* separation is necessary because track_format doesn't resolve to
* int */
if (format == track_format) {
stream->length_tracks = value;
GST_DEBUG (" total %s: %lld", definition->nick, value);
} else
GST_DEBUG ("unhandled format %s", definition->nick);
}
} else
GST_DEBUG ("query didn't return result for %s", definition->nick);
formats++;
}
if (stream->length_tracks == 0)
stream->length_tracks = 1;
/* now get number of bytes from the sink pad to get the bitrate */
format = GST_FORMAT_BYTES;
g_assert (GST_IS_PAD (priv->source_pad));
res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL, &format, &value);
if (!res)
g_warning ("Failed to query on sink pad !");
bytes = value;
GST_DEBUG ("bitrate calc: bytes gotten: %ld", bytes);
if (bytes) {
double seconds = (double) stream->length_time / GST_SECOND;
double bits = bytes * 8;
stream->bitrate = (long) (bits / seconds);
}
GST_DEBUG ("moving to STATE_METADATA\n");
priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */
return TRUE;
}
/* get properties of complete physical stream
* and return them in pre-alloced stream struct in priv->stream */
gboolean
gmip_find_stream (GstMediaInfoPriv * priv)
{
GST_DEBUG ("mip_find_stream start");
gmip_find_stream_pre (priv);
/* iterate until caps are found */
/* FIXME: this should be done through the plugin sending some signal
* that it is ready for queries */
while (gst_bin_iterate (GST_BIN (priv->pipeline)) && priv->format == NULL);
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
== GST_STATE_FAILURE)
g_warning ("Couldn't set to paused");
if (priv->format == NULL) {
GMI_DEBUG ("gmip_find_stream: couldn't get caps !");
return FALSE;
}
return gmip_find_stream_post (priv);
}
/* find metadata encoded in media and store in priv->metadata */
gboolean
gmip_find_track_metadata_pre (GstMediaInfoPriv * priv)
{
/* FIXME: this is a hack to set max allowed iterations for metadata
* querying - we should make gst smarter by itself instead */
priv->metadata_iters = 0;
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
return TRUE;
}
gboolean
gmip_find_track_metadata_post (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
== GST_STATE_FAILURE)
return FALSE;
priv->current_track->metadata = priv->metadata;
priv->metadata = NULL;
return TRUE;
}
gboolean
gmip_find_track_metadata (GstMediaInfoPriv * priv)
{
gmip_find_track_metadata_pre (priv);
GST_DEBUG ("gmip_find_metadata: iterating");
while ((priv->metadata == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_metadata_post (priv);
return TRUE;
}
/* find streaminfo found by decoder and store in priv->streaminfo */
/* FIXME: this is an exact copy, so reuse this function instead */
gboolean
gmip_find_track_streaminfo_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
return TRUE;
}
gboolean
gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv)
{
GstFormat format, track_format;
gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
/* now add total length to this, and maybe even bitrate ? FIXME */
track_format = gst_format_get_by_nick ("logical_stream");
if (track_format == 0) {
g_print ("FIXME: implement getting length of whole track\n");
} else {
/* which one are we at ? */
long track_num;
gint64 value_start, value_end;
gboolean res;
res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION,
&track_format, &value_start);
if (res) {
format = GST_FORMAT_TIME;
track_num = value_start;
GST_DEBUG ("we are currently at %ld", track_num);
res = gst_pad_convert (priv->decoder_pad,
track_format, track_num, &format, &value_start);
res &= gst_pad_convert (priv->decoder_pad,
track_format, track_num + 1, &format, &value_end);
if (res) {
/* substract to get the length */
GST_DEBUG ("start %lld, end %lld", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE,
GST_TAG_DURATION, (int) (value_end / 1E6), NULL);
}
}
}
priv->current_track->streaminfo = priv->streaminfo;
priv->streaminfo = NULL;
return TRUE;
}
gboolean
gmip_find_track_streaminfo (GstMediaInfoPriv * priv)
{
gmip_find_track_streaminfo_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_streaminfo: iterating");
while ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_streaminfo_post (priv);
return TRUE;
}
/* find format found by decoder and store in priv->format */
gboolean
gmip_find_track_format_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
return TRUE;
}
gboolean
gmip_find_track_format_post (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
== GST_STATE_FAILURE)
return FALSE;
priv->current_track->format = priv->format;
priv->format = NULL;
return TRUE;
}
gboolean
gmip_find_track_format (GstMediaInfoPriv * priv)
{
gmip_find_track_format_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_format: iterating");
while ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_format_post (priv);
return TRUE;
}

View file

@ -1,159 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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.
*/
/* media-info-priv.h: private stuff */
#ifndef __GST_MEDIA_INFO_PRIV_H__
#define __GST_MEDIA_INFO_PRIV_H__
#include <gst/gst.h>
#include <glib/gprintf.h>
G_BEGIN_DECLS
/* debug */
GST_DEBUG_CATEGORY_EXTERN (gst_media_info_debug);
#define GST_CAT_DEFAULT gst_media_info_debug
//#define DEBUG
#ifdef DEBUG
static gboolean _gmi_debug = TRUE;
#else
static gboolean _gmi_debug = FALSE;
#endif
#ifdef G_HAVE_ISO_VARARGS
#define GMI_DEBUG(...) \
{ if (_gmi_debug) { g_print ( __VA_ARGS__ ); }}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GMI_DEBUG(format, args...) \
{ if (_gmi_debug) { g_print ( format , ## args ); }}
#else
static inline void
GMI_DEBUG (const char *format, ...)
{
va_list varargs;
if (_gmi_debug) {
va_start (varargs, format);
g_vprintf ( format, varargs);
va_end (varargs);
}
}
#endif
/* state machine enum; FIXME: can we move this to priv.c ? */
typedef enum
{
GST_MEDIA_INFO_STATE_NULL,
GST_MEDIA_INFO_STATE_TYPEFIND,
GST_MEDIA_INFO_STATE_STREAM,
GST_MEDIA_INFO_STATE_METADATA,
GST_MEDIA_INFO_STATE_STREAMINFO,
GST_MEDIA_INFO_STATE_FORMAT,
GST_MEDIA_INFO_STATE_DONE
} GstMediaInfoState;
/* private structure */
struct GstMediaInfoPriv
{
GstElement *typefind;
GstCaps *type;
GstCaps *format;
GstTagList *metadata;
gint metadata_iters;
GstTagList *streaminfo;
GstElement *pipeline; /* will be != NULL during collection */
gchar *pipeline_desc; /* will be != NULL during collection */
GstElement *fakesink; /* so we can get caps from the
decoder sink pad */
gchar *source_name; /* type of element used as source */
GstElement *source;
GstPad *source_pad; /* pad for querying encoded caps */
GstElement *decoder;
GstPad *decoder_pad; /* pad for querying decoded caps */
GstElement *decontainer; /* element to typefind in containers */
GstMediaInfoState state; /* current state of state machine */
gchar *location; /* location set on the info object */
guint16 flags; /* flags supplied for detection */
GstMediaInfoTrack *current_track; /* track pointer under inspection */
glong current_track_num; /* current track under inspection */
GstMediaInfoStream *stream; /* total stream properties */
char *cache; /* location of cache */
GError *error; /* error for creation problems */
};
/* declarations */
GstMediaInfoStream *
gmi_stream_new (void);
void gmi_stream_free (GstMediaInfoStream *stream);
GstMediaInfoTrack *
gmi_track_new (void);
void gmip_reset (GstMediaInfoPriv *priv);
gboolean gmip_init (GstMediaInfoPriv *priv, GError **error);
void gmi_clear_decoder (GstMediaInfo *info);
gboolean gmi_seek_to_track (GstMediaInfo *info,
long track);
gboolean gmi_set_mime (GstMediaInfo *info,
const char *mime);
void deep_notify_callback (GObject *object,
GstObject *origin,
GParamSpec *pspec,
GstMediaInfoPriv *priv);
void found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, GstMediaInfoPriv *priv);
void error_callback (GObject *element, GstElement *source, GError *error, gchar *debug, GstMediaInfoPriv *priv);
gboolean gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error);
gboolean gmip_find_type_post (GstMediaInfoPriv *priv);
gboolean gmip_find_type (GstMediaInfoPriv *priv, GError **error);
gboolean gmip_find_stream_pre (GstMediaInfoPriv *priv);
gboolean gmip_find_stream_post (GstMediaInfoPriv *priv);
gboolean gmip_find_stream (GstMediaInfoPriv *priv);
gboolean gmip_find_track_metadata_pre (GstMediaInfoPriv *priv);
gboolean gmip_find_track_metadata_post (GstMediaInfoPriv *priv);
gboolean gmip_find_track_metadata (GstMediaInfoPriv *priv);
gboolean gmip_find_track_streaminfo_pre (GstMediaInfoPriv *priv);
gboolean gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv);
gboolean gmip_find_track_streaminfo (GstMediaInfoPriv *priv);
gboolean gmip_find_track_format_pre (GstMediaInfoPriv *priv);
gboolean gmip_find_track_format_post (GstMediaInfoPriv *priv);
gboolean gmip_find_track_format (GstMediaInfoPriv *priv);
G_END_DECLS
#endif /* __GST_MEDIA_INFO_PRIV_H__ */

View file

@ -1,120 +0,0 @@
/* media-info test app */
#include <gst/gst.h>
#include <string.h>
#include "media-info.h"
static void
print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
{
gint i, count;
count = gst_tag_list_get_tag_size (list, tag);
for (i = 0; i < count; i++) {
gchar *str;
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
if (!gst_tag_list_get_string_index (list, tag, i, &str))
g_assert_not_reached ();
} else {
str =
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
if (i == 0) {
g_print ("%15s: %s\n", gst_tag_get_nick (tag), str);
} else {
g_print (" : %s\n", str);
}
g_free (str);
}
}
static void
info_print (GstMediaInfoStream * stream)
{
int i;
GList *p;
GstMediaInfoTrack *track;
g_print ("- mime type: %s\n", stream->mime);
g_print ("- length: %.3f seconds\n",
(gdouble) stream->length_time / GST_SECOND);
g_print ("- bitrate: %.3f kbps\n", stream->bitrate / 1000.0);
g_print ("- number of tracks: %ld\n", stream->length_tracks);
p = stream->tracks;
if (p == NULL) {
g_print ("- no track information, probably an error\n");
return;
}
for (i = 0; i < stream->length_tracks; ++i) {
g_print ("- track %d\n", i);
track = (GstMediaInfoTrack *) p->data;
g_print (" - metadata:\n");
if (track->metadata)
gst_tag_list_foreach (track->metadata, print_tag, NULL);
else
g_print (" (none found)\n");
g_print (" - streaminfo:\n");
gst_tag_list_foreach (track->streaminfo, print_tag, NULL);
g_print (" - format:\n");
g_print ("%s\n", gst_caps_to_string (track->format));
p = p->next;
}
}
int
main (int argc, char *argv[])
{
GstMediaInfo *info;
GstMediaInfoStream *stream = NULL;
GError *error = NULL;
gint i;
g_assert (argc > 1);
gst_media_info_init ();
gst_init (&argc, &argv);
info = gst_media_info_new (&error);
if (error != NULL) {
g_print ("Error creating media-info object: %s\n", error->message);
g_error_free (error);
return -1;
}
g_assert (G_IS_OBJECT (info));
if (!gst_media_info_set_source (info, "gnomevfssrc", &error)) {
g_print ("Could not set gnomevfssrc as a source\n");
g_print ("reason: %s\n", error->message);
g_error_free (error);
return -1;
}
g_print ("stream: %p, &stream: %p\n", stream, &stream);
for (i = 1; i < argc; ++i) {
/*
stream = gst_media_info_read (info, argv[i], GST_MEDIA_INFO_ALL);
*/
gst_media_info_read_with_idler (info, argv[i], GST_MEDIA_INFO_ALL, &error);
while (gst_media_info_read_idler (info, &stream, &error) && stream == NULL)
/* keep idling */
g_print ("+");
g_print ("\nFILE: %s\n", argv[i]);
g_print ("stream: %p, &stream: %p\n", stream, &stream);
if (error) {
g_print ("Error reading media info: %s\n", error->message);
g_error_free (error);
}
if (stream)
info_print (stream);
else
g_print ("no media info found.\n");
stream = NULL;
}
return 0;
}

View file

@ -1,428 +0,0 @@
/* GStreamer media-info library
* Copyright (C) 2003,2004 Thomas Vander Stichele <thomas@apestaart.org>
*
* 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 <gst/gst.h>
#include <string.h>
#include "media-info.h"
#include "media-info-priv.h"
static void gst_media_info_class_init (GstMediaInfoClass * klass);
static void gst_media_info_instance_init (GstMediaInfo * info);
static void gst_media_info_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean _media_info_inited = FALSE;
/* FIXME: this is a lousy hack that needs to go */
#define MAX_METADATA_ITERS 5
/* GObject-y bits */
/* signal stuff */
enum
{
MEDIA_INFO_SIGNAL,
LAST_SIGNAL
};
static guint gst_media_info_signals[LAST_SIGNAL] = { 0 };
/*
* all GError stuff
*/
enum
{
MEDIA_INFO_ERROR_FILE
};
/* GError quark stuff */
GQuark
gst_media_info_error_quark (void)
{
static GQuark quark = 0;
if (quark == 0)
quark = g_quark_from_static_string ("gst-media-info-error-quark");
return quark;
}
/*
* GObject type stuff
*/
enum
{
PROP_SOURCE
};
static GObjectClass *parent_class = NULL;
GST_DEBUG_CATEGORY (gst_media_info_debug);
/* initialize the media-info library */
void
gst_media_info_init (void)
{
if (_media_info_inited)
return;
/* register our debugging category */
GST_DEBUG_CATEGORY_INIT (gst_media_info_debug, "GST_MEDIA_INFO", 0,
"GStreamer media-info library");
GST_DEBUG ("Initialized media-info library");
_media_info_inited = TRUE;
}
GType
gst_media_info_get_type (void)
{
static GType gst_media_info_type = 0;
if (!gst_media_info_type) {
static const GTypeInfo gst_media_info_info = {
sizeof (GstMediaInfoClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gst_media_info_class_init,
NULL, NULL,
sizeof (GstMediaInfo),
0,
(GInstanceInitFunc) gst_media_info_instance_init,
NULL
};
gst_media_info_type = g_type_register_static (G_TYPE_OBJECT,
"GstMediaInfo", &gst_media_info_info, 0);
}
return gst_media_info_type;
}
static void
gst_media_info_class_init (GstMediaInfoClass * klass)
{
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
//parent_class = g_type_class_peek_parent (klass);
/*
object_class->finalize = gst_media_info_finalize;
object_class->dispose = gst_media_info_dispose;
*/
/*
g_object_class->set_property = gst_media_info_set_property;
*/
g_object_class->get_property = gst_media_info_get_property;
klass->media_info_signal = NULL;
gst_media_info_signals[MEDIA_INFO_SIGNAL] =
g_signal_new ("media-info",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMediaInfoClass, media_info_signal),
NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void
gst_media_info_instance_init (GstMediaInfo * info)
{
GError **error;
info->priv = g_new0 (GstMediaInfoPriv, 1);
error = &info->priv->error;
if (!_media_info_inited) {
gst_media_info_init ();
}
gmip_init (info->priv, error);
gmip_reset (info->priv);
}
/* get/set */
static void
gst_media_info_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstMediaInfo *info = GST_MEDIA_INFO (object);
switch (prop_id) {
case PROP_SOURCE:
g_value_set_string (value, info->priv->source_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
GstMediaInfo *
gst_media_info_new (GError ** error)
{
GstMediaInfo *info = g_object_new (GST_MEDIA_INFO_TYPE, NULL);
if (info->priv->error) {
if (error) {
*error = info->priv->error;
info->priv->error = NULL;
} else {
g_warning ("Error creating GstMediaInfo object.\n%s",
info->priv->error->message);
g_error_free (info->priv->error);
}
}
return info;
}
/**
* public methods
*/
gboolean
gst_media_info_set_source (GstMediaInfo * info, const char *source,
GError ** error)
{
info->priv->source_name = g_strdup (source);
return TRUE;
}
/* idler-based implementation
* set up read on a given location
* FIXME: maybe we should check if the info is cleared when calling this
* function ? What happens if it gets called again on same info before
* previous one is done ?
*/
void
gst_media_info_read_with_idler (GstMediaInfo * info, const char *location,
guint16 flags, GError ** error)
{
GstMediaInfoPriv *priv = info->priv;
gmip_reset (info->priv); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
}
/* an idler which does the work of actually collecting all data
* this must be called repeatedly, until streamp is set to a non-NULL value
* returns: TRUE if it was able to idle, FALSE if there was an error
*/
gboolean
gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
GError ** error)
{
GstMediaInfoPriv *priv;
/* if it's NULL then we're sure something went wrong higher up) */
if (info == NULL)
return FALSE;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = info->priv;
g_assert (streamp != NULL);
g_assert (priv);
switch (priv->state) {
case GST_MEDIA_INFO_STATE_NULL:
/* make sure we have a source */
if (!priv->source_name) {
*error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
"No source set on media info.");
return FALSE;
}
/* need to find type */
GST_DEBUG ("idler: NULL, need to find type, priv %p", priv);
return gmip_find_type_pre (priv, error);
case GST_MEDIA_INFO_STATE_TYPEFIND:
{
gchar *mime;
GST_LOG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GST_DEBUG ("iterating while in STATE_TYPEFIND");
GMI_DEBUG ("?");
return TRUE;
}
if (priv->type == NULL) {
g_warning ("Couldn't find type\n");
return FALSE;
}
/* do the state transition */
GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv);
GST_DEBUG ("finding out mime type");
mime =
g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
0)));
GST_DEBUG ("found out mime type: %s", mime);
if (!gmi_set_mime (info, mime)) {
/* FIXME: pop up error */
GST_DEBUG ("no decoder pipeline found for mime %s", mime);
return FALSE;
}
priv->stream = gmi_stream_new ();
GST_DEBUG ("new stream: %p", priv->stream);
priv->stream->mime = mime;
priv->stream->path = priv->location;
gmip_find_stream_pre (priv);
}
case GST_MEDIA_INFO_STATE_STREAM:
{
GST_LOG ("STATE_STREAM");
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
}
if (priv->format == NULL) {
g_warning ("Couldn't find format\n");
return FALSE;
}
/* do state transition; stream -> first track metadata */
priv->current_track_num = 0;
gmip_find_stream_post (priv);
priv->current_track = gmi_track_new ();
gmip_find_track_metadata_pre (priv);
return TRUE;
}
/* these ones are repeated per track */
case GST_MEDIA_INFO_STATE_METADATA:
{
if ((priv->metadata == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)) &&
priv->metadata_iters < MAX_METADATA_ITERS) {
GMI_DEBUG ("?");
priv->metadata_iters++;
return TRUE;
}
if (priv->metadata_iters == MAX_METADATA_ITERS)
g_print ("iterated a few times, didn't find metadata\n");
if (priv->metadata == NULL) {
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find metadata");
}
GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
if (!gmip_find_track_metadata_post (priv))
return FALSE;
GST_DEBUG ("METADATA: going to STREAMINFO\n");
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv);
}
case GST_MEDIA_INFO_STATE_STREAMINFO:
{
if ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
}
if (priv->streaminfo == NULL) {
/* this is not a permanent failure */
GST_DEBUG ("Couldn't find streaminfo");
} else
GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
if (!gmip_find_track_streaminfo_post (priv))
return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv);
}
case GST_MEDIA_INFO_STATE_FORMAT:
{
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GMI_DEBUG ("?");
return TRUE;
}
if (priv->format == NULL) {
g_warning ("Couldn't find format\n");
return FALSE;
}
GST_DEBUG ("found format of track %ld", priv->current_track_num);
if (!gmip_find_track_format_post (priv))
return FALSE;
/* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks,
priv->current_track);
/* these alloc'd data types have been handed off */
priv->current_track = NULL;
priv->location = NULL;
/* now see if we need to seek to a next track or not */
priv->current_track_num++;
if (priv->current_track_num < priv->stream->length_tracks) {
gmi_seek_to_track (info, priv->current_track_num);
priv->current_track = gmi_track_new ();
if (!gmip_find_track_metadata_pre (priv)) {
g_free (priv->current_track);
return FALSE;
}
priv->state = GST_MEDIA_INFO_STATE_METADATA;
return TRUE;
}
priv->state = GST_MEDIA_INFO_STATE_DONE;
gmi_clear_decoder (info);
GST_DEBUG ("TOTALLY DONE, setting pointer *streamp to %p", *streamp);
*streamp = priv->stream;
priv->stream = NULL;
return TRUE;
}
case GST_MEDIA_INFO_STATE_DONE:
return TRUE;
default:
g_warning ("don't know what to do\n");
return FALSE;
}
}
/* main function
* read all possible info from the file pointed to by location
* use flags to limit the type of information searched for */
GstMediaInfoStream *
gst_media_info_read (GstMediaInfo * info, const char *location, guint16 flags,
GError ** error)
{
GstMediaInfoStream *stream = NULL;
gst_media_info_read_with_idler (info, location, flags, error);
if (*error)
return FALSE;
while (gst_media_info_read_idler (info, &stream, error) && stream == NULL)
/* keep looping */ ;
if (*error)
return NULL;
return stream;
}
/*
* FIXME: reset ?
gboolean gst_media_info_write (GstMediaInfo *media_info,
const char *location,
GstCaps *media_info);
*/

View file

@ -1,140 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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_MEDIA_INFO_H__
#define __GST_MEDIA_INFO_H__
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct GstMediaInfoPriv GstMediaInfoPriv;
typedef struct _GstMediaInfo GstMediaInfo;
typedef struct _GstMediaInfoClass GstMediaInfoClass;
struct _GstMediaInfo
{
GObject parent;
GstMediaInfoPriv *priv;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstMediaInfoClass
{
GObjectClass parent_class;
/* signals */
void (*media_info_signal) (GstMediaInfo *gst_media_info);
void (*error_signal) (GstMediaInfo *gst_media_info, GError *error, const gchar *debug);
gpointer _gst_reserved[GST_PADDING];
};
/* structure for "physical" stream,
* which can contain multiple sequential ones */
typedef struct
{
gboolean seekable;
gchar *mime;
gchar *path;
GstCaps *caps; /* properties of the complete bitstream */
guint64 length_time;
glong length_tracks;
glong bitrate;
GList *tracks;
} GstMediaInfoStream;
/* structure for "logical" stream or track,
* or one of a set of sequentially muxed streams */
typedef struct
{
GstTagList *metadata; /* changeable metadata or tags */
GstTagList *streaminfo; /* codec property stuff */
GstCaps *format; /* properties of the logical stream */
guint64 length_time;
GList *con_streams; /* list of concurrent streams in this
sequential stream */
} GstMediaInfoTrack;
typedef struct
{
GstCaps *caps; /* properties of the muxed concurrent stream */
} GstMediaInfoConcurrent;
#define GST_MEDIA_INFO_ERROR gst_media_info_error_quark ()
#define GST_MEDIA_INFO_TYPE (gst_media_info_get_type ())
#define GST_MEDIA_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_MEDIA_INFO_TYPE, GstMediaInfo))
#define GST_MEDIA_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_MEDIA_INFO_TYPE, GstMediaInfoClass))
#define IS_GST_MEDIA_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_MEDIA_INFO_TYPE))
#define IS_GST_MEDIA_INFO_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_MEDIA_INFO_TYPE))
#define GST_MEDIA_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_MEDIA_INFO_TYPE, GstMediaInfoClass))
#define GST_MEDIA_INFO_STREAM 1 << 1
#define GST_MEDIA_INFO_MIME 1 << 2
#define GST_MEDIA_INFO_METADATA 1 << 3
#define GST_MEDIA_INFO_STREAMINFO 1 << 4
#define GST_MEDIA_INFO_FORMAT 1 << 5
#define GST_MEDIA_INFO_ALL ((1 << 6) - 1)
GQuark gst_media_info_error_quark (void);
void gst_media_info_init (void);
GType gst_media_info_get_type (void);
GstMediaInfo * gst_media_info_new (GError **error);
gboolean gst_media_info_set_source (GstMediaInfo *info,
const char *source,
GError **error);
void gst_media_info_read_with_idler (GstMediaInfo *media_info,
const char *location,
guint16 GST_MEDIA_INFO_FLAGS,
GError **error);
gboolean gst_media_info_read_idler (GstMediaInfo *media_info,
GstMediaInfoStream **streamp,
GError **error);
GstMediaInfoStream *
gst_media_info_read (GstMediaInfo *media_info,
const char *location,
guint16 GST_MEDIA_INFO_FLAGS,
GError **error);
gboolean gst_media_info_read_many (GstMediaInfo *media_info,
GList *locations,
guint16 GST_MEDIA_INFO_FLAGS,
GError **error);
GstCaps * gst_media_info_get_next (GstMediaInfo *media_info,
GError **error);
/*
* FIXME: reset ?
gboolean gst_media_info_write (GstMediaInfo *media_info,
const char *location,
GstCaps *media_info);
*/
G_END_DECLS
#endif /* __GST_MEDIA_INFO_H__ */

View file

@ -1,150 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="media-info"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67896}"
RootNamespace="media-info"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmedia-info.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/media-info.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstmedia-info.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmedia-info.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstmedia-info.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\media-info-priv.c">
</File>
<File
RelativePath=".\media-info.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\media-info-priv.h">
</File>
<File
RelativePath=".\media-info.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,49 +0,0 @@
# variables used for enum/marshal generation
glib_enum_headers=$(mixer_headers)
glib_enum_define=GST_MIXER
glib_enum_prefix=gst_mixer
libgstmixerincludedir = \
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/mixer
mixer_headers = \
mixer.h \
mixeroptions.h \
mixertrack.h
built_sources = \
mixer-marshal.c \
mixer-enumtypes.c
built_headers = \
mixer-marshal.h \
mixer-enumtypes.h
libgstmixerinclude_HEADERS = \
$(mixer_headers)
nodist_libgstmixerinclude_HEADERS = \
mixer-enumtypes.h
noinst_LTLIBRARIES = libgstmixer.la
libgstmixer_la_SOURCES = \
mixer.c \
mixeroptions.c \
mixertrack.c
nodist_libgstmixer_la_SOURCES = \
$(built_sources)
libgstmixer_la_CFLAGS = $(GST_CFLAGS)
BUILT_SOURCES = \
$(built_sources) \
$(built_headers)
EXTRA_DIST = mixer-marshal.list
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/glib-gen.mak

View file

@ -1,3 +0,0 @@
VOID:OBJECT,BOOLEAN
VOID:OBJECT,POINTER
VOID:OBJECT,STRING

View file

@ -1,317 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixer.c: mixer design virtual class function wrappers
*
* 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 "mixer.h"
#include "mixer-marshal.h"
enum
{
SIGNAL_MUTE_TOGGLED,
SIGNAL_RECORD_TOGGLED,
SIGNAL_VOLUME_CHANGED,
SIGNAL_OPTION_CHANGED,
LAST_SIGNAL
};
static void gst_mixer_class_init (GstMixerClass * klass);
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
GType
gst_mixer_get_type (void)
{
static GType gst_mixer_type = 0;
if (!gst_mixer_type) {
static const GTypeInfo gst_mixer_info = {
sizeof (GstMixerClass),
(GBaseInitFunc) gst_mixer_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
"GstMixer", &gst_mixer_info, 0);
g_type_interface_add_prerequisite (gst_mixer_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_mixer_type;
}
static void
gst_mixer_class_init (GstMixerClass * klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_mixer_signals[SIGNAL_RECORD_TOGGLED] =
g_signal_new ("record-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, record_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[SIGNAL_MUTE_TOGGLED] =
g_signal_new ("mute-toggled",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[SIGNAL_VOLUME_CHANGED] =
g_signal_new ("volume-changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, volume_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
gst_mixer_signals[SIGNAL_OPTION_CHANGED] =
g_signal_new ("option-changed",
GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerClass, option_changed),
NULL, NULL,
gst_mixer_marshal_VOID__OBJECT_STRING, G_TYPE_NONE, 2,
GST_TYPE_MIXER_OPTIONS, G_TYPE_STRING);
initialized = TRUE;
}
klass->mixer_type = GST_MIXER_SOFTWARE;
/* default virtual functions */
klass->list_tracks = NULL;
klass->set_volume = NULL;
klass->get_volume = NULL;
klass->set_mute = NULL;
klass->set_record = NULL;
klass->set_option = NULL;
klass->get_option = NULL;
}
/**
* gst_mixer_list_tracks:
* @mixer: the #GstMixer (a #GstElement) to get the tracks from.
*
* Returns a list of available tracks for this mixer/element. Note
* that it is allowed for sink (output) elements to only provide
* the output tracks in this list. Likewise, for sources (inputs),
* it is allowed to only provide input elements in this list.
*
* Returns: A #GList consisting of zero or more #GstMixerTracks.
*/
const GList *
gst_mixer_list_tracks (GstMixer * mixer)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->list_tracks) {
return klass->list_tracks (mixer);
}
return NULL;
}
/**
* gst_mixer_set_volume:
* @mixer: The #GstMixer (a #GstElement) that owns the track.
* @track: The #GstMixerTrack to set the volume on.
* @volumes: an array of integers (of size track->num_channels)
* that gives the wanted volume for each channel in
* this track.
*
* Sets the volume on each channel in a track. Short note about
* naming: a track is defined as one separate stream owned by
* the mixer/element, such as 'Line-in' or 'Microphone'. A
* channel is said to be a mono-stream inside this track. A
* stereo track thus contains two channels.
*/
void
gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_volume) {
klass->set_volume (mixer, track, volumes);
}
}
/*
* gst_mixer_get_volume:
* @mixer: the #GstMixer (a #GstElement) that owns the track
* @track: the GstMixerTrack to get the volume from.
* @volumes: a pre-allocated array of integers (of size
* track->num_channels) to store the current volume
* of each channel in the given track in.
*
* Get the current volume(s) on the given track.
*/
void
gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->get_volume) {
klass->get_volume (mixer, track, volumes);
} else {
gint i;
for (i = 0; i < track->num_channels; i++) {
volumes[i] = 0;
}
}
}
/**
* gst_mixer_set_mute:
* @mixer: the #GstMixer (a #GstElement) that owns the track.
* @track: the #GstMixerTrack to operate on.
* @mute: a boolean value indicating whether to turn on or off
* muting.
*
* Mutes or unmutes the given channel. To find out whether a
* track is currently muted, use GST_MIXER_TRACK_HAS_FLAG ().
*/
void
gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_mute) {
klass->set_mute (mixer, track, mute);
}
}
/**
* gst_mixer_set_record:
* @mixer: The #GstMixer (a #GstElement) that owns the track.
* @track: the #GstMixerTrack to operate on.
* @record: a boolean value that indicates whether to turn on
* or off recording.
*
* Enables or disables recording on the given track. Note that
* this is only possible on input tracks, not on output tracks
* (see GST_MIXER_TRACK_HAS_FLAG () and the GST_MIXER_TRACK_INPUT
* flag).
*/
void
gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_record) {
klass->set_record (mixer, track, record);
}
}
/**
* gst_mixer_set_option:
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
* @opts: The #GstMixerOptions that we operate on.
* @value: The requested new option value.
*
* Sets a name/value option in the mixer to the requested value.
*/
void
gst_mixer_set_option (GstMixer * mixer, GstMixerOptions * opts, gchar * value)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->set_option) {
klass->set_option (mixer, opts, value);
}
}
/**
* gst_mixer_get_option:
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
* @opts: The #GstMixerOptions that we operate on.
*
* Get the current value of a name/value option in the mixer.
*
* Returns: current value of the name/value option.
*/
const gchar *
gst_mixer_get_option (GstMixer * mixer, GstMixerOptions * opts)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
if (klass->get_option) {
return klass->get_option (mixer, opts);
}
return NULL;
}
void
gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[SIGNAL_MUTE_TOGGLED], 0, track, mute);
g_signal_emit_by_name (G_OBJECT (track), "mute_toggled", mute);
}
void
gst_mixer_record_toggled (GstMixer * mixer,
GstMixerTrack * track, gboolean record)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[SIGNAL_RECORD_TOGGLED], 0, track, record);
g_signal_emit_by_name (G_OBJECT (track), "record_toggled", record);
}
void
gst_mixer_volume_changed (GstMixer * mixer,
GstMixerTrack * track, gint * volumes)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[SIGNAL_VOLUME_CHANGED], 0, track, volumes);
g_signal_emit_by_name (G_OBJECT (track), "volume_changed", volumes);
}
void
gst_mixer_option_changed (GstMixer * mixer,
GstMixerOptions * opts, gchar * value)
{
g_signal_emit (G_OBJECT (mixer),
gst_mixer_signals[SIGNAL_OPTION_CHANGED], 0, opts, value);
g_signal_emit_by_name (G_OBJECT (opts), "value_changed", value);
}

View file

@ -1,141 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixer.h: mixer interface design
*
* 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_MIXER_H__
#define __GST_MIXER_H__
#include <gst/gst.h>
#include <gst/mixer/mixeroptions.h>
#include <gst/mixer/mixertrack.h>
#include <gst/mixer/mixer-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
#define GST_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER, GstMixerClass))
#define GST_IS_MIXER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
#define GST_IS_MIXER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
#define GST_MIXER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
#define GST_MIXER_TYPE(klass) (klass->mixer_type)
typedef struct _GstMixer GstMixer;
typedef struct _GstMixerClass GstMixerClass;
typedef enum
{
GST_MIXER_HARDWARE,
GST_MIXER_SOFTWARE
} GstMixerType;
struct _GstMixerClass {
GTypeInterface klass;
GstMixerType mixer_type;
/* virtual functions */
const GList * (* list_tracks) (GstMixer *mixer);
void (* set_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* get_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* set_mute) (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void (* set_record) (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
/* signals */
void (* mute_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixer *mixer,
GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixer *mixer,
GstMixerTrack *channel,
gint *volumes);
/* use padding */
void (* set_option) (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * (* get_option) (GstMixer *mixer,
GstMixerOptions *opts);
void (* option_changed) (GstMixer *mixer,
GstMixerOptions *opts,
gchar *option);
gpointer _gst_reserved[GST_PADDING-3];
};
GType gst_mixer_get_type (void);
/* virtual class function wrappers */
const GList * gst_mixer_list_tracks (GstMixer *mixer);
void gst_mixer_set_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_get_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_set_mute (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_set_record (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_set_option (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * gst_mixer_get_option (GstMixer *mixer,
GstMixerOptions *opts);
/* trigger signals */
void gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_option_changed (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
G_END_DECLS
#endif /* __GST_MIXER_H__ */

View file

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="mixer"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67897}"
RootNamespace="mixer"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmixer.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="mixer.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/mixer.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstmixer.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstmixer.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="mixer.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstmixer.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\mixer.c">
</File>
<File
RelativePath=".\mixeroptions.c">
</File>
<File
RelativePath=".\mixertrack.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\mixer.h">
</File>
<File
RelativePath=".\mixeroptions.h">
</File>
<File
RelativePath=".\mixertrack.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,122 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixeroptions.c: mixer track options object design
*
* 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 "mixeroptions.h"
enum
{
/* FILL ME */
SIGNAL_OPTION_CHANGED,
LAST_SIGNAL
};
static void gst_mixer_options_class_init (GstMixerOptionsClass * klass);
static void gst_mixer_options_init (GstMixerOptions * mixer);
static void gst_mixer_options_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
gst_mixer_options_get_type (void)
{
static GType gst_mixer_options_type = 0;
if (!gst_mixer_options_type) {
static const GTypeInfo mixer_options_info = {
sizeof (GstMixerOptionsClass),
NULL,
NULL,
(GClassInitFunc) gst_mixer_options_class_init,
NULL,
NULL,
sizeof (GstMixerOptions),
0,
(GInstanceInitFunc) gst_mixer_options_init,
NULL
};
gst_mixer_options_type =
g_type_register_static (GST_TYPE_MIXER_TRACK,
"GstMixerOptions", &mixer_options_info, 0);
}
return gst_mixer_options_type;
}
static void
gst_mixer_options_class_init (GstMixerOptionsClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_MIXER_TRACK);
signals[SIGNAL_OPTION_CHANGED] =
g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
NULL, NULL, g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
object_klass->dispose = gst_mixer_options_dispose;
}
static void
gst_mixer_options_init (GstMixerOptions * mixer_options)
{
mixer_options->values = NULL;
}
/**
* gst_mixer_options_get_values:
* @mixer_optnios: The #GstMixerOptions item that owns the values.
*
* Get the values for the mixer option.
*
* Returns: A list of all the possible values for the mixer option.
*/
GList *
gst_mixer_options_get_values (GstMixerOptions * mixer_options)
{
if (!mixer_options->values)
return NULL;
return (GList *) mixer_options->values;
}
static void
gst_mixer_options_dispose (GObject * object)
{
GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
g_list_foreach (opts->values, (GFunc) g_free, NULL);
g_list_free (opts->values);
opts->values = NULL;
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,73 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixeroptions.h: mixer track options object
* This should be a subclass of MixerItem, along with MixerOptions,
* but that's not possible because of API/ABI in 0.8.x. FIXME.
*
* 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_MIXER_OPTIONS_H__
#define __GST_MIXER_OPTIONS_H__
#include <gst/gst.h>
#include <gst/mixer/mixertrack.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_OPTIONS \
(gst_mixer_options_get_type ())
#define GST_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptions))
#define GST_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptionsClass))
#define GST_IS_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_OPTIONS))
#define GST_IS_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_OPTIONS))
typedef struct _GstMixerOptions GstMixerOptions;
typedef struct _GstMixerOptionsClass GstMixerOptionsClass;
struct _GstMixerOptions {
GstMixerTrack parent;
/* list of strings */
GList *values;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstMixerOptionsClass {
GstMixerTrackClass parent;
/* signals */
void (* option_changed) (GstMixerOptions *opts,
gchar *value);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_options_get_type (void);
GList * gst_mixer_options_get_values (GstMixerOptions *mixer_options);
G_END_DECLS
#endif /* __GST_MIXER_OPTIONS_H__ */

View file

@ -1,193 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixertrack.c: mixer track object design
*
* 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 "mixertrack.h"
enum
{
/* FILL ME */
SIGNAL_VOLUME_CHANGED,
SIGNAL_RECORD_TOGGLED,
SIGNAL_MUTE_TOGGLED,
LAST_SIGNAL
};
enum
{
ARG_0,
ARG_LABEL,
ARG_MIN_VOLUME,
ARG_MAX_VOLUME,
ARG_FLAGS,
ARG_NUM_CHANNELS
};
static void gst_mixer_track_class_init (GstMixerTrackClass * klass);
static void gst_mixer_track_init (GstMixerTrack * mixer);
static void gst_mixer_track_dispose (GObject * object);
static void gst_mixer_track_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
gst_mixer_track_get_type (void)
{
static GType gst_mixer_track_type = 0;
if (!gst_mixer_track_type) {
static const GTypeInfo mixer_track_info = {
sizeof (GstMixerTrackClass),
NULL,
NULL,
(GClassInitFunc) gst_mixer_track_class_init,
NULL,
NULL,
sizeof (GstMixerTrack),
0,
(GInstanceInitFunc) gst_mixer_track_init,
NULL
};
gst_mixer_track_type =
g_type_register_static (G_TYPE_OBJECT,
"GstMixerTrack", &mixer_track_info, 0);
}
return gst_mixer_track_type;
}
static void
gst_mixer_track_class_init (GstMixerTrackClass * klass)
{
GObjectClass *object_klass = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_klass->get_property = gst_mixer_track_get_property;
g_object_class_install_property (object_klass, ARG_LABEL,
g_param_spec_string ("label", "Track label",
"The label assigned to the track", NULL, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_MIN_VOLUME,
g_param_spec_int ("min_volume", "Minimum volume level",
"The minimum possible volume level", G_MININT, G_MAXINT,
0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_MAX_VOLUME,
g_param_spec_int ("max_volume", "Maximum volume level",
"The maximum possible volume level", G_MININT, G_MAXINT,
0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_FLAGS,
g_param_spec_uint ("flags", "Flags",
"Flags indicating the type of mixer track",
0, G_MAXUINT, 0, G_PARAM_READABLE));
g_object_class_install_property (object_klass, ARG_NUM_CHANNELS,
g_param_spec_int ("num_channels", "Number of channels",
"The number of channels contained within the track",
0, G_MAXINT, 0, G_PARAM_READABLE));
signals[SIGNAL_RECORD_TOGGLED] =
g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
record_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_MUTE_TOGGLED] =
g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
mute_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_VOLUME_CHANGED] =
g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
volume_changed),
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
object_klass->dispose = gst_mixer_track_dispose;
}
static void
gst_mixer_track_init (GstMixerTrack * mixer_track)
{
mixer_track->label = NULL;
mixer_track->min_volume = mixer_track->max_volume = 0;
mixer_track->flags = 0;
mixer_track->num_channels = 0;
}
static void
gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMixerTrack *mixer_track;
mixer_track = GST_MIXER_TRACK (object);
switch (prop_id) {
case ARG_LABEL:
g_value_set_string (value, mixer_track->label);
break;
case ARG_MIN_VOLUME:
g_value_set_int (value, mixer_track->min_volume);
break;
case ARG_MAX_VOLUME:
g_value_set_int (value, mixer_track->max_volume);
break;
case ARG_FLAGS:
g_value_set_uint (value, (guint32) mixer_track->flags);
break;
case ARG_NUM_CHANNELS:
g_value_set_int (value, mixer_track->num_channels);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_mixer_track_dispose (GObject * object)
{
GstMixerTrack *channel = GST_MIXER_TRACK (object);
if (channel->label) {
g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,102 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixertrack.h: mixer track object
*
* 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_MIXER_TRACK_H__
#define __GST_MIXER_TRACK_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_TRACK \
(gst_mixer_track_get_type ())
#define GST_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_TRACK, \
GstMixerTrack))
#define GST_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_TRACK, \
GstMixerTrackClass))
#define GST_IS_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
#define GST_IS_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
/*
* Naming:
*
* A track is a single input/output stream (e.g. line-in,
* microphone, etc.). Channels are then single streams
* within a track. A mono stream has one channel, a stereo
* stream has two, etc.
*
* Input tracks can have 'recording' enabled, which means
* that any input will be hearable into the speakers that
* are attached to the output. Mute is obvious. A track
* flagged as master is the master volume track on this
* mixer, which means that setting this track will change
* the hearable volume on any output.
*/
typedef enum {
GST_MIXER_TRACK_INPUT = (1<<0),
GST_MIXER_TRACK_OUTPUT = (1<<1),
GST_MIXER_TRACK_MUTE = (1<<2),
GST_MIXER_TRACK_RECORD = (1<<3),
GST_MIXER_TRACK_MASTER = (1<<4),
GST_MIXER_TRACK_SOFTWARE = (1<<5)
} GstMixerTrackFlags;
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstMixerTrack GstMixerTrack;
typedef struct _GstMixerTrackClass GstMixerTrackClass;
struct _GstMixerTrack {
GObject parent;
gchar *label;
/* FIXME: flags should be guint32. Change in 0.9 */
GstMixerTrackFlags flags;
gint num_channels,
min_volume,
max_volume;
};
struct _GstMixerTrackClass {
GObjectClass parent;
/* signals */
void (* mute_toggled) (GstMixerTrack *channel,
gboolean mute);
void (* record_toggled) (GstMixerTrack *channel,
gboolean record);
void (* volume_changed) (GstMixerTrack *channel,
gint *volumes);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_track_get_type (void);
G_END_DECLS
#endif /* __GST_MIXER_TRACK_H__ */

View file

@ -1,8 +0,0 @@
noinst_LTLIBRARIES = libgstnavigation.la
libgstnavigation_la_SOURCES = navigation.c
libgstnavigationincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/navigation
libgstnavigationinclude_HEADERS = navigation.h
libgstnavigation_la_CFLAGS = $(GST_CFLAGS)

View file

@ -1,91 +0,0 @@
/* GStreamer Navigation
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* navigation.c: navigation design virtual class function wrappers
*
* 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 <gst/navigation/navigation.h>
static void gst_navigation_class_init (GstNavigationInterface * iface);
GType
gst_navigation_get_type (void)
{
static GType gst_navigation_type = 0;
if (!gst_navigation_type) {
static const GTypeInfo gst_navigation_info = {
sizeof (GstNavigationInterface),
(GBaseInitFunc) gst_navigation_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
"GstNavigation", &gst_navigation_info, 0);
}
return gst_navigation_type;
}
static void
gst_navigation_class_init (GstNavigationInterface * iface)
{
/* default virtual functions */
iface->send_event = NULL;
}
/* The interface implementer should make sure that the object can handle
* the event. */
void
gst_navigation_send_event (GstNavigation * navigation, GstStructure * structure)
{
GstNavigationInterface *iface = GST_NAVIGATION_GET_IFACE (navigation);
if (iface->send_event) {
iface->send_event (navigation, structure);
}
}
void
gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
const char *key)
{
gst_navigation_send_event (navigation,
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
event, "key", G_TYPE_STRING, key, NULL));
}
void
gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
int button, double x, double y)
{
gst_navigation_send_event (navigation,
gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
"pointer_y", G_TYPE_DOUBLE, y, NULL));
}

View file

@ -1,62 +0,0 @@
/* GStreamer Navigation
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* navigation.h: navigation interface design
*
* 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_NAVIGATION_H__
#define __GST_NAVIGATION_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_NAVIGATION \
(gst_navigation_get_type ())
#define GST_NAVIGATION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation))
#define GST_IS_NAVIGATION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
#define GST_NAVIGATION_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
typedef struct _GstNavigation GstNavigation;
typedef struct _GstNavigationInterface {
GTypeInterface g_iface;
/* virtual functions */
void (*send_event) (GstNavigation *navigation, GstStructure *structure);
gpointer _gst_reserved[GST_PADDING];
} GstNavigationInterface;
GType gst_navigation_get_type (void);
/* virtual class function wrappers */
void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
void gst_navigation_send_key_event (GstNavigation *navigation,
const char *event, const char *key);
void gst_navigation_send_mouse_event (GstNavigation *navigation,
const char *event, int button, double x, double y);
G_END_DECLS
#endif /* __GST_NAVIGATION_H__ */

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="navigation"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67898}"
RootNamespace="navigation"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstnavigation.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/navigation.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstnavigation.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstnavigation.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstnavigation.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\navigation.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\navigation.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,37 +0,0 @@
# variables used for enum generation
glib_enum_headers=$(play_headers)
glib_enum_define=GST_PLAY
glib_enum_prefix=gst_play
librarydir = $(libdir)
play_headers = \
play.h
built_headers = \
play-enumtypes.h
library_LTLIBRARIES = libgstplay-@GST_MAJORMINOR@.la
libgstplay_@GST_MAJORMINOR@_la_SOURCES = play.c
nodist_libgstplay_@GST_MAJORMINOR@_la_SOURCES = play-enumtypes.c
libgstplay_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/play
libgstplay_@GST_MAJORMINOR@include_HEADERS = $(play_headers)
nodist_libgstplay_@GST_MAJORMINOR@include_HEADERS = $(built_headers)
libgstplay_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_CFLAGS)
libgstplay_@GST_MAJORMINOR@_la_LIBADD = \
$(GST_LIBS) $(GST_PLUGINS_LIBS) \
$(GST_CONTROL_LIBS) \
$(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
libgstplay_@GST_MAJORMINOR@_la_LDFLAGS = \
-version-info @GST_PLUGINS_LIBVERSION@
BUILT_SOURCES = \
play-enumtypes.c \
$(built_headers)
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/glib-gen.mak

View file

@ -1,758 +0,0 @@
/* GStreamer
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
*
* 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 <string.h>
#include <unistd.h>
#include <gst/gst.h>
#include <gst/gst-i18n-plugin.h>
#include "play.h"
#define TICK_INTERVAL_MSEC 200
GST_DEBUG_CATEGORY_STATIC (play_debug);
#define GST_CAT_DEFAULT play_debug
enum
{
TIME_TICK,
STREAM_LENGTH,
HAVE_VIDEO_SIZE,
LAST_SIGNAL
};
struct _GstPlayPrivate
{
/* progress indicators */
guint64 time_nanos;
guint64 length_nanos;
gint get_length_attempt;
guint tick_id;
/* playbin object */
GstElement *playbin;
/* visualization */
gboolean enable_vis;
GstElement *vis_element;
/* location */
char *location;
};
static guint gst_play_signals[LAST_SIGNAL] = { 0 };
static GstPipelineClass *parent_class = NULL;
/* ======================================================= */
/* */
/* Private Methods */
/* */
/* ======================================================= */
static void
caps_set (GstPad * pad, GParamSpec * pspec, GstPlay * play)
{
const GstCaps *caps = GST_PAD_CAPS (pad);
GstStructure *s = gst_caps_get_structure (caps, 0);
if (s) {
const GValue *par;
gint w, h;
/* get effective size */
gst_structure_get_int (s, "width", &w);
gst_structure_get_int (s, "height", &h);
if ((par = gst_structure_get_value (s, "pixel-aspect-ratio"))) {
gint num = gst_value_get_fraction_numerator (par),
den = gst_value_get_fraction_denominator (par);
if (num > den)
w *= (gfloat) num / den;
else
h *= (gfloat) den / num;
}
g_signal_emit (play, gst_play_signals[HAVE_VIDEO_SIZE], 0, w, h);
g_signal_handlers_disconnect_by_func (pad, caps_set, play);
}
}
static void
setup_size (GstPlay * play)
{
const GList *streaminfo = NULL;
GstPad *pad = NULL;
g_object_get (G_OBJECT (play->priv->playbin),
"stream-info", &streaminfo, NULL);
for (; streaminfo != NULL; streaminfo = streaminfo->next) {
GObject *info = streaminfo->data;
gint type;
GParamSpec *pspec;
GEnumValue *val;
g_object_get (info, "type", &type, NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (info), "type");
val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
if (g_strrstr (val->value_name, "VIDEO")) {
g_object_get (info, "object", &pad, NULL);
pad = (GstPad *) GST_PAD_REALIZE (pad);
break;
}
}
if (pad) {
/* handle explicit caps as well - they're set later */
if (GST_PAD_CAPS (pad))
caps_set (pad, NULL, play);
else
g_signal_connect (pad, "notify::caps", G_CALLBACK (caps_set), play);
}
}
static gboolean
gst_play_tick_callback (GstPlay * play)
{
GstFormat fmt = GST_FORMAT_TIME;
gint64 value;
/* check length/pos of stream */
if (!GST_CLOCK_TIME_IS_VALID (play->priv->length_nanos) &&
play->priv->get_length_attempt < 16) {
if (gst_element_query (GST_ELEMENT (play->priv->playbin),
GST_QUERY_TOTAL, &fmt, &value)) {
play->priv->length_nanos = value;
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
0, play->priv->length_nanos);
}
play->priv->get_length_attempt++;
}
if (gst_element_query (GST_ELEMENT (play->priv->playbin),
GST_QUERY_POSITION, &fmt, &value)) {
play->priv->time_nanos = value;
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
0, play->priv->time_nanos);
}
return TRUE;
}
/*
* Virtual function.
*/
static void
gst_play_change_state (GstElement * element,
GstElementState old, GstElementState new, gpointer data)
{
GstPlay *play = GST_PLAY (data);
gint t = (old << 8) | new;
/* now set up tickers */
switch (t) {
case GST_STATE_PAUSED_TO_PLAYING:
play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC,
(GSourceFunc) gst_play_tick_callback, play);
break;
case GST_STATE_PLAYING_TO_PAUSED:
if (play->priv->tick_id != 0) {
g_source_remove (play->priv->tick_id);
play->priv->tick_id = 0;
}
break;
case GST_STATE_PAUSED_TO_READY:
play->priv->length_nanos = GST_CLOCK_TIME_NONE;
play->priv->time_nanos = GST_CLOCK_TIME_NONE;
play->priv->get_length_attempt = 0;
break;
case GST_STATE_READY_TO_PAUSED:
setup_size (play);
break;
default:
break;
}
}
/* =========================================== */
/* */
/* Init & Dispose & Class init */
/* */
/* =========================================== */
static void
gst_play_dispose (GObject * object)
{
GstPlay *play = GST_PLAY (object);
/* reset */
gst_element_set_state (GST_ELEMENT (play), GST_STATE_NULL);
/* no vis */
if (play->priv->vis_element) {
gst_object_unref (GST_OBJECT (play->priv->vis_element));
play->priv->vis_element = NULL;
}
g_free (play->priv->location);
play->priv->location = NULL;
/* parent will clean up the rest */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_play_init (GstPlay * play)
{
play->priv = g_new0 (GstPlayPrivate, 1);
/* default */
play->priv->length_nanos = GST_CLOCK_TIME_NONE;
play->priv->time_nanos = GST_CLOCK_TIME_NONE;
play->priv->tick_id = 0;
play->priv->get_length_attempt = 0;
play->priv->enable_vis = FALSE;
play->priv->vis_element = NULL;
play->priv->location = NULL;
/* make playbin */
play->priv->playbin = gst_element_factory_make ("playbin", "player");
if (play->priv->playbin) {
gst_bin_add (GST_BIN (play), play->priv->playbin);
g_signal_connect (play->priv->playbin, "state-change",
G_CALLBACK (gst_play_change_state), play);
}
}
static void
gst_play_class_init (GstPlayClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (GST_TYPE_PIPELINE);
gobject_class->dispose = gst_play_dispose;
gst_play_signals[TIME_TICK] =
g_signal_new ("time-tick", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstPlayClass, time_tick), NULL, NULL,
gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
gst_play_signals[STREAM_LENGTH] =
g_signal_new ("stream-length", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstPlayClass, stream_length), NULL, NULL,
gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
gst_play_signals[HAVE_VIDEO_SIZE] =
g_signal_new ("have-video-size", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstPlayClass, have_video_size), NULL, NULL,
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
GST_DEBUG_CATEGORY_INIT (play_debug, "GST_PLAY", 0, "GStreamer Play library");
GST_DEBUG ("Play class initialized");
}
/* ======================================================= */
/* */
/* Public Methods */
/* */
/* ======================================================= */
/**
* gst_play_set_location:
* @play: a #GstPlay.
* @location: a const #char* indicating location to play
*
* Set location of @play to @location.
*
* Returns: TRUE if location was set successfully.
*/
gboolean
gst_play_set_location (GstPlay * play, const char *location)
{
char *uri;
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (location != NULL, FALSE);
/* cache */
if (play->priv->location)
g_free (play->priv->location);
play->priv->location = g_strdup (location);
/* get file */
gst_element_set_state (play->priv->playbin, GST_STATE_READY);
if (strchr (location, ':'))
uri = g_strdup (location);
else if (location[0] == '/')
uri = g_strdup_printf ("file://%s", location);
else {
char cwd[256];
getcwd (cwd, 255);
uri = g_strdup_printf ("file://%s/%s", cwd, location);
}
g_object_set (play->priv->playbin, "uri", uri, NULL);
g_free (uri);
/* open */
if (gst_element_set_state (play->priv->playbin,
GST_STATE_PAUSED) != GST_STATE_SUCCESS) {
return FALSE;
}
return TRUE;
}
/**
* gst_play_get_location:
* @play: a #GstPlay.
*
* Get current location of @play.
*
* Returns: a #char* pointer to current location.
*/
char *
gst_play_get_location (GstPlay * play)
{
g_return_val_if_fail (play != NULL, NULL);
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
return g_strdup (play->priv->location);
}
/**
* gst_play_seek_to_time:
* @play: a #GstPlay.
* @time_nanos: a #gint64 indicating a time position.
*
* Performs a seek on @play until @time_nanos.
*/
/*
* FIXME: use GstClockTime for 0.9
*/
gboolean
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
{
return gst_element_seek (play->priv->playbin,
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
}
/**
* gst_play_set_data_src:
* @play: a #GstPlay.
* @data_src: a #GstElement.
*
* Set @data_src as the source element of @play.
*
* Returns: TRUE if call succeeded.
*/
gboolean
gst_play_set_data_src (GstPlay * play, GstElement * data_src)
{
/* deprecated - use URIs */
return FALSE;
}
/**
* gst_play_set_video_sink:
* @play: a #GstPlay.
* @video_sink: a #GstElement.
*
* Set @video_sink as the video sink element of @play.
*
* Returns: TRUE if call succeeded.
*/
gboolean
gst_play_set_video_sink (GstPlay * play, GstElement * video_sink)
{
g_object_set (G_OBJECT (play->priv->playbin), "video-sink", video_sink, NULL);
return TRUE;
}
/**
* gst_play_set_audio_sink:
* @play: a #GstPlay.
* @audio_sink: a #GstElement.
*
* Set @audio_sink as the audio sink element of @play.
*
* Returns: TRUE if call succeeded.
*/
gboolean
gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink)
{
g_object_set (G_OBJECT (play->priv->playbin), "audio-sink", audio_sink, NULL);
return TRUE;
}
/**
* gst_play_set_visualization:
* @play: a #GstPlay.
* @element: a #GstElement.
*
* Set @video_sink as the video sink element of @play.
*
* Returns: TRUE if call succeeded.
*/
gboolean
gst_play_set_visualization (GstPlay * play, GstElement * vis_element)
{
/* unset old */
if (play->priv->vis_element) {
gst_object_unref (GST_OBJECT (play->priv->vis_element));
play->priv->vis_element = NULL;
}
/* set new */
if (vis_element) {
gst_object_ref (GST_OBJECT (vis_element));
play->priv->vis_element = vis_element;
}
/* use */
if (play->priv->vis_element && play->priv->enable_vis) {
g_object_set (G_OBJECT (play->priv->playbin),
"vis-plugin", vis_element, NULL);
} else {
g_object_set (G_OBJECT (play->priv->playbin), "vis-plugin", NULL, NULL);
}
return TRUE;
}
/**
* gst_play_connect_visualization:
* @play: a #GstPlay.
* @connect: a #gboolean indicating wether or not
* visualization should be connected.
*
* Connect or disconnect visualization bin in @play.
*
* Returns: TRUE if call succeeded.
*/
gboolean
gst_play_connect_visualization (GstPlay * play, gboolean connect)
{
play->priv->enable_vis = connect;
/* use */
if (play->priv->vis_element && play->priv->enable_vis) {
g_object_set (G_OBJECT (play->priv->playbin),
"vis-plugin", play->priv->vis_element, NULL);
} else {
g_object_set (G_OBJECT (play->priv->playbin), "vis-plugin", NULL, NULL);
}
return TRUE;
}
/**
* gst_play_get_framerate:
* @play: a #GstPlay.
*
* Get the video framerate from @play.
*
* Returns: a #gdouble indicating video framerate in frame per second.
*/
gdouble
gst_play_get_framerate (GstPlay * play)
{
const GList *streaminfo = NULL;
const GstStructure *str = NULL;
gdouble value;
g_object_get (G_OBJECT (play->priv->playbin),
"stream-info", &streaminfo, NULL);
for (; streaminfo != NULL; streaminfo = streaminfo->next) {
GObject *info = streaminfo->data;
gint type;
GParamSpec *pspec;
GEnumValue *val;
g_object_get (info, "type", &type, NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (info), "type");
val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
if (strstr (val->value_name, "VIDEO")) {
const GstCaps *caps = NULL;
GstPad *pad = NULL;
g_object_get (info, "object", &pad, NULL);
g_assert (GST_IS_PAD (pad));
pad = (GstPad *) GST_PAD_REALIZE (pad);
caps = GST_PAD_CAPS (pad);
str = gst_caps_get_structure (caps, 0);
break;
}
}
if (!str)
return 0.;
gst_structure_get_double (str, "framerate", &value);
return value;
}
/**
* gst_play_get_sink_element:
* @play: a #GstPlay.
* @element: a #GstElement.
* @sink_type: a #GstPlaySinkType.
*
* Searches recursively for a sink #GstElement with
* type @sink_type in @element which is supposed to be a #GstBin.
*
* Returns: the sink #GstElement of @element.
*/
/*
* (Ronald) what is this?
*/
GstElement *
gst_play_get_sink_element (GstPlay * play,
GstElement * element, GstPlaySinkType sink_type)
{
GList *elements = NULL;
const GList *pads = NULL;
gboolean has_src, has_correct_type;
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
GST_DEBUG_OBJECT (play, "looking for sink element in %s",
GST_ELEMENT_NAME (element));
if (!GST_IS_BIN (element)) {
/* since its not a bin, we'll assume this
* element is a sink element */
GST_DEBUG_OBJECT (play, "not a bin, returning %s as sink element",
GST_ELEMENT_NAME (element));
return element;
}
elements = (GList *) gst_bin_get_list (GST_BIN (element));
/* traverse all elements looking for one without src pad */
while (elements) {
element = GST_ELEMENT (elements->data);
GST_DEBUG_OBJECT (play, "looking at element %s",
GST_ELEMENT_NAME (element));
/* Recursivity :) */
if (GST_IS_BIN (element)) {
element = gst_play_get_sink_element (play, element, sink_type);
if (GST_IS_ELEMENT (element))
return element;
} else {
pads = gst_element_get_pad_list (element);
has_src = FALSE;
has_correct_type = FALSE;
while (pads) {
/* check for src pad */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
GST_DEBUG_OBJECT (play, "element %s has a src pad",
GST_ELEMENT_NAME (element));
has_src = TRUE;
break;
} else {
/* If not a src pad checking caps */
GstPad *pad;
GstCaps *caps;
GstStructure *structure;
int i;
gboolean has_video_cap = FALSE;
gboolean has_audio_cap = FALSE;
pad = GST_PAD (pads->data);
caps = gst_pad_get_caps (pad);
/* loop over all caps members to find mime types */
for (i = 0; i < gst_caps_get_size (caps); ++i) {
structure = gst_caps_get_structure (caps, i);
GST_DEBUG_OBJECT (play,
"looking at caps %d pad %s:%s on element %s with mime %s", i,
GST_DEBUG_PAD_NAME (pad),
GST_ELEMENT_NAME (element), gst_structure_get_name (structure));
if (strcmp (gst_structure_get_name (structure),
"audio/x-raw-int") == 0) {
has_audio_cap = TRUE;
}
if (strcmp (gst_structure_get_name (structure),
"video/x-raw-yuv") == 0 ||
strcmp (gst_structure_get_name (structure),
"video/x-raw-rgb") == 0) {
has_video_cap = TRUE;
}
}
gst_caps_free (caps);
switch (sink_type) {
case GST_PLAY_SINK_TYPE_AUDIO:
if (has_audio_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_VIDEO:
if (has_video_cap)
has_correct_type = TRUE;
break;
case GST_PLAY_SINK_TYPE_ANY:
if ((has_video_cap) || (has_audio_cap))
has_correct_type = TRUE;
break;
default:
has_correct_type = FALSE;
}
}
pads = g_list_next (pads);
}
if ((!has_src) && (has_correct_type)) {
GST_DEBUG_OBJECT (play, "found %s with src pad and correct type",
GST_ELEMENT_NAME (element));
return element;
}
}
elements = g_list_next (elements);
}
/* we didn't find a sink element */
return NULL;
}
/**
* gst_play_get_all_by_interface:
* @play: a #GstPlay.
* @interface: an interface.
*
* Returns all elements that are used by @play implementing the given interface.
*
* Returns: a #GList of #GstElement implementing the interface.
*/
GList *
gst_play_get_all_by_interface (GstPlay * play, GType interface_type)
{
GstElement *videosink = NULL, *audiosink = NULL;
GList *res = NULL;
g_object_get (G_OBJECT (play->priv->playbin),
"video-sink", &videosink, "audio-sink", &audiosink, NULL);
/* ehw... */
if (videosink && GST_IS_BIN (videosink)) {
res = gst_bin_get_all_by_interface (GST_BIN (videosink), interface_type);
}
if (!res && audiosink && GST_IS_BIN (audiosink)) {
res = gst_bin_get_all_by_interface (GST_BIN (audiosink), interface_type);
}
return res;
}
/**
* gst_play_new:
* @error: a pointer to a #GError, which will be filled in on error.
*
* Creates a new GstPlay object.
*
* Returns: a newly created #GstPlay, or NULL on error (the #GError
* will be set accordingly).
*/
GstPlay *
gst_play_new (GError ** error)
{
GstPlay *play = g_object_new (GST_TYPE_PLAY, NULL);
if (!play->priv->playbin) {
g_set_error (error, 0, 0, _("Failed to create playbin object"));
g_object_unref (G_OBJECT (play));
return NULL;
}
return play;
}
/* =========================================== */
/* */
/* Object typing & Creation */
/* */
/* =========================================== */
GType
gst_play_get_type (void)
{
static GType play_type = 0;
if (!play_type) {
static const GTypeInfo play_info = {
sizeof (GstPlayClass),
NULL,
NULL,
(GClassInitFunc) gst_play_class_init,
NULL,
NULL,
sizeof (GstPlay),
0,
(GInstanceInitFunc) gst_play_init,
NULL
};
play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay",
&play_info, 0);
}
return play_type;
}

View file

@ -1,9 +0,0 @@
noinst_LTLIBRARIES = libgstpropertyprobe.la
libgstpropertyprobe_la_SOURCES = propertyprobe.c
libgstpropertyprobeincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/propertyprobe
libgstpropertyprobeinclude_HEADERS = propertyprobe.h
libgstpropertyprobe_la_CFLAGS = $(GST_CFLAGS)

View file

@ -1,345 +0,0 @@
/* GStreamer PropertyProbe
* Copyright (C) 2003 David Schleef <ds@schleef.org>
*
* property_probe.c: property_probe design virtual class function wrappers
*
* 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 <string.h>
#include "propertyprobe.h"
enum
{
SIGNAL_PROBE_NEEDED,
LAST_SIGNAL
};
static void gst_property_probe_iface_init (GstPropertyProbeInterface * iface);
static guint gst_property_probe_signals[LAST_SIGNAL] = { 0 };
GType
gst_property_probe_get_type (void)
{
static GType gst_property_probe_type = 0;
if (!gst_property_probe_type) {
static const GTypeInfo gst_property_probe_info = {
sizeof (GstPropertyProbeInterface),
(GBaseInitFunc) gst_property_probe_iface_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_property_probe_type =
g_type_register_static (G_TYPE_INTERFACE,
"GstPropertyProbe", &gst_property_probe_info, 0);
}
return gst_property_probe_type;
}
static void
gst_property_probe_iface_init (GstPropertyProbeInterface * iface)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_property_probe_signals[SIGNAL_PROBE_NEEDED] =
g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
initialized = TRUE;
}
/* default virtual functions */
iface->get_properties = NULL;
iface->get_values = NULL;
}
/**
* gst_property_probe_get_properties:
* @probe: the #GstPropertyProbe to get the properties for.
*
* Get a list of properties for which probing is supported.
*
* Returns the list of properties for which probing is supported
* by this element.
*/
const GList *
gst_property_probe_get_properties (GstPropertyProbe * probe)
{
GstPropertyProbeInterface *iface;
g_return_val_if_fail (probe != NULL, NULL);
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
if (iface->get_properties)
return iface->get_properties (probe);
return NULL;
}
const GParamSpec *
gst_property_probe_get_property (GstPropertyProbe * probe, const gchar * name)
{
const GList *pspecs = gst_property_probe_get_properties (probe);
g_return_val_if_fail (probe != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
while (pspecs) {
const GParamSpec *pspec = pspecs->data;
if (!strcmp (pspec->name, name))
return pspec;
pspecs = pspecs->next;
}
return NULL;
}
void
gst_property_probe_probe_property (GstPropertyProbe * probe,
const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
g_return_if_fail (probe != NULL);
g_return_if_fail (pspec != NULL);
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
if (iface->probe_property)
iface->probe_property (probe, pspec->param_id, pspec);
}
/**
* gst_property_probe_probe_property_name:
* @probe: the #GstPropertyProbe to check.
* @name: name of the property to return.
*
* Returns the #GParamSpec for the given property. It's similar to
* g_object_class_find_property (), except that this function only
* takes "probe'able" properties into account.
*
* Returns: the #GParamSpec that belongs to the given property.
*/
void
gst_property_probe_probe_property_name (GstPropertyProbe * probe,
const gchar * name)
{
const GParamSpec *pspec;
g_return_if_fail (probe != NULL);
g_return_if_fail (name != NULL);
pspec = g_object_class_find_property (G_OBJECT_CLASS (probe), name);
if (!pspec) {
g_warning ("No such property %s", name);
return;
}
gst_property_probe_probe_property (probe, pspec);
}
/**
* gst_property_probe_needs_probe:
* @probe: the #GstPropertyProbe object to which the given property belongs.
* @pspec: a #GParamSpec that identifies the property to check.
*
* Checks whether a property needs a probe. This might be because
* the property wasn't initialized before, or because host setup
* changed. This might be, for example, because a new device was
* added, and thus device probing needs to be refreshed to display
* the new device.
*
* Returns: TRUE if the property needs a new probe, FALSE if not.
*/
gboolean
gst_property_probe_needs_probe (GstPropertyProbe * probe,
const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
g_return_val_if_fail (probe != NULL, FALSE);
g_return_val_if_fail (pspec != NULL, FALSE);
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
if (iface->needs_probe)
return iface->needs_probe (probe, pspec->param_id, pspec);
return FALSE;
}
/**
* gst_property_probe_needs_probe_name:
* @probe: the #GstPropertyProbe object to which the given property belongs.
* @name: the name of the property to check.
*
* Same as gst_property_probe_needs_probe ().
*
* Returns: TRUE if the property needs a new probe, FALSE if not.
*/
gboolean
gst_property_probe_needs_probe_name (GstPropertyProbe * probe,
const gchar * name)
{
const GParamSpec *pspec;
g_return_val_if_fail (probe != NULL, FALSE);
g_return_val_if_fail (name != NULL, FALSE);
pspec = g_object_class_find_property (G_OBJECT_CLASS (probe), name);
if (!pspec) {
g_warning ("No such property %s", name);
return FALSE;
}
return gst_property_probe_needs_probe (probe, pspec);
}
/**
* gst_property_probe_get_values:
* @probe: the #GstPropertyProbe object.
* @pspec: the #GParamSpec property identifier.
*
* Gets the possible (probed) values for the given property,
* requires the property to have been probed before.
*
* Returns: A list of valid values for the given property.
*/
GValueArray *
gst_property_probe_get_values (GstPropertyProbe * probe,
const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
g_return_val_if_fail (probe != NULL, NULL);
g_return_val_if_fail (pspec != NULL, NULL);
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
if (iface->get_values)
return iface->get_values (probe, pspec->param_id, pspec);
return NULL;
}
/**
* gst_property_probe_get_values_name:
* @probe: the #GstPropertyProbe object.
* @name: the name of the property to get values for.
*
* Same as gst_property_probe_get_values ().
*
* Returns: A list of valid values for the given property.
*/
GValueArray *
gst_property_probe_get_values_name (GstPropertyProbe * probe,
const gchar * name)
{
const GParamSpec *pspec;
g_return_val_if_fail (probe != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
pspec = g_object_class_find_property (G_OBJECT_CLASS (probe), name);
if (!pspec) {
g_warning ("No such property %s", name);
return NULL;
}
return gst_property_probe_get_values (probe, pspec);
}
/**
* gst_property_probe_probe_and_get_values:
* @probe: the #GstPropertyProbe object.
* @pspec: The #GParamSpec property identifier.
*
* Check whether the given property requires a new probe. If so,
* fo the probe. After that, retrieve a value list. Meant as a
* utility function that wraps the above functions.
*
* Return: the list of valid values for this property.
*/
GValueArray *
gst_property_probe_probe_and_get_values (GstPropertyProbe * probe,
const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
g_return_val_if_fail (probe != NULL, NULL);
g_return_val_if_fail (pspec != NULL, NULL);
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
if (gst_property_probe_needs_probe (probe, pspec))
gst_property_probe_probe_property (probe, pspec);
return gst_property_probe_get_values (probe, pspec);
}
/**
* gst_property_probe_probe_and_get_values_name:
* @probe: the #GstPropertyProbe object.
* @name: the name of the property to get values for.
*
* Same as gst_property_probe_probe_and_get_values ().
*
* Return: the list of valid values for this property.
*/
GValueArray *
gst_property_probe_probe_and_get_values_name (GstPropertyProbe * probe,
const gchar * name)
{
const GParamSpec *pspec;
g_return_val_if_fail (probe != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
pspec = g_object_class_find_property (G_OBJECT_CLASS (probe), name);
if (!pspec) {
g_warning ("No such property %s", name);
return NULL;
}
return gst_property_probe_probe_and_get_values (probe, pspec);
}

View file

@ -1,97 +0,0 @@
/* GStreamer PropertyProbe
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* property_probe.h: property_probe interface design
*
* 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_PROPERTY_PROBE_H__
#define __GST_PROPERTY_PROBE_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_PROPERTY_PROBE \
(gst_property_probe_get_type ())
#define GST_PROPERTY_PROBE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbe))
#define GST_IS_PROPERTY_PROBE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE))
#define GST_PROPERTY_PROBE_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface))
typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
typedef struct _GstPropertyProbeInterface {
GTypeInterface klass;
/* signals */
void (*probe_needed) (GstPropertyProbe *probe,
const GParamSpec *pspec);
/* virtual functions */
const GList * (*get_properties) (GstPropertyProbe *probe);
gboolean (*needs_probe) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
void (*probe_property) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
GValueArray * (*get_values) (GstPropertyProbe *probe,
guint prop_id,
const GParamSpec *pspec);
gpointer _gst_reserved[GST_PADDING];
} GstPropertyProbeInterface;
GType gst_property_probe_get_type (void);
/* virtual class function wrappers */
/* returns list of GParamSpecs */
const GList * gst_property_probe_get_properties (GstPropertyProbe *probe);
const GParamSpec *gst_property_probe_get_property (GstPropertyProbe *probe,
const gchar *name);
/* probe one property */
void gst_property_probe_probe_property (GstPropertyProbe *probe,
const GParamSpec *pspec);
void gst_property_probe_probe_property_name (GstPropertyProbe *probe,
const gchar *name);
/* do we need a probe? */
gboolean gst_property_probe_needs_probe (GstPropertyProbe *probe,
const GParamSpec *pspec);
gboolean gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
const gchar *name);
/* returns list of GValues */
GValueArray * gst_property_probe_get_values (GstPropertyProbe *probe,
const GParamSpec *pspec);
GValueArray * gst_property_probe_get_values_name (GstPropertyProbe *probe,
const gchar *name);
/* sugar */
GValueArray * gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
const GParamSpec *pspec);
GValueArray * gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
const gchar *name);
G_END_DECLS
#endif /* __GST_PROPERTY_PROBE_H__ */

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="propertyprobe"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D6789A}"
RootNamespace="propertyprobe"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstpropertyprobe.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/propertyprobe.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstpropertyprobe.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstpropertyprobe.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstpropertyprobe.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\propertyprobe.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\propertyprobe.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,14 +0,0 @@
librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@
library_LTLIBRARIES = libgstresample.la
libgstresample_la_SOURCES = dtos.c dtof.c functable.c resample.c resample.h
libgstresample_la_LIBADD =
libgstresample_la_CFLAGS = $(GST_CFLAGS)
libgstresample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstresampleincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/resample
libgstresampleinclude_HEADERS = resample.h
noinst_HEADERS = private.h

View file

@ -1,62 +0,0 @@
This is a snapshot of my current work developing an audio
resampling library. While working on this library, I started
writing lots of general purpose functions that should really
be part of a larger library. Rather than have a constantly
changing library, and since the current code is capable, I
decided to freeze this codebase for use with gstreamer, and
move active development of the code elsewhere.
The algorithm used is based on Shannon's theorem, which says
that you can recreate an input signal from equidistant samples
using a sin(x)/x filter; thus, you can create new samples from
the regenerated input signal. Since sin(x)/x is expensive to
evaluate, an interpolated lookup table is used. Also, a
windowing function (1-x^2)^2 is used, which aids the convergence
of sin(x)/x for lower frequencies at the expense of higher.
There is one tunable parameter, which is the filter length.
Longer filter lengths are obviously slower, but more accurate.
There's not much reason to use a filter length longer than 64,
since other approximations start to dominate. Filter lengths
as short as 8 are audially acceptable, but should not be
considered for serious work.
Performance: A PowerPC G4 at 400 Mhz can resample 2 audio
channels at almost 10x speed with a filter length of 64, without
using Altivec extensions. (My goal was 10x speed, which I almost
reached. Maybe later.)
Limitations: Currently only supports streams in the form of
interleaved signed 16-bit samples.
The test.c program is a simple regression test. It creates a
test input pattern (1 sec at 48 khz) that is a frequency ramp
from 0 to 24000 hz, and then converts it to 44100 hz using a
filter length of 64. It then compares the result to the same
pattern generated at 44100 hz, and outputs the result to the
file "out".
A graph of the correct output should have field 2 and field 4
almost equal (plus/minus 1) up to about sample 40000 (which
corresponds to 20 khz), and then field 2 should be close to 0
above that. Running the test program will print to stdout
something like the following:
time 0.112526
average error 10k=0.4105 22k=639.34
The average error is RMS error over the range [0-10khz] and
[0-22khz], and is expressed in sample values, for an input
amplitude of 16000. Note that RMS errors below 1.0 can't
really be compared, but basically this shows that below
10 khz, the resampler is nearly perfect. Most of the error
is concentrated above 20 khz.
If the average error is significantly larger after modifying
the code, it's probably not good.
dave...

View file

@ -1,74 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David A. Schleef <ds@schleef.org>
*
* 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 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 <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/*#include <ml.h> */
#include "private.h"
void
conv_double_float_ref (double *dest, float *src, int n)
{
int i;
for (i = 0; i < n; i++) {
dest[i] = src[i];
}
}
void
conv_float_double_ref (float *dest, double *src, int n)
{
int i;
for (i = 0; i < n; i++) {
dest[i] = src[i];
}
}
void
conv_double_float_dstr (double *dest, float *src, int n, int dstr)
{
int i;
void *d = dest;
for (i = 0; i < n; i++) {
(*(double *) d) = *src++;
d += dstr;
}
}
void
conv_float_double_sstr (float *dest, double *src, int n, int sstr)
{
int i;
void *s = src;
for (i = 0; i < n; i++) {
*dest++ = *(double *) s;
s += sstr;
}
}

View file

@ -1,217 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David A. Schleef <ds@schleef.org>
*
* 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 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 <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/*#include <ml.h> */
#include <resample.h>
#define short_to_double_table
/*#define short_to_double_altivec */
#define short_to_double_unroll
#ifdef short_to_double_table
static float ints_high[256];
static float ints_low[256];
void
conv_double_short_table (double *dest, short *src, int n)
{
static int init = 0;
int i;
unsigned int idx;
if (!init) {
for (i = 0; i < 256; i++) {
ints_high[i] = 256.0 * ((i < 128) ? i : i - 256);
ints_low[i] = i;
}
init = 1;
}
if (n & 1) {
idx = (unsigned short) *src++;
*dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
n -= 1;
}
for (i = 0; i < n; i += 2) {
idx = (unsigned short) *src++;
*dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
idx = (unsigned short) *src++;
*dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
}
}
#endif
#ifdef short_to_double_unroll
void
conv_double_short_unroll (double *dest, short *src, int n)
{
if (n & 1) {
*dest++ = *src++;
n--;
}
if (n & 2) {
*dest++ = *src++;
*dest++ = *src++;
n -= 2;
}
while (n > 0) {
*dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
n -= 4;
}
}
#endif
void
conv_double_short_ref (double *dest, short *src, int n)
{
int i;
for (i = 0; i < n; i++) {
dest[i] = src[i];
}
}
#ifdef HAVE_CPU_PPC
#if 0
static union
{
int i[4];
float f[4];
}
av_tmp __attribute__ ((__aligned__ (16)));
void
conv_double_short_altivec (double *dest, short *src, int n)
{
int i;
for (i = 0; i < n; i += 4) {
av_tmp.i[0] = src[0];
av_tmp.i[1] = src[1];
av_tmp.i[2] = src[2];
av_tmp.i[3] = src[3];
asm (" lvx 0,0,%0\n" " vcfsx 1,0,0\n" " stvx 1,0,%0\n": :"r" (&av_tmp)
);
dest[0] = av_tmp.f[0];
dest[1] = av_tmp.f[1];
dest[2] = av_tmp.f[2];
dest[3] = av_tmp.f[3];
src += 4;
dest += 4;
}
}
#endif
#endif
/* double to short */
void
conv_short_double_ref (short *dest, double *src, int n)
{
int i;
double x;
for (i = 0; i < n; i++) {
x = *src++;
if (x < -32768.0)
x = -32768.0;
if (x > 32767.0)
x = 32767.0;
*dest++ = rint (x);
}
}
/* #ifdef HAVE_CPU_PPC */
#if 0
void
conv_short_double_ppcasm (short *dest, double *src, int n)
{
int tmp[2];
double min = -32768.0;
double max = 32767.0;
double ftmp0, ftmp1;
asm __volatile__ ("\taddic. %3,%3,-8\n"
"\taddic. %6,%6,-2\n"
"loop:\n"
"\tlfdu %0,8(%3)\n"
"\tfsub %1,%0,%4\n"
"\tfsel %0,%1,%0,%4\n"
"\tfsub %1,%0,%5\n"
"\tfsel %0,%1,%5,%0\n"
"\tfctiw %1,%0\n"
"\taddic. 5,5,-1\n"
"\tstfd %1,0(%2)\n"
"\tlhz 9,6(%2)\n"
"\tsthu 9,2(%6)\n" "\tbne loop\n":"=&f" (ftmp0), "=&f" (ftmp1)
:"b" (tmp), "r" (src), "f" (min), "f" (max), "r" (dest)
:"r9", "r5");
}
#endif
void
conv_double_short_dstr (double *dest, short *src, int n, int dstr)
{
int i;
void *d = dest;
for (i = 0; i < n; i++) {
(*(double *) d) = *src++;
d += dstr;
}
}
void
conv_short_double_sstr (short *dest, double *src, int n, int sstr)
{
int i;
double x;
void *s = src;
for (i = 0; i < n; i++) {
x = *(double *) s;
if (x < -32768.0)
x = -32768.0;
if (x > 32767.0)
x = 32767.0;
*dest++ = rint (x);
s += sstr;
}
}

View file

@ -1,322 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David A. Schleef <ds@schleef.org>
*
* 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 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 <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "private.h"
double
functable_sinc (void *p, double x)
{
if (x == 0)
return 1;
return sin (x) / x;
}
double
functable_dsinc (void *p, double x)
{
if (x == 0)
return 0;
return cos (x) / x - sin (x) / (x * x);
}
double
functable_window_boxcar (void *p, double x)
{
if (x < -1 || x > 1)
return 0;
return 1;
}
double
functable_window_dboxcar (void *p, double x)
{
return 0;
}
double
functable_window_std (void *p, double x)
{
if (x < -1 || x > 1)
return 0;
return (1 - x * x) * (1 - x * x);
}
double
functable_window_dstd (void *p, double x)
{
if (x < -1 || x > 1)
return 0;
return -4 * x * (1 - x * x);
}
void
functable_init (functable_t * t)
{
int i;
double x;
t->fx = malloc (sizeof (double) * (t->len + 1));
t->fdx = malloc (sizeof (double) * (t->len + 1));
t->invoffset = 1.0 / t->offset;
for (i = 0; i < t->len + 1; i++) {
x = t->start + t->offset * i;
x *= t->scale;
t->fx[i] = t->func_x (t->priv, x);
t->fdx[i] = t->scale * t->func_dx (t->priv, x);
}
if (t->func2_x) {
double f1x, f1dx;
double f2x, f2dx;
for (i = 0; i < t->len + 1; i++) {
x = t->start + t->offset * i;
x *= t->scale2;
f2x = t->func2_x (t->priv, x);
f2dx = t->scale2 * t->func2_dx (t->priv, x);
f1x = t->fx[i];
f1dx = t->fdx[i];
t->fx[i] = f1x * f2x;
t->fdx[i] = f1x * f2dx + f1dx * f2x;
}
}
}
double
functable_eval (functable_t * t, double x)
{
int i;
double f0, f1, w0, w1;
double x2, x3;
double w;
if (x < t->start || x > (t->start + (t->len + 1) * t->offset)) {
printf ("x out of range %g\n", x);
}
x -= t->start;
x /= t->offset;
i = floor (x);
x -= i;
x2 = x * x;
x3 = x2 * x;
f1 = 3 * x2 - 2 * x3;
f0 = 1 - f1;
w0 = (x - 2 * x2 + x3) * t->offset;
w1 = (-x2 + x3) * t->offset;
/*printf("i=%d x=%g f0=%g f1=%g w0=%g w1=%g\n",i,x,f0,f1,w0,w1); */
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
/*w = t->fx[i] * (1-x) + t->fx[i+1] * x; */
return w;
}
double
functable_fir (functable_t * t, double x, int n, double *data, int len)
{
int i, j;
double f0, f1, w0, w1;
double x2, x3;
double w;
double sum;
x -= t->start;
x /= t->offset;
i = floor (x);
x -= i;
x2 = x * x;
x3 = x2 * x;
f1 = 3 * x2 - 2 * x3;
f0 = 1 - f1;
w0 = (x - 2 * x2 + x3) * t->offset;
w1 = (-x2 + x3) * t->offset;
sum = 0;
for (j = 0; j < len; j++) {
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
sum += data[j * 2] * w;
i += n;
}
return sum;
}
void
functable_fir2 (functable_t * t, double *r0, double *r1, double x,
int n, double *data, int len)
{
int i, j;
double f0, f1, w0, w1;
double x2, x3;
double w;
double sum0, sum1;
double floor_x;
x -= t->start;
x *= t->invoffset;
floor_x = floor (x);
i = floor_x;
x -= floor_x;
x2 = x * x;
x3 = x2 * x;
f1 = 3 * x2 - 2 * x3;
f0 = 1 - f1;
w0 = (x - 2 * x2 + x3) * t->offset;
w1 = (-x2 + x3) * t->offset;
sum0 = 0;
sum1 = 0;
for (j = 0; j < len; j++) {
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
sum0 += data[j * 2] * w;
sum1 += data[j * 2 + 1] * w;
i += n;
#define unroll2
#define unroll3
#define unroll4
#ifdef unroll2
j++;
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
sum0 += data[j * 2] * w;
sum1 += data[j * 2 + 1] * w;
i += n;
#endif
#ifdef unroll3
j++;
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
sum0 += data[j * 2] * w;
sum1 += data[j * 2 + 1] * w;
i += n;
#endif
#ifdef unroll4
j++;
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
sum0 += data[j * 2] * w;
sum1 += data[j * 2 + 1] * w;
i += n;
#endif
}
*r0 = sum0;
*r1 = sum1;
}
#ifdef unused
void
functable_fir2_altivec (functable_t * t, float *r0, float *r1,
double x, int n, float *data, int len)
{
int i, j;
double f0, f1, w0, w1;
double x2, x3;
double w;
double sum0, sum1;
double floor_x;
x -= t->start;
x *= t->invoffset;
floor_x = floor (x);
i = floor_x;
x -= floor_x;
x2 = x * x;
x3 = x2 * x;
f1 = 3 * x2 - 2 * x3;
f0 = 1 - f1;
w0 = (x - 2 * x2 + x3) * t->offset;
w1 = (-x2 + x3) * t->offset;
sum0 = 0;
sum1 = 0;
for (j = 0; j < len; j++) {
/* t->fx, t->fdx needs to be multiplexed by n */
/* we need 5 consecutive floats, which fit into 2 vecs */
/* load v0, t->fx[i] */
/* load v1, t->fx[i+n] */
/* v2 = v0 (not correct) */
/* v3 = (v0>>32) || (v1<<3*32) (not correct) */
/* */
/* load v4, t->dfx[i] */
/* load v5, t->dfx[i+n] */
/* v6 = v4 (not correct) */
/* v7 = (v4>>32) || (v5<<3*32) (not correct) */
/* */
/* v8 = splat(f0) */
/* v9 = splat(f1) */
/* v10 = splat(w0) */
/* v11 = splat(w1) */
/* */
/* v12 = v2 * v8 */
/* v12 += v3 * v9 */
/* v12 += v6 * v10 */
/* v12 += v7 * v11 */
w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
/* v13 = data[j*2] */
/* v14 = data[j*2+4] */
/* v15 = deinterlace_high(v13,v14) */
/* v16 = deinterlace_low(v13,v14) */
/* (sum0) v17 += multsum(v13,v15) */
/* (sum1) v18 += multsum(v14,v16) */
sum0 += data[j * 2] * w;
sum1 += data[j * 2 + 1] * w;
i += n;
}
*r0 = sum0;
*r1 = sum1;
}
#endif

View file

@ -1,118 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David Schleef <ds@schleef.org>
*
* 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 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 __PRIVATE_H__
#define __PRIVATE_H__
#include "resample.h"
G_BEGIN_DECLS
void gst_resample_nearest_s16(gst_resample_t *r);
void gst_resample_bilinear_s16(gst_resample_t *r);
void gst_resample_sinc_s16(gst_resample_t *r);
void gst_resample_sinc_slow_s16(gst_resample_t *r);
void gst_resample_sinc_ft_s16(gst_resample_t * r);
void gst_resample_nearest_float(gst_resample_t *r);
void gst_resample_bilinear_float(gst_resample_t *r);
void gst_resample_sinc_float(gst_resample_t *r);
void gst_resample_sinc_slow_float(gst_resample_t *r);
void gst_resample_sinc_ft_float(gst_resample_t * r);
typedef struct functable_s functable_t;
struct functable_s {
double start;
double offset;
int len;
double invoffset;
double scale;
double scale2;
double (*func_x)(void *,double x);
double (*func_dx)(void *,double x);
double (*func2_x)(void *,double x);
double (*func2_dx)(void *,double x);
double *fx;
double *fdx;
void *priv;
};
void functable_init(functable_t *t);
double functable_eval(functable_t *t,double x);
double functable_fir(functable_t *t,double x0,int n,double *data,int len);
void functable_fir2(functable_t *t,double *r0, double *r1, double x0,
int n,double *data,int len);
double functable_sinc(void *p, double x);
double functable_dsinc(void *p, double x);
double functable_window_std(void *p, double x);
double functable_window_dstd(void *p, double x);
double functable_window_boxcar(void *p, double x);
double functable_window_dboxcar(void *p, double x);
/* math lib stuff */
void conv_double_short_table(double *dest, short *src, int n);
void conv_double_short_unroll(double *dest, short *src, int n);
void conv_double_short_ref(double *dest, short *src, int n);
#ifdef HAVE_CPU_PPC
void conv_double_short_altivec(double *dest, short *src, int n);
#endif
void conv_short_double_ref(short *dest, double *src, int n);
#ifdef HAVE_CPU_PPC
void conv_short_double_ppcasm(short *dest, double *src, int n);
#endif
#ifdef HAVE_CPU_PPC
# define conv_double_short conv_double_short_table
# if 0
/* disabled as in .c */
# define conv_short_double conv_short_double_ppcasm
# else
# define conv_short_double conv_short_double_ref
# endif
#else
# define conv_double_short conv_double_short_ref
# define conv_short_double conv_short_double_ref
#endif
#define conv_double_float conv_double_float_ref
#define conv_float_double conv_float_double_ref
void conv_double_short_dstr(double *dest, short *src, int n, int dstr);
void conv_short_double_sstr(short *dest, double *src, int n, int dstr);
void conv_double_float_ref(double *dest, float *src, int n);
void conv_float_double_ref(float *dest, double *src, int n);
void conv_double_float_dstr(double *dest, float *src, int n, int dstr);
void conv_float_double_sstr(float *dest, double *src, int n, int sstr);
G_END_DECLS
#endif /* __PRIVATE_H__ */

View file

@ -1,929 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David A. Schleef <ds@schleef.org>
*
* 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 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 <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "private.h"
#include <gst/gstplugin.h>
#include <gst/gstversion.h>
inline double
sinc (double x)
{
if (x == 0)
return 1;
return sin (x) / x;
}
inline double
window_func (double x)
{
x = 1 - x * x;
return x * x;
}
signed short
double_to_s16 (double x)
{
if (x < -32768) {
printf ("clipped\n");
return -32768;
}
if (x > 32767) {
printf ("clipped\n");
return -32767;
}
return rint (x);
}
signed short
double_to_s16_ppcasm (double x)
{
if (x < -32768) {
return -32768;
}
if (x > 32767) {
return -32767;
}
return rint (x);
}
void
gst_resample_init (gst_resample_t * r)
{
r->i_start = 0;
if (r->filter_length & 1) {
r->o_start = 0;
} else {
r->o_start = r->o_inc * 0.5;
}
memset (r->acc, 0, sizeof (r->acc));
gst_resample_reinit (r);
}
void
gst_resample_reinit (gst_resample_t * r)
{
/* i_inc is the number of samples that the output increments for
* each input sample. o_inc is the opposite. */
r->i_inc = (double) r->o_rate / r->i_rate;
r->o_inc = (double) r->i_rate / r->o_rate;
r->halftaps = (r->filter_length - 1.0) * 0.5;
if (r->format == GST_RESAMPLE_S16) {
switch (r->method) {
default:
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_s16;
break;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_s16;
break;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_s16;
break;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_s16;
break;
}
} else if (r->format == GST_RESAMPLE_FLOAT) {
switch (r->method) {
default:
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_float;
break;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_float;
break;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_float;
break;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_float;
break;
}
} else {
fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format);
}
}
void
gst_resample_close (gst_resample_t * r)
{
if (r->buffer) {
free (r->buffer);
r->buffer = NULL;
r->buffer_len = 0;
}
if (r->hack_union.s.out_tmp) {
free (r->hack_union.s.out_tmp);
r->hack_union.s.out_tmp = NULL;
r->hack_union.s.out_tmp_len = 0;
}
}
/*
* Prepare to be confused.
*
* We keep a "timebase" that is based on output samples. The zero
* of the timebase cooresponds to the next output sample that will
* be written.
*
* i_start is the "time" that corresponds to the first input sample
* in an incoming buffer. Since the output depends on input samples
* ahead in time, i_start will tend to be around halftaps.
*
* i_start_buf is the time of the first sample in the temporary
* buffer.
*/
void
gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size)
{
int o_size;
r->i_buf = i_buf;
r->i_samples = i_size / 2 / r->channels;
r->i_start_buf = r->i_start - r->filter_length * r->i_inc;
/* i_start is the offset (in a given output sample) that is the
* beginning of the current input buffer */
r->i_end = r->i_start + r->i_inc * r->i_samples;
r->o_samples = floor (r->i_end - r->halftaps * r->i_inc);
o_size = r->o_samples * r->channels * 2;
r->o_buf = r->get_buffer (r->priv, o_size);
if (r->verbose) {
printf ("gst_resample_scale: i_buf=%p i_size=%d\n", i_buf, i_size);
printf ("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
r->i_samples, r->o_samples, r->i_inc, r->o_buf);
printf ("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
r->i_start, r->i_end, r->o_start);
}
if ((r->filter_length + r->i_samples) * sizeof (double) * 2 > r->buffer_len) {
int size = (r->filter_length + r->i_samples) * sizeof (double) * 2;
if (r->verbose) {
printf ("gst_resample temp buffer size=%d\n", size);
}
if (r->buffer)
free (r->buffer);
r->buffer_len = size;
r->buffer = malloc (size);
memset (r->buffer, 0, size);
}
if (r->format == GST_RESAMPLE_S16) {
if (r->channels == 2) {
conv_double_short (r->buffer + r->filter_length * sizeof (double) * 2,
r->i_buf, r->i_samples * 2);
} else {
conv_double_short_dstr (r->buffer +
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
}
} else if (r->format == GST_RESAMPLE_FLOAT) {
if (r->channels == 2) {
conv_double_float (r->buffer + r->filter_length * sizeof (double) * 2,
r->i_buf, r->i_samples * 2);
} else {
conv_double_float_dstr (r->buffer +
r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
sizeof (double) * 2);
}
}
r->scale (r);
memcpy (r->buffer,
r->buffer + r->i_samples * sizeof (double) * 2,
r->filter_length * sizeof (double) * 2);
/* updating times */
r->i_start += r->i_samples * r->i_inc;
r->o_start += r->o_samples * r->o_inc - r->i_samples;
/* adjusting timebase zero */
r->i_start -= r->o_samples;
}
void
gst_resample_nearest_s16 (gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int i_count = 0;
double a;
int i;
i_ptr = (signed short *) r->i_buf;
o_ptr = (signed short *) r->o_buf;
a = r->o_start;
i_count = 0;
#define SCALE_LOOP(COPY,INC) \
for (i = 0; i < r->o_samples; i++) { \
COPY; \
a += r->o_inc; \
while (a >= 1) { \
a -= 1; \
i_ptr+=INC; \
i_count++; \
} \
o_ptr+=INC; \
}
switch (r->channels) {
case 1:
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break;
case 2:
SCALE_LOOP (o_ptr[0] = i_ptr[0];
o_ptr[1] = i_ptr[1], 2);
break;
default:
{
int n, n_chan = r->channels;
SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
}
}
if (i_count != r->i_samples) {
printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
}
}
void
gst_resample_bilinear_s16 (gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int o_count = 0;
double b;
int i;
double acc0, acc1;
i_ptr = (signed short *) r->i_buf;
o_ptr = (signed short *) r->o_buf;
acc0 = r->acc[0];
acc1 = r->acc[1];
b = r->i_start;
for (i = 0; i < r->i_samples; i++) {
b += r->i_inc;
/*printf("in %d\n",i_ptr[0]); */
if (b >= 2) {
printf ("not expecting b>=2\n");
}
if (b >= 1) {
acc0 += (1.0 - (b - r->i_inc)) * i_ptr[0];
acc1 += (1.0 - (b - r->i_inc)) * i_ptr[1];
o_ptr[0] = rint (acc0);
/*printf("out %d\n",o_ptr[0]); */
o_ptr[1] = rint (acc1);
o_ptr += 2;
o_count++;
b -= 1.0;
acc0 = b * i_ptr[0];
acc1 = b * i_ptr[1];
} else {
acc0 += i_ptr[0] * r->i_inc;
acc1 += i_ptr[1] * r->i_inc;
}
i_ptr += 2;
}
r->acc[0] = acc0;
r->acc[1] = acc1;
if (o_count != r->o_samples) {
printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
}
}
void
gst_resample_sinc_slow_s16 (gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int i, j;
double c0, c1;
double a;
int start;
double center;
double weight;
if (!r->buffer) {
int size = r->filter_length * 2 * r->channels;
printf ("gst_resample temp buffer\n");
r->buffer = malloc (size);
memset (r->buffer, 0, size);
}
i_ptr = (signed short *) r->i_buf;
o_ptr = (signed short *) r->o_buf;
a = r->i_start;
#define GETBUF(index,chan) (((index)<0) \
? ((short *)(r->buffer))[((index)+r->filter_length)*2+(chan)] \
: i_ptr[(index)*2+(chan)])
{
double sinx, cosx, sind, cosd;
double x, d;
double t;
for (i = 0; i < r->o_samples; i++) {
start = floor (a) - r->filter_length;
center = a - r->halftaps;
x = M_PI * (start - center) * r->o_inc;
sinx = sin (M_PI * (start - center) * r->o_inc);
cosx = cos (M_PI * (start - center) * r->o_inc);
d = M_PI * r->o_inc;
sind = sin (M_PI * r->o_inc);
cosd = cos (M_PI * r->o_inc);
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
}
o_ptr[0] = rint (c0);
o_ptr[1] = rint (c1);
o_ptr += 2;
a += r->o_inc;
}
}
#undef GETBUF
memcpy (r->buffer,
i_ptr + (r->i_samples - r->filter_length) * r->channels,
r->filter_length * 2 * r->channels);
}
/* only works for channels == 2 ???? */
void
gst_resample_sinc_s16 (gst_resample_t * r)
{
double *ptr;
signed short *o_ptr;
int i, j;
double c0, c1;
double a;
int start;
double center;
double weight;
double x0, x, d;
double scale;
ptr = (double *) r->buffer;
o_ptr = (signed short *) r->o_buf;
/* scale provides a cutoff frequency for the low
* pass filter aspects of sinc(). scale=M_PI
* will cut off at the input frequency, which is
* good for up-sampling, but will cause aliasing
* for downsampling. Downsampling needs to be
* cut off at o_rate, thus scale=M_PI*r->i_inc. */
/* actually, it needs to be M_PI*r->i_inc*r->i_inc.
* Need to research why. */
scale = M_PI * r->i_inc;
for (i = 0; i < r->o_samples; i++) {
a = r->o_start + i * r->o_inc;
start = floor (a - r->halftaps);
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
center = a;
/*x = M_PI * (start - center) * r->o_inc; */
/*d = M_PI * r->o_inc; */
/*x = (start - center) * r->o_inc; */
x0 = (start - center) * r->o_inc;
d = r->o_inc;
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
x = x0 + d * j;
weight = sinc (x * scale * r->i_inc) * scale / M_PI;
weight *= window_func (x / r->halftaps * r->i_inc);
c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
}
o_ptr[0] = double_to_s16 (c0);
o_ptr[1] = double_to_s16 (c1);
o_ptr += 2;
}
}
/*
* Resampling audio is best done using a sinc() filter.
*
*
* out[t] = Sum( in[t'] * sinc((t-t')/delta_t), all t')
*
* The immediate problem with this algorithm is that it involves a
* sum over an infinite number of input samples, both in the past
* and future. Note that even though sinc(x) is bounded by 1/x,
* and thus decays to 0 for large x, since sum(x,{x=0,1..,n}) diverges
* as log(n), we need to be careful about convergence. This is
* typically done by using a windowing function, which also makes
* the sum over a finite number of input samples.
*
* The next problem is computational: sinc(), and especially
* sinc() multiplied by a non-trivial windowing function is expensive
* to calculate, and also difficult to find SIMD optimizations. Since
* the time increment on input and output is different, it is not
* possible to use a FIR filter, because the taps would have to be
* recalculated for every t.
*
* To get around the expense of calculating sinc() for every point,
* we pre-calculate sinc() at a number of points, and then interpolate
* for the values we want in calculations. The interpolation method
* chosen is bi-cubic, which requires both the evalated function and
* its derivative at every pre-sampled point. Also, if the sampled
* points are spaced commensurate with the input delta_t, we notice
* that the interpolating weights are the same for every input point.
* This decreases the number of operations to 4 multiplies and 4 adds
* for each tap, regardless of the complexity of the filtering function.
*
* At this point, it is possible to rearrange the problem as the sum
* of 4 properly weghted FIR filters. Typical SIMD computation units
* are highly optimized for FIR filters, making long filter lengths
* reasonable.
*/
static functable_t *ft;
void
gst_resample_sinc_ft_s16 (gst_resample_t * r)
{
double *ptr;
signed short *o_ptr;
int i;
/*int j; */
double c0, c1;
/*double a; */
double start_f, start_x;
int start;
double center;
/*double weight; */
double x, d;
double scale;
int n = 4;
double *out_tmp;
if (r->hack_union.s.out_tmp_len < r->o_samples) {
r->hack_union.s.out_tmp = realloc (r->hack_union.s.out_tmp,
r->o_samples * 2 * sizeof (double));
r->hack_union.s.out_tmp_len = r->o_samples;
}
out_tmp = r->hack_union.s.out_tmp;
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
/*scale = r->i_inc * 0.5; // cutoff at 11025 */
if (!ft) {
ft = malloc (sizeof (*ft));
memset (ft, 0, sizeof (*ft));
ft->len = (r->filter_length + 2) * n;
ft->offset = 1.0 / n;
ft->start = -ft->len * 0.5 * ft->offset;
ft->func_x = functable_sinc;
ft->func_dx = functable_dsinc;
ft->scale = M_PI * scale;
ft->func2_x = functable_window_std;
ft->func2_dx = functable_window_dstd;
ft->scale2 = 1.0 / r->halftaps;
functable_init (ft);
/*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
}
ptr = r->buffer;
o_ptr = (signed short *) r->o_buf;
center = r->o_start;
while (center - r->halftaps < -1 * r->filter_length)
center += 1.0;
start_x = center - r->halftaps;
start_f = floor (start_x);
start_x -= start_f;
start = start_f;
for (i = 0; i < r->o_samples; i++) {
/*start_f = floor(center - r->halftaps); */
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
x = start_f - center;
d = 1;
c0 = 0;
c1 = 0;
/*#define slow */
#ifdef slow
for (j = 0; j < r->filter_length; j++) {
weight = functable_eval (ft, x) * scale;
/*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
/*weight *= window_func(x / r->halftaps); */
c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
x += d;
}
#else
functable_fir2 (ft,
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
c0 *= scale;
c1 *= scale;
#endif
out_tmp[2 * i + 0] = c0;
out_tmp[2 * i + 1] = c1;
center += r->o_inc;
start_x += r->o_inc;
while (start_x >= 1.0) {
start_f++;
start_x -= 1.0;
start++;
}
}
if (r->channels == 2) {
conv_short_double (r->o_buf, out_tmp, 2 * r->o_samples);
} else {
conv_short_double_sstr (r->o_buf, out_tmp, r->o_samples,
2 * sizeof (double));
}
}
/********
** float code below
********/
void
gst_resample_nearest_float (gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int i_count = 0;
double a;
int i;
i_ptr = (float *) r->i_buf;
o_ptr = (float *) r->o_buf;
a = r->o_start;
i_count = 0;
#define SCALE_LOOP(COPY,INC) \
for (i = 0; i < r->o_samples; i++) { \
COPY; \
a += r->o_inc; \
while (a >= 1) { \
a -= 1; \
i_ptr+=INC; \
i_count++; \
} \
o_ptr+=INC; \
}
switch (r->channels) {
case 1:
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break;
case 2:
SCALE_LOOP (o_ptr[0] = i_ptr[0];
o_ptr[1] = i_ptr[1], 2);
break;
default:
{
int n, n_chan = r->channels;
SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
}
}
if (i_count != r->i_samples) {
printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
}
}
void
gst_resample_bilinear_float (gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int o_count = 0;
double b;
int i;
double acc0, acc1;
i_ptr = (float *) r->i_buf;
o_ptr = (float *) r->o_buf;
acc0 = r->acc[0];
acc1 = r->acc[1];
b = r->i_start;
for (i = 0; i < r->i_samples; i++) {
b += r->i_inc;
/*printf("in %d\n",i_ptr[0]); */
if (b >= 2) {
printf ("not expecting b>=2\n");
}
if (b >= 1) {
acc0 += (1.0 - (b - r->i_inc)) * i_ptr[0];
acc1 += (1.0 - (b - r->i_inc)) * i_ptr[1];
o_ptr[0] = acc0;
/*printf("out %d\n",o_ptr[0]); */
o_ptr[1] = acc1;
o_ptr += 2;
o_count++;
b -= 1.0;
acc0 = b * i_ptr[0];
acc1 = b * i_ptr[1];
} else {
acc0 += i_ptr[0] * r->i_inc;
acc1 += i_ptr[1] * r->i_inc;
}
i_ptr += 2;
}
r->acc[0] = acc0;
r->acc[1] = acc1;
if (o_count != r->o_samples) {
printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
}
}
void
gst_resample_sinc_slow_float (gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int i, j;
double c0, c1;
double a;
int start;
double center;
double weight;
if (!r->buffer) {
int size = r->filter_length * sizeof (float) * r->channels;
printf ("gst_resample temp buffer\n");
r->buffer = malloc (size);
memset (r->buffer, 0, size);
}
i_ptr = (float *) r->i_buf;
o_ptr = (float *) r->o_buf;
a = r->i_start;
#define GETBUF(index,chan) (((index)<0) \
? ((float *)(r->buffer))[((index)+r->filter_length)*2+(chan)] \
: i_ptr[(index)*2+(chan)])
{
double sinx, cosx, sind, cosd;
double x, d;
double t;
for (i = 0; i < r->o_samples; i++) {
start = floor (a) - r->filter_length;
center = a - r->halftaps;
x = M_PI * (start - center) * r->o_inc;
sinx = sin (M_PI * (start - center) * r->o_inc);
cosx = cos (M_PI * (start - center) * r->o_inc);
d = M_PI * r->o_inc;
sind = sin (M_PI * r->o_inc);
cosd = cos (M_PI * r->o_inc);
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
c0 += weight * GETBUF ((start + j), 0);
c1 += weight * GETBUF ((start + j), 1);
t = cosx * cosd - sinx * sind;
sinx = cosx * sind + sinx * cosd;
cosx = t;
x += d;
}
o_ptr[0] = c0;
o_ptr[1] = c1;
o_ptr += 2;
a += r->o_inc;
}
}
#undef GETBUF
memcpy (r->buffer,
i_ptr + (r->i_samples - r->filter_length) * r->channels,
r->filter_length * sizeof (float) * r->channels);
}
/* only works for channels == 2 ???? */
void
gst_resample_sinc_float (gst_resample_t * r)
{
double *ptr;
float *o_ptr;
int i, j;
double c0, c1;
double a;
int start;
double center;
double weight;
double x0, x, d;
double scale;
ptr = (double *) r->buffer;
o_ptr = (float *) r->o_buf;
/* scale provides a cutoff frequency for the low
* pass filter aspects of sinc(). scale=M_PI
* will cut off at the input frequency, which is
* good for up-sampling, but will cause aliasing
* for downsampling. Downsampling needs to be
* cut off at o_rate, thus scale=M_PI*r->i_inc. */
/* actually, it needs to be M_PI*r->i_inc*r->i_inc.
* Need to research why. */
scale = M_PI * r->i_inc;
for (i = 0; i < r->o_samples; i++) {
a = r->o_start + i * r->o_inc;
start = floor (a - r->halftaps);
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
center = a;
/*x = M_PI * (start - center) * r->o_inc; */
/*d = M_PI * r->o_inc; */
/*x = (start - center) * r->o_inc; */
x0 = (start - center) * r->o_inc;
d = r->o_inc;
c0 = 0;
c1 = 0;
for (j = 0; j < r->filter_length; j++) {
x = x0 + d * j;
weight = sinc (x * scale * r->i_inc) * scale / M_PI;
weight *= window_func (x / r->halftaps * r->i_inc);
c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
}
o_ptr[0] = c0;
o_ptr[1] = c1;
o_ptr += 2;
}
}
void
gst_resample_sinc_ft_float (gst_resample_t * r)
{
double *ptr;
float *o_ptr;
int i;
/*int j; */
double c0, c1;
/*double a; */
double start_f, start_x;
int start;
double center;
/*double weight; */
double x, d;
double scale;
int n = 4;
double *out_tmp;
if (r->hack_union.s.out_tmp_len < r->o_samples) {
r->hack_union.s.out_tmp = realloc (r->hack_union.s.out_tmp,
r->o_samples * 2 * sizeof (double));
r->hack_union.s.out_tmp_len = r->o_samples;
}
out_tmp = r->hack_union.s.out_tmp;
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
/*scale = r->i_inc * 0.5; // cutoff at 11025 */
if (!ft) {
ft = malloc (sizeof (*ft));
memset (ft, 0, sizeof (*ft));
ft->len = (r->filter_length + 2) * n;
ft->offset = 1.0 / n;
ft->start = -ft->len * 0.5 * ft->offset;
ft->func_x = functable_sinc;
ft->func_dx = functable_dsinc;
ft->scale = M_PI * scale;
ft->func2_x = functable_window_std;
ft->func2_dx = functable_window_dstd;
ft->scale2 = 1.0 / r->halftaps;
functable_init (ft);
/*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
}
ptr = r->buffer;
o_ptr = (float *) r->o_buf;
center = r->o_start;
start_x = center - r->halftaps;
start_f = floor (start_x);
start_x -= start_f;
start = start_f;
for (i = 0; i < r->o_samples; i++) {
/*start_f = floor(center - r->halftaps); */
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
x = start_f - center;
d = 1;
c0 = 0;
c1 = 0;
/*#define slow */
#ifdef slow
for (j = 0; j < r->filter_length; j++) {
weight = functable_eval (ft, x) * scale;
/*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
/*weight *= window_func(x / r->halftaps); */
c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
x += d;
}
#else
functable_fir2 (ft,
&c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
c0 *= scale;
c1 *= scale;
#endif
out_tmp[2 * i + 0] = c0;
out_tmp[2 * i + 1] = c1;
center += r->o_inc;
start_x += r->o_inc;
while (start_x >= 1.0) {
start_f++;
start_x -= 1.0;
start++;
}
}
if (r->channels == 2) {
conv_float_double (r->o_buf, out_tmp, 2 * r->o_samples);
} else {
conv_float_double_sstr (r->o_buf, out_tmp, r->o_samples,
2 * sizeof (double));
}
}
static gboolean
plugin_init (GstPlugin * plugin)
{
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gstresample",
"Resampling routines for use in audio plugins",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);

View file

@ -1,111 +0,0 @@
/* Resampling library
* Copyright (C) <2001> David Schleef <ds@schleef.org>
*
* 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 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_RESAMPLE_H__
#define __GST_RESAMPLE_H__
#include <glib.h>
G_BEGIN_DECLS
typedef enum {
GST_RESAMPLE_NEAREST = 0,
GST_RESAMPLE_BILINEAR,
GST_RESAMPLE_SINC_SLOW,
GST_RESAMPLE_SINC,
} gst_resample_method;
typedef enum {
GST_RESAMPLE_S16 = 0,
GST_RESAMPLE_FLOAT
} gst_resample_format;
typedef struct gst_resample_s gst_resample_t;
struct gst_resample_s {
/* parameters */
gst_resample_method method;
int channels;
int verbose;
gst_resample_format format;
int filter_length;
double i_rate;
double o_rate;
void *priv;
void *(*get_buffer)(void *priv, unsigned int size);
/* internal parameters */
double halftaps;
/* filter state */
void *buffer;
int buffer_len;
double i_start;
double o_start;
double i_start_buf;
double i_end_buf;
double i_inc;
double o_inc;
double i_end;
double o_end;
int i_samples;
int o_samples;
void *i_buf, *o_buf;
double acc[2];
union {
struct {
double *out_tmp;
int out_tmp_len;
} s;
double padding[8];
} hack_union;
/* methods */
void (*scale)(gst_resample_t *r);
double ack;
};
void gst_resample_init(gst_resample_t *r);
void gst_resample_reinit(gst_resample_t *r);
void gst_resample_close (gst_resample_t * r);
void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size);
G_END_DECLS
#endif /* __GST_RESAMPLE_H__ */

View file

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="resample"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D6789B}"
RootNamespace="resample"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstresample.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="resample.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/resample.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstresample.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstresample.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="resample.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstresample.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\resample.c">
</File>
<File
RelativePath=".\dtos.c">
</File>
<File
RelativePath=".\dtof.c">
</File>
<File
RelativePath=".\functable.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\resample.h">
</File>
<File
RelativePath=".\private.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,375 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <resample.h>
#define AMP 16000
#define I_RATE 48000
#define O_RATE 44100
/*#define O_RATE 24000 */
/*#define test_func(x) 1 */
/*#define test_func(x) sin(2*M_PI*(x)*10) */
/*#define test_func(x) sin(2*M_PI*(x)*(x)*1000) */
#define test_func(x) sin(2*M_PI*(x)*(x)*12000)
short i_buf[I_RATE * 2 * 2];
short o_buf[O_RATE * 2 * 2];
static int i_offset;
static int o_offset;
FILE *out;
void test_res1 (void);
void test_res2 (void);
void test_res3 (void);
void test_res4 (void);
void test_res5 (void);
void test_res6 (void);
void test_res7 (void);
int
main (int argc, char *argv[])
{
out = fopen ("out", "w");
test_res7 ();
return 0;
}
void *
get_buffer (void *priv, unsigned int size)
{
void *ret;
ret = ((void *) o_buf) + o_offset;
o_offset += size;
return ret;
}
struct timeval start_time;
void
start_timer (void)
{
gettimeofday (&start_time, NULL);
/*printf("start %ld.%06ld\n",start_time.tv_sec,start_time.tv_usec); */
}
void
end_timer (void)
{
struct timeval end_time;
double diff;
gettimeofday (&end_time, NULL);
/*printf("end %ld.%06ld\n",end_time.tv_sec,end_time.tv_usec); */
diff = (end_time.tv_sec - start_time.tv_sec) +
1e-6 * (end_time.tv_usec - start_time.tv_usec);
printf ("time %g\n", diff);
}
void
test_res1 (void)
{
resample_t *r;
int i;
double sum10k, sum22k;
double f;
int n10k, n22k;
double x;
for (i = 0; i < I_RATE; i++) {
i_buf[i * 2 + 0] = rint (AMP * test_func ((double) i / I_RATE));
/*i_buf[i*2+1] = rint(AMP * test_func((double)i/I_RATE)); */
i_buf[i * 2 + 1] = (i < 1000) ? AMP : 0;
}
r = malloc (sizeof (resample_t));
memset (r, 0, sizeof (resample_t));
r->i_rate = I_RATE;
r->o_rate = O_RATE;
/*r->method = RESAMPLE_SINC_SLOW; */
r->method = RESAMPLE_SINC;
r->channels = 2;
/*r->verbose = 1; */
r->filter_length = 64;
r->get_buffer = get_buffer;
resample_init (r);
start_timer ();
#define blocked
#ifdef blocked
for (i = 0; i + 256 < I_RATE; i += 256) {
resample_scale (r, i_buf + i * 2, 256 * 2 * 2);
}
if (I_RATE - i) {
resample_scale (r, i_buf + i * 2, (I_RATE - i) * 2 * 2);
}
#else
resample_scale (r, i_buf, I_RATE * 2 * 2);
#endif
end_timer ();
for (i = 0; i < O_RATE; i++) {
f = AMP * test_func ((double) i / O_RATE);
/*f = rint(AMP*test_func((double)i/O_RATE)); */
fprintf (out, "%d %d %d %g %g\n", i,
o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f);
}
sum10k = 0;
sum22k = 0;
n10k = 0;
n22k = 0;
for (i = 0; i < O_RATE; i++) {
f = AMP * test_func ((double) i / O_RATE);
/*f = rint(AMP*test_func((double)i/O_RATE)); */
x = o_buf[2 * i + 0] - f;
if (((0.5 * i) / O_RATE * I_RATE) < 10000) {
sum10k += x * x;
n10k++;
}
if (((0.5 * i) / O_RATE * I_RATE) < 22050) {
sum22k += x * x;
n22k++;
}
}
printf ("average error 10k=%g 22k=%g\n",
sqrt (sum10k / n10k), sqrt (sum22k / n22k));
}
void
test_res2 (void)
{
functable_t *t;
int i;
double x;
double f1, f2;
t = malloc (sizeof (*t));
memset (t, 0, sizeof (*t));
t->start = -50.0;
t->offset = 1;
t->len = 100;
t->func_x = functable_sinc;
t->func_dx = functable_dsinc;
functable_init (t);
for (i = 0; i < 1000; i++) {
x = -50.0 + 0.1 * i;
f1 = functable_sinc (NULL, x);
f2 = functable_eval (t, x);
fprintf (out, "%d %g %g %g\n", i, f1, f2, f1 - f2);
}
}
void
test_res3 (void)
{
functable_t *t;
int i;
double x;
double f1, f2;
int n = 1;
t = malloc (sizeof (*t));
memset (t, 0, sizeof (*t));
t->start = -50.0;
t->offset = 1.0 / n;
t->len = 100 * n;
t->func_x = functable_sinc;
t->func_dx = functable_dsinc;
t->func2_x = functable_window_std;
t->func2_dx = functable_window_dstd;
t->scale = 1.0;
t->scale2 = 1.0 / (M_PI * 16);
functable_init (t);
for (i = 0; i < 1000 * n; i++) {
x = -50.0 + 0.1 / n * i;
f1 = functable_sinc (NULL, t->scale * x) *
functable_window_std (NULL, t->scale2 * x);
f2 = functable_eval (t, x);
fprintf (out, "%d %g %g %g\n", i, f1, f2, f2 - f1);
}
}
double
sinc_poly (double x)
{
#define INV3FAC 1.66666666666666666e-1
#define INV5FAC 8.33333333333333333e-3
#define INV7FAC 1.984126984e-4
#define INV9FAC 2.755731922e-6
#define INV11FAC 2.505210839e-8
double x2 = x * x;
return 1 - x2 * INV3FAC + x2 * x2 * INV5FAC - x2 * x2 * x2 * INV7FAC;
/*+ x2 * x2 * x2 * x2 * INV9FAC */
/*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */
}
void
test_res4 (void)
{
int i;
double x, f1, f2;
for (i = 1; i < 100; i++) {
x = 0.01 * i;
f1 = 1 - sin (x) / x;
f2 = 1 - sinc_poly (x);
fprintf (out, "%g %.20g %.20g %.20g\n", x, f1, f2, f2 - f1);
}
}
void
test_res5 (void)
{
int i;
double sum;
start_timer ();
sum = 0;
for (i = 0; i < I_RATE; i++) {
sum += i_buf[i * 2];
}
end_timer ();
i_buf[0] = sum;
}
void
short_to_double (double *d, short *x)
{
*d = *x;
}
void
short_to_float (float *f, short *x)
{
*f = *x;
}
void
float_to_double (double *f, float *x)
{
*f = *x;
}
void
double_to_short (short *f, double *x)
{
*f = *x;
}
double res6_tmp[1000];
void
test_res6 (void)
{
int i;
for (i = 0; i < I_RATE; i++) {
i_buf[i] = rint (AMP * test_func ((double) i / I_RATE));
}
conv_double_short_ref (res6_tmp, i_buf, 1000);
for (i = 0; i < 1000; i++) {
res6_tmp[i] *= 3.0;
}
conv_short_double_ppcasm (o_buf, res6_tmp, 1000);
for (i = 0; i < 1000; i++) {
fprintf (out, "%d %d %g %d\n", i, i_buf[i], res6_tmp[i], o_buf[i]);
}
}
void
test_res7 (void)
{
resample_t *r;
int i;
double sum10k, sum22k;
double f;
int n10k, n22k;
double x;
for (i = 0; i < I_RATE; i++) {
i_buf[i] = rint (AMP * test_func ((double) i / I_RATE));
}
r = malloc (sizeof (resample_t));
memset (r, 0, sizeof (resample_t));
r->i_rate = I_RATE;
r->o_rate = O_RATE;
/*r->method = RESAMPLE_SINC_SLOW; */
r->method = RESAMPLE_SINC;
r->channels = 1;
/*r->verbose = 1; */
r->filter_length = 64;
r->get_buffer = get_buffer;
resample_init (r);
start_timer ();
#define blocked
#ifdef blocked
for (i = 0; i + 256 < I_RATE; i += 256) {
resample_scale (r, i_buf + i, 256 * 2);
}
if (I_RATE - i) {
resample_scale (r, i_buf + i, (I_RATE - i) * 2);
}
#else
resample_scale (r, i_buf, I_RATE * 2);
#endif
end_timer ();
for (i = 0; i < O_RATE; i++) {
f = AMP * test_func ((double) i / O_RATE);
/*f = rint(AMP*test_func((double)i/O_RATE)); */
fprintf (out, "%d %d %d %g %g\n", i, o_buf[i], 0, f, o_buf[i] - f);
}
sum10k = 0;
sum22k = 0;
n10k = 0;
n22k = 0;
for (i = 0; i < O_RATE; i++) {
f = AMP * test_func ((double) i / O_RATE);
/*f = rint(AMP*test_func((double)i/O_RATE)); */
x = o_buf[i] - f;
if (((0.5 * i) / O_RATE * I_RATE) < 10000) {
sum10k += x * x;
n10k++;
}
if (((0.5 * i) / O_RATE * I_RATE) < 22050) {
sum22k += x * x;
n22k++;
}
}
printf ("average error 10k=%g 22k=%g\n",
sqrt (sum10k / n10k), sqrt (sum22k / n22k));
}

View file

@ -1,16 +0,0 @@
plugin_LTLIBRARIES = libgstriff.la
libgstriff_la_SOURCES = \
riff.c \
riff-media.c \
riff-read.c
libgstriffincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/riff
libgstriffinclude_HEADERS = \
riff-ids.h \
riff-media.h \
riff-read.h
libgstriff_la_LIBADD =
libgstriff_la_CFLAGS = $(GST_CFLAGS)
libgstriff_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)

View file

@ -1,335 +0,0 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-ids.h: RIFF IDs and structs
*
* 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_RIFF_IDS_H__
#define __GST_RIFF_IDS_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* RIFF types */
#define GST_RIFF_RIFF_WAVE GST_MAKE_FOURCC ('W','A','V','E')
#define GST_RIFF_RIFF_AVI GST_MAKE_FOURCC ('A','V','I',' ')
#define GST_RIFF_RIFF_CDXA GST_MAKE_FOURCC ('C','D','X','A')
/* tags */
#define GST_RIFF_TAG_RIFF GST_MAKE_FOURCC ('R','I','F','F')
#define GST_RIFF_TAG_RIFX GST_MAKE_FOURCC ('R','I','F','X')
#define GST_RIFF_TAG_LIST GST_MAKE_FOURCC ('L','I','S','T')
#define GST_RIFF_TAG_avih GST_MAKE_FOURCC ('a','v','i','h')
#define GST_RIFF_TAG_strd GST_MAKE_FOURCC ('s','t','r','d')
#define GST_RIFF_TAG_strn GST_MAKE_FOURCC ('s','t','r','n')
#define GST_RIFF_TAG_strh GST_MAKE_FOURCC ('s','t','r','h')
#define GST_RIFF_TAG_strf GST_MAKE_FOURCC ('s','t','r','f')
#define GST_RIFF_TAG_vedt GST_MAKE_FOURCC ('v','e','d','t')
#define GST_RIFF_TAG_JUNK GST_MAKE_FOURCC ('J','U','N','K')
#define GST_RIFF_TAG_idx1 GST_MAKE_FOURCC ('i','d','x','1')
#define GST_RIFF_TAG_dmlh GST_MAKE_FOURCC ('d','m','l','h')
/* WAV stuff */
#define GST_RIFF_TAG_fmt GST_MAKE_FOURCC ('f','m','t',' ')
#define GST_RIFF_TAG_data GST_MAKE_FOURCC ('d','a','t','a')
#define GST_RIFF_TAG_plst GST_MAKE_FOURCC ('p','l','s','t')
#define GST_RIFF_TAG_cue GST_MAKE_FOURCC ('c','u','e',' ')
/* LIST types */
#define GST_RIFF_LIST_movi GST_MAKE_FOURCC ('m','o','v','i')
#define GST_RIFF_LIST_hdrl GST_MAKE_FOURCC ('h','d','r','l')
#define GST_RIFF_LIST_odml GST_MAKE_FOURCC ('o','d','m','l')
#define GST_RIFF_LIST_strl GST_MAKE_FOURCC ('s','t','r','l')
#define GST_RIFF_LIST_INFO GST_MAKE_FOURCC ('I','N','F','O')
#define GST_RIFF_LIST_AVIX GST_MAKE_FOURCC ('A','V','I','X')
#define GST_RIFF_LIST_adtl GST_MAKE_FOURCC ('a','d','t','l')
/* fcc types */
#define GST_RIFF_FCC_vids GST_MAKE_FOURCC ('v','i','d','s')
#define GST_RIFF_FCC_auds GST_MAKE_FOURCC ('a','u','d','s')
#define GST_RIFF_FCC_pads GST_MAKE_FOURCC ('p','a','d','s')
#define GST_RIFF_FCC_txts GST_MAKE_FOURCC ('t','x','t','s')
#define GST_RIFF_FCC_vidc GST_MAKE_FOURCC ('v','i','d','c')
#define GST_RIFF_FCC_iavs GST_MAKE_FOURCC ('i','a','v','s')
/* fcc handlers */
#define GST_RIFF_FCCH_RLE GST_MAKE_FOURCC ('R','L','E',' ')
#define GST_RIFF_FCCH_msvc GST_MAKE_FOURCC ('m','s','v','c')
#define GST_RIFF_FCCH_MSVC GST_MAKE_FOURCC ('M','S','V','C')
/* INFO types - see http://www.saettler.com/RIFFMCI/riffmci.html */
#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */
#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */
#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */
#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */
#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */
#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */
#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */
#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */
#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */
#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */
#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */
#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */
#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */
#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */
#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */
#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */
#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */
#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */
#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */
#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */
#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */
#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */
#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */
/*********Chunk Names***************/
#define GST_RIFF_FF00 GST_MAKE_FOURCC (0xFF,0xFF,0x00,0x00)
#define GST_RIFF_00 GST_MAKE_FOURCC ('0', '0',0x00,0x00)
#define GST_RIFF_01 GST_MAKE_FOURCC ('0', '1',0x00,0x00)
#define GST_RIFF_02 GST_MAKE_FOURCC ('0', '2',0x00,0x00)
#define GST_RIFF_03 GST_MAKE_FOURCC ('0', '3',0x00,0x00)
#define GST_RIFF_04 GST_MAKE_FOURCC ('0', '4',0x00,0x00)
#define GST_RIFF_05 GST_MAKE_FOURCC ('0', '5',0x00,0x00)
#define GST_RIFF_06 GST_MAKE_FOURCC ('0', '6',0x00,0x00)
#define GST_RIFF_07 GST_MAKE_FOURCC ('0', '7',0x00,0x00)
#define GST_RIFF_00pc GST_MAKE_FOURCC ('0', '0', 'p', 'c')
#define GST_RIFF_01pc GST_MAKE_FOURCC ('0', '1', 'p', 'c')
#define GST_RIFF_00dc GST_MAKE_FOURCC ('0', '0', 'd', 'c')
#define GST_RIFF_00dx GST_MAKE_FOURCC ('0', '0', 'd', 'x')
#define GST_RIFF_00db GST_MAKE_FOURCC ('0', '0', 'd', 'b')
#define GST_RIFF_00xx GST_MAKE_FOURCC ('0', '0', 'x', 'x')
#define GST_RIFF_00id GST_MAKE_FOURCC ('0', '0', 'i', 'd')
#define GST_RIFF_00rt GST_MAKE_FOURCC ('0', '0', 'r', 't')
#define GST_RIFF_0021 GST_MAKE_FOURCC ('0', '0', '2', '1')
#define GST_RIFF_00iv GST_MAKE_FOURCC ('0', '0', 'i', 'v')
#define GST_RIFF_0031 GST_MAKE_FOURCC ('0', '0', '3', '1')
#define GST_RIFF_0032 GST_MAKE_FOURCC ('0', '0', '3', '2')
#define GST_RIFF_00vc GST_MAKE_FOURCC ('0', '0', 'v', 'c')
#define GST_RIFF_00xm GST_MAKE_FOURCC ('0', '0', 'x', 'm')
#define GST_RIFF_01wb GST_MAKE_FOURCC ('0', '1', 'w', 'b')
#define GST_RIFF_01dc GST_MAKE_FOURCC ('0', '1', 'd', 'c')
#define GST_RIFF_00__ GST_MAKE_FOURCC ('0', '0', '_', '_')
/*********VIDEO CODECS**************/
#define GST_RIFF_cram GST_MAKE_FOURCC ('c', 'r', 'a', 'm')
#define GST_RIFF_CRAM GST_MAKE_FOURCC ('C', 'R', 'A', 'M')
#define GST_RIFF_wham GST_MAKE_FOURCC ('w', 'h', 'a', 'm')
#define GST_RIFF_WHAM GST_MAKE_FOURCC ('W', 'H', 'A', 'M')
#define GST_RIFF_rgb GST_MAKE_FOURCC (0x00,0x00,0x00,0x00)
#define GST_RIFF_RGB GST_MAKE_FOURCC ('R', 'G', 'B', ' ')
#define GST_RIFF_rle8 GST_MAKE_FOURCC (0x01,0x00,0x00,0x00)
#define GST_RIFF_RLE8 GST_MAKE_FOURCC ('R', 'L', 'E', '8')
#define GST_RIFF_rle4 GST_MAKE_FOURCC (0x02,0x00,0x00,0x00)
#define GST_RIFF_RLE4 GST_MAKE_FOURCC ('R', 'L', 'E', '4')
#define GST_RIFF_none GST_MAKE_FOURCC (0x00,0x00,0xFF,0xFF)
#define GST_RIFF_NONE GST_MAKE_FOURCC ('N', 'O', 'N', 'E')
#define GST_RIFF_pack GST_MAKE_FOURCC (0x01,0x00,0xFF,0xFF)
#define GST_RIFF_PACK GST_MAKE_FOURCC ('P', 'A', 'C', 'K')
#define GST_RIFF_tran GST_MAKE_FOURCC (0x02,0x00,0xFF,0xFF)
#define GST_RIFF_TRAN GST_MAKE_FOURCC ('T', 'R', 'A', 'N')
#define GST_RIFF_ccc GST_MAKE_FOURCC (0x03,0x00,0xFF,0xFF)
#define GST_RIFF_CCC GST_MAKE_FOURCC ('C', 'C', 'C', ' ')
#define GST_RIFF_cyuv GST_MAKE_FOURCC ('c', 'y', 'u', 'v')
#define GST_RIFF_CYUV GST_MAKE_FOURCC ('C', 'Y', 'U', 'V')
#define GST_RIFF_jpeg GST_MAKE_FOURCC (0x04,0x00,0xFF,0xFF)
#define GST_RIFF_JPEG GST_MAKE_FOURCC ('J', 'P', 'E', 'G')
#define GST_RIFF_MJPG GST_MAKE_FOURCC ('M', 'J', 'P', 'G')
#define GST_RIFF_mJPG GST_MAKE_FOURCC ('m', 'J', 'P', 'G')
#define GST_RIFF_IJPG GST_MAKE_FOURCC ('I', 'J', 'P', 'G')
#define GST_RIFF_rt21 GST_MAKE_FOURCC ('r', 't', '2', '1')
#define GST_RIFF_RT21 GST_MAKE_FOURCC ('R', 'T', '2', '1')
#define GST_RIFF_iv31 GST_MAKE_FOURCC ('i', 'v', '3', '1')
#define GST_RIFF_IV31 GST_MAKE_FOURCC ('I', 'V', '3', '1')
#define GST_RIFF_iv32 GST_MAKE_FOURCC ('i', 'v', '3', '2')
#define GST_RIFF_IV32 GST_MAKE_FOURCC ('I', 'V', '3', '2')
#define GST_RIFF_iv41 GST_MAKE_FOURCC ('i', 'v', '4', '1')
#define GST_RIFF_IV41 GST_MAKE_FOURCC ('I', 'V', '4', '1')
#define GST_RIFF_iv50 GST_MAKE_FOURCC ('i', 'v', '5', '0')
#define GST_RIFF_IV50 GST_MAKE_FOURCC ('I', 'V', '5', '0')
#define GST_RIFF_cvid GST_MAKE_FOURCC ('c', 'v', 'i', 'd')
#define GST_RIFF_CVID GST_MAKE_FOURCC ('C', 'V', 'I', 'D')
#define GST_RIFF_ULTI GST_MAKE_FOURCC ('U', 'L', 'T', 'I')
#define GST_RIFF_ulti GST_MAKE_FOURCC ('u', 'l', 't', 'i')
#define GST_RIFF_YUV9 GST_MAKE_FOURCC ('Y', 'V', 'U', '9')
#define GST_RIFF_YVU9 GST_MAKE_FOURCC ('Y', 'U', 'V', '9')
#define GST_RIFF_XMPG GST_MAKE_FOURCC ('X', 'M', 'P', 'G')
#define GST_RIFF_xmpg GST_MAKE_FOURCC ('x', 'm', 'p', 'g')
#define GST_RIFF_VDOW GST_MAKE_FOURCC ('V', 'D', 'O', 'W')
#define GST_RIFF_MVI1 GST_MAKE_FOURCC ('M', 'V', 'I', '1')
#define GST_RIFF_v422 GST_MAKE_FOURCC ('v', '4', '2', '2')
#define GST_RIFF_V422 GST_MAKE_FOURCC ('V', '4', '2', '2')
#define GST_RIFF_mvi1 GST_MAKE_FOURCC ('m', 'v', 'i', '1')
#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */
#define GST_RIFF_AURA GST_MAKE_FOURCC ('A', 'U', 'R', 'A')
#define GST_RIFF_DMB1 GST_MAKE_FOURCC ('D', 'M', 'B', '1')
#define GST_RIFF_dmb1 GST_MAKE_FOURCC ('d', 'm', 'b', '1')
#define GST_RIFF_BW10 GST_MAKE_FOURCC ('B', 'W', '1', '0')
#define GST_RIFF_bw10 GST_MAKE_FOURCC ('b', 'w', '1', '0')
#define GST_RIFF_yuy2 GST_MAKE_FOURCC ('y', 'u', 'y', '2')
#define GST_RIFF_YUY2 GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')
#define GST_RIFF_YUV8 GST_MAKE_FOURCC ('Y', 'U', 'V', '8')
#define GST_RIFF_WINX GST_MAKE_FOURCC ('W', 'I', 'N', 'X')
#define GST_RIFF_WPY2 GST_MAKE_FOURCC ('W', 'P', 'Y', '2')
#define GST_RIFF_m263 GST_MAKE_FOURCC ('m', '2', '6', '3')
#define GST_RIFF_M263 GST_MAKE_FOURCC ('M', '2', '6', '3')
#define GST_RIFF_H263 GST_MAKE_FOURCC ('H', '2', '6', '3')
#define GST_RIFF_i263 GST_MAKE_FOURCC ('i', '2', '6', '3')
#define GST_RIFF_L263 GST_MAKE_FOURCC ('L', '2', '6', '3')
#define GST_RIFF_x263 GST_MAKE_FOURCC ('x', '2', '6', '3')
#define GST_RIFF_VSSH GST_MAKE_FOURCC ( 'V', 'S', 'S', 'H') /* H2.64 */
#define GST_RIFF_Q1_0 GST_MAKE_FOURCC ('Q', '1',0x2e, '0')
#define GST_RIFF_SFMC GST_MAKE_FOURCC ('S', 'F', 'M', 'C')
#define GST_RIFF_y41p GST_MAKE_FOURCC ('y', '4', '1', 'p')
#define GST_RIFF_Y41P GST_MAKE_FOURCC ('Y', '4', '1', 'P')
#define GST_RIFF_yv12 GST_MAKE_FOURCC ('y', 'v', '1', '2')
#define GST_RIFF_YV12 GST_MAKE_FOURCC ('Y', 'V', '1', '2')
#define GST_RIFF_vixl GST_MAKE_FOURCC ('v', 'i', 'x', 'l')
#define GST_RIFF_VIXL GST_MAKE_FOURCC ('V', 'I', 'X', 'L')
#define GST_RIFF_iyuv GST_MAKE_FOURCC ('i', 'y', 'u', 'v')
#define GST_RIFF_IYUV GST_MAKE_FOURCC ('I', 'Y', 'U', 'V')
#define GST_RIFF_i420 GST_MAKE_FOURCC ('i', '4', '2', '0')
#define GST_RIFF_I420 GST_MAKE_FOURCC ('I', '4', '2', '0')
#define GST_RIFF_vyuy GST_MAKE_FOURCC ('v', 'y', 'u', 'y')
#define GST_RIFF_VYUY GST_MAKE_FOURCC ('V', 'Y', 'U', 'Y')
#define GST_RIFF_DIV3 GST_MAKE_FOURCC ('D', 'I', 'V', '3')
#define GST_RIFF_rpza GST_MAKE_FOURCC ('r', 'p', 'z', 'a')
/* And this here's the mistakes that need to be supported */
#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */
/*********** FND in MJPG **********/
#define GST_RIFF_ISFT GST_MAKE_FOURCC ('I', 'S', 'F', 'T')
#define GST_RIFF_IDIT GST_MAKE_FOURCC ('I', 'D', 'I', 'T')
#define GST_RIFF_00AM GST_MAKE_FOURCC ('0', '0', 'A', 'M')
#define GST_RIFF_DISP GST_MAKE_FOURCC ('D', 'I', 'S', 'P')
#define GST_RIFF_ISBJ GST_MAKE_FOURCC ('I', 'S', 'B', 'J')
#define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ')
/* common data structures */
typedef struct _gst_riff_strh {
guint32 type; /* stream type */
guint32 fcc_handler; /* fcc_handler */
guint32 flags;
/* flags values */
#define GST_RIFF_STRH_DISABLED 0x000000001
#define GST_RIFF_STRH_VIDEOPALCHANGES 0x000010000
guint32 priority;
guint32 init_frames; /* initial frames (???) */
guint32 scale;
guint32 rate;
guint32 start;
guint32 length;
guint32 bufsize; /* suggested buffer size */
guint32 quality;
guint32 samplesize;
/* XXX 16 bytes ? */
} gst_riff_strh;
typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
guint32 size;
guint32 width;
guint32 height;
guint16 planes;
guint16 bit_cnt;
guint32 compression;
guint32 image_size;
guint32 xpels_meter;
guint32 ypels_meter;
guint32 num_colors; /* used colors */
guint32 imp_colors; /* important colors */
/* may be more for some codecs */
} gst_riff_strf_vids;
typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
guint16 format;
/**** from public Microsoft RIFF docs ******/
#define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000)
#define GST_RIFF_WAVE_FORMAT_PCM (0x0001)
#define GST_RIFF_WAVE_FORMAT_ADPCM (0x0002)
#define GST_RIFF_WAVE_FORMAT_IBM_CVSD (0x0005)
#define GST_RIFF_WAVE_FORMAT_ALAW (0x0006)
#define GST_RIFF_WAVE_FORMAT_MULAW (0x0007)
#define GST_RIFF_WAVE_FORMAT_OKI_ADPCM (0x0010)
#define GST_RIFF_WAVE_FORMAT_DVI_ADPCM (0x0011)
#define GST_RIFF_WAVE_FORMAT_DIGISTD (0x0015)
#define GST_RIFF_WAVE_FORMAT_DIGIFIX (0x0016)
#define GST_RIFF_WAVE_FORMAT_YAMAHA_ADPCM (0x0020)
#define GST_RIFF_WAVE_FORMAT_DSP_TRUESPEECH (0x0022)
#define GST_RIFF_WAVE_FORMAT_GSM610 (0x0031)
#define GST_RIFF_WAVE_FORMAT_MSN (0x0032)
#define GST_RIFF_WAVE_FORMAT_ITU_G721_ADPCM (0x0040)
#define GST_RIFF_WAVE_FORMAT_MPEGL12 (0x0050)
#define GST_RIFF_WAVE_FORMAT_MPEGL3 (0x0055)
#define GST_RIFF_IBM_FORMAT_MULAW (0x0101)
#define GST_RIFF_IBM_FORMAT_ALAW (0x0102)
#define GST_RIFF_IBM_FORMAT_ADPCM (0x0103)
#define GST_RIFF_WAVE_FORMAT_WMAV1 (0x0160)
#define GST_RIFF_WAVE_FORMAT_WMAV2 (0x0161)
#define GST_RIFF_WAVE_FORMAT_WMAV3 (0x0162)
#define GST_RIFF_WAVE_FORMAT_SONY_ATRAC3 (0x0270)
#define GST_RIFF_WAVE_FORMAT_A52 (0x2000)
#define GST_RIFF_WAVE_FORMAT_VORBIS1 (0x674f)
#define GST_RIFF_WAVE_FORMAT_VORBIS2 (0x6750)
#define GST_RIFF_WAVE_FORMAT_VORBIS3 (0x6751)
#define GST_RIFF_WAVE_FORMAT_VORBIS1PLUS (0x676f)
#define GST_RIFF_WAVE_FORMAT_VORBIS2PLUS (0x6770)
#define GST_RIFF_WAVE_FORMAT_VORBIS3PLUS (0x6771)
#define GST_RIFF_WAVE_FORMAT_GSM_AMR_CBR (0x7A21)
#define GST_RIFF_WAVE_FORMAT_GSM_AMR_VBR (0x7A22)
guint16 channels;
guint32 rate;
guint32 av_bps;
guint16 blockalign;
guint16 size;
} gst_riff_strf_auds;
typedef struct _gst_riff_strf_iavs {
guint32 DVAAuxSrc;
guint32 DVAAuxCtl;
guint32 DVAAuxSrc1;
guint32 DVAAuxCtl1;
guint32 DVVAuxSrc;
guint32 DVVAuxCtl;
guint32 DVReserved1;
guint32 DVReserved2;
} gst_riff_strf_iavs;
typedef struct _gst_riff_index_entry {
guint32 id;
guint32 flags;
#define GST_RIFF_IF_LIST (0x00000001L)
#define GST_RIFF_IF_KEYFRAME (0x00000010L)
#define GST_RIFF_IF_NO_TIME (0x00000100L)
#define GST_RIFF_IF_COMPUSE (0x0FFF0000L)
guint32 offset;
guint32 size;
} gst_riff_index_entry;
typedef struct _gst_riff_dmlh {
guint32 totalframes;
} gst_riff_dmlh;
G_END_DECLS
#endif /* __GST_RIFF_IDS_H__ */

View file

@ -1,713 +0,0 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-media.h: RIFF-id to/from caps routines
*
* 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 "riff-ids.h"
#include "riff-media.h"
/**
* gst_riff_create_video_caps_with_data:
* @codec_fcc: fourCC codec for this codec.
* @strh: pointer to the strh stream header structure.
* @strf: pointer to the strf stream header structure, including any
* data that is within the range of strf.size, but excluding any
* additional data withint this chunk but outside strf.size.
* @strf_data: a #GstBuffer containing the additional data in the strf
* chunk outside reach of strf.size. Ususally a palette.
* @strd_data: a #GstBuffer containing the data in the strd stream header
* chunk. Usually codec initialization data.
* @codec_name: if given, will be filled with a human-readable codec name.
*/
GstCaps *
gst_riff_create_video_caps_with_data (guint32 codec_fcc,
gst_riff_strh * strh, gst_riff_strf_vids * strf,
GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name)
{
GstCaps *caps = NULL;
GstBuffer *palette = NULL;
switch (codec_fcc) {
case GST_MAKE_FOURCC ('D', 'I', 'B', ' '):
caps = gst_caps_new_simple ("video/x-raw-rgb",
"bpp", G_TYPE_INT, 8,
"depth", G_TYPE_INT, 8, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
palette = strf_data;
strf_data = NULL;
if (codec_name)
*codec_name = g_strdup ("Palettized 8-bit RGB");
break;
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
*codec_name = g_strdup ("Uncompressed planar YUV 4:2:0");
break;
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
*codec_name = g_strdup ("Uncompressed packed YUV 4:2:2");
break;
case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
caps = gst_caps_new_simple ("image/jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("Motion JPEG");
break;
case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
caps = gst_caps_new_simple ("image/jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("JPEG Still Image");
break;
case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
caps = gst_caps_new_simple ("image/jpeg", NULL);
if (codec_name)
*codec_name = g_strdup ("Miro/Pinnacle Motion JPEG Video");
break;
case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
caps = gst_caps_new_simple ("video/x-huffyuv", NULL);
if (strf) {
gst_caps_set_simple (caps, "bpp",
G_TYPE_INT, (int) strf->bit_cnt, NULL);
}
if (codec_name)
*codec_name = g_strdup ("Huffman Lossless Codec");
break;
case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
case GST_MAKE_FOURCC ('m', 'p', 'g', '1'):
case GST_MAKE_FOURCC ('M', 'P', 'G', '1'):
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG video");
break;
case GST_MAKE_FOURCC ('M', 'P', 'G', '2'):
case GST_MAKE_FOURCC ('m', 'p', 'g', '2'):
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
"mpegversion", G_TYPE_INT, 2, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG 2 video");
break;
case GST_MAKE_FOURCC ('H', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("ITU H.26n");
break;
case GST_MAKE_FOURCC ('i', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("ITU H.263");
break;
case GST_MAKE_FOURCC ('L', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Lead H.263");
break;
case GST_MAKE_FOURCC ('M', '2', '6', '3'):
case GST_MAKE_FOURCC ('m', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft H.263");
break;
case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("VDOLive");
break;
case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Vivo H.263");
break;
case GST_MAKE_FOURCC ('x', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Xirlink H.263");
break;
/* apparently not standard H.263...? */
case GST_MAKE_FOURCC ('I', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-intel-h263", NULL);
if (codec_name)
*codec_name = g_strdup ("Intel H.263");
break;
case GST_MAKE_FOURCC ('h', '2', '6', '4'):
caps = gst_caps_new_simple ("video/x-h264", NULL);
if (codec_name)
*codec_name = g_strdup ("ITU H.264");
break;
case GST_MAKE_FOURCC ('V', 'S', 'S', 'H'):
caps = gst_caps_new_simple ("video/x-h264", NULL);
if (codec_name)
*codec_name = g_strdup ("VideoSoft H.264");
break;
case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
case GST_MAKE_FOURCC ('d', 'i', 'v', '3'):
case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
case GST_MAKE_FOURCC ('d', 'i', 'v', '4'):
case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
case GST_MAKE_FOURCC ('d', 'i', 'v', '5'):
case GST_MAKE_FOURCC ('D', 'I', 'V', '6'):
case GST_MAKE_FOURCC ('d', 'i', 'v', '6'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MS-MPEG-4 Version 3");
break;
case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 4, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MPEG-4 Version 4");
break;
case GST_MAKE_FOURCC ('B', 'L', 'Z', '0'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 4, NULL);
if (codec_name)
*codec_name = g_strdup ("Blizzard DivX");
break;
case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 5, NULL);
if (codec_name)
*codec_name = g_strdup ("DivX MPEG-4 Version 5");
break;
case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
caps = gst_caps_new_simple ("video/x-xvid", NULL);
if (codec_name)
*codec_name = g_strdup ("XVID MPEG-4");
break;
case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
case GST_MAKE_FOURCC ('M', 'P', '4', 'S'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 41, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.1");
break;
case GST_MAKE_FOURCC ('m', 'p', '4', '2'):
case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 42, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.2");
break;
case GST_MAKE_FOURCC ('m', 'p', '4', '3'):
case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
caps = gst_caps_new_simple ("video/x-msmpeg",
"msmpegversion", G_TYPE_INT, 43, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft MPEG-4 4.3");
break;
case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
caps = gst_caps_new_simple ("video/x-3ivx", NULL);
if (codec_name)
*codec_name = g_strdup ("3ivx");
break;
case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
if (codec_name)
*codec_name = g_strdup ("Generic DV");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft Windows Media 7 (WMV1)");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 2, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft Windows Media 8 (WMV2)");
break;
case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
caps = gst_caps_new_simple ("video/x-wmv",
"wmvversion", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("Microsoft Windows Media 9 (WMV3)");
break;
case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'):
caps = gst_caps_new_simple ("video/x-cinepak", NULL);
if (codec_name)
*codec_name = g_strdup ("Cinepak video");
break;
case GST_MAKE_FOURCC ('M', 'S', 'V', 'C'):
case GST_MAKE_FOURCC ('m', 's', 'v', 'c'):
case GST_MAKE_FOURCC ('C', 'R', 'A', 'M'):
case GST_MAKE_FOURCC ('c', 'r', 'a', 'm'):
case GST_MAKE_FOURCC ('W', 'H', 'A', 'M'):
case GST_MAKE_FOURCC ('w', 'h', 'a', 'm'):
caps = gst_caps_new_simple ("video/x-msvideocodec",
"msvideoversion", G_TYPE_INT, 1, NULL);
if (codec_name)
*codec_name = g_strdup ("MS video v1");
break;
case GST_MAKE_FOURCC ('R', 'L', 'E', ' '):
case GST_MAKE_FOURCC ('m', 'r', 'l', 'e'):
case GST_MAKE_FOURCC (0x1, 0x0, 0x0, 0x0): /* why, why, why? */
caps = gst_caps_new_simple ("video/x-rle",
"layout", G_TYPE_STRING, "microsoft", NULL);
palette = strf_data;
strf_data = NULL;
if (strf) {
gst_caps_set_simple (caps,
"depth", G_TYPE_INT, (gint) strf->bit_cnt, NULL);
} else {
gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL);
}
if (codec_name)
*codec_name = g_strdup ("Microsoft RLE");
break;
case GST_MAKE_FOURCC ('X', 'x', 'a', 'n'):
caps = gst_caps_new_simple ("video/x-xan",
"wcversion", G_TYPE_INT, 4, NULL);
if (codec_name)
*codec_name = g_strdup ("Xan Wing Commander 4");
break;
case GST_MAKE_FOURCC ('I', 'V', '5', '0'):
caps = gst_caps_new_simple ("video/x-intel",
"ivversion", G_TYPE_INT, 5, NULL);
if (codec_name)
*codec_name = g_strdup ("Intel Video 5");
break;
default:
GST_WARNING ("Unknown video fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
return NULL;
}
if (strh != NULL) {
gdouble fps = 1. * strh->rate / strh->scale;
gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
} else {
gst_caps_set_simple (caps,
"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL);
}
if (strf != NULL) {
gst_caps_set_simple (caps,
"width", G_TYPE_INT, strf->width,
"height", G_TYPE_INT, strf->height, NULL);
} else {
gst_caps_set_simple (caps,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
}
/* extradata */
if (strf_data || strd_data) {
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
strf_data ? strf_data : strd_data, NULL);
}
/* palette */
if (palette && GST_BUFFER_SIZE (palette) >= 256 * 4) {
GstBuffer *copy = gst_buffer_copy (palette);
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
gint n;
guint32 *data = (guint32 *) GST_BUFFER_DATA (copy);
/* own endianness */
for (n = 0; n < 256; n++)
data[n] = GUINT32_FROM_LE (data[n]);
#endif
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
gst_buffer_unref (copy);
}
return caps;
}
GstCaps *
gst_riff_create_video_caps (guint32 codec_fcc,
gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name)
{
return gst_riff_create_video_caps_with_data (codec_fcc,
strh, strf, NULL, NULL, codec_name);
}
GstCaps *
gst_riff_create_audio_caps_with_data (guint16 codec_id,
gst_riff_strh * strh, gst_riff_strf_auds * strf,
GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name)
{
gboolean block_align = FALSE, rate_chan = TRUE;
GstCaps *caps = NULL;
gint rate_min = 1000, rate_max = 96000;
gint channels_max = 2;
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG 1 layer 3");
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
caps = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
if (codec_name)
*codec_name = g_strdup ("MPEG 1 layer 2");
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM */
if (strf != NULL) {
gint ba = strf->blockalign;
gint ch = strf->channels;
gint ws = strf->size;
caps = gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
"width", G_TYPE_INT, (int) (ba * 8 / ch),
"depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
} else {
caps = gst_caps_from_string ("audio/x-raw-int, "
"endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) { true, false }, "
"width = (int) { 8, 16 }, " "depth = (int) { 8, 16 }");
}
if (codec_name)
*codec_name = g_strdup ("Uncompressed PCM audio");
break;
case GST_RIFF_WAVE_FORMAT_ADPCM:
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "microsoft", NULL);
if (codec_name)
*codec_name = g_strdup ("ADPCM audio");
block_align = TRUE;
break;
case GST_RIFF_WAVE_FORMAT_DVI_ADPCM:
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "dvi", NULL);
if (codec_name)
*codec_name = g_strdup ("DVI ADPCM audio");
block_align = TRUE;
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
if (strf != NULL && strf->size != 8) {
GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
strf->size = 8;
strf->av_bps = 8;
strf->blockalign = strf->av_bps * strf->channels;
}
if (strf != NULL && (strf->av_bps == 0 || strf->blockalign == 0)) {
GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of mulaw audio",
strf->av_bps, strf->blockalign);
strf->av_bps = strf->size;
strf->blockalign = strf->av_bps * strf->channels;
}
caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
if (codec_name)
*codec_name = g_strdup ("Mulaw");
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
if (strf != NULL && strf->size != 8) {
GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
strf->size = 8;
strf->av_bps = 8;
strf->blockalign = strf->av_bps * strf->channels;
}
if (strf != NULL && (strf->av_bps == 0 || strf->blockalign == 0)) {
GST_WARNING ("fixing av_bps (%d) and blockalign (%d) of alaw audio",
strf->av_bps, strf->blockalign);
strf->av_bps = strf->size;
strf->blockalign = strf->av_bps * strf->channels;
}
caps = gst_caps_new_simple ("audio/x-alaw", NULL);
if (codec_name)
*codec_name = g_strdup ("Alaw");
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
if (codec_name)
*codec_name = g_strdup ("Vorbis");
break;
case GST_RIFF_WAVE_FORMAT_A52:
channels_max = 6;
caps = gst_caps_new_simple ("audio/x-ac3", NULL);
if (codec_name)
*codec_name = g_strdup ("AC3");
break;
case GST_RIFF_WAVE_FORMAT_WMAV1:
case GST_RIFF_WAVE_FORMAT_WMAV2:
case GST_RIFF_WAVE_FORMAT_WMAV3:
{
gint version = (codec_id - GST_RIFF_WAVE_FORMAT_WMAV1) + 1;
channels_max = 6;
block_align = TRUE;
caps = gst_caps_new_simple ("audio/x-wma",
"wmaversion", G_TYPE_INT, version, NULL);
if (codec_name)
*codec_name = g_strdup_printf ("WMA Version %d", version);
if (strf != NULL) {
gst_caps_set_simple (caps,
"bitrate", G_TYPE_INT, strf->av_bps * 8, NULL);
} else {
gst_caps_set_simple (caps,
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
}
break;
}
case GST_RIFF_WAVE_FORMAT_SONY_ATRAC3:
caps = gst_caps_new_simple ("audio/x-vnd.sony.atrac3", NULL);
if (codec_name)
*codec_name = g_strdup ("Sony ATRAC3");
break;
default:
GST_WARNING ("Unknown audio tag 0x%04x", codec_id);
return NULL;
}
if (strf != NULL) {
if (rate_chan) {
gst_caps_set_simple (caps,
"rate", G_TYPE_INT, strf->rate,
"channels", G_TYPE_INT, strf->channels, NULL);
}
if (block_align) {
gst_caps_set_simple (caps,
"block_align", G_TYPE_INT, strf->blockalign, NULL);
}
} else {
if (rate_chan) {
gst_caps_set_simple (caps,
"rate", GST_TYPE_INT_RANGE, rate_min, rate_max,
"channels", GST_TYPE_INT_RANGE, 1, channels_max, NULL);
}
if (block_align) {
gst_caps_set_simple (caps,
"block_align", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
}
}
/* extradata */
if (strf_data || strd_data) {
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
strf_data ? strf_data : strd_data, NULL);
}
return caps;
}
GstCaps *
gst_riff_create_audio_caps (guint16 codec_id,
gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name)
{
return gst_riff_create_audio_caps_with_data (codec_id,
strh, strf, NULL, NULL, codec_name);
}
GstCaps *
gst_riff_create_iavs_caps (guint32 codec_fcc,
gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name)
{
GstCaps *caps = NULL;
switch (codec_fcc) {
/* is this correct? */
case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
caps = gst_caps_new_simple ("video/x-dv",
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
if (codec_name)
*codec_name = g_strdup ("Generic DV");
break;
default:
GST_WARNING ("Unknown IAVS fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
return NULL;
}
return caps;
}
/*
* Functions below are for template caps. All is variable.
*/
GstCaps *
gst_riff_create_video_template_caps (void)
{
guint32 tags[] = {
GST_MAKE_FOURCC ('I', '4', '2', '0'),
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
GST_MAKE_FOURCC ('M', 'J', 'P', 'G'),
GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
GST_MAKE_FOURCC ('W', 'M', 'V', '1'),
GST_MAKE_FOURCC ('W', 'M', 'V', '2'),
GST_MAKE_FOURCC ('W', 'M', 'V', '3'),
GST_MAKE_FOURCC ('M', 'P', 'G', '4'),
GST_MAKE_FOURCC ('M', 'P', '4', '2'),
GST_MAKE_FOURCC ('M', 'P', '4', '3'),
GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'),
GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
GST_MAKE_FOURCC ('M', 'P', 'E', 'G'),
GST_MAKE_FOURCC ('H', '2', '6', '3'),
GST_MAKE_FOURCC ('I', '2', '6', '3'),
GST_MAKE_FOURCC ('h', '2', '6', '4'),
GST_MAKE_FOURCC ('D', 'I', 'V', 'X'),
GST_MAKE_FOURCC ('D', 'X', '5', '0'),
GST_MAKE_FOURCC ('X', 'V', 'I', 'D'),
GST_MAKE_FOURCC ('3', 'I', 'V', '1'),
GST_MAKE_FOURCC ('c', 'v', 'i', 'd'),
GST_MAKE_FOURCC ('m', 's', 'v', 'c'),
GST_MAKE_FOURCC ('R', 'L', 'E', ' '),
GST_MAKE_FOURCC ('D', 'I', 'B', ' '),
GST_MAKE_FOURCC ('X', 'x', 'a', 'n'),
GST_MAKE_FOURCC ('I', 'V', '5', '0'),
/* FILL ME */
0
};
guint i;
GstCaps *caps, *one;
caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_video_caps (tags[i], NULL, NULL, NULL);
if (one)
gst_caps_append (caps, one);
}
return caps;
}
GstCaps *
gst_riff_create_audio_template_caps (void)
{
guint16 tags[] = {
GST_RIFF_WAVE_FORMAT_MPEGL3,
GST_RIFF_WAVE_FORMAT_MPEGL12,
GST_RIFF_WAVE_FORMAT_PCM,
GST_RIFF_WAVE_FORMAT_VORBIS1,
GST_RIFF_WAVE_FORMAT_A52,
GST_RIFF_WAVE_FORMAT_ALAW,
GST_RIFF_WAVE_FORMAT_MULAW,
GST_RIFF_WAVE_FORMAT_ADPCM,
GST_RIFF_WAVE_FORMAT_DVI_ADPCM,
GST_RIFF_WAVE_FORMAT_WMAV1,
GST_RIFF_WAVE_FORMAT_WMAV2,
GST_RIFF_WAVE_FORMAT_WMAV3,
/* FILL ME */
0
};
guint i;
GstCaps *caps, *one;
caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_audio_caps (tags[i], NULL, NULL, NULL);
if (one)
gst_caps_append (caps, one);
}
return caps;
}
GstCaps *
gst_riff_create_iavs_template_caps (void)
{
guint32 tags[] = {
GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
/* FILL ME */
0
};
guint i;
GstCaps *caps, *one;
caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_iavs_caps (tags[i], NULL, NULL, NULL);
if (one)
gst_caps_append (caps, one);
}
return caps;
}

View file

@ -1,77 +0,0 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-media.h: RIFF-id to/from caps routines
*
* 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_RIFF_MEDIA_H__
#define __GST_RIFF_MEDIA_H__
#include <glib.h>
#include <gst/gst.h>
#include "riff-ids.h"
G_BEGIN_DECLS
/*
* Create one caps. strh/strf can be NULL (for non-fixed caps).
*/
GstCaps *gst_riff_create_video_caps (guint32 codec_fcc,
gst_riff_strh *strh,
gst_riff_strf_vids *strf,
char **codec_name);
GstCaps *gst_riff_create_audio_caps (guint16 codec_id,
gst_riff_strh *strh,
gst_riff_strf_auds *strf,
char **codec_name);
GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc,
gst_riff_strh *strh,
gst_riff_strf_iavs *strf,
char **codec_name);
/*
* Extended...
*/
GstCaps *
gst_riff_create_video_caps_with_data (guint32 codec_fcc,
gst_riff_strh * strh,
gst_riff_strf_vids * strf,
GstBuffer * strf_data,
GstBuffer * strd_data,
char ** codec_name);
GstCaps *
gst_riff_create_audio_caps_with_data (guint16 codec_id,
gst_riff_strh * strh,
gst_riff_strf_auds * strf,
GstBuffer * strf_data,
GstBuffer * strd_data,
char ** codec_name);
/*
* Create template caps (includes all known types).
*/
GstCaps *gst_riff_create_video_template_caps (void);
GstCaps *gst_riff_create_audio_template_caps (void);
GstCaps *gst_riff_create_iavs_template_caps (void);
G_END_DECLS
#endif /* __GST_RIFF_READ_H__ */

File diff suppressed because it is too large Load diff

View file

@ -1,114 +0,0 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff-read.h: function declarations for parsing a RIFF file
*
* 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_RIFF_READ_H__
#define __GST_RIFF_READ_H__
#include <glib.h>
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
G_BEGIN_DECLS
#define GST_TYPE_RIFF_READ \
(gst_riff_read_get_type ())
#define GST_RIFF_READ(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RIFF_READ, GstRiffRead))
#define GST_RIFF_READ_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RIFF_READ, GstRiffReadClass))
#define GST_IS_RIFF_READ(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RIFF_READ))
#define GST_IS_RIFF_READ_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RIFF_READ))
#define GST_RIFF_READ_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RIFF_READ, GstRiffReadClass))
typedef struct _GstRiffLevel {
guint64 start,
length;
} GstRiffLevel;
typedef struct _GstRiffRead {
GstElement parent;
GstPad *sinkpad;
GstByteStream *bs;
GList *level;
} GstRiffRead;
typedef struct _GstRiffReadClass {
GstElementClass parent;
} GstRiffReadClass;
GType gst_riff_read_get_type (void);
guint32 gst_riff_peek_tag (GstRiffRead *riff,
guint *level_up);
guint32 gst_riff_peek_list (GstRiffRead *riff);
gboolean gst_riff_peek_head (GstRiffRead *riff,
guint32 *tag,
guint32 *length,
guint *level_up);
GstEvent *gst_riff_read_seek (GstRiffRead *riff,
guint64 offset);
gboolean gst_riff_read_skip (GstRiffRead *riff);
gboolean gst_riff_read_data (GstRiffRead *riff,
guint32 *tag,
GstBuffer **buf);
gboolean gst_riff_read_ascii (GstRiffRead *riff,
guint32 *tag,
gchar **str);
gboolean gst_riff_read_list (GstRiffRead *riff,
guint32 *tag);
gboolean gst_riff_read_header (GstRiffRead *read,
guint32 *doctype);
GstBuffer *gst_riff_read_element_data (GstRiffRead *riff,
guint length,
guint *got_bytes);
GstBuffer *gst_riff_peek_element_data (GstRiffRead *riff,
guint length,
guint *got_bytes);
/*
* Utility functions (including byteswapping).
*/
gboolean gst_riff_read_strh (GstRiffRead *riff,
gst_riff_strh **header);
gboolean gst_riff_read_strf_vids (GstRiffRead *riff,
gst_riff_strf_vids **header);
gboolean gst_riff_read_strf_vids_with_data
(GstRiffRead *riff,
gst_riff_strf_vids **header,
GstBuffer **extradata);
gboolean gst_riff_read_strf_auds (GstRiffRead *riff,
gst_riff_strf_auds **header);
gboolean gst_riff_read_strf_auds_with_data
(GstRiffRead *riff,
gst_riff_strf_auds **header,
GstBuffer **extradata);
gboolean gst_riff_read_strf_iavs (GstRiffRead *riff,
gst_riff_strf_iavs **header);
gboolean gst_riff_read_info (GstRiffRead *riff);
G_END_DECLS
#endif /* __GST_RIFF_READ_H__ */

View file

@ -1,38 +0,0 @@
/* GStreamer RIFF I/O
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* riff.c: plugin registering
*
* 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 <gst/gst.h>
static gboolean
plugin_init (GstPlugin * plugin)
{
return gst_library_load ("gstbytestream");
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"riff",
"RIFF I/O functions",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)

View file

@ -1,27 +0,0 @@
EXPORTS
gst_plugin_desc
gst_riff_read_get_type
gst_riff_read_element_data
gst_riff_create_video_template_caps
gst_riff_create_video_caps
gst_riff_create_video_caps_with_data
gst_riff_create_audio_template_caps
gst_riff_create_audio_caps
gst_riff_create_audio_caps_with_data
gst_riff_create_iavs_template_caps
gst_riff_create_iavs_caps
gst_riff_read_header
gst_riff_read_data
gst_riff_read_seek
gst_riff_read_skip
gst_riff_read_info
gst_riff_read_list
gst_riff_read_ascii
gst_riff_read_strh
gst_riff_read_strf_iavs
gst_riff_read_strf_auds
gst_riff_read_strf_auds_with_data
gst_riff_read_strf_vids_with_data
gst_riff_peek_tag
gst_riff_peek_list
gst_riff_peek_head

View file

@ -1,158 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="riff"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67890}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;RIFF_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstriff.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="riff.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/riff.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gstriff.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;RIFF_EXPORTS;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gstriff.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="riff.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gstriff.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\riff-media.c">
</File>
<File
RelativePath=".\riff-read.c">
</File>
<File
RelativePath=".\riff.c">
</File>
<File
RelativePath=".\riff.def">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\riff-ids.h">
</File>
<File
RelativePath=".\riff-media.h">
</File>
<File
RelativePath=".\riff-read.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,5 +0,0 @@
libgsttagincludedir = \
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/tag
libgsttaginclude_HEADERS = \
tag.h

View file

@ -1,62 +0,0 @@
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* 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_TAG_TAG_H__
#define __GST_TAG_TAG_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* functions for vorbis comment manipulation */
G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
void gst_vorbis_tag_add (GstTagList * list,
const gchar * tag,
const gchar * value);
GList * gst_tag_to_vorbis_comments (const GstTagList * list,
const gchar * tag);
/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
const guint8 * id_data,
const guint id_data_length,
gchar ** vendor_string);
GstBuffer * gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
const guint8 * id_data,
const guint id_data_length,
const gchar * vendor_string);
/* functions for ID3 tag manipulation */
guint gst_tag_id3_genre_count (void);
G_CONST_RETURN gchar * gst_tag_id3_genre_get (const guint id);
GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data);
G_CONST_RETURN gchar * gst_tag_from_id3_tag (const gchar * vorbis_tag);
G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
G_END_DECLS
#endif /* __GST_TAG_TAG_H__ */

View file

@ -1,49 +0,0 @@
# variables used for enum/marshal generation
glib_enum_headers=$(tuner_headers)
glib_enum_define=GST_TUNER
glib_enum_prefix=gst_tuner
libgsttunerincludedir = \
$(includedir)/gstreamer-@GST_MAJORMINOR@/gst/tuner
tuner_headers = \
tuner.h \
tunernorm.h \
tunerchannel.h
built_sources = \
tuner-marshal.c \
tuner-enumtypes.c
built_headers = \
tuner-marshal.h \
tuner-enumtypes.h
libgsttunerinclude_HEADERS = \
$(tuner_headers)
nodist_libgsttunerinclude_HEADERS = \
tuner-enumtypes.h
noinst_LTLIBRARIES = libgsttuner.la
libgsttuner_la_SOURCES = \
tuner.c \
tunernorm.c \
tunerchannel.c
nodist_libgsttuner_la_SOURCES = \
$(built_sources) \
tuner-marshal.h
libgsttuner_la_CFLAGS = $(GST_CFLAGS)
BUILT_SOURCES = \
$(built_sources) \
$(built_headers)
EXTRA_DIST = tuner-marshal.list
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/glib-gen.mak

View file

@ -1,2 +0,0 @@
VOID:OBJECT,ULONG
VOID:OBJECT,INT

View file

@ -1,404 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tuner.c: tuner design virtual class function wrappers
*
* 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 "tuner.h"
#include "tuner-marshal.h"
#include <string.h>
enum
{
NORM_CHANGED,
CHANNEL_CHANGED,
FREQUENCY_CHANGED,
SIGNAL_CHANGED,
LAST_SIGNAL
};
static void gst_tuner_class_init (GstTunerClass * klass);
static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
GType
gst_tuner_get_type (void)
{
static GType gst_tuner_type = 0;
if (!gst_tuner_type) {
static const GTypeInfo gst_tuner_info = {
sizeof (GstTunerClass),
(GBaseInitFunc) gst_tuner_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
"GstTuner", &gst_tuner_info, 0);
g_type_interface_add_prerequisite (gst_tuner_type,
GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_tuner_type;
}
static void
gst_tuner_class_init (GstTunerClass * klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_tuner_signals[NORM_CHANGED] =
g_signal_new ("norm-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, norm_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
gst_tuner_signals[CHANNEL_CHANGED] =
g_signal_new ("channel-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, channel_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GST_TYPE_TUNER_CHANNEL);
gst_tuner_signals[FREQUENCY_CHANGED] =
g_signal_new ("frequency-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
gst_tuner_signals[SIGNAL_CHANGED] =
g_signal_new ("signal-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerClass, signal_changed),
NULL, NULL,
gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}
/* default virtual functions */
klass->list_channels = NULL;
klass->set_channel = NULL;
klass->get_channel = NULL;
klass->list_norms = NULL;
klass->set_norm = NULL;
klass->get_norm = NULL;
klass->set_frequency = NULL;
klass->get_frequency = NULL;
klass->signal_strength = NULL;
}
/**
* gst_tuner_list_channels:
* @tuner: the #GstTuner (a #GstElement) to get the channels from.
*
* Retrieve a list of channels (e.g. 'composite', 's-video', ...)
* from the given tuner object.
*
* Returns: a list of channels available on this tuner.
*/
const GList *
gst_tuner_list_channels (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->list_channels) {
return klass->list_channels (tuner);
}
return NULL;
}
/**
* gst_tuner_set_channel:
* @tuner: the #GstTuner (a #GstElement) that owns the channel.
* @channel: the channel to tune to.
*
* Tunes the object to the given channel.
*/
void
gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->set_channel) {
klass->set_channel (tuner, channel);
}
}
/**
* gst_Tuner_get_channel:
* @tuner: the #GstTuner (a #GstElement) to get the current channel from.
*
* Retrieve the current channel from the tuner.
*
* Returns: the current channel of the tuner object.
*/
GstTunerChannel *
gst_tuner_get_channel (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->get_channel) {
return klass->get_channel (tuner);
}
return NULL;
}
/**
* gst_tuner_get_norms_list:
* @tuner: the #GstTuner (*a #GstElement) to get the list of norms from.
*
* Retrieve a list of available norms on the currently tuned channel
* from the given tuner object.
*
* Returns: A list of norms available on the current channel for this
* tuner object.
*/
const GList *
gst_tuner_list_norms (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->list_norms) {
return klass->list_norms (tuner);
}
return NULL;
}
/**
* gst_tuner_set_norm:
* @tuner: the #GstTuner (a #GstElement) to set the norm on.
* @norm: the norm to use for the current channel.
*
* Changes the video norm on this tuner to the given norm.
*/
void
gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->set_norm) {
klass->set_norm (tuner, norm);
}
}
/**
* gst_tuner_get_norm:
* @tuner: the #GstTuner (a #GstElement) to get the current norm from.
*
* Get the current video norm from the given tuner object for the
* currently selected channel.
*
* Returns: the current norm.
*/
GstTunerNorm *
gst_tuner_get_norm (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
if (klass->get_norm) {
return klass->get_norm (tuner);
}
return NULL;
}
/**
* gst_tuner_set_frequency:
* @tuner: the #Gsttuner (a #GstElement) that owns the given channel.
* @channel: the #GstTunerChannel to set the frequency on.
* @frequency: the frequency to tune in to.
*
* Sets a tuning frequency on the given tuner/channel. Note that this
* requires the given channel to be a "tuning" channel, which can be
* checked using GST_TUNER_CHANNEL_HAS_FLAG (), with the proper flag
* being GST_TUNER_CHANNEL_FREQUENCY.
*/
void
gst_tuner_set_frequency (GstTuner * tuner,
GstTunerChannel * channel, gulong frequency)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY));
if (klass->set_frequency) {
klass->set_frequency (tuner, channel, frequency);
}
}
/**
* gst_tuner_get_frequency:
* @tuner: the #GstTuner (a #GstElement) that owns the given channel.
* @channel: the #GstTunerChannel to retrieve the frequency from.
*
* Retrieve the current frequency from the given channel. The same
* applies as for set_frequency (): check the flag.
*
* Returns: the current frequency, or 0 on error.
*/
gulong
gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->get_frequency) {
return klass->get_frequency (tuner, channel);
}
return 0;
}
/**
* gst_tuner_get_signal_strength:
* @tuner: the #GstTuner (a #GstElement) that owns the given channel.
* @channel: the #GstTunerChannel to get the signal strength from.
*
* get the strength of the signal on this channel. Note that this
* requires the current channel to be a "tuning" channel, e.g. a
* channel on which frequency can be set. This can be checked using
* GST_TUNER_CHANNEL_HAS_FLAG (), and the appropriate flag to check
* for is GST_TUNER_CHANNEL_FREQUENCY.
*
* Returns: signal strength, or 0 on error.
*/
gint
gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->signal_strength) {
return klass->signal_strength (tuner, channel);
}
return 0;
}
GstTunerNorm *
gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm)
{
GList *walk;
g_return_val_if_fail (GST_TUNER (tuner), NULL);
g_return_val_if_fail (norm != NULL, NULL);
walk = (GList *) gst_tuner_list_norms (tuner);
while (walk) {
if (strcmp (GST_TUNER_NORM (walk->data)->label, norm) == 0)
return GST_TUNER_NORM (walk->data);
walk = g_list_next (walk);
}
return NULL;
}
GstTunerChannel *
gst_tuner_find_channel_by_name (GstTuner * tuner, gchar * channel)
{
GList *walk;
g_return_val_if_fail (GST_TUNER (tuner), NULL);
g_return_val_if_fail (channel != NULL, NULL);
walk = (GList *) gst_tuner_list_channels (tuner);
while (walk) {
if (strcmp (GST_TUNER_CHANNEL (walk->data)->label, channel) == 0)
return GST_TUNER_CHANNEL (walk->data);
walk = g_list_next (walk);
}
return NULL;
}
void
gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[CHANNEL_CHANGED], 0, channel);
}
void
gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_NORM (norm));
g_signal_emit (G_OBJECT (tuner), gst_tuner_signals[NORM_CHANGED], 0, norm);
}
void
gst_tuner_frequency_changed (GstTuner * tuner,
GstTunerChannel * channel, gulong frequency)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[FREQUENCY_CHANGED], 0, channel, frequency);
g_signal_emit_by_name (G_OBJECT (channel), "frequency_changed", frequency);
}
void
gst_tuner_signal_changed (GstTuner * tuner,
GstTunerChannel * channel, gint signal)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[SIGNAL_CHANGED], 0, channel, signal);
g_signal_emit_by_name (G_OBJECT (channel), "signal_changed", signal);
}

View file

@ -1,127 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tuner.h: tuner interface design
*
* 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_TUNER_H__
#define __GST_TUNER_H__
#include <gst/gst.h>
#include <gst/tuner/tunernorm.h>
#include <gst/tuner/tunerchannel.h>
#include <gst/tuner/tuner-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER \
(gst_tuner_get_type ())
#define GST_TUNER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
#define GST_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER, GstTunerClass))
#define GST_IS_TUNER(obj) \
(GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
#define GST_IS_TUNER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
#define GST_TUNER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerClass))
typedef struct _GstTuner GstTuner;
typedef struct _GstTunerClass {
GTypeInterface klass;
/* virtual functions */
const GList * (* list_channels) (GstTuner *tuner);
void (* set_channel) (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
(* get_channel) (GstTuner *tuner);
const GList * (* list_norms) (GstTuner *tuner);
void (* set_norm) (GstTuner *tuner,
GstTunerNorm *norm);
GstTunerNorm *(* get_norm) (GstTuner *tuner);
void (* set_frequency) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong (* get_frequency) (GstTuner *tuner,
GstTunerChannel *channel);
gint (* signal_strength) (GstTuner *tuner,
GstTunerChannel *channel);
/* signals */
void (*channel_changed) (GstTuner *tuner,
GstTunerChannel *channel);
void (*norm_changed) (GstTuner *tuner,
GstTunerNorm *norm);
void (*frequency_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerClass;
GType gst_tuner_get_type (void);
/* virtual class function wrappers */
const GList * gst_tuner_list_channels (GstTuner *tuner);
void gst_tuner_set_channel (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
gst_tuner_get_channel (GstTuner *tuner);
const GList * gst_tuner_list_norms (GstTuner *tuner);
void gst_tuner_set_norm (GstTuner *tuner,
GstTunerNorm *channel);
GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
void gst_tuner_set_frequency (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong gst_tuner_get_frequency (GstTuner *tuner,
GstTunerChannel *channel);
gint gst_tuner_signal_strength (GstTuner *tuner,
GstTunerChannel *channel);
/* helper functions */
GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
gchar *norm);
GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner,
gchar *channel);
/* trigger signals */
void gst_tuner_channel_changed (GstTuner *tuner,
GstTunerChannel *channel);
void gst_tuner_norm_changed (GstTuner *tuner,
GstTunerNorm *norm);
void gst_tuner_frequency_changed (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void gst_tuner_signal_changed (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
G_END_DECLS
#endif /* __GST_TUNER_H__ */

View file

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="tuner"
ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D6789C}"
RootNamespace="tuner"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../win32/Debug"
IntermediateDirectory="../../../win32/Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gsttuner.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="tuner.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/tuner.pdb"
SubSystem="2"
OptimizeReferences="2"
ImportLibrary="$(OutDir)/gsttuner.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../win32/Release"
IntermediateDirectory="../../../win32/Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;&quot;../../../gst-libs&quot;;../../../../popt/include;../../../../libxml2/include/libxml2"
PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
OutputFile="$(OutDir)/gsttuner.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
ModuleDefinitionFile="tuner.def"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/gsttuner.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\tuner.c">
</File>
<File
RelativePath=".\tunerchannel.c">
</File>
<File
RelativePath=".\tunernorm.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\tuner.h">
</File>
<File
RelativePath=".\tunerchannel.h">
</File>
<File
RelativePath=".\tunernorm.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,114 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunerchannel.c: tuner channel object design
*
* 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 "tunerchannel.h"
enum
{
/* FILL ME */
SIGNAL_FREQUENCY_CHANGED,
SIGNAL_SIGNAL_CHANGED,
LAST_SIGNAL
};
static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
static void gst_tuner_channel_init (GstTunerChannel * channel);
static void gst_tuner_channel_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
gst_tuner_channel_get_type (void)
{
static GType gst_tuner_channel_type = 0;
if (!gst_tuner_channel_type) {
static const GTypeInfo tuner_channel_info = {
sizeof (GstTunerChannelClass),
NULL,
NULL,
(GClassInitFunc) gst_tuner_channel_class_init,
NULL,
NULL,
sizeof (GstTunerChannel),
0,
(GInstanceInitFunc) gst_tuner_channel_init,
NULL
};
gst_tuner_channel_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerChannel", &tuner_channel_info, 0);
}
return gst_tuner_channel_type;
}
static void
gst_tuner_channel_class_init (GstTunerChannelClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
signals[SIGNAL_FREQUENCY_CHANGED] =
g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
frequency_changed),
NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
signals[SIGNAL_SIGNAL_CHANGED] =
g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
signal_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_tuner_channel_dispose;
}
static void
gst_tuner_channel_init (GstTunerChannel * channel)
{
channel->label = NULL;
channel->flags = 0;
channel->min_frequency = channel->max_frequency = 0;
channel->min_signal = channel->max_signal = 0;
}
static void
gst_tuner_channel_dispose (GObject * object)
{
GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
if (channel->label) {
g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,80 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunerchannel.h: tuner channel object design
*
* 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_TUNER_CHANNEL_H__
#define __GST_TUNER_CHANNEL_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_CHANNEL \
(gst_tuner_channel_get_type ())
#define GST_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannel))
#define GST_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannelClass))
#define GST_IS_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
typedef enum {
GST_TUNER_CHANNEL_INPUT = (1<<0),
GST_TUNER_CHANNEL_OUTPUT = (1<<1),
GST_TUNER_CHANNEL_FREQUENCY = (1<<2),
GST_TUNER_CHANNEL_AUDIO = (1<<3)
} GstTunerChannelFlags;
#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstTunerChannel {
GObject parent;
gchar *label;
GstTunerChannelFlags flags;
gfloat freq_multiplicator;
gulong min_frequency,
max_frequency;
gint min_signal,
max_signal;
} GstTunerChannel;
typedef struct _GstTunerChannelClass {
GObjectClass parent;
/* signals */
void (*frequency_changed) (GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTunerChannel *channel,
gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerChannelClass;
GType gst_tuner_channel_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_CHANNEL_H__ */

View file

@ -1,98 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunernorm.c: tuner norm object design
*
* 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 "tunernorm.h"
enum
{
/* FILL ME */
LAST_SIGNAL
};
static void gst_tuner_norm_class_init (GstTunerNormClass * klass);
static void gst_tuner_norm_init (GstTunerNorm * norm);
static void gst_tuner_norm_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
/*static guint signals[LAST_SIGNAL] = { 0 };*/
GType
gst_tuner_norm_get_type (void)
{
static GType gst_tuner_norm_type = 0;
if (!gst_tuner_norm_type) {
static const GTypeInfo tuner_norm_info = {
sizeof (GstTunerNormClass),
NULL,
NULL,
(GClassInitFunc) gst_tuner_norm_class_init,
NULL,
NULL,
sizeof (GstTunerNorm),
0,
(GInstanceInitFunc) gst_tuner_norm_init,
NULL
};
gst_tuner_norm_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerNorm", &tuner_norm_info, 0);
}
return gst_tuner_norm_type;
}
static void
gst_tuner_norm_class_init (GstTunerNormClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_klass->dispose = gst_tuner_norm_dispose;
}
static void
gst_tuner_norm_init (GstTunerNorm * norm)
{
norm->label = NULL;
norm->fps = 0.;
}
static void
gst_tuner_norm_dispose (GObject * object)
{
GstTunerNorm *norm = GST_TUNER_NORM (object);
if (norm->label) {
g_free (norm->label);
norm->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,57 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunernorm.h: tuner norm object design
*
* 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_TUNER_NORM_H__
#define __GST_TUNER_NORM_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_NORM \
(gst_tuner_norm_get_type ())
#define GST_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_NORM, GstTunerNorm))
#define GST_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_NORM, GstTunerNormClass))
#define GST_IS_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
#define GST_IS_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
typedef struct _GstTunerNorm {
GObject parent;
gchar *label;
gfloat fps;
} GstTunerNorm;
typedef struct _GstTunerNormClass {
GObjectClass parent;
gpointer _gst_reserved[GST_PADDING];
} GstTunerNormClass;
GType gst_tuner_norm_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_NORM_H__ */

Some files were not shown because too many files have changed in this diff Show more