libdcp
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
dcp::SMPTESubtitleAsset Class Reference

A set of subtitles to be read and/or written in the SMPTE format. More...

#include <smpte_subtitle_asset.h>

Inheritance diagram for dcp::SMPTESubtitleAsset:
dcp::SubtitleAsset dcp::MXF dcp::Asset dcp::Object

Public Member Functions

 SMPTESubtitleAsset (boost::filesystem::path file)
 
bool equals (std::shared_ptr< const Asset >, EqualityOptions, NoteHandler note) const override
 
std::vector< std::shared_ptr< LoadFontNode > > load_font_nodes () const override
 
std::string xml_as_string () const override
 
void write (boost::filesystem::path path) const override
 
void add (std::shared_ptr< Subtitle >) override
 
void add_font (std::string id, dcp::ArrayData data) override
 
void set_key (Key key) override
 
void set_content_title_text (std::string t)
 
void set_language (dcp::LanguageTag l)
 
void set_issue_date (LocalTime t)
 
void set_reel_number (int r)
 
void set_edit_rate (Fraction e)
 
void set_time_code_rate (int t)
 
void set_start_time (Time t)
 
void set_intrinsic_duration (int64_t d)
 
int64_t intrinsic_duration () const
 
std::string content_title_text () const
 
boost::optional< std::string > language () const
 
boost::optional< std::string > annotation_text () const
 
LocalTime issue_date () const
 
boost::optional< int > reel_number () const
 
Fraction edit_rate () const
 
int time_code_rate () const override
 
boost::optional< Timestart_time () const
 
boost::optional< std::string > xml_id () const
 
boost::optional< std::string > resource_id () const
 
- Public Member Functions inherited from dcp::SubtitleAsset
 SubtitleAsset (boost::filesystem::path file)
 
bool equals (std::shared_ptr< const Asset >, EqualityOptions, NoteHandler note) const override
 
std::vector< std::shared_ptr< const Subtitle > > subtitles_during (Time from, Time to, bool starting) const
 
std::vector< std::shared_ptr< const Subtitle > > subtitles_in_reel (std::shared_ptr< const dcp::ReelAsset > asset) const
 
std::vector< std::shared_ptr< const Subtitle > > subtitles () const
 
std::map< std::string, ArrayDatafont_data () const
 
std::map< std::string, boost::filesystem::path > font_filenames () const
 
Time latest_subtitle_out () const
 
void fix_empty_font_ids ()
 
virtual boost::optional< std::string > raw_xml () const
 
- Public Member Functions inherited from dcp::Asset
 Asset ()
 
 Asset (boost::filesystem::path file)
 
 Asset (std::string id, boost::filesystem::path file)
 
virtual void write_to_assetmap (xmlpp::Node *node, boost::filesystem::path root) const
 
virtual void add_to_pkl (std::shared_ptr< PKL > pkl, boost::filesystem::path root) const
 
boost::optional< boost::filesystem::path > file () const
 
void set_file (boost::filesystem::path file) const
 
std::string hash (boost::function< void(float)> progress={}) const
 
void set_hash (std::string hash)
 
- Public Member Functions inherited from dcp::Object
 Object ()
 
 Object (std::string id)
 
 Object (Object const &)=delete
 
Objectoperator= (Object const &)=delete
 
std::string id () const
 
- Public Member Functions inherited from dcp::MXF
 MXF (Standard standard)
 
bool encrypted () const
 
void set_key_id (std::string i)
 
boost::optional< std::string > key_id () const
 
boost::optional< Keykey () const
 
void set_context_id (std::string id)
 
std::string context_id () const
 
void set_metadata (MXFMetadata m)
 
MXFMetadata metadata () const
 
Standard standard () const
 

Static Public Member Functions

static bool valid_mxf (boost::filesystem::path)
 
static std::string static_pkl_type (Standard)
 

Protected Member Functions

std::string pkl_type (Standard s) const override
 
- Protected Member Functions inherited from dcp::SubtitleAsset
void parse_subtitles (xmlpp::Element const *node, std::vector< ParseState > &state, boost::optional< int > tcr, Standard standard)
 
ParseState font_node_state (xmlpp::Element const *node, Standard standard) const
 
ParseState text_node_state (xmlpp::Element const *node) const
 
ParseState image_node_state (xmlpp::Element const *node) const
 
ParseState subtitle_node_state (xmlpp::Element const *node, boost::optional< int > tcr) const
 
Time fade_time (xmlpp::Element const *node, std::string name, boost::optional< int > tcr) const
 
void position_align (ParseState &ps, xmlpp::Element const *node) const
 
void subtitles_as_xml (xmlpp::Element *root, int time_code_rate, Standard standard) const
 
- Protected Member Functions inherited from dcp::MXF
std::string read_writer_info (ASDCP::WriterInfo const &)
 
void fill_writer_info (ASDCP::WriterInfo *w, std::string id) const
 

Private Member Functions

void read_fonts (std::shared_ptr< ASDCP::TimedText::MXFReader >)
 
void parse_xml (std::shared_ptr< cxml::Document > xml)
 
void read_mxf_descriptor (std::shared_ptr< ASDCP::TimedText::MXFReader > reader)
 
void read_mxf_resources (std::shared_ptr< ASDCP::TimedText::MXFReader > reader, std::shared_ptr< DecryptionContext > dec)
 

Private Attributes

int64_t _intrinsic_duration = 0
 
std::string _content_title_text
 
boost::optional< std::string > _language
 
boost::optional< std::string > _annotation_text
 
LocalTime _issue_date
 
boost::optional< int > _reel_number
 
Fraction _edit_rate
 
int _time_code_rate = 0
 
boost::optional< Time_start_time
 
std::vector< std::shared_ptr< SMPTELoadFontNode > > _load_font_nodes
 
boost::optional< std::string > _xml_id
 
boost::optional< std::string > _resource_id
 

Friends

struct ::write_smpte_subtitle_test
 
struct ::write_smpte_subtitle_test2
 
struct ::verify_invalid_language1
 
struct ::verify_invalid_language2
 
struct ::write_subtitles_in_vertical_order_with_top_alignment
 
struct ::write_subtitles_in_vertical_order_with_bottom_alignment
 

Additional Inherited Members

- Static Protected Member Functions inherited from dcp::Asset
static void write_file_to_assetmap (xmlpp::Node *node, boost::filesystem::path root, boost::filesystem::path file, std::string id)
 
- Protected Attributes inherited from dcp::SubtitleAsset
std::vector< std::shared_ptr< Subtitle > > _subtitles
 
std::vector< Font_fonts
 
boost::optional< std::string > _raw_xml
 
- Protected Attributes inherited from dcp::Asset
boost::optional< boost::filesystem::path > _file
 
- Protected Attributes inherited from dcp::Object
std::string _id
 
- Protected Attributes inherited from dcp::MXF
boost::optional< std::string > _key_id
 
boost::optional< Key_key
 
std::string _context_id
 
MXFMetadata _metadata
 
boost::optional< Standard > _standard
 

Detailed Description

A set of subtitles to be read and/or written in the SMPTE format.

Definition at line 74 of file smpte_subtitle_asset.h.

Constructor & Destructor Documentation

◆ SMPTESubtitleAsset()

SMPTESubtitleAsset::SMPTESubtitleAsset ( boost::filesystem::path  file)
explicit

Construct a SMPTESubtitleAsset by reading an MXF or XML file

Parameters
fileFilename

Definition at line 88 of file smpte_subtitle_asset.cc.

Member Function Documentation

◆ annotation_text()

boost::optional<std::string> dcp::SMPTESubtitleAsset::annotation_text ( ) const
inline
Returns
annotation text, to be presented to the user

Definition at line 152 of file smpte_subtitle_asset.h.

◆ content_title_text()

std::string dcp::SMPTESubtitleAsset::content_title_text ( ) const
inline
Returns
title of the film that these subtitles are for, to be presented to the user

Definition at line 140 of file smpte_subtitle_asset.h.

◆ issue_date()

LocalTime dcp::SMPTESubtitleAsset::issue_date ( ) const
inline
Returns
file issue time and date

Definition at line 157 of file smpte_subtitle_asset.h.

◆ language()

boost::optional<std::string> dcp::SMPTESubtitleAsset::language ( ) const
inline
Returns
Language, if one was set. This should be a xs:language, but it might not be if a non-compliant DCP was read in.

Definition at line 147 of file smpte_subtitle_asset.h.

◆ pkl_type()

std::string dcp::SMPTESubtitleAsset::pkl_type ( Standard  standard) const
inlineoverrideprotectedvirtual
Returns
type string for PKLs for this asset

Implements dcp::Asset.

Definition at line 200 of file smpte_subtitle_asset.h.

◆ resource_id()

boost::optional<std::string> dcp::SMPTESubtitleAsset::resource_id ( ) const
inline
Returns
ResourceID read from any MXF that was read

Definition at line 189 of file smpte_subtitle_asset.h.

◆ set_key()

void SMPTESubtitleAsset::set_key ( Key  key)
overridevirtual

Set the (private) key that will be used to encrypt or decrypt this MXF's content This is the top-secret key that is distributed (itself encrypted) to cinemas via Key Delivery Messages (KDMs)

Parameters
keyKey to use

Reimplemented from dcp::MXF.

Definition at line 282 of file smpte_subtitle_asset.cc.

◆ time_code_rate()

int dcp::SMPTESubtitleAsset::time_code_rate ( ) const
inlineoverridevirtual
Returns
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.

Implements dcp::SubtitleAsset.

Definition at line 173 of file smpte_subtitle_asset.h.

◆ write()

void SMPTESubtitleAsset::write ( boost::filesystem::path  path) const
overridevirtual

Write this content to a MXF file

Implements dcp::SubtitleAsset.

Definition at line 382 of file smpte_subtitle_asset.cc.

◆ xml_id()

boost::optional<std::string> dcp::SMPTESubtitleAsset::xml_id ( ) const
inline
Returns
ID from XML's <Id> tag, or the <Id> that will be used when writing the XML, or boost::none if this content is encrypted and no key is available.

Definition at line 184 of file smpte_subtitle_asset.h.

Member Data Documentation

◆ _content_title_text

std::string dcp::SMPTESubtitleAsset::_content_title_text
private

<ContentTitleText> from the asset

Definition at line 222 of file smpte_subtitle_asset.h.

◆ _intrinsic_duration

int64_t dcp::SMPTESubtitleAsset::_intrinsic_duration = 0
private

The total length of this content in video frames. The amount of content presented may be less than this.

Definition at line 220 of file smpte_subtitle_asset.h.

◆ _language

boost::optional<std::string> dcp::SMPTESubtitleAsset::_language
private

This is stored and returned as a string so that we can tolerate non-RFC-5646 strings, but must be set as a dcp::LanguageTag to try to ensure that we create compliant output.

Definition at line 226 of file smpte_subtitle_asset.h.

◆ _resource_id

boost::optional<std::string> dcp::SMPTESubtitleAsset::_resource_id
private

ResourceID read from the MXF, if there was one

Definition at line 242 of file smpte_subtitle_asset.h.

◆ _xml_id

boost::optional<std::string> dcp::SMPTESubtitleAsset::_xml_id
private

UUID for the XML inside the MXF, which should be the same as the ResourceID in the MXF (our _resource_id) but different to the AssetUUID in the MXF (our _id) according to SMPTE Bv2.1 and Doremi's 2.8.18 release notes. May be boost::none if this object has been made from an encrypted object without a key.

Definition at line 239 of file smpte_subtitle_asset.h.


The documentation for this class was generated from the following files: