X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_content.cc;h=a186db48eaecff51d6f0f1b6fa59f508378ab5ed;hb=c008066160d85b9ec9e5485375d7baaa5d27bda2;hp=d2bb329db346bc3ca34988f95a8425a3727dcded;hpb=8d58a7c5f4320ad5c111e336c45e44d6b51ab509;p=dcpomatic.git diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index d2bb329db..a186db48e 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; @@ -110,7 +110,7 @@ FFmpegContent::FFmpegContent (shared_ptr f, vector 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.")); } @@ -163,11 +163,11 @@ FFmpegContent::as_xml (xmlpp::Node* node) const } void -FFmpegContent::examine (shared_ptr job) +FFmpegContent::examine (shared_ptr job, bool calculate_digest) { job->set_progress_unknown (); - Content::examine (job); + Content::examine (job, calculate_digest); shared_ptr examiner (new FFmpegExaminer (shared_from_this ())); take_from_video_examiner (examiner); @@ -235,7 +235,7 @@ FFmpegContent::information () const return ""; } - stringstream s; + SafeStringStream 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 (); @@ -284,7 +284,7 @@ FFmpegContent::audio_channels () const return 0; } - return _audio_stream->channels; + return _audio_stream->channels (); } int @@ -296,7 +296,7 @@ FFmpegContent::audio_frame_rate () const return 0; } - return _audio_stream->frame_rate; + return _audio_stream->frame_rate (); } bool @@ -328,7 +328,7 @@ FFmpegContent::audio_mapping () const return AudioMapping (); } - return _audio_stream->mapping; + return _audio_stream->mapping (); } void @@ -345,14 +345,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(); @@ -409,3 +409,9 @@ FFmpegContent::subtitles_during (ContentTimePeriod period, bool starting) const return d; } + +bool +FFmpegContent::has_subtitles () const +{ + return !subtitle_streams().empty (); +}