Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
270e903b
Commit
270e903b
authored
Aug 09, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libsamplerate resampling filter
parent
0fdaa3d7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
163 additions
and
1 deletion
+163
-1
NEWS
NEWS
+1
-0
configure.ac
configure.ac
+6
-1
modules/LIST
modules/LIST
+1
-0
modules/audio_filter/Modules.am
modules/audio_filter/Modules.am
+1
-0
modules/audio_filter/resampler/src.c
modules/audio_filter/resampler/src.c
+153
-0
po/POTFILES.in
po/POTFILES.in
+1
-0
No files found.
NEWS
View file @
270e903b
...
@@ -105,6 +105,7 @@ Audio Output:
...
@@ -105,6 +105,7 @@ Audio Output:
* New audio output in memory (amem)
* New audio output in memory (amem)
* Important simplification and improvements in the core audio output
* Important simplification and improvements in the core audio output
* New audio output based on OpenSL ES API for Android
* New audio output based on OpenSL ES API for Android
* New audio resampler using the Secret Rabbit Code (a.k.a. libsamplerate)
Video Filter:
Video Filter:
* New gradfun filter for debanding videos using dithering
* New gradfun filter for debanding videos using dithering
...
...
configure.ac
View file @
270e903b
...
@@ -703,7 +703,7 @@ AC_CHECK_FUNC(getopt_long,, [
...
@@ -703,7 +703,7 @@ AC_CHECK_FUNC(getopt_long,, [
AC_SUBST(GNUGETOPT_LIBS)
AC_SUBST(GNUGETOPT_LIBS)
AC_CHECK_LIB(m,cos,[
AC_CHECK_LIB(m,cos,[
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger freetype avcodec avformat access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq libvlccore freetype mod mpc dmo quicktime realvideo qt4 compressor headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball access_imem hotkeys mosaic gaussianblur dbus x264],[-lm])
VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom visual panoramix rotate noise grain scene kate flac lua chorus_flanger freetype avcodec avformat access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq
samplerate
libvlccore freetype mod mpc dmo quicktime realvideo qt4 compressor headphone_channel_mixer normvol audiobargraph_a speex mono colorthres extract ball access_imem hotkeys mosaic gaussianblur dbus x264],[-lm])
LIBM="-lm"
LIBM="-lm"
], [
], [
LIBM=""
LIBM=""
...
@@ -3015,6 +3015,11 @@ dnl libfluidsynth (MIDI synthetizer) plugin
...
@@ -3015,6 +3015,11 @@ dnl libfluidsynth (MIDI synthetizer) plugin
dnl
dnl
PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth], [MIDI synthetiser with libfluidsynth], [auto])
PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth], [MIDI synthetiser with libfluidsynth], [auto])
dnl
dnl libsamplerate plugin
dnl
PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
dnl
dnl
dnl Teletext Modules
dnl Teletext Modules
dnl vbi decoder plugin (using libzbvi)
dnl vbi decoder plugin (using libzbvi)
...
...
modules/LIST
View file @
270e903b
...
@@ -275,6 +275,7 @@ $Id$
...
@@ -275,6 +275,7 @@ $Id$
* rss: Display a RSS feed on the video output
* rss: Display a RSS feed on the video output
* rtp: rtp demux module
* rtp: rtp demux module
* rv32: RV32 image format conversion module
* rv32: RV32 image format conversion module
* samplerate: Secret Rabbit Code (libsamplerate) audio resampler
* sap: Interface module to read SAP/SDP announcements
* sap: Interface module to read SAP/SDP announcements
* scale: Images rescaler
* scale: Images rescaler
* scaletempo: Scale audio tempo in sync with playback rate
* scaletempo: Scale audio tempo in sync with playback rate
...
...
modules/audio_filter/Modules.am
View file @
270e903b
...
@@ -56,6 +56,7 @@ libvlc_LTLIBRARIES += \
...
@@ -56,6 +56,7 @@ libvlc_LTLIBRARIES += \
SOURCES_bandlimited_resampler = \
SOURCES_bandlimited_resampler = \
resampler/bandlimited.c resampler/bandlimited.h
resampler/bandlimited.c resampler/bandlimited.h
SOURCES_ugly_resampler = resampler/ugly.c
SOURCES_ugly_resampler = resampler/ugly.c
SOURCES_samplerate = resampler/src.c
libvlc_LTLIBRARIES += \
libvlc_LTLIBRARIES += \
libugly_resampler_plugin.la
libugly_resampler_plugin.la
...
...
modules/audio_filter/resampler/src.c
0 → 100644
View file @
270e903b
/*****************************************************************************
* src.c : Secret Rabbit Code (a.k.a. libsamplerate) resampler
*****************************************************************************
* Copyright (C) 2011 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_filter.h>
#include <samplerate.h>
#include <math.h>
#define SRC_CONV_TYPE_TEXT N_("Sample rate converter type")
#define SRC_CONV_TYPE_LONGTEXT N_( \
"Different resampling algorithm are supported. " \
"The best one is slower, while the fast one exhibits low quality.")
static
const
int
conv_type_values
[]
=
{
SRC_SINC_BEST_QUALITY
,
SRC_SINC_MEDIUM_QUALITY
,
SRC_SINC_FASTEST
,
SRC_ZERO_ORDER_HOLD
,
SRC_LINEAR
,
};
static
const
char
*
const
conv_type_texts
[]
=
{
"Sinc function (best quality)"
,
"Sinc function (medium quality)"
,
"Sinc function (fast)"
,
"Zero Order Hold (fastest)"
,
"Linear (fastest)"
,
};
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
()
set_shortname
(
N_
(
"SRC resampler"
))
set_description
(
N_
(
"Secret Rabbit Code (libsamplerate) resampler"
)
)
set_category
(
CAT_AUDIO
)
set_subcategory
(
SUBCAT_AUDIO_MISC
)
add_integer
(
"src-converter-type"
,
SRC_SINC_MEDIUM_QUALITY
,
SRC_CONV_TYPE_TEXT
,
SRC_CONV_TYPE_LONGTEXT
,
true
)
change_integer_list
(
conv_type_values
,
conv_type_texts
)
set_capability
(
"audio filter"
,
50
)
set_callbacks
(
Open
,
Close
)
vlc_module_end
()
static
block_t
*
Resample
(
filter_t
*
,
block_t
*
);
static
int
Open
(
vlc_object_t
*
obj
)
{
filter_t
*
filter
=
(
filter_t
*
)
obj
;
/* Only float->float */
if
(
filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
||
filter
->
fmt_out
.
audio
.
i_format
!=
VLC_CODEC_FL32
/* No channels remapping */
||
filter
->
fmt_in
.
audio
.
i_physical_channels
!=
filter
->
fmt_out
.
audio
.
i_physical_channels
||
filter
->
fmt_in
.
audio
.
i_original_channels
!=
filter
->
fmt_out
.
audio
.
i_original_channels
/* Different sample rate */
||
filter
->
fmt_in
.
audio
.
i_rate
==
filter
->
fmt_out
.
audio
.
i_rate
)
return
VLC_EGENERIC
;
int
type
=
var_InheritInteger
(
obj
,
"src-converter-type"
);
int
channels
=
aout_FormatNbChannels
(
&
filter
->
fmt_in
.
audio
);
int
err
;
SRC_STATE
*
s
=
src_new
(
type
,
channels
,
&
err
);
if
(
s
==
NULL
)
{
msg_Err
(
obj
,
"cannot initialize resampler: %s"
,
src_strerror
(
err
));
return
VLC_EGENERIC
;
}
filter
->
p_sys
=
(
filter_sys_t
*
)
s
;
filter
->
pf_audio_filter
=
Resample
;
return
VLC_SUCCESS
;
}
static
void
Close
(
vlc_object_t
*
obj
)
{
filter_t
*
filter
=
(
filter_t
*
)
obj
;
SRC_STATE
*
s
=
(
SRC_STATE
*
)
filter
->
p_sys
;
src_delete
(
s
);
}
static
block_t
*
Resample
(
filter_t
*
filter
,
block_t
*
in
)
{
block_t
*
out
=
NULL
;
const
size_t
framesize
=
filter
->
fmt_out
.
audio
.
i_bytes_per_frame
;
SRC_STATE
*
s
=
(
SRC_STATE
*
)
filter
->
p_sys
;
SRC_DATA
src
;
src
.
src_ratio
=
(
double
)
filter
->
fmt_out
.
audio
.
i_rate
/
(
double
)
filter
->
fmt_in
.
audio
.
i_rate
;
int
err
=
src_set_ratio
(
s
,
src
.
src_ratio
);
if
(
err
!=
0
)
{
msg_Err
(
filter
,
"cannot update resampling ratio: %s"
,
src_strerror
(
err
));
goto
error
;
}
src
.
input_frames
=
in
->
i_nb_samples
;
src
.
output_frames
=
ceil
(
src
.
src_ratio
*
src
.
input_frames
);
src
.
end_of_input
=
0
;
out
=
block_Alloc
(
src
.
output_frames
*
framesize
);
if
(
unlikely
(
out
==
NULL
))
goto
error
;
src
.
data_in
=
(
float
*
)
in
->
p_buffer
;
src
.
data_out
=
(
float
*
)
out
->
p_buffer
;
err
=
src_process
(
s
,
&
src
);
if
(
err
!=
0
)
{
msg_Err
(
filter
,
"cannot resample: %s"
,
src_strerror
(
err
));
block_Release
(
out
);
out
=
NULL
;
goto
error
;
}
if
(
src
.
input_frames_used
<
src
.
input_frames
)
msg_Warn
(
filter
,
"lost %ld of %ld input frames"
,
src
.
input_frames
-
src
.
input_frames_used
,
src
.
input_frames
);
out
->
i_buffer
=
src
.
output_frames_gen
*
framesize
;
out
->
i_nb_samples
=
src
.
output_frames_gen
;
out
->
i_pts
=
in
->
i_pts
;
out
->
i_length
=
src
.
output_frames_gen
*
CLOCK_FREQ
/
filter
->
fmt_out
.
audio
.
i_rate
;
error:
block_Release
(
in
);
return
out
;
}
po/POTFILES.in
View file @
270e903b
...
@@ -301,6 +301,7 @@ modules/audio_filter/normvol.c
...
@@ -301,6 +301,7 @@ modules/audio_filter/normvol.c
modules/audio_filter/param_eq.c
modules/audio_filter/param_eq.c
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/bandlimited.h
modules/audio_filter/resampler/bandlimited.h
modules/audio_filter/resampler/src.c
modules/audio_filter/resampler/ugly.c
modules/audio_filter/resampler/ugly.c
modules/audio_filter/scaletempo.c
modules/audio_filter/scaletempo.c
modules/audio_filter/spatializer/allpass.cpp
modules/audio_filter/spatializer/allpass.cpp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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