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

A class to create or read a DCP. More...

#include <dcp.h>

Public Member Functions

 DCP (boost::filesystem::path directory)
 
 DCP (DCP const &)=delete
 
DCPoperator= (DCP const &)=delete
 
void read (std::vector< VerificationNote > *notes=nullptr, bool ignore_incorrect_picture_mxf_type=false)
 
bool equals (DCP const &other, EqualityOptions options, NoteHandler note) const
 
void add (std::shared_ptr< CPL > cpl)
 
std::vector< std::shared_ptr< CPL > > cpls () const
 
std::vector< std::shared_ptr< Asset > > assets (bool ignore_unresolved=false) const
 
bool any_encrypted () const
 
bool all_encrypted () const
 
void add (DecryptedKDM const &)
 
void write_xml (std::string issuer=String::compose("libdcp %1", dcp::version), std::string creator=String::compose("libdcp %1", dcp::version), std::string issue_date=LocalTime().as_string(), std::string annotation_text=String::compose("Created by libdcp %1", dcp::version), std::shared_ptr< const CertificateChain > signer=std::shared_ptr< const CertificateChain >(), NameFormat name_format=NameFormat("%t"))
 
void resolve_refs (std::vector< std::shared_ptr< Asset >> assets)
 
boost::optional< Standard > standard () const
 
boost::filesystem::path directory () const
 
std::vector< std::shared_ptr< PKL > > pkls () const
 
boost::optional< boost::filesystem::path > asset_map_path ()
 

Static Public Member Functions

static std::vector< boost::filesystem::path > directories_from_files (std::vector< boost::filesystem::path > files)
 

Private Member Functions

void write_volindex (Standard standard) const
 
void write_assetmap (Standard standard, std::string pkl_uuid, boost::filesystem::path pkl_path, std::string issuer, std::string creator, std::string issue_date, std::string annotation_text) const
 

Private Attributes

boost::filesystem::path _directory
 
std::vector< std::shared_ptr< CPL > > _cpls
 
std::vector< std::shared_ptr< PKL > > _pkls
 
boost::optional< boost::filesystem::path > _asset_map
 
boost::optional< Standard > _standard
 

Detailed Description

A class to create or read a DCP.

Definition at line 82 of file dcp.h.

Constructor & Destructor Documentation

◆ DCP()

DCP::DCP ( boost::filesystem::path  directory)
explicit

Construct a DCP. You can pass an existing DCP's directory as the parameter; alternatively, directory will be created if it does not exist. Note that if you pass an existing DCP into this constructor it will not be read until you call ::read().

Parameters
directoryDirectory containing the DCP's files.

Definition at line 100 of file dcp.cc.

Member Function Documentation

◆ add()

void DCP::add ( DecryptedKDM const &  kdm)

Add a KDM to decrypt this DCP. This method must be called after DCP::read() or the KDM you specify will be ignored.

Parameters
kdmKDM to use.

Definition at line 364 of file dcp.cc.

◆ assets()

vector< shared_ptr< Asset > > DCP::assets ( bool  ignore_unresolved = false) const
Parameters
ignore_unresolvedtrue to silently ignore unresolved assets, otherwise an exception is thrown if they are found.
Returns
All assets (including CPLs).

Definition at line 549 of file dcp.cc.

◆ directories_from_files()

vector< boost::filesystem::path > DCP::directories_from_files ( std::vector< boost::filesystem::path >  files)
static

Given a list of files that make up 1 or more DCPs, return the DCP directories

Definition at line 585 of file dcp.cc.

◆ equals()

bool DCP::equals ( DCP const &  other,
EqualityOptions  options,
NoteHandler  note 
) const

Compare this DCP with another, according to various options.

Parameters
otherDCP to compare this one to.
optionsOptions to define what "equality" means.
noteFunctor to handle notes made by the equality operation.
Returns
true if the DCPs are equal according to EqualityOptions, otherwise false.

Definition at line 303 of file dcp.cc.

◆ pkls()

std::vector<std::shared_ptr<PKL> > dcp::DCP::pkls ( ) const
inline
Returns
PKLs if this DCP was read from an existing one, or if write_xml() has been called on it. If neither is true, this method returns an empty vector.

Definition at line 176 of file dcp.h.

◆ read()

void DCP::read ( std::vector< VerificationNote > *  notes = nullptr,
bool  ignore_incorrect_picture_mxf_type = false 
)

Read a DCP. This method does not do any deep checking of the DCP's validity, but if it comes across any bad things it will do one of two things.

Errors that are so serious that they prevent the method from working will result in an exception being thrown. For example, a missing ASSETMAP means that the DCP can't be read without a lot of guesswork, so this will throw.

Errors that are not fatal will be added to notes, if it's non-null. For example, if the DCP contains a mixture of Interop and SMPTE elements this will result in a note being added to the vector.

For more thorough checking of a DCP's contents, see dcp::verify().

Parameters
notesList of notes that will be added to if non-0.
ignore_incorrect_picture_mxf_typetrue to try loading MXF files marked as monoscopic as stereoscopic if the monoscopic load fails; fixes problems some 3D DCPs that (I think) have an incorrect descriptor in their MXF.

Definition at line 112 of file dcp.cc.

◆ standard()

boost::optional<Standard> dcp::DCP::standard ( ) const
inline
Returns
Standard of a DCP that was read in

Definition at line 165 of file dcp.h.

◆ write_assetmap()

void DCP::write_assetmap ( Standard  standard,
std::string  pkl_uuid,
boost::filesystem::path  pkl_path,
std::string  issuer,
std::string  creator,
std::string  issue_date,
std::string  annotation_text 
) const
private

Write the ASSETMAP file.

Parameters
pkl_uuidUUID of our PKL.
pkl_pathPathname of our PKL file.

Definition at line 416 of file dcp.cc.

◆ write_volindex()

void DCP::write_volindex ( Standard  standard) const
private

Write the VOLINDEX file.

Parameters
standardDCP standard to use (INTEROP or SMPTE)

Definition at line 382 of file dcp.cc.

◆ write_xml()

void DCP::write_xml ( std::string  issuer = String::compose("libdcp %1", dcp::version),
std::string  creator = String::compose("libdcp %1", dcp::version),
std::string  issue_date = LocalTime().as_string(),
std::string  annotation_text = String::compose("Created by libdcp %1", dcp::version),
std::shared_ptr< const CertificateChain signer = std::shared_ptr<const CertificateChain>(),
NameFormat  name_format = NameFormat("%t") 
)

Write all the XML files for this DCP

Parameters
standandINTEROP or SMPTE
issuerValue for the PKL and AssetMap <Issuer> tags
creatorValue for the PKL and AssetMap <Creator> tags
issue_dateValue for the CPL <IssueDate> tags
annotation_textValue for the CPL <AnnotationText> tags
signerSigner to use
name_formatName format to use for the CPL and PKL filenames

Definition at line 490 of file dcp.cc.

Member Data Documentation

◆ _asset_map

boost::optional<boost::filesystem::path> dcp::DCP::_asset_map
mutableprivate

File that the ASSETMAP was read from or last written to

Definition at line 206 of file dcp.h.

◆ _cpls

std::vector<std::shared_ptr<CPL> > dcp::DCP::_cpls
private

The CPLs that make up this DCP

Definition at line 202 of file dcp.h.

◆ _directory

boost::filesystem::path dcp::DCP::_directory
private

The directory that we are writing to

Definition at line 200 of file dcp.h.

◆ _pkls

std::vector<std::shared_ptr<PKL> > dcp::DCP::_pkls
private

The PKLs that make up this DCP

Definition at line 204 of file dcp.h.

◆ _standard

boost::optional<Standard> dcp::DCP::_standard
private

Standard of DCP that was read in

Definition at line 209 of file dcp.h.


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