Small fixes.
[libdcp.git] / tools / dcpinfo.cc
index 119a2106c27e44e4a08a8a9aed32a8032c0a2f9e..bd74387b35f1272a72aad745243591bb1f448bc4 100644 (file)
 #include "dcp.h"
 #include "exceptions.h"
 #include "reel.h"
-#include "sound_mxf.h"
-#include "picture_mxf.h"
+#include "sound_asset.h"
+#include "picture_asset.h"
 #include "subtitle_asset.h"
 #include "reel_picture_asset.h"
 #include "reel_sound_asset.h"
 #include "reel_subtitle_asset.h"
 #include "subtitle_string.h"
+#include "interop_subtitle_asset.h"
+#include "smpte_subtitle_asset.h"
 #include "cpl.h"
 #include "common.h"
 #include <getopt.h>
@@ -40,6 +42,7 @@ using std::cerr;
 using std::cout;
 using std::list;
 using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
 using namespace dcp;
 
 static void
@@ -54,22 +57,22 @@ help (string n)
 static void
 main_picture (shared_ptr<Reel> reel)
 {
-       if (reel->main_picture() && reel->main_picture()->mxf()) {
+       if (reel->main_picture() && reel->main_picture()->asset()) {
                cout << "      Picture:  "
-                    << reel->main_picture()->mxf()->size().width
+                    << reel->main_picture()->asset()->size().width
                     << "x"
-                    << reel->main_picture()->mxf()->size().height << "\n";
+                    << reel->main_picture()->asset()->size().height << "\n";
        }
 }
 
 static void
 main_sound (shared_ptr<Reel> reel)
 {
-       if (reel->main_sound() && reel->main_sound()->mxf()) {
+       if (reel->main_sound() && reel->main_sound()->asset()) {
                cout << "      Sound:    "
-                    << reel->main_sound()->mxf()->channels()
+                    << reel->main_sound()->asset()->channels()
                     << " channels at "
-                    << reel->main_sound()->mxf()->sampling_rate() << "Hz\n";
+                    << reel->main_sound()->asset()->sampling_rate() << "Hz\n";
        }
 }
 
@@ -79,9 +82,17 @@ main_subtitle (shared_ptr<Reel> reel, bool list_subtitles)
        if (!reel->main_subtitle()) {
                return;
        }
-       
+
        list<SubtitleString> subs = reel->main_subtitle()->subtitle_asset()->subtitles ();
-       cout << "      Subtitle: " << subs.size() << " subtitles in " << reel->main_subtitle()->subtitle_asset()->language() << "\n";
+       cout << "      Subtitle: " << subs.size() << " subtitles";
+       shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (reel->main_subtitle()->subtitle_asset());
+       if (iop) {
+               cout << " in " << iop->language() << "\n";
+       }
+       shared_ptr<SMPTESubtitleAsset> smpte = dynamic_pointer_cast<SMPTESubtitleAsset> (reel->main_subtitle()->subtitle_asset());
+       if (smpte && smpte->language ()) {
+               cout << " in " << smpte->language().get() << "\n";
+       }
        if (list_subtitles) {
                BOOST_FOREACH (SubtitleString const& k, subs) {
                        cout << k << "\n";
@@ -95,7 +106,7 @@ main (int argc, char* argv[])
        bool subtitles = false;
        bool keep_going = false;
        bool ignore_missing_assets = false;
-       
+
        int option_index = 0;
        while (1) {
                static struct option long_options[] = {
@@ -154,7 +165,7 @@ main (int argc, char* argv[])
                cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << "\n";
                exit (EXIT_FAILURE);
        }
-       
+
        cout << "DCP: " << boost::filesystem::path(argv[optind]).filename().string() << "\n";
 
        dcp::filter_errors (errors, ignore_missing_assets);
@@ -166,7 +177,7 @@ main (int argc, char* argv[])
 
        for (list<shared_ptr<CPL> >::iterator i = cpls.begin(); i != cpls.end(); ++i) {
                cout << "  CPL: " << (*i)->annotation_text() << "\n";
-               
+
                list<shared_ptr<Reel> > reels = (*i)->reels ();
 
                int R = 1;