#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
-#include <boost/lexical_cast.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#ifdef DCPOMATIC_WINDOWS
#include <dcp/util.h>
#include <dcp/signer_chain.h>
#include <dcp/signer.h>
+#include <dcp/raw_convert.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
using std::set_terminate;
using boost::shared_ptr;
using boost::thread;
-using boost::lexical_cast;
using boost::optional;
using dcp::Size;
+using dcp::raw_convert;
static boost::thread::id ui_thread;
static boost::filesystem::path backtrace_file;
get_required_int (multimap<string, string> const & kv, string k)
{
string const v = get_required_string (kv, k);
- return lexical_cast<int> (v);
+ return raw_convert<int> (v);
}
float
get_required_float (multimap<string, string> const & kv, string k)
{
string const v = get_required_string (kv, k);
- return lexical_cast<float> (v);
+ return raw_convert<float> (v);
}
string
return 0;
}
- return lexical_cast<int> (i->second);
+ return raw_convert<int> (i->second);
}
/** Trip an assert if the caller is not in the UI thread */
string
audio_channel_name (int c)
{
- assert (MAX_AUDIO_CHANNELS == 12);
+ assert (MAX_DCP_AUDIO_CHANNELS == 12);
/* TRANSLATORS: these are the names of audio channels; Lfe (sub) is the low-frequency
enhancement channel (sub-woofer). HI is the hearing-impaired audio track and
return channels[c];
}
-LocaleGuard::LocaleGuard ()
- : _old (0)
-{
- char const * old = setlocale (LC_NUMERIC, 0);
-
- if (old) {
- _old = strdup (old);
- if (strcmp (_old, "C")) {
- setlocale (LC_NUMERIC, "C");
- }
- }
-}
-
-LocaleGuard::~LocaleGuard ()
-{
- setlocale (LC_NUMERIC, _old);
- free (_old);
-}
-
bool
valid_image_file (boost::filesystem::path f)
{
_open = 0;
}
}
+
+ContentTimePeriod
+subtitle_period (AVSubtitle const & sub)
+{
+ ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
+
+ ContentTimePeriod period (
+ packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
+ packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
+ );
+
+ return period;
+}