summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-04-13 18:39:56 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit6dd3777a0074f6f97c7f7286621006a1c14376e8 (patch)
treef151d71e7d5616e87d1b1d087e4a3034d676dee7 /src/lib
parentc5dab5fdc0edde080e408a6d24fa059e27106ef5 (diff)
Copy SingleStreamAudioContent into DCPContent and SndfileContent.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_content.cc31
-rw-r--r--src/lib/dcp_content.h12
-rw-r--r--src/lib/single_stream_audio_content.cc87
-rw-r--r--src/lib/single_stream_audio_content.h55
-rw-r--r--src/lib/sndfile_content.cc34
-rw-r--r--src/lib/sndfile_content.h16
-rw-r--r--src/lib/wscript1
7 files changed, 75 insertions, 161 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 81068262b..a81a152c1 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -42,6 +42,7 @@ using std::string;
using std::cout;
using std::distance;
using std::pair;
+using std::vector;
using std::list;
using boost::shared_ptr;
using boost::scoped_ptr;
@@ -54,7 +55,7 @@ int const DCPContentProperty::REFERENCE_SUBTITLE = 603;
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)
@@ -71,7 +72,8 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
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));
@@ -111,7 +113,16 @@ DCPContent::examine (shared_ptr<Job> job)
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);
@@ -148,7 +159,9 @@ DCPContent::as_xml (xmlpp::Node* node) const
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);
@@ -213,7 +226,7 @@ DCPContent::directory () const
void
DCPContent::add_properties (list<UserProperty>& p) const
{
- SingleStreamAudioContent::add_properties (p);
+ AudioContent::add_properties (p);
}
void
@@ -347,3 +360,11 @@ DCPContent::subtitle_video_frame_rate () const
{
return video->video_frame_rate ();
}
+
+vector<AudioStreamPtr>
+DCPContent::audio_streams () const
+{
+ vector<AudioStreamPtr> s;
+ s.push_back (_audio_stream);
+ return s;
+}
diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h
index 81432b6d3..f3cd6bf65 100644
--- a/src/lib/dcp_content.h
+++ b/src/lib/dcp_content.h
@@ -24,7 +24,7 @@
* @brief DCPContent class.
*/
-#include "single_stream_audio_content.h"
+#include "audio_content.h"
#include <libcxml/cxml.h>
#include <dcp/encrypted_kdm.h>
@@ -40,7 +40,7 @@ public:
/** @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);
@@ -120,6 +120,12 @@ public:
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;
@@ -147,6 +153,8 @@ private:
* rather than by rewrapping.
*/
bool _reference_subtitle;
+
+ boost::shared_ptr<AudioStream> _audio_stream;
};
#endif
diff --git a/src/lib/single_stream_audio_content.cc b/src/lib/single_stream_audio_content.cc
deleted file mode 100644
index b1291df45..000000000
--- a/src/lib/single_stream_audio_content.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- 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;
-}
-
diff --git a/src/lib/single_stream_audio_content.h b/src/lib/single_stream_audio_content.h
deleted file mode 100644
index 7ae6dbaa4..000000000
--- a/src/lib/single_stream_audio_content.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- 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
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index f9eb62a2b..d8435613d 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -1,5 +1,5 @@
/*
- 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
@@ -34,19 +34,21 @@
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)))
{
}
@@ -56,7 +58,9 @@ SndfileContent::as_xml (xmlpp::Node* node) const
{
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 ()));
}
@@ -97,10 +101,16 @@ SndfileContent::examine (shared_ptr<Job> job)
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
@@ -109,3 +119,11 @@ SndfileContent::full_length () const
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;
+}
diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h
index 9dcf954b5..5f89b7cc8 100644
--- a/src/lib/sndfile_content.h
+++ b/src/lib/sndfile_content.h
@@ -1,5 +1,5 @@
/*
- 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
@@ -20,9 +20,11 @@
#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);
@@ -42,6 +44,12 @@ public:
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:
@@ -51,6 +59,8 @@ private:
}
Frame _audio_length;
+
+ boost::shared_ptr<AudioStream> _audio_stream;
};
#endif
diff --git a/src/lib/wscript b/src/lib/wscript
index d6d85af49..4104e57a7 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -113,7 +113,6 @@ sources = """
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