summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-26 16:47:39 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-26 22:32:11 +0100
commitf188128e2577942f030374631d3cf1324a00624a (patch)
tree72c1b82d5b7f90069b7ba2a05e8b209cd527c3e4 /src/lib
parentc4ea2ff06b31ccd20daadbdc968e397eb13a7e36 (diff)
{Video,Audio}Frame -> Frame.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/analyse_audio_job.h4
-rw-r--r--src/lib/audio_decoder.cc22
-rw-r--r--src/lib/audio_decoder.h4
-rw-r--r--src/lib/content_audio.h4
-rw-r--r--src/lib/content_video.h4
-rw-r--r--src/lib/image_decoder.h2
-rw-r--r--src/lib/player.cc14
-rw-r--r--src/lib/player.h6
-rw-r--r--src/lib/types.h3
-rw-r--r--src/lib/util.h1
-rw-r--r--src/lib/video_content.cc4
-rw-r--r--src/lib/video_content.h2
-rw-r--r--src/lib/video_decoder.cc18
-rw-r--r--src/lib/video_decoder.h10
14 files changed, 48 insertions, 50 deletions
diff --git a/src/lib/analyse_audio_job.h b/src/lib/analyse_audio_job.h
index 0f9605eed..ec61c0d39 100644
--- a/src/lib/analyse_audio_job.h
+++ b/src/lib/analyse_audio_job.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ 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
@@ -53,7 +53,7 @@ private:
std::vector<AudioPoint> _current;
float _overall_peak;
- AudioFrame _overall_peak_frame;
+ Frame _overall_peak_frame;
boost::shared_ptr<AudioAnalysis> _analysis;
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index f6133947a..a310650c5 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ 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
@@ -55,11 +55,11 @@ AudioDecoder::reset_decoded_audio ()
}
shared_ptr<ContentAudio>
-AudioDecoder::get_audio (AudioFrame frame, AudioFrame length, bool accurate)
+AudioDecoder::get_audio (Frame frame, Frame length, bool accurate)
{
shared_ptr<ContentAudio> dec;
- AudioFrame const end = frame + length - 1;
+ Frame const end = frame + length - 1;
if (frame < _decoded_audio.frame || end > (_decoded_audio.frame + length * 4)) {
/* Either we have no decoded data, or what we do have is a long way from what we want: seek */
@@ -69,7 +69,7 @@ AudioDecoder::get_audio (AudioFrame frame, AudioFrame length, bool accurate)
/* Offset of the data that we want from the start of _decoded_audio.audio
(to be set up shortly)
*/
- AudioFrame decoded_offset = 0;
+ Frame decoded_offset = 0;
/* Now enough pass() calls will either:
* (a) give us what we want, or
@@ -90,16 +90,16 @@ AudioDecoder::get_audio (AudioFrame frame, AudioFrame length, bool accurate)
/* The amount of data available in _decoded_audio.audio starting from `frame'. This could be -ve
if pass() returned true before we got enough data.
*/
- AudioFrame const available = _decoded_audio.audio->frames() - decoded_offset;
+ Frame const available = _decoded_audio.audio->frames() - decoded_offset;
/* We will return either that, or the requested amount, whichever is smaller */
- AudioFrame const to_return = max ((AudioFrame) 0, min (available, length));
+ Frame const to_return = max ((Frame) 0, min (available, length));
/* Copy our data to the output */
shared_ptr<AudioBuffers> out (new AudioBuffers (_decoded_audio.audio->channels(), to_return));
out->copy_from (_decoded_audio.audio.get(), to_return, decoded_offset, 0);
- AudioFrame const remaining = max ((AudioFrame) 0, available - to_return);
+ Frame const remaining = max ((Frame) 0, available - to_return);
/* Clean up decoded; first, move the data after what we just returned to the start of the buffer */
_decoded_audio.audio->move (decoded_offset + to_return, 0, remaining);
@@ -131,12 +131,12 @@ AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
data = _processor->run (data);
}
- AudioFrame const frame_rate = _audio_content->resampled_audio_frame_rate ();
+ Frame const frame_rate = _audio_content->resampled_audio_frame_rate ();
if (_seek_reference) {
/* We've had an accurate seek and now we're seeing some data */
ContentTime const delta = time - _seek_reference.get ();
- AudioFrame const delta_frames = delta.frames (frame_rate);
+ Frame const delta_frames = delta.frames (frame_rate);
if (delta_frames > 0) {
/* This data comes after the seek time. Pad the data with some silence. */
shared_ptr<AudioBuffers> padded (new AudioBuffers (data->channels(), data->frames() + delta_frames));
@@ -146,8 +146,8 @@ AudioDecoder::audio (shared_ptr<const AudioBuffers> data, ContentTime time)
time -= delta;
} else if (delta_frames < 0) {
/* This data comes before the seek time. Throw some data away */
- AudioFrame const to_discard = min (-delta_frames, static_cast<AudioFrame> (data->frames()));
- AudioFrame const to_keep = data->frames() - to_discard;
+ Frame const to_discard = min (-delta_frames, static_cast<Frame> (data->frames()));
+ Frame const to_keep = data->frames() - to_discard;
if (to_keep == 0) {
/* We have to throw all this data away, so keep _seek_reference and
try again next time some data arrives.
diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h
index f8438df52..99e9092b3 100644
--- a/src/lib/audio_decoder.h
+++ b/src/lib/audio_decoder.h
@@ -50,7 +50,7 @@ public:
* @param accurate true to try hard to return frames from exactly `frame', false if we don't mind nearby frames.
* @return Time-stamped audio data which may or may not be from the location (and of the length) requested.
*/
- boost::shared_ptr<ContentAudio> get_audio (AudioFrame time, AudioFrame length, bool accurate);
+ boost::shared_ptr<ContentAudio> get_audio (Frame time, Frame length, bool accurate);
protected:
@@ -63,7 +63,7 @@ protected:
boost::shared_ptr<const AudioContent> _audio_content;
boost::shared_ptr<Resampler> _resampler;
boost::shared_ptr<AudioProcessor> _processor;
- boost::optional<AudioFrame> _audio_position;
+ boost::optional<Frame> _audio_position;
/** Currently-available decoded audio data */
ContentAudio _decoded_audio;
/** The time of an accurate seek after which we have not yet received any actual
diff --git a/src/lib/content_audio.h b/src/lib/content_audio.h
index 535c0b491..f704fac58 100644
--- a/src/lib/content_audio.h
+++ b/src/lib/content_audio.h
@@ -34,11 +34,11 @@ public:
, frame (0)
{}
- ContentAudio (boost::shared_ptr<AudioBuffers> a, AudioFrame f)
+ ContentAudio (boost::shared_ptr<AudioBuffers> a, Frame f)
: audio (a)
, frame (f)
{}
boost::shared_ptr<AudioBuffers> audio;
- AudioFrame frame;
+ Frame frame;
};
diff --git a/src/lib/content_video.h b/src/lib/content_video.h
index 4c0bdb655..cdf0f9cdd 100644
--- a/src/lib/content_video.h
+++ b/src/lib/content_video.h
@@ -33,7 +33,7 @@ public:
, part (PART_WHOLE)
{}
- ContentVideo (boost::shared_ptr<const ImageProxy> i, Eyes e, Part p, VideoFrame f)
+ ContentVideo (boost::shared_ptr<const ImageProxy> i, Eyes e, Part p, Frame f)
: image (i)
, eyes (e)
, part (p)
@@ -43,7 +43,7 @@ public:
boost::shared_ptr<const ImageProxy> image;
Eyes eyes;
Part part;
- VideoFrame frame;
+ Frame frame;
};
#endif
diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h
index ec90051da..0453f7e7e 100644
--- a/src/lib/image_decoder.h
+++ b/src/lib/image_decoder.h
@@ -40,6 +40,6 @@ private:
boost::shared_ptr<const ImageContent> _image_content;
boost::shared_ptr<ImageProxy> _image;
- VideoFrame _video_position;
+ Frame _video_position;
};
diff --git a/src/lib/player.cc b/src/lib/player.cc
index d5098fed7..be00aebc7 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -397,7 +397,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
setup_pieces ();
}
- AudioFrame const length_frames = length.frames (_film->audio_frame_rate ());
+ Frame const length_frames = length.frames (_film->audio_frame_rate ());
shared_ptr<AudioBuffers> audio (new AudioBuffers (_film->audio_channels(), length_frames));
audio->make_silent ();
@@ -423,7 +423,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
/* The time that we should request from the content */
DCPTime request = time - DCPTime::from_seconds (content->audio_delay() / 1000.0);
- AudioFrame request_frames = length_frames;
+ Frame request_frames = length_frames;
DCPTime offset;
if (request < DCPTime ()) {
/* We went off the start of the content, so we will need to offset
@@ -437,7 +437,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
request = DCPTime ();
}
- AudioFrame const content_frame = dcp_to_content_audio (*i, request);
+ Frame const content_frame = dcp_to_content_audio (*i, request);
/* Audio from this piece's decoder (which might be more or less than what we asked for) */
shared_ptr<ContentAudio> all = decoder->get_audio (content_frame, request_frames, accurate);
@@ -472,14 +472,14 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate)
all->audio.get(),
content_frame - all->frame,
offset.frames (_film->audio_frame_rate()),
- min (AudioFrame (all->audio->frames()), request_frames)
+ min (Frame (all->audio->frames()), request_frames)
);
}
return audio;
}
-VideoFrame
+Frame
Player::dcp_to_content_video (shared_ptr<const Piece> piece, DCPTime t) const
{
/* s is the offset of t from the start position of this content */
@@ -492,7 +492,7 @@ Player::dcp_to_content_video (shared_ptr<const Piece> piece, DCPTime t) const
}
DCPTime
-Player::content_video_to_dcp (shared_ptr<const Piece> piece, VideoFrame f) const
+Player::content_video_to_dcp (shared_ptr<const Piece> piece, Frame f) const
{
DCPTime t = DCPTime::from_frames (f * piece->frc.factor (), _film->video_frame_rate()) - piece->content->trim_start () + piece->content->position ();
if (t < DCPTime ()) {
@@ -502,7 +502,7 @@ Player::content_video_to_dcp (shared_ptr<const Piece> piece, VideoFrame f) const
return t;
}
-AudioFrame
+Frame
Player::dcp_to_content_audio (shared_ptr<const Piece> piece, DCPTime t) const
{
/* s is the offset of t from the start position of this content */
diff --git a/src/lib/player.h b/src/lib/player.h
index d8b13ee7b..a5194a169 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -116,9 +116,9 @@ private:
void film_changed (Film::Property);
std::list<PositionImage> transform_image_subtitles (std::list<ImageSubtitle>) const;
void update_subtitle_from_text ();
- VideoFrame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const;
- DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, VideoFrame f) const;
- AudioFrame dcp_to_content_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const;
+ Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const;
+ DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const;
+ Frame dcp_to_content_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const;
ContentTime dcp_to_content_subtitle (boost::shared_ptr<const Piece> piece, DCPTime t) const;
boost::shared_ptr<PlayerVideo> black_player_video_frame (DCPTime) const;
diff --git a/src/lib/types.h b/src/lib/types.h
index e7017a295..655aeba09 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -55,8 +55,7 @@ typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
-typedef int64_t VideoFrame;
-typedef int64_t AudioFrame;
+typedef int64_t Frame;
enum VideoFrameType
{
diff --git a/src/lib/util.h b/src/lib/util.h
index 5413e4814..51770c288 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -101,7 +101,6 @@ extern FFmpegSubtitlePeriod subtitle_period (AVSubtitle const &);
extern void set_backtrace_file (boost::filesystem::path);
extern dcp::FrameInfo read_frame_info (FILE* file, int frame, Eyes eyes);
extern void write_frame_info (FILE* file, int frame, Eyes eyes, dcp::FrameInfo info);
-extern int64_t video_frames_to_audio_frames (VideoFrame v, float audio_sample_rate, float frames_per_second);
extern std::map<std::string, std::string> split_get_request (std::string url);
extern std::string video_mxf_filename (boost::shared_ptr<dcp::PictureMXF> mxf);
extern std::string audio_mxf_filename (boost::shared_ptr<dcp::SoundMXF> mxf);
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 9f3d78291..db9a2a5e8 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -483,7 +483,7 @@ VideoContent::set_video_frame_rate (float r)
}
optional<float>
-VideoContent::fade (VideoFrame f) const
+VideoContent::fade (Frame f) const
{
DCPOMATIC_ASSERT (f >= 0);
@@ -491,7 +491,7 @@ VideoContent::fade (VideoFrame f) const
return float (f) / _fade_in.frames (video_frame_rate ());
}
- VideoFrame fade_out_start = ContentTime (video_length() - fade_out()).frames (video_frame_rate ());
+ Frame fade_out_start = ContentTime (video_length() - fade_out()).frames (video_frame_rate ());
if (f >= fade_out_start) {
return 1 - float (f - fade_out_start) / fade_out().frames (video_frame_rate ());
}
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index ccc61b1f9..72bad21f8 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -155,7 +155,7 @@ public:
ContentTime dcp_time_to_content_time (DCPTime) const;
- boost::optional<float> fade (VideoFrame) const;
+ boost::optional<float> fade (Frame) const;
void scale_and_crop_to_fit_width ();
void scale_and_crop_to_fit_height ();
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index 31dc3cdc2..078e78c6f 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -49,7 +49,7 @@ VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c)
}
list<ContentVideo>
-VideoDecoder::decoded_video (VideoFrame frame)
+VideoDecoder::decoded_video (Frame frame)
{
list<ContentVideo> output;
@@ -68,7 +68,7 @@ VideoDecoder::decoded_video (VideoFrame frame)
* @return Frames; there may be none (if there is no video there), 1 for 2D or 2 for 3D.
*/
list<ContentVideo>
-VideoDecoder::get_video (VideoFrame frame, bool accurate)
+VideoDecoder::get_video (Frame frame, bool accurate)
{
/* At this stage, if we have get_video()ed before, _decoded_video will contain the last frame that this
method returned (and possibly a few more). If the requested frame is not in _decoded_video and it is not the next
@@ -130,7 +130,7 @@ VideoDecoder::get_video (VideoFrame frame, bool accurate)
/** Fill _decoded_video from `from' up to, but not including, `to' */
void
-VideoDecoder::fill_2d (VideoFrame from, VideoFrame to)
+VideoDecoder::fill_2d (Frame from, Frame to)
{
if (to == 0) {
/* Already OK */
@@ -147,7 +147,7 @@ VideoDecoder::fill_2d (VideoFrame from, VideoFrame to)
filler_part = _decoded_video.back().part;
}
- VideoFrame filler_frame = from;
+ Frame filler_frame = from;
while (filler_frame < to) {
@@ -164,7 +164,7 @@ VideoDecoder::fill_2d (VideoFrame from, VideoFrame to)
/** Fill _decoded_video from `from' up to, but not including, `to' */
void
-VideoDecoder::fill_3d (VideoFrame from, VideoFrame to, Eyes eye)
+VideoDecoder::fill_3d (Frame from, Frame to, Eyes eye)
{
if (to == 0 && eye == EYES_LEFT) {
/* Already OK */
@@ -192,7 +192,7 @@ VideoDecoder::fill_3d (VideoFrame from, VideoFrame to, Eyes eye)
}
}
- VideoFrame filler_frame = from;
+ Frame filler_frame = from;
Eyes filler_eye = _decoded_video.empty() ? EYES_LEFT : _decoded_video.back().eyes;
if (_decoded_video.empty ()) {
@@ -232,7 +232,7 @@ VideoDecoder::fill_3d (VideoFrame from, VideoFrame to, Eyes eye)
/** Called by subclasses when they have a video frame ready */
void
-VideoDecoder::video (shared_ptr<const ImageProxy> image, VideoFrame frame)
+VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame)
{
if (_ignore_video) {
return;
@@ -275,8 +275,8 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, VideoFrame frame)
and the things we are about to push.
*/
- boost::optional<VideoFrame> from;
- boost::optional<VideoFrame> to;
+ boost::optional<Frame> from;
+ boost::optional<Frame> to;
if (_decoded_video.empty() && _last_seek_time && _last_seek_accurate) {
from = _last_seek_time->frames (_video_content->video_frame_rate ());
diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h
index 5381fb21e..5266604c5 100644
--- a/src/lib/video_decoder.h
+++ b/src/lib/video_decoder.h
@@ -43,7 +43,7 @@ class VideoDecoder : public virtual Decoder
public:
VideoDecoder (boost::shared_ptr<const VideoContent> c);
- std::list<ContentVideo> get_video (VideoFrame frame, bool accurate);
+ std::list<ContentVideo> get_video (Frame frame, bool accurate);
boost::shared_ptr<const VideoContent> video_content () const {
return _video_content;
@@ -60,10 +60,10 @@ protected:
friend struct video_decoder_fill_test2;
void seek (ContentTime time, bool accurate);
- void video (boost::shared_ptr<const ImageProxy>, VideoFrame frame);
- std::list<ContentVideo> decoded_video (VideoFrame frame);
- void fill_2d (VideoFrame from, VideoFrame to);
- void fill_3d (VideoFrame from, VideoFrame to, Eyes);
+ void video (boost::shared_ptr<const ImageProxy>, Frame frame);
+ std::list<ContentVideo> decoded_video (Frame frame);
+ void fill_2d (Frame from, Frame to);
+ void fill_3d (Frame from, Frame to, Eyes);
boost::shared_ptr<const VideoContent> _video_content;
std::list<ContentVideo> _decoded_video;