Tags -> Metadata
authorCarl Hetherington <cth@carlh.net>
Tue, 17 Jul 2012 22:46:20 +0000 (23:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 17 Jul 2012 22:46:20 +0000 (23:46 +0100)
src/asset.cc
src/dcp.cc
src/metadata.cc [new file with mode: 0644]
src/metadata.h [new file with mode: 0644]
src/tags.cc [deleted file]
src/tags.h [deleted file]
src/wscript
test/tests.cc

index 4a111a19d3fe20696469046ff013dc7531ddecf1..5133907160fc774999dd375b90a4201043bea167 100644 (file)
@@ -27,7 +27,7 @@
 #include "KM_util.h"
 #include "asset.h"
 #include "util.h"
-#include "tags.h"
+#include "metadata.h"
 
 using namespace std;
 using namespace boost;
@@ -74,9 +74,9 @@ Asset::write_to_assetmap (ostream& s) const
 void
 Asset::fill_writer_info (ASDCP::WriterInfo* writer_info) const
 {
-       writer_info->ProductVersion = Tags::instance()->product_version;
-       writer_info->CompanyName = Tags::instance()->company_name;
-       writer_info->ProductName = Tags::instance()->product_name.c_str();
+       writer_info->ProductVersion = Metadata::instance()->product_version;
+       writer_info->CompanyName = Metadata::instance()->company_name;
+       writer_info->ProductName = Metadata::instance()->product_name.c_str();
 
        writer_info->LabelSetType = ASDCP::LS_MXF_SMPTE;
        unsigned int c;
index efeafb12a75885f10cc30990a7ac72f1594b1925..ca2a2d143e933fb188957f4e7b8f0a8967dfe5bb 100644 (file)
@@ -27,7 +27,7 @@
 #include "sound_asset.h"
 #include "picture_asset.h"
 #include "util.h"
-#include "tags.h"
+#include "metadata.h"
 
 using namespace std;
 using namespace boost;
@@ -90,13 +90,13 @@ DCP::write_cpl (string cpl_uuid) const
            << "<CompositionPlaylist xmlns=\"http://www.smpte-ra.org/schemas/429-7/2006/CPL\">\n"
            << "  <Id>urn:uuid:" << cpl_uuid << "</Id>\n"
            << "  <AnnotationText>" << _name << "</AnnotationText>\n"
-           << "  <IssueDate>" << Tags::instance()->issue_date << "</IssueDate>\n"
-           << "  <Creator>" << Tags::instance()->creator << "</Creator>\n"
+           << "  <IssueDate>" << Metadata::instance()->issue_date << "</IssueDate>\n"
+           << "  <Creator>" << Metadata::instance()->creator << "</Creator>\n"
            << "  <ContentTitleText>" << _name << "</ContentTitleText>\n"
            << "  <ContentKind>" << content_type_string (_content_type) << "</ContentKind>\n"
            << "  <ContentVersion>\n"
-           << "    <Id>urn:uri:" << cpl_uuid << "_" << Tags::instance()->issue_date << "</Id>\n"
-           << "    <LabelText>" << cpl_uuid << "_" << Tags::instance()->issue_date << "</LabelText>\n"
+           << "    <Id>urn:uri:" << cpl_uuid << "_" << Metadata::instance()->issue_date << "</Id>\n"
+           << "    <LabelText>" << cpl_uuid << "_" << Metadata::instance()->issue_date << "</LabelText>\n"
            << "  </ContentVersion>\n"
            << "  <RatingList/>\n"
            << "  <ReelList>\n";
@@ -131,9 +131,9 @@ DCP::write_pkl (string pkl_uuid, string cpl_uuid, string cpl_digest, int cpl_len
            << "<PackingList xmlns=\"http://www.smpte-ra.org/schemas/429-8/2007/PKL\">\n"
            << "  <Id>urn:uuid:" << pkl_uuid << "</Id>\n"
            << "  <AnnotationText>" << _name << "</AnnotationText>\n"
-           << "  <IssueDate>" << Tags::instance()->issue_date << "</IssueDate>\n"
-           << "  <Issuer>" << Tags::instance()->issuer << "</Issuer>\n"
-           << "  <Creator>" << Tags::instance()->creator << "</Creator>\n"
+           << "  <IssueDate>" << Metadata::instance()->issue_date << "</IssueDate>\n"
+           << "  <Issuer>" << Metadata::instance()->issuer << "</Issuer>\n"
+           << "  <Creator>" << Metadata::instance()->creator << "</Creator>\n"
            << "  <AssetList>\n";
 
        for (list<shared_ptr<Asset> >::const_iterator i = _assets.begin(); i != _assets.end(); ++i) {
@@ -178,10 +178,10 @@ DCP::write_assetmap (string cpl_uuid, int cpl_length, string pkl_uuid, int pkl_l
        am << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
           << "<AssetMap xmlns=\"http://www.smpte-ra.org/schemas/429-9/2007/AM\">\n"
           << "  <Id>urn:uuid:" << make_uuid() << "</Id>\n"
-          << "  <Creator>" << Tags::instance()->creator << "</Creator>\n"
+          << "  <Creator>" << Metadata::instance()->creator << "</Creator>\n"
           << "  <VolumeCount>1</VolumeCount>\n"
-          << "  <IssueDate>" << Tags::instance()->issue_date << "</IssueDate>\n"
-          << "  <Issuer>" << Tags::instance()->issuer << "</Issuer>\n"
+          << "  <IssueDate>" << Metadata::instance()->issue_date << "</IssueDate>\n"
+          << "  <Issuer>" << Metadata::instance()->issuer << "</Issuer>\n"
           << "  <AssetList>\n";
 
        am << "    <Asset>\n"
diff --git a/src/metadata.cc b/src/metadata.cc
new file mode 100644 (file)
index 0000000..797d645
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "metadata.h"
+
+using namespace std;
+using namespace libdcp;
+
+Metadata* Metadata::_instance = 0;
+
+/** Construct a Metadata object with some default values */
+Metadata::Metadata ()
+       : company_name ("libdcp")
+       , product_name ("libdcp")
+       , product_version (LIBDCP_VERSION)
+       , issuer ("libdcp" LIBDCP_VERSION)
+       , creator ("libdcp" LIBDCP_VERSION)
+{
+       char buffer[64];
+       time_t now;
+       time (&now);
+       struct tm* tm = localtime (&now);
+       strftime (buffer, 64, "%Y-%m-%dT%I:%M:%S+00:00", tm);
+       issue_date = string (buffer);
+}
+
+/** @return Singleton Metadata instance */
+Metadata *
+Metadata::instance ()
+{
+       if (_instance == 0) {
+               _instance = new Metadata;
+       }
+
+       return _instance;
+}
+               
diff --git a/src/metadata.h b/src/metadata.h
new file mode 100644 (file)
index 0000000..7660c4d
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <string>
+
+namespace libdcp
+{
+
+/** A class to hold various metadata that will be written
+ *  to the DCP.  The values are initialised, and can be modified
+ *  if desired.
+ */
+class Metadata
+{
+public:
+       static Metadata* instance ();
+
+       std::string company_name;
+       std::string product_name;
+       std::string product_version;
+       std::string issuer;
+       std::string creator;
+       std::string issue_date;
+
+private:
+       Metadata ();
+
+       /** Singleton instance of Metadata */
+       static Metadata* _instance;
+};
+
+}
diff --git a/src/tags.cc b/src/tags.cc
deleted file mode 100644 (file)
index 0adc63c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "tags.h"
-
-using namespace std;
-using namespace libdcp;
-
-Tags* Tags::_instance = 0;
-
-/** Construct a Tags object with some default values */
-Tags::Tags ()
-       : company_name ("libdcp")
-       , product_name ("libdcp")
-       , product_version (LIBDCP_VERSION)
-       , issuer ("libdcp" LIBDCP_VERSION)
-       , creator ("libdcp" LIBDCP_VERSION)
-{
-       char buffer[64];
-       time_t now;
-       time (&now);
-       struct tm* tm = localtime (&now);
-       strftime (buffer, 64, "%Y-%m-%dT%I:%M:%S+00:00", tm);
-       issue_date = string (buffer);
-}
-
-/** @return Singleton Tags instance */
-Tags *
-Tags::instance ()
-{
-       if (_instance == 0) {
-               _instance = new Tags;
-       }
-
-       return _instance;
-}
-               
diff --git a/src/tags.h b/src/tags.h
deleted file mode 100644 (file)
index b82fef6..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <string>
-
-namespace libdcp
-{
-
-/** A class to hold various metadata that will be written
- *  to the DCP.  The values are initialised, and can be modified
- *  if desired.
- */
-class Tags
-{
-public:
-       static Tags* instance ();
-
-       std::string company_name;
-       std::string product_name;
-       std::string product_version;
-       std::string issuer;
-       std::string creator;
-       std::string issue_date;
-
-private:
-       Tags ();
-
-       /** Singleton instance of Tags */
-       static Tags* _instance;
-};
-
-}
index df41cb2c3830f51e41e8d8886f0db2376e79d0d1..7417dee55a1ddfef587d3b9eb1465f6f1bc73b15 100644 (file)
@@ -11,11 +11,12 @@ def build(bld):
                  sound_asset.cc
                  picture_asset.cc
                  util.cc
-                 tags.cc
+                 metadata.cc
                  """
 
     headers = """
               dcp.h
+              metadata.h
               """
 
     bld.install_files('${PREFIX}/include/libdcp', headers)
index 41811b1ee8417f17c2d0ac40c698d565aba9091c..7d60f70e5d159b4c09797369db87a2e295364972 100644 (file)
@@ -21,7 +21,7 @@
 #include "KM_prng.h"
 #include "dcp.h"
 #include "util.h"
-#include "tags.h"
+#include "metadata.h"
 
 #define BOOST_TEST_DYN_LINK
 #define BOOST_TEST_MODULE libdcp_test
@@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE (dcp_test)
 {
        Kumu::libdcp_test = true;
        
-       libdcp::Tags* t = libdcp::Tags::instance ();
+       libdcp::Metadata* t = libdcp::Metadata::instance ();
        t->issuer = "OpenDCP 0.0.25";
        t->creator = "OpenDCP 0.0.25";
        t->company_name = "OpenDCP";