31 #include "mono_picture_asset.h"
42 LIBDCP_DISABLE_WARNINGS
44 LIBDCP_ENABLE_WARNINGS
45 #include <boost/scoped_array.hpp>
59 if (
dcp.all_encrypted()) {
60 std::cout <<
"DCP is encrypted.\n";
61 }
else if (
dcp.any_encrypted()) {
62 std::cout <<
"DCP is partially encrypted.\n";
64 std::cout <<
"DCP is not encrypted.\n";
67 std::cout <<
"DCP has " <<
dcp.cpls().size() <<
" CPLs.\n";
68 auto assets =
dcp.assets ();
69 std::cout <<
"DCP has " << assets.size() <<
" assets.\n";
70 for (
auto i: assets) {
71 if (std::dynamic_pointer_cast<dcp::MonoPictureAsset>(i)) {
72 std::cout <<
"2D picture\n";
73 }
else if (std::dynamic_pointer_cast<dcp::StereoPictureAsset>(i)) {
74 std::cout <<
"3D picture\n";
75 }
else if (std::dynamic_pointer_cast<dcp::SoundAsset>(i)) {
76 std::cout <<
"Sound\n";
77 }
else if (std::dynamic_pointer_cast<dcp::SubtitleAsset>(i)) {
78 std::cout <<
"Subtitle\n";
79 }
else if (std::dynamic_pointer_cast<dcp::CPL>(i)) {
82 std::cout <<
"\t" << i->file()->leaf().string() <<
"\n";
86 auto cpl =
dcp.cpls().front();
89 auto picture_asset = std::dynamic_pointer_cast<dcp::MonoPictureAsset>(
90 cpl->reels()[0]->main_picture()->asset()
94 auto picture_asset_reader = picture_asset->start_read();
97 auto picture_frame_j2k = picture_asset_reader->get_frame(999);
100 auto picture_image_xyz = picture_frame_j2k->xyz_image ();
103 boost::scoped_array<uint8_t> rgba (
new uint8_t[picture_image_xyz->size().width * picture_image_xyz->size().height * 4]);
104 dcp::xyz_to_rgba (picture_image_xyz, dcp::ColourConversion::srgb_to_xyz(), rgba.get(), picture_image_xyz->size().width * 4);
106 Magick::Image image (picture_image_xyz->size().width, picture_image_xyz->size().height,
"BGRA", Magick::CharPixel, rgba.get ());
107 image.write (
"frame.png");
A class to create or read a DCP.
MonoPictureAssetReader typedef.
Namespace for everything in libdcp.
void xyz_to_rgba(std::shared_ptr< const OpenJPEGImage >, ColourConversion const &conversion, uint8_t *rgba, int stride)
Conversion between RGB and XYZ.
StereoPictureAsset class.