using std::cout;
using std::distance;
using std::pair;
+using std::vector;
using std::list;
using boost::shared_ptr;
using boost::scoped_ptr;
DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film)
- , SingleStreamAudioContent (film)
+ , AudioContent (film)
, _has_subtitles (false)
, _encrypted (false)
, _kdm_valid (false)
DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
- , SingleStreamAudioContent (film, node, version)
+ , AudioContent (film, node)
+ , _audio_stream (new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
{
video.reset (new VideoContent (this, film, node, version));
subtitle.reset (new SubtitleContent (this, film, node, version));
shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
video->take_from_video_examiner (examiner);
set_default_colour_conversion ();
- take_from_audio_examiner (examiner);
+
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
+ AudioMapping m = _audio_stream->mapping ();
+ film()->make_audio_mapping_default (m);
+ _audio_stream->set_mapping (m);
+ }
+
+ signal_changed (AudioContentProperty::AUDIO_STREAMS);
{
boost::mutex::scoped_lock lm (_mutex);
Content::as_xml (node);
video->as_xml (node);
- SingleStreamAudioContent::as_xml (node);
+ AudioContent::as_xml (node);
+ node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_stream()->frame_rate ()));
+ audio_stream()->mapping().as_xml (node->add_child("AudioMapping"));
subtitle->as_xml (node);
boost::mutex::scoped_lock lm (_mutex);
void
DCPContent::add_properties (list<UserProperty>& p) const
{
- SingleStreamAudioContent::add_properties (p);
+ AudioContent::add_properties (p);
}
void
{
return video->video_frame_rate ();
}
+
+vector<AudioStreamPtr>
+DCPContent::audio_streams () const
+{
+ vector<AudioStreamPtr> s;
+ s.push_back (_audio_stream);
+ return s;
+}
* @brief DCPContent class.
*/
-#include "single_stream_audio_content.h"
+#include "audio_content.h"
#include <libcxml/cxml.h>
#include <dcp/encrypted_kdm.h>
/** @class DCPContent
* @brief An existing DCP used as input.
*/
-class DCPContent : public SingleStreamAudioContent
+class DCPContent : public AudioContent
{
public:
DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
bool can_reference_subtitle (std::list<std::string> &) const;
+ std::vector<AudioStreamPtr> audio_streams () const;
+
+ AudioStreamPtr audio_stream () const {
+ return _audio_stream;
+ }
+
protected:
void add_properties (std::list<UserProperty>& p) const;
* rather than by rewrapping.
*/
bool _reference_subtitle;
+
+ boost::shared_ptr<AudioStream> _audio_stream;
};
#endif
+++ /dev/null
-/*
- Copyright (C) 2014-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 "single_stream_audio_content.h"
-#include "audio_examiner.h"
-#include "film.h"
-#include "raw_convert.h"
-#include <libxml++/libxml++.h>
-#include <iostream>
-
-#include "i18n.h"
-
-using std::string;
-using std::cout;
-using std::vector;
-using std::list;
-using std::pair;
-using boost::shared_ptr;
-
-SingleStreamAudioContent::SingleStreamAudioContent (shared_ptr<const Film> film)
- : Content (film)
- , AudioContent (film)
-{
-
-}
-
-SingleStreamAudioContent::SingleStreamAudioContent (shared_ptr<const Film> film, boost::filesystem::path p)
- : Content (film, p)
- , AudioContent (film, p)
-{
-
-}
-
-SingleStreamAudioContent::SingleStreamAudioContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
- : Content (film, node)
- , AudioContent (film, node)
- , _audio_stream (new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
-{
-
-}
-
-void
-SingleStreamAudioContent::as_xml (xmlpp::Node* node) const
-{
- AudioContent::as_xml (node);
- node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_stream()->frame_rate ()));
- audio_stream()->mapping().as_xml (node->add_child("AudioMapping"));
-}
-
-void
-SingleStreamAudioContent::take_from_audio_examiner (shared_ptr<AudioExaminer> examiner)
-{
- {
- boost::mutex::scoped_lock lm (_mutex);
- _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
- AudioMapping m = _audio_stream->mapping ();
- film()->make_audio_mapping_default (m);
- _audio_stream->set_mapping (m);
- }
-
- signal_changed (AudioContentProperty::AUDIO_STREAMS);
-}
-
-vector<AudioStreamPtr>
-SingleStreamAudioContent::audio_streams () const
-{
- vector<AudioStreamPtr> s;
- s.push_back (_audio_stream);
- return s;
-}
-
+++ /dev/null
-/*
- Copyright (C) 2014-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.
-
-*/
-
-/** @file src/lib/single_stream_audio_content.h
- * @brief SingleStreamAudioContent class.
- */
-
-#ifndef DCPOMATIC_SINGLE_STREAM_AUDIO_CONTENT_H
-#define DCPOMATIC_SINGLE_STREAM_AUDIO_CONTENT_H
-
-#include "audio_content.h"
-
-class AudioExaminer;
-
-/** @class SingleStreamAudioContent
- * @brief A piece of AudioContent that has a single audio stream.
- */
-class SingleStreamAudioContent : public AudioContent
-{
-public:
- SingleStreamAudioContent (boost::shared_ptr<const Film>);
- SingleStreamAudioContent (boost::shared_ptr<const Film>, boost::filesystem::path);
- SingleStreamAudioContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr node, int version);
-
- void as_xml (xmlpp::Node* node) const;
-
- std::vector<AudioStreamPtr> audio_streams () const;
-
- AudioStreamPtr audio_stream () const {
- return _audio_stream;
- }
-
- void take_from_audio_examiner (boost::shared_ptr<AudioExaminer>);
-
-protected:
- boost::shared_ptr<AudioStream> _audio_stream;
-};
-
-#endif
/*
- 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
using std::string;
using std::cout;
+using std::vector;
using boost::shared_ptr;
SndfileContent::SndfileContent (shared_ptr<const Film> film, boost::filesystem::path p)
: Content (film, p)
- , SingleStreamAudioContent (film, p)
+ , AudioContent (film, p)
{
}
SndfileContent::SndfileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
: Content (film, node)
- , SingleStreamAudioContent (film, node, version)
+ , AudioContent (film, node)
, _audio_length (node->number_child<Frame> ("AudioLength"))
+ , _audio_stream (new AudioStream (node->number_child<int> ("AudioFrameRate"), AudioMapping (node->node_child ("AudioMapping"), version)))
{
}
{
node->add_child("Type")->add_child_text ("Sndfile");
Content::as_xml (node);
- SingleStreamAudioContent::as_xml (node);
+ AudioContent::as_xml (node);
+ node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_stream()->frame_rate ()));
+ audio_stream()->mapping().as_xml (node->add_child("AudioMapping"));
node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
}
void
SndfileContent::take_from_audio_examiner (shared_ptr<AudioExaminer> examiner)
{
- SingleStreamAudioContent::take_from_audio_examiner (examiner);
-
- boost::mutex::scoped_lock lm (_mutex);
- _audio_length = examiner->audio_length ();
+ {
+ boost::mutex::scoped_lock lm (_mutex);
+ _audio_stream.reset (new AudioStream (examiner->audio_frame_rate(), examiner->audio_channels ()));
+ AudioMapping m = _audio_stream->mapping ();
+ film()->make_audio_mapping_default (m);
+ _audio_stream->set_mapping (m);
+ _audio_length = examiner->audio_length ();
+ }
+
+ signal_changed (AudioContentProperty::AUDIO_STREAMS);
}
DCPTime
FrameRateChange const frc (audio_video_frame_rate(), film()->video_frame_rate());
return DCPTime::from_frames (audio_length() / frc.speed_up, audio_stream()->frame_rate ());
}
+
+vector<AudioStreamPtr>
+SndfileContent::audio_streams () const
+{
+ vector<AudioStreamPtr> s;
+ s.push_back (_audio_stream);
+ return s;
+}
/*
- 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
#ifndef DCPOMATIC_SNDFILE_CONTENT_H
#define DCPOMATIC_SNDFILE_CONTENT_H
-#include "single_stream_audio_content.h"
+#include "audio_content.h"
-class SndfileContent : public SingleStreamAudioContent
+class AudioExaminer;
+
+class SndfileContent : public AudioContent
{
public:
SndfileContent (boost::shared_ptr<const Film>, boost::filesystem::path);
void take_from_audio_examiner (boost::shared_ptr<AudioExaminer>);
+ std::vector<AudioStreamPtr> audio_streams () const;
+
+ AudioStreamPtr audio_stream () const {
+ return _audio_stream;
+ }
+
static bool valid_file (boost::filesystem::path);
private:
}
Frame _audio_length;
+
+ boost::shared_ptr<AudioStream> _audio_stream;
};
#endif
send_kdm_email_job.cc
send_problem_report_job.cc
server.cc
- single_stream_audio_content.cc
sndfile_base.cc
sndfile_content.cc
sndfile_decoder.cc
#include "lib/content.h"
#include "lib/video_content.h"
#include "lib/audio_content.h"
-#include "lib/single_stream_audio_content.h"
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>