From f76647abae551840a43bb8f07189051ec20bab6d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 25 Sep 2013 20:41:45 +0100 Subject: Switch away from the many-constructor-arguments approach to a hopefully simpler API. --- src/cpl.cc | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'src/cpl.cc') diff --git a/src/cpl.cc b/src/cpl.cc index 5d57c7c7..48d08035 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -107,15 +107,13 @@ CPL::CPL (boost::filesystem::path directory, string file, list ass if (!(*i)->asset_list->main_stereoscopic_picture && p->edit_rate == p->frame_rate) { - pair > asset = asset_from_id (asset_maps, p->id); - try { - picture.reset (new MonoPictureAsset ( - asset.first, - asset.second->chunks.front()->path - ) - ); + pair > asset = asset_from_id (asset_maps, p->id); + picture.reset (new MonoPictureAsset (asset.first, asset.second->chunks.front()->path)); + + picture->read (); + picture->set_edit_rate (_fps); picture->set_entry_point (p->entry_point); picture->set_duration (p->duration); if (p->key_id.length() > 9) { @@ -132,14 +130,10 @@ CPL::CPL (boost::filesystem::path directory, string file, list ass try { pair > asset = asset_from_id (asset_maps, p->id); - picture.reset (new StereoPictureAsset ( - asset.first, - asset.second->chunks.front()->path, - _fps, - p->duration - ) - ); + picture.reset (new StereoPictureAsset (asset.first, asset.second->chunks.front()->path)); + picture->read (); + picture->set_edit_rate (_fps); picture->set_entry_point (p->entry_point); picture->set_duration (p->duration); if (p->key_id.length() > 9) { @@ -160,14 +154,10 @@ CPL::CPL (boost::filesystem::path directory, string file, list ass try { pair > asset = asset_from_id (asset_maps, (*i)->asset_list->main_sound->id); - sound.reset (new SoundAsset ( - asset.first, - asset.second->chunks.front()->path - ) - ); - + sound.reset (new SoundAsset (asset.first, asset.second->chunks.front()->path)); shared_ptr s = (*i)->asset_list->main_sound; + sound->read (); sound->set_entry_point (s->entry_point); sound->set_duration (s->duration); if (s->key_id.length() > 9) { @@ -185,11 +175,7 @@ CPL::CPL (boost::filesystem::path directory, string file, list ass pair > asset = asset_from_id (asset_maps, (*i)->asset_list->main_subtitle->id); - subtitle.reset (new SubtitleAsset ( - asset.first, - asset.second->chunks.front()->path - ) - ); + subtitle.reset (new SubtitleAsset (asset.first, asset.second->chunks.front()->path)); subtitle->set_entry_point ((*i)->asset_list->main_subtitle->entry_point); subtitle->set_duration ((*i)->asset_list->main_subtitle->duration); -- cgit v1.2.3