X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fencoded_data.cc;h=4f8aaab4b5b6f62199884eb76855140cc34e0441;hb=fc7c87692f090b9233210335dfb7c4f53e0f58be;hp=fffc4d91f0b51d5c016d6a4e6f472a09d471b35f;hpb=a6c2aa6cad5872d27654553d447cb34185317974;p=dcpomatic.git diff --git a/src/lib/encoded_data.cc b/src/lib/encoded_data.cc index fffc4d91f..4f8aaab4b 100644 --- a/src/lib/encoded_data.cc +++ b/src/lib/encoded_data.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "cross.h" #include "exceptions.h" #include "film.h" +#include "dcpomatic_socket.h" #include "i18n.h" @@ -33,6 +34,13 @@ EncodedData::EncodedData (int s) } +EncodedData::EncodedData (uint8_t const * d, int s) + : _data (new uint8_t[s]) + , _size (s) +{ + memcpy (_data, d, s); +} + EncodedData::EncodedData (boost::filesystem::path file) { _size = boost::filesystem::file_size (file); @@ -83,12 +91,14 @@ EncodedData::write (shared_ptr film, int frame, Eyes eyes) const } void -EncodedData::write_info (shared_ptr film, int frame, Eyes eyes, dcp::FrameInfo fin) const +EncodedData::write_info (shared_ptr film, int frame, Eyes eyes, dcp::FrameInfo info) const { - boost::filesystem::path const info = film->info_path (frame, eyes); - FILE* h = fopen_boost (info, "w"); - fin.write (h); - fclose (h); + FILE* file = fopen_boost (film->info_file(), "ab"); + if (!file) { + throw OpenFileError (film->info_file ()); + } + write_frame_info (file, frame, eyes, info); + fclose (file); } /** Send this data to a socket.