files in the program, then also delete it here.
*/
-#include "data.h"
+
+#include "array_data.h"
#include "util.h"
#include "version.h"
#include "j2k.h"
int const count = 100;
int const j2k_bandwidth = 100000000;
- dcp::Data j2k (boost::filesystem::path (argv[1]) / "thx.j2c");
+ dcp::ArrayData j2k (boost::filesystem::path (argv[1]) / "thx.j2c");
Timer decompress;
Timer compress;
- dcp::Data recomp;
+ dcp::ArrayData recomp;
for (int i = 0; i < count; ++i) {
decompress.start ();
shared_ptr<dcp::OpenJPEGImage> xyz = dcp::decompress_j2k (j2k, 0);
--- /dev/null
+/*
+ Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ libdcp is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
+*/
+
+#include "array_data.h"
+#include "util.h"
+#include "exceptions.h"
+#include <cstdio>
+#include <cerrno>
+
+using boost::shared_array;
+using namespace dcp;
+
+ArrayData::ArrayData ()
+ : _size (0)
+{
+
+}
+
+ArrayData::ArrayData (int size)
+ : _data (new uint8_t[size])
+ , _size (size)
+{
+
+}
+
+ArrayData::ArrayData (uint8_t const * data, int size)
+ : _data (new uint8_t[size])
+ , _size (size)
+{
+ memcpy (_data.get(), data, size);
+}
+
+ArrayData::ArrayData (shared_array<uint8_t> data, int size)
+ : _data (data)
+ , _size (size)
+{
+
+}
+
+ArrayData::ArrayData (boost::filesystem::path file)
+{
+ _size = boost::filesystem::file_size (file);
+ _data.reset (new uint8_t[_size]);
+
+ FILE* f = fopen_boost (file, "rb");
+ if (!f) {
+ throw FileError ("could not open file for reading", file, errno);
+ }
+
+ size_t const r = fread (_data.get(), 1, _size, f);
+ if (r != size_t (_size)) {
+ fclose (f);
+ throw FileError ("could not read from file", file, errno);
+ }
+
+ fclose (f);
+}
+
+void
+ArrayData::write (boost::filesystem::path file) const
+{
+ FILE* f = fopen_boost (file, "wb");
+ if (!f) {
+ throw FileError ("could not write to file", file, errno);
+ }
+ size_t const r = fwrite (_data.get(), 1, _size, f);
+ if (r != size_t (_size)) {
+ fclose (f);
+ throw FileError ("could not write to file", file, errno);
+ }
+ fclose (f);
+}
+
+void
+ArrayData::write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const
+{
+ write (temp);
+ boost::filesystem::rename (temp, final);
+}
+
+bool
+dcp::operator== (ArrayData const & a, ArrayData const & b)
+{
+ return (a.size() == b.size() && memcmp (a.data().get(), b.data().get(), a.size()) == 0);
+}
--- /dev/null
+/*
+ Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ libdcp is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
+*/
+
+#ifndef LIBDCP_ARRAY_DATA_H
+#define LIBDCP_ARRAY_DATA_H
+
+#include <boost/shared_array.hpp>
+#include <boost/filesystem.hpp>
+#include <stdint.h>
+
+namespace dcp {
+
+class ArrayData
+{
+public:
+ ArrayData ();
+ explicit ArrayData (int size);
+ ArrayData (uint8_t const * data, int size);
+ ArrayData (boost::shared_array<uint8_t> data, int size);
+ explicit ArrayData (boost::filesystem::path file);
+
+ virtual ~ArrayData () {}
+
+ void write (boost::filesystem::path file) const;
+ void write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const;
+
+ boost::shared_array<uint8_t> data () const {
+ return _data;
+ }
+
+ int size () const {
+ return _size;
+ }
+
+ void set_size (int s) {
+ _size = s;
+ }
+
+private:
+ boost::shared_array<uint8_t> _data;
+ /** amount of `valid' data in _data; the array may be larger */
+ int _size;
+};
+
+bool operator==(ArrayData const & a, ArrayData const & b);
+
+}
+
+#endif
+++ /dev/null
-/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-#include "data.h"
-#include "util.h"
-#include "exceptions.h"
-#include <cstdio>
-#include <cerrno>
-
-using boost::shared_array;
-using namespace dcp;
-
-Data::Data ()
- : _size (0)
-{
-
-}
-
-Data::Data (int size)
- : _data (new uint8_t[size])
- , _size (size)
-{
-
-}
-
-Data::Data (uint8_t const * data, int size)
- : _data (new uint8_t[size])
- , _size (size)
-{
- memcpy (_data.get(), data, size);
-}
-
-Data::Data (shared_array<uint8_t> data, int size)
- : _data (data)
- , _size (size)
-{
-
-}
-
-Data::Data (boost::filesystem::path file)
-{
- _size = boost::filesystem::file_size (file);
- _data.reset (new uint8_t[_size]);
-
- FILE* f = fopen_boost (file, "rb");
- if (!f) {
- throw FileError ("could not open file for reading", file, errno);
- }
-
- size_t const r = fread (_data.get(), 1, _size, f);
- if (r != size_t (_size)) {
- fclose (f);
- throw FileError ("could not read from file", file, errno);
- }
-
- fclose (f);
-}
-
-void
-Data::write (boost::filesystem::path file) const
-{
- FILE* f = fopen_boost (file, "wb");
- if (!f) {
- throw FileError ("could not write to file", file, errno);
- }
- size_t const r = fwrite (_data.get(), 1, _size, f);
- if (r != size_t (_size)) {
- fclose (f);
- throw FileError ("could not write to file", file, errno);
- }
- fclose (f);
-}
-
-void
-Data::write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const
-{
- write (temp);
- boost::filesystem::rename (temp, final);
-}
-
-bool
-dcp::operator== (Data const & a, Data const & b)
-{
- return (a.size() == b.size() && memcmp (a.data().get(), b.data().get(), a.size()) == 0);
-}
+++ /dev/null
-/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-#ifndef LIBDCP_DATA_H
-#define LIBDCP_DATA_H
-
-#include <boost/shared_array.hpp>
-#include <boost/filesystem.hpp>
-#include <stdint.h>
-
-namespace dcp {
-
-class Data
-{
-public:
- Data ();
- explicit Data (int size);
- Data (uint8_t const * data, int size);
- Data (boost::shared_array<uint8_t> data, int size);
- explicit Data (boost::filesystem::path file);
-
- virtual ~Data () {}
-
- void write (boost::filesystem::path file) const;
- void write_via_temp (boost::filesystem::path temp, boost::filesystem::path final) const;
-
- boost::shared_array<uint8_t> data () const {
- return _data;
- }
-
- int size () const {
- return _size;
- }
-
- void set_size (int s) {
- _size = s;
- }
-
-private:
- boost::shared_array<uint8_t> _data;
- /** amount of `valid' data in _data; the array may be larger */
- int _size;
-};
-
-bool operator==(Data const & a, Data const & b);
-
-}
-
-#endif
BOOST_FOREACH (shared_ptr<dcp::Subtitle> i, _subtitles) {
shared_ptr<dcp::SubtitleImage> im = dynamic_pointer_cast<dcp::SubtitleImage> (i);
if (im) {
- Data png_image = im->png_image ();
+ ArrayData png_image = im->png_image ();
pkl->add_asset (im->id(), optional<string>(), make_digest(png_image), png_image.size(), "image/png");
}
}
files in the program, then also delete it here.
*/
+
+#include "array_data.h"
#include "j2k.h"
#include "exceptions.h"
#include "openjpeg_image.h"
-#include "data.h"
#include "dcp_assert.h"
#include "compose.hpp"
#include <openjpeg.h>
using namespace dcp;
shared_ptr<dcp::OpenJPEGImage>
-dcp::decompress_j2k (Data data, int reduce)
+dcp::decompress_j2k (ArrayData data, int reduce)
{
return dcp::decompress_j2k (data.data().get(), data.size(), reduce);
}
return OPJ_TRUE;
}
- Data data () const
+ ArrayData data () const
{
return _data;
}
private:
- Data _data;
+ ArrayData _data;
OPJ_SIZE_T _offset;
};
/** @xyz Picture to compress. Parts of xyz's data WILL BE OVERWRITTEN by libopenjpeg so xyz cannot be re-used
* after this call; see opj_j2k_encode where if l_reuse_data is false it will set l_tilec->data = l_img_comp->data.
*/
-Data
+ArrayData
dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frames_per_second, bool threed, bool fourk, string comment)
{
/* get a J2K compressor handle */
throw MiscError ("could not end JPEG2000 encoding");
}
- Data enc (buffer->data ());
+ ArrayData enc (buffer->data ());
opj_stream_destroy (stream);
opj_destroy_codec (encoder);
#endif
#ifdef LIBDCP_OPENJPEG1
-Data
+ArrayData
dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frames_per_second, bool threed, bool fourk)
{
/* Set the max image and component sizes based on frame_rate */
throw MiscError ("JPEG2000 encoding failed");
}
- Data enc (cio->buffer, cio_tell (cio));
+ ArrayData enc (cio->buffer, cio_tell (cio));
opj_cio_close (cio);
free (parameters.cp_comment);
files in the program, then also delete it here.
*/
-#include "data.h"
+
+#include "array_data.h"
#include <boost/shared_ptr.hpp>
#include <stdint.h>
class OpenJPEGImage;
extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (uint8_t* data, int64_t size, int reduce);
-extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (Data data, int reduce);
-extern Data compress_j2k (boost::shared_ptr<const OpenJPEGImage>, int bandwith, int frames_per_second, bool threed, bool fourk, std::string comment = "libdcp");
+extern boost::shared_ptr<OpenJPEGImage> decompress_j2k (ArrayData data, int reduce);
+extern ArrayData compress_j2k (boost::shared_ptr<const OpenJPEGImage>, int bandwith, int frames_per_second, bool threed, bool fourk, std::string comment = "libdcp");
}
}
if (j != _load_font_nodes.end ()) {
- _fonts.push_back (Font ((*j)->id, (*j)->urn, Data (data, buffer.Size ())));
+ _fonts.push_back (Font ((*j)->id, (*j)->urn, ArrayData (data, buffer.Size ())));
}
break;
}
}
if (j != _subtitles.end()) {
- dynamic_pointer_cast<SubtitleImage>(*j)->set_png_image (Data(data, buffer.Size()));
+ dynamic_pointer_cast<SubtitleImage>(*j)->set_png_image (ArrayData(data, buffer.Size()));
}
break;
}
_subtitles.push_back (
shared_ptr<Subtitle> (
new SubtitleImage (
- Data (),
+ ArrayData (),
standard == INTEROP ? text.substr(0, text.size() - 4) : text,
ps.in.get(),
ps.out.get(),
root->write_xml (xml_root, context);
}
-map<string, Data>
+map<string, ArrayData>
SubtitleAsset::font_data () const
{
- map<string, Data> out;
+ map<string, ArrayData> out;
BOOST_FOREACH (Font const & i, _fonts) {
out[i.load_id] = i.data;
}
#ifndef LIBDCP_SUBTITLE_ASSET_H
#define LIBDCP_SUBTITLE_ASSET_H
+
+#include "array_data.h"
#include "asset.h"
#include "dcp_time.h"
#include "subtitle_string.h"
-#include "data.h"
#include <libcxml/cxml.h>
#include <boost/shared_array.hpp>
#include <map>
virtual void add (boost::shared_ptr<Subtitle>);
virtual void add_font (std::string id, boost::filesystem::path file) = 0;
- std::map<std::string, Data> font_data () const;
+ std::map<std::string, ArrayData> font_data () const;
std::map<std::string, boost::filesystem::path> font_filenames () const;
virtual void write (boost::filesystem::path) const = 0;
, file (file_)
{}
- Font (std::string load_id_, std::string uuid_, Data data_)
+ Font (std::string load_id_, std::string uuid_, ArrayData data_)
: load_id (load_id_)
, uuid (uuid_)
, data (data_)
std::string load_id;
std::string uuid;
- Data data;
+ ArrayData data;
/** .ttf file that this data was last written to, if applicable */
mutable boost::optional<boost::filesystem::path> file;
};
#ifndef LIBDCP_SUBTITLE_ASSET_INTERNAL_H
#define LIBDCP_SUBTITLE_ASSET_INTERNAL_H
+
+#include "array_data.h"
#include "raw_convert.h"
#include "types.h"
#include "dcp_time.h"
-#include "data.h"
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
class Image : public Part
{
public:
- Image (boost::shared_ptr<Part> parent, std::string id, Data png_data, HAlign h_align, float h_position, VAlign v_align, float v_position)
+ Image (boost::shared_ptr<Part> parent, std::string id, ArrayData png_data, HAlign h_align, float h_position, VAlign v_align, float v_position)
: Part (parent)
, _png_data (png_data)
, _id (id)
xmlpp::Element* as_xml (xmlpp::Element* parent, Context& context) const;
private:
- Data _png_data;
+ ArrayData _png_data;
std::string _id; ///< the ID of this image
HAlign _h_align;
float _h_position;
using namespace dcp;
SubtitleImage::SubtitleImage (
- Data png_image,
+ ArrayData png_image,
Time in,
Time out,
float h_position,
}
SubtitleImage::SubtitleImage (
- Data png_image,
+ ArrayData png_image,
string id,
Time in,
Time out,
SubtitleImage::read_png_file (boost::filesystem::path file)
{
_file = file;
- _png_image = Data (file);
+ _png_image = ArrayData (file);
}
void
#ifndef LIBDCP_SUBTITLE_IMAGE_H
#define LIBDCP_SUBTITLE_IMAGE_H
+
+#include "array_data.h"
#include "types.h"
#include "subtitle.h"
-#include "data.h"
#include "dcp_time.h"
#include <boost/optional.hpp>
#include <string>
{
public:
SubtitleImage (
- Data png_image,
+ ArrayData png_image,
Time in,
Time out,
float h_position,
);
SubtitleImage (
- Data png_image,
+ ArrayData png_image,
std::string id,
Time in,
Time out,
Time fade_down_time
);
- Data png_image () const {
+ ArrayData png_image () const {
return _png_image;
}
- void set_png_image (Data png) {
+ void set_png_image (ArrayData png) {
_png_image = png;
}
}
private:
- Data _png_image;
+ ArrayData _png_image;
std::string _id;
mutable boost::optional<boost::filesystem::path> _file;
};
}
string
-dcp::make_digest (Data data)
+dcp::make_digest (ArrayData data)
{
SHA_CTX sha;
SHA1_Init (&sha);
* @brief Utility methods.
*/
+
+#include "array_data.h"
#include "types.h"
-#include "data.h"
#include "local_time.h"
#include <asdcp/KM_log.h>
#include <boost/shared_ptr.hpp>
extern std::string make_uuid ();
extern std::string make_digest (boost::filesystem::path filename, boost::function<void (float)>);
-extern std::string make_digest (Data data);
+extern std::string make_digest (ArrayData data);
extern bool empty_or_white_space (std::string s);
extern bool ids_equal (std::string a, std::string b);
extern std::string remove_urn_uuid (std::string raw);
/* Check that the CPL's hash corresponds to the PKL */
BOOST_FOREACH (shared_ptr<PKL> i, dcp->pkls()) {
optional<string> h = i->hash(cpl->id());
- if (h && make_digest(Data(*cpl->file())) != *h) {
+ if (h && make_digest(ArrayData(*cpl->file())) != *h) {
notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::CPL_HASH_INCORRECT));
}
}
#
-# Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+# Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
#
# 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
def build(bld):
source = """
+ array_data.cc
asset.cc
asset_factory.cc
asset_writer.cc
colour_conversion.cc
combine.cc
cpl.cc
- data.cc
dcp.cc
dcp_time.cc
decrypted_kdm.cc
"""
headers = """
+ array_data.h
asset.h
asset_reader.h
asset_writer.h
dcp.h
dcp_assert.h
dcp_time.h
- data.h
decrypted_kdm.h
decrypted_kdm_key.h
encrypted_kdm.h
}
}
- dcp::Data data = dcp::compress_j2k (xyz, 100000000, 24, false, false);
+ dcp::ArrayData data = dcp::compress_j2k (xyz, 100000000, 24, false, false);
dcp::FrameInfo info = writer->write (data.data().get(), data.size());
BOOST_CHECK_EQUAL (info.hash, hash);
files in the program, then also delete it here.
*/
-#include "data.h"
+
+#include "array_data.h"
#include "util.h"
#include <boost/bind.hpp>
#include <boost/test/unit_test.hpp>
/* Make a big file with some random data */
srand (1);
int const N = 256 * 1024 * 1024;
- dcp::Data data (N);
+ dcp::ArrayData data (N);
uint8_t* p = data.data().get();
for (int i = 0; i < N; ++i) {
*p++ = rand() & 0xff;
BOOST_REQUIRE_EQUAL (subs.subtitles().size(), 1);
shared_ptr<dcp::SubtitleImage> si = dynamic_pointer_cast<dcp::SubtitleImage>(subs.subtitles().front());
BOOST_REQUIRE (si);
- BOOST_CHECK (si->png_image() == dcp::Data("test/data/sub.png"));
+ BOOST_CHECK (si->png_image() == dcp::ArrayData("test/data/sub.png"));
}
BOOST_REQUIRE_EQUAL (subs.subtitles().size(), 1);
shared_ptr<dcp::SubtitleImage> si = dynamic_pointer_cast<dcp::SubtitleImage>(subs.subtitles().front());
BOOST_REQUIRE (si);
- BOOST_CHECK (si->png_image() == dcp::Data("test/data/sub.png"));
+ BOOST_CHECK (si->png_image() == dcp::ArrayData("test/data/sub.png"));
}
subs->add (simple_subtitle());
boost::filesystem::create_directory (path / "subs");
- dcp::Data data(4096);
+ dcp::ArrayData data(4096);
data.write (path / "subs" / "font.ttf");
subs->add_font ("afont", path / "subs" / "font.ttf");
subs->write (path / "subs" / "subs.xml");
shared_ptr<dcp::SMPTESubtitleAsset> subs(new dcp::SMPTESubtitleAsset());
subs->add (simple_subtitle());
- dcp::Data data(4096);
+ dcp::ArrayData data(4096);
subs->write (path / "subs.mxf");
shared_ptr<dcp::ReelSubtitleAsset> reel_subs(new dcp::ReelSubtitleAsset(subs, dcp::Fraction(24, 1), 240, 0));
black_picture_asset (boost::filesystem::path dir, int frames)
{
shared_ptr<dcp::OpenJPEGImage> image = black_image ();
- dcp::Data frame = dcp::compress_j2k (image, 100000000, 24, false, false);
+ dcp::ArrayData frame = dcp::compress_j2k (image, 100000000, 24, false, false);
BOOST_REQUIRE (frame.size() < 230000000 / (24 * 8));
shared_ptr<dcp::MonoPictureAsset> asset(new dcp::MonoPictureAsset(dcp::Fraction(24, 1), dcp::SMPTE));
#include "cpl.h"
-#include "data.h"
#include "dcp.h"
#include "reel.h"
#include "reel_subtitle_asset.h"
static
void
-dcp_from_frame (dcp::Data const& frame, boost::filesystem::path dir)
+dcp_from_frame (dcp::ArrayData const& frame, boost::filesystem::path dir)
{
shared_ptr<dcp::MonoPictureAsset> asset(new dcp::MonoPictureAsset(dcp::Fraction(24, 1), dcp::SMPTE));
boost::filesystem::create_directories (dir);
/* Compress a black image */
shared_ptr<dcp::OpenJPEGImage> image = black_image ();
- dcp::Data frame = dcp::compress_j2k (image, 100000000, 24, false, false);
+ dcp::ArrayData frame = dcp::compress_j2k (image, 100000000, 24, false, false);
BOOST_REQUIRE (frame.size() < too_big);
/* Place it in a bigger block with some zero padding at the end */
- dcp::Data oversized_frame(too_big);
+ dcp::ArrayData oversized_frame(too_big);
memcpy (oversized_frame.data().get(), frame.data().get(), frame.size());
memset (oversized_frame.data().get() + frame.size(), 0, too_big - frame.size());
/* Compress a black image */
shared_ptr<dcp::OpenJPEGImage> image = black_image ();
- dcp::Data frame = dcp::compress_j2k (image, 100000000, 24, false, false);
+ dcp::ArrayData frame = dcp::compress_j2k (image, 100000000, 24, false, false);
BOOST_REQUIRE (frame.size() < nearly_too_big);
/* Place it in a bigger block with some zero padding at the end */
- dcp::Data oversized_frame(nearly_too_big);
+ dcp::ArrayData oversized_frame(nearly_too_big);
memcpy (oversized_frame.data().get(), frame.data().get(), frame.size());
memset (oversized_frame.data().get() + frame.size(), 0, nearly_too_big - frame.size());
{
/* Compress a black image */
shared_ptr<dcp::OpenJPEGImage> image = black_image ();
- dcp::Data frame = dcp::compress_j2k (image, 100000000, 24, false, false);
+ dcp::ArrayData frame = dcp::compress_j2k (image, 100000000, 24, false, false);
BOOST_REQUIRE (frame.size() < 230000000 / (24 * 8));
boost::filesystem::path const dir("build/test/verify_test17");
boost::filesystem::create_directories (ov_dir);
shared_ptr<dcp::OpenJPEGImage> image = black_image ();
- dcp::Data frame = dcp::compress_j2k (image, 100000000, 24, false, false);
+ dcp::ArrayData frame = dcp::compress_j2k (image, 100000000, 24, false, false);
BOOST_REQUIRE (frame.size() < 230000000 / (24 * 8));
dcp_from_frame (frame, ov_dir);
c->add (
shared_ptr<dcp::Subtitle> (
new dcp::SubtitleImage (
- dcp::Data ("test/data/sub.png"),
+ dcp::ArrayData ("test/data/sub.png"),
dcp::Time (0, 4, 9, 22, 24),
dcp::Time (0, 4, 11, 22, 24),
0,
c.add (
shared_ptr<dcp::Subtitle> (
new dcp::SubtitleImage (
- dcp::Data ("test/data/sub.png"),
+ dcp::ArrayData ("test/data/sub.png"),
dcp::Time (0, 4, 9, 22, 24),
dcp::Time (0, 4, 11, 22, 24),
0,
cout << sub.xml_as_string() << "\n";
if (extract_fonts) {
- map<string, dcp::Data> fonts = sub.font_data ();
- for (map<string, dcp::Data>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
+ map<string, dcp::ArrayData> fonts = sub.font_data ();
+ for (map<string, dcp::ArrayData>::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
FILE* f = dcp::fopen_boost (i->first + ".ttf", "wb");
if (!f) {
cerr << "Could not open font file " << i->first << ".ttf for writing";