Remove some dcp prefixes; better logging of content on DCP creation.
[dcpomatic.git] / src / lib / ffmpeg_content.cc
index 487325d71b152245af66534e19537812bae950bd..00499cf135a737be9672cfec85b503485bc9bf49 100644 (file)
@@ -34,6 +34,7 @@ using std::stringstream;
 using std::vector;
 using std::list;
 using std::cout;
+using std::pair;
 using boost::shared_ptr;
 using boost::lexical_cast;
 
@@ -82,19 +83,6 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> f, shared_ptr<const cxml::N
        _first_video = node->optional_number_child<double> ("FirstVideo");
 }
 
-FFmpegContent::FFmpegContent (FFmpegContent const & o)
-       : Content (o)
-       , VideoContent (o)
-       , AudioContent (o)
-       , SubtitleContent (o)
-       , _subtitle_streams (o._subtitle_streams)
-       , _subtitle_stream (o._subtitle_stream)
-       , _audio_streams (o._audio_streams)
-       , _audio_stream (o._audio_stream)
-{
-
-}
-
 void
 FFmpegContent::as_xml (xmlpp::Node* node) const
 {
@@ -178,7 +166,29 @@ FFmpegContent::examine (shared_ptr<Job> job)
 string
 FFmpegContent::summary () const
 {
-       return String::compose (_("Movie: %1"), file().filename().string());
+       return String::compose (_("%1 [movie]"), file().filename().string());
+}
+
+string
+FFmpegContent::technical_summary () const
+{
+       string as = "none";
+       if (_audio_stream) {
+               as = String::compose ("id %1", _audio_stream->id);
+       }
+
+       string ss = "none";
+       if (_subtitle_stream) {
+               ss = String::compose ("id %1", _subtitle_stream->id);
+       }
+
+       pair<string, string> filt = Filter::ffmpeg_strings (_filters);
+       
+       return Content::technical_summary() + " - "
+               + VideoContent::technical_summary() + " - "
+               + String::compose (
+                       "ffmpeg: audio %1, subtitle %2, filters %3 %4", as, ss, filt.first, filt.second
+                       );
 }
 
 string
@@ -266,7 +276,7 @@ FFmpegContent::output_audio_frame_rate () const
        /* Resample to a DCI-approved sample rate */
        double t = dcp_audio_frame_rate (content_audio_frame_rate ());
 
-       FrameRateConversion frc (video_frame_rate(), film->dcp_video_frame_rate());
+       FrameRateConversion frc (video_frame_rate(), film->video_frame_rate());
 
        /* Compensate if the DCP is being run at a different frame rate
           to the source; that is, if the video is run such that it will
@@ -275,7 +285,7 @@ FFmpegContent::output_audio_frame_rate () const
        */
 
        if (frc.change_speed) {
-               t *= video_frame_rate() * frc.factor() / film->dcp_video_frame_rate();
+               t *= video_frame_rate() * frc.factor() / film->video_frame_rate();
        }
 
        return rint (t);
@@ -294,12 +304,12 @@ operator== (FFmpegAudioStream const & a, FFmpegAudioStream const & b)
 }
 
 FFmpegAudioStream::FFmpegAudioStream (shared_ptr<const cxml::Node> node)
+       : mapping (node->node_child ("Mapping"))
 {
        name = node->string_child ("Name");
        id = node->number_child<int> ("Id");
        frame_rate = node->number_child<int> ("FrameRate");
        channels = node->number_child<int64_t> ("Channels");
-       mapping = AudioMapping (node->node_child ("Mapping"));
        first_audio = node->optional_number_child<double> ("FirstAudio");
 }
 
@@ -333,20 +343,14 @@ FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const
        root->add_child("Id")->add_child_text (lexical_cast<string> (id));
 }
 
-shared_ptr<Content>
-FFmpegContent::clone () const
-{
-       return shared_ptr<Content> (new FFmpegContent (*this));
-}
-
 Time
 FFmpegContent::length () const
 {
        shared_ptr<const Film> film = _film.lock ();
        assert (film);
        
-       FrameRateConversion frc (video_frame_rate (), film->dcp_video_frame_rate ());
-       return video_length() * frc.factor() * TIME_HZ / film->dcp_video_frame_rate ();
+       FrameRateConversion frc (video_frame_rate (), film->video_frame_rate ());
+       return video_length() * frc.factor() * TIME_HZ / film->video_frame_rate ();
 }
 
 AudioMapping
@@ -398,3 +402,4 @@ FFmpegContent::identifier () const
 
        return s.str ();
 }
+