summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-07 19:07:35 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-07 19:07:35 +0000
commit978be856218cc15f059b7e267811e7302c37b24d (patch)
tree41b97f950dbc5c30953abe4e98ca5053bdff73bc /src
parentae0e45e03ab168de0d291cfa1520beedd6a0a899 (diff)
Remove template from TimedAudioBuffers; a couple of small fixes.
Diffstat (limited to 'src')
-rw-r--r--src/lib/audio_merger.cc10
-rw-r--r--src/lib/audio_merger.h4
-rw-r--r--src/lib/decoded.h4
-rw-r--r--src/lib/ffmpeg_examiner.cc1
-rw-r--r--src/lib/player.cc4
-rw-r--r--src/lib/subrip_content.cc6
-rw-r--r--src/lib/types.h6
-rw-r--r--src/lib/video_content.cc2
8 files changed, 18 insertions, 19 deletions
diff --git a/src/lib/audio_merger.cc b/src/lib/audio_merger.cc
index d50420c31..ad110a44f 100644
--- a/src/lib/audio_merger.cc
+++ b/src/lib/audio_merger.cc
@@ -33,12 +33,12 @@ AudioMerger::AudioMerger (int channels, int frame_rate)
}
-TimedAudioBuffers<DCPTime>
+TimedAudioBuffers
AudioMerger::pull (DCPTime time)
{
assert (time >= _last_pull);
- TimedAudioBuffers<DCPTime> out;
+ TimedAudioBuffers out;
int64_t const to_return = DCPTime (time - _last_pull).frames (_frame_rate);
out.audio.reset (new AudioBuffers (_buffers->channels(), to_return));
@@ -74,14 +74,14 @@ AudioMerger::push (shared_ptr<const AudioBuffers> audio, DCPTime time)
_buffers->set_frames (after);
}
-TimedAudioBuffers<DCPTime>
+TimedAudioBuffers
AudioMerger::flush ()
{
if (_buffers->frames() == 0) {
- return TimedAudioBuffers<DCPTime> ();
+ return TimedAudioBuffers ();
}
- return TimedAudioBuffers<DCPTime> (_buffers, _last_pull);
+ return TimedAudioBuffers (_buffers, _last_pull);
}
void
diff --git a/src/lib/audio_merger.h b/src/lib/audio_merger.h
index 121b21095..756e5ab31 100644
--- a/src/lib/audio_merger.h
+++ b/src/lib/audio_merger.h
@@ -29,9 +29,9 @@ public:
/** Pull audio up to a given time; after this call, no more data can be pushed
* before the specified time.
*/
- TimedAudioBuffers<DCPTime> pull (DCPTime time);
+ TimedAudioBuffers pull (DCPTime time);
void push (boost::shared_ptr<const AudioBuffers> audio, DCPTime time);
- TimedAudioBuffers<DCPTime> flush ();
+ TimedAudioBuffers flush ();
void clear (DCPTime t);
private:
diff --git a/src/lib/decoded.h b/src/lib/decoded.h
index 30fe89988..ebf4e57c1 100644
--- a/src/lib/decoded.h
+++ b/src/lib/decoded.h
@@ -121,8 +121,8 @@ public:
/* Assuming that all subs are at the same time */
DecodedTextSubtitle (std::list<dcp::SubtitleString> s)
- : Decoded (ContentTime::from_seconds (subs.front().in().to_ticks() * 4 / 1000.0))
- , content_time_to (ContentTime::from_seconds (subs.front().out().to_ticks() * 4 / 1000.0))
+ : Decoded (ContentTime::from_seconds (s.front().in().to_ticks() * 4 / 1000.0))
+ , content_time_to (ContentTime::from_seconds (s.front().out().to_ticks() * 4 / 1000.0))
, subs (s)
{
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc
index 093df0989..6daba4b40 100644
--- a/src/lib/ffmpeg_examiner.cc
+++ b/src/lib/ffmpeg_examiner.cc
@@ -121,7 +121,6 @@ FFmpegExaminer::video_frame_rate () const
AVStream* s = _format_context->streams[_video_stream];
if (s->avg_frame_rate.num && s->avg_frame_rate.den) {
- cout << "here we bitchen well are " << av_q2d (s->avg_frame_rate) << "\n";
return av_q2d (s->avg_frame_rate);
}
diff --git a/src/lib/player.cc b/src/lib/player.cc
index d340ea9b4..e6e1f3753 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -162,7 +162,7 @@ Player::pass ()
if (earliest_audio.get() < 0) {
earliest_audio = DCPTime ();
}
- TimedAudioBuffers<DCPTime> tb = _audio_merger.pull (earliest_audio);
+ TimedAudioBuffers tb = _audio_merger.pull (earliest_audio);
Audio (tb.audio, tb.time);
/* This assumes that the audio-frames-to-time conversion is exact
so that there are no accumulated errors caused by rounding.
@@ -383,7 +383,7 @@ Player::emit_audio (weak_ptr<Piece> weak_piece, shared_ptr<DecodedAudio> audio)
void
Player::flush ()
{
- TimedAudioBuffers<DCPTime> tb = _audio_merger.flush ();
+ TimedAudioBuffers tb = _audio_merger.flush ();
if (_audio && tb.audio) {
Audio (tb.audio, tb.time);
_audio_position += DCPTime::from_frames (tb.audio->frames (), _film->audio_frame_rate ());
diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc
index bf034200d..9524cf96b 100644
--- a/src/lib/subrip_content.cc
+++ b/src/lib/subrip_content.cc
@@ -50,9 +50,11 @@ SubRipContent::examine (boost::shared_ptr<Job> job)
{
Content::examine (job);
SubRip s (shared_from_this ());
- boost::mutex::scoped_lock lm (_mutex);
shared_ptr<const Film> film = _film.lock ();
- _length = DCPTime (s.length (), film->active_frame_rate_change (position ()));
+ DCPTime len (s.length (), film->active_frame_rate_change (position ()));
+
+ boost::mutex::scoped_lock lm (_mutex);
+ _length = len;
}
string
diff --git a/src/lib/types.h b/src/lib/types.h
index 42344cae5..dafea92f8 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -24,6 +24,7 @@
#include <stdint.h>
#include <boost/shared_ptr.hpp>
#include <dcp/util.h>
+#include "dcpomatic_time.h"
class Content;
class VideoContent;
@@ -44,20 +45,19 @@ typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
-template<class T>
struct TimedAudioBuffers
{
TimedAudioBuffers ()
: time (0)
{}
- TimedAudioBuffers (boost::shared_ptr<AudioBuffers> a, T t)
+ TimedAudioBuffers (boost::shared_ptr<AudioBuffers> a, DCPTime t)
: audio (a)
, time (t)
{}
boost::shared_ptr<AudioBuffers> audio;
- T time;
+ DCPTime time;
};
enum VideoFrameType
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index d6122eb51..11310c5da 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -180,13 +180,11 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
/* These examiner calls could call other content methods which take a lock on the mutex */
dcp::Size const vs = d->video_size ();
float const vfr = d->video_frame_rate ();
- cout << "taking " << vfr << "\n";
{
boost::mutex::scoped_lock lm (_mutex);
_video_size = vs;
_video_frame_rate = vfr;
- cout << "and then " << _video_frame_rate << "\n";
}
signal_changed (VideoContentProperty::VIDEO_SIZE);