diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-10 14:13:10 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-10 14:13:10 +0100 |
| commit | cfdd68eb5fb0ef8423e860103ad4e5510994f1da (patch) | |
| tree | 9ea43b250723775329741e59d5bc2dd861bcb7be /src/lib | |
| parent | 1dcfb3a26085ebb3703f40e2f51e43ce3d98be50 (diff) | |
| parent | 5575a950f13dbed1e60d733aee71b316c3429ae0 (diff) | |
Merge master.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_mapping.cc | 9 | ||||
| -rw-r--r-- | src/lib/film.cc | 4 | ||||
| -rw-r--r-- | src/lib/resampler.cc | 34 | ||||
| -rw-r--r-- | src/lib/util.cc | 2 | ||||
| -rw-r--r-- | src/lib/util.h | 4 |
5 files changed, 27 insertions, 26 deletions
diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index f6d747b9b..969397b0b 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -28,6 +28,7 @@ using std::cout; using std::make_pair; using std::pair; using std::string; +using std::min; using boost::shared_ptr; using boost::lexical_cast; using boost::dynamic_pointer_cast; @@ -53,7 +54,7 @@ AudioMapping::setup (int c) _gain.resize (_content_channels); for (int i = 0; i < _content_channels; ++i) { - _gain[i].resize (MAX_AUDIO_CHANNELS); + _gain[i].resize (MAX_DCP_AUDIO_CHANNELS); } } @@ -61,7 +62,7 @@ void AudioMapping::make_default () { for (int i = 0; i < _content_channels; ++i) { - for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) { + for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) { _gain[i][j] = 0; } } @@ -71,7 +72,7 @@ AudioMapping::make_default () set (0, dcp::CENTRE, 1); } else { /* 1:1 mapping */ - for (int i = 0; i < _content_channels; ++i) { + for (int i = 0; i < min (_content_channels, MAX_DCP_AUDIO_CHANNELS); ++i) { set (i, static_cast<dcp::Channel> (i), 1); } } @@ -117,7 +118,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const node->add_child ("ContentChannels")->add_child_text (lexical_cast<string> (_content_channels)); for (int c = 0; c < _content_channels; ++c) { - for (int d = 0; d < MAX_AUDIO_CHANNELS; ++d) { + for (int d = 0; d < MAX_DCP_AUDIO_CHANNELS; ++d) { xmlpp::Element* t = node->add_child ("Gain"); t->set_attribute ("Content", lexical_cast<string> (c)); t->set_attribute ("DCP", lexical_cast<string> (d)); diff --git a/src/lib/film.cc b/src/lib/film.cc index 267138ce6..33cb30460 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -826,6 +826,10 @@ Film::content () const void Film::examine_and_add_content (shared_ptr<Content> c) { + if (dynamic_pointer_cast<FFmpegContent> (c)) { + run_ffprobe (c->path(0), file ("ffprobe.log"), _log); + } + shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), c)); j->Finished.connect (bind (&Film::maybe_add_content, this, boost::weak_ptr<Job> (j), boost::weak_ptr<Content> (c))); JobManager::instance()->add (j); diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc index 00121384d..9a81df499 100644 --- a/src/lib/resampler.cc +++ b/src/lib/resampler.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net> 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 @@ -19,6 +19,7 @@ extern "C" { #include "libavutil/channel_layout.h" +#include "libavutil/opt.h" } #include "resampler.h" #include "audio_buffers.h" @@ -37,24 +38,19 @@ Resampler::Resampler (int in, int out, int channels) , _out_rate (out) , _channels (channels) { - /* We will be using planar float data when we call the - resampler. As far as I can see, the audio channel - layout is not necessary for our purposes; it seems - only to be used get the number of channels and - decide if rematrixing is needed. It won't be, since - input and output layouts are the same. - */ - - _swr_context = swr_alloc_set_opts ( - 0, - av_get_default_channel_layout (_channels), - AV_SAMPLE_FMT_FLTP, - _out_rate, - av_get_default_channel_layout (_channels), - AV_SAMPLE_FMT_FLTP, - _in_rate, - 0, 0 - ); + _swr_context = swr_alloc (); + + /* Sample formats */ + av_opt_set_int (_swr_context, "isf", AV_SAMPLE_FMT_FLTP, 0); + av_opt_set_int (_swr_context, "osf", AV_SAMPLE_FMT_FLTP, 0); + + /* Channel counts */ + av_opt_set_int (_swr_context, "ich", _channels, 0); + av_opt_set_int (_swr_context, "och", _channels, 0); + + /* Sample rates */ + av_opt_set_int (_swr_context, "isr", _in_rate, 0); + av_opt_set_int (_swr_context, "osr", _out_rate, 0); swr_init (_swr_context); } diff --git a/src/lib/util.cc b/src/lib/util.cc index 45d5a757c..0eb14845d 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -737,7 +737,7 @@ ensure_ui_thread () string audio_channel_name (int c) { - assert (MAX_AUDIO_CHANNELS == 12); + assert (MAX_DCP_AUDIO_CHANNELS == 12); /* TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency enhancement channel (sub-woofer). HI is the hearing-impaired audio track and diff --git a/src/lib/util.h b/src/lib/util.h index a13d7ff73..8e65bbb54 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -49,8 +49,8 @@ extern "C" { #undef check -/** The maximum number of audio channels that we can cope with */ -#define MAX_AUDIO_CHANNELS 12 +/** The maximum number of audio channels that we can have in a DCP */ +#define MAX_DCP_AUDIO_CHANNELS 12 #define DCPOMATIC_HELLO "Boys, you gotta learn not to talk to nuns that way" |
