Bits of tidying; comments.
authorCarl Hetherington <cth@carlh.net>
Fri, 5 Jun 2015 18:14:54 +0000 (19:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 5 Jun 2015 18:14:54 +0000 (19:14 +0100)
src/dcp_time.cc
src/dcp_time.h
src/interop_subtitle_asset.h
src/reel_sound_asset.h
src/reel_stereo_picture_asset.h
src/smpte_subtitle_asset.cc
src/smpte_subtitle_asset.h
src/sound_frame.h

index 5d9bed81b4deacb80669d5ee34c1b8b1fa547c7f..43c1ee4962615d01a9005a9fc288849cff95b4db 100644 (file)
@@ -38,11 +38,22 @@ Time::Time (int frame, int frames_per_second, int tcr_)
        set (double (frame) / frames_per_second, tcr_);
 }
 
+/** Construct a Time with a timecode rate of 24 and using the supplied
+ *  number of seconds.
+ *
+ *  @param seconds A number of seconds.
+ */
 Time::Time (double seconds)
 {
        set (seconds, 24);
 }
 
+/** Construct a Time with specified timecode rate and using the supplied
+ *  number of seconds.
+ *
+ *  @param seconds A number of seconds.
+ *  @param tcr_ Timecode rate to use.
+ */
 void
 Time::set (double seconds, int tcr_)
 {
@@ -66,7 +77,7 @@ Time::set (double seconds, int tcr_)
        }
 }
 
-/** @param time String of the form HH:MM:SS:EE */
+/** @param time String of the form HH:MM:SS:EE[E] */
 Time::Time (string time, int tcr_)
        : tcr (tcr_)
 {
@@ -251,18 +262,26 @@ Time::as_string () const
        return str.str ();
 }
 
+/** @param tcr_ Timecode rate with which the return value should be counted.
+ *  @return the total number of editable units that this time consists of at the specified timecode rate.
+ *  For example, as_editable_units (24) returns the total time in frames at 24fps.
+ */
 int64_t
 Time::as_editable_units (int tcr_) const
 {
        return (int64_t(e) * float (tcr_ / tcr)) + int64_t(s) * tcr_ + int64_t(m) * 60 * tcr_ + int64_t(h) * 60 * 60 * tcr_;
 }
 
+/** @return the total number of seconds that this time consists of */
 double
 Time::as_seconds () const
 {
        return h * 3600 + m * 60 + s + double(e) / tcr;
 }
 
+/** @param tcr_ New timecode rate.
+ *  @return A new Time which is this time at the spcified new timecode rate.
+ */
 Time
 Time::rebase (int tcr_) const
 {
index 4e5057383283a51b4f0da502f4d335ecea90045f..c5d0186e4cf88ab0614924c82f7208a9a458b211 100644 (file)
@@ -33,10 +33,10 @@ namespace dcp {
 /** @class Time
  *  @brief A representation of time within a DCP.
  */
-       
 class Time
 {
 public:
+       /** Construct a zero Time */
        Time () : h (0), m (0), s (0), e (0), tcr (1) {}
 
        /** Construct a Time from a frame index (starting from 0),
index 2a1fae7f7300a66feb30ab1a81a0e93d5f51b1d7..5635042179eadec8f27a19f8ebcc2e220bf7d61e 100644 (file)
 
 */
 
+/** @file  src/interop_subtitle_asset.h
+ *  @brief InteropSubtitleAsset class.
+ */
+
 #include "subtitle_asset.h"
 #include <boost/filesystem.hpp>
 
@@ -24,6 +28,11 @@ namespace dcp {
 
 class InteropLoadFontNode;
 
+/** @class InteropSubtitleAsset
+ *  @brief A set of subtitles to be read and/or written in the Inter-Op format.
+ *
+ *  Inter-Op subtitles are sometimes known as CineCanvas.
+ */
 class InteropSubtitleAsset : public SubtitleAsset
 {
 public:
@@ -43,26 +52,39 @@ public:
        Glib::ustring xml_as_string () const;
        void write (boost::filesystem::path path) const;
 
+       /** Set the reel number or sub-element identifier
+        *  of these subtitles.
+        *  @param n New reel number.
+        */
        void set_reel_number (std::string n) {
                _reel_number = n;
        }
 
+       /** Set the language tag of these subtitles.
+        *  @param l New language.
+        */
        void set_language (std::string l) {
                _language = l;
        }
 
+       /** @return title of the movie that the subtitles are for */
        void set_movie_title (std::string m) {
                _movie_title = m;
        }
 
+       /** @return reel number or sub-element of a programme that
+        *  these subtitles refer to.
+        */
        std::string reel_number () const {
                return _reel_number;
        }
-       
+
+       /** @return language used in the subtitles */
        std::string language () const {
                return _language;
        }
 
+       /** @return movie title that these subtitles are for */
        std::string movie_title () const {
                return _movie_title;
        }
index e7358bd0fbc583d05f3adea7f3f14f0a5fc81355..9767307a787a097a925ac97e3b0d04055c2f9a93 100644 (file)
@@ -30,7 +30,7 @@
 namespace dcp {
 
 /** @class ReelSoundAsset
- *  @brief Part of a Reel's description which refers to a sound MXF.
+ *  @brief Part of a Reel's description which refers to a sound asset.
  */
 class ReelSoundAsset : public ReelAsset, public ReelMXF
 {
index df939a9c7fba837d672f342781a6b06af182f185..07d31a03a1e3ff7dcab895f2e8bd8955e859e91e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2015 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
@@ -31,7 +31,7 @@ namespace dcp {
 class StereoPictureAsset;      
 
 /** @class ReelStereoPictureAsset
- *  @brief Part of a Reel's description which refers to a stereoscopic picture MXF.
+ *  @brief Part of a Reel's description which refers to a stereoscopic picture asset.
  */
 class ReelStereoPictureAsset : public ReelPictureAsset
 {
index a81b84eb4032adc2a98c491e388875b19c9c441a..eef28e510ca5e4c8a2091e41ffa4928aafcc113a 100644 (file)
 
 */
 
+/** @file  src/smpte_subtitle_asset.cc
+ *  @brief SMPTESubtitleAsset class.
+ */
+
 #include "smpte_subtitle_asset.h"
 #include "smpte_load_font_node.h"
 #include "font_node.h"
@@ -39,6 +43,10 @@ using boost::split;
 using boost::is_any_of;
 using namespace dcp;
 
+/** Construct a SMPTESubtitleAsset by reading an XML or MXF file.
+ *  @param file Filename.
+ *  @param mxf true if file is an MXF, false if it is XML.
+ */
 SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file, bool mxf)
        : SubtitleAsset (file)
 {
@@ -59,10 +67,7 @@ SMPTESubtitleAsset::SMPTESubtitleAsset (boost::filesystem::path file, bool mxf)
 
                ASDCP::WriterInfo info;
                reader.FillWriterInfo (info);
-               
-               char buffer[64];
-               Kumu::bin2UUIDhex (info.AssetUUID, ASDCP::UUIDlen, buffer, sizeof (buffer));
-               _id = buffer;
+               _id = read_writer_info (info);
        } else {
                xml->read_file (file);
                _id = xml->string_child("Id").substr (9);
index 5f4d8833137251d2fc1ae299f4580772ac14821d..c796e1d45c5640bfcd9c98c15959de47015502b2 100644 (file)
 
 */
 
+/** @file  src/smpte_subtitle_asset.h
+ *  @brief SMPTESubtitleAsset class.
+ */
+
 #include "subtitle_asset.h"
 #include "local_time.h"
 #include "mxf.h"
@@ -26,6 +30,9 @@ namespace dcp {
 
 class SMPTELoadFontNode;
 
+/** @class SMPTESubtitleAsset
+ *  @brief A set of subtitles to be read and/or written in the SMPTE format.
+ */
 class SMPTESubtitleAsset : public SubtitleAsset, public MXF
 {
 public:
@@ -45,10 +52,43 @@ public:
        Glib::ustring xml_as_string () const;
        void write (boost::filesystem::path path) const;
 
-       /** @return language, if one was specified */
+       /** @return title of the film that these subtitles are for,
+        *  to be presented to the user.
+        */
+       std::string content_title_text () const {
+               return _content_title_text;
+       }
+
+       /** @return language as a xs:language, if one was specified */
        boost::optional<std::string> language () const {
                return _language;
        }
+
+       /** @return annotation text, to be presented to the user */
+       boost::optional<std::string> annotation_text () const {
+               return _annotation_text;
+       }
+
+       /** @return file creation time and date */
+       LocalTime issue_date () const {
+               return _issue_date;
+       }
+
+       Fraction edit_rate () const {
+               return _edit_rate;
+       }
+
+       /** @return subdivision of 1 second that is used for subtitle times;
+        *  e.g. a time_code_rate of 250 means that a subtitle time of 0:0:0:001
+        *  represents 4ms.
+        */
+       int time_code_rate () const {
+               return _time_code_rate;
+       }
+
+       boost::optional<Time> start_time () const {
+               return _start_time;
+       }
        
        static bool valid_mxf (boost::filesystem::path);
 
@@ -60,10 +100,10 @@ protected:
        
 private:
        std::string _content_title_text;
+       boost::optional<std::string> _language;
        boost::optional<std::string> _annotation_text;
        LocalTime _issue_date;
        boost::optional<int> _reel_number;
-       boost::optional<std::string> _language;
        Fraction _edit_rate;
        int _time_code_rate;
        boost::optional<Time> _start_time;
index 8b53dd71edfb556a9845f6ec9ab374ec104f0995..4fdc39e512eea8fe54ed175f3b48d964767fb0dc 100644 (file)
@@ -39,7 +39,7 @@ namespace ASDCP {
 namespace dcp {
 
 /** @class SoundFrame
- *  @brief One &lsquo;frame&rsquo; of sound data from a MXF.
+ *  @brief One &lsquo;frame&rsquo; of sound data from a SoundAsset.
  */
 class SoundFrame : public boost::noncopyable
 {