Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
George Kiagiadakis
gst-plugins-base
Commits
61c61e9f
Commit
61c61e9f
authored
Mar 31, 2011
by
Thibault Saunier
Committed by
Tim-Philipp Müller
Apr 16, 2011
Browse files
vorbis: add support for using tremolo on android
Tremolo is an ARM-optimised version of xiph's tremor library.
parent
55e767b6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Android.mk
View file @
61c61e9f
...
...
@@ -63,6 +63,7 @@ GST_PLUGINS_BASE_BUILT_SOURCES := \
gst/audiorate/Android.mk
\
gst/volume/Android.mk
\
tools/Android.mk
\
ext/vorbis/Android.mk
\
ext/ogg/Android.mk
GST_PLUGINS_BASE_BUILT_SOURCES
:=
$(
patsubst
%,
$(
abspath
$(GST_PLUGINS_BASE_TOP)
)
/%,
$(GST_PLUGINS_BASE_BUILT_SOURCES)
)
...
...
@@ -79,8 +80,10 @@ gst-plugins-base-configure:
CPPFLAGS
=
"
$(CONFIGURE_CPPFLAGS)
"
\
PKG_CONFIG_LIBDIR
=
"
$(CONFIGURE_PKG_CONFIG_LIBDIR)
"
\
PKG_CONFIG_TOP_BUILD_DIR
=
/
\
IVORBIS_CFLAGS
=
"-I
$(TOP)
/external/tremolo -DTREMOR"
\
IVORBIS_LIBS
=
"-lvorbisidec"
\
$(
abspath
$(GST_PLUGINS_BASE_TOP)
)
/
$(CONFIGURE)
--host
=
arm-linux-androideabi
\
--prefix
=
/system
--disable-orc
--disable-gio
\
--prefix
=
/system
--disable-orc
--disable-gio
--enable-ivorbis
\
--disable-valgrind
--disable-gtk-doc
&&
\
for
file
in
$(GST_PLUGINS_BASE_BUILT_SOURCES)
;
do
\
rm
-f
$$
file
&&
\
...
...
@@ -118,4 +121,5 @@ CONFIGURE_TARGETS += gst-plugins-base-configure
-include
$(GST_PLUGINS_BASE_TOP)/gst/audiorate/Android.mk
-include
$(GST_PLUGINS_BASE_TOP)/gst/volume/Android.mk
-include
$(GST_PLUGINS_BASE_TOP)/ext/ogg/Android.mk
-include
$(GST_PLUGINS_BASE_TOP)/ext/vorbis/Android.mk
-include
$(GST_PLUGINS_BASE_TOP)/tools/Android.mk
configure.ac
View file @
61c61e9f
...
...
@@ -715,6 +715,10 @@ AG_GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
HAVE_IVORBIS=no)
AC_SUBST(IVORBIS_LIBS)
AC_SUBST(IVORBIS_CFLAGS)
else
AC_CHECK_LIB(vorbisidec, vorbis_dsp_pcmout,
AC_DEFINE([USE_TREMOLO],1, "Define if building for android"),
USE_TREMOLO=no)
fi
])
...
...
ext/vorbis/Makefile.am
View file @
61c61e9f
...
...
@@ -44,3 +44,17 @@ noinst_HEADERS = gstvorbisenc.h \
gstvorbistag.h
\
gstvorbiscommon.h
Android.mk
:
Makefile.am $(BUILT_SOURCES)
androgenizer
\
-:PROJECT libgstivorbisdec -:SHARED libgstivorbisdec
\
-:TAGS eng debug
\
-:REL_TOP
$(top_srcdir)
-:ABS_TOP
$(abs_top_srcdir)
\
-:SOURCES
$(libgstivorbisdec_la_SOURCES)
\
-:CFLAGS
$(DEFS)
$(DEFAULT_INCLUDES)
$(libgstivorbisdec_la_CFLAGS)
\
-:LDFLAGS
$(libgstivorbisdec_la_LDFLAGS)
\
$(libgstivorbisdec_la_LIBADD)
\
-lvorbisidec
\
-ldl
\
-:PASSTHROUGH LOCAL_ARM_MODE:
=
arm
\
LOCAL_MODULE_PATH:
=
'$
$(TARGET_OUT)
/lib/gstreamer-0.10'
\
>
$@
ext/vorbis/gstvorbisdec.c
View file @
61c61e9f
...
...
@@ -166,7 +166,10 @@ vorbis_dec_finalize (GObject * object)
*/
GstVorbisDec
*
vd
=
GST_VORBIS_DEC
(
object
);
#ifndef USE_TREMOLO
vorbis_block_clear
(
&
vd
->
vb
);
#endif
vorbis_dsp_clear
(
&
vd
->
vd
);
vorbis_comment_clear
(
&
vd
->
vc
);
vorbis_info_clear
(
&
vd
->
vi
);
...
...
@@ -712,11 +715,16 @@ vorbis_handle_type_packet (GstVorbisDec * vd)
g_assert
(
vd
->
initialized
==
FALSE
);
#ifdef USE_TREMOLO
if
(
G_UNLIKELY
((
res
=
vorbis_dsp_init
(
&
vd
->
vd
,
&
vd
->
vi
))))
goto
synthesis_init_error
;
#else
if
(
G_UNLIKELY
((
res
=
vorbis_synthesis_init
(
&
vd
->
vd
,
&
vd
->
vi
))))
goto
synthesis_init_error
;
if
(
G_UNLIKELY
((
res
=
vorbis_block_init
(
&
vd
->
vd
,
&
vd
->
vb
))))
goto
block_init_error
;
#endif
vd
->
initialized
=
TRUE
;
...
...
@@ -760,7 +768,11 @@ vorbis_handle_header_packet (GstVorbisDec * vd, ogg_packet * packet)
/* Packetno = 0 if the first byte is exactly 0x01 */
packet
->
b_o_s
=
((
gst_ogg_packet_data
(
packet
))[
0
]
==
0x1
)
?
1
:
0
;
#ifdef USE_TREMOLO
if
((
ret
=
vorbis_dsp_headerin
(
&
vd
->
vi
,
&
vd
->
vc
,
packet
)))
#else
if
((
ret
=
vorbis_synthesis_headerin
(
&
vd
->
vi
,
&
vd
->
vc
,
packet
)))
#endif
goto
header_read_error
;
switch
((
gst_ogg_packet_data
(
packet
))[
0
])
{
...
...
@@ -861,7 +873,11 @@ static GstFlowReturn
vorbis_handle_data_packet
(
GstVorbisDec
*
vd
,
ogg_packet
*
packet
,
GstClockTime
timestamp
,
GstClockTime
duration
)
{
#ifdef USE_TREMOLO
vorbis_sample_t
*
pcm
;
#else
vorbis_sample_t
**
pcm
;
#endif
guint
sample_count
;
GstBuffer
*
out
=
NULL
;
GstFlowReturn
result
;
...
...
@@ -876,17 +892,27 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
* packet to decode the current one so we must be carefull not to
* throw away too much. For now we decode everything and clip right
* before pushing data. */
#ifdef USE_TREMOLO
if
(
G_UNLIKELY
(
vorbis_dsp_synthesis
(
&
vd
->
vd
,
packet
,
1
)))
goto
could_not_read
;
#else
if
(
G_UNLIKELY
(
vorbis_synthesis
(
&
vd
->
vb
,
packet
)))
goto
could_not_read
;
if
(
G_UNLIKELY
(
vorbis_synthesis_blockin
(
&
vd
->
vd
,
&
vd
->
vb
)
<
0
))
goto
not_accepted
;
#endif
/* assume all goes well here */
result
=
GST_FLOW_OK
;
/* count samples ready for reading */
#ifdef USE_TREMOLO
if
((
sample_count
=
vorbis_dsp_pcmout
(
&
vd
->
vd
,
NULL
,
0
))
==
0
)
#else
if
((
sample_count
=
vorbis_synthesis_pcmout
(
&
vd
->
vd
,
NULL
))
==
0
)
#endif
goto
done
;
size
=
sample_count
*
vd
->
vi
.
channels
*
vd
->
width
;
...
...
@@ -901,12 +927,19 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
goto
done
;
/* get samples ready for reading now, should be sample_count */
#ifdef USE_TREMOLO
pcm
=
GST_BUFFER_DATA
(
out
);
if
(
G_UNLIKELY
((
vorbis_dsp_pcmout
(
&
vd
->
vd
,
pcm
,
sample_count
))
!=
sample_count
))
#else
if
(
G_UNLIKELY
((
vorbis_synthesis_pcmout
(
&
vd
->
vd
,
&
pcm
))
!=
sample_count
))
#endif
goto
wrong_samples
;
#ifndef USE_TREMOLO
/* copy samples in buffer */
vd
->
copy_samples
((
vorbis_sample_t
*
)
GST_BUFFER_DATA
(
out
),
pcm
,
sample_count
,
vd
->
vi
.
channels
,
vd
->
width
);
#endif
GST_LOG_OBJECT
(
vd
,
"setting output size to %d"
,
size
);
GST_BUFFER_SIZE
(
out
)
=
size
;
...
...
@@ -927,7 +960,12 @@ done:
/* no output, still keep track of timestamps */
vorbis_do_timestamps
(
vd
,
NULL
,
FALSE
,
timestamp
,
duration
);
}
#ifdef USE_TREMOLO
vorbis_dsp_read
(
&
vd
->
vd
,
sample_count
);
#else
vorbis_synthesis_read
(
&
vd
->
vd
,
sample_count
);
#endif
return
result
;
...
...
@@ -1243,7 +1281,11 @@ vorbis_dec_change_state (GstElement * element, GstStateChange transition)
case
GST_STATE_CHANGE_PAUSED_TO_READY
:
GST_DEBUG_OBJECT
(
vd
,
"PAUSED -> READY, clearing vorbis structures"
);
vd
->
initialized
=
FALSE
;
#ifndef USE_TREMOLO
vorbis_block_clear
(
&
vd
->
vb
);
#endif
vorbis_dsp_clear
(
&
vd
->
vd
);
vorbis_comment_clear
(
&
vd
->
vc
);
vorbis_info_clear
(
&
vd
->
vi
);
...
...
ext/vorbis/gstvorbisdec.h
View file @
61c61e9f
...
...
@@ -22,6 +22,9 @@
#ifndef __GST_VORBIS_DEC_H__
#define __GST_VORBIS_DEC_H__
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<gst/gst.h>
#include
"gstvorbisdeclib.h"
...
...
@@ -56,7 +59,10 @@ struct _GstVorbisDec {
vorbis_dsp_state
vd
;
vorbis_info
vi
;
vorbis_comment
vc
;
#ifndef USE_TREMOLO
vorbis_block
vb
;
#endif
gboolean
initialized
;
guint
width
;
...
...
ext/vorbis/gstvorbisdeclib.h
View file @
61c61e9f
...
...
@@ -74,9 +74,15 @@ gst_ogg_packet_from_wrapper (ogg_packet_wrapper * packet)
#else
#include
<tremor/ivorbiscodec.h>
#ifdef USE_TREMOLO
#include
<Tremolo/ivorbiscodec.h>
#include
<Tremolo/codec_internal.h>
typedef
ogg_int16_t
vorbis_sample_t
;
#else
#include
<tremor/ivorbiscodec.h>
typedef
ogg_int32_t
vorbis_sample_t
;
#endif
typedef
ogg_int32_t
vorbis_sample_t
;
typedef
struct
_ogg_packet_wrapper
ogg_packet_wrapper
;
struct
_ogg_packet_wrapper
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment