From 2194158985f9c1300ffe24c7c6fb786cb39bbdb5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 17 Jul 2012 23:46:20 +0100 Subject: Tags -> Metadata --- src/asset.cc | 8 ++++---- src/dcp.cc | 22 +++++++++++----------- src/metadata.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/metadata.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/tags.cc | 53 ----------------------------------------------------- src/tags.h | 48 ------------------------------------------------ src/wscript | 3 ++- 7 files changed, 118 insertions(+), 117 deletions(-) create mode 100644 src/metadata.cc create mode 100644 src/metadata.h delete mode 100644 src/tags.cc delete mode 100644 src/tags.h (limited to 'src') diff --git a/src/asset.cc b/src/asset.cc index 4a111a19..51339071 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -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; diff --git a/src/dcp.cc b/src/dcp.cc index efeafb12..ca2a2d14 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -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 << "\n" << " urn:uuid:" << cpl_uuid << "\n" << " " << _name << "\n" - << " " << Tags::instance()->issue_date << "\n" - << " " << Tags::instance()->creator << "\n" + << " " << Metadata::instance()->issue_date << "\n" + << " " << Metadata::instance()->creator << "\n" << " " << _name << "\n" << " " << content_type_string (_content_type) << "\n" << " \n" - << " urn:uri:" << cpl_uuid << "_" << Tags::instance()->issue_date << "\n" - << " " << cpl_uuid << "_" << Tags::instance()->issue_date << "\n" + << " urn:uri:" << cpl_uuid << "_" << Metadata::instance()->issue_date << "\n" + << " " << cpl_uuid << "_" << Metadata::instance()->issue_date << "\n" << " \n" << " \n" << " \n"; @@ -131,9 +131,9 @@ DCP::write_pkl (string pkl_uuid, string cpl_uuid, string cpl_digest, int cpl_len << "\n" << " urn:uuid:" << pkl_uuid << "\n" << " " << _name << "\n" - << " " << Tags::instance()->issue_date << "\n" - << " " << Tags::instance()->issuer << "\n" - << " " << Tags::instance()->creator << "\n" + << " " << Metadata::instance()->issue_date << "\n" + << " " << Metadata::instance()->issuer << "\n" + << " " << Metadata::instance()->creator << "\n" << " \n"; for (list >::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 << "\n" << "\n" << " urn:uuid:" << make_uuid() << "\n" - << " " << Tags::instance()->creator << "\n" + << " " << Metadata::instance()->creator << "\n" << " 1\n" - << " " << Tags::instance()->issue_date << "\n" - << " " << Tags::instance()->issuer << "\n" + << " " << Metadata::instance()->issue_date << "\n" + << " " << Metadata::instance()->issuer << "\n" << " \n"; am << " \n" diff --git a/src/metadata.cc b/src/metadata.cc new file mode 100644 index 00000000..797d645d --- /dev/null +++ b/src/metadata.cc @@ -0,0 +1,53 @@ +/* + Copyright (C) 2012 Carl Hetherington + + 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 index 00000000..7660c4dd --- /dev/null +++ b/src/metadata.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2012 Carl Hetherington + + 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 + +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 index 0adc63c8..00000000 --- a/src/tags.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - 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 index b82fef61..00000000 --- a/src/tags.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - 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 - -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; -}; - -} diff --git a/src/wscript b/src/wscript index df41cb2c..7417dee5 100644 --- a/src/wscript +++ b/src/wscript @@ -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) -- cgit v1.2.3