summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-10 21:55:06 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-10 21:55:06 +0100
commit76052960d07a611889967f5927e2adb0d867ea07 (patch)
tree86e51b16d5325b377fffd6488beb9661a01465b1
parente203e064cd2d550771a80d9a710140ed07e3d7a0 (diff)
Make libswresample mandatory.
-rw-r--r--src/lib/encoder.cc12
-rw-r--r--src/lib/encoder.h6
-rw-r--r--src/wx/film_editor.cc2
-rw-r--r--wscript10
4 files changed, 3 insertions, 27 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index d25e0d0f8..8e0d1cd91 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -60,9 +60,7 @@ Encoder::Encoder (shared_ptr<Film> f, shared_ptr<Job> j)
, _job (j)
, _video_frames_in (0)
, _video_frames_out (0)
-#ifdef HAVE_SWRESAMPLE
, _swr_context (0)
-#endif
, _have_a_real_frame (false)
, _terminate (false)
{
@@ -81,7 +79,6 @@ void
Encoder::process_begin ()
{
if (_film->has_audio() && _film->audio_frame_rate() != _film->target_audio_sample_rate()) {
-#ifdef HAVE_SWRESAMPLE
stringstream s;
s << String::compose (N_("Will resample audio from %1 to %2"), _film->audio_frame_rate(), _film->target_audio_sample_rate());
@@ -107,13 +104,8 @@ Encoder::process_begin ()
);
swr_init (_swr_context);
-#else
- throw EncodeError (_("Cannot resample audio as libswresample is not present"));
-#endif
} else {
-#ifdef HAVE_SWRESAMPLE
_swr_context = 0;
-#endif
}
for (int i = 0; i < Config::instance()->num_local_encoding_threads (); ++i) {
@@ -135,7 +127,6 @@ Encoder::process_begin ()
void
Encoder::process_end ()
{
-#if HAVE_SWRESAMPLE
if (_film->has_audio() && _swr_context) {
shared_ptr<AudioBuffers> out (new AudioBuffers (_film->audio_mapping().dcp_channels(), 256));
@@ -157,7 +148,6 @@ Encoder::process_end ()
swr_free (&_swr_context);
}
-#endif
boost::mutex::scoped_lock lock (_mutex);
@@ -306,7 +296,6 @@ Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Sub
void
Encoder::process_audio (shared_ptr<const AudioBuffers> data)
{
-#if HAVE_SWRESAMPLE
/* Maybe sample-rate convert */
if (_swr_context) {
@@ -329,7 +318,6 @@ Encoder::process_audio (shared_ptr<const AudioBuffers> data)
/* And point our variables at the resampled audio */
data = resampled;
}
-#endif
_writer->write (data);
}
diff --git a/src/lib/encoder.h b/src/lib/encoder.h
index 6cf5540c5..a3a484856 100644
--- a/src/lib/encoder.h
+++ b/src/lib/encoder.h
@@ -33,12 +33,8 @@
#include <stdint.h>
extern "C" {
#include <libavutil/samplefmt.h>
-}
-#ifdef HAVE_SWRESAMPLE
-extern "C" {
#include <libswresample/swresample.h>
}
-#endif
#include "util.h"
#include "video_sink.h"
#include "audio_sink.h"
@@ -110,9 +106,7 @@ private:
/** Number of video frames written for the DCP so far */
int _video_frames_out;
-#if HAVE_SWRESAMPLE
SwrContext* _swr_context;
-#endif
bool _have_a_real_frame;
bool _terminate;
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index ca43ffb8a..528e3840f 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -810,7 +810,6 @@ FilmEditor::setup_frame_rate_description ()
if (_film->video_frame_rate()) {
d << std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description);
++lines;
-#ifdef HAVE_SWRESAMPLE
if (_film->audio_frame_rate() && _film->audio_frame_rate() != _film->target_audio_sample_rate ()) {
d << wxString::Format (
_("Audio will be resampled from %dHz to %dHz\n"),
@@ -819,7 +818,6 @@ FilmEditor::setup_frame_rate_description ()
);
++lines;
}
-#endif
}
for (int i = lines; i < 2; ++i) {
diff --git a/wscript b/wscript
index 169e46257..50d6d9040 100644
--- a/wscript
+++ b/wscript
@@ -62,7 +62,7 @@ def configure(conf):
conf.check_cfg(package = 'libavcodec', args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = True)
conf.check_cfg(package = 'libavutil', args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = True)
conf.check_cfg(package = 'libswscale', args = '--cflags --libs', uselib_store = 'SWSCALE', mandatory = True)
- conf.check_cfg(package = 'libswresample', args = '--cflags --libs', uselib_store = 'SWRESAMPLE', mandatory = False)
+ conf.check_cfg(package = 'libswresample', args = '--cflags --libs', uselib_store = 'SWRESAMPLE', mandatory = True)
conf.check_cfg(package = 'libpostproc', args = '--cflags --libs', uselib_store = 'POSTPROC', mandatory = True)
else:
# This is hackio grotesquio for static builds (ie for .deb packages). We need to link some things
@@ -87,14 +87,10 @@ def configure(conf):
conf.env.STLIB_AVUTIL = ['avutil']
conf.env.HAVE_SWSCALE = 1
conf.env.STLIB_SWSCALE = ['swscale']
- conf.env.HAVE_SWRESAMPLE = 1
- conf.env.STLIB_SWRESAMPLE = ['swresample']
conf.env.HAVE_POSTPROC = 1
conf.env.STLIB_POSTPROC = ['postproc']
-
- # This doesn't seem to be set up, and we need it otherwise resampling support
- # won't be included. Hack upon a hack, obviously
- conf.env.append_value('CXXFLAGS', ['-DHAVE_SWRESAMPLE=1'])
+ conf.env.HAVE_SWRESAMPLE = 1
+ conv.env.STLIB_SWRESAMPLE = ['swresample']
conf.check_cfg(package = 'sndfile', args = '--cflags --libs', uselib_store = 'SNDFILE', mandatory = True)
conf.check_cfg(package = 'glib-2.0', args = '--cflags --libs', uselib_store = 'GLIB', mandatory = True)