2 Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/smpte_subtitle_asset.h
21 * @brief SMPTESubtitleAsset class.
24 #include "subtitle_asset.h"
25 #include "local_time.h"
27 #include <boost/filesystem.hpp>
37 class SMPTELoadFontNode;
39 /** @class SMPTESubtitleAsset
40 * @brief A set of subtitles to be read and/or written in the SMPTE format.
42 class SMPTESubtitleAsset : public SubtitleAsset, public MXF
45 SMPTESubtitleAsset ();
47 /** @param file File name
49 SMPTESubtitleAsset (boost::filesystem::path file);
52 boost::shared_ptr<const Asset>,
57 std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const;
59 Glib::ustring xml_as_string () const;
60 void write (boost::filesystem::path path) const;
61 void add_font (std::string id, boost::filesystem::path file);
63 void set_content_title_text (std::string t) {
64 _content_title_text = t;
67 void set_language (std::string l) {
71 void set_reel_number (int r) {
75 void set_edit_rate (Fraction e) {
79 void set_time_code_rate (int t) {
83 void set_start_time (Time t) {
87 /** @return title of the film that these subtitles are for,
88 * to be presented to the user.
90 std::string content_title_text () const {
91 return _content_title_text;
94 /** @return language as a xs:language, if one was specified */
95 boost::optional<std::string> language () const {
99 /** @return annotation text, to be presented to the user */
100 boost::optional<std::string> annotation_text () const {
101 return _annotation_text;
104 /** @return file creation time and date */
105 LocalTime issue_date () const {
109 boost::optional<int> reel_number () const {
113 Fraction edit_rate () const {
117 /** @return subdivision of 1 second that is used for subtitle times;
118 * e.g. a time_code_rate of 250 means that a subtitle time of 0:0:0:001
121 int time_code_rate () const {
122 return _time_code_rate;
125 boost::optional<Time> start_time () const {
129 static bool valid_mxf (boost::filesystem::path);
133 std::string pkl_type (Standard) const {
134 return "application/mxf";
138 void read_fonts (boost::shared_ptr<ASDCP::TimedText::MXFReader>);
140 std::string _content_title_text;
141 boost::optional<std::string> _language;
142 boost::optional<std::string> _annotation_text;
143 LocalTime _issue_date;
144 boost::optional<int> _reel_number;
147 boost::optional<Time> _start_time;
149 std::list<boost::shared_ptr<SMPTELoadFontNode> > _load_font_nodes;