X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=tools%2Fdcpinfo.cc;h=c85198587947ce876f73bbace97ccafae09a7af4;hb=f8882632e7f2968f97f551615da3e8403a398992;hp=3d5c2109066566d755a7221977808c1fcd6b9ed3;hpb=4d6c8aaf0167cde3bb63e9014604243bdc47b1a1;p=libdcp.git diff --git a/tools/dcpinfo.cc b/tools/dcpinfo.cc index 3d5c2109..c8519858 100644 --- a/tools/dcpinfo.cc +++ b/tools/dcpinfo.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2020 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of libdcp. @@ -52,7 +52,6 @@ #include "compose.hpp" #include #include -#include #include #include #include @@ -69,8 +68,8 @@ using std::max; using std::exception; using std::vector; using std::stringstream; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; +using std::shared_ptr; +using std::dynamic_pointer_cast; using boost::optional; using namespace dcp; @@ -88,7 +87,7 @@ help (string n) cerr << "--only takes a comma-separated list of strings, one or more of:\n" " dcp-path DCP path\n" - " cpl-name CPL name\n" + " cpl-name-id CPL name and ID\n" " picture picture information\n" " sound sound information\n" " subtitle picture information\n" @@ -101,16 +100,16 @@ mbits_per_second (int size, Fraction frame_rate) return size * 8 * frame_rate.as_float() / 1e6; } -#define OUTPUT_DCP_PATH(...) maybe_output(only, "dcp-path", String::compose(__VA_ARGS__)); -#define OUTPUT_CPL_NAME(...) maybe_output(only, "cpl-name", String::compose(__VA_ARGS__)); -#define OUTPUT_PICTURE(...) maybe_output(only, "picture", String::compose(__VA_ARGS__)); -#define OUTPUT_PICTURE_NC(x) maybe_output(only, "picture", (x)); -#define SHOULD_PICTURE should_output(only, "picture") -#define OUTPUT_SOUND(...) maybe_output(only, "sound", String::compose(__VA_ARGS__)); -#define OUTPUT_SOUND_NC(x) maybe_output(only, "sound", (x)); -#define OUTPUT_SUBTITLE(...) maybe_output(only, "subtitle", String::compose(__VA_ARGS__)); -#define OUTPUT_SUBTITLE_NC(x) maybe_output(only, "subtitle", (x)); -#define OUTPUT_TOTAL_TIME(...) maybe_output(only, "total-time", String::compose(__VA_ARGS__)); +#define OUTPUT_DCP_PATH(...) maybe_output(only, "dcp-path", String::compose(__VA_ARGS__)); +#define OUTPUT_CPL_NAME_ID(...) maybe_output(only, "cpl-name-id", String::compose(__VA_ARGS__)); +#define OUTPUT_PICTURE(...) maybe_output(only, "picture", String::compose(__VA_ARGS__)); +#define OUTPUT_PICTURE_NC(x) maybe_output(only, "picture", (x)); +#define SHOULD_PICTURE should_output(only, "picture") +#define OUTPUT_SOUND(...) maybe_output(only, "sound", String::compose(__VA_ARGS__)); +#define OUTPUT_SOUND_NC(x) maybe_output(only, "sound", (x)); +#define OUTPUT_SUBTITLE(...) maybe_output(only, "subtitle", String::compose(__VA_ARGS__)); +#define OUTPUT_SUBTITLE_NC(x) maybe_output(only, "subtitle", (x)); +#define OUTPUT_TOTAL_TIME(...) maybe_output(only, "total-time", String::compose(__VA_ARGS__)); static bool should_output(vector const& only, string t) @@ -143,7 +142,7 @@ main_picture (vector const& only, shared_ptr reel, bool analyse, b OUTPUT_PICTURE( " duration %1 (%2) intrinsic %3", *mp->duration(), - dcp::Time(*mp->duration(), mp->frame_rate().as_float(), mp->frame_rate().as_float()).as_string(dcp::SMPTE), + dcp::Time(*mp->duration(), mp->frame_rate().as_float(), mp->frame_rate().as_float()).as_string(dcp::Standard::SMPTE), mp->intrinsic_duration() ); } else { @@ -162,10 +161,10 @@ main_picture (vector const& only, shared_ptr reel, bool analyse, b for (int64_t i = 0; i < ma->intrinsic_duration(); ++i) { shared_ptr frame = reader->get_frame (i); if (SHOULD_PICTURE) { - printf("Frame %" PRId64 " J2K size %7d", i, frame->j2k_size()); + printf("Frame %" PRId64 " J2K size %7d", i, frame->size()); } - j2k_size_range.first = min(j2k_size_range.first, frame->j2k_size()); - j2k_size_range.second = max(j2k_size_range.second, frame->j2k_size()); + j2k_size_range.first = min(j2k_size_range.first, frame->size()); + j2k_size_range.second = max(j2k_size_range.second, frame->size()); if (decompress) { try { @@ -248,7 +247,7 @@ main_subtitle (vector const& only, shared_ptr reel, bool list_subt OUTPUT_SUBTITLE(" Subtitle ID: %1", ms->id()); if (ms->asset_ref().resolved()) { - list > subs = ms->asset()->subtitles (); + auto subs = ms->asset()->subtitles (); OUTPUT_SUBTITLE("\n Subtitle: %1 subtitles", subs.size()); shared_ptr iop = dynamic_pointer_cast (ms->asset()); if (iop) { @@ -259,14 +258,14 @@ main_subtitle (vector const& only, shared_ptr reel, bool list_subt OUTPUT_SUBTITLE(" in %1\n", smpte->language().get()); } if (list_subtitles) { - BOOST_FOREACH (shared_ptr k, subs) { - shared_ptr ks = dynamic_pointer_cast (k); + for (auto k: subs) { + auto ks = dynamic_pointer_cast(k); if (ks) { stringstream s; s << *ks; OUTPUT_SUBTITLE("%1\n", s.str()); } - shared_ptr is = dynamic_pointer_cast (k); + auto is = dynamic_pointer_cast(k); if (is) { stringstream s; s << *is; @@ -283,6 +282,8 @@ main_subtitle (vector const& only, shared_ptr reel, bool list_subt int main (int argc, char* argv[]) { + dcp::init (); + bool subtitles = false; bool picture = false; bool decompress = false; @@ -358,10 +359,10 @@ main (int argc, char* argv[]) only = boost::split(only, *only_string, boost::is_any_of(",")); } - list > cpls; + vector > cpls; if (boost::filesystem::is_directory(argv[optind])) { DCP* dcp = 0; - list notes; + vector notes; try { dcp = new DCP (argv[optind]); dcp->read (¬es); @@ -382,7 +383,7 @@ main (int argc, char* argv[]) OUTPUT_DCP_PATH("DCP: %1\n", boost::filesystem::path(argv[optind]).string()); dcp::filter_notes (notes, ignore_missing_assets); - BOOST_FOREACH (dcp::VerificationNote i, notes) { + for (auto i: notes) { cerr << "Error: " << note_to_string(i) << "\n"; } @@ -394,11 +395,11 @@ main (int argc, char* argv[]) dcp::Time total_time; - BOOST_FOREACH (shared_ptr i, cpls) { - OUTPUT_CPL_NAME(" CPL: %1\n", i->annotation_text()); + for (auto i: cpls) { + OUTPUT_CPL_NAME_ID(" CPL: %1 %2\n", i->annotation_text().get_value_or(""), i->id()); int R = 1; - BOOST_FOREACH (shared_ptr j, i->reels()) { + for (auto j: i->reels()) { if (should_output(only, "picture") || should_output(only, "sound") || should_output(only, "subtitle")) { cout << " Reel " << R << "\n"; } @@ -431,7 +432,7 @@ main (int argc, char* argv[]) } } - OUTPUT_TOTAL_TIME("Total: %1\n", total_time.as_string(dcp::SMPTE)); + OUTPUT_TOTAL_TIME("Total: %1\n", total_time.as_string(dcp::Standard::SMPTE)); return 0; }