Basic detach of FFmpegContent, ImageContent, DCPContent
authorCarl Hetherington <cth@carlh.net>
Tue, 12 Apr 2016 15:33:51 +0000 (16:33 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 18 May 2016 10:50:29 +0000 (11:50 +0100)
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/image_content.cc
src/lib/image_content.h

index 8698c4ecd8325ef712b59ad600333290d3e5d67f..5bd6e1e33a7c2627345848ebc268281f3a0949a7 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
@@ -18,6 +18,7 @@
 */
 
 #include "dcp_content.h"
+#include "video_content.h"
 #include "dcp_examiner.h"
 #include "job.h"
 #include "film.h"
@@ -52,9 +53,9 @@ int const DCPContentProperty::REFERENCE_SUBTITLE = 603;
 
 DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
-       , VideoContent (film)
        , SingleStreamAudioContent (film)
        , SubtitleContent (film)
+       , video (new VideoContent (film))
        , _has_subtitles (false)
        , _encrypted (false)
        , _kdm_valid (false)
@@ -63,13 +64,14 @@ DCPContent::DCPContent (shared_ptr<const Film> film, boost::filesystem::path p)
        , _reference_subtitle (false)
 {
        read_directory (p);
+       set_default_colour_conversion ();
 }
 
 DCPContent::DCPContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
        : Content (film, node)
-       , VideoContent (film, node, version)
        , SingleStreamAudioContent (film, node, version)
        , SubtitleContent (film, node, version)
+       , video (new VideoContent (film, node, version))
 {
        _name = node->string_child ("Name");
        _has_subtitles = node->bool_child ("HasSubtitles");
@@ -105,6 +107,7 @@ DCPContent::examine (shared_ptr<Job> job)
 
        shared_ptr<DCPExaminer> examiner (new DCPExaminer (shared_from_this ()));
        take_from_video_examiner (examiner);
+       set_default_colour_conversion ();
        take_from_audio_examiner (examiner);
 
        {
@@ -131,7 +134,7 @@ string
 DCPContent::technical_summary () const
 {
        return Content::technical_summary() + " - "
-               + VideoContent::technical_summary() + " - "
+               + video->technical_summary() + " - "
                + AudioContent::technical_summary() + " - ";
 }
 
@@ -141,7 +144,7 @@ DCPContent::as_xml (xmlpp::Node* node) const
        node->add_child("Type")->add_child_text ("DCP");
 
        Content::as_xml (node);
-       VideoContent::as_xml (node);
+       video->as_xml (node);
        SingleStreamAudioContent::as_xml (node);
        SubtitleContent::as_xml (node);
 
@@ -169,7 +172,7 @@ string
 DCPContent::identifier () const
 {
        SafeStringStream s;
-       s << VideoContent::identifier() << "_" << SubtitleContent::identifier () << " "
+       s << Content::identifier() << "_" << video->identifier() << "_" << SubtitleContent::identifier () << " "
          << (_reference_video ? "1" : "0")
          << (_reference_subtitle ? "1" : "0");
        return s.str ();
index 26c1802bacb748557aa18ad60b827ce4686e541e..f4445ad53045cb5d733017b7e5ae3519cf6f2ad2 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
@@ -24,7 +24,6 @@
  *  @brief DCPContent class.
  */
 
-#include "video_content.h"
 #include "single_stream_audio_content.h"
 #include "subtitle_content.h"
 #include <libcxml/cxml.h>
@@ -42,7 +41,7 @@ public:
 /** @class DCPContent
  *  @brief An existing DCP used as input.
  */
-class DCPContent : public VideoContent, public SingleStreamAudioContent, public SubtitleContent
+class DCPContent : public SingleStreamAudioContent, public SubtitleContent
 {
 public:
        DCPContent (boost::shared_ptr<const Film>, boost::filesystem::path p);
index 8452d65ee5c043428dc9a6df6ed5c63398dc17c3..8d9aa195aadf4d561f57fd9512e2ec2ab4e0b9eb 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "ffmpeg_content.h"
+#include "video_content.h"
 #include "ffmpeg_examiner.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "ffmpeg_audio_stream.h"
@@ -60,18 +61,18 @@ int const FFmpegContentProperty::FILTERS = 102;
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film, p)
-       , VideoContent (film, p)
        , AudioContent (film, p)
        , SubtitleContent (film, p)
+       , video (new VideoContent (film))
 {
-
+       set_default_colour_conversion ();
 }
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version, list<string>& notes)
        : Content (film, node)
-       , VideoContent (film, node, version)
        , AudioContent (film, node)
        , SubtitleContent (film, node, version)
+       , video (new VideoContent (film, node, version))
 {
        list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
        for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
@@ -117,9 +118,9 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, cxml::ConstNodePtr no
 
 FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<boost::shared_ptr<Content> > c)
        : Content (film, c)
-       , VideoContent (film, c)
        , AudioContent (film, c)
        , SubtitleContent (film, c)
+       , video (new VideoContent (film, c))
 {
        shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
        DCPOMATIC_ASSERT (ref);
@@ -150,7 +151,7 @@ FFmpegContent::as_xml (xmlpp::Node* node) const
 {
        node->add_child("Type")->add_child_text ("FFmpeg");
        Content::as_xml (node);
-       VideoContent::as_xml (node);
+       video->as_xml (node);
        AudioContent::as_xml (node);
        SubtitleContent::as_xml (node);
 
@@ -194,6 +195,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
 
        shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (shared_from_this (), job));
        take_from_video_examiner (examiner);
+       set_default_colour_conversion ();
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -252,7 +254,7 @@ FFmpegContent::technical_summary () const
        string filt = Filter::ffmpeg_string (_filters);
 
        return Content::technical_summary() + " - "
-               + VideoContent::technical_summary() + " - "
+               + video->technical_summary() + " - "
                + AudioContent::technical_summary() + " - "
                + String::compose (
                        "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt
@@ -305,7 +307,8 @@ FFmpegContent::identifier () const
 {
        SafeStringStream s;
 
-       s << VideoContent::identifier() << "_"
+       s << Content::identifier() << "_"
+         << video->identifier() << "_"
          << SubtitleContent::identifier();
 
        boost::mutex::scoped_lock lm (_mutex);
@@ -394,7 +397,8 @@ FFmpegContent::audio_streams () const
 void
 FFmpegContent::add_properties (list<UserProperty>& p) const
 {
-       VideoContent::add_properties (p);
+       Content::add_properties (p);
+       video->add_properties (p);
        AudioContent::add_properties (p);
 
        if (_bits_per_pixel) {
index e9cb3dacf911577105be1d91ad7e5e5dcf87cc1d..9f82be9c3751e18a404591a8ee900e318d1e63d2 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef DCPOMATIC_FFMPEG_CONTENT_H
 #define DCPOMATIC_FFMPEG_CONTENT_H
 
-#include "video_content.h"
 #include "audio_content.h"
 #include "subtitle_content.h"
 
@@ -30,6 +29,7 @@ struct AVStream;
 class Filter;
 class FFmpegSubtitleStream;
 class FFmpegAudioStream;
+class VideoContent;
 struct ffmpeg_pts_offset_test;
 struct audio_sampling_rate_test;
 
@@ -42,7 +42,7 @@ public:
        static int const FILTERS;
 };
 
-class FFmpegContent : public VideoContent, public AudioContent, public SubtitleContent
+class FFmpegContent : public AudioContent, public SubtitleContent
 {
 public:
        FFmpegContent (boost::shared_ptr<const Film>, boost::filesystem::path);
@@ -108,6 +108,8 @@ public:
 
        void signal_subtitle_stream_changed ();
 
+       boost::shared_ptr<VideoContent> video;
+
 protected:
        void add_properties (std::list<UserProperty> &) const;
 
index c415f933dd637c696a57ce07ef23863e233d65c0..ed290dd6c9e5f5f3cfc1187cd8eb7a0aad7af32f 100644 (file)
@@ -18,6 +18,7 @@
 */
 
 #include "image_content.h"
+#include "video_content.h"
 #include "image_examiner.h"
 #include "compose.hpp"
 #include "film.h"
@@ -39,7 +40,7 @@ using boost::shared_ptr;
 
 ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
        : Content (film)
-       , VideoContent (film)
+       , video (new VideoContent (film))
 {
        if (boost::filesystem::is_regular_file (p) && valid_image_file (p)) {
                _paths.push_back (p);
@@ -56,12 +57,14 @@ ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path
 
                sort (_paths.begin(), _paths.end(), ImageFilenameSorter ());
        }
+
+       set_default_colour_conversion ();
 }
 
 
 ImageContent::ImageContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
        : Content (film, node)
-       , VideoContent (film, node, version)
+       , video (new VideoContent (film, node, version))
 {
 
 }
@@ -84,7 +87,7 @@ string
 ImageContent::technical_summary () const
 {
        string s = Content::technical_summary() + " - "
-               + VideoContent::technical_summary() + " - ";
+               + video->technical_summary() + " - ";
 
        if (still ()) {
                s += _("still");
@@ -100,7 +103,7 @@ ImageContent::as_xml (xmlpp::Node* node) const
 {
        node->add_child("Type")->add_child_text ("Image");
        Content::as_xml (node);
-       VideoContent::as_xml (node);
+       video->as_xml (node);
 }
 
 void
@@ -113,6 +116,7 @@ ImageContent::examine (shared_ptr<Job> job)
 
        shared_ptr<ImageExaminer> examiner (new ImageExaminer (film, shared_from_this(), job));
        take_from_video_examiner (examiner);
+       set_default_colour_conversion ();
 }
 
 void
@@ -139,7 +143,8 @@ string
 ImageContent::identifier () const
 {
        SafeStringStream s;
-       s << VideoContent::identifier ();
+       s << Content::identifier();
+       s << "_" << video->identifier ();
        s << "_" << video_length();
        return s.str ();
 }
index a4968ea8b753937f11260c29c2a0c3edccf3065f..353ce8370eb451050ab554210056d32c8b715e65 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
@@ -20,9 +20,9 @@
 #ifndef DCPOMATIC_IMAGE_CONTENT_H
 #define DCPOMATIC_IMAGE_CONTENT_H
 
-#include "video_content.h"
+#include "content.h"
 
-class ImageContent : public VideoContent
+class ImageContent : public Content
 {
 public:
        ImageContent (boost::shared_ptr<const Film>, boost::filesystem::path);
@@ -40,11 +40,12 @@ public:
 
        std::string identifier () const;
 
-       /* VideoContent */
        void set_default_colour_conversion ();
 
        void set_video_length (Frame);
        bool still () const;
+
+       boost::shared_ptr<VideoContent> video;
 };
 
 #endif