}
void
-CPL::resolve_refs (list<shared_ptr<Object> > objects)
+CPL::resolve_refs (list<shared_ptr<Asset> > assets)
{
BOOST_FOREACH (shared_ptr<Reel> i, _reels) {
- i->resolve_refs (objects);
+ i->resolve_refs (assets);
}
}
boost::shared_ptr<const CertificateChain>
) const;
- void resolve_refs (std::list<boost::shared_ptr<Object> >);
+ void resolve_refs (std::list<boost::shared_ptr<Asset> >);
protected:
/** @return type string for PKLs for this asset */
}
BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
- i->resolve_refs (list_of_type<Asset, Object> (other_assets));
+ i->resolve_refs (other_assets);
+ }
+}
+
+void
+DCP::resolve_refs (list<shared_ptr<Asset> > assets)
+{
+ BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
+ i->resolve_refs (assets);
}
}
BOOST_FOREACH (shared_ptr<CPL> i, cpls ()) {
assets.push_back (i);
BOOST_FOREACH (shared_ptr<const ReelAsset> j, i->reel_assets ()) {
- shared_ptr<Asset> o = j->asset_ref().object ();
+ shared_ptr<Asset> o = j->asset_ref().asset ();
assets.push_back (o);
/* More Interop special-casing */
shared_ptr<InteropSubtitleAsset> sub = dynamic_pointer_cast<InteropSubtitleAsset> (o);
boost::shared_ptr<const CertificateChain> signer = boost::shared_ptr<const CertificateChain> ()
);
+ void resolve_refs (std::list<boost::shared_ptr<Asset> > assets);
+
private:
/** Write the PKL file.
}
void
-InteropSubtitleAsset::resolve_fonts (list<shared_ptr<Object> > objects)
+InteropSubtitleAsset::resolve_fonts (list<shared_ptr<Asset> > assets)
{
- BOOST_FOREACH (shared_ptr<Object> i, objects) {
+ BOOST_FOREACH (shared_ptr<Asset> i, assets) {
shared_ptr<FontAsset> font = dynamic_pointer_cast<FontAsset> (i);
if (!font) {
continue;
std::string xml_as_string () const;
void write (boost::filesystem::path path) const;
- void resolve_fonts (std::list<boost::shared_ptr<Object> > objects);
+ void resolve_fonts (std::list<boost::shared_ptr<Asset> > assets);
void add_font_assets (std::list<boost::shared_ptr<Asset> >& assets);
/** Set the reel number or sub-element identifier
}
void
-Reel::resolve_refs (list<shared_ptr<Object> > objects)
+Reel::resolve_refs (list<shared_ptr<Asset> > assets)
{
if (_main_picture) {
- _main_picture->asset_ref().resolve (objects);
+ _main_picture->asset_ref().resolve (assets);
}
if (_main_sound) {
- _main_sound->asset_ref().resolve (objects);
+ _main_sound->asset_ref().resolve (assets);
}
if (_main_subtitle) {
- _main_subtitle->asset_ref().resolve (objects);
+ _main_subtitle->asset_ref().resolve (assets);
/* Interop subtitle handling is all special cases */
- shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (_main_subtitle->asset_ref().object ());
+ shared_ptr<InteropSubtitleAsset> iop = dynamic_pointer_cast<InteropSubtitleAsset> (_main_subtitle->asset_ref().asset ());
if (iop) {
- iop->resolve_fonts (objects);
+ iop->resolve_fonts (assets);
}
}
}
void add (DecryptedKDM const &);
- void resolve_refs (std::list<boost::shared_ptr<Object> >);
+ void resolve_refs (std::list<boost::shared_ptr<Asset> >);
private:
boost::shared_ptr<ReelPictureAsset> _main_picture;
a->add_child("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
a->add_child("EntryPoint")->add_child_text (raw_convert<string> (_entry_point));
a->add_child("Duration")->add_child_text (raw_convert<string> (_duration));
- a->add_child("Hash")->add_child_text (_asset_ref.object()->hash ());
+ a->add_child("Hash")->add_child_text (_asset_ref.asset()->hash ());
}
pair<string, string>
}
if (_asset_ref.resolved () && other->_asset_ref.resolved ()) {
- return _asset_ref->equals (other->_asset_ref.object (), opt, note);
+ return _asset_ref->equals (other->_asset_ref.asset(), opt, note);
}
return true;
virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
/** @return a Ref to our actual asset */
- Ref<Asset> const & asset_ref () const {
+ Ref const & asset_ref () const {
return _asset_ref;
}
/** @return a Ref to our actual asset */
- Ref<Asset>& asset_ref () {
+ Ref & asset_ref () {
return _asset_ref;
}
/** Reference to the asset (MXF or XML file) that this reel entry
* applies to.
*/
- Ref<Asset> _asset_ref;
+ Ref _asset_ref;
private:
std::string _annotation_text; ///< The <AnnotationText> from the reel's entry for this asset
#define LIBDCP_REEL_MONO_PICTURE_ASSET_H
#include "reel_picture_asset.h"
+#include "mono_picture_asset.h"
namespace dcp {
ReelMonoPictureAsset (boost::shared_ptr<MonoPictureAsset> asset, int64_t entry_point);
ReelMonoPictureAsset (boost::shared_ptr<const cxml::Node>);
+ /** @return the MonoPictureAsset that this object refers to */
+ boost::shared_ptr<const MonoPictureAsset> mono_asset () const {
+ return boost::dynamic_pointer_cast<const MonoPictureAsset> (_asset_ref.asset ());
+ }
+
+ /** @return the MonoPictureAsset that this object refers to */
+ boost::shared_ptr<MonoPictureAsset> mono_asset () {
+ return boost::dynamic_pointer_cast<MonoPictureAsset> (_asset_ref.asset ());
+ }
+
private:
std::string cpl_node_name () const;
};
virtual void write_to_cpl (xmlpp::Node* node, Standard standard) const;
virtual bool equals (boost::shared_ptr<const ReelAsset>, EqualityOptions, NoteHandler) const;
+ /** @return the PictureAsset that this object refers to */
+ boost::shared_ptr<const PictureAsset> asset () const {
+ return boost::dynamic_pointer_cast<const PictureAsset> (_asset_ref.asset ());
+ }
+
/** @return the PictureAsset that this object refers to */
boost::shared_ptr<PictureAsset> asset () {
- return boost::dynamic_pointer_cast<PictureAsset> (_asset_ref.object ());
+ return boost::dynamic_pointer_cast<PictureAsset> (_asset_ref.asset ());
}
/** @return picture frame rate */
/** @return the SoundAsset that this object refers to */
boost::shared_ptr<SoundAsset> asset () {
- return boost::dynamic_pointer_cast<SoundAsset> (_asset_ref.object ());
+ return boost::dynamic_pointer_cast<SoundAsset> (_asset_ref.asset ());
}
/** @return the SoundAsset that this object refers to */
boost::shared_ptr<const SoundAsset> asset () const {
- return boost::dynamic_pointer_cast<const SoundAsset> (_asset_ref.object ());
+ return boost::dynamic_pointer_cast<const SoundAsset> (_asset_ref.asset ());
}
private:
};
}
-
#define LIBDCP_REEL_STEREO_PICTURE_ASSET_H
#include "reel_picture_asset.h"
+#include "stereo_picture_asset.h"
namespace dcp {
ReelStereoPictureAsset (boost::shared_ptr<StereoPictureAsset> content, int64_t entry_point);
ReelStereoPictureAsset (boost::shared_ptr<const cxml::Node>);
+ /** @return the StereoPictureAsset that this object refers to */
+ boost::shared_ptr<const StereoPictureAsset> stereo_asset () const {
+ return boost::dynamic_pointer_cast<const StereoPictureAsset> (_asset_ref.asset ());
+ }
+
+ /** @return the StereoPictureAsset that this object refers to */
+ boost::shared_ptr<StereoPictureAsset> stereo_asset () {
+ return boost::dynamic_pointer_cast<StereoPictureAsset> (_asset_ref.asset ());
+ }
+
private:
std::string cpl_node_name () const;
std::pair<std::string, std::string> cpl_node_attribute (Standard standard) const;
}
#endif
-
ReelSubtitleAsset (boost::shared_ptr<const cxml::Node>);
boost::shared_ptr<SubtitleAsset> asset () const {
- return boost::dynamic_pointer_cast<SubtitleAsset> (_asset_ref.object ());
+ return boost::dynamic_pointer_cast<SubtitleAsset> (_asset_ref.asset ());
}
private:
#define LIBDCP_REF_H
#include "exceptions.h"
-#include "object.h"
+#include "asset.h"
#include "util.h"
#include <boost/shared_ptr.hpp>
#include <string>
namespace dcp {
/** @class Ref
- * @brief A reference to an object which is identified by a universally-unique identifier (UUID).
+ * @brief A reference to an asset which is identified by a universally-unique identifier (UUID).
*
* This class is a `pointer' to a thing. It will always know the
* UUID of the thing, and it may have a shared_ptr to the C++ object
* which represents the thing.
*
* If the Ref does not have a shared_ptr it may be given one by
- * calling resolve() with a list of objects. The shared_ptr will be
+ * calling resolve() with a list of assets. The shared_ptr will be
* set up using any object on the list which has a matching ID.
*/
-template<class T>
class Ref
{
public:
: _id (id)
{}
- /** Initialise a Ref with a shared_ptr to an object */
- Ref (boost::shared_ptr<T> object)
- : _id (object->id ())
- , _object (object)
+ /** Initialise a Ref with a shared_ptr to an asset */
+ Ref (boost::shared_ptr<Asset> asset)
+ : _id (asset->id ())
+ , _asset (asset)
{}
/** Set the ID of this Ref */
_id = id;
}
- /** Look through a list of objects and copy a shared_ptr to any object
- * which matches the ID of this one.
- */
- void resolve (std::list<boost::shared_ptr<Object> > objects)
- {
- typename std::list<boost::shared_ptr<Object> >::iterator i = objects.begin();
- while (i != objects.end() && !ids_equal ((*i)->id(), _id)) {
- ++i;
- }
-
- if (i != objects.end ()) {
- _object = boost::dynamic_pointer_cast<T> (*i);
- }
- }
+ void resolve (std::list<boost::shared_ptr<Asset> > assets);
/** @return the ID of the thing that we are pointing to */
std::string id () const {
/** @return a shared_ptr to the thing; an UnresolvedRefError is thrown
* if the shared_ptr is not known.
*/
- boost::shared_ptr<T> object () const {
- if (!_object) {
+ boost::shared_ptr<Asset> asset () const {
+ if (!_asset) {
throw UnresolvedRefError (_id);
}
- return _object;
+ return _asset;
}
/** operator-> to access the shared_ptr; an UnresolvedRefError is thrown
* if the shared_ptr is not known.
*/
- T * operator->() const {
- if (!_object) {
+ Asset * operator->() const {
+ if (!_asset) {
throw UnresolvedRefError (_id);
}
- return _object.get ();
+ return _asset.get ();
}
/** @return true if a shared_ptr is known for this Ref */
bool resolved () const {
- return static_cast<bool>(_object);
+ return static_cast<bool>(_asset);
}
private:
- std::string _id; ///< ID; will always be known
- boost::shared_ptr<T> _object; ///< shared_ptr to the thing, may be null.
+ std::string _id; ///< ID; will always be known
+ boost::shared_ptr<Asset> _asset; ///< shared_ptr to the thing, may be null.
};
}
extern std::string private_key_fingerprint (std::string key);
extern xmlpp::Node* find_child (xmlpp::Node const * node, std::string name);
-template <class F, class T>
-std::list<boost::shared_ptr<T> >
-list_of_type (std::list<boost::shared_ptr<F> > const & from)
-{
- std::list<boost::shared_ptr<T> > out;
- for (typename std::list<boost::shared_ptr<F> >::const_iterator i = from.begin(); i != from.end(); ++i) {
- boost::shared_ptr<T> check = boost::dynamic_pointer_cast<T> (*i);
- if (check) {
- out.push_back (check);
- }
- }
-
- return out;
-}
-
}
#endif
reel_sound_asset.cc
reel_stereo_picture_asset.cc
reel_subtitle_asset.cc
+ ref.cc
rgb_xyz.cc
smpte_load_font_node.cc
smpte_subtitle_asset.cc
dcp::DCP dcp2 (directory);
dcp2.read ();
shared_ptr<dcp::SubtitleAsset> subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
- dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().object()
+ dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().asset()
);
BOOST_REQUIRE (subs2);
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);
dcp::DCP dcp2 (directory);
dcp2.read ();
shared_ptr<dcp::SubtitleAsset> subs2 = dynamic_pointer_cast<dcp::SubtitleAsset> (
- dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().object()
+ dcp2.cpls().front()->reels().front()->main_subtitle()->asset_ref().asset()
);
BOOST_REQUIRE (subs2);
BOOST_REQUIRE_EQUAL (subs2->_fonts.size(), 1);