diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-31 18:16:58 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-31 18:16:58 +0000 |
| commit | 4f902db0ad994910a34ca845225635ceefcac96e (patch) | |
| tree | adf80a8543c20082057f7ed1e75b46524257b2e1 | |
| parent | e651d843c513e8dbf0967735ea702a3795ac321d (diff) | |
Initial hacks.
| -rw-r--r-- | examples/make_dcp.cc | 4 | ||||
| -rwxr-xr-x | run-tests.sh | 14 | ||||
| -rw-r--r-- | src/dcp_time.cc | 11 | ||||
| -rw-r--r-- | src/mxf_asset.cc | 41 | ||||
| -rw-r--r-- | src/mxf_asset.h | 15 | ||||
| -rw-r--r-- | src/picture_asset.cc | 23 | ||||
| -rw-r--r-- | src/picture_asset.h | 12 | ||||
| -rw-r--r-- | src/sound_asset.cc | 12 | ||||
| -rw-r--r-- | src/sound_asset.h | 8 | ||||
| -rw-r--r-- | test/ref/DCP/81fb54df-e1bf-4647-8788-ea7ba154375b_cpl.xml | 39 | ||||
| -rw-r--r-- | test/ref/DCP/ASSETMAP.xml | 55 | ||||
| -rw-r--r-- | test/ref/DCP/VOLINDEX.xml | 4 | ||||
| -rw-r--r-- | test/ref/DCP/audio.mxf | bin | 305326 -> 0 bytes | |||
| -rw-r--r-- | test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_pkl.xml | 30 | ||||
| -rw-r--r-- | test/ref/DCP/video.mxf | bin | 26080 -> 0 bytes | |||
| -rw-r--r-- | test/tests.cc | 57 |
16 files changed, 159 insertions, 166 deletions
diff --git a/examples/make_dcp.cc b/examples/make_dcp.cc index e1d8353b..22490d71 100644 --- a/examples/make_dcp.cc +++ b/examples/make_dcp.cc @@ -73,7 +73,7 @@ main () for 2K projectors. */ boost::shared_ptr<libdcp::MonoPictureAsset> picture_asset ( - new libdcp::MonoPictureAsset (video_frame, "My Film DCP", "video.mxf", 0, 24, 48, 1998, 1080) + new libdcp::MonoPictureAsset (video_frame, "My Film DCP", "video.mxf", 0, 24, 48, 1998, 1080, false) ); /* Now we will create a `sound asset', which is made up of a WAV file for each channel of audio. Here we're using @@ -93,7 +93,7 @@ main () /* Now we can create the sound asset using these files */ boost::shared_ptr<libdcp::SoundAsset> sound_asset ( - new libdcp::SoundAsset (sound_files, "My Film DCP", "audio.mxf", 0, 24, 48) + new libdcp::SoundAsset (sound_files, "My Film DCP", "audio.mxf", 0, 24, 48, false) ); /* Now that we have the assets, we can create a Reel to put them in and add it to the CPL */ diff --git a/run-tests.sh b/run-tests.sh index 3c92dae0..e08dc86d 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,8 +1,9 @@ #!/bin/bash # -# Runs our test suite, which builds a DCP. -# The output is compared against the one +# Runs our test suite, which (amongst other things) +# builds a couple of DCPs. +# The outputs are compared against the ones # in test/ref/DCP, and an error is given # if anything is different. # @@ -13,7 +14,14 @@ if [ "$1" == "--debug" ]; then else LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests fi -diff -ur test/ref/DCP build/test/foo + +diff -ur test/ref/DCP/foo build/test/foo +if [ "$?" != "0" ]; then + echo "FAIL: files differ" + exit 1 +fi + +diff -ur test/ref/DCP/bar build/test/bar if [ "$?" != "0" ]; then echo "FAIL: files differ" exit 1 diff --git a/src/dcp_time.cc b/src/dcp_time.cc index c9cd751a..c5a7affd 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -39,9 +39,14 @@ Time::Time (int frame, int frames_per_second) , s (0) , t (0) { - float sec_float = float (frame) / frames_per_second; - t = (int (floor (sec_float * 1000)) % 1000) / 4; - s = floor (sec_float); + set (double (frame) / frames_per_second); +} + +void +Time::set (double ss) +{ + t = (int (round (ss * 1000)) % 1000) / 4; + s = floor (ss); if (s > 60) { m = s / 60; diff --git a/src/mxf_asset.cc b/src/mxf_asset.cc index 95412d0c..d229331b 100644 --- a/src/mxf_asset.cc +++ b/src/mxf_asset.cc @@ -25,10 +25,12 @@ #include <fstream> #include <boost/filesystem.hpp> #include "AS_DCP.h" +#include "KM_prng.h" #include "KM_util.h" #include "mxf_asset.h" #include "util.h" #include "metadata.h" +#include "exceptions.h" using std::string; using std::list; @@ -36,14 +38,40 @@ using boost::shared_ptr; using boost::dynamic_pointer_cast; using namespace libdcp; -MXFAsset::MXFAsset (string directory, string file_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length) +MXFAsset::MXFAsset (string directory, string file_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length, bool encrypted) : Asset (directory, file_name) , _progress (progress) , _fps (fps) , _entry_point (entry_point) , _length (length) + , _encrypted (encrypted) + , _encryption_context (0) { - + if (_encrypted) { + _key_id = make_uuid (); + uint8_t key_buffer[ASDCP::KeyLen]; + Kumu::FortunaRNG rng; + rng.FillRandom (key_buffer, ASDCP::KeyLen); + char key_string[ASDCP::KeyLen * 4]; + Kumu::bin2hex (key_buffer, ASDCP::KeyLen, key_string, ASDCP::KeyLen * 4); + _key_value = key_string; + + _encryption_context = new ASDCP::AESEncContext; + if (ASDCP_FAILURE (_encryption_context->InitKey (key_buffer))) { + throw MiscError ("could not set up encryption context"); + } + + uint8_t cbc_buffer[ASDCP::CBC_BLOCK_SIZE]; + + if (ASDCP_FAILURE (_encryption_context->SetIVec (rng.FillRandom (cbc_buffer, ASDCP::CBC_BLOCK_SIZE)))) { + throw MiscError ("could not set up CBC initialization vector"); + } + } +} + +MXFAsset::~MXFAsset () +{ + delete _encryption_context; } void @@ -57,6 +85,15 @@ MXFAsset::fill_writer_info (ASDCP::WriterInfo* writer_info) const unsigned int c; Kumu::hex2bin (_uuid.c_str(), writer_info->AssetUUID, Kumu::UUID_Length, &c); assert (c == Kumu::UUID_Length); + + if (_encrypted) { + Kumu::GenRandomUUID (writer_info->ContextID); + writer_info->EncryptedEssence = true; + + unsigned int c; + Kumu::hex2bin (_key_id.c_str(), writer_info->CryptographicKeyID, Kumu::UUID_Length, &c); + assert (c == Kumu::UUID_Length); + } } bool diff --git a/src/mxf_asset.h b/src/mxf_asset.h index 03f2aa6b..e45ab2d7 100644 --- a/src/mxf_asset.h +++ b/src/mxf_asset.h @@ -23,6 +23,10 @@ #include <boost/signals2.hpp> #include "asset.h" +namespace ASDCP { + class AESEncContext; +} + namespace libdcp { @@ -36,8 +40,13 @@ public: * @param fps Frames per second. * @param entry_point The entry point of this MXF; ie the first frame that should be used. * @param length Length in frames. + * @param encrypted true if the MXF should be encrypted. */ - MXFAsset (std::string directory, std::string file_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length); + MXFAsset ( + std::string directory, std::string file_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length, bool encrypted + ); + + ~MXFAsset (); virtual bool equals (boost::shared_ptr<const Asset> other, EqualityOptions opt, std::list<std::string>& notes) const; @@ -56,6 +65,10 @@ protected: int _entry_point; /** Length in frames */ int _length; + bool _encrypted; + ASDCP::AESEncContext* _encryption_context; + std::string _key_value; + std::string _key_id; }; } diff --git a/src/picture_asset.cc b/src/picture_asset.cc index ef5d40d4..f2c489e7 100644 --- a/src/picture_asset.cc +++ b/src/picture_asset.cc @@ -46,8 +46,8 @@ using boost::dynamic_pointer_cast; using boost::lexical_cast; using namespace libdcp; -PictureAsset::PictureAsset (string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length) - : MXFAsset (directory, mxf_name, progress, fps, entry_point, length) +PictureAsset::PictureAsset (string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length, bool encrypted) + : MXFAsset (directory, mxf_name, progress, fps, entry_point, length, encrypted) , _width (0) , _height (0) { @@ -138,8 +138,9 @@ MonoPictureAsset::MonoPictureAsset ( int fps, int length, int width, - int height) - : PictureAsset (directory, mxf_name, progress, fps, 0, length) + int height, + bool encrypted) + : PictureAsset (directory, mxf_name, progress, fps, 0, length, encrypted) { _width = width; _height = height; @@ -154,8 +155,9 @@ MonoPictureAsset::MonoPictureAsset ( int fps, int length, int width, - int height) - : PictureAsset (directory, mxf_name, progress, fps, 0, length) + int height, + bool encrypted) + : PictureAsset (directory, mxf_name, progress, fps, 0, length, encrypted) { _width = width; _height = height; @@ -163,7 +165,7 @@ MonoPictureAsset::MonoPictureAsset ( } MonoPictureAsset::MonoPictureAsset (string directory, string mxf_name, int fps, int entry_point, int length) - : PictureAsset (directory, mxf_name, 0, fps, entry_point, length) + : PictureAsset (directory, mxf_name, 0, fps, entry_point, length, false) { ASDCP::JP2K::MXFReader reader; if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) { @@ -194,7 +196,7 @@ MonoPictureAsset::construct (boost::function<string (int)> get_path) ASDCP::WriterInfo writer_info; fill_writer_info (&writer_info); - + ASDCP::JP2K::MXFWriter mxf_writer; if (ASDCP_FAILURE (mxf_writer.OpenWrite (path().string().c_str(), writer_info, picture_desc))) { throw MXFFileError ("could not open MXF file for writing", path().string()); @@ -208,8 +210,7 @@ MonoPictureAsset::construct (boost::function<string (int)> get_path) throw FileError ("could not open JPEG2000 file for reading", path); } - /* XXX: passing 0 to WriteFrame ok? */ - if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, 0, 0))) { + if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, _encryption_context, 0))) { throw MiscError ("error in writing video MXF"); } @@ -363,7 +364,7 @@ PictureAsset::frame_buffer_equals ( StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int fps, int entry_point, int length) - : PictureAsset (directory, mxf_name, 0, fps, entry_point, length) + : PictureAsset (directory, mxf_name, 0, fps, entry_point, length, false) { ASDCP::JP2K::MXFSReader reader; if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) { diff --git a/src/picture_asset.h b/src/picture_asset.h index 08eb338a..53c62223 100644 --- a/src/picture_asset.h +++ b/src/picture_asset.h @@ -34,7 +34,9 @@ class StereoPictureFrame; class PictureAsset : public MXFAsset { public: - PictureAsset (std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length); + PictureAsset ( + std::string directory, std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int entry_point, int length, bool encrypted + ); /** Write details of this asset to a CPL stream. * @param s Stream. @@ -78,6 +80,7 @@ public: * @param length Length in frames. * @param width Width of images in pixels. * @param height Height of images in pixels. + * @param encrypted true if asset should be encrypted. */ MonoPictureAsset ( std::vector<std::string> const & files, @@ -87,7 +90,8 @@ public: int fps, int length, int width, - int height + int height, + bool encrypted ); /** Construct a PictureAsset, generating the MXF from the JPEG2000 files. @@ -100,6 +104,7 @@ public: * @param length Length in frames. * @param width Width of images in pixels. * @param height Height of images in pixels. + * @param encrypted true if asset should be encrypted. */ MonoPictureAsset ( boost::function<std::string (int)> get_path, @@ -109,7 +114,8 @@ public: int fps, int length, int width, - int height + int height, + bool encrypted ); MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int entry_point, int length); diff --git a/src/sound_asset.cc b/src/sound_asset.cc index e987239a..5e52da8e 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -42,9 +42,9 @@ using boost::lexical_cast; using namespace libdcp; SoundAsset::SoundAsset ( - vector<string> const & files, string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int length + vector<string> const & files, string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, int length, bool encrypted ) - : MXFAsset (directory, mxf_name, progress, fps, 0, length) + : MXFAsset (directory, mxf_name, progress, fps, 0, length, encrypted) , _channels (files.size ()) , _sampling_rate (0) { @@ -56,9 +56,9 @@ SoundAsset::SoundAsset ( string directory, string mxf_name, boost::signals2::signal<void (float)>* progress, - int fps, int length, int channels + int fps, int length, int channels, bool encrypted ) - : MXFAsset (directory, mxf_name, progress, fps, 0, length) + : MXFAsset (directory, mxf_name, progress, fps, 0, length, encrypted) , _channels (channels) , _sampling_rate (0) { @@ -66,7 +66,7 @@ SoundAsset::SoundAsset ( } SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int entry_point, int length) - : MXFAsset (directory, mxf_name, 0, fps, entry_point, length) + : MXFAsset (directory, mxf_name, 0, fps, entry_point, length, false) , _channels (0) { ASDCP::PCM::MXFReader reader; @@ -176,7 +176,7 @@ SoundAsset::construct (boost::function<string (Channel)> get_path) offset += sample_size; } - if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, 0, 0))) { + if (ASDCP_FAILURE (mxf_writer.WriteFrame (frame_buffer, _encryption_context, 0))) { throw MiscError ("could not write audio MXF frame"); } diff --git a/src/sound_asset.h b/src/sound_asset.h index 3189c067..4633b9a7 100644 --- a/src/sound_asset.h +++ b/src/sound_asset.h @@ -44,6 +44,7 @@ public: * @param progress Signal to inform of progress. * @param fps Frames per second. * @param length Length in frames. + * @param encrypted true if asset should be encrypted. */ SoundAsset ( std::vector<std::string> const & files, @@ -51,7 +52,8 @@ public: std::string mxf_name, boost::signals2::signal<void (float)>* progress, int fps, - int length + int length, + bool encrypted ); /** Construct a SoundAsset, generating the MXF from some WAV files. @@ -63,6 +65,7 @@ public: * @param fps Frames per second. * @param length Length in frames. * @param channels Number of audio channels. + * @param encrypted true if asset should be encrypted. */ SoundAsset ( boost::function<std::string (Channel)> get_path, @@ -71,7 +74,8 @@ public: boost::signals2::signal<void (float)>* progress, int fps, int length, - int channels + int channels, + bool encrypted ); SoundAsset ( diff --git a/test/ref/DCP/81fb54df-e1bf-4647-8788-ea7ba154375b_cpl.xml b/test/ref/DCP/81fb54df-e1bf-4647-8788-ea7ba154375b_cpl.xml deleted file mode 100644 index 59d50075..00000000 --- a/test/ref/DCP/81fb54df-e1bf-4647-8788-ea7ba154375b_cpl.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<CompositionPlaylist xmlns="http://www.smpte-ra.org/schemas/429-7/2006/CPL"> - <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id> - <AnnotationText>A Test DCP</AnnotationText> - <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> - <Creator>OpenDCP 0.0.25</Creator> - <ContentTitleText>A Test DCP</ContentTitleText> - <ContentKind>feature</ContentKind> - <ContentVersion> - <Id>urn:uri:81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</Id> - <LabelText>81fb54df-e1bf-4647-8788-ea7ba154375b_2012-07-17T04:45:18+00:00</LabelText> - </ContentVersion> - <RatingList/> - <ReelList> - <Reel> - <Id>urn:uuid:379fa64c-ad71-46cf-bef7-b45624006610</Id> - <AssetList> - <MainPicture> - <Id>urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71</Id> - <AnnotationText>video.mxf</AnnotationText> - <EditRate>24 1</EditRate> - <IntrinsicDuration>24</IntrinsicDuration> - <EntryPoint>0</EntryPoint> - <Duration>24</Duration> - <FrameRate>24 1</FrameRate> - <ScreenAspectRatio>32 32</ScreenAspectRatio> - </MainPicture> - <MainSound> - <Id>urn:uuid:c38bdd62-ce03-4988-8603-195f134207c7</Id> - <AnnotationText>audio.mxf</AnnotationText> - <EditRate>24 1</EditRate> - <IntrinsicDuration>24</IntrinsicDuration> - <EntryPoint>0</EntryPoint> - <Duration>24</Duration> - </MainSound> - </AssetList> - </Reel> - </ReelList> -</CompositionPlaylist> diff --git a/test/ref/DCP/ASSETMAP.xml b/test/ref/DCP/ASSETMAP.xml deleted file mode 100644 index defe18da..00000000 --- a/test/ref/DCP/ASSETMAP.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<AssetMap xmlns="http://www.smpte-ra.org/schemas/429-9/2007/AM"> - <Id>urn:uuid:b135d5cf-d180-43d8-b0b3-7373737b73bf</Id> - <Creator>OpenDCP 0.0.25</Creator> - <VolumeCount>1</VolumeCount> - <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> - <Issuer>OpenDCP 0.0.25</Issuer> - <AssetList> - <Asset> - <Id>urn:uuid:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb</Id> - <PackingList>true</PackingList> - <ChunkList> - <Chunk> - <Path>df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_pkl.xml</Path> - <VolumeIndex>1</VolumeIndex> - <Offset>0</Offset> - <Length>1049</Length> - </Chunk> - </ChunkList> - </Asset> - <Asset> - <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id> - <ChunkList> - <Chunk> - <Path>81fb54df-e1bf-4647-8788-ea7ba154375b_cpl.xml</Path> - <VolumeIndex>1</VolumeIndex> - <Offset>0</Offset> - <Length>1526</Length> - </Chunk> - </ChunkList> - </Asset> - <Asset> - <Id>urn:uuid:c38bdd62-ce03-4988-8603-195f134207c7</Id> - <ChunkList> - <Chunk> - <Path>audio.mxf</Path> - <VolumeIndex>1</VolumeIndex> - <Offset>0</Offset> - <Length>305326</Length> - </Chunk> - </ChunkList> - </Asset> - <Asset> - <Id>urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71</Id> - <ChunkList> - <Chunk> - <Path>video.mxf</Path> - <VolumeIndex>1</VolumeIndex> - <Offset>0</Offset> - <Length>26080</Length> - </Chunk> - </ChunkList> - </Asset> - </AssetList> -</AssetMap> diff --git a/test/ref/DCP/VOLINDEX.xml b/test/ref/DCP/VOLINDEX.xml deleted file mode 100644 index f66c004a..00000000 --- a/test/ref/DCP/VOLINDEX.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<VolumeIndex xmlns="http://www.smpte-ra.org/schemas/429-9/2007/AM"> - <Index>1</Index> -</VolumeIndex> diff --git a/test/ref/DCP/audio.mxf b/test/ref/DCP/audio.mxf Binary files differdeleted file mode 100644 index 9bc735af..00000000 --- a/test/ref/DCP/audio.mxf +++ /dev/null diff --git a/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_pkl.xml b/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_pkl.xml deleted file mode 100644 index 7a8ec697..00000000 --- a/test/ref/DCP/df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb_pkl.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<PackingList xmlns="http://www.smpte-ra.org/schemas/429-8/2007/PKL"> - <Id>urn:uuid:df0e4141-13c3-4a7a-bef8-b5a04fcbc4bb</Id> - <AnnotationText>A Test DCP</AnnotationText> - <IssueDate>2012-07-17T04:45:18+00:00</IssueDate> - <Issuer>OpenDCP 0.0.25</Issuer> - <Creator>OpenDCP 0.0.25</Creator> - <AssetList> - <Asset> - <Id>urn:uuid:c38bdd62-ce03-4988-8603-195f134207c7</Id> - <AnnotationText>audio.mxf</AnnotationText> - <Hash>+qImGHkt/XouNaJ1V/+7BtcB4VU=</Hash> - <Size>305326</Size> - <Type>application/mxf</Type> - </Asset> - <Asset> - <Id>urn:uuid:d36f4bb3-c4fa-4a95-9915-6fec3110cd71</Id> - <AnnotationText>video.mxf</AnnotationText> - <Hash>E2vhyxdJQhEzSQZdp31w84ZZpfk=</Hash> - <Size>26080</Size> - <Type>application/mxf</Type> - </Asset> - <Asset> - <Id>urn:uuid:81fb54df-e1bf-4647-8788-ea7ba154375b</Id> - <Hash>TTn7vvdUQi/G+KaW1Pym/DjxULM=</Hash> - <Size>1526</Size> - <Type>text/xml</Type> - </Asset> - </AssetList> -</PackingList> diff --git a/test/ref/DCP/video.mxf b/test/ref/DCP/video.mxf Binary files differdeleted file mode 100644 index 645fb85a..00000000 --- a/test/ref/DCP/video.mxf +++ /dev/null diff --git a/test/tests.cc b/test/tests.cc index ef25b7c8..a842fa4d 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -76,7 +76,8 @@ BOOST_AUTO_TEST_CASE (dcp_test) 24, 24, 32, - 32 + 32, + false )); shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( @@ -86,7 +87,8 @@ BOOST_AUTO_TEST_CASE (dcp_test) &(d.Progress), 24, 24, - 2 + 2, + false )); cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); @@ -97,12 +99,12 @@ BOOST_AUTO_TEST_CASE (dcp_test) BOOST_AUTO_TEST_CASE (error_test) { - libdcp::DCP d ("build/test/bar"); + libdcp::DCP d ("build/test/fred"); vector<string> p; p.push_back ("frobozz"); - BOOST_CHECK_THROW (new libdcp::MonoPictureAsset (p, "build/test/bar", "video.mxf", &d.Progress, 24, 24, 32, 32), libdcp::FileError); - BOOST_CHECK_THROW (new libdcp::SoundAsset (p, "build/test/bar", "audio.mxf", &d.Progress, 24, 24), libdcp::FileError); + BOOST_CHECK_THROW (new libdcp::MonoPictureAsset (p, "build/test/fred", "video.mxf", &d.Progress, 24, 24, 32, 32, false), libdcp::FileError); + BOOST_CHECK_THROW (new libdcp::SoundAsset (p, "build/test/fred", "audio.mxf", &d.Progress, 24, 24, false), libdcp::FileError); } BOOST_AUTO_TEST_CASE (read_dcp) @@ -579,3 +581,48 @@ BOOST_AUTO_TEST_CASE (color) BOOST_CHECK_EQUAL (c.to_argb_string(), "FF0000FF"); } + +BOOST_AUTO_TEST_CASE (encryption) +{ + Kumu::libdcp_test = true; + + libdcp::Metadata* t = libdcp::Metadata::instance (); + t->issuer = "OpenDCP 0.0.25"; + t->creator = "OpenDCP 0.0.25"; + t->company_name = "OpenDCP"; + t->product_name = "OpenDCP"; + t->product_version = "0.0.25"; + t->issue_date = "2012-07-17T04:45:18+00:00"; + boost::filesystem::remove_all ("build/test/bar"); + boost::filesystem::create_directories ("build/test/bar"); + libdcp::DCP d ("build/test/bar"); + shared_ptr<libdcp::CPL> cpl (new libdcp::CPL ("build/test/bar", "A Test DCP", libdcp::FEATURE, 24, 24)); + + shared_ptr<libdcp::MonoPictureAsset> mp (new libdcp::MonoPictureAsset ( + j2c, + "build/test/bar", + "video.mxf", + &d.Progress, + 24, + 24, + 32, + 32, + false + )); + + shared_ptr<libdcp::SoundAsset> ms (new libdcp::SoundAsset ( + wav, + "build/test/bar", + "audio.mxf", + &(d.Progress), + 24, + 24, + 2, + false + )); + + cpl->add_reel (shared_ptr<libdcp::Reel> (new libdcp::Reel (mp, ms, shared_ptr<libdcp::SubtitleAsset> ()))); + d.add_cpl (cpl); + + d.write_xml (); +} |
