+
+void
+Reel::add (shared_ptr<ReelAsset> asset)
+{
+ shared_ptr<ReelPictureAsset> p = dynamic_pointer_cast<ReelPictureAsset> (asset);
+ shared_ptr<ReelSoundAsset> so = dynamic_pointer_cast<ReelSoundAsset> (asset);
+ shared_ptr<ReelSubtitleAsset> su = dynamic_pointer_cast<ReelSubtitleAsset> (asset);
+ if (p) {
+ _main_picture = p;
+ } else if (so) {
+ _main_sound = so;
+ } else if (su) {
+ _main_subtitle = su;
+ }
+}
+
+void
+Reel::resolve_refs (list<shared_ptr<Asset> > assets)
+{
+ if (_main_picture) {
+ _main_picture->asset_ref().resolve (assets);
+ }
+
+ if (_main_sound) {
+ _main_sound->asset_ref().resolve (assets);
+ }
+
+ if (_main_subtitle) {
+ _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().asset ());
+ if (iop) {
+ iop->resolve_fonts (assets);
+ }
+ }
+}
+
+int64_t
+Reel::duration () const
+{
+ int64_t d = 0;
+
+ if (_main_picture) {
+ d = max (d, _main_picture->duration ());
+ }
+ if (_main_sound) {
+ d = max (d, _main_sound->duration ());
+ }
+ if (_main_subtitle) {
+ d = max (d, _main_subtitle->duration ());
+ }
+
+ return d;
+}