#include "safe_stringstream.h"
#include <dcp/util.h>
#include <dcp/signer.h>
+#include <dcp/picture_asset.h>
+#include <dcp/sound_asset.h>
+#include <dcp/subtitle_asset.h>
#include <glib.h>
#include <pangomm/init.h>
#include <boost/algorithm/string.hpp>
dcp::init ();
Ratio::setup_ratios ();
+ PresetColourConversion::setup_colour_conversion_presets ();
VideoContentScale::setup_scales ();
DCPContentType::setup_dcp_content_types ();
Filter::setup_filters ();
#endif
#ifdef DCPOMATIC_LINUX
- bindtextdomain ("libdcpomatic", POSIX_LOCALE_PREFIX);
+ bindtextdomain ("libdcpomatic", LINUX_LOCALE_PREFIX);
#endif
}
}
boost::uintmax_t this_time = min (to_do, boost::filesystem::file_size (files[i]));
- fseek (f, -this_time, SEEK_END);
+ dcpomatic_fseek (f, -this_time, SEEK_END);
fread (p, 1, this_time, f);
p += this_time;
to_do -= this_time;
bool
valid_image_file (boost::filesystem::path f)
{
+ if (boost::starts_with (f.leaf().string(), "._")) {
+ return false;
+ }
+
string ext = f.extension().string();
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
return (
ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" ||
ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" ||
- ext == ".j2c" || ext == ".j2k"
+ ext == ".j2c" || ext == ".j2k" || ext == ".jp2"
);
}
{
string ext = f.extension().string();
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
- return (ext == ".j2k" || ext == ".j2c");
+ return (ext == ".j2k" || ext == ".j2c" || ext == ".jp2");
}
string
}
dcp::Size
-fit_ratio_within (float ratio, dcp::Size full_frame, int round)
+fit_ratio_within (float ratio, dcp::Size full_frame)
{
if (ratio < full_frame.ratio ()) {
- return dcp::Size (round_to (full_frame.height * ratio, round), full_frame.height);
+ return dcp::Size (rint (full_frame.height * ratio), full_frame.height);
}
- return dcp::Size (full_frame.width, round_to (full_frame.width / ratio, round));
+ return dcp::Size (full_frame.width, rint (full_frame.width / ratio));
}
void *
}
return p;
}
-
-ContentTimePeriod
+
+FFmpegSubtitlePeriod
subtitle_period (AVSubtitle const & sub)
{
ContentTime const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
- ContentTimePeriod period (
+ if (sub.end_display_time == static_cast<uint32_t> (-1)) {
+ /* End time is not known */
+ return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3));
+ }
+
+ return FFmpegSubtitlePeriod (
packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
);
-
- return period;
}
map<string, string>
return r;
}
+
+string
+video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
+{
+ return "j2c_" + asset->id() + ".mxf";
+}
+
+string
+audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
+{
+ return "pcm_" + asset->id() + ".mxf";
+}