Try to fix completely broken i18n.
[dcpomatic.git] / src / lib / util.cc
index 99d9ba2c4f55654f12e2af866585121b2f6cb92e..ad4349da202d61d81811629db950882e2279bb17 100644 (file)
@@ -37,6 +37,9 @@
 #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>
@@ -322,6 +325,7 @@ dcpomatic_setup ()
        dcp::init ();
        
        Ratio::setup_ratios ();
+       PresetColourConversion::setup_colour_conversion_presets ();
        VideoContentScale::setup_scales ();
        DCPContentType::setup_dcp_content_types ();
        Filter::setup_filters ();
@@ -373,15 +377,15 @@ dcpomatic_setup_gettext_i18n (string lang)
        }
 
        setlocale (LC_ALL, "");
-       textdomain ("libdcpomatic");
+       textdomain ("libdcpomatic2");
 
 #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
-       bindtextdomain ("libdcpomatic", mo_path().string().c_str());
-       bind_textdomain_codeset ("libdcpomatic", "UTF8");
+       bindtextdomain ("libdcpomatic2", mo_path().string().c_str());
+       bind_textdomain_codeset ("libdcpomatic2", "UTF8");
 #endif 
 
 #ifdef DCPOMATIC_LINUX
-       bindtextdomain ("libdcpomatic", LINUX_LOCALE_PREFIX);
+       bindtextdomain ("libdcpomatic2", LINUX_LOCALE_PREFIX);
 #endif
 }
 
@@ -518,7 +522,7 @@ valid_image_file (boost::filesystem::path f)
        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"
                );
 }
 
@@ -527,7 +531,7 @@ valid_j2k_file (boost::filesystem::path f)
 {
        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
@@ -627,47 +631,14 @@ split_get_request (string url)
        return r;
 }
 
-long
-frame_info_position (int frame, Eyes eyes)
-{
-       static int const info_size = 48;
-       
-       switch (eyes) {
-       case EYES_BOTH:
-               return frame * info_size;
-       case EYES_LEFT:
-               return frame * info_size * 2;
-       case EYES_RIGHT:
-               return frame * info_size * 2 + info_size;
-       default:
-               DCPOMATIC_ASSERT (false);
-       }
-
-       DCPOMATIC_ASSERT (false);
-}
-
-dcp::FrameInfo
-read_frame_info (FILE* file, int frame, Eyes eyes)
+string
+video_asset_filename (shared_ptr<dcp::PictureAsset> asset)
 {
-       dcp::FrameInfo info;
-       dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET);
-       fread (&info.offset, sizeof (info.offset), 1, file);
-       fread (&info.size, sizeof (info.size), 1, file);
-       
-       char hash_buffer[33];
-       fread (hash_buffer, 1, 32, file);
-       hash_buffer[32] = '\0';
-       info.hash = hash_buffer;
-
-       return info;
+       return "j2c_" + asset->id() + ".mxf";
 }
 
-void
-write_frame_info (FILE* file, int frame, Eyes eyes, dcp::FrameInfo info)
+string
+audio_asset_filename (shared_ptr<dcp::SoundAsset> asset)
 {
-       dcpomatic_fseek (file, frame_info_position (frame, eyes), SEEK_SET);
-       fwrite (&info.offset, sizeof (info.offset), 1, file);
-       fwrite (&info.size, sizeof (info.size), 1, file);
-       fwrite (info.hash.c_str(), 1, info.hash.size(), file);
+       return "pcm_" + asset->id() + ".mxf";
 }
-