_analysis.reset (new AudioAnalysis (_film->audio_channels ()));
_done = 0;
- OutputAudioFrame const len = _film->time_to_audio_frames (_film->length ());
+ AudioFrame const len = _film->time_to_audio_frames (_film->length ());
while (!player->pass ()) {
set_progress (double (_done) / len);
}
void audio (boost::shared_ptr<const AudioBuffers>, DCPTime);
boost::weak_ptr<AudioContent> _content;
- OutputAudioFrame _done;
+ AudioFrame _done;
int64_t _samples_per_point;
std::vector<AudioPoint> _current;
* @param at The time within the DCP to get the active frame rate change from; i.e. a point at which
* the `controlling' video content is active.
*/
-AudioContent::Frame
+AudioFrame
AudioContent::time_to_content_audio_frames (DCPTime t, DCPTime at) const
{
shared_ptr<const Film> film = _film.lock ();
std::string technical_summary () const;
virtual int audio_channels () const = 0;
- virtual AudioContent::Frame audio_length () const = 0;
+ virtual AudioFrame audio_length () const = 0;
virtual int content_audio_frame_rate () const = 0;
virtual int output_audio_frame_rate () const = 0;
virtual AudioMapping audio_mapping () const = 0;
shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this ()));
- VideoContent::Frame video_length = 0;
+ VideoFrame video_length = 0;
video_length = examiner->video_length ();
film->log()->log (String::compose ("Video length obtained from header as %1 frames", video_length));
signal_changed (FFmpegContentProperty::AUDIO_STREAM);
}
-AudioContent::Frame
+AudioFrame
FFmpegContent::audio_length () const
{
int const cafr = content_audio_frame_rate ();
int const vfr = video_frame_rate ();
- VideoContent::Frame const vl = video_length ();
+ VideoFrame const vl = video_length ();
boost::mutex::scoped_lock lm (_mutex);
if (!_audio_stream) {
/* AudioContent */
int audio_channels () const;
- AudioContent::Frame audio_length () const;
+ AudioFrame audio_length () const;
int content_audio_frame_rate () const;
int output_audio_frame_rate () const;
AudioMapping audio_mapping () const;
}
/** @return Length (in video frames) according to our content's header */
-VideoContent::Frame
+VideoFrame
FFmpegExaminer::video_length () const
{
- VideoContent::Frame const length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate();
+ VideoFrame const length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate();
return max (1, length);
}
float video_frame_rate () const;
libdcp::Size video_size () const;
- VideoContent::Frame video_length () const;
+ VideoFrame video_length () const;
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
return _subtitle_streams;
return _playlist->has_subtitles ();
}
-OutputVideoFrame
+VideoFrame
Film::best_video_frame_rate () const
{
return _playlist->best_dcp_frame_rate ();
signal_changed (CONTENT);
}
-OutputAudioFrame
+AudioFrame
Film::time_to_audio_frames (DCPTime t) const
{
return t * audio_frame_rate () / TIME_HZ;
}
-OutputVideoFrame
+VideoFrame
Film::time_to_video_frames (DCPTime t) const
{
return t * video_frame_rate () / TIME_HZ;
}
DCPTime
-Film::audio_frames_to_time (OutputAudioFrame f) const
+Film::audio_frames_to_time (AudioFrame f) const
{
return f * TIME_HZ / audio_frame_rate ();
}
DCPTime
-Film::video_frames_to_time (OutputVideoFrame f) const
+Film::video_frames_to_time (VideoFrame f) const
{
return f * TIME_HZ / video_frame_rate ();
}
-OutputAudioFrame
+AudioFrame
Film::audio_frame_rate () const
{
/* XXX */
boost::shared_ptr<Player> make_player () const;
boost::shared_ptr<Playlist> playlist () const;
- OutputAudioFrame audio_frame_rate () const;
+ AudioFrame audio_frame_rate () const;
- OutputAudioFrame time_to_audio_frames (DCPTime) const;
- OutputVideoFrame time_to_video_frames (DCPTime) const;
- DCPTime video_frames_to_time (OutputVideoFrame) const;
- DCPTime audio_frames_to_time (OutputAudioFrame) const;
+ AudioFrame time_to_audio_frames (DCPTime) const;
+ VideoFrame time_to_video_frames (DCPTime) const;
+ DCPTime video_frames_to_time (VideoFrame) const;
+ DCPTime audio_frames_to_time (AudioFrame) const;
/* Proxies for some Playlist methods */
ContentList content () const;
DCPTime length () const;
bool has_subtitles () const;
- OutputVideoFrame best_video_frame_rate () const;
+ VideoFrame best_video_frame_rate () const;
FrameRateChange active_frame_rate_change (DCPTime) const;
libdcp::KDM
}
void
-ImageContent::set_video_length (VideoContent::Frame len)
+ImageContent::set_video_length (VideoFrame len)
{
{
boost::mutex::scoped_lock lm (_mutex);
std::string identifier () const;
- void set_video_length (VideoContent::Frame);
+ void set_video_length (VideoFrame);
bool still () const;
};
float video_frame_rate () const;
libdcp::Size video_size () const;
- VideoContent::Frame video_length () const {
+ VideoFrame video_length () const {
return _video_length;
}
boost::weak_ptr<const Film> _film;
boost::shared_ptr<const ImageContent> _image_content;
boost::optional<libdcp::Size> _video_size;
- VideoContent::Frame _video_length;
+ VideoFrame _video_length;
};
void do_seek (DCPTime, bool);
void flush ();
void emit_black ();
- void emit_silence (OutputAudioFrame);
+ void emit_silence (AudioFrame);
void film_changed (Film::Property);
void update_subtitle ();
void emit_video (boost::weak_ptr<Piece>, boost::shared_ptr<DecodedVideo>);
/** The time after the last audio that we emitted */
DCPTime _audio_position;
- AudioMerger<DCPTime, AudioContent::Frame> _audio_merger;
+ AudioMerger<DCPTime, AudioFrame> _audio_merger;
libdcp::Size _video_container_size;
boost::shared_ptr<PlayerImage> _black_frame;
, _audio_mapping (node->node_child ("AudioMapping"))
{
_audio_channels = node->number_child<int> ("AudioChannels");
- _audio_length = node->number_child<AudioContent::Frame> ("AudioLength");
+ _audio_length = node->number_child<AudioFrame> ("AudioLength");
_audio_frame_rate = node->number_child<int> ("AudioFrameRate");
}
shared_ptr<const Film> film = _film.lock ();
assert (film);
- OutputAudioFrame const len = audio_length() * output_audio_frame_rate() / content_audio_frame_rate ();
+ AudioFrame const len = audio_length() * output_audio_frame_rate() / content_audio_frame_rate ();
/* XXX: this depends on whether, alongside this audio, we are running video slower or faster than
it should be. The calculation above works out the output audio frames assuming that we are just
return _audio_channels;
}
- AudioContent::Frame audio_length () const {
+ AudioFrame audio_length () const {
boost::mutex::scoped_lock lm (_mutex);
return _audio_length;
}
private:
int _audio_channels;
- AudioContent::Frame _audio_length;
+ AudioFrame _audio_length;
int _audio_frame_rate;
AudioMapping _audio_mapping;
};
return _info.channels;
}
-AudioContent::Frame
+AudioFrame
SndfileDecoder::audio_length () const
{
return _info.frames;
void seek (ContentTime, bool);
int audio_channels () const;
- AudioContent::Frame audio_length () const;
+ AudioFrame audio_length () const;
int audio_frame_rate () const;
private:
boost::shared_ptr<const SndfileContent> _sndfile_content;
SNDFILE* _sndfile;
SF_INFO _info;
- AudioContent::Frame _done;
- AudioContent::Frame _remaining;
+ AudioFrame _done;
+ AudioFrame _remaining;
float* _deinterleave_buffer;
};
}
/* Compute approximate proposed length here, as it's only here that we need it */
- OutputVideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out();
+ VideoFrame const left = _film->time_to_video_frames (_film->length ()) - _transcoder->video_frames_out();
return left / fps;
}
#define TIME_MAX INT64_MAX
#define TIME_HZ ((DCPTime) 96000)
typedef int64_t ContentTime;
-typedef int64_t OutputAudioFrame;
-typedef int OutputVideoFrame;
+typedef int64_t AudioFrame;
+typedef int VideoFrame;
typedef std::vector<boost::shared_ptr<Content> > ContentList;
typedef std::vector<boost::shared_ptr<VideoContent> > VideoContentList;
typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
* @return Equivalent number of audio frames for `v'.
*/
int64_t
-video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second)
+video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second)
{
return ((int64_t) v * audio_sample_rate / frames_per_second);
}
int _timeout;
};
-extern int64_t video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second);
+extern int64_t video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second);
class LocaleGuard
{
setup_default_colour_conversion ();
}
-VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, VideoContent::Frame len)
+VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, VideoFrame len)
: Content (f, s)
, _video_length (len)
, _video_frame_rate (0)
: Content (f, node)
, _ratio (0)
{
- _video_length = node->number_child<VideoContent::Frame> ("VideoLength");
+ _video_length = node->number_child<VideoFrame> ("VideoLength");
_video_size.width = node->number_child<int> ("VideoWidth");
_video_size.height = node->number_child<int> ("VideoHeight");
_video_frame_rate = node->number_child<float> ("VideoFrameRate");
* @return Corresponding frame index, rounded up so that the frame index
* is that of the next complete frame which starts after `t'.
*/
-VideoContent::Frame
+VideoFrame
VideoContent::time_to_content_video_frames (DCPTime t) const
{
shared_ptr<const Film> film = _film.lock ();
typedef int Frame;
VideoContent (boost::shared_ptr<const Film>);
- VideoContent (boost::shared_ptr<const Film>, DCPTime, VideoContent::Frame);
+ VideoContent (boost::shared_ptr<const Film>, DCPTime, VideoFrame);
VideoContent (boost::shared_ptr<const Film>, boost::filesystem::path);
VideoContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>);
VideoContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
virtual std::string information () const;
virtual std::string identifier () const;
- VideoContent::Frame video_length () const {
+ VideoFrame video_length () const {
boost::mutex::scoped_lock lm (_mutex);
return _video_length;
}
libdcp::Size video_size_after_3d_split () const;
libdcp::Size video_size_after_crop () const;
- VideoContent::Frame time_to_content_video_frames (DCPTime) const;
+ VideoFrame time_to_content_video_frames (DCPTime) const;
protected:
void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
- VideoContent::Frame _video_length;
+ VideoFrame _video_length;
private:
friend class ffmpeg_pts_offset_test;
virtual ~VideoExaminer () {}
virtual float video_frame_rate () const = 0;
virtual libdcp::Size video_size () const = 0;
- virtual VideoContent::Frame video_length () const = 0;
+ virtual VideoFrame video_length () const = 0;
};