#include "digester.h"
#include "audio_processor.h"
#include "compose.hpp"
+#include "audio_buffers.h"
#include <dcp/locale_convert.h>
#include <dcp/util.h>
#include <dcp/raw_convert.h>
#include <libavcodec/avcodec.h>
}
#include <curl/curl.h>
-#ifdef DCPOMATIC_GRAPHICS_MAGICK
-#include <Magick++.h>
-#endif
#include <glib.h>
#include <pangomm/init.h>
#include <boost/algorithm/string.hpp>
* in during App::onInit().
*/
string program_name;
+bool is_batch_converter = false;
static boost::thread::id ui_thread;
static boost::filesystem::path backtrace_file;
return buffer;
}
+string
+time_to_hmsf (DCPTime time, Frame rate)
+{
+ Frame f = time.frames_round (rate);
+ int s = f / rate;
+ f -= (s * rate);
+ int m = s / 60;
+ s -= m * 60;
+ int h = m / 60;
+ m -= h * 60;
+
+ char buffer[64];
+ snprintf (buffer, sizeof(buffer), "%d:%02d:%02d.%d", h, m, s, static_cast<int>(f));
+ return buffer;
+}
+
/** @param s Number of seconds.
* @return String containing an approximate description of s (e.g. "about 2 hours")
*/
string ap;
- bool const hours = h > 0;
- bool const minutes = h < 6 && m > 0;
- bool const seconds = h == 0 && m < 10 && s > 0;
+ bool hours = h > 0;
+ bool minutes = h < 6 && m > 0;
+ bool seconds = h == 0 && m < 10 && s > 0;
- if (hours) {
- if (m > 30 && !minutes) {
- /// TRANSLATORS: h here is an abbreviation for hours
- ap += locale_convert<string>(h + 1) + _("h");
- } else {
- /// TRANSLATORS: h here is an abbreviation for hours
- ap += locale_convert<string>(h) + _("h");
+ if (m > 30 && !minutes) {
+ /* round up the hours */
+ ++h;
+ }
+ if (s > 30 && !seconds) {
+ /* round up the minutes */
+ ++m;
+ if (m == 60) {
+ m = 0;
+ minutes = false;
+ ++h;
}
+ }
+
+ if (hours) {
+ /// TRANSLATORS: h here is an abbreviation for hours
+ ap += locale_convert<string>(h) + _("h");
if (minutes || seconds) {
ap += N_(" ");
}
if (minutes) {
- /* Minutes */
- if (s > 30 && !seconds) {
- /// TRANSLATORS: m here is an abbreviation for minutes
- ap += locale_convert<string>(m + 1) + _("m");
- } else {
- /// TRANSLATORS: m here is an abbreviation for minutes
- ap += locale_convert<string>(m) + _("m");
- }
+ /// TRANSLATORS: m here is an abbreviation for minutes
+ ap += locale_convert<string>(m) + _("m");
if (seconds) {
ap += N_(" ");
avfilter_register_all ();
#ifdef DCPOMATIC_OSX
- /* Add our lib directory to the libltdl search path so that
+ /* Add our library directory to the libltdl search path so that
xmlsec can find xmlsec1-openssl.
*/
boost::filesystem::path lib = app_contents ();
- lib /= "lib";
+ lib /= "Frameworks";
setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
#endif
curl_global_init (CURL_GLOBAL_ALL);
-#ifdef DCPOMATIC_GRAPHICS_MAGICK
- Magick::InitializeMagick (0);
-#endif
-
ui_thread = boost::this_thread::get_id ();
}
return (
ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" ||
ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" ||
- ext == ".j2c" || ext == ".j2k" || ext == ".jp2"
+ ext == ".j2c" || ext == ".j2k" || ext == ".jp2" || ext == ".exr" ||
+ ext == ".jpf"
);
}
*/
string out;
- string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%.";
+ string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%.+";
for (size_t i = 0; i < s.size(); ++i) {
if (allowed.find (s[i]) != string::npos) {
out += s[i];
return make_pair (non_lfe, lfe);
}
+
+shared_ptr<AudioBuffers>
+remap (shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map)
+{
+ shared_ptr<AudioBuffers> mapped (new AudioBuffers (output_channels, input->frames()));
+ mapped->make_silent ();
+
+ for (int i = 0; i < map.input_channels(); ++i) {
+ for (int j = 0; j < mapped->channels(); ++j) {
+ if (map.get (i, static_cast<dcp::Channel> (j)) > 0) {
+ mapped->accumulate_channel (
+ input.get(),
+ i,
+ static_cast<dcp::Channel> (j),
+ map.get (i, static_cast<dcp::Channel> (j))
+ );
+ }
+ }
+ }
+
+ return mapped;
+}
+
+Eyes
+increment_eyes (Eyes e)
+{
+ if (e == EYES_LEFT) {
+ return EYES_RIGHT;
+ }
+
+ return EYES_LEFT;
+}