diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-04-14 02:06:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-18 11:50:29 +0100 |
| commit | 2d5beb0d6794df13ad1df47e84fd7a57d1d1c64d (patch) | |
| tree | 70034dc6789e55394dac0ec87b968c58b96e4b48 /src/lib | |
| parent | 826ed68a1e34ce158342da324ff7203af0449641 (diff) | |
Rename video/audio/subtitle part methods.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/analyse_audio_job.cc | 2 | ||||
| -rw-r--r-- | src/lib/audio_analysis.cc | 2 | ||||
| -rw-r--r-- | src/lib/audio_content.cc | 66 | ||||
| -rw-r--r-- | src/lib/audio_content.h | 32 | ||||
| -rw-r--r-- | src/lib/audio_decoder_stream.cc | 12 | ||||
| -rw-r--r-- | src/lib/dcp_content.cc | 12 | ||||
| -rw-r--r-- | src/lib/dcp_decoder.cc | 8 | ||||
| -rw-r--r-- | src/lib/dcp_subtitle_content.cc | 10 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 14 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/film.cc | 14 | ||||
| -rw-r--r-- | src/lib/image_content.cc | 8 | ||||
| -rw-r--r-- | src/lib/image_decoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/image_examiner.cc | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 74 | ||||
| -rw-r--r-- | src/lib/playlist.cc | 14 | ||||
| -rw-r--r-- | src/lib/sndfile_content.cc | 2 | ||||
| -rw-r--r-- | src/lib/subtitle_content.cc | 152 | ||||
| -rw-r--r-- | src/lib/subtitle_content.h | 82 | ||||
| -rw-r--r-- | src/lib/text_subtitle_content.cc | 4 | ||||
| -rw-r--r-- | src/lib/transcoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/video_content.cc | 154 | ||||
| -rw-r--r-- | src/lib/video_content.h | 71 | ||||
| -rw-r--r-- | src/lib/video_content_scale.cc | 2 | ||||
| -rw-r--r-- | src/lib/video_decoder.cc | 10 | ||||
| -rw-r--r-- | src/lib/video_examiner.h | 2 |
26 files changed, 387 insertions, 380 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 9a24a9188..fefb8bc16 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -147,7 +147,7 @@ AnalyseAudioJob::run () */ shared_ptr<const AudioContent> ac = _playlist->content().front()->audio; DCPOMATIC_ASSERT (ac); - _analysis->set_analysis_gain (ac->audio_gain ()); + _analysis->set_analysis_gain (ac->gain ()); } _analysis->write (_film->audio_analysis_path (_playlist)); diff --git a/src/lib/audio_analysis.cc b/src/lib/audio_analysis.cc index d99b01ce6..e04468ba2 100644 --- a/src/lib/audio_analysis.cc +++ b/src/lib/audio_analysis.cc @@ -154,7 +154,7 @@ AudioAnalysis::gain_correction (shared_ptr<const Playlist> playlist) what correction is now needed to make it look `right'. */ DCPOMATIC_ASSERT (playlist->content().front()->audio); - return playlist->content().front()->audio->audio_gain() - analysis_gain().get (); + return playlist->content().front()->audio->gain() - analysis_gain().get (); } return 0.0f; diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 2832e2575..983d502b8 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -44,15 +44,21 @@ using boost::dynamic_pointer_cast; using boost::optional; /** Something stream-related has changed */ +<<<<<<< 17dbd967c18aff2f3007eb86b5eee5b43f23bc4b int const AudioContentProperty::AUDIO_STREAMS = 200; int const AudioContentProperty::AUDIO_GAIN = 201; int const AudioContentProperty::AUDIO_DELAY = 202; int const AudioContentProperty::AUDIO_VIDEO_FRAME_RATE = 203; +======= +int const AudioContentProperty::STREAMS = 200; +int const AudioContentProperty::GAIN = 201; +int const AudioContentProperty::DELAY = 202; +>>>>>>> Rename video/audio/subtitle part methods. AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film) : ContentPart (parent, film) - , _audio_gain (0) - , _audio_delay (Config::instance()->default_audio_delay ()) + , _gain (0) + , _delay (Config::instance()->default_audio_delay ()) { } @@ -60,9 +66,9 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film) AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node) : ContentPart (parent, film) { - _audio_gain = node->number_child<double> ("AudioGain"); - _audio_delay = node->number_child<int> ("AudioDelay"); - _audio_video_frame_rate = node->optional_number_child<double> ("AudioVideoFrameRate"); + _gain = node->number_child<double> ("AudioGain"); + _delay = node->number_child<int> ("AudioDelay"); + _video_frame_rate = node->optional_number_child<double> ("AudioVideoFrameRate"); } AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c) @@ -72,11 +78,11 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector DCPOMATIC_ASSERT (ref); for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->audio->audio_gain() != ref->audio_gain()) { + if (c[i]->audio->gain() != ref->gain()) { throw JoinError (_("Content to be joined must have the same audio gain.")); } - if (c[i]->audio->audio_delay() != ref->audio_delay()) { + if (c[i]->audio->delay() != ref->delay()) { throw JoinError (_("Content to be joined must have the same audio delay.")); } @@ -85,10 +91,10 @@ AudioContent::AudioContent (Content* parent, shared_ptr<const Film> film, vector } } - _audio_gain = ref->audio_gain (); - _audio_delay = ref->audio_delay (); + _gain = ref->audio_gain (); + _delay = ref->audio_delay (); /* Preserve the optional<> part of this */ - _audio_video_frame_rate = ref->_audio_video_frame_rate; + _video_frame_rate = ref->_audio_video_frame_rate; _streams = ref->streams (); } @@ -96,23 +102,23 @@ void AudioContent::as_xml (xmlpp::Node* node) const { boost::mutex::scoped_lock lm (_mutex); - node->add_child("AudioGain")->add_child_text (raw_convert<string> (_audio_gain)); - node->add_child("AudioDelay")->add_child_text (raw_convert<string> (_audio_delay)); + node->add_child("AudioGain")->add_child_text (raw_convert<string> (_gain)); + node->add_child("AudioDelay")->add_child_text (raw_convert<string> (_delay)); if (_audio_video_frame_rate) { node->add_child("AudioVideoFrameRate")->add_child_text (raw_convert<string> (_audio_video_frame_rate.get())); } } void -AudioContent::set_audio_gain (double g) +AudioContent::set_gain (double g) { - maybe_set (_audio_gain, g, AudioContentProperty::AUDIO_GAIN); + maybe_set (_gain, g, AudioContentProperty::GAIN); } void -AudioContent::set_audio_delay (int d) +AudioContent::set_delay (int d) { - maybe_set (_audio_delay, d, AudioContentProperty::AUDIO_DELAY); + maybe_set (_delay, d, AudioContentProperty::DELAY); } string @@ -127,7 +133,7 @@ AudioContent::technical_summary () const } void -AudioContent::set_audio_mapping (AudioMapping mapping) +AudioContent::set_mapping (AudioMapping mapping) { int c = 0; BOOST_FOREACH (AudioStreamPtr i, streams ()) { @@ -141,11 +147,11 @@ AudioContent::set_audio_mapping (AudioMapping mapping) i->set_mapping (stream_mapping); } - _parent->signal_changed (AudioContentProperty::AUDIO_STREAMS); + _parent->signal_changed (AudioContentProperty::STREAMS); } AudioMapping -AudioContent::audio_mapping () const +AudioContent::mapping () const { int channels = 0; BOOST_FOREACH (AudioStreamPtr i, streams ()) { @@ -177,7 +183,7 @@ AudioContent::audio_mapping () const * that it is in sync with the active video content at its start time. */ int -AudioContent::resampled_audio_frame_rate () const +AudioContent::resampled_frame_rate () const { /* Resample to a DCI-approved sample rate */ double t = has_rate_above_48k() ? 96000 : 48000; @@ -218,7 +224,7 @@ AudioContent::processing_description () const optional<int> common_frame_rate; BOOST_FOREACH (AudioStreamPtr i, streams()) { - if (i->frame_rate() != resampled_audio_frame_rate()) { + if (i->frame_rate() != resampled_frame_rate()) { resampled = true; } else { not_resampled = true; @@ -235,14 +241,14 @@ AudioContent::processing_description () const } if (not_resampled && resampled) { - return String::compose (_("Some audio will be resampled to %1kHz"), resampled_audio_frame_rate ()); + return String::compose (_("Some audio will be resampled to %1kHz"), resampled_frame_rate ()); } if (!not_resampled && resampled) { if (same) { - return String::compose (_("Audio will be resampled from %1kHz to %2kHz"), common_frame_rate.get(), resampled_audio_frame_rate ()); + return String::compose (_("Audio will be resampled from %1kHz to %2kHz"), common_frame_rate.get(), resampled_frame_rate ()); } else { - return String::compose (_("Audio will be resampled to %1kHz"), resampled_audio_frame_rate ()); + return String::compose (_("Audio will be resampled to %1kHz"), resampled_frame_rate ()); } } @@ -264,7 +270,7 @@ AudioContent::has_rate_above_48k () const /** @return User-visible names of each of our audio channels */ vector<string> -AudioContent::audio_channel_names () const +AudioContent::channel_names () const { vector<string> n; @@ -312,7 +318,7 @@ AudioContent::add_properties (list<UserProperty>& p) const ); } - p.push_back (UserProperty (_("Audio"), _("DCP frame rate"), resampled_audio_frame_rate (), _("Hz"))); + p.push_back (UserProperty (_("Audio"), _("DCP frame rate"), resampled_frame_rate (), _("Hz"))); p.push_back (UserProperty (_("Length"), _("Full length in video frames at DCP rate"), c.frames_round (frc.dcp))); if (stream) { @@ -320,7 +326,7 @@ AudioContent::add_properties (list<UserProperty>& p) const UserProperty ( _("Length"), _("Full length in audio frames at DCP rate"), - c.frames_round (resampled_audio_frame_rate ()) + c.frames_round (resampled_frame_rate ()) ) ); } @@ -360,7 +366,7 @@ AudioContent::set_streams (vector<AudioStreamPtr> streams) _streams = streams; } - _parent->signal_changed (AudioContentProperty::AUDIO_STREAMS); + _parent->signal_changed (AudioContentProperty::STREAMS); } AudioStreamPtr @@ -379,7 +385,7 @@ AudioContent::add_stream (AudioStreamPtr stream) _streams.push_back (stream); } - _parent->signal_changed (AudioContentProperty::AUDIO_STREAMS); + _parent->signal_changed (AudioContentProperty::STREAMS); } void @@ -391,5 +397,5 @@ AudioContent::set_stream (AudioStreamPtr stream) _streams.push_back (stream); } - _parent->signal_changed (AudioContentProperty::AUDIO_STREAMS); + _parent->signal_changed (AudioContentProperty::STREAMS); } diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 3aa9678b0..09e7a0d12 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -34,10 +34,16 @@ class AudioContentProperty { public: +<<<<<<< 17dbd967c18aff2f3007eb86b5eee5b43f23bc4b static int const AUDIO_STREAMS; static int const AUDIO_GAIN; static int const AUDIO_DELAY; static int const AUDIO_VIDEO_FRAME_RATE; +======= + static int const STREAMS; + static int const GAIN; + static int const DELAY; +>>>>>>> Rename video/audio/subtitle part methods. }; class AudioContent : public ContentPart @@ -50,23 +56,23 @@ public: void as_xml (xmlpp::Node *) const; std::string technical_summary () const; - AudioMapping audio_mapping () const; - void set_audio_mapping (AudioMapping); - int resampled_audio_frame_rate () const; + AudioMapping mapping () const; + void set_mapping (AudioMapping); + int resampled_frame_rate () const; bool has_rate_above_48k () const; - std::vector<std::string> audio_channel_names () const; + std::vector<std::string> channel_names () const; - void set_audio_gain (double); - void set_audio_delay (int); + void set_gain (double); + void set_delay (int); - double audio_gain () const { + double gain () const { boost::mutex::scoped_lock lm (_mutex); - return _audio_gain; + return _gain; } - int audio_delay () const { + int delay () const { boost::mutex::scoped_lock lm (_mutex); - return _audio_delay; + return _delay; } double audio_video_frame_rate () const; @@ -89,10 +95,10 @@ public: private: /** Gain to apply to audio in dB */ - double _audio_gain; + double _gain; /** Delay to apply to audio (positive moves audio later) in milliseconds */ - int _audio_delay; - boost::optional<double> _audio_video_frame_rate; + int _delay; + boost::optional<double> _video_frame_rate; std::vector<AudioStreamPtr> _streams; }; diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc index 7037d9f47..cd2e3a388 100644 --- a/src/lib/audio_decoder_stream.cc +++ b/src/lib/audio_decoder_stream.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-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 @@ -45,8 +45,8 @@ AudioDecoderStream::AudioDecoderStream (shared_ptr<const AudioContent> content, , _decoder (decoder) , _log (log) { - if (content->resampled_audio_frame_rate() != _stream->frame_rate() && _stream->channels() > 0) { - _resampler.reset (new Resampler (_stream->frame_rate(), content->resampled_audio_frame_rate(), _stream->channels (), decoder->fast ())); + if (content->resampled_frame_rate() != _stream->frame_rate() && _stream->channels() > 0) { + _resampler.reset (new Resampler (_stream->frame_rate(), content->resampled_frame_rate(), _stream->channels (), decoder->fast ())); } reset_decoded (); @@ -69,7 +69,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) if (frame < _decoded.frame || end > (_decoded.frame + length * 4)) { /* Either we have no decoded data, or what we do have is a long way from what we want: seek */ - seek (ContentTime::from_frames (frame, _content->resampled_audio_frame_rate()), accurate); + seek (ContentTime::from_frames (frame, _content->resampled_frame_rate()), accurate); } /* Offset of the data that we want from the start of _decoded.audio @@ -148,7 +148,7 @@ AudioDecoderStream::audio (shared_ptr<const AudioBuffers> data, ContentTime time data = _resampler->run (data); } - Frame const frame_rate = _content->resampled_audio_frame_rate (); + Frame const frame_rate = _content->resampled_frame_rate (); if (_seek_reference) { /* We've had an accurate seek and now we're seeing some data */ @@ -217,7 +217,7 @@ AudioDecoderStream::add (shared_ptr<const AudioBuffers> data) _position = _position.get() + data->frames (); /* Limit the amount of data we keep in case nobody is asking for it */ - int const max_frames = _content->resampled_audio_frame_rate () * 10; + int const max_frames = _content->resampled_frame_rate () * 10; if (_decoded.audio->frames() > max_frames) { int const to_remove = _decoded.audio->frames() - max_frames; _decoded.frame += to_remove; diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index cfd19fe31..d47c52273 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -116,7 +116,7 @@ DCPContent::examine (shared_ptr<Job> job) Content::examine (job); shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ())); - video->take_from_video_examiner (examiner); + video->take_from_examiner (examiner); set_default_colour_conversion (); { @@ -129,7 +129,7 @@ DCPContent::examine (shared_ptr<Job> job) as->set_mapping (m); } - signal_changed (AudioContentProperty::AUDIO_STREAMS); + signal_changed (AudioContentProperty::STREAMS); { boost::mutex::scoped_lock lm (_mutex); @@ -187,8 +187,8 @@ DCPContent::as_xml (xmlpp::Node* node) const DCPTime DCPContent::full_length () const { - FrameRateChange const frc (video->video_frame_rate (), film()->video_frame_rate ()); - return DCPTime::from_frames (llrint (video->video_length () * frc.factor ()), film()->video_frame_rate ()); + FrameRateChange const frc (video->frame_rate (), film()->video_frame_rate ()); + return DCPTime::from_frames (llrint (video->length () * frc.factor ()), film()->video_frame_rate ()); } string @@ -358,7 +358,7 @@ DCPContent::can_reference_subtitle (list<string>& why_not) const void DCPContent::changed (int property) { - if (property == VideoContentProperty::VIDEO_FRAME_RATE && subtitle) { - subtitle->set_subtitle_video_frame_rate (video->video_frame_rate ()); + if (property == VideoContentProperty::FRAME_RATE && subtitle) { + subtitle->set_video_frame_rate (video->frame_rate ()); } } diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 4e28dc758..1c25587e0 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -74,7 +74,7 @@ DCPDecoder::pass (PassReason reason, bool) ++i; } - double const vfr = _dcp_content->video->video_frame_rate (); + double const vfr = _dcp_content->video->frame_rate (); /* Frame within the (played part of the) reel that is coming up next */ int64_t const frame = _next.frames_round (vfr); @@ -157,8 +157,8 @@ DCPDecoder::seek (ContentTime t, bool accurate) SubtitleDecoder::seek (t, accurate); _reel = _reels.begin (); - while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->video->video_frame_rate ())) { - t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->video->video_frame_rate ()); + while (_reel != _reels.end() && t >= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->video->frame_rate ())) { + t -= ContentTime::from_frames ((*_reel)->main_picture()->duration(), _dcp_content->video->frame_rate ()); ++_reel; } @@ -178,7 +178,7 @@ DCPDecoder::text_subtitles_during (ContentTimePeriod period, bool starting) cons /* XXX: inefficient */ list<ContentTimePeriod> ctp; - double const vfr = _dcp_content->video->video_frame_rate (); + double const vfr = _dcp_content->video->frame_rate (); BOOST_FOREACH (shared_ptr<dcp::Reel> r, _reels) { if (!r->main_subtitle ()) { diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc index 3feb8947a..eabcaaafe 100644 --- a/src/lib/dcp_subtitle_content.cc +++ b/src/lib/dcp_subtitle_content.cc @@ -56,18 +56,18 @@ DCPSubtitleContent::examine (shared_ptr<Job> job) shared_ptr<dcp::SubtitleAsset> sc = load (path (0)); /* Default to turning these subtitles on */ - subtitle->set_use_subtitles (true); + subtitle->set_use (true); boost::mutex::scoped_lock lm (_mutex); shared_ptr<dcp::InteropSubtitleAsset> iop = dynamic_pointer_cast<dcp::InteropSubtitleAsset> (sc); if (iop) { - subtitle->set_subtitle_language (iop->language ()); + subtitle->set_language (iop->language ()); } shared_ptr<dcp::SMPTESubtitleAsset> smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset> (sc); if (smpte) { - subtitle->set_subtitle_language (smpte->language().get_value_or ("")); - subtitle->set_subtitle_video_frame_rate (smpte->edit_rate().numerator); + subtitle->set_language (smpte->language().get_value_or ("")); + subtitle->set_video_frame_rate (smpte->edit_rate().numerator); } _length = ContentTime::from_seconds (sc->latest_subtitle_out().as_seconds ()); @@ -80,7 +80,7 @@ DCPSubtitleContent::examine (shared_ptr<Job> job) DCPTime DCPSubtitleContent::full_length () const { - FrameRateChange const frc (subtitle->subtitle_video_frame_rate(), film()->video_frame_rate()); + FrameRateChange const frc (subtitle->video_frame_rate(), film()->video_frame_rate()); return DCPTime (_length, frc); } diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index c67d643a5..d9941685d 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -133,7 +133,7 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ for (size_t i = 0; i < c.size(); ++i) { shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]); - if (fc->subtitle->use_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { + if (fc->subtitle->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { throw JoinError (_("Content to be joined must use the same subtitle stream.")); } } @@ -201,7 +201,7 @@ FFmpegContent::examine (shared_ptr<Job> job) Content::examine (job); shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job)); - video->take_from_video_examiner (examiner); + video->take_from_examiner (examiner); set_default_colour_conversion (); { @@ -296,8 +296,8 @@ operator!= (FFmpegStream const & a, FFmpegStream const & b) DCPTime FFmpegContent::full_length () const { - FrameRateChange const frc (video->video_frame_rate (), film()->video_frame_rate ()); - return DCPTime::from_frames (llrint (video->video_length_after_3d_combine() * frc.factor()), film()->video_frame_rate()); + FrameRateChange const frc (video->frame_rate (), film()->video_frame_rate ()); + return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film()->video_frame_rate()); } void @@ -382,7 +382,7 @@ FFmpegContent::has_text_subtitles () const void FFmpegContent::set_default_colour_conversion () { - dcp::Size const s = video->video_size (); + dcp::Size const s = video->size (); boost::mutex::scoped_lock lm (_mutex); @@ -536,7 +536,7 @@ FFmpegContent::signal_subtitle_stream_changed () void FFmpegContent::changed (int property) { - if (property == VideoContentProperty::VIDEO_FRAME_RATE && subtitle) { - subtitle->set_subtitle_video_frame_rate (video->video_frame_rate ()); + if (property == VideoContentProperty::FRAME_RATE && subtitle) { + subtitle->set_video_frame_rate (video->frame_rate ()); } } diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 8e4a1cc23..57327b63d 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -77,7 +77,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> , SubtitleDecoder (c->subtitle) , FFmpeg (c) , _log (log) - , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video->video_frame_rate())) + , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video->frame_rate())) { } @@ -413,7 +413,7 @@ FFmpegDecoder::decode_video_packet () double const pts = i->second * av_q2d (_format_context->streams[_video_stream]->time_base) + _pts_offset.seconds (); video ( shared_ptr<ImageProxy> (new RawImageProxy (image)), - llrint (pts * _ffmpeg_content->video->video_frame_rate ()) + llrint (pts * _ffmpeg_content->video->frame_rate ()) ); } else { LOG_WARNING_NC ("Dropping frame without PTS"); @@ -547,7 +547,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP out_p += image->stride()[0] / sizeof (uint32_t); } - dcp::Size const vs = _ffmpeg_content->video->video_size (); + dcp::Size const vs = _ffmpeg_content->video->size (); dcpomatic::Rect<double> const scaled_rect ( static_cast<double> (rect->x) / vs.width, static_cast<double> (rect->y) / vs.height, diff --git a/src/lib/film.cc b/src/lib/film.cc index 49a0a9b13..3d5d625e1 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -250,7 +250,7 @@ Film::audio_analysis_path (shared_ptr<const Playlist> playlist) const } digester.add (i->digest ()); - digester.add (i->audio->audio_mapping().digest ()); + digester.add (i->audio->mapping().digest ()); if (playlist->content().size() != 1) { /* Analyses should be considered equal regardless of gain if they were made from just one piece of content. This @@ -258,7 +258,7 @@ Film::audio_analysis_path (shared_ptr<const Playlist> playlist) const analysis at the plotting stage rather than having to recompute it. */ - digester.add (i->audio->audio_gain ()); + digester.add (i->audio->gain ()); } } @@ -620,7 +620,7 @@ Film::isdcf_name (bool if_created_now) const if (i->video->scale().ratio ()) { content_ratio = i->video->scale().ratio (); } else { - content_ratio = Ratio::from_ratio (i->video->video_size().ratio ()); + content_ratio = Ratio::from_ratio (i->video->size().ratio ()); } break; } @@ -641,7 +641,7 @@ Film::isdcf_name (bool if_created_now) const continue; } - if (i->subtitle->use_subtitles() && !i->subtitle->burn_subtitles()) { + if (i->subtitle->use() && !i->subtitle->burn()) { burnt_in = false; } } @@ -1096,9 +1096,9 @@ Film::playlist_content_changed (weak_ptr<Content> c, int p, bool frequent) { _dirty = true; - if (p == VideoContentProperty::VIDEO_FRAME_RATE) { + if (p == VideoContentProperty::FRAME_RATE) { set_video_frame_rate (_playlist->best_dcp_frame_rate ()); - } else if (p == AudioContentProperty::AUDIO_STREAMS) { + } else if (p == AudioContentProperty::STREAMS) { signal_changed (NAME); } @@ -1268,7 +1268,7 @@ Film::subtitle_language () const ContentList cl = content (); BOOST_FOREACH (shared_ptr<Content>& c, cl) { if (c->subtitle) { - languages.insert (c->subtitle->subtitle_language ()); + languages.insert (c->subtitle->language ()); } } diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 231eb9f8c..29af451b7 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -115,7 +115,7 @@ ImageContent::examine (shared_ptr<Job> job) DCPOMATIC_ASSERT (film); shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job)); - video->take_from_video_examiner (examiner); + video->take_from_examiner (examiner); set_default_colour_conversion (); } @@ -124,8 +124,8 @@ ImageContent::full_length () const { shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); - FrameRateChange const frc (video->video_frame_rate(), film->video_frame_rate()); - return DCPTime::from_frames (llrint (video->video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ()); + FrameRateChange const frc (video->frame_rate(), film->video_frame_rate()); + return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor ()), film->video_frame_rate ()); } string @@ -134,7 +134,7 @@ ImageContent::identifier () const SafeStringStream s; s << Content::identifier(); s << "_" << video->identifier (); - s << "_" << video->video_length(); + s << "_" << video->length(); return s.str (); } diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index e26574f61..c3a11ce97 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -45,7 +45,7 @@ ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c, shared_ptr<Log> lo bool ImageDecoder::pass (PassReason, bool) { - if (_video_position >= _image_content->video->video_length()) { + if (_video_position >= _image_content->video->length()) { return true; } @@ -56,7 +56,7 @@ ImageDecoder::pass (PassReason, bool) /* We can't extract image size from a JPEG2000 codestream without decoding it, so pass in the image content's size here. */ - _image.reset (new J2KImageProxy (path, _image_content->video->video_size ())); + _image.reset (new J2KImageProxy (path, _image_content->video->size ())); } else { _image.reset (new MagickImageProxy (path)); } @@ -71,5 +71,5 @@ void ImageDecoder::seek (ContentTime time, bool accurate) { VideoDecoder::seek (time, accurate); - _video_position = time.frames_round (_image_content->video->video_frame_rate ()); + _video_position = time.frames_round (_image_content->video->frame_rate ()); } diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 010275429..8e15a9d48 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -85,9 +85,9 @@ ImageExaminer::video_size () const optional<double> ImageExaminer::video_frame_rate () const { - if (_image_content->video->has_own_video_frame_rate()) { + if (_image_content->video->has_own_frame_rate()) { /* The content already knows what frame rate it should be */ - return _image_content->video->video_frame_rate(); + return _image_content->video->frame_rate(); } /* Don't know */ diff --git a/src/lib/player.cc b/src/lib/player.cc index ce048ed79..d37910ad8 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -114,13 +114,13 @@ Player::setup_pieces () shared_ptr<const FFmpegContent> fc = dynamic_pointer_cast<const FFmpegContent> (i); if (fc) { decoder.reset (new FFmpegDecoder (fc, _film->log(), _fast)); - frc = FrameRateChange (fc->video->video_frame_rate(), _film->video_frame_rate()); + frc = FrameRateChange (fc->video->frame_rate(), _film->video_frame_rate()); } shared_ptr<const DCPContent> dc = dynamic_pointer_cast<const DCPContent> (i); if (dc) { decoder.reset (new DCPDecoder (dc, _film->log(), _fast)); - frc = FrameRateChange (dc->video->video_frame_rate(), _film->video_frame_rate()); + frc = FrameRateChange (dc->video->frame_rate(), _film->video_frame_rate()); } /* ImageContent */ @@ -138,7 +138,7 @@ Player::setup_pieces () decoder.reset (new ImageDecoder (ic, _film->log())); } - frc = FrameRateChange (ic->video->video_frame_rate(), _film->video_frame_rate()); + frc = FrameRateChange (ic->video->frame_rate(), _film->video_frame_rate()); } /* SndfileContent */ @@ -162,7 +162,7 @@ Player::setup_pieces () } if (best_overlap) { - frc = FrameRateChange (best_overlap->video->video_frame_rate(), _film->video_frame_rate ()); + frc = FrameRateChange (best_overlap->video->frame_rate(), _film->video_frame_rate ()); } else { /* No video overlap; e.g. if the DCP is just audio */ frc = FrameRateChange (_film->video_frame_rate(), _film->video_frame_rate ()); @@ -178,14 +178,14 @@ Player::setup_pieces () shared_ptr<const TextSubtitleContent> rc = dynamic_pointer_cast<const TextSubtitleContent> (i); if (rc) { decoder.reset (new TextSubtitleDecoder (rc)); - frc = FrameRateChange (rc->subtitle->subtitle_video_frame_rate(), _film->video_frame_rate()); + frc = FrameRateChange (rc->subtitle->video_frame_rate(), _film->video_frame_rate()); } /* DCPSubtitleContent */ shared_ptr<const DCPSubtitleContent> dsc = dynamic_pointer_cast<const DCPSubtitleContent> (i); if (dsc) { decoder.reset (new DCPSubtitleDecoder (dsc)); - frc = FrameRateChange (dsc->subtitle->subtitle_video_frame_rate(), _film->video_frame_rate()); + frc = FrameRateChange (dsc->subtitle->video_frame_rate(), _film->video_frame_rate()); } shared_ptr<VideoDecoder> vd = dynamic_pointer_cast<VideoDecoder> (decoder); @@ -218,11 +218,11 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque property == ContentProperty::TRIM_START || property == ContentProperty::TRIM_END || property == ContentProperty::PATH || - property == VideoContentProperty::VIDEO_FRAME_TYPE || + property == VideoContentProperty::FRAME_TYPE || property == DCPContentProperty::CAN_BE_PLAYED || - property == SubtitleContentProperty::SUBTITLE_COLOUR || - property == SubtitleContentProperty::SUBTITLE_OUTLINE || - property == SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR || + property == SubtitleContentProperty::COLOUR || + property == SubtitleContentProperty::OUTLINE || + property == SubtitleContentProperty::OUTLINE_COLOUR || property == FFmpegContentProperty::SUBTITLE_STREAM ) { @@ -230,17 +230,17 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque Changed (frequent); } else if ( - property == SubtitleContentProperty::USE_SUBTITLES || - property == SubtitleContentProperty::SUBTITLE_X_OFFSET || - property == SubtitleContentProperty::SUBTITLE_Y_OFFSET || - property == SubtitleContentProperty::SUBTITLE_X_SCALE || - property == SubtitleContentProperty::SUBTITLE_Y_SCALE || + property == SubtitleContentProperty::USE || + property == SubtitleContentProperty::X_OFFSET || + property == SubtitleContentProperty::Y_OFFSET || + property == SubtitleContentProperty::X_SCALE || + property == SubtitleContentProperty::Y_SCALE || property == SubtitleContentProperty::FONTS || - property == VideoContentProperty::VIDEO_CROP || - property == VideoContentProperty::VIDEO_SCALE || - property == VideoContentProperty::VIDEO_FRAME_RATE || - property == VideoContentProperty::VIDEO_FADE_IN || - property == VideoContentProperty::VIDEO_FADE_OUT || + property == VideoContentProperty::CROP || + property == VideoContentProperty::SCALE || + property == VideoContentProperty::FRAME_RATE || + property == VideoContentProperty::FADE_IN || + property == VideoContentProperty::FADE_OUT || property == VideoContentProperty::COLOUR_CONVERSION ) { @@ -397,7 +397,7 @@ Player::get_video (DCPTime time, bool accurate) } else { /* Some video content at this time */ shared_ptr<Piece> last = *(ov.rbegin ()); - VideoFrameType const last_type = last->content->video->video_frame_type (); + VideoFrameType const last_type = last->content->video->frame_type (); /* Get video from appropriate piece(s) */ BOOST_FOREACH (shared_ptr<Piece> piece, ov) { @@ -414,8 +414,8 @@ Player::get_video (DCPTime time, bool accurate) /* always use the last video */ piece == last || /* with a corresponding L/R eye if appropriate */ - (last_type == VIDEO_FRAME_TYPE_3D_LEFT && piece->content->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) || - (last_type == VIDEO_FRAME_TYPE_3D_RIGHT && piece->content->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_LEFT); + (last_type == VIDEO_FRAME_TYPE_3D_LEFT && piece->content->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) || + (last_type == VIDEO_FRAME_TYPE_3D_RIGHT && piece->content->video->frame_type() == VIDEO_FRAME_TYPE_3D_LEFT); if (use) { /* We want to use this piece */ @@ -499,7 +499,7 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) DCPOMATIC_ASSERT (decoder); /* The time that we should request from the content */ - DCPTime request = time - DCPTime::from_seconds (i->content->audio->audio_delay() / 1000.0); + DCPTime request = time - DCPTime::from_seconds (i->content->audio->delay() / 1000.0); Frame request_frames = length_frames; DCPTime offset; if (request < DCPTime ()) { @@ -527,9 +527,9 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) ContentAudio all = decoder->get_audio (j, content_frame, request_frames, accurate); /* Gain */ - if (i->content->audio->audio_gain() != 0) { + if (i->content->audio->gain() != 0) { shared_ptr<AudioBuffers> gain (new AudioBuffers (all.audio)); - gain->apply_gain (i->content->audio->audio_gain ()); + gain->apply_gain (i->content->audio->gain ()); all.audio = gain; } @@ -628,7 +628,7 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, PlayerSubtitles ps (time, length); for (list<shared_ptr<Piece> >::const_iterator j = subs.begin(); j != subs.end(); ++j) { - if (!(*j)->content->subtitle->use_subtitles () || (!_always_burn_subtitles && (burnt != (*j)->content->subtitle->burn_subtitles ()))) { + if (!(*j)->content->subtitle->use () || (!_always_burn_subtitles && (burnt != (*j)->content->subtitle->burn ()))) { continue; } @@ -646,16 +646,16 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, for (list<ContentImageSubtitle>::iterator i = image.begin(); i != image.end(); ++i) { /* Apply content's subtitle offsets */ - i->sub.rectangle.x += (*j)->content->subtitle->subtitle_x_offset (); - i->sub.rectangle.y += (*j)->content->subtitle->subtitle_y_offset (); + i->sub.rectangle.x += (*j)->content->subtitle->x_offset (); + i->sub.rectangle.y += (*j)->content->subtitle->y_offset (); /* Apply content's subtitle scale */ - i->sub.rectangle.width *= (*j)->content->subtitle->subtitle_x_scale (); - i->sub.rectangle.height *= (*j)->content->subtitle->subtitle_y_scale (); + i->sub.rectangle.width *= (*j)->content->subtitle->x_scale (); + i->sub.rectangle.height *= (*j)->content->subtitle->y_scale (); /* Apply a corrective translation to keep the subtitle centred after that scale */ - i->sub.rectangle.x -= i->sub.rectangle.width * ((*j)->content->subtitle->subtitle_x_scale() - 1); - i->sub.rectangle.y -= i->sub.rectangle.height * ((*j)->content->subtitle->subtitle_y_scale() - 1); + i->sub.rectangle.x -= i->sub.rectangle.width * ((*j)->content->subtitle->x_scale() - 1); + i->sub.rectangle.y -= i->sub.rectangle.height * ((*j)->content->subtitle->y_scale() - 1); ps.image.push_back (i->sub); } @@ -663,10 +663,10 @@ Player::get_subtitles (DCPTime time, DCPTime length, bool starting, bool burnt, list<ContentTextSubtitle> text = subtitle_decoder->get_text_subtitles (ContentTimePeriod (from, to), starting, accurate); BOOST_FOREACH (ContentTextSubtitle& ts, text) { BOOST_FOREACH (dcp::SubtitleString s, ts.subs) { - s.set_h_position (s.h_position() + (*j)->content->subtitle->subtitle_x_offset ()); - s.set_v_position (s.v_position() + (*j)->content->subtitle->subtitle_y_offset ()); - float const xs = (*j)->content->subtitle->subtitle_x_scale(); - float const ys = (*j)->content->subtitle->subtitle_y_scale(); + s.set_h_position (s.h_position() + (*j)->content->subtitle->x_offset ()); + s.set_v_position (s.v_position() + (*j)->content->subtitle->y_offset ()); + float const xs = (*j)->content->subtitle->x_scale(); + float const ys = (*j)->content->subtitle->y_scale(); float size = s.size(); /* Adjust size to express the common part of the scaling; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 092060fa0..24a38f2cd 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -67,7 +67,7 @@ Playlist::~Playlist () void Playlist::content_changed (weak_ptr<Content> content, int property, bool frequent) { - if (property == ContentProperty::LENGTH || property == VideoContentProperty::VIDEO_FRAME_TYPE) { + if (property == ContentProperty::LENGTH || property == VideoContentProperty::FRAME_TYPE) { /* Don't respond to position changes here, as: - sequencing after earlier/later changes is handled by move_earlier/move_later - any other position changes will be timeline drags which should not result in content @@ -115,7 +115,7 @@ Playlist::maybe_sequence () continue; } - if (i->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) { + if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) { i->set_position (next_right); next_right = i->end(); } else { @@ -150,7 +150,7 @@ Playlist::video_identifier () const string t; BOOST_FOREACH (shared_ptr<const Content> i, _content) { - if (i->video || (i->subtitle && i->subtitle->burn_subtitles())) { + if (i->video || (i->subtitle && i->subtitle->burn())) { t += i->identifier (); } } @@ -266,14 +266,14 @@ Playlist::best_dcp_frame_rate () const float this_error = 0; BOOST_FOREACH (shared_ptr<Content> j, _content) { - if (!j->video || !j->video->has_own_video_frame_rate()) { + if (!j->video || !j->video->has_own_frame_rate()) { continue; } /* Best error for this content; we could use the content as-is or double its rate */ float best_error = min ( - float (fabs (i->source - j->video->video_frame_rate ())), - float (fabs (i->source - j->video->video_frame_rate () * 2)) + float (fabs (i->source - j->video->frame_rate ())), + float (fabs (i->source - j->video->frame_rate () * 2)) ); /* Use the largest difference between DCP and source as the "error" */ @@ -375,7 +375,7 @@ Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const /* This is the first piece of content (going backwards...) that starts before t, so it's the active one. */ - return FrameRateChange ((*i)->video->video_frame_rate(), dcp_video_frame_rate); + return FrameRateChange ((*i)->video->frame_rate(), dcp_video_frame_rate); } } diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index d023b27d6..ed7e67c3c 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -113,7 +113,7 @@ SndfileContent::take_from_audio_examiner (shared_ptr<AudioExaminer> examiner) _audio_length = examiner->audio_length (); } - signal_changed (AudioContentProperty::AUDIO_STREAMS); + signal_changed (AudioContentProperty::STREAMS); } DCPTime diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 089e3a3fc..2066793fb 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -39,27 +39,27 @@ using std::list; using boost::shared_ptr; using boost::dynamic_pointer_cast; -int const SubtitleContentProperty::SUBTITLE_X_OFFSET = 500; -int const SubtitleContentProperty::SUBTITLE_Y_OFFSET = 501; -int const SubtitleContentProperty::SUBTITLE_X_SCALE = 502; -int const SubtitleContentProperty::SUBTITLE_Y_SCALE = 503; -int const SubtitleContentProperty::USE_SUBTITLES = 504; -int const SubtitleContentProperty::BURN_SUBTITLES = 505; -int const SubtitleContentProperty::SUBTITLE_LANGUAGE = 506; +int const SubtitleContentProperty::X_OFFSET = 500; +int const SubtitleContentProperty::Y_OFFSET = 501; +int const SubtitleContentProperty::X_SCALE = 502; +int const SubtitleContentProperty::Y_SCALE = 503; +int const SubtitleContentProperty::USE = 504; +int const SubtitleContentProperty::BURN = 505; +int const SubtitleContentProperty::LANGUAGE = 506; int const SubtitleContentProperty::FONTS = 507; -int const SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE = 508; -int const SubtitleContentProperty::SUBTITLE_COLOUR = 509; -int const SubtitleContentProperty::SUBTITLE_OUTLINE = 510; -int const SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR = 511; +int const SubtitleContentProperty::VIDEO_FRAME_RATE = 508; +int const SubtitleContentProperty::COLOUR = 509; +int const SubtitleContentProperty::OUTLINE = 510; +int const SubtitleContentProperty::OUTLINE_COLOUR = 511; SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film) : ContentPart (parent, film) - , _use_subtitles (false) - , _burn_subtitles (false) - , _subtitle_x_offset (0) - , _subtitle_y_offset (0) - , _subtitle_x_scale (1) - , _subtitle_y_scale (1) + , _use (false) + , _burn (false) + , _x_offset (0) + , _y_offset (0) + , _x_scale (1) + , _y_scale (1) , _colour (255, 255, 255) , _outline (false) , _outline_colour (0, 0, 0) @@ -69,12 +69,12 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film) SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : ContentPart (parent, film) - , _use_subtitles (false) - , _burn_subtitles (false) - , _subtitle_x_offset (0) - , _subtitle_y_offset (0) - , _subtitle_x_scale (1) - , _subtitle_y_scale (1) + , _use (false) + , _burn (false) + , _x_offset (0) + , _y_offset (0) + , _x_scale (1) + , _y_scale (1) , _colour ( node->optional_number_child<int>("Red").get_value_or(255), node->optional_number_child<int>("Green").get_value_or(255), @@ -89,25 +89,25 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, , _frame_rate (node->optional_number_child<double>("SubtitleFrameRate")) { if (version >= 32) { - _use_subtitles = node->bool_child ("UseSubtitles"); - _burn_subtitles = node->bool_child ("BurnSubtitles"); + _use = node->bool_child ("UseSubtitles"); + _burn = node->bool_child ("BurnSubtitles"); } if (version >= 7) { - _subtitle_x_offset = node->number_child<double> ("SubtitleXOffset"); - _subtitle_y_offset = node->number_child<double> ("SubtitleYOffset"); + _x_offset = node->number_child<double> ("SubtitleXOffset"); + _y_offset = node->number_child<double> ("SubtitleYOffset"); } else { - _subtitle_y_offset = node->number_child<double> ("SubtitleOffset"); + _y_offset = node->number_child<double> ("SubtitleOffset"); } if (version >= 10) { - _subtitle_x_scale = node->number_child<double> ("SubtitleXScale"); - _subtitle_y_scale = node->number_child<double> ("SubtitleYScale"); + _x_scale = node->number_child<double> ("SubtitleXScale"); + _y_scale = node->number_child<double> ("SubtitleYScale"); } else { - _subtitle_x_scale = _subtitle_y_scale = node->number_child<double> ("SubtitleScale"); + _x_scale = _y_scale = node->number_child<double> ("SubtitleScale"); } - _subtitle_language = node->optional_string_child ("SubtitleLanguage").get_value_or (""); + _language = node->optional_string_child ("SubtitleLanguage").get_value_or (""); list<cxml::NodePtr> fonts = node->node_children ("Font"); for (list<cxml::NodePtr>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) { @@ -126,27 +126,27 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->subtitle->use_subtitles() != ref->use_subtitles()) { + if (c[i]->subtitle->use() != ref->use()) { throw JoinError (_("Content to be joined must have the same 'use subtitles' setting.")); } - if (c[i]->subtitle->burn_subtitles() != ref->burn_subtitles()) { + if (c[i]->subtitle->burn() != ref->burn()) { throw JoinError (_("Content to be joined must have the same 'burn subtitles' setting.")); } - if (c[i]->subtitle->subtitle_x_offset() != ref->subtitle_x_offset()) { + if (c[i]->subtitle->x_offset() != ref->x_offset()) { throw JoinError (_("Content to be joined must have the same subtitle X offset.")); } - if (c[i]->subtitle->subtitle_y_offset() != ref->subtitle_y_offset()) { + if (c[i]->subtitle->y_offset() != ref->y_offset()) { throw JoinError (_("Content to be joined must have the same subtitle Y offset.")); } - if (c[i]->subtitle->subtitle_x_scale() != ref->subtitle_x_scale()) { + if (c[i]->subtitle->x_scale() != ref->x_scale()) { throw JoinError (_("Content to be joined must have the same subtitle X scale.")); } - if (c[i]->subtitle->subtitle_y_scale() != ref->subtitle_y_scale()) { + if (c[i]->subtitle->y_scale() != ref->y_scale()) { throw JoinError (_("Content to be joined must have the same subtitle Y scale.")); } @@ -167,13 +167,13 @@ SubtitleContent::SubtitleContent (Content* parent, shared_ptr<const Film> film, } } - _use_subtitles = ref->use_subtitles (); - _burn_subtitles = ref->burn_subtitles (); - _subtitle_x_offset = ref->subtitle_x_offset (); - _subtitle_y_offset = ref->subtitle_y_offset (); - _subtitle_x_scale = ref->subtitle_x_scale (); - _subtitle_y_scale = ref->subtitle_y_scale (); - _subtitle_language = ref->subtitle_language (); + _use = ref->use (); + _burn = ref->burn (); + _x_offset = ref->x_offset (); + _y_offset = ref->y_offset (); + _x_scale = ref->x_scale (); + _y_scale = ref->y_scale (); + _language = ref->language (); _fonts = ref_fonts; connect_to_fonts (); @@ -185,13 +185,13 @@ SubtitleContent::as_xml (xmlpp::Node* root) const { boost::mutex::scoped_lock lm (_mutex); - root->add_child("UseSubtitles")->add_child_text (raw_convert<string> (_use_subtitles)); - root->add_child("BurnSubtitles")->add_child_text (raw_convert<string> (_burn_subtitles)); - root->add_child("SubtitleXOffset")->add_child_text (raw_convert<string> (_subtitle_x_offset)); - root->add_child("SubtitleYOffset")->add_child_text (raw_convert<string> (_subtitle_y_offset)); - root->add_child("SubtitleXScale")->add_child_text (raw_convert<string> (_subtitle_x_scale)); - root->add_child("SubtitleYScale")->add_child_text (raw_convert<string> (_subtitle_y_scale)); - root->add_child("SubtitleLanguage")->add_child_text (_subtitle_language); + root->add_child("UseSubtitles")->add_child_text (raw_convert<string> (_use)); + root->add_child("BurnSubtitles")->add_child_text (raw_convert<string> (_burn)); + root->add_child("SubtitleXOffset")->add_child_text (raw_convert<string> (_x_offset)); + root->add_child("SubtitleYOffset")->add_child_text (raw_convert<string> (_y_offset)); + root->add_child("SubtitleXScale")->add_child_text (raw_convert<string> (_x_scale)); + root->add_child("SubtitleYScale")->add_child_text (raw_convert<string> (_y_scale)); + root->add_child("SubtitleLanguage")->add_child_text (_language); root->add_child("Red")->add_child_text (raw_convert<string> (_colour.r)); root->add_child("Green")->add_child_text (raw_convert<string> (_colour.g)); root->add_child("Blue")->add_child_text (raw_convert<string> (_colour.b)); @@ -209,10 +209,10 @@ string SubtitleContent::identifier () const { SafeStringStream s; - s << raw_convert<string> (subtitle_x_scale()) - << "_" << raw_convert<string> (subtitle_y_scale()) - << "_" << raw_convert<string> (subtitle_x_offset()) - << "_" << raw_convert<string> (subtitle_y_offset()); + s << raw_convert<string> (x_scale()) + << "_" << raw_convert<string> (y_scale()) + << "_" << raw_convert<string> (x_offset()) + << "_" << raw_convert<string> (y_offset()); /* XXX: I suppose really _fonts shouldn't be in here, since not all types of subtitle content involve fonts. @@ -260,71 +260,71 @@ SubtitleContent::font_changed () void SubtitleContent::set_colour (dcp::Colour colour) { - maybe_set (_colour, colour, SubtitleContentProperty::SUBTITLE_COLOUR); + maybe_set (_colour, colour, SubtitleContentProperty::COLOUR); } void SubtitleContent::set_outline (bool o) { - maybe_set (_outline, o, SubtitleContentProperty::SUBTITLE_OUTLINE); + maybe_set (_outline, o, SubtitleContentProperty::OUTLINE); } void SubtitleContent::set_outline_colour (dcp::Colour colour) { - maybe_set (_outline_colour, colour, SubtitleContentProperty::SUBTITLE_OUTLINE_COLOUR); + maybe_set (_outline_colour, colour, SubtitleContentProperty::OUTLINE_COLOUR); } void -SubtitleContent::set_use_subtitles (bool u) +SubtitleContent::set_use (bool u) { - maybe_set (_use_subtitles, u, SubtitleContentProperty::USE_SUBTITLES); + maybe_set (_use, u, SubtitleContentProperty::USE); } void -SubtitleContent::set_burn_subtitles (bool b) +SubtitleContent::set_burn (bool b) { - maybe_set (_burn_subtitles, b, SubtitleContentProperty::BURN_SUBTITLES); + maybe_set (_burn, b, SubtitleContentProperty::BURN); } void -SubtitleContent::set_subtitle_x_offset (double o) +SubtitleContent::set_x_offset (double o) { - maybe_set (_subtitle_x_offset, o, SubtitleContentProperty::SUBTITLE_X_OFFSET); + maybe_set (_x_offset, o, SubtitleContentProperty::X_OFFSET); } void -SubtitleContent::set_subtitle_y_offset (double o) +SubtitleContent::set_y_offset (double o) { - maybe_set (_subtitle_y_offset, o, SubtitleContentProperty::SUBTITLE_Y_OFFSET); + maybe_set (_y_offset, o, SubtitleContentProperty::Y_OFFSET); } void -SubtitleContent::set_subtitle_x_scale (double s) +SubtitleContent::set_x_scale (double s) { - maybe_set (_subtitle_x_scale, s, SubtitleContentProperty::SUBTITLE_X_SCALE); + maybe_set (_x_scale, s, SubtitleContentProperty::X_SCALE); } void -SubtitleContent::set_subtitle_y_scale (double s) +SubtitleContent::set_y_scale (double s) { - maybe_set (_subtitle_y_scale, s, SubtitleContentProperty::SUBTITLE_Y_SCALE); + maybe_set (_y_scale, s, SubtitleContentProperty::Y_SCALE); } void -SubtitleContent::set_subtitle_language (string language) +SubtitleContent::set_language (string language) { - maybe_set (_subtitle_language, language, SubtitleContentProperty::SUBTITLE_LANGUAGE); + maybe_set (_language, language, SubtitleContentProperty::LANGUAGE); } void -SubtitleContent::set_subtitle_video_frame_rate (double r) +SubtitleContent::set_video_frame_rate (double r) { - maybe_set (_frame_rate, r, SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE); + maybe_set (_frame_rate, r, SubtitleContentProperty::VIDEO_FRAME_RATE); } double -SubtitleContent::subtitle_video_frame_rate () const +SubtitleContent::video_frame_rate () const { { boost::mutex::scoped_lock lm (_mutex); diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index 0adb12c0d..cb61ad9a8 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -30,18 +30,18 @@ class Font; class SubtitleContentProperty { public: - static int const SUBTITLE_X_OFFSET; - static int const SUBTITLE_Y_OFFSET; - static int const SUBTITLE_X_SCALE; - static int const SUBTITLE_Y_SCALE; - static int const USE_SUBTITLES; - static int const BURN_SUBTITLES; - static int const SUBTITLE_LANGUAGE; + static int const X_OFFSET; + static int const Y_OFFSET; + static int const X_SCALE; + static int const Y_SCALE; + static int const USE; + static int const BURN; + static int const LANGUAGE; static int const FONTS; - static int const SUBTITLE_VIDEO_FRAME_RATE; - static int const SUBTITLE_COLOUR; - static int const SUBTITLE_OUTLINE; - static int const SUBTITLE_OUTLINE_COLOUR; + static int const VIDEO_FRAME_RATE; + static int const COLOUR; + static int const OUTLINE; + static int const OUTLINE_COLOUR; }; class SubtitleContent : public ContentPart @@ -61,42 +61,42 @@ public: void add_font (boost::shared_ptr<Font> font); - void set_use_subtitles (bool); - void set_burn_subtitles (bool); - void set_subtitle_x_offset (double); - void set_subtitle_y_offset (double); - void set_subtitle_x_scale (double); - void set_subtitle_y_scale (double); - void set_subtitle_language (std::string language); + void set_use (bool); + void set_burn (bool); + void set_x_offset (double); + void set_y_offset (double); + void set_x_scale (double); + void set_y_scale (double); + void set_language (std::string language); - bool use_subtitles () const { + bool use () const { boost::mutex::scoped_lock lm (_mutex); - return _use_subtitles; + return _use; } - bool burn_subtitles () const { + bool burn () const { boost::mutex::scoped_lock lm (_mutex); - return _burn_subtitles; + return _burn; } - double subtitle_x_offset () const { + double x_offset () const { boost::mutex::scoped_lock lm (_mutex); - return _subtitle_x_offset; + return _x_offset; } - double subtitle_y_offset () const { + double y_offset () const { boost::mutex::scoped_lock lm (_mutex); - return _subtitle_y_offset; + return _y_offset; } - double subtitle_x_scale () const { + double x_scale () const { boost::mutex::scoped_lock lm (_mutex); - return _subtitle_x_scale; + return _x_scale; } - double subtitle_y_scale () const { + double y_scale () const { boost::mutex::scoped_lock lm (_mutex); - return _subtitle_y_scale; + return _y_scale; } std::list<boost::shared_ptr<Font> > fonts () const { @@ -104,9 +104,9 @@ public: return _fonts; } - std::string subtitle_language () const { + std::string language () const { boost::mutex::scoped_lock lm (_mutex); - return _subtitle_language; + return _language; } void set_colour (dcp::Colour); @@ -130,32 +130,32 @@ public: return _outline_colour; } - double subtitle_video_frame_rate () const; - void set_subtitle_video_frame_rate (double r); + double video_frame_rate () const; + void set_video_frame_rate (double r); protected: /** subtitle language (e.g. "German") or empty if it is not known */ - std::string _subtitle_language; + std::string _language; private: friend struct ffmpeg_pts_offset_test; void font_changed (); void connect_to_fonts (); - bool _use_subtitles; - bool _burn_subtitles; + bool _use; + bool _burn; /** x offset for placing subtitles, as a proportion of the container width; * +ve is further right, -ve is further left. */ - double _subtitle_x_offset; + double _x_offset; /** y offset for placing subtitles, as a proportion of the container height; * +ve is further down the frame, -ve is further up. */ - double _subtitle_y_offset; + double _y_offset; /** x scale factor to apply to subtitles */ - double _subtitle_x_scale; + double _x_scale; /** y scale factor to apply to subtitles */ - double _subtitle_y_scale; + double _y_scale; std::list<boost::shared_ptr<Font> > _fonts; dcp::Colour _colour; bool _outline; diff --git a/src/lib/text_subtitle_content.cc b/src/lib/text_subtitle_content.cc index 79a225c47..0ad41114e 100644 --- a/src/lib/text_subtitle_content.cc +++ b/src/lib/text_subtitle_content.cc @@ -55,7 +55,7 @@ TextSubtitleContent::examine (boost::shared_ptr<Job> job) TextSubtitle s (shared_from_this ()); /* Default to turning these subtitles on */ - subtitle->set_use_subtitles (true); + subtitle->set_use (true); boost::mutex::scoped_lock lm (_mutex); _length = s.length (); @@ -86,6 +86,6 @@ TextSubtitleContent::as_xml (xmlpp::Node* node) const DCPTime TextSubtitleContent::full_length () const { - FrameRateChange const frc (subtitle->subtitle_video_frame_rate(), film()->video_frame_rate ()); + FrameRateChange const frc (subtitle->video_frame_rate(), film()->video_frame_rate ()); return DCPTime (_length, frc); } diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index b7b056612..ba004d634 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -72,8 +72,8 @@ Transcoder::go () int burnt_subtitles = 0; int non_burnt_subtitles = 0; BOOST_FOREACH (shared_ptr<const Content> c, _film->content ()) { - if (c->subtitle && c->subtitle->use_subtitles()) { - if (c->subtitle->burn_subtitles()) { + if (c->subtitle && c->subtitle->use()) { + if (c->subtitle->burn()) { ++burnt_subtitles; } else { ++non_burnt_subtitles; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 97d7d4343..0533a12e5 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -41,14 +41,14 @@ #define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); -int const VideoContentProperty::VIDEO_SIZE = 0; -int const VideoContentProperty::VIDEO_FRAME_RATE = 1; -int const VideoContentProperty::VIDEO_FRAME_TYPE = 2; -int const VideoContentProperty::VIDEO_CROP = 3; -int const VideoContentProperty::VIDEO_SCALE = 4; +int const VideoContentProperty::SIZE = 0; +int const VideoContentProperty::FRAME_RATE = 1; +int const VideoContentProperty::FRAME_TYPE = 2; +int const VideoContentProperty::CROP = 3; +int const VideoContentProperty::SCALE = 4; int const VideoContentProperty::COLOUR_CONVERSION = 5; -int const VideoContentProperty::VIDEO_FADE_IN = 6; -int const VideoContentProperty::VIDEO_FADE_OUT = 7; +int const VideoContentProperty::FADE_IN = 6; +int const VideoContentProperty::FADE_OUT = 7; using std::string; using std::setprecision; @@ -66,8 +66,8 @@ using boost::dynamic_pointer_cast; VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film) : ContentPart (parent, film) - , _video_length (0) - , _video_frame_type (VIDEO_FRAME_TYPE_2D) + , _length (0) + , _frame_type (VIDEO_FRAME_TYPE_2D) , _scale (VideoContentScale (Ratio::from_id ("178"))) , _yuv (true) , _fade_in (0) @@ -79,11 +79,11 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film) VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version) : ContentPart (parent, film) { - _video_size.width = node->number_child<int> ("VideoWidth"); - _video_size.height = node->number_child<int> ("VideoHeight"); - _video_frame_rate = node->optional_number_child<double> ("VideoFrameRate"); - _video_length = node->number_child<Frame> ("VideoLength"); - _video_frame_type = static_cast<VideoFrameType> (node->number_child<int> ("VideoFrameType")); + _size.width = node->number_child<int> ("VideoWidth"); + _size.height = node->number_child<int> ("VideoHeight"); + _frame_rate = node->optional_number_child<double> ("VideoFrameRate"); + _length = node->number_child<Frame> ("VideoLength"); + _frame_type = static_cast<VideoFrameType> (node->number_child<int> ("VideoFrameType")); _sample_aspect_ratio = node->optional_number_child<double> ("SampleAspectRatio"); _crop.left = node->number_child<int> ("LeftCrop"); _crop.right = node->number_child<int> ("RightCrop"); @@ -116,7 +116,7 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml:: VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c) : ContentPart (parent, film) - , _video_length (0) + , _length (0) , _yuv (false) { shared_ptr<VideoContent> ref = c[0]->video; @@ -124,15 +124,15 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector for (size_t i = 1; i < c.size(); ++i) { - if (c[i]->video->video_size() != ref->video_size()) { + if (c[i]->video->size() != ref->size()) { throw JoinError (_("Content to be joined must have the same picture size.")); } - if (c[i]->video->video_frame_rate() != ref->video_frame_rate()) { + if (c[i]->video->frame_rate() != ref->frame_rate()) { throw JoinError (_("Content to be joined must have the same video frame rate.")); } - if (c[i]->video->video_frame_type() != ref->video_frame_type()) { + if (c[i]->video->frame_type() != ref->frame_type()) { throw JoinError (_("Content to be joined must have the same video frame type.")); } @@ -152,16 +152,16 @@ VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector throw JoinError (_("Content to be joined must have the same fades.")); } - _video_length += c[i]->video->video_length (); + _length += c[i]->video->length (); if (c[i]->video->yuv ()) { _yuv = true; } } - _video_size = ref->video_size (); - _video_frame_rate = ref->video_frame_rate (); - _video_frame_type = ref->video_frame_type (); + _size = ref->size (); + _frame_rate = ref->frame_rate (); + _frame_type = ref->frame_type (); _crop = ref->crop (); _scale = ref->scale (); _colour_conversion = ref->colour_conversion (); @@ -173,13 +173,13 @@ void VideoContent::as_xml (xmlpp::Node* node) const { boost::mutex::scoped_lock lm (_mutex); - node->add_child("VideoLength")->add_child_text (raw_convert<string> (_video_length)); - node->add_child("VideoWidth")->add_child_text (raw_convert<string> (_video_size.width)); - node->add_child("VideoHeight")->add_child_text (raw_convert<string> (_video_size.height)); - if (_video_frame_rate) { - node->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate.get())); + node->add_child("VideoLength")->add_child_text (raw_convert<string> (_length)); + node->add_child("VideoWidth")->add_child_text (raw_convert<string> (_size.width)); + node->add_child("VideoHeight")->add_child_text (raw_convert<string> (_size.height)); + if (_frame_rate) { + node->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_frame_rate.get())); } - node->add_child("VideoFrameType")->add_child_text (raw_convert<string> (static_cast<int> (_video_frame_type))); + node->add_child("VideoFrameType")->add_child_text (raw_convert<string> (static_cast<int> (_frame_type))); if (_sample_aspect_ratio) { node->add_child("SampleAspectRatio")->add_child_text (raw_convert<string> (_sample_aspect_ratio.get ())); } @@ -194,7 +194,7 @@ VideoContent::as_xml (xmlpp::Node* node) const } void -VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d) +VideoContent::take_from_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 (); @@ -205,25 +205,25 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d) { boost::mutex::scoped_lock lm (_mutex); - _video_size = vs; - _video_frame_rate = vfr; - _video_length = vl; + _size = vs; + _frame_rate = vfr; + _length = vl; _sample_aspect_ratio = ar; _yuv = yuv; /* Guess correct scale from size and sample aspect ratio */ _scale = VideoContentScale ( - Ratio::nearest_from_ratio (double (_video_size.width) * ar.get_value_or (1) / _video_size.height) + Ratio::nearest_from_ratio (double (_size.width) * ar.get_value_or (1) / _size.height) ); } shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); - LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length); + LOG_GENERAL ("Video length obtained from header as %1 frames", _length); - _parent->signal_changed (VideoContentProperty::VIDEO_SIZE); - _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE); - _parent->signal_changed (VideoContentProperty::VIDEO_SCALE); + _parent->signal_changed (VideoContentProperty::SIZE); + _parent->signal_changed (VideoContentProperty::FRAME_RATE); + _parent->signal_changed (VideoContentProperty::SCALE); _parent->signal_changed (ContentProperty::LENGTH); } @@ -252,10 +252,10 @@ VideoContent::technical_summary () const { string s = String::compose ( N_("video: length %1 frames, size %2x%3, rate %4"), - video_length_after_3d_combine(), - video_size().width, - video_size().height, - video_frame_rate() + length_after_3d_combine(), + size().width, + size().height, + frame_rate() ); if (sample_aspect_ratio ()) { @@ -266,10 +266,10 @@ VideoContent::technical_summary () const } dcp::Size -VideoContent::video_size_after_3d_split () const +VideoContent::size_after_3d_split () const { - dcp::Size const s = video_size (); - switch (video_frame_type ()) { + dcp::Size const s = size (); + switch (frame_type ()) { case VIDEO_FRAME_TYPE_2D: case VIDEO_FRAME_TYPE_3D_ALTERNATE: case VIDEO_FRAME_TYPE_3D_LEFT: @@ -286,9 +286,9 @@ VideoContent::video_size_after_3d_split () const /** @return Video size after 3D split and crop */ dcp::Size -VideoContent::video_size_after_crop () const +VideoContent::size_after_crop () const { - return crop().apply (video_size_after_3d_split ()); + return crop().apply (size_after_3d_split ()); } void @@ -298,7 +298,7 @@ VideoContent::scale_and_crop_to_fit_width () DCPOMATIC_ASSERT (film); set_scale (VideoContentScale (film->container ())); - int const crop = max (0, int (video_size().height - double (film->frame_size().height) * video_size().width / film->frame_size().width)); + int const crop = max (0, int (size().height - double (film->frame_size().height) * size().width / film->frame_size().width)); set_left_crop (0); set_right_crop (0); set_top_crop (crop / 2); @@ -312,7 +312,7 @@ VideoContent::scale_and_crop_to_fit_height () DCPOMATIC_ASSERT (film); set_scale (VideoContentScale (film->container ())); - int const crop = max (0, int (video_size().width - double (film->frame_size().width) * video_size().height / film->frame_size().height)); + int const crop = max (0, int (size().width - double (film->frame_size().width) * size().height / film->frame_size().height)); set_left_crop (crop / 2); set_right_crop (crop / 2); set_top_crop (0); @@ -325,12 +325,12 @@ VideoContent::fade (Frame f) const { DCPOMATIC_ASSERT (f >= 0); - Frame const ts = _parent->trim_start().frames_round(video_frame_rate()); + Frame const ts = _parent->trim_start().frames_round(frame_rate()); if ((f - ts) < fade_in()) { return double (f - ts) / fade_in(); } - Frame fade_out_start = video_length() - _parent->trim_end().frames_round(video_frame_rate()) - fade_out(); + Frame fade_out_start = length() - _parent->trim_end().frames_round(frame_rate()) - fade_out(); if (f >= fade_out_start) { return 1 - double (f - fade_out_start) / fade_out(); } @@ -344,15 +344,15 @@ VideoContent::processing_description () const /* stringstream is OK here as this string is just for presentation to the user */ SafeStringStream d; - if (video_size().width && video_size().height) { + if (size().width && size().height) { d << String::compose ( _("Content video is %1x%2"), - video_size_after_3d_split().width, - video_size_after_3d_split().height + size_after_3d_split().width, + size_after_3d_split().height ); - double ratio = video_size_after_3d_split().ratio (); + double ratio = size_after_3d_split().ratio (); if (sample_aspect_ratio ()) { d << ", " << _("pixel aspect ratio") << " " << fixed << setprecision(2) << sample_aspect_ratio().get () << ":1"; @@ -362,8 +362,8 @@ VideoContent::processing_description () const d << "\n" << _("Display aspect ratio") << " " << fixed << setprecision(2) << ratio << ":1\n"; } - if ((crop().left || crop().right || crop().top || crop().bottom) && video_size() != dcp::Size (0, 0)) { - dcp::Size cropped = video_size_after_crop (); + if ((crop().left || crop().right || crop().top || crop().bottom) && size() != dcp::Size (0, 0)) { + dcp::Size cropped = size_after_crop (); d << String::compose ( _("Cropped to %1x%2"), cropped.width, cropped.height @@ -377,7 +377,7 @@ VideoContent::processing_description () const dcp::Size const container_size = film->frame_size (); dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size); - if (scaled != video_size_after_crop ()) { + if (scaled != size_after_crop ()) { d << String::compose ( _("Scaled to %1x%2"), scaled.width, scaled.height @@ -397,9 +397,9 @@ VideoContent::processing_description () const } d << _("Content frame rate"); - d << " " << fixed << setprecision(4) << video_frame_rate() << "\n"; + d << " " << fixed << setprecision(4) << frame_rate() << "\n"; - FrameRateChange frc (video_frame_rate(), film->video_frame_rate ()); + FrameRateChange frc (frame_rate(), film->video_frame_rate ()); d << frc.description () << "\n"; return d.str (); @@ -408,66 +408,66 @@ VideoContent::processing_description () const void VideoContent::add_properties (list<UserProperty>& p) const { - p.push_back (UserProperty (_("Video"), _("Length"), raw_convert<string> (video_length ()), _("video frames"))); - p.push_back (UserProperty (_("Video"), _("Size"), raw_convert<string> (video_size().width) + "x" + raw_convert<string> (video_size().height))); - p.push_back (UserProperty (_("Video"), _("Frame rate"), raw_convert<string> (video_frame_rate(), 5), _("frames per second"))); + p.push_back (UserProperty (_("Video"), _("Length"), raw_convert<string> (length ()), _("video frames"))); + p.push_back (UserProperty (_("Video"), _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height))); + p.push_back (UserProperty (_("Video"), _("Frame rate"), raw_convert<string> (frame_rate(), 5), _("frames per second"))); } double -VideoContent::video_frame_rate () const +VideoContent::frame_rate () const { boost::mutex::scoped_lock lm (_mutex); shared_ptr<const Film> film = _film.lock (); DCPOMATIC_ASSERT (film); - return _video_frame_rate.get_value_or (film->video_frame_rate ()); + return _frame_rate.get_value_or (film->video_frame_rate ()); } void -VideoContent::set_video_length (Frame len) +VideoContent::set_length (Frame len) { - maybe_set (_video_length, len, ContentProperty::LENGTH); + maybe_set (_length, len, ContentProperty::LENGTH); } void VideoContent::set_left_crop (int c) { - maybe_set (_crop.left, c, VideoContentProperty::VIDEO_CROP); + maybe_set (_crop.left, c, VideoContentProperty::CROP); } void VideoContent::set_right_crop (int c) { - maybe_set (_crop.right, c, VideoContentProperty::VIDEO_CROP); + maybe_set (_crop.right, c, VideoContentProperty::CROP); } void VideoContent::set_top_crop (int c) { - maybe_set (_crop.top, c, VideoContentProperty::VIDEO_CROP); + maybe_set (_crop.top, c, VideoContentProperty::CROP); } void VideoContent::set_bottom_crop (int c) { - maybe_set (_crop.bottom, c, VideoContentProperty::VIDEO_CROP); + maybe_set (_crop.bottom, c, VideoContentProperty::CROP); } void VideoContent::set_scale (VideoContentScale s) { - maybe_set (_scale, s, VideoContentProperty::VIDEO_SCALE); + maybe_set (_scale, s, VideoContentProperty::SCALE); } void -VideoContent::set_video_frame_rate (double r) +VideoContent::set_frame_rate (double r) { - maybe_set (_video_frame_rate, r, VideoContentProperty::VIDEO_FRAME_RATE); + maybe_set (_frame_rate, r, VideoContentProperty::FRAME_RATE); } void -VideoContent::set_video_frame_type (VideoFrameType t) +VideoContent::set_frame_type (VideoFrameType t) { - maybe_set (_video_frame_type, t, VideoContentProperty::VIDEO_FRAME_TYPE); + maybe_set (_frame_type, t, VideoContentProperty::FRAME_TYPE); } void @@ -485,11 +485,11 @@ VideoContent::set_colour_conversion (ColourConversion c) void VideoContent::set_fade_in (Frame t) { - maybe_set (_fade_in, t, VideoContentProperty::VIDEO_FADE_IN); + maybe_set (_fade_in, t, VideoContentProperty::FADE_IN); } void VideoContent::set_fade_out (Frame t) { - maybe_set (_fade_out, t, VideoContentProperty::VIDEO_FADE_OUT); + maybe_set (_fade_out, t, VideoContentProperty::FADE_OUT); } diff --git a/src/lib/video_content.h b/src/lib/video_content.h index 0348969ae..432775651 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -38,14 +38,14 @@ class Content; class VideoContentProperty { public: - static int const VIDEO_SIZE; - static int const VIDEO_FRAME_RATE; - static int const VIDEO_FRAME_TYPE; - static int const VIDEO_CROP; - static int const VIDEO_SCALE; + static int const SIZE; + static int const FRAME_RATE; + static int const FRAME_TYPE; + static int const CROP; + static int const SCALE; static int const COLOUR_CONVERSION; - static int const VIDEO_FADE_IN; - static int const VIDEO_FADE_OUT; + static int const FADE_IN; + static int const FADE_OUT; }; class VideoContent : public ContentPart, public boost::enable_shared_from_this<VideoContent> @@ -59,37 +59,37 @@ public: std::string technical_summary () const; std::string identifier () const; - Frame video_length () const { + Frame length () const { boost::mutex::scoped_lock lm (_mutex); - return _video_length; + return _length; } - Frame video_length_after_3d_combine () const { + Frame length_after_3d_combine () const { boost::mutex::scoped_lock lm (_mutex); - if (_video_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) { - return _video_length / 2; + if (_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) { + return _length / 2; } - return _video_length; + return _length; } - dcp::Size video_size () const { + dcp::Size size () const { boost::mutex::scoped_lock lm (_mutex); - return _video_size; + return _size; } - double video_frame_rate () const; + double frame_rate () const; /** @return true if this content has a specific video frame rate, false * if it should use the DCP's rate. */ - bool has_own_video_frame_rate () const { + bool has_own_frame_rate () const { boost::mutex::scoped_lock lm (_mutex); - return static_cast<bool>(_video_frame_rate); + return static_cast<bool>(_frame_rate); } - void set_video_frame_type (VideoFrameType); - void set_video_frame_rate (double); + void set_frame_type (VideoFrameType); + void set_frame_rate (double); void set_left_crop (int); void set_right_crop (int); @@ -103,9 +103,9 @@ public: void set_fade_in (Frame); void set_fade_out (Frame); - VideoFrameType video_frame_type () const { + VideoFrameType frame_type () const { boost::mutex::scoped_lock lm (_mutex); - return _video_frame_type; + return _frame_type; } Crop crop () const { @@ -164,10 +164,8 @@ public: return _fade_out; } - dcp::Size video_size_after_3d_split () const; - dcp::Size video_size_after_crop () const; - - ContentTime dcp_time_to_content_time (DCPTime) const; + dcp::Size size_after_3d_split () const; + dcp::Size size_after_crop () const; boost::optional<double> fade (Frame) const; @@ -176,18 +174,13 @@ public: std::string processing_description () const; - void set_video_length (Frame); + void set_length (Frame); - void take_from_video_examiner (boost::shared_ptr<VideoExaminer>); + void take_from_examiner (boost::shared_ptr<VideoExaminer>); void add_properties (std::list<UserProperty> &) const; private: - Frame _video_length; - /** Video frame rate, or not set if this content should use the DCP's frame rate */ - boost::optional<double> _video_frame_rate; - boost::optional<ColourConversion> _colour_conversion; - friend struct ffmpeg_pts_offset_test; friend struct best_dcp_frame_rate_test_single; friend struct best_dcp_frame_rate_test_double; @@ -195,13 +188,15 @@ private: void setup_default_colour_conversion (); - dcp::Size _video_size; - VideoFrameType _video_frame_type; + Frame _length; + /** Video frame rate, or not set if this content should use the DCP's frame rate */ + boost::optional<double> _frame_rate; + boost::optional<ColourConversion> _colour_conversion; + dcp::Size _size; + VideoFrameType _frame_type; Crop _crop; VideoContentScale _scale; - /** Sample aspect ratio obtained from the content file's header, - if there is one. - */ + /** Sample aspect ratio obtained from the content file's header, if there is one */ boost::optional<double> _sample_aspect_ratio; bool _yuv; Frame _fade_in; diff --git a/src/lib/video_content_scale.cc b/src/lib/video_content_scale.cc index 775b3d9b7..3e67b82f6 100644 --- a/src/lib/video_content_scale.cc +++ b/src/lib/video_content_scale.cc @@ -132,7 +132,7 @@ VideoContentScale::size (shared_ptr<const VideoContent> c, dcp::Size display_con { /* Work out the size of the content if it were put inside film_container */ - dcp::Size const video_size_after_crop = c->video_size_after_crop (); + dcp::Size const video_size_after_crop = c->size_after_crop (); dcp::Size size; diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index f68f0815c..08f79c3d8 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -45,7 +45,7 @@ VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c, shared_ptr<Log> lo , _last_seek_accurate (true) , _ignore_video (false) { - _black_image.reset (new Image (AV_PIX_FMT_RGB24, _video_content->video_size(), true)); + _black_image.reset (new Image (AV_PIX_FMT_RGB24, _video_content->size(), true)); _black_image->make_black (); } @@ -83,7 +83,7 @@ VideoDecoder::get_video (Frame frame, bool accurate) _log->log (String::compose ("VD has request for %1", frame), LogEntry::TYPE_DEBUG_DECODE); if (_decoded_video.empty() || frame < _decoded_video.front().frame || frame > (_decoded_video.back().frame + 1)) { - seek (ContentTime::from_frames (frame, _video_content->video_frame_rate()), accurate); + seek (ContentTime::from_frames (frame, _video_content->frame_rate()), accurate); } list<ContentVideo> dec; @@ -257,7 +257,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame) /* Work out what we are going to push into _decoded_video next */ list<ContentVideo> to_push; - switch (_video_content->video_frame_type ()) { + switch (_video_content->frame_type ()) { case VIDEO_FRAME_TYPE_2D: to_push.push_back (ContentVideo (image, EYES_BOTH, PART_WHOLE, frame)); break; @@ -297,7 +297,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame) optional<Frame> to; if (_decoded_video.empty() && _last_seek_time && _last_seek_accurate) { - from = _last_seek_time->frames_round (_video_content->video_frame_rate ()); + from = _last_seek_time->frames_round (_video_content->frame_rate ()); to = to_push.front().frame; } else if (!_decoded_video.empty ()) { from = _decoded_video.back().frame + 1; @@ -313,7 +313,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame) } if (from) { - switch (_video_content->video_frame_type ()) { + switch (_video_content->frame_type ()) { case VIDEO_FRAME_TYPE_2D: fill_one_eye (from.get(), to.get (), EYES_BOTH); break; diff --git a/src/lib/video_examiner.h b/src/lib/video_examiner.h index 3c8f71757..1a551a5c0 100644 --- a/src/lib/video_examiner.h +++ b/src/lib/video_examiner.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 |
