#include <dcp/sound_asset.h>
#include <dcp/subtitle_asset.h>
#include <dcp/atmos_asset.h>
+DCPOMATIC_DISABLE_WARNINGS
extern "C" {
#include <libavfilter/avfilter.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
+DCPOMATIC_ENABLE_WARNINGS
#include <curl/curl.h>
#include <glib.h>
#include <pangomm/init.h>
+#include <unicode/utypes.h>
+#include <unicode/unistr.h>
+#include <unicode/translit.h>
#include <boost/algorithm/string.hpp>
#include <boost/range/algorithm/replace_if.hpp>
#include <boost/thread.hpp>
ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" ||
ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" ||
ext == ".j2c" || ext == ".j2k" || ext == ".jp2" || ext == ".exr" ||
- ext == ".jpf"
+ ext == ".jpf" || ext == ".psd"
);
}
Safety first and all that.
*/
- wstring ws = boost::locale::conv::utf_to_utf<wchar_t>(s);
+ /* First transliterate using libicu to try to remove accents in a "nice" way */
+ auto icu_utf16 = icu::UnicodeString::fromUTF8(icu::StringPiece(s));
+ auto status = U_ZERO_ERROR;
+ auto transliterator = icu::Transliterator::createInstance("NFD; [:M:] Remove; NFC", UTRANS_FORWARD, status);
+ transliterator->transliterate(icu_utf16);
+ s.clear ();
+ icu_utf16.toUTF8String(s);
+ /* Then remove anything that's not in a very limited character set */
+ wstring ws = boost::locale::conv::utf_to_utf<wchar_t>(s);
string out;
string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%.+";
for (size_t i = 0; i < ws.size(); ++i) {
-
wchar_t c = ws[i];
-
- /* Remove some accents */
- if (wstring(L"áàâ").find(c) != string::npos) {
- c = 'a';
- }
- if (wstring(L"éèêë").find(c) != string::npos) {
- c = 'e';
- }
- if (wstring(L"ö").find(c) != string::npos) {
- c = 'o';
- }
- if (wstring(L"ü").find(c) != string::npos) {
- c = 'u';
- }
-
if (allowed.find(c) != string::npos) {
out += c;
}
emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
{
/* XXX: this is rather inefficient; decoding the image just to get its size */
- FFmpegImageProxy proxy (sub.png_image(), VideoRange::FULL);
+ FFmpegImageProxy proxy (sub.png_image());
auto image = proxy.image().image;
/* set up rect with height and width */
dcpomatic::Rect<double> rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height));
/** XXX: could use mmap? */
void
-copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)> progress)
+copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)> progress)
{
auto f = fopen_boost (from, "rb");
if (!f) {
return liberation_normal;
}
+
+
+string
+to_upper (string s)
+{
+ transform (s.begin(), s.end(), s.begin(), ::toupper);
+ return s;
+}
+
+
+/* Set to 1 to print the IDs of some of our threads to stdout on creation */
+#define DCPOMATIC_DEBUG_THREADS 0
+
+#if DCPOMATIC_DEBUG_THREADS
+void
+start_of_thread (string name)
+{
+ std::cout << "THREAD:" << name << ":" << std::hex << pthread_self() << "\n";
+}
+#else
+void
+start_of_thread (string)
+{
+
+}
+#endif
+