Use entry points.
authorCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 14:28:46 +0000 (15:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Aug 2012 14:28:46 +0000 (15:28 +0100)
src/dcp.cc
src/mxf_asset.cc
src/mxf_asset.h
src/picture_asset.cc
src/picture_asset.h
src/sound_asset.cc
src/sound_asset.h

index aa937de52d095d712a0376279cea63a6706fa8e3..65a6a826dc0c84f786613bf553e8f86a5776c6e2 100644 (file)
@@ -293,6 +293,7 @@ DCP::DCP (string directory)
                                               _directory,
                                               n,
                                               _fps,
+                                              (*i)->asset_list->main_picture->entry_point,
                                               (*i)->asset_list->main_picture->duration
                                               )
                                );
@@ -308,6 +309,7 @@ DCP::DCP (string directory)
                                               _directory,
                                               n,
                                               _fps,
+                                              (*i)->asset_list->main_stereoscopic_picture->entry_point,
                                               (*i)->asset_list->main_stereoscopic_picture->duration
                                               )
                                );
@@ -325,6 +327,7 @@ DCP::DCP (string directory)
                                             _directory,
                                             n,
                                             _fps,
+                                            (*i)->asset_list->main_sound->entry_point,
                                             (*i)->asset_list->main_sound->duration
                                             )
                                );
index b5560b268d698510403fee994a0fdec665448dcf..2246c55d103ea458c0f7ad247f3722773edbdb4e 100644 (file)
@@ -34,10 +34,11 @@ using namespace std;
 using namespace boost;
 using namespace libdcp;
 
-MXFAsset::MXFAsset (string directory, string file_name, sigc::signal1<void, float>* progress, int fps, int length)
+MXFAsset::MXFAsset (string directory, string file_name, sigc::signal1<void, float>* progress, int fps, int entry_point, int length)
        : Asset (directory, file_name)
        , _progress (progress)
        , _fps (fps)
+       , _entry_point (entry_point)
        , _length (length)
 {
        
@@ -120,5 +121,3 @@ MXFAsset::length () const
 {
        return _length;
 }
-
-       
index d01d091d7104d2c9ed2c410b5b30dad85f047d13..cdcd08bf45b36f98997c126832245c46071562a3 100644 (file)
@@ -35,7 +35,7 @@ public:
         *  @param fps Frames per second.
         *  @param length Length in frames.
         */
-       MXFAsset (std::string directory, std::string file_name, sigc::signal1<void, float>* progress, int fps, int length);
+       MXFAsset (std::string directory, std::string file_name, sigc::signal1<void, float>* progress, int fps, int entry_point, int length);
 
        virtual std::list<std::string> equals (boost::shared_ptr<const Asset> other, EqualityOptions opt) const;
        
@@ -51,6 +51,7 @@ protected:
        sigc::signal1<void, float>* _progress;
        /** Frames per second */
        int _fps;
+       int _entry_point;
        /** Length in frames */
        int _length;
 };
index ac6ec05eab2cd344d394823c45251b2e881a107f..7db8515678138d91a98919616a57e5d35aa2798f 100644 (file)
@@ -40,8 +40,8 @@ using namespace std;
 using namespace boost;
 using namespace libdcp;
 
-PictureAsset::PictureAsset (string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length)
-       : MXFAsset (directory, mxf_name, progress, fps, length)
+PictureAsset::PictureAsset (string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int entry_point, int length)
+       : MXFAsset (directory, mxf_name, progress, fps, entry_point, length)
 {
 
 }
@@ -214,7 +214,7 @@ MonoPictureAsset::MonoPictureAsset (
        int length,
        int width,
        int height)
-       : PictureAsset (directory, mxf_name, progress, fps, length)
+       : PictureAsset (directory, mxf_name, progress, fps, 0, length)
 {
        _width = width;
        _height = height;
@@ -230,15 +230,15 @@ MonoPictureAsset::MonoPictureAsset (
        int length,
        int width,
        int height)
-       : PictureAsset (directory, mxf_name, progress, fps, length)
+       : PictureAsset (directory, mxf_name, progress, fps, 0, length)
 {
        _width = width;
        _height = height;
        construct (sigc::bind (sigc::mem_fun (*this, &MonoPictureAsset::path_from_list), files));
 }
 
-MonoPictureAsset::MonoPictureAsset (string directory, string mxf_name, int fps, int length)
-       : PictureAsset (directory, mxf_name, 0, fps, length)
+MonoPictureAsset::MonoPictureAsset (string directory, string mxf_name, int fps, int entry_point, int length)
+       : PictureAsset (directory, mxf_name, 0, fps, entry_point, length)
 {
        ASDCP::JP2K::MXFReader reader;
        if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) {
@@ -305,11 +305,11 @@ MonoPictureAsset::path_from_list (int f, vector<string> const & files) const
 shared_ptr<const MonoPictureFrame>
 MonoPictureAsset::get_frame (int n) const
 {
-       return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (path().string(), n));
+       return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (path().string(), n + _entry_point));
 }
 
-StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int fps, int length)
-       : PictureAsset (directory, mxf_name, 0, fps, length)
+StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int fps, int entry_point, int length)
+       : PictureAsset (directory, mxf_name, 0, fps, entry_point, length)
 {
        ASDCP::JP2K::MXFSReader reader;
        if (ASDCP_FAILURE (reader.OpenRead (path().string().c_str()))) {
@@ -328,5 +328,5 @@ StereoPictureAsset::StereoPictureAsset (string directory, string mxf_name, int f
 shared_ptr<const StereoPictureFrame>
 StereoPictureAsset::get_frame (int n) const
 {
-       return shared_ptr<const StereoPictureFrame> (new StereoPictureFrame (path().string(), n));
+       return shared_ptr<const StereoPictureFrame> (new StereoPictureFrame (path().string(), n + _entry_point));
 }
index c21e8cd53900d0cad4e59c883ddf38dd5ba5b072..ae45798439aeb21820aed6450f20b6f5bcac72db 100644 (file)
@@ -34,7 +34,7 @@ class StereoPictureFrame;
 class PictureAsset : public MXFAsset
 {
 public:
-       PictureAsset (std::string directory, std::string mxf_name, sigc::signal1<void, float>* progress, int fps, int length);
+       PictureAsset (std::string directory, std::string mxf_name, sigc::signal1<void, float>* progress, int fps, int entry_point, int length);
        
        /** Write details of this asset to a CPL stream.
         *  @param s Stream.
@@ -105,7 +105,7 @@ public:
                int height
                );
 
-       MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int length);
+       MonoPictureAsset (std::string directory, std::string mxf_name, int fps, int entry_point, int length);
        
        boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
 
@@ -117,7 +117,7 @@ private:
 class StereoPictureAsset : public PictureAsset
 {
 public:
-       StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int length);
+       StereoPictureAsset (std::string directory, std::string mxf_name, int fps, int entry_point, int length);
        
        boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
 };
index 7d8a86c82372626c2909afa1407e8bfe39272a68..75ca3a76db6ead19d9c02fbde0077dfc9ac10b6c 100644 (file)
@@ -39,7 +39,7 @@ using namespace libdcp;
 SoundAsset::SoundAsset (
        vector<string> const & files, string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length
        )
-       : MXFAsset (directory, mxf_name, progress, fps, length)
+       : MXFAsset (directory, mxf_name, progress, fps, 0, length)
        , _channels (files.size ())
        , _sampling_rate (0)
 {
@@ -49,15 +49,15 @@ SoundAsset::SoundAsset (
 SoundAsset::SoundAsset (
        sigc::slot<string, Channel> get_path, string directory, string mxf_name, sigc::signal1<void, float>* progress, int fps, int length, int channels
        )
-       : MXFAsset (directory, mxf_name, progress, fps, length)
+       : MXFAsset (directory, mxf_name, progress, fps, 0, length)
        , _channels (channels)
        , _sampling_rate (0)
 {
        construct (get_path);
 }
 
-SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int length)
-       : MXFAsset (directory, mxf_name, 0, fps, length)
+SoundAsset::SoundAsset (string directory, string mxf_name, int fps, int entry_point, int length)
+       : MXFAsset (directory, mxf_name, 0, fps, entry_point, length)
        , _channels (0)
 {
        ASDCP::PCM::MXFReader reader;
@@ -264,5 +264,5 @@ SoundAsset::equals (shared_ptr<const Asset> other, EqualityOptions opt) const
 shared_ptr<const SoundFrame>
 SoundAsset::get_frame (int n) const
 {
-       return shared_ptr<const SoundFrame> (new SoundFrame (path().string(), n));
+       return shared_ptr<const SoundFrame> (new SoundFrame (path().string(), n + _entry_point));
 }
index 84a941cd70f3ca7363d0b54ef3144685d49f4a9a..3f42a522b3a3953704fcf63b11df44b4efe3e884 100644 (file)
@@ -78,6 +78,7 @@ public:
                std::string directory,
                std::string mxf_name,
                int fps,
+               int entry_point,
                int length
                );