42 LIBDCP_DISABLE_WARNINGS
44 LIBDCP_ENABLE_WARNINGS
55 Magick::InitializeMagick(
nullptr);
62 if (
dcp.all_encrypted()) {
63 std::cout <<
"DCP is encrypted.\n";
64 }
else if (
dcp.any_encrypted()) {
65 std::cout <<
"DCP is partially encrypted.\n";
67 std::cout <<
"DCP is not encrypted.\n";
70 std::cout <<
"DCP has " <<
dcp.cpls().size() <<
" CPLs.\n";
71 auto assets =
dcp.assets();
72 std::cout <<
"DCP has " << assets.size() <<
" assets.\n";
73 for (
auto i: assets) {
74 if (std::dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(i)) {
75 std::cout <<
"2D picture\n";
76 }
else if (std::dynamic_pointer_cast<dcp::StereoJ2KPictureAsset>(i)) {
77 std::cout <<
"3D picture\n";
78 }
else if (std::dynamic_pointer_cast<dcp::SoundAsset>(i)) {
79 std::cout <<
"Sound\n";
80 }
else if (std::dynamic_pointer_cast<dcp::TextAsset>(i)) {
81 std::cout <<
"Subtitle/caption\n";
82 }
else if (std::dynamic_pointer_cast<dcp::CPL>(i)) {
85 std::cout <<
"\t" << i->file()->leaf().string() <<
"\n";
89 auto cpl =
dcp.cpls().front();
92 auto picture_asset = std::dynamic_pointer_cast<dcp::MonoJ2KPictureAsset>(
93 cpl->reels()[0]->main_picture()->asset()
97 auto picture_asset_reader = picture_asset->start_read();
100 auto picture_frame_j2k = picture_asset_reader->get_frame(999);
103 auto picture_image_xyz = picture_frame_j2k->xyz_image();
106 std::vector<uint8_t> rgba(picture_image_xyz->size().width * picture_image_xyz->size().height * 4);
107 dcp::xyz_to_rgba(picture_image_xyz, dcp::ColourConversion::srgb_to_xyz(), rgba.data(), picture_image_xyz->size().width * 4);
109 Magick::Image image(picture_image_xyz->size().width, picture_image_xyz->size().height,
"BGRA", Magick::CharPixel, rgba.data());
110 image.write(
"frame.png");
A class to create or read a DCP.
MonoJ2KPictureAsset class.
MonoJ2KPictureAssetReader typedef.
MonoJ2KPictureFrame class.
Namespace for everything in libdcp.
void init(boost::optional< boost::filesystem::path > resources_directory=boost::optional< boost::filesystem::path >())
void xyz_to_rgba(std::shared_ptr< const OpenJPEGImage >, ColourConversion const &conversion, uint8_t *rgba, int stride)
Conversion between RGB and XYZ.
StereoJ2KPictureAsset class.