X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fffmpeg_content.cc;h=9e9473935d82810f88ca4a8bf445230504780629;hb=59e769023c392c332331567a1aea94660002c463;hp=9b2bfc60649c6b9e58b11905ed3216063e6148df;hpb=a8af9a0b57b853b8a8cd8fa35adb3fc967d59ee7;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 9b2bfc606..9e9473935 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -34,13 +34,13 @@ extern "C" { #include "log.h" #include "exceptions.h" #include "frame_rate_change.h" +#include "safe_stringstream.h" #include "i18n.h" #define LOG_GENERAL(...) film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL); using std::string; -using std::stringstream; using std::vector; using std::list; using std::cout; @@ -106,11 +106,11 @@ FFmpegContent::FFmpegContent (shared_ptr f, vector ref = dynamic_pointer_cast (c[0]); - assert (ref); + DCPOMATIC_ASSERT (ref); for (size_t i = 0; i < c.size(); ++i) { shared_ptr fc = dynamic_pointer_cast (c[i]); - if (fc->subtitle_use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { + if (fc->use_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) { throw JoinError (_("Content to be joined must use the same subtitle stream.")); } @@ -169,11 +169,11 @@ FFmpegContent::examine (shared_ptr job) Content::examine (job); - shared_ptr examiner (new FFmpegExaminer (shared_from_this ())); + shared_ptr examiner (new FFmpegExaminer (shared_from_this (), job)); take_from_video_examiner (examiner); shared_ptr film = _film.lock (); - assert (film); + DCPOMATIC_ASSERT (film); { boost::mutex::scoped_lock lm (_mutex); @@ -228,21 +228,6 @@ FFmpegContent::technical_summary () const ); } -string -FFmpegContent::information () const -{ - if (video_length() == ContentTime (0) || video_frame_rate() == 0) { - return ""; - } - - stringstream s; - - s << String::compose (_("%1 frames; %2 frames per second"), video_length_after_3d_combine().frames (video_frame_rate()), video_frame_rate()) << "\n"; - s << VideoContent::information (); - - return s.str (); -} - void FFmpegContent::set_subtitle_stream (shared_ptr s) { @@ -284,7 +269,7 @@ FFmpegContent::audio_channels () const return 0; } - return _audio_stream->channels; + return _audio_stream->channels (); } int @@ -296,7 +281,7 @@ FFmpegContent::audio_frame_rate () const return 0; } - return _audio_stream->frame_rate; + return _audio_stream->frame_rate (); } bool @@ -315,7 +300,7 @@ DCPTime FFmpegContent::full_length () const { shared_ptr film = _film.lock (); - assert (film); + DCPOMATIC_ASSERT (film); return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate (), film->video_frame_rate ())); } @@ -328,7 +313,7 @@ FFmpegContent::audio_mapping () const return AudioMapping (); } - return _audio_stream->mapping; + return _audio_stream->mapping (); } void @@ -345,14 +330,14 @@ FFmpegContent::set_filters (vector const & filters) void FFmpegContent::set_audio_mapping (AudioMapping m) { - audio_stream()->mapping = m; + audio_stream()->set_mapping (m); AudioContent::set_audio_mapping (m); } string FFmpegContent::identifier () const { - stringstream s; + SafeStringStream s; s << VideoContent::identifier(); @@ -382,7 +367,7 @@ FFmpegContent::audio_analysis_path () const */ boost::filesystem::path p = film->audio_analysis_dir (); - string name = digest (); + string name = digest(); if (audio_stream ()) { name += "_" + audio_stream()->identifier (); }