mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
Remove lame plugin, moved to -good
https://bugzilla.gnome.org/show_bug.cgi?id=774252
This commit is contained in:
parent
83ff57c849
commit
b40e1a76b8
25 changed files with 3 additions and 1770 deletions
|
@ -41,11 +41,14 @@ CRUFT_FILES = \
|
|||
$(top_builddir)/common/shave \
|
||||
$(top_builddir)/common/shave-libtool \
|
||||
$(top_builddir)/ext/mpg123/.libs/libgstmpg123.so \
|
||||
$(top_builddir)/ext/lame/.libs/libgstlame.so \
|
||||
$(top_builddir)/gst/realmedia/.libs/libgstrmdemux.so
|
||||
|
||||
CRUFT_DIRS = \
|
||||
$(top_builddir)/tests/check/pipelines \
|
||||
$(top_srcdir)/docs/plugins/tmpl \
|
||||
$(top_srcdir)/ext/mpg123/ \
|
||||
$(top_srcdir)/ext/lame/ \
|
||||
$(top_builddir)/win32 \
|
||||
$(top_srcdir)/win32
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@ a52dec (for the a52dec AC-3 decoder)
|
|||
http://liba52.sourceforge.net/
|
||||
opencore-amr (for the AMR-NB decoder and encoder and the AMR-WB decoder)
|
||||
http://sourceforge.net/projects/opencore-amr/
|
||||
liblame (for lame mp3 encoder)
|
||||
http://www.mp3dev.org/mp3/
|
||||
libdvdread (for the dvdreadsrc)
|
||||
http://www.dtek.chalmers.se/groups/dvd/
|
||||
(optional: libcss for encrypted DVDs)
|
||||
|
|
22
configure.ac
22
configure.ac
|
@ -277,26 +277,6 @@ AG_GST_CHECK_FEATURE(DVDREAD, [dvdread library], dvdreadsrc, [
|
|||
AC_SUBST(DVDREAD_LIBS)
|
||||
])
|
||||
|
||||
dnl *** lame ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_LAME, true)
|
||||
AG_GST_CHECK_FEATURE(LAME, [lame mp3 encoder library], lame, [
|
||||
AG_GST_CHECK_LIBHEADER(LAME, mp3lame, lame_init, $LIBM, lame/lame.h,
|
||||
[
|
||||
HAVE_LAME="yes"
|
||||
LAME_LIBS="-lmp3lame $LIBM"
|
||||
dnl is lame presets available
|
||||
LAME_CFLAGS=""
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lame/lame.h>]], [[ int preset = MEDIUM ]])],[LAME_CFLAGS="-DGSTLAME_PRESET"],[LAME_CFLAGS=""
|
||||
])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lame/lame.h>]], [[
|
||||
void *ptr = &lame_set_VBR_quality
|
||||
]])],[LAME_CFLAGS="$LAME_CFLAGS -DHAVE_LAME_SET_VBR_QUALITY"],[LAME_CFLAGS="$LAME_CFLAGS"
|
||||
])
|
||||
AC_SUBST(LAME_CFLAGS)
|
||||
AC_SUBST(LAME_LIBS)
|
||||
])
|
||||
])
|
||||
|
||||
dnl *** mpeg2dec ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2DEC, true)
|
||||
AG_GST_CHECK_FEATURE(MPEG2DEC, [mpeg2dec], mpeg2dec, [
|
||||
|
@ -347,7 +327,6 @@ AM_CONDITIONAL(USE_AMRNB, false)
|
|||
AM_CONDITIONAL(USE_AMRWB, false)
|
||||
AM_CONDITIONAL(USE_CDIO, false)
|
||||
AM_CONDITIONAL(USE_DVDREAD, false)
|
||||
AM_CONDITIONAL(USE_LAME, false)
|
||||
AM_CONDITIONAL(USE_MPEG2DEC, false)
|
||||
AM_CONDITIONAL(USE_SIDPLAY, false)
|
||||
AM_CONDITIONAL(USE_TWOLAME, false)
|
||||
|
@ -430,7 +409,6 @@ ext/amrnb/Makefile
|
|||
ext/amrwbdec/Makefile
|
||||
ext/cdio/Makefile
|
||||
ext/dvdread/Makefile
|
||||
ext/lame/Makefile
|
||||
ext/mpeg2dec/Makefile
|
||||
ext/sidplay/Makefile
|
||||
ext/twolame/Makefile
|
||||
|
|
|
@ -59,7 +59,6 @@ EXTRA_HFILES = \
|
|||
$(top_srcdir)/ext/amrnb/amrnbenc.h \
|
||||
$(top_srcdir)/ext/amrwbdec/amrwbdec.h \
|
||||
$(top_srcdir)/ext/cdio/gstcdiocddasrc.h \
|
||||
$(top_srcdir)/ext/lame/gstlamemp3enc.h \
|
||||
$(top_srcdir)/ext/sidplay/gstsiddec.h \
|
||||
$(top_srcdir)/ext/twolame/gsttwolamemp2enc.h \
|
||||
$(top_srcdir)/ext/x264/gstx264enc.h \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<xi:include href="xml/element-amrnbenc.xml" />
|
||||
<xi:include href="xml/element-amrwbdec.xml" />
|
||||
<xi:include href="xml/element-cdiocddasrc.xml" />
|
||||
<xi:include href="xml/element-lamemp3enc.xml" />
|
||||
<xi:include href="xml/element-rademux.xml" />
|
||||
<xi:include href="xml/element-rmdemux.xml" />
|
||||
<xi:include href="xml/element-rdtmanager.xml" />
|
||||
|
@ -44,7 +43,6 @@
|
|||
<xi:include href="xml/plugin-dvdlpcmdec.xml" />
|
||||
<xi:include href="xml/plugin-dvdread.xml" />
|
||||
<xi:include href="xml/plugin-dvdsub.xml" />
|
||||
<xi:include href="xml/plugin-lame.xml" />
|
||||
<xi:include href="xml/plugin-mpeg2dec.xml" />
|
||||
<xi:include href="xml/plugin-realmedia.xml" />
|
||||
<xi:include href="xml/plugin-siddec.xml" />
|
||||
|
|
|
@ -77,21 +77,6 @@ GST_IS_CDIO_CDDA_SRC_CLASS
|
|||
gst_cdio_cdda_src_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>element-lamemp3enc</FILE>
|
||||
<TITLE>lamemp3enc</TITLE>
|
||||
GstLameMP3Enc
|
||||
<SUBSECTION Standard>
|
||||
GstLameMP3EncClass
|
||||
GST_LAMEMP3ENC
|
||||
GST_LAMEMP3ENC_CLASS
|
||||
GST_IS_LAMEMP3ENC
|
||||
GST_IS_LAMEMP3ENC_CLASS
|
||||
GST_TYPE_LAMEMP3ENC
|
||||
gst_lamemp3enc_get_type
|
||||
gst_lamemp3enc_register
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>element-rademux</FILE>
|
||||
<TITLE>rademux</TITLE>
|
||||
|
|
|
@ -138,396 +138,6 @@
|
|||
<DEFAULT>3 Front, 2 Rear</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::allow-diff-short</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Allow diff short</NICK>
|
||||
<BLURB>Allow diff short.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::ath-lower</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>ATH lower</NICK>
|
||||
<BLURB>lowers ATH by x dB.</BLURB>
|
||||
<DEFAULT>3</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::ath-only</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>ATH only</NICK>
|
||||
<BLURB>Ignore GPSYCHO completely, use ATH only.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::ath-short</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>ATH short</NICK>
|
||||
<BLURB>Ignore GPSYCHO for short blocks, use ATH only.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::bitrate</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,320]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Bitrate (kb/s)</NICK>
|
||||
<BLURB>Bitrate in kbit/sec (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).</BLURB>
|
||||
<DEFAULT>128</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::compression-ratio</NAME>
|
||||
<TYPE>gfloat</TYPE>
|
||||
<RANGE>[0,200]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Compression Ratio</NICK>
|
||||
<BLURB>let lame choose bitrate to achieve selected compression ratio.</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::copyright</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Copyright</NICK>
|
||||
<BLURB>Mark as copyright.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::cwlimit</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,50000]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Cwlimit</NICK>
|
||||
<BLURB>Compute tonality up to freq (in kHz) default 8.8717 (DEPRECATED: this setting has no effect).</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::disable-reservoir</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Disable reservoir</NICK>
|
||||
<BLURB>Disable the bit reservoir.</BLURB>
|
||||
<DEFAULT>TRUE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::emphasis</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Emphasis</NICK>
|
||||
<BLURB>Emphasis.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::error-protection</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Error protection</NICK>
|
||||
<BLURB>Adds 16 bit checksum to every frame.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::extension</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Extension</NICK>
|
||||
<BLURB>Extension.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::force-ms</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Force ms</NICK>
|
||||
<BLURB>Force ms_stereo on all frames.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::free-format</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Free format</NICK>
|
||||
<BLURB>Produce a free format bitstream.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::highpass-freq</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,50000]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Highpass freq</NICK>
|
||||
<BLURB>frequency(kHz), highpass filter cutoff below freq.</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::highpass-width</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>>= -1</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Highpass width</NICK>
|
||||
<BLURB>frequency(kHz) - default 15% of highpass freq.</BLURB>
|
||||
<DEFAULT>-1</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::lowpass-freq</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,50000]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Lowpass freq</NICK>
|
||||
<BLURB>frequency(kHz), lowpass filter cutoff above freq.</BLURB>
|
||||
<DEFAULT>17000</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::lowpass-width</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>>= -1</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Lowpass width</NICK>
|
||||
<BLURB>frequency(kHz) - default 15% of lowpass freq.</BLURB>
|
||||
<DEFAULT>-1</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::mode</NAME>
|
||||
<TYPE>GstLameMode</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Mode</NICK>
|
||||
<BLURB>Encoding mode.</BLURB>
|
||||
<DEFAULT>Joint Stereo</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::no-ath</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>No ath</NICK>
|
||||
<BLURB>turns ATH down to a flat noise floor.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::no-short-blocks</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>No short blocks</NICK>
|
||||
<BLURB>Do not use short blocks.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::original</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Original</NICK>
|
||||
<BLURB>Mark as original.</BLURB>
|
||||
<DEFAULT>TRUE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::padding-type</NAME>
|
||||
<TYPE>GstLamePadding</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Padding type</NICK>
|
||||
<BLURB>Padding type (DEPRECATED: this setting has no effect).</BLURB>
|
||||
<DEFAULT>No Padding</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::preset</NAME>
|
||||
<TYPE>GstLamePreset</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Lame Preset</NICK>
|
||||
<BLURB>Lame Preset.</BLURB>
|
||||
<DEFAULT>None</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::quality</NAME>
|
||||
<TYPE>GstLameQuality</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Quality</NICK>
|
||||
<BLURB>Quality of algorithm used for encoding.</BLURB>
|
||||
<DEFAULT>3</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::strict-iso</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Strict ISO</NICK>
|
||||
<BLURB>Comply as much as possible to ISO MPEG spec.</BLURB>
|
||||
<DEFAULT>TRUE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr</NAME>
|
||||
<TYPE>GstLameVbrmode</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR</NICK>
|
||||
<BLURB>Specify bitrate mode.</BLURB>
|
||||
<DEFAULT>No VBR (Constant Bitrate)</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr-hard-min</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,1]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR hard min</NICK>
|
||||
<BLURB>Specify whether min VBR bitrate is a hard limit. Normally, it can be violated for silence.</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr-max-bitrate</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,320]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR max bitrate</NICK>
|
||||
<BLURB>Specify maximum VBR bitrate (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr-mean-bitrate</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,320]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR mean bitrate</NICK>
|
||||
<BLURB>Specify mean VBR bitrate.</BLURB>
|
||||
<DEFAULT>128</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr-min-bitrate</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[0,320]</RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR min bitrate</NICK>
|
||||
<BLURB>Specify minimum VBR bitrate (8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).</BLURB>
|
||||
<DEFAULT>0</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::vbr-quality</NAME>
|
||||
<TYPE>GstLameQuality</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>VBR Quality</NICK>
|
||||
<BLURB>VBR Quality.</BLURB>
|
||||
<DEFAULT>4</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLame::xingheader</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rw</FLAGS>
|
||||
<NICK>Output Xing Header</NICK>
|
||||
<BLURB>Output Xing Header (BROKEN, use xingmux instead).</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::bitrate</NAME>
|
||||
<TYPE>gint</TYPE>
|
||||
<RANGE>[8,320]</RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>Bitrate (kb/s)</NICK>
|
||||
<BLURB>Bitrate in kbit/sec (Only valid if target is bitrate, for CBR one of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320).</BLURB>
|
||||
<DEFAULT>128</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::cbr</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>CBR</NICK>
|
||||
<BLURB>Enforce constant bitrate encoding (Only valid if target is bitrate).</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::encoding-engine-quality</NAME>
|
||||
<TYPE>GstLameMP3EncEncodingEngineQuality</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>Encoding Engine Quality</NICK>
|
||||
<BLURB>Quality/speed of the encoding engine, this does not affect the bitrate!.</BLURB>
|
||||
<DEFAULT>Standard</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::mono</NAME>
|
||||
<TYPE>gboolean</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>Mono</NICK>
|
||||
<BLURB>Enforce mono encoding.</BLURB>
|
||||
<DEFAULT>FALSE</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::quality</NAME>
|
||||
<TYPE>gfloat</TYPE>
|
||||
<RANGE>[0,9.999]</RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>Quality</NICK>
|
||||
<BLURB>VBR Quality from 0 to 10, 0 being the best (Only valid if target is quality).</BLURB>
|
||||
<DEFAULT>4</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstLameMP3Enc::target</NAME>
|
||||
<TYPE>GstLameMP3EncTarget</TYPE>
|
||||
<RANGE></RANGE>
|
||||
<FLAGS>rwx</FLAGS>
|
||||
<NICK>Target</NICK>
|
||||
<BLURB>Optimize for quality or bitrate.</BLURB>
|
||||
<DEFAULT>Quality</DEFAULT>
|
||||
</ARG>
|
||||
|
||||
<ARG>
|
||||
<NAME>GstSidDec::blocksize</NAME>
|
||||
<TYPE>guint</TYPE>
|
||||
|
|
|
@ -16,7 +16,6 @@ GObject
|
|||
GstDvdLpcmDec
|
||||
GstAudioEncoder
|
||||
GstAmrnbEnc
|
||||
GstLameMP3Enc
|
||||
GstTwoLame
|
||||
GstBaseSrc
|
||||
GstPushSrc
|
||||
|
|
|
@ -5,8 +5,6 @@ GstBin GstChildProxy
|
|||
GstCddaBaseSrc GstURIHandler
|
||||
GstCdioCddaSrc GstURIHandler
|
||||
GstDvdReadSrc GstURIHandler
|
||||
GstLame GstTagSetter GstPreset
|
||||
GstLameMP3Enc GstPreset
|
||||
GstPNMSrc GstURIHandler
|
||||
GstPipeline GstChildProxy
|
||||
GstRTSPReal GstRTSPExtension
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<plugin>
|
||||
<name>lame</name>
|
||||
<description>Encode MP3s with LAME</description>
|
||||
<filename>../../ext/lame/.libs/libgstlame.so</filename>
|
||||
<basename>libgstlame.so</basename>
|
||||
<version>1.12.0</version>
|
||||
<license>LGPL</license>
|
||||
<source>gst-plugins-ugly</source>
|
||||
<package>GStreamer Ugly Plug-ins source release</package>
|
||||
<origin>Unknown package origin</origin>
|
||||
<elements>
|
||||
<element>
|
||||
<name>lamemp3enc</name>
|
||||
<longname>L.A.M.E. mp3 encoder</longname>
|
||||
<class>Codec/Encoder/Audio</class>
|
||||
<description>High-quality free MP3 encoder</description>
|
||||
<author>Sebastian Dröge <sebastian.droege@collabora.co.uk></author>
|
||||
<pads>
|
||||
<caps>
|
||||
<name>sink</name>
|
||||
<direction>sink</direction>
|
||||
<presence>always</presence>
|
||||
<details>audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)1; audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)2, channel-mask=(bitmask)0x0000000000000003</details>
|
||||
</caps>
|
||||
<caps>
|
||||
<name>src</name>
|
||||
<direction>source</direction>
|
||||
<presence>always</presence>
|
||||
<details>audio/mpeg, mpegversion=(int)1, layer=(int)3, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ]</details>
|
||||
</caps>
|
||||
</pads>
|
||||
</element>
|
||||
</elements>
|
||||
</plugin>
|
|
@ -28,12 +28,6 @@ else
|
|||
DVDREAD_DIR =
|
||||
endif
|
||||
|
||||
if USE_LAME
|
||||
LAME_DIR = lame
|
||||
else
|
||||
LAME_DIR =
|
||||
endif
|
||||
|
||||
if USE_MPEG2DEC
|
||||
MPEG2DEC_DIR = mpeg2dec
|
||||
else
|
||||
|
@ -64,7 +58,6 @@ SUBDIRS = \
|
|||
$(AMRWB_DIR) \
|
||||
$(CDIO_DIR) \
|
||||
$(DVDREAD_DIR) \
|
||||
$(LAME_DIR) \
|
||||
$(MPEG2DEC_DIR) \
|
||||
$(SIDPLAY_DIR) \
|
||||
$(TWOLAME_DIR) \
|
||||
|
@ -76,7 +69,6 @@ DIST_SUBDIRS = \
|
|||
amrwbdec \
|
||||
cdio \
|
||||
dvdread \
|
||||
lame \
|
||||
mpeg2dec \
|
||||
sidplay \
|
||||
twolame \
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
plugin_LTLIBRARIES = libgstlame.la
|
||||
|
||||
libgstlame_la_SOURCES = gstlamemp3enc.c plugin.c
|
||||
libgstlame_la_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(LAME_CFLAGS)
|
||||
libgstlame_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) -lgstaudio-$(GST_API_VERSION) \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LAME_LIBS)
|
||||
libgstlame_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = gstlamemp3enc.h
|
|
@ -1,934 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) <2004> Wim Taymans <wim@fluendo.com>
|
||||
* Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
* Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:element-lamemp3enc
|
||||
* @see_also: lame, mad, vorbisenc
|
||||
*
|
||||
* This element encodes raw integer audio into an MPEG-1 layer 3 (MP3) stream.
|
||||
* Note that <ulink url="http://en.wikipedia.org/wiki/MP3">MP3</ulink> is not
|
||||
* a free format, there are licensing and patent issues to take into
|
||||
* consideration. See <ulink url="http://www.vorbis.com/">Ogg/Vorbis</ulink>
|
||||
* for a royalty free (and often higher quality) alternative.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Output sample rate</title>
|
||||
* If no fixed output sample rate is negotiated on the element's src pad,
|
||||
* the element will choose an optimal sample rate to resample to internally.
|
||||
* For example, a 16-bit 44.1 KHz mono audio stream encoded at 48 kbit will
|
||||
* get resampled to 32 KHz. Use filter caps on the src pad to force a
|
||||
* particular sample rate.
|
||||
* </refsect2>
|
||||
* <refsect2>
|
||||
* <title>Example pipelines</title>
|
||||
* |[
|
||||
* gst-launch-1.0 -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! lamemp3enc ! filesink location=sine.mp3
|
||||
* ]| Encode a test sine signal to MP3.
|
||||
* |[
|
||||
* gst-launch-1.0 -v autoaudiosrc ! audioconvert ! lamemp3enc target=bitrate bitrate=192 ! filesink location=alsasrc.mp3
|
||||
* ]| Record from a sound card using ALSA and encode to MP3 with an average bitrate of 192kbps
|
||||
* |[
|
||||
* gst-launch-1.0 -v filesrc location=music.wav ! decodebin ! audioconvert ! audioresample ! lamemp3enc target=quality quality=0 ! id3v2mux ! filesink location=music.mp3
|
||||
* ]| Transcode from a .wav file to MP3 (the id3v2mux element is optional) with best VBR quality
|
||||
* |[
|
||||
* gst-launch-1.0 -v cdda://5 ! audioconvert ! lamemp3enc target=bitrate cbr=true bitrate=192 ! filesink location=track5.mp3
|
||||
* ]| Encode Audio CD track 5 to MP3 with a constant bitrate of 192kbps
|
||||
* |[
|
||||
* gst-launch-1.0 -v audiotestsrc num-buffers=10 ! audio/x-raw,rate=44100,channels=1 ! lamemp3enc target=bitrate cbr=true bitrate=48 ! filesink location=test.mp3
|
||||
* ]| Encode to a fixed sample rate
|
||||
* </refsect2>
|
||||
*
|
||||
* Since: 0.10.12
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "gstlamemp3enc.h"
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
/* lame < 3.98 */
|
||||
#ifndef HAVE_LAME_SET_VBR_QUALITY
|
||||
#define lame_set_VBR_quality(flags,q) lame_set_VBR_q((flags),(int)(q))
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (debug);
|
||||
#define GST_CAT_DEFAULT debug
|
||||
|
||||
/* elementfactory information */
|
||||
|
||||
/* LAMEMP3ENC can do MPEG-1, MPEG-2, and MPEG-2.5, so it has 9 possible
|
||||
* sample rates it supports */
|
||||
static GstStaticPadTemplate gst_lamemp3enc_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"layout = (string) interleaved, "
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
|
||||
"channels = (int) 1; "
|
||||
"audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"layout = (string) interleaved, "
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
|
||||
"channels = (int) 2, " "channel-mask = (bitmask) 0x3")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_lamemp3enc_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/mpeg, "
|
||||
"mpegversion = (int) 1, "
|
||||
"layer = (int) 3, "
|
||||
"rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, "
|
||||
"channels = (int) [ 1, 2 ]")
|
||||
);
|
||||
|
||||
/********** Define useful types for non-programmatic interfaces **********/
|
||||
enum
|
||||
{
|
||||
LAMEMP3ENC_TARGET_QUALITY = 0,
|
||||
LAMEMP3ENC_TARGET_BITRATE
|
||||
};
|
||||
|
||||
#define GST_TYPE_LAMEMP3ENC_TARGET (gst_lamemp3enc_target_get_type())
|
||||
static GType
|
||||
gst_lamemp3enc_target_get_type (void)
|
||||
{
|
||||
static GType lame_target_type = 0;
|
||||
static const GEnumValue lame_targets[] = {
|
||||
{LAMEMP3ENC_TARGET_QUALITY, "Quality", "quality"},
|
||||
{LAMEMP3ENC_TARGET_BITRATE, "Bitrate", "bitrate"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!lame_target_type) {
|
||||
lame_target_type =
|
||||
g_enum_register_static ("GstLameMP3EncTarget", lame_targets);
|
||||
}
|
||||
return lame_target_type;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
LAMEMP3ENC_ENCODING_ENGINE_QUALITY_FAST = 0,
|
||||
LAMEMP3ENC_ENCODING_ENGINE_QUALITY_STANDARD,
|
||||
LAMEMP3ENC_ENCODING_ENGINE_QUALITY_HIGH
|
||||
};
|
||||
|
||||
#define GST_TYPE_LAMEMP3ENC_ENCODING_ENGINE_QUALITY (gst_lamemp3enc_encoding_engine_quality_get_type())
|
||||
static GType
|
||||
gst_lamemp3enc_encoding_engine_quality_get_type (void)
|
||||
{
|
||||
static GType lame_encoding_engine_quality_type = 0;
|
||||
static const GEnumValue lame_encoding_engine_quality[] = {
|
||||
{0, "Fast", "fast"},
|
||||
{1, "Standard", "standard"},
|
||||
{2, "High", "high"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!lame_encoding_engine_quality_type) {
|
||||
lame_encoding_engine_quality_type =
|
||||
g_enum_register_static ("GstLameMP3EncEncodingEngineQuality",
|
||||
lame_encoding_engine_quality);
|
||||
}
|
||||
return lame_encoding_engine_quality_type;
|
||||
}
|
||||
|
||||
/********** Standard stuff for signals and arguments **********/
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_TARGET,
|
||||
ARG_BITRATE,
|
||||
ARG_CBR,
|
||||
ARG_QUALITY,
|
||||
ARG_ENCODING_ENGINE_QUALITY,
|
||||
ARG_MONO
|
||||
};
|
||||
|
||||
#define DEFAULT_TARGET LAMEMP3ENC_TARGET_QUALITY
|
||||
#define DEFAULT_BITRATE 128
|
||||
#define DEFAULT_CBR FALSE
|
||||
#define DEFAULT_QUALITY 4
|
||||
#define DEFAULT_ENCODING_ENGINE_QUALITY LAMEMP3ENC_ENCODING_ENGINE_QUALITY_STANDARD
|
||||
#define DEFAULT_MONO FALSE
|
||||
|
||||
static gboolean gst_lamemp3enc_start (GstAudioEncoder * enc);
|
||||
static gboolean gst_lamemp3enc_stop (GstAudioEncoder * enc);
|
||||
static gboolean gst_lamemp3enc_set_format (GstAudioEncoder * enc,
|
||||
GstAudioInfo * info);
|
||||
static GstFlowReturn gst_lamemp3enc_handle_frame (GstAudioEncoder * enc,
|
||||
GstBuffer * in_buf);
|
||||
static void gst_lamemp3enc_flush (GstAudioEncoder * enc);
|
||||
|
||||
static void gst_lamemp3enc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_lamemp3enc_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
static gboolean gst_lamemp3enc_setup (GstLameMP3Enc * lame, GstTagList ** tags);
|
||||
|
||||
#define gst_lamemp3enc_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstLameMP3Enc, gst_lamemp3enc, GST_TYPE_AUDIO_ENCODER);
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_release_memory (GstLameMP3Enc * lame)
|
||||
{
|
||||
if (lame->lgf) {
|
||||
lame_close (lame->lgf);
|
||||
lame->lgf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_finalize (GObject * obj)
|
||||
{
|
||||
gst_lamemp3enc_release_memory (GST_LAMEMP3ENC (obj));
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_class_init (GstLameMP3EncClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstAudioEncoderClass *base_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
base_class = (GstAudioEncoderClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_lamemp3enc_set_property;
|
||||
gobject_class->get_property = gst_lamemp3enc_get_property;
|
||||
gobject_class->finalize = gst_lamemp3enc_finalize;
|
||||
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_lamemp3enc_src_template);
|
||||
gst_element_class_add_static_pad_template (gstelement_class,
|
||||
&gst_lamemp3enc_sink_template);
|
||||
|
||||
gst_element_class_set_static_metadata (gstelement_class,
|
||||
"L.A.M.E. mp3 encoder", "Codec/Encoder/Audio",
|
||||
"High-quality free MP3 encoder",
|
||||
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
||||
|
||||
base_class->start = GST_DEBUG_FUNCPTR (gst_lamemp3enc_start);
|
||||
base_class->stop = GST_DEBUG_FUNCPTR (gst_lamemp3enc_stop);
|
||||
base_class->set_format = GST_DEBUG_FUNCPTR (gst_lamemp3enc_set_format);
|
||||
base_class->handle_frame = GST_DEBUG_FUNCPTR (gst_lamemp3enc_handle_frame);
|
||||
base_class->flush = GST_DEBUG_FUNCPTR (gst_lamemp3enc_flush);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TARGET,
|
||||
g_param_spec_enum ("target", "Target",
|
||||
"Optimize for quality or bitrate", GST_TYPE_LAMEMP3ENC_TARGET,
|
||||
DEFAULT_TARGET,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
|
||||
g_param_spec_int ("bitrate", "Bitrate (kb/s)",
|
||||
"Bitrate in kbit/sec (Only valid if target is bitrate, for CBR one "
|
||||
"of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, "
|
||||
"256 or 320)", 8, 320, DEFAULT_BITRATE,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CBR,
|
||||
g_param_spec_boolean ("cbr", "CBR", "Enforce constant bitrate encoding "
|
||||
"(Only valid if target is bitrate)", DEFAULT_CBR,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
||||
g_param_spec_float ("quality", "Quality",
|
||||
"VBR Quality from 0 to 10, 0 being the best "
|
||||
"(Only valid if target is quality)", 0.0, 9.999,
|
||||
DEFAULT_QUALITY,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
||||
ARG_ENCODING_ENGINE_QUALITY, g_param_spec_enum ("encoding-engine-quality",
|
||||
"Encoding Engine Quality", "Quality/speed of the encoding engine, "
|
||||
"this does not affect the bitrate!",
|
||||
GST_TYPE_LAMEMP3ENC_ENCODING_ENGINE_QUALITY,
|
||||
DEFAULT_ENCODING_ENGINE_QUALITY,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MONO,
|
||||
g_param_spec_boolean ("mono", "Mono", "Enforce mono encoding",
|
||||
DEFAULT_MONO,
|
||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_init (GstLameMP3Enc * lame)
|
||||
{
|
||||
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_ENCODER_SINK_PAD (lame));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_lamemp3enc_start (GstAudioEncoder * enc)
|
||||
{
|
||||
GstLameMP3Enc *lame = GST_LAMEMP3ENC (enc);
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "start");
|
||||
|
||||
if (!lame->adapter)
|
||||
lame->adapter = gst_adapter_new ();
|
||||
gst_adapter_clear (lame->adapter);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_lamemp3enc_stop (GstAudioEncoder * enc)
|
||||
{
|
||||
GstLameMP3Enc *lame = GST_LAMEMP3ENC (enc);
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "stop");
|
||||
|
||||
if (lame->adapter) {
|
||||
g_object_unref (lame->adapter);
|
||||
lame->adapter = NULL;
|
||||
}
|
||||
|
||||
gst_lamemp3enc_release_memory (lame);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_lamemp3enc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
|
||||
{
|
||||
GstLameMP3Enc *lame;
|
||||
gint out_samplerate;
|
||||
gint version;
|
||||
GstCaps *othercaps;
|
||||
GstClockTime latency;
|
||||
GstTagList *tags = NULL;
|
||||
|
||||
lame = GST_LAMEMP3ENC (enc);
|
||||
|
||||
/* parameters already parsed for us */
|
||||
lame->samplerate = GST_AUDIO_INFO_RATE (info);
|
||||
lame->num_channels = GST_AUDIO_INFO_CHANNELS (info);
|
||||
|
||||
/* but we might be asked to reconfigure, so reset */
|
||||
gst_lamemp3enc_release_memory (lame);
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "setting up lame");
|
||||
if (!gst_lamemp3enc_setup (lame, &tags))
|
||||
goto setup_failed;
|
||||
|
||||
out_samplerate = lame_get_out_samplerate (lame->lgf);
|
||||
if (out_samplerate == 0)
|
||||
goto zero_output_rate;
|
||||
if (out_samplerate != lame->samplerate) {
|
||||
GST_WARNING_OBJECT (lame,
|
||||
"output samplerate %d is different from incoming samplerate %d",
|
||||
out_samplerate, lame->samplerate);
|
||||
}
|
||||
lame->out_samplerate = out_samplerate;
|
||||
|
||||
version = lame_get_version (lame->lgf);
|
||||
if (version == 0)
|
||||
version = 2;
|
||||
else if (version == 1)
|
||||
version = 1;
|
||||
else if (version == 2)
|
||||
version = 3;
|
||||
|
||||
othercaps =
|
||||
gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 1,
|
||||
"mpegaudioversion", G_TYPE_INT, version,
|
||||
"layer", G_TYPE_INT, 3,
|
||||
"channels", G_TYPE_INT, lame->mono ? 1 : lame->num_channels,
|
||||
"rate", G_TYPE_INT, out_samplerate, NULL);
|
||||
|
||||
/* and use these caps */
|
||||
gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (enc), othercaps);
|
||||
gst_caps_unref (othercaps);
|
||||
|
||||
/* base class feedback:
|
||||
* - we will handle buffers, just hand us all available
|
||||
* - report latency */
|
||||
latency = gst_util_uint64_scale_int (lame_get_framesize (lame->lgf),
|
||||
GST_SECOND, lame->samplerate);
|
||||
gst_audio_encoder_set_latency (enc, latency, latency);
|
||||
|
||||
if (tags) {
|
||||
gst_audio_encoder_merge_tags (enc, tags, GST_TAG_MERGE_REPLACE);
|
||||
gst_tag_list_unref (tags);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
zero_output_rate:
|
||||
{
|
||||
if (tags)
|
||||
gst_tag_list_unref (tags);
|
||||
GST_ELEMENT_ERROR (lame, LIBRARY, SETTINGS, (NULL),
|
||||
("LAME mp3 audio decided on a zero sample rate"));
|
||||
return FALSE;
|
||||
}
|
||||
setup_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (lame, LIBRARY, SETTINGS,
|
||||
(_("Failed to configure LAME mp3 audio encoder. Check your encoding parameters.")), (NULL));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* <php-emulation-mode>three underscores for ___rate is really really really
|
||||
* private as opposed to one underscore<php-emulation-mode> */
|
||||
/* call this MACRO outside of the NULL state so that we have a higher chance
|
||||
* of actually having a pipeline and bus to get the message through */
|
||||
|
||||
#define CHECK_AND_FIXUP_BITRATE(obj,param,rate) \
|
||||
G_STMT_START { \
|
||||
gint ___rate = rate; \
|
||||
gint maxrate = 320; \
|
||||
gint multiplier = 64; \
|
||||
if (rate == 0) { \
|
||||
___rate = rate; \
|
||||
} else if (rate <= 64) { \
|
||||
maxrate = 64; multiplier = 8; \
|
||||
if ((rate % 8) != 0) ___rate = GST_ROUND_UP_8 (rate); \
|
||||
} else if (rate <= 128) { \
|
||||
maxrate = 128; multiplier = 16; \
|
||||
if ((rate % 16) != 0) ___rate = GST_ROUND_UP_16 (rate); \
|
||||
} else if (rate <= 256) { \
|
||||
maxrate = 256; multiplier = 32; \
|
||||
if ((rate % 32) != 0) ___rate = GST_ROUND_UP_32 (rate); \
|
||||
} else if (rate <= 320) { \
|
||||
maxrate = 320; multiplier = 64; \
|
||||
if ((rate % 64) != 0) ___rate = GST_ROUND_UP_64 (rate); \
|
||||
} \
|
||||
if (___rate != rate) { \
|
||||
GST_ELEMENT_WARNING (obj, LIBRARY, SETTINGS, \
|
||||
(_("The requested bitrate %d kbit/s for property '%s' " \
|
||||
"is not allowed. " \
|
||||
"The bitrate was changed to %d kbit/s."), rate, \
|
||||
param, ___rate), \
|
||||
("A bitrate below %d should be a multiple of %d.", \
|
||||
maxrate, multiplier)); \
|
||||
rate = ___rate; \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstLameMP3Enc *lame;
|
||||
|
||||
lame = GST_LAMEMP3ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_TARGET:
|
||||
lame->target = g_value_get_enum (value);
|
||||
break;
|
||||
case ARG_BITRATE:
|
||||
lame->bitrate = g_value_get_int (value);
|
||||
break;
|
||||
case ARG_CBR:
|
||||
lame->cbr = g_value_get_boolean (value);
|
||||
break;
|
||||
case ARG_QUALITY:
|
||||
lame->quality = g_value_get_float (value);
|
||||
break;
|
||||
case ARG_ENCODING_ENGINE_QUALITY:
|
||||
lame->encoding_engine_quality = g_value_get_enum (value);
|
||||
break;
|
||||
case ARG_MONO:
|
||||
lame->mono = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstLameMP3Enc *lame;
|
||||
|
||||
lame = GST_LAMEMP3ENC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_TARGET:
|
||||
g_value_set_enum (value, lame->target);
|
||||
break;
|
||||
case ARG_BITRATE:
|
||||
g_value_set_int (value, lame->bitrate);
|
||||
break;
|
||||
case ARG_CBR:
|
||||
g_value_set_boolean (value, lame->cbr);
|
||||
break;
|
||||
case ARG_QUALITY:
|
||||
g_value_set_float (value, lame->quality);
|
||||
break;
|
||||
case ARG_ENCODING_ENGINE_QUALITY:
|
||||
g_value_set_enum (value, lame->encoding_engine_quality);
|
||||
break;
|
||||
case ARG_MONO:
|
||||
g_value_set_boolean (value, lame->mono);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* **** credits go to mpegaudioparse **** */
|
||||
|
||||
static const guint mp3types_bitrates[2][3][16] = {
|
||||
{
|
||||
{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
|
||||
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
|
||||
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}
|
||||
},
|
||||
{
|
||||
{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
|
||||
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
|
||||
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}
|
||||
},
|
||||
};
|
||||
|
||||
static const guint mp3types_freqs[3][3] = { {44100, 48000, 32000},
|
||||
{22050, 24000, 16000},
|
||||
{11025, 12000, 8000}
|
||||
};
|
||||
|
||||
static inline guint
|
||||
mp3_type_frame_length_from_header (GstLameMP3Enc * lame, guint32 header,
|
||||
guint * put_version, guint * put_layer, guint * put_channels,
|
||||
guint * put_bitrate, guint * put_samplerate, guint * put_mode,
|
||||
guint * put_crc)
|
||||
{
|
||||
guint length;
|
||||
gulong mode, samplerate, bitrate, layer, channels, padding, crc;
|
||||
gulong version;
|
||||
gint lsf, mpg25;
|
||||
|
||||
if (header & (1 << 20)) {
|
||||
lsf = (header & (1 << 19)) ? 0 : 1;
|
||||
mpg25 = 0;
|
||||
} else {
|
||||
lsf = 1;
|
||||
mpg25 = 1;
|
||||
}
|
||||
|
||||
version = 1 + lsf + mpg25;
|
||||
|
||||
layer = 4 - ((header >> 17) & 0x3);
|
||||
|
||||
crc = (header >> 16) & 0x1;
|
||||
|
||||
bitrate = (header >> 12) & 0xF;
|
||||
bitrate = mp3types_bitrates[lsf][layer - 1][bitrate] * 1000;
|
||||
/* The caller has ensured we have a valid header, so bitrate can't be
|
||||
zero here. */
|
||||
g_assert (bitrate != 0);
|
||||
|
||||
samplerate = (header >> 10) & 0x3;
|
||||
samplerate = mp3types_freqs[lsf + mpg25][samplerate];
|
||||
|
||||
padding = (header >> 9) & 0x1;
|
||||
|
||||
mode = (header >> 6) & 0x3;
|
||||
channels = (mode == 3) ? 1 : 2;
|
||||
|
||||
switch (layer) {
|
||||
case 1:
|
||||
length = 4 * ((bitrate * 12) / samplerate + padding);
|
||||
break;
|
||||
case 2:
|
||||
length = (bitrate * 144) / samplerate + padding;
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
length = (bitrate * 144) / (samplerate << lsf) + padding;
|
||||
break;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "Calculated mp3 frame length of %u bytes", length);
|
||||
GST_DEBUG_OBJECT (lame, "samplerate = %lu, bitrate = %lu, version = %lu, "
|
||||
"layer = %lu, channels = %lu", samplerate, bitrate, version,
|
||||
layer, channels);
|
||||
|
||||
if (put_version)
|
||||
*put_version = version;
|
||||
if (put_layer)
|
||||
*put_layer = layer;
|
||||
if (put_channels)
|
||||
*put_channels = channels;
|
||||
if (put_bitrate)
|
||||
*put_bitrate = bitrate;
|
||||
if (put_samplerate)
|
||||
*put_samplerate = samplerate;
|
||||
if (put_mode)
|
||||
*put_mode = mode;
|
||||
if (put_crc)
|
||||
*put_crc = crc;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mp3_sync_check (GstLameMP3Enc * lame, unsigned long head)
|
||||
{
|
||||
GST_DEBUG_OBJECT (lame, "checking mp3 header 0x%08lx", head);
|
||||
/* if it's not a valid sync */
|
||||
if ((head & 0xffe00000) != 0xffe00000) {
|
||||
GST_WARNING_OBJECT (lame, "invalid sync");
|
||||
return FALSE;
|
||||
}
|
||||
/* if it's an invalid MPEG version */
|
||||
if (((head >> 19) & 3) == 0x1) {
|
||||
GST_WARNING_OBJECT (lame, "invalid MPEG version: 0x%lx", (head >> 19) & 3);
|
||||
return FALSE;
|
||||
}
|
||||
/* if it's an invalid layer */
|
||||
if (!((head >> 17) & 3)) {
|
||||
GST_WARNING_OBJECT (lame, "invalid layer: 0x%lx", (head >> 17) & 3);
|
||||
return FALSE;
|
||||
}
|
||||
/* if it's an invalid bitrate */
|
||||
if (((head >> 12) & 0xf) == 0x0) {
|
||||
GST_WARNING_OBJECT (lame, "invalid bitrate: 0x%lx."
|
||||
"Free format files are not supported yet", (head >> 12) & 0xf);
|
||||
return FALSE;
|
||||
}
|
||||
if (((head >> 12) & 0xf) == 0xf) {
|
||||
GST_WARNING_OBJECT (lame, "invalid bitrate: 0x%lx", (head >> 12) & 0xf);
|
||||
return FALSE;
|
||||
}
|
||||
/* if it's an invalid samplerate */
|
||||
if (((head >> 10) & 0x3) == 0x3) {
|
||||
GST_WARNING_OBJECT (lame, "invalid samplerate: 0x%lx", (head >> 10) & 0x3);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((head & 0x3) == 0x2) {
|
||||
/* Ignore this as there are some files with emphasis 0x2 that can
|
||||
* be played fine. See BGO #537235 */
|
||||
GST_WARNING_OBJECT (lame, "invalid emphasis: 0x%lx", head & 0x3);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* **** end mpegaudioparse **** */
|
||||
|
||||
static GstFlowReturn
|
||||
gst_lamemp3enc_finish_frames (GstLameMP3Enc * lame)
|
||||
{
|
||||
gint av;
|
||||
guint header;
|
||||
GstFlowReturn result = GST_FLOW_OK;
|
||||
|
||||
/* limited parsing, we don't expect to lose sync here */
|
||||
while ((result == GST_FLOW_OK) &&
|
||||
((av = gst_adapter_available (lame->adapter)) > 4)) {
|
||||
guint rate, version, layer, size;
|
||||
GstBuffer *mp3_buf;
|
||||
const guint8 *data;
|
||||
guint samples_per_frame;
|
||||
|
||||
data = gst_adapter_map (lame->adapter, 4);
|
||||
header = GST_READ_UINT32_BE (data);
|
||||
gst_adapter_unmap (lame->adapter);
|
||||
|
||||
if (!mp3_sync_check (lame, header))
|
||||
goto invalid_header;
|
||||
|
||||
size = mp3_type_frame_length_from_header (lame, header, &version, &layer,
|
||||
NULL, NULL, &rate, NULL, NULL);
|
||||
|
||||
if (G_UNLIKELY (layer != 3 || rate != lame->out_samplerate)) {
|
||||
GST_DEBUG_OBJECT (lame,
|
||||
"unexpected mp3 header with rate %u, version %u, layer %u",
|
||||
rate, version, layer);
|
||||
goto invalid_header;
|
||||
}
|
||||
|
||||
if (size > av) {
|
||||
/* pretty likely to occur when lame is holding back on us */
|
||||
GST_LOG_OBJECT (lame, "frame size %u (> %d)", size, av);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Account for the internal resampling, finish frame really wants to
|
||||
* know about the number of incoming samples
|
||||
*/
|
||||
samples_per_frame = (version == 1) ? 1152 : 576;
|
||||
samples_per_frame *= lame->samplerate;
|
||||
samples_per_frame /= lame->out_samplerate;
|
||||
|
||||
/* should be ok now */
|
||||
mp3_buf = gst_adapter_take_buffer (lame->adapter, size);
|
||||
/* number of samples for MPEG-1, layer 3 */
|
||||
result = gst_audio_encoder_finish_frame (GST_AUDIO_ENCODER (lame),
|
||||
mp3_buf, samples_per_frame);
|
||||
}
|
||||
|
||||
exit:
|
||||
return result;
|
||||
|
||||
/* ERRORS */
|
||||
invalid_header:
|
||||
{
|
||||
GST_ELEMENT_ERROR (lame, STREAM, ENCODE,
|
||||
("invalid lame mp3 sync header %08X", header), (NULL));
|
||||
result = GST_FLOW_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_lamemp3enc_flush_full (GstLameMP3Enc * lame, gboolean push)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
GstMapInfo map;
|
||||
gint size;
|
||||
GstFlowReturn result = GST_FLOW_OK;
|
||||
gint av;
|
||||
|
||||
if (!lame->lgf)
|
||||
return GST_FLOW_OK;
|
||||
|
||||
buf = gst_buffer_new_and_alloc (7200);
|
||||
gst_buffer_map (buf, &map, GST_MAP_WRITE);
|
||||
size = lame_encode_flush (lame->lgf, map.data, 7200);
|
||||
|
||||
if (size > 0) {
|
||||
gst_buffer_unmap (buf, &map);
|
||||
gst_buffer_resize (buf, 0, size);
|
||||
GST_DEBUG_OBJECT (lame, "collecting final %d bytes", size);
|
||||
gst_adapter_push (lame->adapter, buf);
|
||||
} else {
|
||||
gst_buffer_unmap (buf, &map);
|
||||
GST_DEBUG_OBJECT (lame, "no final packet (size=%d, push=%d)", size, push);
|
||||
gst_buffer_unref (buf);
|
||||
result = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
if (push) {
|
||||
result = gst_lamemp3enc_finish_frames (lame);
|
||||
} else {
|
||||
/* never mind */
|
||||
gst_adapter_clear (lame->adapter);
|
||||
}
|
||||
|
||||
/* either way, we expect nothing left */
|
||||
if ((av = gst_adapter_available (lame->adapter))) {
|
||||
/* should this be more fatal ?? */
|
||||
GST_WARNING_OBJECT (lame, "unparsed %d bytes left after flushing", av);
|
||||
/* clean up anyway */
|
||||
gst_adapter_clear (lame->adapter);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_lamemp3enc_flush (GstAudioEncoder * enc)
|
||||
{
|
||||
gst_lamemp3enc_flush_full (GST_LAMEMP3ENC (enc), FALSE);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_lamemp3enc_handle_frame (GstAudioEncoder * enc, GstBuffer * in_buf)
|
||||
{
|
||||
GstLameMP3Enc *lame;
|
||||
gint mp3_buffer_size, mp3_size;
|
||||
GstBuffer *mp3_buf;
|
||||
GstFlowReturn result;
|
||||
gint num_samples;
|
||||
GstMapInfo in_map, mp3_map;
|
||||
|
||||
lame = GST_LAMEMP3ENC (enc);
|
||||
|
||||
/* squeeze remaining and push */
|
||||
if (G_UNLIKELY (in_buf == NULL))
|
||||
return gst_lamemp3enc_flush_full (lame, TRUE);
|
||||
|
||||
gst_buffer_map (in_buf, &in_map, GST_MAP_READ);
|
||||
|
||||
num_samples = in_map.size / 2;
|
||||
|
||||
/* allocate space for output */
|
||||
mp3_buffer_size = 1.25 * num_samples + 7200;
|
||||
mp3_buf = gst_buffer_new_allocate (NULL, mp3_buffer_size, NULL);
|
||||
gst_buffer_map (mp3_buf, &mp3_map, GST_MAP_WRITE);
|
||||
|
||||
/* lame seems to be too stupid to get mono interleaved going */
|
||||
if (lame->num_channels == 1) {
|
||||
mp3_size = lame_encode_buffer (lame->lgf,
|
||||
(short int *) in_map.data,
|
||||
(short int *) in_map.data, num_samples, mp3_map.data, mp3_buffer_size);
|
||||
} else {
|
||||
mp3_size = lame_encode_buffer_interleaved (lame->lgf,
|
||||
(short int *) in_map.data,
|
||||
num_samples / lame->num_channels, mp3_map.data, mp3_buffer_size);
|
||||
}
|
||||
gst_buffer_unmap (in_buf, &in_map);
|
||||
|
||||
GST_LOG_OBJECT (lame, "encoded %" G_GSIZE_FORMAT " bytes of audio "
|
||||
"to %d bytes of mp3", in_map.size, mp3_size);
|
||||
|
||||
if (G_LIKELY (mp3_size > 0)) {
|
||||
/* unfortunately lame does not provide frame delineated output,
|
||||
* so collect output and parse into frames ... */
|
||||
gst_buffer_unmap (mp3_buf, &mp3_map);
|
||||
gst_buffer_resize (mp3_buf, 0, mp3_size);
|
||||
gst_adapter_push (lame->adapter, mp3_buf);
|
||||
result = gst_lamemp3enc_finish_frames (lame);
|
||||
} else {
|
||||
gst_buffer_unmap (mp3_buf, &mp3_map);
|
||||
if (mp3_size < 0) {
|
||||
/* eat error ? */
|
||||
g_warning ("error %d", mp3_size);
|
||||
}
|
||||
gst_buffer_unref (mp3_buf);
|
||||
result = GST_FLOW_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* set up the encoder state */
|
||||
static gboolean
|
||||
gst_lamemp3enc_setup (GstLameMP3Enc * lame, GstTagList ** tags)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
#define CHECK_ERROR(command) G_STMT_START {\
|
||||
if ((command) < 0) { \
|
||||
GST_ERROR_OBJECT (lame, "setup failed: " G_STRINGIFY (command)); \
|
||||
if (*tags) { \
|
||||
gst_tag_list_unref (*tags); \
|
||||
*tags = NULL; \
|
||||
} \
|
||||
return FALSE; \
|
||||
} \
|
||||
}G_STMT_END
|
||||
|
||||
int retval;
|
||||
GstCaps *allowed_caps;
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "starting setup");
|
||||
|
||||
lame->lgf = lame_init ();
|
||||
|
||||
if (lame->lgf == NULL)
|
||||
return FALSE;
|
||||
|
||||
*tags = gst_tag_list_new_empty ();
|
||||
|
||||
/* copy the parameters over */
|
||||
lame_set_in_samplerate (lame->lgf, lame->samplerate);
|
||||
|
||||
/* let lame choose default samplerate unless outgoing sample rate is fixed */
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_AUDIO_ENCODER_SRC_PAD (lame));
|
||||
|
||||
if (allowed_caps != NULL) {
|
||||
GstStructure *structure;
|
||||
gint samplerate;
|
||||
|
||||
structure = gst_caps_get_structure (allowed_caps, 0);
|
||||
|
||||
if (gst_structure_get_int (structure, "rate", &samplerate)) {
|
||||
GST_DEBUG_OBJECT (lame, "Setting sample rate to %d as fixed in src caps",
|
||||
samplerate);
|
||||
lame_set_out_samplerate (lame->lgf, samplerate);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (lame, "Letting lame choose sample rate");
|
||||
lame_set_out_samplerate (lame->lgf, 0);
|
||||
}
|
||||
gst_caps_unref (allowed_caps);
|
||||
allowed_caps = NULL;
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (lame, "No peer yet, letting lame choose sample rate");
|
||||
lame_set_out_samplerate (lame->lgf, 0);
|
||||
}
|
||||
|
||||
CHECK_ERROR (lame_set_num_channels (lame->lgf, lame->num_channels));
|
||||
CHECK_ERROR (lame_set_bWriteVbrTag (lame->lgf, 0));
|
||||
|
||||
if (lame->target == LAMEMP3ENC_TARGET_QUALITY) {
|
||||
CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_default));
|
||||
CHECK_ERROR (lame_set_VBR_quality (lame->lgf, lame->quality));
|
||||
} else {
|
||||
if (lame->cbr) {
|
||||
CHECK_AND_FIXUP_BITRATE (lame, "bitrate", lame->bitrate);
|
||||
CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_off));
|
||||
CHECK_ERROR (lame_set_brate (lame->lgf, lame->bitrate));
|
||||
} else {
|
||||
CHECK_ERROR (lame_set_VBR (lame->lgf, vbr_abr));
|
||||
CHECK_ERROR (lame_set_VBR_mean_bitrate_kbps (lame->lgf, lame->bitrate));
|
||||
}
|
||||
gst_tag_list_add (*tags, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE,
|
||||
lame->bitrate * 1000, NULL);
|
||||
}
|
||||
|
||||
if (lame->encoding_engine_quality == LAMEMP3ENC_ENCODING_ENGINE_QUALITY_FAST)
|
||||
CHECK_ERROR (lame_set_quality (lame->lgf, 7));
|
||||
else if (lame->encoding_engine_quality ==
|
||||
LAMEMP3ENC_ENCODING_ENGINE_QUALITY_HIGH)
|
||||
CHECK_ERROR (lame_set_quality (lame->lgf, 2));
|
||||
/* else default */
|
||||
|
||||
if (lame->mono)
|
||||
CHECK_ERROR (lame_set_mode (lame->lgf, MONO));
|
||||
|
||||
/* initialize the lame encoder */
|
||||
if ((retval = lame_init_params (lame->lgf)) >= 0) {
|
||||
/* FIXME: it would be nice to print out the mode here */
|
||||
GST_INFO
|
||||
("lame encoder setup (target %s, quality %f, bitrate %d, %d Hz, %d channels)",
|
||||
(lame->target == LAMEMP3ENC_TARGET_QUALITY) ? "quality" : "bitrate",
|
||||
lame->quality, lame->bitrate, lame->samplerate, lame->num_channels);
|
||||
res = TRUE;
|
||||
} else {
|
||||
GST_ERROR_OBJECT (lame, "lame_init_params returned %d", retval);
|
||||
res = FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (lame, "done with setup");
|
||||
return res;
|
||||
#undef CHECK_ERROR
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_lamemp3enc_register (GstPlugin * plugin)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT (debug, "lamemp3enc", 0, "lame mp3 encoder");
|
||||
|
||||
if (!gst_element_register (plugin, "lamemp3enc", GST_RANK_PRIMARY,
|
||||
GST_TYPE_LAMEMP3ENC))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_LAMEMP3ENC_H__
|
||||
#define __GST_LAMEMP3ENC_H__
|
||||
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/gstaudioencoder.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#include <lame/lame.h>
|
||||
|
||||
#define GST_TYPE_LAMEMP3ENC \
|
||||
(gst_lamemp3enc_get_type())
|
||||
#define GST_LAMEMP3ENC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LAMEMP3ENC,GstLameMP3Enc))
|
||||
#define GST_LAMEMP3ENC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LAMEMP3ENC,GstLameMP3EncClass))
|
||||
#define GST_IS_LAMEMP3ENC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LAMEMP3ENC))
|
||||
#define GST_IS_LAMEMP3ENC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LAMEMP3ENC))
|
||||
|
||||
typedef struct _GstLameMP3Enc GstLameMP3Enc;
|
||||
typedef struct _GstLameMP3EncClass GstLameMP3EncClass;
|
||||
|
||||
/**
|
||||
* GstLameMP3Enc:
|
||||
*
|
||||
* Opaque data structure.
|
||||
*/
|
||||
struct _GstLameMP3Enc {
|
||||
GstAudioEncoder element;
|
||||
|
||||
/*< private >*/
|
||||
gint samplerate;
|
||||
gint out_samplerate;
|
||||
gint num_channels;
|
||||
|
||||
/* properties */
|
||||
gint target;
|
||||
gint bitrate;
|
||||
gboolean cbr;
|
||||
gfloat quality;
|
||||
gint encoding_engine_quality;
|
||||
gboolean mono;
|
||||
|
||||
lame_global_flags *lgf;
|
||||
|
||||
GstAdapter *adapter;
|
||||
};
|
||||
|
||||
struct _GstLameMP3EncClass {
|
||||
GstAudioEncoderClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_lamemp3enc_get_type(void);
|
||||
gboolean gst_lamemp3enc_register (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_LAMEMP3ENC_H__ */
|
|
@ -1,19 +0,0 @@
|
|||
lame_dep = cc.find_library('mp3lame', required : false)
|
||||
|
||||
if lame_dep.found() and cc.has_header_symbol('lame/lame.h', 'lame_init')
|
||||
lame_extra_c_args = []
|
||||
if cc.has_header_symbol('lame/lame.h', 'lame_set_VBR_quality')
|
||||
lame_extra_c_args += ['-DHAVE_LAME_SET_VBR_QUALITY']
|
||||
endif
|
||||
if cc.has_header_symbol('lame/lame.h', 'MEDIUM')
|
||||
lame_extra_c_args += ['-DGSTLAME_PRESET']
|
||||
endif
|
||||
lame = library('gstlame',
|
||||
['gstlamemp3enc.c', 'plugin.c'],
|
||||
c_args : ugly_args + lame_extra_c_args,
|
||||
include_directories : [configinc, libsinc],
|
||||
dependencies : [gstaudio_dep, lame_dep],
|
||||
install : true,
|
||||
install_dir : plugins_install_dir,
|
||||
)
|
||||
endif
|
|
@ -1,44 +0,0 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gst-i18n-plugin.h>
|
||||
|
||||
#include "gstlamemp3enc.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
return gst_lamemp3enc_register (plugin);
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
lame,
|
||||
"Encode MP3s with LAME",
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
|
@ -3,7 +3,6 @@ subdir('amrnb')
|
|||
subdir('amrwbdec')
|
||||
subdir('cdio')
|
||||
subdir('dvdread')
|
||||
subdir('lame')
|
||||
subdir('mpeg2dec')
|
||||
subdir('sidplay')
|
||||
subdir('twolame')
|
||||
|
|
|
@ -19,7 +19,6 @@ GETTEXT_M4 = \
|
|||
EXTRA_DIST = \
|
||||
a52.m4 \
|
||||
aalib.m4 \
|
||||
as-liblame.m4 \
|
||||
as-slurp-ffmpeg.m4 \
|
||||
check-libheader.m4 \
|
||||
freetype2.m4 \
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
# CFLAGS and library paths for LIBLAME
|
||||
# taken from Autostar Sandbox, http://autostars.sourceforge.net/
|
||||
# inspired by xmms.m4
|
||||
|
||||
dnl Usage:
|
||||
dnl AM_PATH_LIBLAME([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl FIXME: version checking does not work currently
|
||||
dnl
|
||||
dnl Example:
|
||||
dnl AM_PATH_LIBLAME(3.89, , AC_MSG_ERROR([*** LIBLAME >= 3.89 not installed))
|
||||
dnl
|
||||
dnl Defines LIBLAME_LIBS
|
||||
dnl FIXME: should define LIBLAME_VERSION
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AM_PATH_LIBLAME],
|
||||
[
|
||||
dnl check for the library
|
||||
AC_CHECK_LIB(mp3lame, lame_init, HAVE_LIBLAME=yes, HAVE_LIBLAME=no, -lm)
|
||||
dnl check if lame.h is available in the standard location or not
|
||||
HAVE_LAME_H_STD=no
|
||||
AC_CHECK_HEADER(lame.h, HAVE_LAME_H_STD=no, :)
|
||||
AC_CHECK_HEADER(lame/lame.h, HAVE_LAME_H_STD=yes, :)
|
||||
AC_MSG_CHECKING(for lame.h in right location)
|
||||
if test "x$HAVE_LAME_H_STD" = "xyes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
HAVE_LIBLAME=no
|
||||
if test "x$HAVE_LAME_H_STD"="xno"; then
|
||||
AC_MSG_WARN(lame.h found in include dir,)
|
||||
AC_MSG_WARN( while it should be in it's own lame/ dir !)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl now do the actual "do we have it ?" test
|
||||
if test "x$HAVE_LIBLAME" = "xyes"; then
|
||||
LIBLAME_LIBS="-lmp3lame -lm"
|
||||
dnl execute what we have to because it's found
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
LIBLAME_LIBS=""
|
||||
dnl execute what we have to because it's not found
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
|
||||
dnl make variables available
|
||||
AC_SUBST(LIBLAME_LIBS)
|
||||
AC_SUBST(HAVE_LIBLAME)
|
||||
])
|
|
@ -1,5 +1,4 @@
|
|||
ext/cdio/gstcdiocddasrc.c
|
||||
ext/dvdread/dvdreadsrc.c
|
||||
ext/lame/gstlamemp3enc.c
|
||||
ext/twolame/gsttwolamemp2enc.c
|
||||
gst/asfdemux/gstasfdemux.c
|
||||
|
|
|
@ -26,12 +26,6 @@ else
|
|||
AMRNB =
|
||||
endif
|
||||
|
||||
if USE_LAME
|
||||
LAME = pipelines/lame
|
||||
else
|
||||
LAME =
|
||||
endif
|
||||
|
||||
if USE_MPEG2DEC
|
||||
MPEG2DEC = elements/mpeg2dec
|
||||
else
|
||||
|
@ -54,7 +48,6 @@ endif
|
|||
check_PROGRAMS = \
|
||||
generic/states \
|
||||
$(AMRNB) \
|
||||
$(LAME) \
|
||||
$(MPEG2DEC) \
|
||||
$(check_x264enc) \
|
||||
$(check_xingmux)
|
||||
|
|
|
@ -188,16 +188,3 @@
|
|||
fun:Speech_Encode_Frame
|
||||
fun:Encoder_Interface_Encode
|
||||
}
|
||||
|
||||
## lame
|
||||
|
||||
{
|
||||
<lame Conditional jump or move depends on uninitialised values>
|
||||
Memcheck:Cond
|
||||
fun:L3psycho_anal_vbr
|
||||
fun:lame_encode_mp3_frame
|
||||
...
|
||||
fun:lame_encode_flush
|
||||
fun:gst_lamemp3enc_sink_event
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ ugly_tests = [
|
|||
[ 'elements/x264enc', not x264_dep.found() ],
|
||||
[ 'elements/xingmux' ],
|
||||
[ 'generic/states' ],
|
||||
[ 'pipelines/lame', not lame_dep.found() ],
|
||||
]
|
||||
|
||||
test_defines = [
|
||||
|
|
2
tests/check/pipelines/.gitignore
vendored
2
tests/check/pipelines/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
.dirstamp
|
||||
lame
|
|
@ -1,127 +0,0 @@
|
|||
/* GStreamer
|
||||
*
|
||||
* unit test for lame
|
||||
*
|
||||
* Copyright (C) 2007 Thomas Vander Stichele <thomas at apestaart dot 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
#include <gst/check/gstbufferstraw.h>
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
|
||||
GST_START_TEST (test_format)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstPad *pad;
|
||||
gchar *pipe_str;
|
||||
GstBuffer *buffer;
|
||||
GError *error = NULL;
|
||||
|
||||
pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
|
||||
"! audio/x-raw, rate=22050, channels=1 "
|
||||
"! lamemp3enc bitrate=24 ! audio/mpeg,rate=22050 ! fakesink");
|
||||
|
||||
bin = gst_parse_launch (pipe_str, &error);
|
||||
fail_unless (bin != NULL, "Error parsing pipeline: %s",
|
||||
error ? error->message : "(invalid error)");
|
||||
g_free (pipe_str);
|
||||
|
||||
/* get the pad */
|
||||
{
|
||||
GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
|
||||
|
||||
fail_unless (sink != NULL, "Could not get fakesink out of bin");
|
||||
pad = gst_element_get_static_pad (sink, "sink");
|
||||
fail_unless (pad != NULL, "Could not get pad out of fakesink");
|
||||
gst_object_unref (sink);
|
||||
}
|
||||
|
||||
gst_buffer_straw_start_pipeline (bin, pad);
|
||||
|
||||
buffer = gst_buffer_straw_get_buffer (bin, pad);
|
||||
|
||||
gst_buffer_straw_stop_pipeline (bin, pad);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
gst_object_unref (pad);
|
||||
gst_object_unref (bin);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_caps_proxy)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstPad *pad;
|
||||
gchar *pipe_str;
|
||||
GstBuffer *buffer;
|
||||
GError *error = NULL;
|
||||
|
||||
pipe_str = g_strdup_printf ("audiotestsrc num-buffers=1 "
|
||||
"! audio/x-raw,rate=48000,channels=1 "
|
||||
"! audioresample "
|
||||
"! lamemp3enc ! audio/mpeg,rate=(int){22050,44100} ! fakesink");
|
||||
|
||||
bin = gst_parse_launch (pipe_str, &error);
|
||||
fail_unless (bin != NULL, "Error parsing pipeline: %s",
|
||||
error ? error->message : "(invalid error)");
|
||||
g_free (pipe_str);
|
||||
|
||||
/* get the pad */
|
||||
{
|
||||
GstElement *sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink0");
|
||||
|
||||
fail_unless (sink != NULL, "Could not get fakesink out of bin");
|
||||
pad = gst_element_get_static_pad (sink, "sink");
|
||||
fail_unless (pad != NULL, "Could not get pad out of fakesink");
|
||||
gst_object_unref (sink);
|
||||
}
|
||||
|
||||
gst_buffer_straw_start_pipeline (bin, pad);
|
||||
|
||||
buffer = gst_buffer_straw_get_buffer (bin, pad);
|
||||
|
||||
gst_buffer_straw_stop_pipeline (bin, pad);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
gst_object_unref (pad);
|
||||
gst_object_unref (bin);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
#endif /* #ifndef GST_DISABLE_PARSE */
|
||||
|
||||
Suite *
|
||||
lame_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("lame");
|
||||
TCase *tc_chain = tcase_create ("general");
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
#ifndef GST_DISABLE_PARSE
|
||||
tcase_add_test (tc_chain, test_format);
|
||||
tcase_add_test (tc_chain, test_caps_proxy);
|
||||
#endif
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
GST_CHECK_MAIN (lame);
|
Loading…
Reference in a new issue