summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xasdcplib/src/AS_DCP_PCM.cpp10
-rw-r--r--src/local_time.cc27
-rw-r--r--src/raw_convert.h2
3 files changed, 18 insertions, 21 deletions
diff --git a/asdcplib/src/AS_DCP_PCM.cpp b/asdcplib/src/AS_DCP_PCM.cpp
index 8639cb0f..385d9035 100755
--- a/asdcplib/src/AS_DCP_PCM.cpp
+++ b/asdcplib/src/AS_DCP_PCM.cpp
@@ -232,6 +232,10 @@ ASDCP::PCM::MXFReader::h__Reader::OpenRead(const char* filename)
}
}
+ /* This check has been removed so that DCP-o-matic can use any edit rate
+ it wants.
+ */
+#if 0
// check for sample/frame rate sanity
if ( ASDCP_SUCCESS(result)
&& m_ADesc.EditRate != EditRate_24
@@ -260,6 +264,7 @@ ASDCP::PCM::MXFReader::h__Reader::OpenRead(const char* filename)
return RESULT_FORMAT;
}
}
+#endif
if( ASDCP_SUCCESS(result) )
result = InitMXFIndex();
@@ -483,6 +488,10 @@ ASDCP::PCM::MXFWriter::h__Writer::SetSourceStream(const AudioDescriptor& ADesc)
if ( ! m_State.Test_INIT() )
return RESULT_STATE;
+#if 0
+ /* This check has been removed so that DCP-o-matic can use anye dit rate
+ it wants.
+ */
if ( ADesc.EditRate != EditRate_24
&& ADesc.EditRate != EditRate_25
&& ADesc.EditRate != EditRate_30
@@ -498,6 +507,7 @@ ASDCP::PCM::MXFWriter::h__Writer::SetSourceStream(const AudioDescriptor& ADesc)
ADesc.EditRate.Numerator, ADesc.EditRate.Denominator);
return RESULT_RAW_FORMAT;
}
+#endif
if ( ADesc.AudioSamplingRate != SampleRate_48k && ADesc.AudioSamplingRate != SampleRate_96k )
{
diff --git a/src/local_time.cc b/src/local_time.cc
index 2388825c..fe58c077 100644
--- a/src/local_time.cc
+++ b/src/local_time.cc
@@ -20,6 +20,7 @@
#include "local_time.h"
#include "exceptions.h"
#include <boost/lexical_cast.hpp>
+#include <boost/date_time/c_local_time_adjustor.hpp>
#include <cstdio>
using std::string;
@@ -56,28 +57,12 @@ LocalTime::LocalTime (boost::posix_time::ptime t)
void
LocalTime::set_local_time_zone ()
{
- time_t now = time (0);
- struct tm* tm = localtime (&now);
-
- int offset = 0;
-
-#ifdef LIBDCP_POSIX
- offset = tm->tm_gmtoff / 60;
-#else
- TIME_ZONE_INFORMATION tz;
- GetTimeZoneInformation (&tz);
- offset = tz.Bias;
-#endif
+ boost::posix_time::ptime const utc_now = boost::posix_time::second_clock::universal_time ();
+ boost::posix_time::ptime const now = boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local (utc_now);
+ boost::posix_time::time_duration offset = now - utc_now;
- bool const negative = offset < 0;
- offset = negative ? -offset : offset;
-
- _tz_hour = offset / 60;
- _tz_minute = offset % 60;
-
- if (negative) {
- _tz_hour = -_tz_hour;
- }
+ _tz_hour = offset.hours ();
+ _tz_minute = offset.minutes ();
}
/** @param s A string of the form 2013-01-05T18:06:59+04:00 */
diff --git a/src/raw_convert.h b/src/raw_convert.h
index 68bbaf7a..37cddbf0 100644
--- a/src/raw_convert.h
+++ b/src/raw_convert.h
@@ -18,6 +18,7 @@
*/
#include <sstream>
+#include <iomanip>
namespace dcp {
@@ -30,6 +31,7 @@ raw_convert (Q v)
{
std::stringstream s;
s.imbue (std::locale::classic ());
+ s << std::setprecision (16);
s << v;
P r;
s >> r;