X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_content.cc;h=def123fb11489870cb5090a698350a0c2bf3c241;hb=387304bc9147933b68eda2b38ba8cac0d250e87e;hp=d02728b00018f5ed6d8bc023698b6fe4a94c7536;hpb=5e4f001bf32e3cdf65efa34803d70e6c1c00c66b;p=dcpomatic.git diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index d02728b00..def123fb1 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -17,8 +17,6 @@ */ -#include -#include #include "audio_content.h" #include "analyse_audio_job.h" #include "job_manager.h" @@ -27,15 +25,19 @@ #include "config.h" #include "frame_rate_change.h" #include "audio_processor.h" +#include "raw_convert.h" +#include #include "i18n.h" using std::string; using std::cout; using std::vector; +using std::stringstream; +using std::fixed; +using std::setprecision; using boost::shared_ptr; using boost::dynamic_pointer_cast; -using dcp::raw_convert; int const AudioContentProperty::AUDIO_CHANNELS = 200; int const AudioContentProperty::AUDIO_LENGTH = 201; @@ -87,7 +89,7 @@ AudioContent::AudioContent (shared_ptr f, vector : Content (f, c) { shared_ptr ref = dynamic_pointer_cast (c[0]); - assert (ref); + DCPOMATIC_ASSERT (ref); for (size_t i = 0; i < c.size(); ++i) { shared_ptr ac = dynamic_pointer_cast (c[i]); @@ -160,7 +162,7 @@ boost::signals2::connection AudioContent::analyse_audio (boost::function finished) { shared_ptr film = _film.lock (); - assert (film); + DCPOMATIC_ASSERT (film); shared_ptr job (new AnalyseAudioJob (film, dynamic_pointer_cast (shared_from_this()))); boost::signals2::connection c = job->Finished.connect (finished); @@ -186,9 +188,9 @@ string AudioContent::technical_summary () const { return String::compose ( - "audio: channels %1, length %2, content rate %3, resampled rate %4", + "audio: channels %1, length %2 frames, content rate %3, resampled rate %4", audio_channels(), - audio_length().seconds(), + audio_length(), audio_frame_rate(), resampled_audio_frame_rate() ); @@ -207,7 +209,7 @@ int AudioContent::resampled_audio_frame_rate () const { shared_ptr film = _film.lock (); - assert (film); + DCPOMATIC_ASSERT (film); /* Resample to a DCI-approved sample rate */ double t = dcp_audio_frame_rate (audio_frame_rate ()); @@ -236,3 +238,22 @@ AudioContent::processed_audio_channels () const return audio_processor()->out_channels (audio_channels ()); } +string +AudioContent::processing_description () const +{ + stringstream d; + + if (audio_frame_rate() != resampled_audio_frame_rate ()) { + stringstream from; + from << fixed << setprecision(3) << (audio_frame_rate() / 1000.0); + stringstream to; + to << fixed << setprecision(3) << (resampled_audio_frame_rate() / 1000.0); + + d << String::compose (_("Audio will be resampled from %1kHz to %2kHz."), from.str(), to.str()); + } else { + d << _("Audio will not be resampled."); + } + + return d.str (); +} +