mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
merge integer based Tremor vorbis plugin
Original commit message from CVS: merge integer based Tremor vorbis plugin
This commit is contained in:
parent
ea2dd02a4a
commit
da346202e4
7 changed files with 1364 additions and 3 deletions
17
configure.ac
17
configure.ac
|
@ -601,6 +601,22 @@ GST_CHECK_FEATURE(HTTP, [http plug-ins], gsthttpsrc, [
|
||||||
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl *** ivorbis ***
|
||||||
|
dnl AM_PATH_IVORBIS only takes two options
|
||||||
|
translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
|
||||||
|
GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
|
||||||
|
XIPH_PATH_IVORBIS(HAVE_IVORBIS=yes, HAVE_IVORBIS=no)
|
||||||
|
AS_SCRUB_INCLUDE(IVORBIS_CFLAGS)
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl *** ivorbis ***
|
||||||
|
dnl AM_PATH_IVORBIS only takes two options
|
||||||
|
translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
|
||||||
|
GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
|
||||||
|
XIPH_PATH_IVORBIS(HAVE_IVORBIS=yes, HAVE_IVORBIS=no)
|
||||||
|
AS_SCRUB_INCLUDE(IVORBIS_CFLAGS)
|
||||||
|
])
|
||||||
|
|
||||||
dnl *** Jack ***
|
dnl *** Jack ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
||||||
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
||||||
|
@ -1098,6 +1114,7 @@ ext/gnomevfs/Makefile
|
||||||
ext/gsm/Makefile
|
ext/gsm/Makefile
|
||||||
ext/hermes/Makefile
|
ext/hermes/Makefile
|
||||||
ext/http/Makefile
|
ext/http/Makefile
|
||||||
|
ext/ivorbis/Makefile
|
||||||
ext/jack/Makefile
|
ext/jack/Makefile
|
||||||
ext/jpeg/Makefile
|
ext/jpeg/Makefile
|
||||||
ext/ladspa/Makefile
|
ext/ladspa/Makefile
|
||||||
|
|
|
@ -238,6 +238,12 @@ else
|
||||||
TARKIN_DIR=
|
TARKIN_DIR=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if USE_IVORBIS
|
||||||
|
IVORBIS_DIR=ivorbis
|
||||||
|
else
|
||||||
|
IVORBIS_DIR=
|
||||||
|
endif
|
||||||
|
|
||||||
if USE_VORBIS
|
if USE_VORBIS
|
||||||
VORBIS_DIR=vorbis
|
VORBIS_DIR=vorbis
|
||||||
else
|
else
|
||||||
|
@ -268,7 +274,7 @@ SUBDIRS=$(A52DEC_DIR) $(AALIB_DIR) $(ALSA_DIR) \
|
||||||
$(OPENQUICKTIME_DIR) $(RAW1394_DIR) $(RTP_DIR) \
|
$(OPENQUICKTIME_DIR) $(RAW1394_DIR) $(RTP_DIR) \
|
||||||
$(SDL_DIR) $(SHOUT_DIR) $(SIDPLAY_DIR) \
|
$(SDL_DIR) $(SHOUT_DIR) $(SIDPLAY_DIR) \
|
||||||
$(SMOOTHWAVE_DIR) $(SWFDEC_DIR) $(TARKIN_DIR) \
|
$(SMOOTHWAVE_DIR) $(SWFDEC_DIR) $(TARKIN_DIR) \
|
||||||
$(VORBIS_DIR) $(XMMS_DIR) $(SNAPSHOT_DIR)
|
$(IVORBIS_DIR) $(VORBIS_DIR) $(XMMS_DIR) $(SNAPSHOT_DIR)
|
||||||
|
|
||||||
DIST_SUBDIRS=\
|
DIST_SUBDIRS=\
|
||||||
a52dec aalib alsa \
|
a52dec aalib alsa \
|
||||||
|
@ -276,7 +282,7 @@ DIST_SUBDIRS=\
|
||||||
audiofile cdparanoia dv \
|
audiofile cdparanoia dv \
|
||||||
dvdread dvdnav esd mas ffmpeg \
|
dvdread dvdnav esd mas ffmpeg \
|
||||||
flac gnomevfs gsm \
|
flac gnomevfs gsm \
|
||||||
hermes http jack jpeg \
|
hermes http ivorbis jack jpeg \
|
||||||
ladspa lame lcs libfame libpng \
|
ladspa lame lcs libfame libpng \
|
||||||
mad mikmod mjpegtools mpeg2dec \
|
mad mikmod mjpegtools mpeg2dec \
|
||||||
openquicktime raw1394 rtp \
|
openquicktime raw1394 rtp \
|
||||||
|
|
9
ext/ivorbis/Makefile.am
Normal file
9
ext/ivorbis/Makefile.am
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
|
||||||
|
|
||||||
|
plugin_LTLIBRARIES = libgstivorbis.la
|
||||||
|
|
||||||
|
libgstivorbis_la_SOURCES = vorbis.c vorbisfile.c
|
||||||
|
libgstivorbis_la_CFLAGS = $(GST_CFLAGS) $(IVORBIS_CFLAGS)
|
||||||
|
libgstivorbis_la_LIBADD = $(IVORBIS_LIBS) $(IVORBISFILE_LIBS)
|
||||||
|
libgstivorbis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
148
ext/ivorbis/vorbis.c
Normal file
148
ext/ivorbis/vorbis.c
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
#include <tremor/ivorbiscodec.h>
|
||||||
|
#include <tremor/ivorbisfile.h>
|
||||||
|
#include <gst/bytestream/bytestream.h>
|
||||||
|
|
||||||
|
extern GType vorbisfile_get_type(void);
|
||||||
|
|
||||||
|
extern GstElementDetails vorbisfile_details;
|
||||||
|
extern GstElementDetails vorbisenc_details;
|
||||||
|
|
||||||
|
static GstCaps* vorbis_type_find (GstBuffer *buf, gpointer private);
|
||||||
|
|
||||||
|
GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
|
||||||
|
|
||||||
|
static GstCaps*
|
||||||
|
vorbis_caps_factory (void)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
gst_caps_new (
|
||||||
|
"tremor_tremor",
|
||||||
|
"application/x-ogg",
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstCaps*
|
||||||
|
raw_caps_factory (void)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
gst_caps_new (
|
||||||
|
"tremor_raw",
|
||||||
|
"audio/raw",
|
||||||
|
gst_props_new (
|
||||||
|
"format", GST_PROPS_STRING ("int"),
|
||||||
|
"law", GST_PROPS_INT (0),
|
||||||
|
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||||
|
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||||
|
"width", GST_PROPS_INT (16),
|
||||||
|
"depth", GST_PROPS_INT (16),
|
||||||
|
"rate", GST_PROPS_INT_RANGE (11025, 48000),
|
||||||
|
"channels", GST_PROPS_INT_RANGE (1, 2),
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstCaps*
|
||||||
|
raw_caps2_factory (void)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
gst_caps_new (
|
||||||
|
"tremor_raw_float",
|
||||||
|
"audio/raw",
|
||||||
|
gst_props_new (
|
||||||
|
"format", GST_PROPS_STRING ("float"),
|
||||||
|
"layout", GST_PROPS_STRING ("IEEE"),
|
||||||
|
"rate", GST_PROPS_INT_RANGE (11025, 48000),
|
||||||
|
"channels", GST_PROPS_INT (2),
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstTypeDefinition vorbisdefinition = {
|
||||||
|
"tremor_audio/x-ogg",
|
||||||
|
"application/x-ogg",
|
||||||
|
".ogg",
|
||||||
|
vorbis_type_find,
|
||||||
|
};
|
||||||
|
|
||||||
|
static GstCaps*
|
||||||
|
vorbis_type_find (GstBuffer *buf, gpointer private)
|
||||||
|
{
|
||||||
|
gulong head = GULONG_FROM_BE (*((gulong *)GST_BUFFER_DATA (buf)));
|
||||||
|
|
||||||
|
if (head != 0x4F676753)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return gst_caps_new ("vorbis_type_find", "application/x-ogg", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
plugin_init (GModule *module, GstPlugin *plugin)
|
||||||
|
{
|
||||||
|
GstElementFactory *enc, *file;
|
||||||
|
GstTypeFactory *type;
|
||||||
|
GstCaps *raw_caps, *vorbis_caps, *raw_caps2;
|
||||||
|
|
||||||
|
gst_plugin_set_longname (plugin, "The OGG Vorbis Codec");
|
||||||
|
|
||||||
|
raw_caps = raw_caps_factory ();
|
||||||
|
raw_caps2 = raw_caps2_factory ();
|
||||||
|
vorbis_caps = vorbis_caps_factory ();
|
||||||
|
|
||||||
|
/* register sink pads */
|
||||||
|
gst_vorbisdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
vorbis_caps, NULL);
|
||||||
|
raw_caps = gst_caps_prepend (raw_caps, raw_caps2);
|
||||||
|
/* register src pads */
|
||||||
|
gst_vorbisdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
raw_caps, NULL);
|
||||||
|
/* create an elementfactory for the vorbisfile element */
|
||||||
|
file = gst_element_factory_new ("ivorbisfile", vorbisfile_get_type(),
|
||||||
|
&vorbisfile_details);
|
||||||
|
g_return_val_if_fail(file != NULL, FALSE);
|
||||||
|
gst_element_factory_set_rank (file, GST_ELEMENT_RANK_PRIMARY);
|
||||||
|
|
||||||
|
/* register sink pads */
|
||||||
|
gst_element_factory_add_pad_template (file, gst_vorbisdec_sink_template);
|
||||||
|
/* register src pads */
|
||||||
|
gst_element_factory_add_pad_template (file, gst_vorbisdec_src_template);
|
||||||
|
|
||||||
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (file));
|
||||||
|
|
||||||
|
/* this filter needs the bytestream package */
|
||||||
|
if (!gst_library_load ("gstbytestream"))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
type = gst_type_factory_new (&vorbisdefinition);
|
||||||
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GstPluginDesc plugin_desc = {
|
||||||
|
GST_VERSION_MAJOR,
|
||||||
|
GST_VERSION_MINOR,
|
||||||
|
"tremor",
|
||||||
|
plugin_init
|
||||||
|
};
|
101
ext/ivorbis/vorbisenc.h
Normal file
101
ext/ivorbis/vorbisenc.h
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/* 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 __VORBISENC_H__
|
||||||
|
#define __VORBISENC_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include <tremor/codec.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#define GST_TYPE_VORBISENC \
|
||||||
|
(vorbisenc_get_type())
|
||||||
|
#define GST_VORBISENC(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VORBISENC,VorbisEnc))
|
||||||
|
#define GST_VORBISENC_CLASS(klass) \
|
||||||
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VORBISENC,VorbisEncClass))
|
||||||
|
#define GST_IS_VORBISENC(obj) \
|
||||||
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VORBISENC))
|
||||||
|
#define GST_IS_VORBISENC_CLASS(obj) \
|
||||||
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VORBISENC))
|
||||||
|
|
||||||
|
typedef struct _VorbisEnc VorbisEnc;
|
||||||
|
typedef struct _VorbisEncClass VorbisEncClass;
|
||||||
|
|
||||||
|
struct _VorbisEnc {
|
||||||
|
GstElement element;
|
||||||
|
|
||||||
|
GstPad *sinkpad,
|
||||||
|
*srcpad;
|
||||||
|
|
||||||
|
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||||
|
stream of packets */
|
||||||
|
ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
|
||||||
|
ogg_packet op; /* one raw packet of data for decode */
|
||||||
|
|
||||||
|
vorbis_info vi; /* struct that stores all the static vorbis bitstream
|
||||||
|
settings */
|
||||||
|
vorbis_comment vc; /* struct that stores all the user comments */
|
||||||
|
|
||||||
|
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||||
|
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||||
|
|
||||||
|
gboolean eos;
|
||||||
|
|
||||||
|
gboolean managed;
|
||||||
|
gint bitrate;
|
||||||
|
gint min_bitrate;
|
||||||
|
gint max_bitrate;
|
||||||
|
gfloat quality;
|
||||||
|
gboolean quality_set;
|
||||||
|
gint serial;
|
||||||
|
|
||||||
|
gint channels;
|
||||||
|
gint frequency;
|
||||||
|
|
||||||
|
guint64 samples_in;
|
||||||
|
guint64 bytes_out;
|
||||||
|
|
||||||
|
GstCaps *metadata;
|
||||||
|
|
||||||
|
gboolean setup;
|
||||||
|
gboolean flush_header;
|
||||||
|
gchar *last_message;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _VorbisEncClass {
|
||||||
|
GstElementClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType vorbisenc_get_type(void);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __VORBISENC_H__ */
|
1078
ext/ivorbis/vorbisfile.c
Normal file
1078
ext/ivorbis/vorbisfile.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -137,6 +137,9 @@ HAVE_GCONFTOOL = @HAVE_GCONFTOOL@
|
||||||
HERMES_LIBS = @HERMES_LIBS@
|
HERMES_LIBS = @HERMES_LIBS@
|
||||||
HTTP_LIBS = @HTTP_LIBS@
|
HTTP_LIBS = @HTTP_LIBS@
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
IVORBISFILE_LIBS = @IVORBISFILE_LIBS@
|
||||||
|
IVORBIS_CFLAGS = @IVORBIS_CFLAGS@
|
||||||
|
IVORBIS_LIBS = @IVORBIS_LIBS@
|
||||||
JACK_CFLAGS = @JACK_CFLAGS@
|
JACK_CFLAGS = @JACK_CFLAGS@
|
||||||
JACK_LIBS = @JACK_LIBS@
|
JACK_LIBS = @JACK_LIBS@
|
||||||
JPEG_LIBS = @JPEG_LIBS@
|
JPEG_LIBS = @JPEG_LIBS@
|
||||||
|
@ -220,7 +223,6 @@ libgstmassink_la_CFLAGS = $(GST_CFLAGS) $(MAS_CFLAGS)
|
||||||
libgstmassink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(MAS_LIBS)
|
libgstmassink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(MAS_LIBS)
|
||||||
|
|
||||||
noinst_HEADERS = massink.h
|
noinst_HEADERS = massink.h
|
||||||
EXTRA_DIST = README
|
|
||||||
subdir = ext/mas
|
subdir = ext/mas
|
||||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
CONFIG_HEADER = $(top_builddir)/config.h
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||||||
|
|
Loading…
Reference in a new issue