/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 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
*/
#include "ffmpeg_content.h"
+#include "audio_content.h"
#include "image_content.h"
-#include "sndfile_content.h"
#include "text_subtitle_content.h"
#include "dcp_content.h"
#include "dcp_subtitle_content.h"
#include "util.h"
+#include "ffmpeg_audio_stream.h"
#include "film.h"
#include "log_entry.h"
#include "log.h"
boost::shared_ptr<Content> content;
if (type == "FFmpeg") {
+ /* SndfileContent is now handled by the FFmpeg code rather than by
+ separate libsndfile-based code.
+ */
content.reset (new FFmpegContent (film, node, version, notes));
} else if (type == "Image") {
content.reset (new ImageContent (film, node, version));
} else if (type == "Sndfile") {
- content.reset (new SndfileContent (film, node, version));
+ /* SndfileContent is now handled by the FFmpeg code rather than by
+ separate libsndfile-based code.
+ */
+ content.reset (new FFmpegContent (film, node, version, notes));
+
+ content->audio->set_stream (
+ AudioStreamPtr (
+ new FFmpegAudioStream (
+ "Stream", 0,
+ node->number_child<int> ("AudioFrameRate"),
+ node->number_child<Frame> ("AudioLength"),
+ AudioMapping (node->node_child ("AudioMapping"), version)
+ )
+ )
+ );
+
} else if (type == "SubRip" || type == "TextSubtitle") {
content.reset (new TextSubtitleContent (film, node, version));
} else if (type == "DCP") {
if (valid_image_file (path)) {
content.reset (new ImageContent (film, path));
- } else if (SndfileContent::valid_file (path)) {
- content.reset (new SndfileContent (film, path));
} else if (ext == ".srt" || ext == ".ssa") {
content.reset (new TextSubtitleContent (film, path));
} else if (ext == ".xml") {
, AudioStream (frame_rate, length, channels)
{}
+ FFmpegAudioStream (std::string name, int id, int frame_rate, Frame length, AudioMapping mapping)
+ : FFmpegStream (name, id)
+ , AudioStream (frame_rate, length, mapping)
+ {}
+
FFmpegAudioStream (cxml::ConstNodePtr, int);
void as_xml (xmlpp::Node *) const;
#include "film.h"
#include "ffmpeg_decoder.h"
#include "video_decoder.h"
+#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_content.h"
#include "ffmpeg_content.h"
#include "image_decoder.h"
+#include "content_audio.h"
#include "image_content.h"
-#include "sndfile_decoder.h"
-#include "sndfile_content.h"
#include "subtitle_content.h"
#include "text_subtitle_decoder.h"
#include "text_subtitle_content.h"
frc = FrameRateChange (ic->active_video_frame_rate(), _film->video_frame_rate());
}
- /* SndfileContent */
- shared_ptr<const SndfileContent> sc = dynamic_pointer_cast<const SndfileContent> (i);
- if (sc) {
- decoder.reset (new SndfileDecoder (sc, _fast, _film->log()));
-
- /* Work out a FrameRateChange for the best overlap video for this content */
- DCPTime best_overlap_t;
- shared_ptr<Content> best_overlap;
- BOOST_FOREACH (shared_ptr<Content> j, _playlist->content ()) {
- if (!j->video) {
- continue;
- }
-
- DCPTime const overlap = min (j->end(), i->end()) - max (j->position(), i->position());
- if (overlap > best_overlap_t) {
- best_overlap = j;
- best_overlap_t = overlap;
- }
- }
-
- if (best_overlap) {
- frc = FrameRateChange (best_overlap->active_video_frame_rate(), _film->video_frame_rate ());
- } else {
- /* No video overlap; e.g. if the DCP is just audio */
- frc = FrameRateChange (_film->video_frame_rate(), _film->video_frame_rate ());
- }
- }
-
/* It's questionable whether subtitle content should have a video frame rate; perhaps
it should be assumed that any subtitle content has been prepared at the same rate
as simultaneous video content (like we do with audio).
*/
#include "playlist.h"
-#include "sndfile_content.h"
-#include "sndfile_decoder.h"
#include "video_content.h"
#include "subtitle_content.h"
#include "ffmpeg_decoder.h"
+++ /dev/null
-/*
- Copyright (C) 2012-2015 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifdef DCPOMATIC_WINDOWS
-#include <windows.h>
-#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
-#endif
-#include <sndfile.h>
-
-#include "sndfile_base.h"
-#include "sndfile_content.h"
-#include "exceptions.h"
-
-#include "i18n.h"
-
-using boost::shared_ptr;
-
-Sndfile::Sndfile (shared_ptr<const SndfileContent> c)
- : _sndfile_content (c)
-{
- _info.format = 0;
-
- /* Here be monsters. See fopen_boost for similar shenanigans */
-#ifdef DCPOMATIC_WINDOWS
- _sndfile = sf_wchar_open (_sndfile_content->path(0).c_str(), SFM_READ, &_info);
-#else
- _sndfile = sf_open (_sndfile_content->path(0).string().c_str(), SFM_READ, &_info);
-#endif
-
- if (!_sndfile) {
- throw DecodeError (_("could not open audio file for reading"));
- }
-}
-
-Sndfile::~Sndfile ()
-{
- sf_close (_sndfile);
-}
+++ /dev/null
-/*
- Copyright (C) 2012-2015 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef DCPOMATIC_SNDFILE_BASE_H
-#define DCPOMATIC_SNDFILE_BASE_H
-
-#include <sndfile.h>
-#include <boost/shared_ptr.hpp>
-
-class SndfileContent;
-
-class Sndfile
-{
-public:
- Sndfile (boost::shared_ptr<const SndfileContent> content);
- virtual ~Sndfile ();
-
-protected:
- boost::shared_ptr<const SndfileContent> _sndfile_content;
- SNDFILE* _sndfile;
- SF_INFO _info;
-};
-
-#endif
+++ /dev/null
-/*
- Copyright (C) 2013-2016 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef DCPOMATIC_SNDFILE_CONTENT_H
-#define DCPOMATIC_SNDFILE_CONTENT_H
-
-#include "content.h"
-
-class AudioExaminer;
-
-class SndfileContent : public Content
-{
-public:
- SndfileContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- SndfileContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
-
- boost::shared_ptr<SndfileContent> shared_from_this () {
- return boost::dynamic_pointer_cast<SndfileContent> (Content::shared_from_this ());
- }
-
- DCPTime full_length () const;
-
- void examine (boost::shared_ptr<Job>);
- std::string summary () const;
- std::string technical_summary () const;
- std::string information () const;
- void as_xml (xmlpp::Node *) const;
-
- static bool valid_file (boost::filesystem::path);
-};
-
-#endif
+++ /dev/null
-/*
- Copyright (C) 2012-2016 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <iostream>
-#include <sndfile.h>
-#include "audio_content.h"
-#include "sndfile_content.h"
-#include "sndfile_decoder.h"
-#include "exceptions.h"
-#include "audio_buffers.h"
-
-#include "i18n.h"
-
-using std::vector;
-using std::string;
-using std::min;
-using std::cout;
-using boost::shared_ptr;
-
-SndfileDecoder::SndfileDecoder (shared_ptr<const SndfileContent> c, bool fast, shared_ptr<Log> log)
- : Sndfile (c)
- , _done (0)
- , _remaining (_info.frames)
- , _deinterleave_buffer (0)
-{
- audio.reset (new AudioDecoder (this, c->audio, fast, log));
-}
-
-SndfileDecoder::~SndfileDecoder ()
-{
- delete[] _deinterleave_buffer;
-}
-
-bool
-SndfileDecoder::pass (PassReason, bool)
-{
- if (_remaining == 0) {
- return true;
- }
-
- /* Do things in half second blocks as I think there may be limits
- to what FFmpeg (and in particular the resampler) can cope with.
- */
- sf_count_t const block = _sndfile_content->audio->stream()->frame_rate() / 2;
- sf_count_t const this_time = min (block, _remaining);
-
- int const channels = _sndfile_content->audio->stream()->channels ();
-
- shared_ptr<AudioBuffers> data (new AudioBuffers (channels, this_time));
-
- if (_sndfile_content->audio->stream()->channels() == 1) {
- /* No de-interleaving required */
- sf_read_float (_sndfile, data->data(0), this_time);
- } else {
- /* Deinterleave */
- if (!_deinterleave_buffer) {
- _deinterleave_buffer = new float[block * channels];
- }
- sf_readf_float (_sndfile, _deinterleave_buffer, this_time);
- vector<float*> out_ptr (channels);
- for (int i = 0; i < channels; ++i) {
- out_ptr[i] = data->data(i);
- }
- float* in_ptr = _deinterleave_buffer;
- for (int i = 0; i < this_time; ++i) {
- for (int j = 0; j < channels; ++j) {
- *out_ptr[j]++ = *in_ptr++;
- }
- }
- }
-
- data->set_frames (this_time);
- audio->give (_sndfile_content->audio->stream (), data, ContentTime::from_frames (_done, _info.samplerate));
- _done += this_time;
- _remaining -= this_time;
-
- return _remaining == 0;
-}
-
-void
-SndfileDecoder::seek (ContentTime t, bool accurate)
-{
- audio->seek (t, accurate);
-
- _done = t.frames_round (_info.samplerate);
- _remaining = _info.frames - _done;
-}
+++ /dev/null
-/*
- Copyright (C) 2012-2016 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "audio_decoder.h"
-#include "sndfile_base.h"
-
-class SndfileContent;
-
-class SndfileDecoder : public Sndfile, public Decoder
-{
-public:
- SndfileDecoder (boost::shared_ptr<const SndfileContent> c, bool fast, boost::shared_ptr<Log> log);
- ~SndfileDecoder ();
-
-private:
- bool pass (PassReason, bool);
- void seek (ContentTime, bool);
-
- int64_t _done;
- int64_t _remaining;
- float* _deinterleave_buffer;
-};
+++ /dev/null
-/*
- Copyright (C) 2015 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "sndfile_examiner.h"
-
-using boost::shared_ptr;
-
-SndfileExaminer::SndfileExaminer (shared_ptr<const SndfileContent> content)
- : Sndfile (content)
-{
-
-}
-
-int
-SndfileExaminer::audio_channels () const
-{
- return _info.channels;
-}
-
-Frame
-SndfileExaminer::audio_length () const
-{
- return _info.frames;
-}
-
-int
-SndfileExaminer::audio_frame_rate () const
-{
- return _info.samplerate;
-}
+++ /dev/null
-/*
- Copyright (C) 2015 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
- 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "sndfile_base.h"
-#include "audio_examiner.h"
-
-class SndfileExaminer : public Sndfile, public AudioExaminer
-{
-public:
- SndfileExaminer (boost::shared_ptr<const SndfileContent> content);
-
- int audio_channels () const;
- Frame audio_length () const;
- int audio_frame_rate () const;
-};
send_kdm_email_job.cc
send_problem_report_job.cc
server.cc
- sndfile_base.cc
- sndfile_content.cc
- sndfile_decoder.cc
- sndfile_examiner.cc
string_log_entry.cc
text_subtitle.cc
text_subtitle_content.cc
obj.uselib = """
AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE
BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 BOOST_REGEX
- SNDFILE SAMPLERATE POSTPROC TIFF MAGICK SSH DCP CXML GLIB LZMA XML++
+ SAMPLERATE POSTPROC TIFF MAGICK SSH DCP CXML GLIB LZMA XML++
CURL ZIP FONTCONFIG PANGOMM CAIROMM XMLSEC SUB ICU
"""
#include "lib/audio_analysis.h"
#include "lib/analyse_audio_job.h"
#include "lib/film.h"
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/dcp_content_type.h"
#include "lib/ffmpeg_content.h"
#include "lib/ratio.h"
film->set_name ("audio_analysis_test");
boost::filesystem::path p = private_data / "betty_L.wav";
- shared_ptr<SndfileContent> c (new SndfileContent (film, p));
+ shared_ptr<FFmpegContent> c (new FFmpegContent (film, p));
film->examine_and_add_content (c);
wait_for_jobs ();
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
*/
/** @file test/audio_delay_test.cc
- * @brief Test encode using some SndfileContents which have audio delays.
+ * @brief Test encode using some FFmpegContents which have audio delays.
*
* The output is checked algorithmically using knowledge of the input.
*/
#include <dcp/reel.h>
#include <dcp/sound_asset.h>
#include <dcp/reel_sound_asset.h>
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/dcp_content_type.h"
#include "lib/ratio.h"
#include "lib/film.h"
film->set_container (Ratio::from_id ("185"));
film->set_name (film_name);
- shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/staircase.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
content->audio->set_delay (delay_in_ms);
film->examine_and_add_content (content);
wait_for_jobs ();
#include "lib/analyse_audio_job.h"
#include "lib/dcp_content_type.h"
#include "lib/job_manager.h"
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
{
shared_ptr<Film> film = new_test_film ("audio_processor_test");
film->set_name ("audio_processor_test");
- shared_ptr<SndfileContent> c (new SndfileContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/white.wav"));
film->examine_and_add_content (c);
wait_for_jobs ();
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 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
#include <dcp/sound_frame.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel.h>
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include "lib/video_content.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
#include "lib/image_content.h"
-#include "lib/sndfile_content.h"
#include "lib/video_content.h"
#include "lib/audio_mapping.h"
+#include "lib/ffmpeg_content.h"
#include "lib/audio_content.h"
#include "test.h"
#include <iostream>
/* Test audio channel markup */
film->set_audio_channels (6);
- shared_ptr<SndfileContent> sound (new SndfileContent (film, "test/data/sine_440.wav"));
+ shared_ptr<FFmpegContent> sound (new FFmpegContent (film, "test/data/sine_440.wav"));
film->examine_and_add_content (sound);
wait_for_jobs ();
BOOST_CHECK_EQUAL (film->isdcf_name(false), "LikeShouting_XSN-2_F-133_DE-fr_US-R_10_4K_DI_20140704_PP_SMPTE_OV");
#include <dcp/sound_frame.h>
#include <dcp/reel.h>
#include <dcp/reel_sound_asset.h>
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include "lib/ratio.h"
film->set_container (Ratio::from_id ("185"));
film->set_name (film_name);
- shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/staircase.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/staircase.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
#include "lib/film.h"
#include "lib/ratio.h"
#include "lib/dcp_content_type.h"
-#include "lib/sndfile_content.h"
+#include "lib/ffmpeg_content.h"
#include "lib/player.h"
#include "lib/audio_buffers.h"
#include "lib/upmixer_a.h"
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_audio_processor (AudioProcessor::from_id ("stereo-5.1-upmix-a"));
- shared_ptr<SndfileContent> content (new SndfileContent (film, "test/data/white.wav"));
+ shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/white.wav"));
film->examine_and_add_content (content);
wait_for_jobs ();
if conf.env.TARGET_WINDOWS:
boost_test_suffix='-mt'
- conf.check_cxx(fragment = """
- #define BOOST_TEST_MODULE Config test\n
- #include <boost/test/unit_test.hpp>\n
- int main() {}
- """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework%s' % boost_test_suffix, uselib_store = 'BOOST_TEST')
+ conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
+
+ conf.check_cxx(fragment="""
+ #define BOOST_TEST_MODULE Config test\n
+ #include <boost/test/unit_test.hpp>\n
+ int main() {}
+ """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework%s' % boost_test_suffix, uselib_store = 'BOOST_TEST')
def build(bld):
obj = bld(features='cxx cxxprogram')
lib=['icuio', 'icui18n', 'icudata', 'icuuc'],
uselib_store='ICU')
- # libsndfile
- conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
-
# libsamplerate
conf.check_cfg(package='samplerate', args='--cflags --libs', uselib_store='SAMPLERATE', mandatory=True)