diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-09-19 03:13:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-09-19 03:13:38 +0100 |
| commit | 0cdd094b556b59cca81727664e4161887f4d3b17 (patch) | |
| tree | ee7bd2ba758d848a2b5669dd93710a32f097b9a6 /src | |
| parent | f44f95e5592f800edfa54ec8b6b1cc1ccf302e3a (diff) | |
Cope with DCPs that don't specify the picture as stereoscopic but are 3D and indicate it by having differing EditRate and FrameRate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp.cc | 20 | ||||
| -rw-r--r-- | src/types.cc | 12 | ||||
| -rw-r--r-- | src/types.h | 3 |
3 files changed, 28 insertions, 7 deletions
@@ -342,12 +342,18 @@ CPL::CPL (string directory, string file, shared_ptr<const AssetMap> asset_map, b shared_ptr<SoundAsset> sound; shared_ptr<SubtitleAsset> subtitle; - if ((*i)->asset_list->main_picture) { + /* Some rather twisted logic to decide if we are 3D or not; + some DCPs give a MainStereoscopicPicture to indicate 3D, others + just have a FrameRate twice the EditRate and apparently + expect you to divine the fact that they are hence 3D. + */ + + if (!(*i)->asset_list->main_stereoscopic_picture && p->edit_rate == p->frame_rate) { try { picture.reset (new MonoPictureAsset ( _directory, - asset_map->asset_from_id ((*i)->asset_list->main_picture->id)->chunks.front()->path, + asset_map->asset_from_id (p->id)->chunks.front()->path, _fps, (*i)->asset_list->main_picture->entry_point, (*i)->asset_list->main_picture->duration @@ -359,15 +365,15 @@ CPL::CPL (string directory, string file, shared_ptr<const AssetMap> asset_map, b } } - } else if ((*i)->asset_list->main_stereoscopic_picture) { - + } else { + try { picture.reset (new StereoPictureAsset ( _directory, - asset_map->asset_from_id ((*i)->asset_list->main_stereoscopic_picture->id)->chunks.front()->path, + asset_map->asset_from_id (p->id)->chunks.front()->path, _fps, - (*i)->asset_list->main_stereoscopic_picture->entry_point, - (*i)->asset_list->main_stereoscopic_picture->duration + p->entry_point, + p->duration ) ); } catch (MXFFileError) { diff --git a/src/types.cc b/src/types.cc index 39d7fea5..50aee2a2 100644 --- a/src/types.cc +++ b/src/types.cc @@ -20,6 +20,18 @@ Fraction::Fraction (string s) denominator = lexical_cast<int> (b[1]); } +bool +libdcp::operator== (Fraction const & a, Fraction const & b) +{ + return (a.numerator == b.numerator && a.denominator == b.denominator); +} + +bool +libdcp::operator!= (Fraction const & a, Fraction const & b) +{ + return (a.numerator != b.numerator || a.denominator != b.denominator); +} + Color::Color () : r (0) , g (0) diff --git a/src/types.h b/src/types.h index 98b7c33a..314b674b 100644 --- a/src/types.h +++ b/src/types.h @@ -82,6 +82,9 @@ public: int denominator; }; +extern bool operator== (Fraction const & a, Fraction const & b); +extern bool operator!= (Fraction const & a, Fraction const & b); + enum EqualityFlags { LIBDCP_METADATA = 0x1, MXF_BITWISE = 0x2, |
