Reasonably straightforward stuff; main things are adding
authorCarl Hetherington <cth@carlh.net>
Tue, 12 Apr 2016 21:10:54 +0000 (22:10 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
a _parent to VideoContent (mainly, but not only, for signalling)
and moving the video shared_ptr into Content, which makes much
more sense to replace dynamic_cast tests for whether something
has video or whatever.  Nearly builds.

38 files changed:
src/lib/content.h
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/lib/dcp_decoder.cc
src/lib/dcp_decoder.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_examiner.h
src/lib/film.cc
src/lib/image_content.cc
src/lib/image_content.h
src/lib/image_decoder.cc
src/lib/image_decoder.h
src/lib/image_examiner.cc
src/lib/player.cc
src/lib/playlist.cc
src/lib/types.h
src/lib/video_content.cc
src/lib/video_content.h
src/lib/video_decoder.cc
src/lib/video_decoder.h
src/tools/dcpomatic.cc
src/tools/dcpomatic_create.cc
src/wx/content_panel.cc
src/wx/content_panel.h
src/wx/dcp_panel.cc
src/wx/timeline.cc
src/wx/timing_panel.cc
src/wx/video_panel.cc
test/4k_test.cc
test/black_fill_test.cc
test/dcp_subtitle_test.cc
test/ffmpeg_audio_test.cc
test/ffmpeg_dcp_test.cc
test/ffmpeg_pts_offset_test.cc
test/frame_rate_test.cc
test/isdcf_name_test.cc

index d08540a9aa8fc9e4d00885f9cd54f05d094d4f5d..0ce9d39c146a781d3b5f54d7755e67c33e3c9d9c 100644 (file)
@@ -166,9 +166,12 @@ public:
 
        boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed;
 
-protected:
+       boost::shared_ptr<VideoContent> video;
+
        void signal_changed (int);
 
+protected:
+
        virtual void add_properties (std::list<UserProperty> &) const {}
 
        boost::weak_ptr<const Film> _film;
index 3bc28598d8886ecbda7f007da2cdf8c405e2c894..5a9a47fb11bbde028ae56dea2a226c4ab83886df 100644 (file)
@@ -55,7 +55,6 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
        , SingleStreamAudioContent (film)
        , SubtitleContent (film)
-       , video (new VideoContent (film))
        , _has_subtitles (false)
        , _encrypted (false)
        , _kdm_valid (false)
@@ -63,6 +62,8 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
        , _reference_audio (false)
        , _reference_subtitle (false)
 {
+       video.reset (new VideoContent (this, film));
+
        read_directory (p);
        set_default_colour_conversion ();
 }
@@ -71,8 +72,9 @@ DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, in
        : Content (film, node)
        , SingleStreamAudioContent (film, node, version)
        , SubtitleContent (film, node, version)
-       , video (new VideoContent (film, node, version))
 {
+       video.reset (new VideoContent (this, film, node, version));
+
        _name = node->string_child ("Name");
        _has_subtitles = node->bool_child ("HasSubtitles");
        _encrypted = node->bool_child ("Encrypted");
@@ -165,7 +167,7 @@ DCPTime
 DCPContent::full_length () const
 {
        FrameRateChange const frc (video->video_frame_rate (), film()->video_frame_rate ());
-       return DCPTime::from_frames (llrint (video_length () * frc.factor ()), film()->video_frame_rate ());
+       return DCPTime::from_frames (llrint (video->video_length () * frc.factor ()), film()->video_frame_rate ());
 }
 
 string
@@ -259,7 +261,7 @@ DCPContent::reels () const
        list<DCPTimePeriod> p;
        scoped_ptr<DCPDecoder> decoder;
        try {
-               decoder.reset (new DCPDecoder (shared_from_this(), false));
+               decoder.reset (new DCPDecoder (shared_from_this(), film()->log(), false));
        } catch (...) {
                /* Could not load the DCP; guess reels */
                list<DCPTimePeriod> p;
@@ -314,13 +316,14 @@ DCPContent::can_reference (string overlapping, list<string>& why_not) const
 bool
 DCPContent::can_reference_video (list<string>& why_not) const
 {
-       return can_reference<VideoContent> (_("There is other video content overlapping this DCP; remove it."), why_not);
+       /* XXX: this needs to be fixed */
+       return true;
 }
 
 bool
 DCPContent::can_reference_audio (list<string>& why_not) const
 {
-       DCPDecoder decoder (shared_from_this(), false);
+       DCPDecoder decoder (shared_from_this(), film()->log(), false);
        BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder.reels()) {
                if (!i->main_sound()) {
                        why_not.push_back (_("The DCP does not have sound in all reels."));
@@ -334,7 +337,7 @@ DCPContent::can_reference_audio (list<string>& why_not) const
 bool
 DCPContent::can_reference_subtitle (list<string>& why_not) const
 {
-       DCPDecoder decoder (shared_from_this(), false);
+       DCPDecoder decoder (shared_from_this(), film()->log(), false);
        BOOST_FOREACH (shared_ptr<dcp::Reel> i, decoder.reels()) {
                if (!i->main_subtitle()) {
                        why_not.push_back (_("The DCP does not have subtitles in all reels."));
index 04352b269bb884e2a332187d90c70c357216dc9d..1edc3a3aaaac7276a600499f60b7a93d7f4d0100 100644 (file)
@@ -121,8 +121,6 @@ public:
 
        bool can_reference_subtitle (std::list<std::string> &) const;
 
-       boost::shared_ptr<VideoContent> video;
-
 protected:
        void add_properties (std::list<UserProperty>& p) const;
 
index 873b3634fb18be9a2803d7b70d16c620c9b6605c..e8c64a086012742e1fe3c4fe3c8bfe3320ece87c 100644 (file)
@@ -42,8 +42,8 @@ using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 
-DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, bool fast)
-       : VideoDecoder (c->video)
+DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c, shared_ptr<Log> log, bool fast)
+       : VideoDecoder (c->video, log)
        , AudioDecoder (c, fast)
        , SubtitleDecoder (c)
        , _dcp_content (c)
index 32d334ec1530e45551f45639ddf63f25d30c0202..ce9a3ef9af3dd7af03e311f2052f58a4abdf8b36 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-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
@@ -35,7 +35,7 @@ struct dcp_subtitle_within_dcp_test;
 class DCPDecoder : public VideoDecoder, public AudioDecoder, public SubtitleDecoder
 {
 public:
-       DCPDecoder (boost::shared_ptr<const DCPContent>, bool fast);
+       DCPDecoder (boost::shared_ptr<const DCPContent>, boost::shared_ptr<Log> log, bool fast);
 
        std::list<boost::shared_ptr<dcp::Reel> > reels () const {
                return _reels;
index 54e0b470aa15ded1acc1dc93e762eef27b008b4a..a8b7fb716cecf92d39b1b931ddf7d49277f35bee 100644 (file)
@@ -63,8 +63,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, boost::filesystem::pa
        : Content (film, p)
        , AudioContent (film, p)
        , SubtitleContent (film, p)
-       , video (new VideoContent (film))
 {
+       video.reset (new VideoContent (this, film));
+
        set_default_colour_conversion ();
 }
 
@@ -72,8 +73,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
        : Content (film, node)
        , AudioContent (film, node)
        , SubtitleContent (film, node, version)
-       , video (new VideoContent (film, node, version))
 {
+       video.reset (new VideoContent (this, film, node, version));
+
        list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
        for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
                _subtitle_streams.push_back (shared_ptr<FFmpegSubtitleStream> (new FFmpegSubtitleStream (*i, version)));
@@ -120,8 +122,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_
        : Content (film, c)
        , AudioContent (film, c)
        , SubtitleContent (film, c)
-       , video (new VideoContent (film, c))
 {
+       video.reset (new VideoContent (this, film, c));
+
        shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
        DCPOMATIC_ASSERT (ref);
 
@@ -194,7 +197,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
        Content::examine (job);
 
        shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
-       take_from_video_examiner (examiner);
+       video->take_from_video_examiner (examiner);
        set_default_colour_conversion ();
 
        {
@@ -287,8 +290,8 @@ operator!= (FFmpegStream const & a, FFmpegStream const & b)
 DCPTime
 FFmpegContent::full_length () const
 {
-       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());
+       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());
 }
 
 void
@@ -373,14 +376,14 @@ FFmpegContent::has_text_subtitles () const
 void
 FFmpegContent::set_default_colour_conversion ()
 {
-       dcp::Size const s = video_size ();
+       dcp::Size const s = video->video_size ();
 
        boost::mutex::scoped_lock lm (_mutex);
 
        if (s.width < 1080) {
-               _colour_conversion = PresetColourConversion::from_id ("rec601").conversion;
+               video->set_colour_conversion (PresetColourConversion::from_id ("rec601").conversion);
        } else {
-               _colour_conversion = PresetColourConversion::from_id ("rec709").conversion;
+               video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
        }
 }
 
index f5bbbd31e27654ae1d5da742842ab0d07af4fd50..d210d63a8b98e8cb674b6b745d25ee7d901b5986 100644 (file)
@@ -106,8 +106,6 @@ public:
 
        void signal_subtitle_stream_changed ();
 
-       boost::shared_ptr<VideoContent> video;
-
 protected:
        void add_properties (std::list<UserProperty> &) const;
 
index 698078b5b4339eae552aa67d249d24d24bd82d9d..5240decb24dfd69e74650b31a2de3b13ab8c8f18 100644 (file)
@@ -72,12 +72,12 @@ using boost::split;
 using dcp::Size;
 
 FFmpegDecoder::FFmpegDecoder (shared_ptr<const FFmpegContent> c, shared_ptr<Log> log, bool fast)
-       : VideoDecoder (c)
+       : VideoDecoder (c->video, log)
        , AudioDecoder (c, fast)
        , SubtitleDecoder (c)
        , FFmpeg (c)
        , _log (log)
-       , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video_frame_rate()))
+       , _pts_offset (pts_offset (c->ffmpeg_audio_streams(), c->first_video(), c->video->video_frame_rate()))
 {
 
 }
@@ -414,7 +414,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_frame_rate ())
+                               llrint (pts * _ffmpeg_content->video->video_frame_rate ())
                                );
                } else {
                        LOG_WARNING_NC ("Dropping frame without PTS");
@@ -548,7 +548,7 @@ FFmpegDecoder::decode_bitmap_subtitle (AVSubtitleRect const * rect, ContentTimeP
                out_p += image->stride()[0] / sizeof (uint32_t);
        }
 
-       dcp::Size const vs = _ffmpeg_content->video_size ();
+       dcp::Size const vs = _ffmpeg_content->video->video_size ();
        dcpomatic::Rect<double> const scaled_rect (
                static_cast<double> (rect->x) / vs.width,
                static_cast<double> (rect->y) / vs.height,
index f64ea8d799dd51af807eb6cfbb29aee374cb5d95..b9ca04e4c6ce958bf6ae78247e6b71fe177c821f 100644 (file)
@@ -25,6 +25,7 @@ struct AVStream;
 
 class FFmpegAudioStream;
 class FFmpegSubtitleStream;
+class Job;
 
 class FFmpegExaminer : public FFmpeg, public VideoExaminer
 {
index dbcb9f31a1c18c7a5bdc329bdc5bac6a371b8a3f..7d319fc1e02e6882e8638a3c3f51cb1bc87f97a5 100644 (file)
@@ -617,13 +617,12 @@ Film::isdcf_name (bool if_created_now) const
        if (dcp_content_type() && dcp_content_type()->libdcp_kind() != dcp::TRAILER) {
                Ratio const * content_ratio = 0;
                BOOST_FOREACH (shared_ptr<Content> i, content ()) {
-                       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
-                       if (vc) {
+                       if (i->video) {
                                /* Here's the first piece of video content */
-                               if (vc->scale().ratio ()) {
-                                       content_ratio = vc->scale().ratio ();
+                               if (i->video->scale().ratio ()) {
+                                       content_ratio = i->video->scale().ratio ();
                                } else {
-                                       content_ratio = Ratio::from_ratio (vc->video_size().ratio ());
+                                       content_ratio = Ratio::from_ratio (i->video->video_size().ratio ());
                                }
                                break;
                        }
@@ -1049,7 +1048,7 @@ void
 Film::add_content (shared_ptr<Content> c)
 {
        /* Add {video,subtitle} content after any existing {video,subtitle} content */
-       if (dynamic_pointer_cast<VideoContent> (c)) {
+       if (c->video) {
                c->set_position (_playlist->video_end ());
        } else if (dynamic_pointer_cast<SubtitleContent> (c)) {
                c->set_position (_playlist->subtitle_end ());
@@ -1377,18 +1376,17 @@ Film::reels () const
        case REELTYPE_BY_VIDEO_CONTENT:
        {
                optional<DCPTime> last_split;
-               shared_ptr<VideoContent> last_video;
+               shared_ptr<Content> last_video;
                ContentList cl = content ();
                BOOST_FOREACH (shared_ptr<Content> c, content ()) {
-                       shared_ptr<VideoContent> v = dynamic_pointer_cast<VideoContent> (c);
-                       if (v) {
-                               BOOST_FOREACH (DCPTime t, v->reel_split_points()) {
+                       if (c->video) {
+                               BOOST_FOREACH (DCPTime t, c->reel_split_points()) {
                                        if (last_split) {
                                                p.push_back (DCPTimePeriod (last_split.get(), t));
                                        }
                                        last_split = t;
                                }
-                               last_video = v;
+                               last_video = c;
                        }
                }
 
index ed290dd6c9e5f5f3cfc1187cd8eb7a0aad7af32f..231eb9f8c163c117c5b88941f9c52350613e1554 100644 (file)
@@ -40,8 +40,9 @@ using boost::shared_ptr;
 
 ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
-       , video (new VideoContent (film))
 {
+       video.reset (new VideoContent (this, film));
+
        if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
                _paths.push_back (p);
        } else {
@@ -64,9 +65,8 @@ ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path
 
 ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
        : Content (film, node)
-       , video (new VideoContent (film, node, version))
 {
-
+       video.reset (new VideoContent (this, film, node, version));
 }
 
 string
@@ -115,28 +115,17 @@ ImageContent::examine (shared_ptr<Job> job)
        DCPOMATIC_ASSERT (film);
 
        shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
-       take_from_video_examiner (examiner);
+       video->take_from_video_examiner (examiner);
        set_default_colour_conversion ();
 }
 
-void
-ImageContent::set_video_length (Frame len)
-{
-       {
-               boost::mutex::scoped_lock lm (_mutex);
-               _video_length = len;
-       }
-
-       signal_changed (ContentProperty::LENGTH);
-}
-
 DCPTime
 ImageContent::full_length () const
 {
        shared_ptr<const Film> film = _film.lock ();
        DCPOMATIC_ASSERT (film);
-       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 ());
+       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 ());
 }
 
 string
@@ -145,7 +134,7 @@ ImageContent::identifier () const
        SafeStringStream s;
        s << Content::identifier();
        s << "_" << video->identifier ();
-       s << "_" << video_length();
+       s << "_" << video->video_length();
        return s.str ();
 }
 
@@ -161,7 +150,7 @@ ImageContent::set_default_colour_conversion ()
        BOOST_FOREACH (boost::filesystem::path i, _paths) {
                if (valid_j2k_file (i)) {
                        /* We default to no colour conversion if we have JPEG2000 files */
-                       unset_colour_conversion ();
+                       video->unset_colour_conversion ();
                        return;
                }
        }
@@ -171,8 +160,8 @@ ImageContent::set_default_colour_conversion ()
        boost::mutex::scoped_lock lm (_mutex);
 
        if (s) {
-               _colour_conversion = PresetColourConversion::from_id ("srgb").conversion;
+               video->set_colour_conversion (PresetColourConversion::from_id ("srgb").conversion);
        } else {
-               _colour_conversion = PresetColourConversion::from_id ("rec709").conversion;
+               video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
        }
 }
index 353ce8370eb451050ab554210056d32c8b715e65..dcdb7b526660d53b7b23bf411874637be737100e 100644 (file)
@@ -42,10 +42,7 @@ public:
 
        void set_default_colour_conversion ();
 
-       void set_video_length (Frame);
        bool still () const;
-
-       boost::shared_ptr<VideoContent> video;
 };
 
 #endif
index 2291daecd7996f85e00ad9bdc7d6cc9a96e8be90..e26574f610ab2a19868037953cc684906570f229 100644 (file)
@@ -34,8 +34,8 @@ using std::cout;
 using boost::shared_ptr;
 using dcp::Size;
 
-ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
-       : VideoDecoder (c)
+ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c, shared_ptr<Log> log)
+       : VideoDecoder (c->video, log)
        , _image_content (c)
        , _video_position (0)
 {
@@ -45,7 +45,7 @@ ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
 bool
 ImageDecoder::pass (PassReason, bool)
 {
-       if (_video_position >= _image_content->video_length()) {
+       if (_video_position >= _image_content->video->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_size ()));
+                       _image.reset (new J2KImageProxy (path, _image_content->video->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_frame_rate ());
+       _video_position = time.frames_round (_image_content->video->video_frame_rate ());
 }
index e2de56acb9b1789f5e0e37a584dc30b88acc8625..9d81cdac18248087a9a4982c0c97fa59eedd3632 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 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
@@ -24,7 +24,7 @@ class ImageContent;
 class ImageDecoder : public VideoDecoder
 {
 public:
-       ImageDecoder (boost::shared_ptr<const ImageContent> c);
+       ImageDecoder (boost::shared_ptr<const ImageContent> c, boost::shared_ptr<Log> log);
 
        boost::shared_ptr<const ImageContent> content () {
                return _image_content;
index 7b02de956e033ff14a60810f732d82b6774412a6..0102754292f09c8edb1c8c1738a481c04a965b73 100644 (file)
@@ -85,9 +85,9 @@ ImageExaminer::video_size () const
 optional<double>
 ImageExaminer::video_frame_rate () const
 {
-       if (_image_content->has_own_video_frame_rate()) {
+       if (_image_content->video->has_own_video_frame_rate()) {
                /* The content already knows what frame rate it should be */
-               return _image_content->video_frame_rate();
+               return _image_content->video->video_frame_rate();
        }
 
        /* Don't know */
index d35c1b76bb711afd59d0e2df151445cb5b0bbf35..2b65fd54e393d5c252fecb67a564115d45bb3630 100644 (file)
@@ -113,13 +113,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_frame_rate(), _film->video_frame_rate());
+                       frc = FrameRateChange (fc->video->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, _fast));
-                       frc = FrameRateChange (dc->video_frame_rate(), _film->video_frame_rate());
+                       decoder.reset (new DCPDecoder (dc, _film->log(), _fast));
+                       frc = FrameRateChange (dc->video->video_frame_rate(), _film->video_frame_rate());
                }
 
                /* ImageContent */
@@ -134,10 +134,10 @@ Player::setup_pieces ()
                        }
 
                        if (!decoder) {
-                               decoder.reset (new ImageDecoder (ic));
+                               decoder.reset (new ImageDecoder (ic, _film->log()));
                        }
 
-                       frc = FrameRateChange (ic->video_frame_rate(), _film->video_frame_rate());
+                       frc = FrameRateChange (ic->video->video_frame_rate(), _film->video_frame_rate());
                }
 
                /* SndfileContent */
@@ -147,22 +147,21 @@ Player::setup_pieces ()
 
                        /* Work out a FrameRateChange for the best overlap video for this content */
                        DCPTime best_overlap_t;
-                       shared_ptr<VideoContent> best_overlap;
+                       shared_ptr<Content> best_overlap;
                        BOOST_FOREACH (shared_ptr<Content> j, _playlist->content ()) {
-                               shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (j);
-                               if (!vc) {
+                               if (!j->video) {
                                        continue;
                                }
 
-                               DCPTime const overlap = min (vc->end(), i->end()) - max (vc->position(), i->position());
+                               DCPTime const overlap = min (j->end(), i->end()) - max (j->position(), i->position());
                                if (overlap > best_overlap_t) {
-                                       best_overlap = vc;
+                                       best_overlap = j;
                                        best_overlap_t = overlap;
                                }
                        }
 
                        if (best_overlap) {
-                               frc = FrameRateChange (best_overlap->video_frame_rate(), _film->video_frame_rate ());
+                               frc = FrameRateChange (best_overlap->video->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 ());
@@ -397,17 +396,15 @@ Player::get_video (DCPTime time, bool accurate)
        } else {
                /* Some video content at this time */
                shared_ptr<Piece> last = *(ov.rbegin ());
-               VideoFrameType const last_type = dynamic_pointer_cast<VideoContent> (last->content)->video_frame_type ();
+               VideoFrameType const last_type = last->content->video->video_frame_type ();
 
                /* Get video from appropriate piece(s) */
                BOOST_FOREACH (shared_ptr<Piece> piece, ov) {
 
                        shared_ptr<VideoDecoder> decoder = dynamic_pointer_cast<VideoDecoder> (piece->decoder);
                        DCPOMATIC_ASSERT (decoder);
-                       shared_ptr<VideoContent> video_content = dynamic_pointer_cast<VideoContent> (piece->content);
-                       DCPOMATIC_ASSERT (video_content);
 
-                       shared_ptr<DCPContent> dcp_content = dynamic_pointer_cast<DCPContent> (video_content);
+                       shared_ptr<DCPContent> dcp_content = dynamic_pointer_cast<DCPContent> (piece->content);
                        if (dcp_content && dcp_content->reference_video () && !_play_referenced) {
                                continue;
                        }
@@ -416,8 +413,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 && video_content->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) ||
-                               (last_type == VIDEO_FRAME_TYPE_3D_RIGHT && video_content->video_frame_type() == VIDEO_FRAME_TYPE_3D_LEFT);
+                               (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);
 
                        if (use) {
                                /* We want to use this piece */
@@ -425,7 +422,9 @@ Player::get_video (DCPTime time, bool accurate)
                                if (content_video.empty ()) {
                                        pvf.push_back (black_player_video_frame (time));
                                } else {
-                                       dcp::Size image_size = video_content->scale().size (video_content, _video_container_size, _film->frame_size ());
+                                       dcp::Size image_size = piece->content->video->scale().size (
+                                               piece->content->video, _video_container_size, _film->frame_size ()
+                                               );
 
                                        for (list<ContentVideo>::const_iterator i = content_video.begin(); i != content_video.end(); ++i) {
                                                pvf.push_back (
@@ -433,13 +432,13 @@ Player::get_video (DCPTime time, bool accurate)
                                                                new PlayerVideo (
                                                                        i->image,
                                                                        content_video_to_dcp (piece, i->frame),
-                                                                       video_content->crop (),
-                                                                       video_content->fade (i->frame),
+                                                                       piece->content->video->crop (),
+                                                                       piece->content->video->fade (i->frame),
                                                                        image_size,
                                                                        _video_container_size,
                                                                        i->eyes,
                                                                        i->part,
-                                                                       video_content->colour_conversion ()
+                                                                       piece->content->video->colour_conversion ()
                                                                        )
                                                                )
                                                        );
@@ -770,7 +769,7 @@ Player::get_reel_assets ()
 
                scoped_ptr<DCPDecoder> decoder;
                try {
-                       decoder.reset (new DCPDecoder (j, false));
+                       decoder.reset (new DCPDecoder (j, _film->log(), false));
                } catch (...) {
                        return a;
                }
index 82a4666cdd162185dd8a19530eaf363797f45182..f03f8a9a1747eb7fcd061c2c4f078ce93a598ec5 100644 (file)
@@ -110,20 +110,19 @@ Playlist::maybe_sequence ()
        DCPTime next_left;
        DCPTime next_right;
        BOOST_FOREACH (shared_ptr<Content> i, _content) {
-               shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (i);
-               if (!vc) {
+               if (!i->video) {
                        continue;
                }
 
-               if (vc->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
-                       vc->set_position (next_right);
-                       next_right = vc->end();
+               if (i->video->video_frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+                       i->set_position (next_right);
+                       next_right = i->end();
                } else {
-                       vc->set_position (next_left);
-                       next_left = vc->end();
+                       i->set_position (next_left);
+                       next_left = i->end();
                }
 
-               placed.push_back (vc);
+               placed.push_back (i);
        }
 
        /* Subtitles */
@@ -271,15 +270,14 @@ Playlist::best_dcp_frame_rate () const
 
                float this_error = 0;
                BOOST_FOREACH (shared_ptr<Content> j, _content) {
-                       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (j);
-                       if (!vc || !vc->has_own_video_frame_rate()) {
+                       if (!j->video || !j->video->has_own_video_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 - vc->video_frame_rate ())),
-                               float (fabs (i->source - vc->video_frame_rate () * 2))
+                               float (fabs (i->source - j->video->video_frame_rate ())),
+                               float (fabs (i->source - j->video->video_frame_rate () * 2))
                                );
 
                        /* Use the largest difference between DCP and source as the "error" */
@@ -373,16 +371,15 @@ FrameRateChange
 Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const
 {
        for (ContentList::const_reverse_iterator i = _content.rbegin(); i != _content.rend(); ++i) {
-               shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (*i);
-               if (!vc) {
+               if (!(*i)->video) {
                        continue;
                }
 
-               if (vc->position() <= t) {
+               if ((*i)->position() <= t) {
                        /* This is the first piece of content (going backwards...) that starts before t,
                           so it's the active one.
                        */
-                       return FrameRateChange (vc->video_frame_rate(), dcp_video_frame_rate);
+                       return FrameRateChange ((*i)->video->video_frame_rate(), dcp_video_frame_rate);
                }
        }
 
@@ -403,9 +400,9 @@ ContentSorter::operator() (shared_ptr<Content> a, shared_ptr<Content> b)
        }
 
        /* Put video before audio if they start at the same time */
-       if (dynamic_pointer_cast<VideoContent>(a) && !dynamic_pointer_cast<VideoContent>(b)) {
+       if (a->video && !b->video) {
                return true;
-       } else if (!dynamic_pointer_cast<VideoContent>(a) && dynamic_pointer_cast<VideoContent>(b)) {
+       } else if (!a->video && b->video) {
                return false;
        }
 
index 105432f83508cd43be07cf7f430f8c66f76fbf4c..33bad1d24455fc03938f175cd3f1bf3be7c06b1c 100644 (file)
@@ -48,7 +48,6 @@ namespace xmlpp {
 #define SERVER_LINK_VERSION (64+0)
 
 typedef std::vector<boost::shared_ptr<Content> > ContentList;
-typedef std::vector<boost::shared_ptr<VideoContent> > VideoContentList;
 typedef std::vector<boost::shared_ptr<AudioContent> > AudioContentList;
 typedef std::vector<boost::shared_ptr<SubtitleContent> > SubtitleContentList;
 typedef std::vector<boost::shared_ptr<FFmpegContent> > FFmpegContentList;
index 91701415e0fef5adc52d1a48deed1376ff3deb50..708edee76a031e4ea8fe90624388564b173d77a0 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "video_content.h"
+#include "content.h"
 #include "video_examiner.h"
 #include "compose.hpp"
 #include "ratio.h"
@@ -63,8 +64,9 @@ using boost::shared_ptr;
 using boost::optional;
 using boost::dynamic_pointer_cast;
 
-VideoContent::VideoContent (shared_ptr<const Film> film)
-       : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film)
+       : _parent (parent)
+       , _film (film)
        , _video_length (0)
        , _video_frame_type (VIDEO_FRAME_TYPE_2D)
        , _scale (VideoContentScale (Ratio::from_id ("178")))
@@ -75,8 +77,9 @@ VideoContent::VideoContent (shared_ptr<const Film> film)
 
 }
 
-VideoContent::VideoContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
-       : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
+       : _parent (parent)
+       , _film (film)
 {
        _video_size.width = node->number_child<int> ("VideoWidth");
        _video_size.height = node->number_child<int> ("VideoHeight");
@@ -113,8 +116,9 @@ VideoContent::VideoContent (shared_ptr<const Film> film, cxml::ConstNodePtr node
        }
 }
 
-VideoContent::VideoContent (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
-       : _film (film)
+VideoContent::VideoContent (Content* parent, shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
+       : _parent (parent)
+       , _film (film)
        , _video_length (0)
        , _yuv (false)
 {
@@ -229,10 +233,10 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
        DCPOMATIC_ASSERT (film);
        LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length);
 
-       signal_changed (VideoContentProperty::VIDEO_SIZE);
-       signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
-       signal_changed (VideoContentProperty::VIDEO_SCALE);
-       signal_changed (ContentProperty::LENGTH);
+       _parent->signal_changed (VideoContentProperty::VIDEO_SIZE);
+       _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
+       _parent->signal_changed (VideoContentProperty::VIDEO_SCALE);
+       _parent->signal_changed (ContentProperty::LENGTH);
 }
 
 void
@@ -248,7 +252,7 @@ VideoContent::set_left_crop (int c)
                _crop.left = c;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_CROP);
+       _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
 }
 
 void
@@ -263,7 +267,7 @@ VideoContent::set_right_crop (int c)
                _crop.right = c;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_CROP);
+       _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
 }
 
 void
@@ -278,7 +282,7 @@ VideoContent::set_top_crop (int c)
                _crop.top = c;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_CROP);
+       _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
 }
 
 void
@@ -293,7 +297,7 @@ VideoContent::set_bottom_crop (int c)
                _crop.bottom = c;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_CROP);
+       _parent->signal_changed (VideoContentProperty::VIDEO_CROP);
 }
 
 void
@@ -308,7 +312,7 @@ VideoContent::set_scale (VideoContentScale s)
                _scale = s;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_SCALE);
+       _parent->signal_changed (VideoContentProperty::VIDEO_SCALE);
 }
 
 /** @return string which includes everything about how this content looks */
@@ -339,7 +343,7 @@ VideoContent::set_video_frame_type (VideoFrameType t)
                _video_frame_type = t;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_FRAME_TYPE);
+       _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_TYPE);
 }
 
 string
@@ -387,7 +391,7 @@ VideoContent::unset_colour_conversion ()
                _colour_conversion = boost::optional<ColourConversion> ();
        }
 
-       signal_changed (VideoContentProperty::COLOUR_CONVERSION);
+       _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION);
 }
 
 void
@@ -398,7 +402,7 @@ VideoContent::set_colour_conversion (ColourConversion c)
                _colour_conversion = c;
        }
 
-       signal_changed (VideoContentProperty::COLOUR_CONVERSION);
+       _parent->signal_changed (VideoContentProperty::COLOUR_CONVERSION);
 }
 
 void
@@ -409,7 +413,7 @@ VideoContent::set_fade_in (Frame t)
                _fade_in = t;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_FADE_IN);
+       _parent->signal_changed (VideoContentProperty::VIDEO_FADE_IN);
 }
 
 void
@@ -420,7 +424,7 @@ VideoContent::set_fade_out (Frame t)
                _fade_out = t;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_FADE_OUT);
+       _parent->signal_changed (VideoContentProperty::VIDEO_FADE_OUT);
 }
 
 /** @return Video size after 3D split and crop */
@@ -470,7 +474,7 @@ VideoContent::set_video_frame_rate (double r)
                _video_frame_rate = r;
        }
 
-       signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
+       _parent->signal_changed (VideoContentProperty::VIDEO_FRAME_RATE);
 }
 
 /** @param f Frame index within the whole (untrimmed) content */
@@ -479,12 +483,12 @@ VideoContent::fade (Frame f) const
 {
        DCPOMATIC_ASSERT (f >= 0);
 
-       Frame const ts = trim_start().frames_round(video_frame_rate());
+       Frame const ts = _parent->trim_start().frames_round(video_frame_rate());
        if ((f - ts) < fade_in()) {
                return double (f - ts) / fade_in();
        }
 
-       Frame fade_out_start = video_length() - trim_end().frames_round(video_frame_rate()) - fade_out();
+       Frame fade_out_start = video_length() - _parent->trim_end().frames_round(video_frame_rate()) - fade_out();
        if (f >= fade_out_start) {
                return 1 - double (f - fade_out_start) / fade_out();
        }
@@ -529,7 +533,7 @@ VideoContent::processing_description () const
        shared_ptr<const Film> film = _film.lock ();
        DCPOMATIC_ASSERT (film);
        dcp::Size const container_size = film->frame_size ();
-       dcp::Size const scaled = scale().size (dynamic_pointer_cast<const VideoContent> (shared_from_this ()), container_size, container_size);
+       dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size);
 
        if (scaled != video_size_after_crop ()) {
                d << String::compose (
@@ -575,3 +579,14 @@ VideoContent::video_frame_rate () const
        DCPOMATIC_ASSERT (film);
        return _video_frame_rate.get_value_or (film->video_frame_rate ());
 }
+
+void
+VideoContent::set_video_length (Frame len)
+{
+       {
+               boost::mutex::scoped_lock lm (_mutex);
+               _video_length = len;
+       }
+
+       _parent->signal_changed (ContentProperty::LENGTH);
+}
index b93744053b1e9ff42383880ad757816bdbae5d8a..768f1897df247e15a714c544b4cb5fce1699afa4 100644 (file)
 #include "video_content_scale.h"
 #include "dcpomatic_time.h"
 #include "user_property.h"
+#include "types.h"
 #include <boost/thread/mutex.hpp>
 #include <boost/weak_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
 
 class VideoExaminer;
 class Ratio;
 class Film;
+class Content;
 
 class VideoContentProperty
 {
@@ -44,12 +47,12 @@ public:
        static int const VIDEO_FADE_OUT;
 };
 
-class VideoContent
+class VideoContent : public boost::enable_shared_from_this<VideoContent>
 {
 public:
-       VideoContent (boost::shared_ptr<const Film>);
-       VideoContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
-       VideoContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+       VideoContent (Content* parent, boost::shared_ptr<const Film>);
+       VideoContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
+       VideoContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
 
        void as_xml (xmlpp::Node *) const;
        std::string technical_summary () const;
@@ -174,10 +177,14 @@ public:
 
        std::string processing_description () const;
 
-private:
+       void set_video_length (Frame);
+
        void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
        void add_properties (std::list<UserProperty> &) const;
 
+private:
+
+       Content* _parent;
        boost::weak_ptr<const Film> _film;
        mutable boost::mutex _mutex;
        Frame _video_length;
index 0936d1bda4f9641bccc1c5c3ab05d97ab81736c6..f68f0815c1f156c75421d853049e712b21c337be 100644 (file)
@@ -34,13 +34,14 @@ using std::back_inserter;
 using boost::shared_ptr;
 using boost::optional;
 
-VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c)
+VideoDecoder::VideoDecoder (shared_ptr<const VideoContent> c, shared_ptr<Log> log)
 #ifdef DCPOMATIC_DEBUG
        : test_gaps (0)
        , _video_content (c)
 #else
        : _video_content (c)
 #endif
+       , _log (log)
        , _last_seek_accurate (true)
        , _ignore_video (false)
 {
@@ -79,7 +80,7 @@ VideoDecoder::get_video (Frame frame, bool accurate)
           one after the end of _decoded_video we need to seek.
        */
 
-       _video_content->film()->log()->log (String::compose ("VD has request for %1", frame), LogEntry::TYPE_DEBUG_DECODE);
+       _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);
@@ -252,7 +253,7 @@ VideoDecoder::video (shared_ptr<const ImageProxy> image, Frame frame)
                return;
        }
 
-       _video_content->film()->log()->log (String::compose ("VD receives %1", frame), LogEntry::TYPE_DEBUG_DECODE);
+       _log->log (String::compose ("VD receives %1", frame), LogEntry::TYPE_DEBUG_DECODE);
 
        /* Work out what we are going to push into _decoded_video next */
        list<ContentVideo> to_push;
index af24b93bc9ca1c016f74f29169a53e59daa68d10..c787faa0413e4181c8206aa35fad5123e6e54e16 100644 (file)
@@ -34,6 +34,7 @@
 class VideoContent;
 class ImageProxy;
 class Image;
+class Log;
 
 /** @class VideoDecoder
  *  @brief Parent for classes which decode video.
@@ -41,7 +42,7 @@ class Image;
 class VideoDecoder : public virtual Decoder
 {
 public:
-       VideoDecoder (boost::shared_ptr<const VideoContent> c);
+       VideoDecoder (boost::shared_ptr<const VideoContent> c, boost::shared_ptr<Log> log);
 
        std::list<ContentVideo> get_video (Frame frame, bool accurate);
 
@@ -66,6 +67,7 @@ protected:
        void fill_both_eyes (Frame from, Frame to, Eyes);
 
        boost::shared_ptr<const VideoContent> _video_content;
+       boost::shared_ptr<Log> _log;
        std::list<ContentVideo> _decoded_video;
        boost::shared_ptr<Image> _black_image;
        boost::optional<ContentTime> _last_seek_time;
index f336f0a854ee1672b12278f18c090e7fcc6d7cc7..edc44ee6642ac490f4cfa5bad343cfd9d4381066 100644 (file)
@@ -41,6 +41,7 @@
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/video_content.h"
+#include "lib/content.h"
 #include "lib/version.h"
 #include "lib/signal_manager.h"
 #include "lib/log.h"
@@ -585,17 +586,17 @@ private:
 
        void content_scale_to_fit_width ()
        {
-               VideoContentList vc = _film_editor->content_panel()->selected_video ();
-               for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
-                       (*i)->scale_and_crop_to_fit_width ();
+               ContentList vc = _film_editor->content_panel()->selected_video ();
+               for (ContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
+                       (*i)->video->scale_and_crop_to_fit_width ();
                }
        }
 
        void content_scale_to_fit_height ()
        {
-               VideoContentList vc = _film_editor->content_panel()->selected_video ();
-               for (VideoContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
-                       (*i)->scale_and_crop_to_fit_height ();
+               ContentList vc = _film_editor->content_panel()->selected_video ();
+               for (ContentList::iterator i = vc.begin(); i != vc.end(); ++i) {
+                       (*i)->video->scale_and_crop_to_fit_height ();
                }
        }
 
index 2911be0a70414ffac412ca2595e0dde485387629..0e5bee70a7402cbd50dd27ecb4886dbc30cdbbe1 100644 (file)
@@ -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
@@ -27,6 +27,7 @@
 #include "lib/dcp_content_type.h"
 #include "lib/ratio.h"
 #include "lib/image_content.h"
+#include "lib/video_content.h"
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
 #include <getopt.h>
@@ -215,9 +216,8 @@ main (int argc, char* argv[])
 
                for (int i = optind; i < argc; ++i) {
                        shared_ptr<Content> c = content_factory (film, boost::filesystem::canonical (argv[i]));
-                       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c);
-                       if (vc) {
-                               vc->set_scale (VideoContentScale (content_ratio));
+                       if (c->video) {
+                               c->video->set_scale (VideoContentScale (content_ratio));
                        }
                        film->examine_and_add_content (c);
                }
@@ -231,7 +231,7 @@ main (int argc, char* argv[])
                for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                        shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (*i);
                        if (ic) {
-                               ic->set_video_length (still_length * 24);
+                               ic->video->set_video_length (still_length * 24);
                        }
                }
 
index 654378248b3f61433a505909b6788a14215a3e59..55dd671e9061bd6683d7f6a3667d7951ae4957ef 100644 (file)
@@ -149,15 +149,14 @@ ContentPanel::selected ()
        return sel;
 }
 
-VideoContentList
+ContentList
 ContentPanel::selected_video ()
 {
-       VideoContentList vc;
+       ContentList vc;
 
        BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
-               shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (i);
-               if (t) {
-                       vc.push_back (t);
+               if (i->video) {
+                       vc.push_back (i);
                }
        }
 
@@ -337,7 +336,7 @@ ContentPanel::add_folder_clicked ()
                        return;
                }
 
-               ic->set_video_frame_rate (frame_rate);
+               ic->video->set_video_frame_rate (frame_rate);
        }
 
        _film->examine_and_add_content (content);
@@ -388,7 +387,7 @@ ContentPanel::setup_sensitivity ()
        _add_folder->Enable (_generally_sensitive);
 
        ContentList selection = selected ();
-       VideoContentList video_selection = selected_video ();
+       ContentList video_selection = selected_video ();
        AudioContentList audio_selection = selected_audio ();
 
        _remove->Enable   (!selection.empty() && _generally_sensitive);
index 9e6cf9f24b24a714c85b94a1e705d4942f3a1438..e735213d3860c3b108928e93903ada20ebd9f913 100644 (file)
@@ -59,7 +59,7 @@ public:
        }
 
        ContentList selected ();
-       VideoContentList selected_video ();
+       ContentList selected_video ();
        AudioContentList selected_audio ();
        SubtitleContentList selected_subtitle ();
        FFmpegContentList selected_ffmpeg ();
index 7ffc24f7dd0263863f1b02b4173a6a174c955f30..42d2f153701fa056029c70a932fc9001801d0a37 100644 (file)
@@ -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
@@ -29,6 +29,7 @@
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/audio_processor.h"
+#include "lib/video_content.h"
 #include "lib/dcp_content.h"
 #include <dcp/key.h>
 #include <dcp/raw_convert.h>
index 786d70721c5549498ceffbec0314df7039282b0b..31981deea7b4129e590715ca0a6146e2031f0839 100644 (file)
@@ -145,7 +145,7 @@ Timeline::recreate_views ()
        _views.push_back (_labels_view);
 
        BOOST_FOREACH (shared_ptr<Content> i, film->content ()) {
-               if (dynamic_pointer_cast<VideoContent> (i)) {
+               if (i->video) {
                        _views.push_back (shared_ptr<TimelineView> (new TimelineVideoContentView (*this, i)));
                }
 
index cad34682373697fcb1d1eab4ffb13fe07f0671f7..241b0f70647e0c92c77a6e532ab78841c8f78c2b 100644 (file)
@@ -29,6 +29,7 @@
 #include "lib/dcp_subtitle_content.h"
 #include "lib/audio_content.h"
 #include "lib/text_subtitle_content.h"
+#include "lib/video_content.h"
 #include <boost/foreach.hpp>
 #include <set>
 #include <iostream>
@@ -259,16 +260,15 @@ TimingPanel::film_content_changed (int property)
 
        if (property == VideoContentProperty::VIDEO_FRAME_RATE || property == SubtitleContentProperty::SUBTITLE_VIDEO_FRAME_RATE) {
                set<double> check_vc;
-               shared_ptr<const VideoContent> vc;
+               shared_ptr<const Content> vc;
                int count_ac = 0;
-               shared_ptr<const AudioContent> ac;
+               shared_ptr<const Content> ac;
                int count_sc = 0;
                shared_ptr<const SubtitleContent> sc;
                BOOST_FOREACH (shared_ptr<const Content> i, _parent->selected ()) {
-                       shared_ptr<const VideoContent> vt = dynamic_pointer_cast<const VideoContent> (i);
-                       if (vt) {
-                               check_vc.insert (vt->video_frame_rate ());
-                               vc = vt;
+                       if (i->video) {
+                               check_vc.insert (i->video->video_frame_rate ());
+                               vc = i;
                        }
                        shared_ptr<const AudioContent> at = dynamic_pointer_cast<const AudioContent> (i);
                        if (at) {
@@ -287,9 +287,9 @@ TimingPanel::film_content_changed (int property)
 
                if ((check_vc.size() == 1 || count_ac == 1 || count_sc == 1) && !single_frame_image_content) {
                        if (vc) {
-                               checked_set (_video_frame_rate, raw_convert<string> (vc->video_frame_rate (), 5));
+                               checked_set (_video_frame_rate, raw_convert<string> (vc->video->video_frame_rate (), 5));
                        } else if (ac) {
-                               checked_set (_video_frame_rate, raw_convert<string> (ac->audio_video_frame_rate (), 5));
+                               checked_set (_video_frame_rate, raw_convert<string> (ac->audio->audio_video_frame_rate (), 5));
                        } else if (sc) {
                                checked_set (_video_frame_rate, raw_convert<string> (sc->subtitle_video_frame_rate (), 5));
                        }
@@ -329,7 +329,7 @@ TimingPanel::full_length_changed ()
                shared_ptr<ImageContent> ic = dynamic_pointer_cast<ImageContent> (i);
                if (ic && ic->still ()) {
                        int const vfr = _parent->film()->video_frame_rate ();
-                       ic->set_video_length (_full_length->get (vfr).frames_round (vfr));
+                       ic->video->set_video_length (_full_length->get (vfr).frames_round (vfr));
                }
        }
 }
index f2f164ad518b746f068c7cafea2212377bd19946..f6f234a0d2bce4a3eee372e8d513e437f4a93ac7 100644 (file)
@@ -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
@@ -31,6 +31,7 @@
 #include "lib/ratio.h"
 #include "lib/frame_rate_change.h"
 #include "lib/dcp_content.h"
+#include "lib/video_content.h"
 #include <wx/spinctrl.h>
 #include <boost/foreach.hpp>
 #include <set>
@@ -258,8 +259,8 @@ VideoPanel::film_changed (Film::Property property)
 void
 VideoPanel::film_content_changed (int property)
 {
-       VideoContentList vc = _parent->selected_video ();
-       shared_ptr<VideoContent> vcs;
+       ContentList vc = _parent->selected_video ();
+       shared_ptr<Content> vcs;
        shared_ptr<FFmpegContent> fcs;
        if (!vc.empty ()) {
                vcs = vc.front ();
@@ -275,8 +276,8 @@ VideoPanel::film_content_changed (int property)
        } else if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
                setup_description ();
        } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
-               if (vcs && vcs->colour_conversion ()) {
-                       optional<size_t> preset = vcs->colour_conversion().get().preset ();
+               if (vcs && vcs->video->colour_conversion ()) {
+                       optional<size_t> preset = vcs->video->colour_conversion().get().preset ();
                        vector<PresetColourConversion> cc = PresetColourConversion::all ();
                        if (preset) {
                                checked_set (_colour_conversion, preset.get() + 1);
@@ -303,23 +304,29 @@ VideoPanel::film_content_changed (int property)
                }
        } else if (property == VideoContentProperty::VIDEO_FADE_IN) {
                set<Frame> check;
-               BOOST_FOREACH (shared_ptr<const VideoContent> i, vc) {
-                       check.insert (i->fade_in ());
+               BOOST_FOREACH (shared_ptr<const Content> i, vc) {
+                       check.insert (i->video->fade_in ());
                }
 
                if (check.size() == 1) {
-                       _fade_in->set (ContentTime::from_frames (vc.front()->fade_in (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ());
+                       _fade_in->set (
+                               ContentTime::from_frames (vc.front()->video->fade_in (), vc.front()->video->video_frame_rate ()),
+                               vc.front()->video->video_frame_rate ()
+                               );
                } else {
                        _fade_in->clear ();
                }
        } else if (property == VideoContentProperty::VIDEO_FADE_OUT) {
                set<Frame> check;
-               BOOST_FOREACH (shared_ptr<const VideoContent> i, vc) {
-                       check.insert (i->fade_out ());
+               BOOST_FOREACH (shared_ptr<const Content> i, vc) {
+                       check.insert (i->video->fade_out ());
                }
 
                if (check.size() == 1) {
-                       _fade_out->set (ContentTime::from_frames (vc.front()->fade_out (), vc.front()->video_frame_rate ()), vc.front()->video_frame_rate ());
+                       _fade_out->set (
+                               ContentTime::from_frames (vc.front()->video->fade_out (), vc.front()->video->video_frame_rate ()),
+                               vc.front()->video->video_frame_rate ()
+                               );
                } else {
                        _fade_out->clear ();
                }
@@ -353,7 +360,7 @@ VideoPanel::edit_filters_clicked ()
 void
 VideoPanel::setup_description ()
 {
-       VideoContentList vc = _parent->selected_video ();
+       ContentList vc = _parent->selected_video ();
        if (vc.empty ()) {
                checked_set (_description, wxT (""));
                return;
@@ -362,7 +369,7 @@ VideoPanel::setup_description ()
                return;
        }
 
-       string d = vc.front()->processing_description ();
+       string d = vc.front()->video->processing_description ();
        size_t lines = count (d.begin(), d.end(), '\n');
 
        for (int i = lines; i < 6; ++i) {
@@ -376,7 +383,7 @@ VideoPanel::setup_description ()
 void
 VideoPanel::colour_conversion_changed ()
 {
-       VideoContentList vc = _parent->selected_video ();
+       ContentList vc = _parent->selected_video ();
        if (vc.size() != 1) {
                return;
        }
@@ -385,33 +392,33 @@ VideoPanel::colour_conversion_changed ()
        vector<PresetColourConversion> all = PresetColourConversion::all ();
 
        if (s == 0) {
-               vc.front()->unset_colour_conversion ();
+               vc.front()->video->unset_colour_conversion ();
        } else if (s == int (all.size() + 1)) {
                edit_colour_conversion_clicked ();
        } else {
-               vc.front()->set_colour_conversion (all[s - 1].conversion);
+               vc.front()->video->set_colour_conversion (all[s - 1].conversion);
        }
 }
 
 void
 VideoPanel::edit_colour_conversion_clicked ()
 {
-       VideoContentList vc = _parent->selected_video ();
+       ContentList vc = _parent->selected_video ();
        if (vc.size() != 1) {
                return;
        }
 
        ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->yuv ());
-       d->set (vc.front()->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
+       d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
        d->ShowModal ();
-       vc.front()->set_colour_conversion (d->get ());
+       vc.front()->video->set_colour_conversion (d->get ());
        d->Destroy ();
 }
 
 void
 VideoPanel::content_selection_changed ()
 {
-       VideoContentList video_sel = _parent->selected_video ();
+       ContentList video_sel = _parent->selected_video ();
 
        _frame_type->set_content (video_sel);
        _left_crop->set_content (video_sel);
@@ -459,7 +466,7 @@ VideoPanel::setup_sensitivity ()
                _filters_button->Enable (false);
                _colour_conversion->Enable (false);
        } else {
-               VideoContentList video_sel = _parent->selected_video ();
+               ContentList video_sel = _parent->selected_video ();
                FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
                bool const single = video_sel.size() == 1;
 
@@ -477,13 +484,13 @@ VideoPanel::setup_sensitivity ()
                _colour_conversion->Enable (single && !video_sel.empty ());
        }
 
-       VideoContentList vc = _parent->selected_video ();
-       shared_ptr<VideoContent> vcs;
+       ContentList vc = _parent->selected_video ();
+       shared_ptr<Content> vcs;
        if (!vc.empty ()) {
                vcs = vc.front ();
        }
 
-       if (vcs && vcs->colour_conversion ()) {
+       if (vcs && vcs->video->colour_conversion ()) {
                _edit_colour_conversion_button->Enable (!vcs->colour_conversion().get().preset());
        } else {
                _edit_colour_conversion_button->Enable (false);
index de4e5218b94dc3695261f57a6476361bf6b92190..9ad2dfb58fa4f4da6ebfe9524086835868ad10dd 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/film.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
 #include "lib/ratio.h"
 #include "test.h"
 
@@ -37,7 +38,7 @@ BOOST_AUTO_TEST_CASE (fourk_test)
        shared_ptr<Film> film = new_test_film ("4k_test");
        film->set_name ("4k_test");
        shared_ptr<FFmpegContent> c (new FFmpegContent (film, "test/data/test.mp4"));
-       c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+       c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
        film->set_resolution (RESOLUTION_4K);
        film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
        film->set_container (Ratio::from_id ("185"));
index 6da0b037a1164a35923c0c14ee849e0cd6f7232c..173c256e25f7e9b10d678202f9db53a7677cdcca 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 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
@@ -22,6 +22,7 @@
 #include "lib/dcp_content_type.h"
 #include "lib/film.h"
 #include "lib/ratio.h"
+#include "lib/video_content.h"
 #include "test.h"
 
 /** @file test/black_fill_test.cc
@@ -44,11 +45,11 @@ BOOST_AUTO_TEST_CASE (black_fill_test)
        film->examine_and_add_content (contentB);
        wait_for_jobs ();
 
-       contentA->set_scale (VideoContentScale (Ratio::from_id ("185")));
-       contentA->set_video_length (3);
+       contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
+       contentA->video->set_video_length (3);
        contentA->set_position (DCPTime::from_frames (2, film->video_frame_rate ()));
-       contentB->set_scale (VideoContentScale (Ratio::from_id ("185")));
-       contentB->set_video_length (1);
+       contentB->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
+       contentB->video->set_video_length (1);
        contentB->set_position (DCPTime::from_frames (7, film->video_frame_rate ()));
 
        film->make_dcp ();
index 0e5f2d6ad2b894c4cea765f98d56a3bb15779282..7e13b1c1a461d1698f70f74022eb465a69672583 100644 (file)
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
-       shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, false));
+       shared_ptr<DCPDecoder> decoder (new DCPDecoder (content, film->log(), false));
 
        list<ContentTimePeriod> ctp = decoder->text_subtitles_during (
                ContentTimePeriod (
index a93d77fc188d39ae84feafcbfd96ab5939769196..4d6200d78d5bab9ed1c6fb63f18fce0f219920a2 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/sndfile_content.h"
 #include "lib/film.h"
 #include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
 #include "lib/ratio.h"
 #include "lib/ffmpeg_content.h"
 #include "test.h"
@@ -47,7 +48,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_audio_test)
 
        wait_for_jobs ();
 
-       c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+       c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
 
        film->set_container (Ratio::from_id ("185"));
        film->set_audio_channels (6);
index ce8ecad6bfcfa7a2fffe708f82aca99ba6e84c93..c32220f99c882340e1f2401e9a04ba1805800a9d 100644 (file)
@@ -30,6 +30,7 @@
 #include "lib/ffmpeg_content.h"
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
+#include "lib/video_content.h"
 #include "test.h"
 
 using boost::shared_ptr;
@@ -43,7 +44,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test)
 
        wait_for_jobs ();
 
-       c->set_scale (VideoContentScale (Ratio::from_id ("185")));
+       c->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
 
        film->set_container (Ratio::from_id ("185"));
        film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
index 65ed6436df9273d03d46fae506d0fa1b47353e51..0148487eda5ad3d2d080dff1f390012e0031e776 100644 (file)
@@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
        shared_ptr<Film> film = new_test_film ("ffmpeg_pts_offset_test");
        shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/test.mp4"));
        content->_audio_streams.push_back (shared_ptr<FFmpegAudioStream> (new FFmpegAudioStream));
-       content->_video_frame_rate = 24;
+       content->video->_video_frame_rate = 24;
 
        {
                /* Sound == video so no offset required */
index a318ada11e66c6e844bf3b8ae6bdef1e53755249..78d092b94179b14fd07dda0bdb7c6bfe621ee9e0 100644 (file)
@@ -29,6 +29,7 @@
 #include "lib/playlist.h"
 #include "lib/ffmpeg_audio_stream.h"
 #include "lib/frame_rate_change.h"
+#include "lib/video_content.h"
 #include "test.h"
 
 using boost::shared_ptr;
@@ -52,7 +53,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        afr.push_back (30);
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
-       content->_video_frame_rate = 60;
+       content->video->_video_frame_rate = 60;
        int best = film->best_video_frame_rate ();
        FrameRateChange frc = FrameRateChange (60, best);
        BOOST_CHECK_EQUAL (best, 30);
@@ -61,7 +62,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 50;
+       content->video->_video_frame_rate = 50;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (50, best);
        BOOST_CHECK_EQUAL (best, 25);
@@ -70,7 +71,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 48;
+       content->video->_video_frame_rate = 48;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (48, best);
        BOOST_CHECK_EQUAL (best, 24);
@@ -79,7 +80,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 30;
+       content->video->_video_frame_rate = 30;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (30, best);
        BOOST_CHECK_EQUAL (best, 30);
@@ -88,7 +89,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 29.97;
+       content->video->_video_frame_rate = 29.97;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (29.97, best);
        BOOST_CHECK_EQUAL (best, 30);
@@ -97,7 +98,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, true);
        BOOST_CHECK_CLOSE (frc.speed_up, 30 / 29.97, 0.1);
 
-       content->_video_frame_rate = 25;
+       content->video->_video_frame_rate = 25;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (25, best);
        BOOST_CHECK_EQUAL (best, 25);
@@ -106,7 +107,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 24;
+       content->video->_video_frame_rate = 24;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (24, best);
        BOOST_CHECK_EQUAL (best, 24);
@@ -115,7 +116,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 14.5;
+       content->video->_video_frame_rate = 14.5;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (14.5, best);
        BOOST_CHECK_EQUAL (best, 30);
@@ -124,7 +125,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, true);
        BOOST_CHECK_CLOSE (frc.speed_up, 15 / 14.5, 0.1);
 
-       content->_video_frame_rate = 12.6;
+       content->video->_video_frame_rate = 12.6;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (12.6, best);
        BOOST_CHECK_EQUAL (best, 25);
@@ -133,7 +134,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, true);
        BOOST_CHECK_CLOSE (frc.speed_up, 25 / 25.2, 0.1);
 
-       content->_video_frame_rate = 12.4;
+       content->video->_video_frame_rate = 12.4;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (12.4, best);
        BOOST_CHECK_EQUAL (best, 25);
@@ -142,7 +143,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, true);
        BOOST_CHECK_CLOSE (frc.speed_up, 25 / 24.8, 0.1);
 
-       content->_video_frame_rate = 12;
+       content->video->_video_frame_rate = 12;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (12, best);
        BOOST_CHECK_EQUAL (best, 24);
@@ -160,7 +161,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        afr.push_back (60);
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
-       content->_video_frame_rate = 60;
+       content->video->_video_frame_rate = 60;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (60, best);
        BOOST_CHECK_EQUAL (best, 60);
@@ -169,7 +170,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 50;
+       content->video->_video_frame_rate = 50;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (50, best);
        BOOST_CHECK_EQUAL (best, 50);
@@ -178,7 +179,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_EQUAL (frc.change_speed, false);
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
-       content->_video_frame_rate = 48;
+       content->video->_video_frame_rate = 48;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (48, best);
        BOOST_CHECK_EQUAL (best, 48);
@@ -201,7 +202,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        afr.push_back (24);
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
-       content->_video_frame_rate = 25;
+       content->video->_video_frame_rate = 25;
        best = film->best_video_frame_rate ();
        frc = FrameRateChange (25, best);
        BOOST_CHECK_EQUAL (best, 24);
@@ -232,16 +233,16 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double)
        afr.push_back (30);
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
-       A->_video_frame_rate = 30;
-       B->_video_frame_rate = 24;
+       A->video->_video_frame_rate = 30;
+       B->video->_video_frame_rate = 24;
        BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 25);
 
-       A->_video_frame_rate = 24;
-       B->_video_frame_rate = 24;
+       A->video->_video_frame_rate = 24;
+       B->video->_video_frame_rate = 24;
        BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 24);
 
-       A->_video_frame_rate = 24;
-       B->_video_frame_rate = 48;
+       A->video->_video_frame_rate = 24;
+       B->video->_video_frame_rate = 48;
        BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 24);
 }
 
@@ -261,7 +262,7 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
 
        shared_ptr<FFmpegAudioStream> stream (new FFmpegAudioStream ("foo", 0, 0, 0));
        content->_audio_streams.push_back (stream);
-       content->_video_frame_rate = 24;
+       content->video->_video_frame_rate = 24;
        film->set_video_frame_rate (24);
        stream->_frame_rate = 48000;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 48000);
@@ -272,30 +273,30 @@ BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
        stream->_frame_rate = 80000;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 96000);
 
-       content->_video_frame_rate = 23.976;
+       content->video->_video_frame_rate = 23.976;
        film->set_video_frame_rate (24);
        stream->_frame_rate = 48000;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
 
-       content->_video_frame_rate = 29.97;
+       content->video->_video_frame_rate = 29.97;
        film->set_video_frame_rate (30);
        BOOST_CHECK_EQUAL (film->video_frame_rate (), 30);
        stream->_frame_rate = 48000;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 47952);
 
-       content->_video_frame_rate = 25;
+       content->video->_video_frame_rate = 25;
        film->set_video_frame_rate (24);
        stream->_frame_rate = 48000;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
 
-       content->_video_frame_rate = 25;
+       content->video->_video_frame_rate = 25;
        film->set_video_frame_rate (24);
        stream->_frame_rate = 44100;
        BOOST_CHECK_EQUAL (content->resampled_audio_frame_rate(), 50000);
 
        /* Check some out-there conversions (not the best) */
 
-       content->_video_frame_rate = 14.99;
+       content->video->_video_frame_rate = 14.99;
        film->set_video_frame_rate (25);
        stream->_frame_rate = 16000;
        /* The FrameRateChange within resampled_audio_frame_rate should choose to double-up
index a7c077643adb4db9058d4d509aa65208bbd00cb9..fb5e26a2d4d93a5cc57684c9825c9f3fb095afcb 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-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
@@ -23,6 +23,7 @@
 #include "lib/dcp_content_type.h"
 #include "lib/image_content.h"
 #include "lib/sndfile_content.h"
+#include "lib/video_content.h"
 #include "test.h"
 #include <iostream>
 
@@ -75,7 +76,7 @@ BOOST_AUTO_TEST_CASE (isdcf_name_test)
        shared_ptr<ImageContent> content (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
        film->examine_and_add_content (content);
        wait_for_jobs ();
-       content->set_scale (VideoContentScale (Ratio::from_id ("133")));
+       content->video->set_scale (VideoContentScale (Ratio::from_id ("133")));
        film->set_container (Ratio::from_id ("185"));
        BOOST_CHECK_EQUAL (film->isdcf_name(false), "MyNiceFilmWith_TLR-2_F_DE-fr_US-R_4K_DI_20140704_PP_SMPTE_OV");