diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/CMakeLists.txt libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/CMakeLists.txt --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/CMakeLists.txt 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/CMakeLists.txt 2017-09-08 04:16:46.000000000 +0000 @@ -67,6 +67,9 @@ MESSAGE("--------------------------------------------------------------") MESSAGE("Generating build files for ${PROJECT_NAME} (${PROJECT_VERSION})") +#### Enable C++11 (for std::shared_ptr support) +set(CMAKE_CXX_FLAGS "-std=c++11") + IF (WIN32) SET_PROPERTY(GLOBAL PROPERTY WIN32 "WIN32") ENDIF(WIN32) diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/bzr-builder.manifest libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/bzr-builder.manifest --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/bzr-builder.manifest 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/bzr-builder.manifest 2017-09-08 04:16:54.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}+0+601+114+201706010453+daily -lp:libopenshot revid:jonathan@openshot.org-20170601043913-wwd7qqsz1pnlmgz7 -nest-part packaging lp:~openshot.packagers/libopenshot/packaging libopenshot/debian debian revid:jonathan@openshot.org-20170601045144-fkw1tpxw7am7i9zl +# bzr-builder format 0.3 deb-version {debupstream}+0+612+116+201709080416+daily +lp:libopenshot revid:jonathan@openshot.org-20170907041312-1xzq72bo62n331cg +nest-part packaging lp:~openshot.packagers/libopenshot/packaging libopenshot/debian debian revid:jonathan@openshot.org-20170907042621-x98o1mxrhbskm48o diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/changelog libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/changelog --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/changelog 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/changelog 2017-09-08 04:16:54.000000000 +0000 @@ -1,8 +1,14 @@ -libopenshot (0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1) vivid; urgency=low +libopenshot (0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1) vivid; urgency=low * Auto build. - -- OpenShot Code Thu, 01 Jun 2017 04:53:35 +0000 + -- OpenShot Code Fri, 08 Sep 2017 04:16:54 +0000 + +libopenshot (0.1.8-1) UNRELEASED; urgency=medium + + * New upstream release + + -- Jonathan Thomas Wed, 06 Sep 2017 23:16:25 -0500 libopenshot (0.1.7-1) UNRELEASED; urgency=medium diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/control libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/control --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/control 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/control 2017-09-08 04:16:53.000000000 +0000 @@ -26,13 +26,14 @@ Standards-Version: 3.9.6 Homepage: http://www.openshot.org/ -Package: libopenshot12 +Package: libopenshot13 Architecture: any Multi-Arch: same Depends: ${misc:Depends}, ${shlibs:Depends} Pre-Depends: ${misc:Pre-Depends} -Replaces: libopenshot11, +Replaces: libopenshot12, + libopenshot11, libopenshot10, libopenshot9, libopenshot8, @@ -54,7 +55,7 @@ Architecture: any Multi-Arch: same Section: libdevel -Depends: libopenshot12 (= ${binary:Version}), +Depends: libopenshot13 (= ${binary:Version}), ${misc:Depends} Suggests: libopenshot-doc Description: development files for the OpenShot library diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/libopenshot12.install libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/libopenshot12.install --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/libopenshot12.install 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/libopenshot12.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/*/*.so.* diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/libopenshot13.install libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/libopenshot13.install --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/libopenshot13.install 1970-01-01 00:00:00.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/libopenshot13.install 2017-09-08 04:16:53.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/*.so.* diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/AudioReaderSource.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/AudioReaderSource.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/AudioReaderSource.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/AudioReaderSource.h 2017-09-08 04:16:46.000000000 +0000 @@ -63,7 +63,7 @@ ReaderBase *reader; /// The reader to pull samples from int64 original_frame_number; /// The current frame to read from int64 frame_number; /// The current frame number - tr1::shared_ptr frame; /// The current frame object that is being read + std::shared_ptr frame; /// The current frame object that is being read long int frame_position; /// The position of the current frame's buffer double estimated_frame; /// The estimated frame position of the currently playing buffer int estimated_samples_per_frame; /// The estimated samples per frame of video @@ -118,7 +118,7 @@ const ReaderInfo & getReaderInfo() const { return reader->info; } /// Return the current frame object - tr1::shared_ptr getFrame() const { return frame; } + std::shared_ptr getFrame() const { return frame; } /// Get the estimate frame that is playing at this moment long int getEstimatedFrame() const { return long(estimated_frame); } diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheBase.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheBase.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheBase.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheBase.h 2017-09-08 04:16:46.000000000 +0000 @@ -28,7 +28,7 @@ #ifndef OPENSHOT_CACHE_BASE_H #define OPENSHOT_CACHE_BASE_H -#include +#include #include "Frame.h" #include "Exceptions.h" #include "Json.h" @@ -62,7 +62,7 @@ /// @brief Add a Frame to the cache /// @param frame The openshot::Frame object needing to be cached. - virtual void Add(tr1::shared_ptr frame) = 0; + virtual void Add(std::shared_ptr frame) = 0; /// Clear the cache of all frames virtual void Clear() = 0; @@ -72,13 +72,13 @@ /// @brief Get a frame from the cache /// @param frame_number The frame number of the cached frame - virtual tr1::shared_ptr GetFrame(long int frame_number) = 0; + virtual std::shared_ptr GetFrame(long int frame_number) = 0; /// Gets the maximum bytes value virtual long long int GetBytes() = 0; /// Get the smallest frame number - virtual tr1::shared_ptr GetSmallestFrame() = 0; + virtual std::shared_ptr GetSmallestFrame() = 0; /// @brief Remove a specific frame /// @param frame_number The frame number of the cached frame diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheDisk.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheDisk.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheDisk.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheDisk.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include "CacheBase.h" #include "Frame.h" #include "Exceptions.h" @@ -93,7 +93,7 @@ /// @brief Add a Frame to the cache /// @param frame The openshot::Frame object needing to be cached. - void Add(tr1::shared_ptr frame); + void Add(std::shared_ptr frame); /// Clear the cache of all frames void Clear(); @@ -103,13 +103,13 @@ /// @brief Get a frame from the cache /// @param frame_number The frame number of the cached frame - tr1::shared_ptr GetFrame(long int frame_number); + std::shared_ptr GetFrame(long int frame_number); /// Gets the maximum bytes value long long int GetBytes(); /// Get the smallest frame number - tr1::shared_ptr GetSmallestFrame(); + std::shared_ptr GetSmallestFrame(); /// @brief Move frame to front of queue (so it lasts longer) /// @param frame_number The frame number of the cached frame diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheMemory.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheMemory.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/CacheMemory.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/CacheMemory.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include "CacheBase.h" #include "Frame.h" #include "Exceptions.h" @@ -47,7 +47,7 @@ */ class CacheMemory : public CacheBase { private: - map > frames; ///< This map holds the frame number and Frame objects + map > frames; ///< This map holds the frame number and Frame objects deque frame_numbers; ///< This queue holds a sequential list of cached Frame numbers bool needs_range_processing; ///< Something has changed, and the range data needs to be re-calculated @@ -75,7 +75,7 @@ /// @brief Add a Frame to the cache /// @param frame The openshot::Frame object needing to be cached. - void Add(tr1::shared_ptr frame); + void Add(std::shared_ptr frame); /// Clear the cache of all frames void Clear(); @@ -85,13 +85,13 @@ /// @brief Get a frame from the cache /// @param frame_number The frame number of the cached frame - tr1::shared_ptr GetFrame(long int frame_number); + std::shared_ptr GetFrame(long int frame_number); /// Gets the maximum bytes value long long int GetBytes(); /// Get the smallest frame number - tr1::shared_ptr GetSmallestFrame(); + std::shared_ptr GetSmallestFrame(); /// @brief Move frame to front of queue (so it lasts longer) /// @param frame_number The frame number of the cached frame diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ChunkReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ChunkReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ChunkReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ChunkReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include "Json.h" #include "CacheMemory.h" #include "Exceptions.h" @@ -110,7 +110,7 @@ FFmpegReader *local_reader; ChunkLocation previous_location; ChunkVersion version; - tr1::shared_ptr last_frame; + std::shared_ptr last_frame; /// Check if folder path existing bool does_folder_exist(string path); @@ -149,7 +149,7 @@ /// @brief Get an openshot::Frame object for a specific frame number of this reader. /// @returns The requested frame (containing the image and audio) /// @param requested_frame The frame number you want to retrieve - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed, ChunkNotFound); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed, ChunkNotFound); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ChunkWriter.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ChunkWriter.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ChunkWriter.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ChunkWriter.h 2017-09-08 04:16:46.000000000 +0000 @@ -90,7 +90,7 @@ FFmpegWriter *writer_thumb; FFmpegWriter *writer_preview; FFmpegWriter *writer_final; - tr1::shared_ptr last_frame; + std::shared_ptr last_frame; bool last_frame_needed; string default_extension; string default_vcodec; @@ -133,7 +133,7 @@ /// @brief Add a frame to the stack waiting to be encoded. /// @param frame The openshot::Frame object that needs to be written to this chunk file. - void WriteFrame(tr1::shared_ptr frame) throw(WriterClosed); + void WriteFrame(std::shared_ptr frame) throw(WriterClosed); /// @brief Write a block of frames from a reader /// @param start The starting frame number to write (of the reader passed into the constructor) diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ClipBase.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ClipBase.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ClipBase.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ClipBase.h 2017-09-08 04:16:46.000000000 +0000 @@ -33,7 +33,7 @@ #define __JUCE_UNITTEST_JUCEHEADER__ #endif -#include +#include #include #include "Exceptions.h" #include "Point.h" diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Clip.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Clip.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Clip.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Clip.h 2017-09-08 04:16:46.000000000 +0000 @@ -33,7 +33,7 @@ #define __JUCE_UNITTEST_JUCEHEADER__ #endif -#include +#include #include #include #include "JuceLibraryCode/JuceHeader.h" @@ -127,16 +127,16 @@ long int adjust_frame_number_minimum(long int frame_number); /// Apply effects to the source frame (if any) - tr1::shared_ptr apply_effects(tr1::shared_ptr frame); + std::shared_ptr apply_effects(std::shared_ptr frame); /// Get file extension string get_file_extension(string path); /// Get a frame object or create a blank one - tr1::shared_ptr GetOrCreateFrame(long int number); + std::shared_ptr GetOrCreateFrame(long int number); /// Adjust the audio and image of a time mapped frame - tr1::shared_ptr get_time_mapped_frame(tr1::shared_ptr frame, long int frame_number) throw(ReaderClosed); + std::shared_ptr get_time_mapped_frame(std::shared_ptr frame, long int frame_number) throw(ReaderClosed); /// Init default settings for a clip void init_settings(); @@ -181,7 +181,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Open the internal reader void Open() throw(InvalidFile, ReaderClosed); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkInput.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkInput.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkInput.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkInput.h 2017-09-08 04:16:46.000000000 +0000 @@ -93,7 +93,7 @@ virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*); // Extra methods - tr1::shared_ptr GetFrame(long int requested_frame); + std::shared_ptr GetFrame(long int requested_frame); unsigned long GetCurrentFrameNumber(); private: diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkOutput.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkOutput.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkOutput.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkOutput.h 2017-09-08 04:16:46.000000000 +0000 @@ -97,7 +97,7 @@ // Queue of raw video frames //deque final_frames; deque final_frames; - deque > raw_video_frames; + deque > raw_video_frames; // Convert between YUV and RGB IDeckLinkOutput *deckLinkOutput; @@ -125,7 +125,7 @@ void ScheduleNextFrame(bool prerolling); /// Custom method to write new frames - void WriteFrame(tr1::shared_ptr frame); + void WriteFrame(std::shared_ptr frame); private: ULONG m_refCount; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include "CacheMemory.h" @@ -107,7 +107,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); unsigned long GetCurrentFrameNumber(); /// Determine if reader is open or closed diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkWriter.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkWriter.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DecklinkWriter.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DecklinkWriter.h 2017-09-08 04:16:46.000000000 +0000 @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include "CacheMemory.h" @@ -96,7 +96,7 @@ void Close(); /// This method is required for all derived classes of WriterBase. Write a Frame to the video file. - void WriteFrame(tr1::shared_ptr frame) throw(WriterClosed); + void WriteFrame(std::shared_ptr frame) throw(WriterClosed); /// This method is required for all derived classes of WriterBase. Write a block of frames from a reader. void WriteFrame(ReaderBase* reader, int start, int length) throw(WriterClosed); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DummyReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DummyReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/DummyReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/DummyReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "CacheMemory.h" #include "Exceptions.h" #include "Fraction.h" @@ -53,7 +53,7 @@ class DummyReader : public ReaderBase { private: - tr1::shared_ptr image_frame; + std::shared_ptr image_frame; bool is_open; public: @@ -75,7 +75,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/EffectBase.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/EffectBase.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/EffectBase.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/EffectBase.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include "ClipBase.h" #include "Frame.h" #include "Json.h" @@ -84,7 +84,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - virtual tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number) = 0; + virtual std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number) = 0; /// Initialize the values of the EffectInfo struct. It is important for derived classes to call /// this method, or the EffectInfo struct values will not be initialized. diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Blur.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Blur.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Blur.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Blur.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include "../Color.h" #include "../Exceptions.h" @@ -98,7 +98,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Brightness.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Brightness.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Brightness.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Brightness.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../Json.h" @@ -88,7 +88,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/ChromaKey.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/ChromaKey.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/ChromaKey.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/ChromaKey.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../KeyFrame.h" @@ -82,7 +82,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Deinterlace.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Deinterlace.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Deinterlace.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Deinterlace.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../Json.h" @@ -78,7 +78,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Mask.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Mask.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Mask.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Mask.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../Json.h" @@ -64,13 +64,13 @@ { private: ReaderBase *reader; - tr1::shared_ptr original_mask; + std::shared_ptr original_mask; /// Constrain a color value from 0 to 255 int constrain(int color_value); /// Get grayscale mask image - void set_grayscale_mask(tr1::shared_ptr mask_frame_image, int width, int height, float brightness, float contrast); + void set_grayscale_mask(std::shared_ptr mask_frame_image, int width, int height, float brightness, float contrast); /// Init effect settings void init_effect_details(); @@ -101,7 +101,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Negate.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Negate.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Negate.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Negate.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../KeyFrame.h" @@ -66,7 +66,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Saturation.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Saturation.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/effects/Saturation.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/effects/Saturation.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "../Color.h" #include "../Exceptions.h" #include "../Json.h" @@ -85,7 +85,7 @@ /// @returns The modified openshot::Frame object /// @param frame The frame object that needs the effect applied to it /// @param frame_number The frame number (starting at 1) of the effect on the timeline. - tr1::shared_ptr GetFrame(tr1::shared_ptr frame, long int frame_number); + std::shared_ptr GetFrame(std::shared_ptr frame, long int frame_number); /// Get and Set JSON methods string Json(); ///< Generate JSON string of this object diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include "CacheMemory.h" #include "Exceptions.h" #include "OpenMPUtilities.h" @@ -78,7 +78,7 @@ * r.Open(); // Open the reader * * // Get frame number 1 from the video - * tr1::shared_ptr f = r.GetFrame(1); + * std::shared_ptr f = r.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen @@ -108,7 +108,6 @@ CacheMemory working_cache; CacheMemory missing_frames; - map frames; map processing_video_frames; multimap processing_audio_frames; map processed_video_frames; @@ -117,7 +116,6 @@ multimap missing_video_frames_source; multimap missing_audio_frames; multimap missing_audio_frames_source; - multimap duplicate_video_frames; map checked_frames; AudioLocation previous_packet_location; @@ -128,7 +126,7 @@ long int pts_counter; long int num_packets_since_video_frame; long int num_checks_since_final; - tr1::shared_ptr last_video_frame; + std::shared_ptr last_video_frame; bool is_seeking; long int seeking_pts; @@ -169,7 +167,7 @@ long int ConvertVideoPTStoFrame(long int pts); /// Create a new Frame (or return an existing one) and add it to the working queue. - tr1::shared_ptr CreateFrame(long int requested_frame); + std::shared_ptr CreateFrame(long int requested_frame); /// Calculate Starting video frame and sample # for an audio PTS AudioLocation GetAudioPTSLocation(long int pts); @@ -199,7 +197,7 @@ void ProcessAudioPacket(long int requested_frame, long int target_frame, int starting_sample); /// Read the stream until we find the requested Frame - tr1::shared_ptr ReadStream(long int requested_frame); + std::shared_ptr ReadStream(long int requested_frame); /// Remove AVFrame from cache (and deallocate it's memory) void RemoveAVFrame(AVPicture*); @@ -249,7 +247,7 @@ /// /// @returns The requested frame of video /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks); + std::shared_ptr GetFrame(long int requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegUtilities.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegUtilities.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegUtilities.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegUtilities.h 2017-09-08 04:16:46.000000000 +0000 @@ -102,11 +102,13 @@ #define AV_ALLOCATE_FRAME() av_frame_alloc() #define AV_RESET_FRAME(av_frame) av_frame_unref(av_frame) #define AV_FREE_FRAME(av_frame) av_frame_free(av_frame) + #define AV_FREE_PACKET(av_packet) av_packet_unref(av_packet) #else #define AV_ALLOCATE_FRAME() avcodec_alloc_frame() #define AV_RESET_FRAME(av_frame) avcodec_get_frame_defaults(av_frame) #define AV_FREE_FRAME(av_frame) avcodec_free_frame(av_frame) - #endif + #define AV_FREE_PACKET(av_packet) av_free_packet(av_packet) + #endif #endif diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegWriter.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegWriter.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FFmpegWriter.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FFmpegWriter.h 2017-09-08 04:16:46.000000000 +0000 @@ -181,20 +181,20 @@ int original_sample_rate; int original_channels; - tr1::shared_ptr last_frame; - deque > spooled_audio_frames; - deque > spooled_video_frames; + std::shared_ptr last_frame; + deque > spooled_audio_frames; + deque > spooled_video_frames; - deque > queued_audio_frames; - deque > queued_video_frames; + deque > queued_audio_frames; + deque > queued_video_frames; - deque > processed_frames; - deque > deallocate_frames; + deque > processed_frames; + deque > deallocate_frames; - map, AVFrame*> av_frames; + map, AVFrame*> av_frames; /// Add an AVFrame to the cache - void add_avframe(tr1::shared_ptr frame, AVFrame* av_frame); + void add_avframe(std::shared_ptr frame, AVFrame* av_frame); /// Add an audio output stream AVStream* add_audio_stream(); @@ -232,13 +232,13 @@ void open_video(AVFormatContext *oc, AVStream *st); /// process video frame - void process_video_packet(tr1::shared_ptr frame); + void process_video_packet(std::shared_ptr frame); /// write all queued frames' audio to the video file void write_audio_packets(bool final); /// write video frame - bool write_video_packet(tr1::shared_ptr frame, AVFrame* frame_final); + bool write_video_packet(std::shared_ptr frame, AVFrame* frame_final); /// write all queued frames void write_queued_frames() throw (ErrorEncodingVideo); @@ -316,7 +316,7 @@ /// @brief Add a frame to the stack waiting to be encoded. /// @param frame The openshot::Frame object to write to this image - void WriteFrame(tr1::shared_ptr frame) throw(ErrorEncodingVideo, WriterClosed); + void WriteFrame(std::shared_ptr frame) throw(ErrorEncodingVideo, WriterClosed); /// @brief Write a block of frames from a reader /// @param reader A openshot::ReaderBase object which will provide frames to be written diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Frame.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Frame.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Frame.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Frame.h 2017-09-08 04:16:46.000000000 +0000 @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include "ZmqLogger.h" #ifdef USE_IMAGEMAGICK @@ -108,18 +108,19 @@ * ); * * // Some methods require a shared pointer to an openshot::Frame object. - * tr1::shared_ptr f(new Frame(1, 720, 480, "#000000", 44100, 2)); + * std::shared_ptr f(new Frame(1, 720, 480, "#000000", 44100, 2)); * * @endcode */ class Frame { private: - tr1::shared_ptr image; - tr1::shared_ptr wave_image; - tr1::shared_ptr audio; - tr1::shared_ptr previewApp; + std::shared_ptr image; + std::shared_ptr wave_image; + std::shared_ptr audio; + std::shared_ptr previewApp; CriticalSection addingImageSection; + CriticalSection addingAudioSection; const unsigned char *qbuffer; Fraction pixel_ratio; int channels; @@ -164,14 +165,14 @@ void AddImage(int new_width, int new_height, int bytes_per_pixel, QImage::Format type, const unsigned char *pixels_); /// Add (or replace) pixel data to the frame - void AddImage(tr1::shared_ptr new_image); + void AddImage(std::shared_ptr new_image); /// Add (or replace) pixel data to the frame (for only the odd or even lines) - void AddImage(tr1::shared_ptr new_image, bool only_odd_lines); + void AddImage(std::shared_ptr new_image, bool only_odd_lines); #ifdef USE_IMAGEMAGICK /// Add (or replace) pixel data to the frame from an ImageMagick Image - void AddMagickImage(tr1::shared_ptr new_image); + void AddMagickImage(std::shared_ptr new_image); #endif /// Add audio samples to a specific channel @@ -229,11 +230,11 @@ int64 GetBytes(); /// Get pointer to Qt QImage image object - tr1::shared_ptr GetImage(); + std::shared_ptr GetImage(); #ifdef USE_IMAGEMAGICK /// Get pointer to ImageMagick image object - tr1::shared_ptr GetMagickImage(); + std::shared_ptr GetMagickImage(); #endif /// Set Pixel Aspect Ratio @@ -255,7 +256,7 @@ static int GetSamplesPerFrame(long int frame_number, Fraction fps, int sample_rate, int channels); /// Get an audio waveform image - tr1::shared_ptr GetWaveform(int width, int height, int Red, int Green, int Blue, int Alpha); + std::shared_ptr GetWaveform(int width, int height, int Red, int Green, int Blue, int Alpha); /// Get an audio waveform image pixels const unsigned char* GetWaveformPixels(int width, int height, int Red, int Green, int Blue, int Alpha); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FrameMapper.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FrameMapper.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/FrameMapper.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/FrameMapper.h 2017-09-08 04:16:46.000000000 +0000 @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include "CacheMemory.h" #include "../include/ReaderBase.h" #include "../include/Frame.h" @@ -130,7 +130,7 @@ * \code * // Create a frame mapper for a reader, and convert the frame rate (from 24 fps to 29.97 fps) * FrameMapper mapping(reader, Fraction(30000, 1001), PULLDOWN_CLASSIC, 44100, 2, LAYOUT_STEREO); - * tr1::shared_ptr frame2 = mapping.GetFrame(2); + * std::shared_ptr frame2 = mapping.GetFrame(2); * // If you need to change the mapping... * mapping.ChangeMapping(Fraction(24, 1), PULLDOWN_CLASSIC, 48000, 2, LAYOUT_MONO) @@ -154,7 +154,7 @@ void AddField(Field field); // Get Frame or Generate Blank Frame - tr1::shared_ptr GetOrCreateFrame(long int number); + std::shared_ptr GetOrCreateFrame(long int number); // Use the original and target frame rates and a pull-down technique to create // a mapping between the original fields and frames or a video to a new frame rate. @@ -194,7 +194,7 @@ /// /// @returns The requested frame of video /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Determine if reader is open or closed bool IsOpen(); @@ -218,7 +218,7 @@ ReaderBase* Reader() throw(ReaderClosed); /// Resample audio and map channels (if needed) - void ResampleMappedAudio(tr1::shared_ptr frame, long int original_frame_number); + void ResampleMappedAudio(std::shared_ptr frame, long int original_frame_number); }; } diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ImageReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ImageReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ImageReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ImageReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "Magick++.h" #include "CacheMemory.h" #include "Exceptions.h" @@ -55,7 +55,7 @@ * r.Open(); // Open the reader * * // Get frame number 1 from the video - * tr1::shared_ptr f = r.GetFrame(1); + * std::shared_ptr f = r.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen @@ -68,7 +68,7 @@ { private: string path; - tr1::shared_ptr image; + std::shared_ptr image; bool is_open; public: @@ -93,7 +93,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ImageWriter.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ImageWriter.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ImageWriter.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ImageWriter.h 2017-09-08 04:16:46.000000000 +0000 @@ -95,7 +95,7 @@ int number_of_loops; bool combine_frames; - tr1::shared_ptr last_frame; + std::shared_ptr last_frame; public: @@ -133,7 +133,7 @@ /// @brief Add a frame to the stack waiting to be encoded. /// @param frame The openshot::Frame object to write to this image - void WriteFrame(tr1::shared_ptr frame) throw(WriterClosed); + void WriteFrame(std::shared_ptr frame) throw(WriterClosed); /// @brief Write a block of frames from a reader /// @param reader A openshot::ReaderBase object which will provide frames to be written diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/OpenMPUtilities.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/OpenMPUtilities.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/OpenMPUtilities.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/OpenMPUtilities.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include - // Calculate the # of OpenMP Threads to allow (HACK / WORK-AROUND for an ImageMagick bug: preventing use of all 8 cores) + // Calculate the # of OpenMP Threads to allow #define OPEN_MP_NUM_PROCESSORS omp_get_num_procs() #endif diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/OpenShot.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/OpenShot.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/OpenShot.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/OpenShot.h 2017-09-08 04:16:46.000000000 +0000 @@ -47,7 +47,7 @@ * r.Open(); // Open the reader * * // Get frame number 1 from the video - * tr1::shared_ptr f = r.GetFrame(1); + * std::shared_ptr f = r.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/AudioPlaybackThread.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/AudioPlaybackThread.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/AudioPlaybackThread.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/AudioPlaybackThread.h 2017-09-08 04:16:46.000000000 +0000 @@ -99,7 +99,7 @@ void Reader(ReaderBase *reader); /// Get the current frame object (which is filling the buffer) - tr1::shared_ptr getFrame(); + std::shared_ptr getFrame(); /// Get the current frame number being played long int getCurrentFramePosition(); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/PlayerPrivate.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/PlayerPrivate.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/PlayerPrivate.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/PlayerPrivate.h 2017-09-08 04:16:46.000000000 +0000 @@ -46,7 +46,7 @@ */ class PlayerPrivate : Thread { - tr1::shared_ptr frame; /// The current frame + std::shared_ptr frame; /// The current frame long int video_position; /// The current frame position. long int audio_position; /// The current frame position. ReaderBase *reader; /// The reader which powers this player @@ -72,7 +72,7 @@ void stopPlayback(int timeOutMilliseconds = -1); /// Get the next frame (based on speed and direction) - tr1::shared_ptr getFrame(); + std::shared_ptr getFrame(); /// The parent class of PlayerPrivate friend class QtPlayer; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoCacheThread.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoCacheThread.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoCacheThread.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoCacheThread.h 2017-09-08 04:16:46.000000000 +0000 @@ -42,7 +42,7 @@ */ class VideoCacheThread : Thread { - std::tr1::shared_ptr frame; + std::shared_ptr frame; int speed; bool is_playing; long int position; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoPlaybackThread.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoPlaybackThread.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoPlaybackThread.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoPlaybackThread.h 2017-09-08 04:16:46.000000000 +0000 @@ -43,7 +43,7 @@ class VideoPlaybackThread : Thread { RendererBase *renderer; - std::tr1::shared_ptr frame; + std::shared_ptr frame; WaitableEvent render; WaitableEvent rendered; bool reset; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoRenderer.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoRenderer.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Qt/VideoRenderer.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Qt/VideoRenderer.h 2017-09-08 04:16:46.000000000 +0000 @@ -31,7 +31,7 @@ #include "../RendererBase.h" #include #include -#include +#include class QPainter; @@ -52,7 +52,7 @@ protected: //void render(openshot::OSPixelFormat format, int width, int height, int bytesPerLine, unsigned char *data); - void render(tr1::shared_ptr image); + void render(std::shared_ptr image); private slots: diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/QtImageReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/QtImageReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/QtImageReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/QtImageReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,7 +57,7 @@ * r.Open(); // Open the reader * * // Get frame number 1 from the video - * tr1::shared_ptr f = r.GetFrame(1); + * std::shared_ptr f = r.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen @@ -70,8 +70,8 @@ { private: string path; - tr1::shared_ptr image; ///> Original image (full quality) - tr1::shared_ptr cached_image; ///> Scaled for performance + std::shared_ptr image; ///> Original image (full quality) + std::shared_ptr cached_image; ///> Scaled for performance bool is_open; public: @@ -96,7 +96,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; @@ -110,6 +110,9 @@ Json::Value JsonValue(); ///< Generate Json::JsonValue for this object void SetJsonValue(Json::Value root) throw(InvalidFile); ///< Load Json::JsonValue into this object + /// Set Max Image Size (used for performance optimization) + void SetMaxSize(int width, int height); + /// Open File - which is called by the constructor automatically void Open() throw(InvalidFile); }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ReaderBase.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ReaderBase.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/ReaderBase.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/ReaderBase.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include "CacheMemory.h" @@ -125,7 +125,7 @@ /// /// @returns The requested frame of video /// @param[in] number The frame number that is requested. - virtual tr1::shared_ptr GetFrame(long int number) = 0; + virtual std::shared_ptr GetFrame(long int number) = 0; /// Determine if reader is open or closed virtual bool IsOpen() = 0; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/RendererBase.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/RendererBase.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/RendererBase.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/RendererBase.h 2017-09-08 04:16:46.000000000 +0000 @@ -30,7 +30,7 @@ #include "../include/Frame.h" #include // for realloc -#include +#include namespace openshot { @@ -47,7 +47,7 @@ public: /// Paint(render) a video Frame. - void paint(const std::tr1::shared_ptr & frame); + void paint(const std::shared_ptr & frame); /// Allow manual override of the QWidget that is used to display virtual void OverrideWidget(long long qwidget_address) = 0; @@ -56,7 +56,7 @@ RendererBase(); virtual ~RendererBase(); - virtual void render(tr1::shared_ptr image) = 0; + virtual void render(std::shared_ptr image) = 0; }; } diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/TextReader.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/TextReader.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/TextReader.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/TextReader.h 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "Magick++.h" #include "CacheMemory.h" #include "Enums.h" @@ -69,7 +69,7 @@ * r.Open(); // Open the reader * * // Get frame number 1 from the video (in fact, any frame # you request will return the same frame) - * tr1::shared_ptr f = r.GetFrame(1); + * std::shared_ptr f = r.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen @@ -90,7 +90,7 @@ double size; string text_color; string background_color; - tr1::shared_ptr image; + std::shared_ptr image; list lines; bool is_open; GravityType gravity; @@ -124,7 +124,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed); /// Determine if reader is open or closed bool IsOpen() { return is_open; }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Timeline.h libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Timeline.h --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/include/Timeline.h 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/include/Timeline.h 2017-09-08 04:16:46.000000000 +0000 @@ -29,7 +29,7 @@ #define OPENSHOT_TIMELINE_H #include -#include +#include #include #include #include "CacheBase.h" @@ -133,7 +133,7 @@ * t.Open(); * * // Get frame number 1 from the timeline (This will generate a new frame, made up from the previous clips and settings) - * tr1::shared_ptr f = t.GetFrame(1); + * std::shared_ptr f = t.GetFrame(1); * * // Now that we have an openshot::Frame object, lets have some fun! * f->Display(); // Display the frame on the screen @@ -153,7 +153,7 @@ CacheBase *final_cache; /// new_frame, Clip* source_clip, long int clip_frame_number, long int timeline_frame_number, bool is_top_clip); + void add_layer(std::shared_ptr new_frame, Clip* source_clip, long int clip_frame_number, long int timeline_frame_number, bool is_top_clip); /// Apply a FrameMapper to a clip which matches the settings of this timeline void apply_mapper_to_clip(Clip* clip); @@ -176,10 +176,10 @@ vector find_intersecting_clips(long int requested_frame, int number_of_frames, bool include); /// Get or generate a blank frame - tr1::shared_ptr GetOrCreateFrame(Clip* clip, long int number); + std::shared_ptr GetOrCreateFrame(Clip* clip, long int number); /// Apply effects to the source frame (if any) - tr1::shared_ptr apply_effects(tr1::shared_ptr frame, long int timeline_frame_number, int layer); + std::shared_ptr apply_effects(std::shared_ptr frame, long int timeline_frame_number, int layer); /// Compare 2 floating point numbers for equality bool isEqual(double a, double b); @@ -243,7 +243,7 @@ /// /// @returns The requested frame (containing the image) /// @param requested_frame The frame number that is requested. - tr1::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed, OutOfBoundsFrame); + std::shared_ptr GetFrame(long int requested_frame) throw(ReaderClosed, OutOfBoundsFrame); // Curves for the viewport Keyframe viewport_scale; /// frame) throw(ErrorEncodingVideo, WriterClosed) = 0; + virtual void WriteFrame(std::shared_ptr frame) throw(ErrorEncodingVideo, WriterClosed) = 0; /// This method is required for all derived classes of WriterBase. Write a block of frames from a reader. virtual void WriteFrame(ReaderBase* reader, long int start, long int length) throw(ErrorEncodingVideo, WriterClosed) = 0; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/.pc/.quilt_patches libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/.pc/.quilt_patches --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/.pc/.quilt_patches 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/.pc/.quilt_patches 2017-09-08 04:16:58.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1382479/chroot-autobuild/home/buildd/work/tree/libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/patches +/home/buildd/build-RECIPEBRANCHBUILD-1444780/chroot-autobuild/home/buildd/work/tree/libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/patches diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/.pc/.quilt_series libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/.pc/.quilt_series --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/.pc/.quilt_series 2017-06-01 04:53:35.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/.pc/.quilt_series 2017-09-08 04:16:58.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1382479/chroot-autobuild/home/buildd/work/tree/libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/debian/patches/series +/home/buildd/build-RECIPEBRANCHBUILD-1444780/chroot-autobuild/home/buildd/work/tree/libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/debian/patches/series diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/bindings/python/openshot.i libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/bindings/python/openshot.i --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/bindings/python/openshot.i 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/bindings/python/openshot.i 2017-09-08 04:16:46.000000000 +0000 @@ -40,7 +40,6 @@ %include /* Include shared pointer code */ -#define SWIG_SHARED_PTR_SUBNAMESPACE tr1 %include /* Mark these classes as shared_ptr classes */ diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/bindings/ruby/openshot.i libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/bindings/ruby/openshot.i --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/bindings/ruby/openshot.i 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/bindings/ruby/openshot.i 2017-09-08 04:16:46.000000000 +0000 @@ -40,7 +40,6 @@ %include namespace std { -namespace tr1 { template class shared_ptr { public: @@ -50,11 +49,11 @@ /* Mark these classes as shared_ptr classes */ #ifdef USE_IMAGEMAGICK - %template(SPtrImage) std::tr1::shared_ptr; + %template(SPtrImage) std::shared_ptr; #endif -%template(SPtrAudioBuffer) std::tr1::shared_ptr; -%template(SPtrOpenFrame) std::tr1::shared_ptr; -%template(SPtrFrame) std::tr1::shared_ptr; +%template(SPtrAudioBuffer) std::shared_ptr; +%template(SPtrOpenFrame) std::shared_ptr; +%template(SPtrFrame) std::shared_ptr; %{ diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CacheDisk.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CacheDisk.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CacheDisk.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CacheDisk.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -163,7 +163,7 @@ } // Add a Frame to the cache -void CacheDisk::Add(tr1::shared_ptr frame) +void CacheDisk::Add(std::shared_ptr frame) { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); @@ -222,7 +222,7 @@ } // Get a frame from the cache (or NULL shared_ptr if no frame is found) -tr1::shared_ptr CacheDisk::GetFrame(long int frame_number) +std::shared_ptr CacheDisk::GetFrame(long int frame_number) { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); @@ -234,14 +234,14 @@ if (path.exists(frame_path)) { // Load image file - tr1::shared_ptr image = tr1::shared_ptr(new QImage()); + std::shared_ptr image = std::shared_ptr(new QImage()); bool success = image->load(QString::fromStdString(frame_path.toStdString())); // Set pixel formatimage-> - image = tr1::shared_ptr(new QImage(image->convertToFormat(QImage::Format_RGBA8888))); + image = std::shared_ptr(new QImage(image->convertToFormat(QImage::Format_RGBA8888))); // Create frame object - tr1::shared_ptr frame(new Frame()); + std::shared_ptr frame(new Frame()); frame->number = frame_number; frame->AddImage(image); @@ -288,15 +288,15 @@ } // no Frame found - return tr1::shared_ptr(); + return std::shared_ptr(); } // Get the smallest frame number (or NULL shared_ptr if no frame is found) -tr1::shared_ptr CacheDisk::GetSmallestFrame() +std::shared_ptr CacheDisk::GetSmallestFrame() { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); - tr1::shared_ptr f; + std::shared_ptr f; // Loop through frame numbers deque::iterator itr; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CacheMemory.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CacheMemory.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CacheMemory.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CacheMemory.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -127,7 +127,7 @@ } // Add a Frame to the cache -void CacheMemory::Add(tr1::shared_ptr frame) +void CacheMemory::Add(std::shared_ptr frame) { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); @@ -152,7 +152,7 @@ } // Get a frame from the cache (or NULL shared_ptr if no frame is found) -tr1::shared_ptr CacheMemory::GetFrame(long int frame_number) +std::shared_ptr CacheMemory::GetFrame(long int frame_number) { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); @@ -164,15 +164,15 @@ else // no Frame found - return tr1::shared_ptr(); + return std::shared_ptr(); } // Get the smallest frame number (or NULL shared_ptr if no frame is found) -tr1::shared_ptr CacheMemory::GetSmallestFrame() +std::shared_ptr CacheMemory::GetSmallestFrame() { // Create a scoped lock, to protect the cache from multiple threads const GenericScopedLock lock(*cacheCriticalSection); - tr1::shared_ptr f; + std::shared_ptr f; // Loop through frame numbers deque::iterator itr; @@ -251,12 +251,12 @@ // Move frame to front of queue (so it lasts longer) void CacheMemory::MoveToFront(long int frame_number) { + // Create a scoped lock, to protect the cache from multiple threads + const GenericScopedLock lock(*cacheCriticalSection); + // Does frame exists in cache? if (frames.count(frame_number)) { - // Create a scoped lock, to protect the cache from multiple threads - const GenericScopedLock lock(*cacheCriticalSection); - // Loop through frame numbers deque::iterator itr; for(itr = frame_numbers.begin(); itr != frame_numbers.end(); ++itr) diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ChunkReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ChunkReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ChunkReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ChunkReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -187,7 +187,7 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr ChunkReader::GetFrame(long int requested_frame) throw(ReaderClosed, ChunkNotFound) +std::shared_ptr ChunkReader::GetFrame(long int requested_frame) throw(ReaderClosed, ChunkNotFound) { // Determine what chunk contains this frame ChunkLocation location = find_chunk_frame(requested_frame); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ChunkWriter.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ChunkWriter.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ChunkWriter.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ChunkWriter.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -74,7 +74,7 @@ } // Add a frame to the queue waiting to be encoded. -void ChunkWriter::WriteFrame(tr1::shared_ptr frame) throw(WriterClosed) +void ChunkWriter::WriteFrame(std::shared_ptr frame) throw(WriterClosed) { // Check for open reader (or throw exception) if (!is_open) @@ -131,7 +131,7 @@ writer_thumb->WriteFrame(last_frame); } else { // Write the 1st frame (of the 1st chunk)... since no previous chunk is available - tr1::shared_ptr blank_frame(new Frame(1, info.width, info.height, "#000000", info.sample_rate, info.channels)); + std::shared_ptr blank_frame(new Frame(1, info.width, info.height, "#000000", info.sample_rate, info.channels)); blank_frame->AddColor(info.width, info.height, "#000000"); writer_final->WriteFrame(blank_frame); writer_preview->WriteFrame(blank_frame); @@ -199,7 +199,7 @@ for (int number = start; number <= length; number++) { // Get the frame - tr1::shared_ptr f = reader->GetFrame(number); + std::shared_ptr f = reader->GetFrame(number); // Encode frame WriteFrame(f); @@ -213,7 +213,7 @@ for (int number = start; number <= length; number++) { // Get the frame - tr1::shared_ptr f = local_reader->GetFrame(number); + std::shared_ptr f = local_reader->GetFrame(number); // Encode frame WriteFrame(f); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Clip.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Clip.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Clip.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Clip.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -57,7 +57,7 @@ rotation = Keyframe(0.0); // Init time & volume - time = Keyframe(0.0); + time = Keyframe(1.0); volume = Keyframe(1.0); // Init audio waveform color @@ -255,7 +255,7 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr Clip::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr Clip::GetFrame(long int requested_frame) throw(ReaderClosed) { if (reader) { @@ -276,20 +276,21 @@ // Is a time map detected long int new_frame_number = requested_frame; + long int time_mapped_number = adjust_frame_number_minimum(time.GetLong(requested_frame)); if (time.Values.size() > 1) - new_frame_number = time.GetLong(requested_frame); + new_frame_number = time_mapped_number; // Now that we have re-mapped what frame number is needed, go and get the frame pointer - tr1::shared_ptr original_frame = GetOrCreateFrame(new_frame_number); + std::shared_ptr original_frame = GetOrCreateFrame(new_frame_number); // Create a new frame - tr1::shared_ptr frame(new Frame(new_frame_number, 1, 1, "#000000", original_frame->GetAudioSamplesCount(), original_frame->GetAudioChannelsCount())); + std::shared_ptr frame(new Frame(new_frame_number, 1, 1, "#000000", original_frame->GetAudioSamplesCount(), original_frame->GetAudioChannelsCount())); frame->SampleRate(original_frame->SampleRate()); frame->ChannelsLayout(original_frame->ChannelsLayout()); // Copy the image from the odd field if (enabled_video) - frame->AddImage(tr1::shared_ptr(new QImage(*original_frame->GetImage()))); + frame->AddImage(std::shared_ptr(new QImage(*original_frame->GetImage()))); // Loop through each channel, add audio if (enabled_audio && reader->info.has_audio) @@ -297,7 +298,7 @@ frame->AddAudio(true, channel, 0, original_frame->GetAudioSamples(channel), original_frame->GetAudioSamplesCount(), 1.0); // Get time mapped frame number (used to increase speed, change direction, etc...) - tr1::shared_ptr new_frame = get_time_mapped_frame(frame, requested_frame); + std::shared_ptr new_frame = get_time_mapped_frame(frame, requested_frame); // Apply effects to the frame (if any) apply_effects(new_frame); @@ -346,7 +347,7 @@ } // Adjust the audio and image of a time mapped frame -tr1::shared_ptr Clip::get_time_mapped_frame(tr1::shared_ptr frame, long int frame_number) throw(ReaderClosed) +std::shared_ptr Clip::get_time_mapped_frame(std::shared_ptr frame, long int frame_number) throw(ReaderClosed) { // Check for valid reader if (!reader) @@ -356,7 +357,8 @@ // Check for a valid time map curve if (time.Values.size() > 1) { - tr1::shared_ptr new_frame; + const GenericScopedLock lock(getFrameCriticalSection); + std::shared_ptr new_frame; // create buffer and resampler juce::AudioSampleBuffer *samples = NULL; @@ -364,11 +366,11 @@ resampler = new AudioResampler(); // Get new frame number - int new_frame_number = round(time.GetValue(frame_number)); + int new_frame_number = adjust_frame_number_minimum(round(time.GetValue(frame_number))); // Create a new frame int samples_in_frame = Frame::GetSamplesPerFrame(new_frame_number, reader->info.fps, reader->info.sample_rate, frame->GetAudioChannelsCount()); - new_frame = tr1::shared_ptr(new Frame(new_frame_number, 1, 1, "#000000", samples_in_frame, frame->GetAudioChannelsCount())); + new_frame = std::make_shared(new_frame_number, 1, 1, "#000000", samples_in_frame, frame->GetAudioChannelsCount()); // Copy the image from the new frame new_frame->AddImage(GetOrCreateFrame(new_frame_number)->GetImage()); @@ -578,9 +580,9 @@ } // Get or generate a blank frame -tr1::shared_ptr Clip::GetOrCreateFrame(long int number) +std::shared_ptr Clip::GetOrCreateFrame(long int number) { - tr1::shared_ptr new_frame; + std::shared_ptr new_frame; // Init some basic properties about this frame int samples_in_frame = Frame::GetSamplesPerFrame(number, reader->info.fps, reader->info.sample_rate, reader->info.channels); @@ -591,12 +593,14 @@ // Determine the max size of this clips source image (based on the timeline's size, the scaling mode, // and the scaling keyframes). This is a performance improvement, to keep the images as small as possible, - // without loosing quality. + // without loosing quality. NOTE: We cannot go smaller than the timeline itself, or the add_layer timeline + // method will scale it back to timeline size before scaling it smaller again. This needs to be fixed in + // the future. if (scale == SCALE_FIT || scale == SCALE_STRETCH) { // Best fit or Stretch scaling (based on max timeline size * scaling keyframes) float max_scale_x = scale_x.GetMaxPoint().co.Y; float max_scale_y = scale_y.GetMaxPoint().co.Y; - reader->SetMaxSize(max_width * max_scale_x, max_height * max_scale_y); + reader->SetMaxSize(max(float(max_width), max_width * max_scale_x), max(float(max_height), max_height * max_scale_y)); } else if (scale == SCALE_CROP) { // Cropping scale mode (based on max timeline size * cropped size * scaling keyframes) @@ -607,9 +611,9 @@ // respect aspect ratio if (width_size.width() >= max_width && width_size.height() >= max_height) - reader->SetMaxSize(width_size.width(), width_size.height()); + reader->SetMaxSize(max(max_width, width_size.width()), max(max_height, width_size.height())); else - reader->SetMaxSize(height_size.width(), height_size.height()); + reader->SetMaxSize(max(max_width, height_size.width()), max(max_height, height_size.height())); } else { // No scaling, use original image size (slower) @@ -635,7 +639,7 @@ ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1); // Create blank frame - new_frame = tr1::shared_ptr(new Frame(number, reader->info.width, reader->info.height, "#000000", samples_in_frame, reader->info.channels)); + new_frame = std::make_shared(number, reader->info.width, reader->info.height, "#000000", samples_in_frame, reader->info.channels); new_frame->SampleRate(reader->info.sample_rate); new_frame->ChannelsLayout(reader->info.channel_layout); return new_frame; @@ -993,7 +997,7 @@ } // Apply effects to the source frame (if any) -tr1::shared_ptr Clip::apply_effects(tr1::shared_ptr frame) +std::shared_ptr Clip::apply_effects(std::shared_ptr frame) { // Find Effects at this position and layer list::iterator effect_itr; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CMakeLists.txt libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CMakeLists.txt --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/CMakeLists.txt 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/CMakeLists.txt 2017-09-08 04:16:46.000000000 +0000 @@ -33,7 +33,7 @@ # required for libopenshot-audio headers IF (WIN32) add_definitions( -DIGNORE_JUCE_HYPOT=1 ) - SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath -std=c++0x") + SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath") ENDIF(WIN32) IF (APPLE) # If you still get errors compiling with GCC 4.8, mac headers need to be patched: http://hamelot.co.uk/programming/osx-gcc-dispatch_block_t-has-not-been-declared-invalid-typedef/ @@ -43,8 +43,6 @@ SET(JUCE_PLATFORM_SPECIFIC_DIR build/macosx/platform_specific_code) SET(JUCE_PLATFORM_SPECIFIC_LIBRARIES "-framework Carbon -framework Cocoa -framework CoreFoundation -framework CoreAudio -framework CoreMidi -framework IOKit -framework AGL -framework AudioToolbox -framework QuartzCore -lobjc -framework Accelerate") - - SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -std=c++0x") ENDIF(APPLE) ################ IMAGE MAGICK ################## diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkInput.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkInput.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkInput.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkInput.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -104,9 +104,9 @@ return 0; } -tr1::shared_ptr DeckLinkInputDelegate::GetFrame(long int requested_frame) +std::shared_ptr DeckLinkInputDelegate::GetFrame(long int requested_frame) { - tr1::shared_ptr f; + std::shared_ptr f; // Is this frame for the future? while (requested_frame > GetCurrentFrameNumber()) @@ -242,7 +242,7 @@ m_rgbFrame->GetBytes(&frameBytes); // *********** CREATE OPENSHOT FRAME ********** - tr1::shared_ptr f(new openshot::Frame(copy_frameCount, width, height, "#000000", 2048, 2)); + std::shared_ptr f(new openshot::Frame(copy_frameCount, width, height, "#000000", 2048, 2)); // Add Image data to openshot frame // TODO: Fix Decklink support with QImage Upgrade diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkOutput.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkOutput.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkOutput.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkOutput.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -195,7 +195,7 @@ } -void DeckLinkOutputDelegate::WriteFrame(tr1::shared_ptr frame) +void DeckLinkOutputDelegate::WriteFrame(std::shared_ptr frame) { #pragma omp critical (blackmagic_output_queue) @@ -220,7 +220,7 @@ while (!raw_video_frames.empty()) { // Get front frame (from the queue) - tr1::shared_ptr frame = raw_video_frames.front(); + std::shared_ptr frame = raw_video_frames.front(); raw_video_frames.pop_front(); // copy of frame count diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -231,10 +231,10 @@ } // Get an openshot::Frame object for the next available LIVE frame -tr1::shared_ptr DecklinkReader::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr DecklinkReader::GetFrame(long int requested_frame) throw(ReaderClosed) { // Get a frame from the delegate decklink class (which is collecting them on another thread) - tr1::shared_ptr f = delegate->GetFrame(requested_frame); + std::shared_ptr f = delegate->GetFrame(requested_frame); // cout << "Change the frame number to " << requested_frame << endl; // f->SetFrameNumber(requested_frame); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkWriter.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkWriter.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DecklinkWriter.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DecklinkWriter.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -139,7 +139,7 @@ // throw DecklinkError("Failed to enable audio output. Is another application using the card?"); // Begin video preroll by scheduling a second of frames in hardware - //tr1::shared_ptr f(new Frame(1, displayMode->GetWidth(), displayMode->GetHeight(), "Blue")); + //std::shared_ptr f(new Frame(1, displayMode->GetWidth(), displayMode->GetHeight(), "Blue")); //f->AddColor(displayMode->GetWidth(), displayMode->GetHeight(), "Blue"); // Preroll 1 second of video @@ -227,7 +227,7 @@ } // This method is required for all derived classes of WriterBase. Write a Frame to the video file. -void DecklinkWriter::WriteFrame(tr1::shared_ptr frame) throw(WriterClosed) +void DecklinkWriter::WriteFrame(std::shared_ptr frame) throw(WriterClosed) { // Check for open reader (or throw exception) if (!is_open) @@ -243,7 +243,7 @@ for (int number = start; number <= length; number++) { // Get the frame - tr1::shared_ptr f = reader->GetFrame(number); + std::shared_ptr f = reader->GetFrame(number); // Encode frame WriteFrame(f); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DummyReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DummyReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/DummyReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/DummyReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -78,7 +78,7 @@ if (!is_open) { // Create or get frame object - image_frame = tr1::shared_ptr(new Frame(1, info.width, info.height, "#000000", info.sample_rate, info.channels)); + image_frame = std::make_shared(1, info.width, info.height, "#000000", info.sample_rate, info.channels); // Mark as "open" is_open = true; @@ -97,7 +97,7 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr DummyReader::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr DummyReader::GetFrame(long int requested_frame) throw(ReaderClosed) { // Check for open reader (or throw exception) if (!is_open) diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Blur.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Blur.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Blur.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Blur.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -60,10 +60,10 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Blur::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Blur::GetFrame(std::shared_ptr frame, long int frame_number) { // Get the frame's image - tr1::shared_ptr frame_image = frame->GetImage(); + std::shared_ptr frame_image = frame->GetImage(); // Get the current blur radius int horizontal_radius_value = horizontal_radius.GetValue(frame_number); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Brightness.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Brightness.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Brightness.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Brightness.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -71,10 +71,10 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Brightness::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Brightness::GetFrame(std::shared_ptr frame, long int frame_number) { // Get the frame's image - tr1::shared_ptr frame_image = frame->GetImage(); + std::shared_ptr frame_image = frame->GetImage(); // Get keyframe values for this frame float brightness_value = brightness.GetValue(frame_number); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/ChromaKey.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/ChromaKey.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/ChromaKey.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/ChromaKey.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -63,7 +63,7 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr ChromaKey::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr ChromaKey::GetFrame(std::shared_ptr frame, long int frame_number) { // Determine the current HSL (Hue, Saturation, Lightness) for the Chrome int threshold = fuzz.GetInt(frame_number); @@ -72,7 +72,7 @@ long mask_B = color.blue.GetInt(frame_number); // Get source image's pixels - tr1::shared_ptr image = frame->GetImage(); + std::shared_ptr image = frame->GetImage(); unsigned char *pixels = (unsigned char *) image->bits(); // Loop through pixels diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Deinterlace.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Deinterlace.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Deinterlace.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Deinterlace.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -59,14 +59,14 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Deinterlace::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Deinterlace::GetFrame(std::shared_ptr frame, long int frame_number) { // Get original size of frame's image int original_width = frame->GetImage()->width(); int original_height = frame->GetImage()->height(); // Get the frame's image - tr1::shared_ptr image = frame->GetImage(); + std::shared_ptr image = frame->GetImage(); const unsigned char* pixels = image->bits(); // Create a smaller, new image @@ -83,7 +83,7 @@ } // Resize deinterlaced image back to original size, and update frame's image - image = tr1::shared_ptr(new QImage(deinterlaced_image.scaled(original_width, original_height, Qt::IgnoreAspectRatio, Qt::FastTransformation))); + image = std::shared_ptr(new QImage(deinterlaced_image.scaled(original_width, original_height, Qt::IgnoreAspectRatio, Qt::FastTransformation))); // Update image on frame frame->AddImage(image); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Mask.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Mask.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Mask.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Mask.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -70,7 +70,7 @@ } // Get grayscale mask image -void Mask::set_grayscale_mask(tr1::shared_ptr mask_frame_image, int width, int height, float brightness, float contrast) +void Mask::set_grayscale_mask(std::shared_ptr mask_frame_image, int width, int height, float brightness, float contrast) { // Get pixels for mask image unsigned char *pixels = (unsigned char *) mask_frame_image->bits(); @@ -107,10 +107,10 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Mask::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Mask::GetFrame(std::shared_ptr frame, long int frame_number) { // Get the mask image (from the mask reader) - tr1::shared_ptr frame_image = frame->GetImage(); + std::shared_ptr frame_image = frame->GetImage(); // Check if mask reader is open if (reader && !reader->IsOpen()) @@ -127,17 +127,17 @@ #pragma omp critical (open_mask_reader) { // Only get mask if needed - tr1::shared_ptr mask_without_sizing = tr1::shared_ptr(new QImage(*reader->GetFrame(frame_number)->GetImage())); + std::shared_ptr mask_without_sizing = std::shared_ptr(new QImage(*reader->GetFrame(frame_number)->GetImage())); // Resize mask image to match frame size - original_mask = tr1::shared_ptr(new QImage( + original_mask = std::shared_ptr(new QImage( mask_without_sizing->scaled(frame_image->width(), frame_image->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); } } // Convert mask to grayscale and resize to frame size - tr1::shared_ptr mask = tr1::shared_ptr(new QImage(*original_mask)); + std::shared_ptr mask = std::shared_ptr(new QImage(*original_mask)); set_grayscale_mask(mask, frame_image->width(), frame_image->height(), brightness.GetValue(frame_number), contrast.GetValue(frame_number)); // Get pixels for frame image diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Negate.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Negate.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Negate.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Negate.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -45,7 +45,7 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Negate::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Negate::GetFrame(std::shared_ptr frame, long int frame_number) { // Make a negative of the images pixels frame->GetImage()->invertPixels(); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Saturation.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Saturation.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/effects/Saturation.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/effects/Saturation.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -70,10 +70,10 @@ // This method is required for all derived classes of EffectBase, and returns a // modified openshot::Frame object -tr1::shared_ptr Saturation::GetFrame(tr1::shared_ptr frame, long int frame_number) +std::shared_ptr Saturation::GetFrame(std::shared_ptr frame, long int frame_number) { // Get the frame's image - tr1::shared_ptr frame_image = frame->GetImage(); + std::shared_ptr frame_image = frame->GetImage(); if (!frame_image) return frame; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/examples/ExampleBlackmagic.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/examples/ExampleBlackmagic.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/examples/ExampleBlackmagic.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/examples/ExampleBlackmagic.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "../../include/OpenShot.h" #include #include @@ -99,7 +99,7 @@ int x = 0; while (true) { - tr1::shared_ptr f = t.GetFrame(x); + std::shared_ptr f = t.GetFrame(x); if (f) { if (x != 0 && x % 30 == 0) @@ -183,7 +183,7 @@ // Image Reader // ImageReader r1("/home/jonathan/Pictures/Screenshot from 2013-02-10 15:06:38.png"); // r1.Open(); -// tr1::shared_ptr f1 = r1.GetFrame(1); +// std::shared_ptr f1 = r1.GetFrame(1); // r1.Close(); // f1->TransparentColors("#8fa09a", 20.0); // f1->Display(); @@ -191,7 +191,7 @@ // ImageReader r2("/home/jonathan/Pictures/trees.jpg"); // r2.Open(); -// tr1::shared_ptr f2 = r2.GetFrame(1); +// std::shared_ptr f2 = r2.GetFrame(1); // r2.Close(); // DecklinkReader dr(1, 11, 0, 2, 16); @@ -207,7 +207,7 @@ // if (x % 30 == 0) // cout << "30 frames..." << endl; // -// tr1::shared_ptr f = dr.GetFrame(0); +// std::shared_ptr f = dr.GetFrame(0); // if (f) // { // //f->Display(); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/examples/Example.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/examples/Example.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/examples/Example.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/examples/Example.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -27,285 +27,43 @@ #include #include -#include +#include #include "../../include/OpenShot.h" +#include "../../include/CrashHandler.h" using namespace openshot; -using namespace tr1; -int main(int argc, char* argv[]) -{ - FFmpegReader rTest("/home/jonathan/Videos/sintel_trailer-720p.mp4"); - rTest.Open(); - rTest.GetFrame(300)->Thumbnail("frame1.png", 300, 100, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#001100", false); - rTest.GetFrame(310)->Thumbnail("frame2.png", 100, 300, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "Red", false); - rTest.GetFrame(320)->Thumbnail("frame3.png", 50, 100, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#000000", false); - rTest.GetFrame(330)->Thumbnail("frame4.png", 1920, 1080, "/home/jonathan/apps/openshot-qt-git/src/images/mask.png", "/home/jonathan/apps/openshot-qt-git/src/images/overlay.png", "#ffffff", false); - return 0; - - - - - Timeline r9(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO); - - int frame_count = 1; - while (true) { - // Create a timeline - Timeline r10(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO); - r10.SetJson("{\"tick_pixels\": 100, \"effects\": [{\"reader\": {\"file_size\": \"1658880\", \"width\": 720, \"video_length\": \"2592000\", \"pixel_format\": -1, \"video_bit_rate\": 0, \"fps\": {\"den\": 1, \"num\": 30}, \"has_single_image\": true, \"channel_layout\": 4, \"audio_stream_index\": -1, \"vcodec\": \"\", \"has_video\": true, \"channels\": 0, \"video_timebase\": {\"den\": 30, \"num\": 1}, \"duration\": 86400.0, \"audio_timebase\": {\"den\": 1, \"num\": 1}, \"path\": \"/Users/jonathan/apps/openshot-qt-git/src/transitions/common/circle_out_to_in.svg\", \"interlaced_frame\": false, \"display_ratio\": {\"den\": 4, \"num\": 5}, \"type\": \"QtImageReader\", \"video_stream_index\": -1, \"acodec\": \"\", \"height\": 576, \"audio_bit_rate\": 0, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": false, \"top_field_first\": true, \"sample_rate\": 0}, \"contrast\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1, \"Y\": 3}}]}, \"position\": 0, \"title\": \"Transition\", \"start\": 0, \"layer\": 4, \"type\": \"Mask\", \"replace_image\": false, \"id\": \"Y1SJ85D8HV\", \"brightness\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_right\": {\"X\": 96.5999984741211, \"Y\": 1}, \"handle_left\": {\"X\": 1, \"Y\": 1}, \"co\": {\"X\": 1, \"Y\": 1}}, {\"handle_type\": 0, \"interpolation\": 0, \"handle_right\": {\"X\": 240, \"Y\": -1}, \"handle_left\": {\"X\": 144.3999938964844, \"Y\": -1}, \"co\": {\"X\": 1249.92, \"Y\": -1}}]}, \"end\": 52.08}], \"duration\": 300, \"version\": {\"openshot-qt\": \"2.0.5\", \"libopenshot\": \"0.0.9\"}, \"markers\": [], \"export_path\": \"\", \"clips\": [{\"reader\": {\"file_size\": \"7608204\", \"width\": 1280, \"video_length\": \"1253\", \"pixel_format\": 0, \"video_bit_rate\": 1165807, \"fps\": {\"den\": 1, \"num\": 24}, \"has_single_image\": false, \"channel_layout\": 3, \"audio_stream_index\": 1, \"vcodec\": \"h264\", \"has_video\": true, \"channels\": 2, \"video_timebase\": {\"den\": 24, \"num\": 1}, \"duration\": 51.9466667175293, \"audio_timebase\": {\"den\": 48000, \"num\": 1}, \"path\": \"/Users/jonathan/Movies/sintel_trailer-720p.mp4\", \"interlaced_frame\": false, \"display_ratio\": {\"den\": 9, \"num\": 16}, \"type\": \"FFmpegReader\", \"video_stream_index\": 0, \"acodec\": \"aac\", \"height\": 720, \"audio_bit_rate\": 126694, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": true, \"top_field_first\": true, \"sample_rate\": 48000}, \"rotation\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"perspective_c2_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c2_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"shear_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"shear_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"effects\": [], \"anchor\": 0, \"perspective_c4_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"location_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"location_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"crop_width\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"scale_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"position\": 0, \"gravity\": 4, \"crop_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"crop_height\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"layer\": 4, \"duration\": 51.9466667175293, \"perspective_c3_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c3_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"title\": \"sintel_trailer-720p.mp4\", \"file_id\": \"J6VK47X5IS\", \"perspective_c4_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c1_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"perspective_c1_x\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": -1.0}}]}, \"time\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"scale_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"id\": \"QLJJ0D354R\", \"crop_y\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"image\": \".openshot_qt/thumbnail/J6VK47X5IS.png\", \"alpha\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"start\": 0, \"scale\": 1, \"waveform\": false, \"wave_color\": {\"red\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 0.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 0.0}, \"co\": {\"X\": 1.0, \"Y\": 0.0}}]}, \"alpha\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 255.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 255.0}, \"co\": {\"X\": 1.0, \"Y\": 255.0}}]}, \"blue\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 255.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 255.0}, \"co\": {\"X\": 1.0, \"Y\": 255.0}}]}, \"green\": {\"Points\": [{\"handle_type\": 0, \"interpolation\": 0, \"handle_left\": {\"X\": 1.0, \"Y\": 123.0}, \"handle_right\": {\"X\": 1.0, \"Y\": 123.0}, \"co\": {\"X\": 1.0, \"Y\": 123.0}}]}}, \"volume\": {\"Points\": [{\"interpolation\": 2, \"co\": {\"X\": 1.0, \"Y\": 1.0}}]}, \"end\": 51.9466667175293}], \"settings\": {}, \"fps\": {\"den\": 1, \"num\": 24}, \"id\": \"T0\", \"channel_layout\": 3, \"playhead_position\": 0, \"layers\": [{\"number\": 0, \"y\": 0, \"label\": \"\", \"id\": \"L0\"}, {\"number\": 1, \"y\": 0, \"label\": \"\", \"id\": \"L1\"}, {\"number\": 2, \"y\": 0, \"label\": \"\", \"id\": \"L2\"}, {\"number\": 3, \"y\": 0, \"label\": \"\", \"id\": \"L3\"}, {\"number\": 4, \"y\": 0, \"label\": \"\", \"id\": \"L4\"}], \"height\": 720, \"progress\": [], \"width\": 1280, \"channels\": 2, \"profile\": \"HDV 720 24p\", \"scale\": 16, \"files\": [{\"file_size\": \"7608204\", \"width\": 1280, \"video_length\": \"1253\", \"pixel_format\": 0, \"video_bit_rate\": 1165807, \"fps\": {\"den\": 1, \"num\": 24}, \"has_single_image\": false, \"channel_layout\": 3, \"audio_stream_index\": 1, \"vcodec\": \"h264\", \"has_video\": true, \"channels\": 2, \"video_timebase\": {\"den\": 24, \"num\": 1}, \"duration\": 51.9466667175293, \"audio_timebase\": {\"den\": 48000, \"num\": 1}, \"path\": \"/Users/jonathan/Movies/sintel_trailer-720p.mp4\", \"interlaced_frame\": false, \"media_type\": \"video\", \"display_ratio\": {\"den\": 9, \"num\": 16}, \"type\": \"FFmpegReader\", \"video_stream_index\": 0, \"id\": \"J6VK47X5IS\", \"acodec\": \"aac\", \"height\": 720, \"audio_bit_rate\": 126694, \"pixel_ratio\": {\"den\": 1, \"num\": 1}, \"has_audio\": true, \"top_field_first\": true, \"sample_rate\": 48000}], \"sample_rate\": 44100}"); - - // Open Timeline - r10.Open(); - - int frame_number = (rand() % 500) + 1; - cout << frame_count << ": reading frame " << frame_number << endl; - r10.GetFrame(frame_number); - - r10.Close(); - - frame_count++; -// if (frame_count == 500) -// return 0; - } - - - cout << " --> 1" << endl; - r9.GetFrame(1)->Save("pic1.png", 1.0); - cout << " --> 500" << endl; - r9.GetFrame(500); - cout << "1034" << endl; - r9.GetFrame(1034); - cout << "1" << endl; - r9.GetFrame(1); - cout << "1200" << endl; - r9.GetFrame(1200)->Save("pic2.png", 1.0); - - - /* WRITER ---------------- */ - FFmpegWriter w("output1.webm"); - - // Set options - w.SetAudioOptions(true, "libvorbis", 44100, 2, LAYOUT_STEREO, 188000); - w.SetVideoOptions(true, "libvpx", Fraction(24,1), 1280, 720, Fraction(1,1), false, false, 3000000); - - // Open writer - w.Open(); - - // Prepare Streams -// w.PrepareStreams(); -// -// w.SetOption(VIDEO_STREAM, "qmin", "2" ); -// w.SetOption(VIDEO_STREAM, "qmax", "30" ); -// w.SetOption(VIDEO_STREAM, "crf", "10" ); -// w.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" ); -// w.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" ); -// w.SetOption(VIDEO_STREAM, "max_b_frames", "10" ); -// -// // Write header -// w.WriteHeader(); - - // Write some frames - w.WriteFrame(&r9, 24, 50); - - // Close writer & reader - w.Close(); - - return 0; -// -// FFmpegReader r110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4"); -// r110.Open(); -//// r110.DisplayInfo(); -//// FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO); -// -// Timeline t110(1280, 720, Fraction(24,1), 48000, 2, LAYOUT_STEREO); -// Clip c110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4"); -// c110.Position(1.0); -// t110.AddClip(&c110); -// t110.Open(); -// -//// m110.GetFrame(100); -//// m110.GetFrame(85); -//// m110.GetFrame(85); -//// m110.GetFrame(86); -//// m110.GetFrame(86); -//// m110.GetFrame(86); -//// m110.GetFrame(86); -//// m110.GetFrame(87); -//// m110.GetFrame(87); -// -// -// t110.GetFrame(1000); -//// r110.GetFrame(96); -//// r110.GetFrame(97); -//// r110.GetFrame(95); -//// r110.GetFrame(98); -//// r110.GetFrame(100); -//// r110.GetFrame(101); -//// r110.GetFrame(103); -// return 0; - -// for (int y = 600; y < 700; y++) { -// cout << y << endl; -// int random_frame_number = rand() % 1000; -// t110.GetFrame(y); -// } - -// srand (time(NULL)); -// for (int z = 0; z <= 1; z++) -// for (int y = 1000; y < 1300; y++) { -// cout << " --> " << y << endl; -// int random_frame_number = rand() % 1000; -// t110.GetFrame(y); -// } - -// FrameMapper m110(&r110, Fraction(24,1), PULLDOWN_NONE, 22050, 2, LAYOUT_STEREO); -// m110.Open(); -// -// Clip c110(&m110); -// c110.Open(); -// -// Timeline t10(1280, 720, Fraction(24,1), 22050, 2, LAYOUT_STEREO); -// //Clip c20("/home/jonathan/Pictures/DSC00660.JPG"); -// //c20.End(1000.0); -// //c20.Layer(-1); -// //c20.scale = SCALE_STRETCH; -// //c20.rotation.AddPoint(1, 0.0); -// //c20.rotation.AddPoint(1000, 360.0); -// Clip c10("/home/jonathan/apps/libopenshot/src/examples/piano-mono.wav"); -// c10.volume.AddPoint(1, 0.0); -// c10.volume.AddPoint(100, 1.0); -//// c10.time.AddPoint(1, 1); -//// c10.time.AddPoint(300, 900); -//// c10.time.AddPoint(600, 300); -//// c10.time.PrintValues(); -// -// //Color background((unsigned char)0, (unsigned char)255, (unsigned char)0, (unsigned char)0); -// //background.red.AddPoint(1000, 255); -// //background.green.AddPoint(1000, 0); -// //t10.color = background; -// -// Color black; -// black.red = Keyframe(0); -// black.green = Keyframe(0); -// black.blue = Keyframe(0); -// -// Keyframe brightness; -// brightness.AddPoint(300, -1.0, BEZIER); -// brightness.AddPoint(370, 0.5, BEZIER); -// brightness.AddPoint(425, -0.5, BEZIER); -// brightness.AddPoint(600, 1.0, BEZIER); -// -// //Negate e; -// //Deinterlace e(false); -// //ChromaKey e(black, Keyframe(30)); -// //QtImageReader mask_reader("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_cross_right_barr.png"); -// //QtImageReader mask_reader1("/home/jonathan/apps/openshot-qt/src/transitions/extra/big_barr.png"); -// //Mask e(&mask_reader, brightness, Keyframe(3.0)); -// //c10.AddEffect(&e); -// //Mask e1(&mask_reader1, brightness, Keyframe(3.0)); -// //c10.AddEffect(&e1); -// -// // add clip to timeline -// t10.AddClip(&c10); -// //t10.AddClip(&c20); -// t10.Open(); - -// FFmpegReader r9("/home/jonathan/Videos/sintel_trailer-720p.mp4"); -// r9.Open(); -// r9.DisplayInfo(); - - - // Mapper - //FrameMapper map(&r9, Fraction(24,1), PULLDOWN_NONE, 48000, 2, LAYOUT_STEREO); - //map.DisplayInfo(); - //map.Open(); - - /* WRITER ---------------- */ - FFmpegWriter w9("C:\\Users\\Jonathan\\test-output.avi"); - //ImageWriter w9("/home/jonathan/output.gif"); - - // Set options - //w9.SetVideoOptions(true, "mpeg4", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000); - //w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000); - w9.SetVideoOptions(true, "libx264", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 1000000); - w9.SetAudioOptions(true, "mp2", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 64000); - //w9.SetAudioOptions(true, "libvorbis", r9.info.sample_rate, r9.info.channels, r9.info.channel_layout, 128000); - //w9.SetVideoOptions(true, "libvpx", r9.info.fps, r9.info.width, r9.info.height, Fraction(1,1), false, false, 3000000); - //w9.SetAudioOptions(true, "libmp3lame", 22050, r9.info.channels, r9.info.channel_layout, 120000); - //w9.SetVideoOptions(true, "libx264", t10.info.fps, t10.info.width, t10.info.height, t10.info.pixel_ratio, false, false, 1500000); - //w9.SetVideoOptions(true, "rawvideo", r9.info.fps, 400, 2, r9.info.pixel_ratio, false, false, 20000000); - //w9.SetVideoOptions("GIF", r9.info.fps, r9.info.width, r9.info.height, 70, 1, true); - - // Open writer - w9.Open(); - - // Prepare Streams - w9.PrepareStreams(); - -// w9.SetOption(VIDEO_STREAM, "qmin", "2" ); -// w9.SetOption(VIDEO_STREAM, "qmax", "30" ); -// w9.SetOption(VIDEO_STREAM, "crf", "10" ); -// w9.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" ); -// w9.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" ); -// w9.SetOption(VIDEO_STREAM, "max_b_frames", "10" ); - - // Write header - w9.WriteHeader(); - //r9.DisplayInfo(); - - // 147000 frames, 28100 frames - //for (int frame = 1; frame <= (r9.info.video_length - 1); frame++) - //for (int z = 0; z < 2; z++) - for (long int frame = 500; frame <= 750; frame++) - //int frame = 1; - //while (true) - { - //int frame_number = (rand() % 750) + 1; - int frame_number = frame; - - cout << "get " << frame << " (frame: " << frame_number << ") " << endl; - tr1::shared_ptr f = r9.GetFrame(frame_number); - //cout << "mapped frame channel layouts: " << f->ChannelsLayout() << endl; - //cout << "display it (" << f->number << ", " << f << ")" << endl; - //r9.GetFrame(frame_number)->DisplayWaveform(); - //if (frame >= 495) - // f->DisplayWaveform(); - //f->Display(); - //f->Save("/home/jonathan/test.png", 1.0); - //f->AddColor(r9.info.width, r9.info.height, "blue"); - w9.WriteFrame(f); - - //frame++; - - //if (frame >= 100) - // break; - } - - cout << "done looping" << endl; - - // Write Footer - //w9.WriteTrailer(); - - // Close writer & reader - w9.Close(); - - // Close timeline - r9.Close(); - //t10.Close(); - /* ---------------- */ - cout << "happy ending" << endl; - - return 0; - - - - - -} - -//int main(int argc, char* argv[]) -//{ -// for (int z = 0; z<10; z++) -// main2(); -//} +int main(int argc, char* argv[]) { + + // Create and open reader + FFmpegReader r("/home/jonathan/sintel-120fps-crash.mp4"); + r.Open(); + + // Enable debug logging + ZmqLogger::Instance()->Enable(false); + ZmqLogger::Instance()->Path("/home/jonathan/.openshot_qt/libopenshot2.log"); + CrashHandler::Instance(); + + // Loop a few times + for (int attempt = 1; attempt < 10; attempt++) { + cout << "** Attempt " << attempt << " **" << endl; + + // Read every frame in reader as fast as possible + for (int frame_number = 1; frame_number < r.info.video_length; frame_number++) { + // Get frame object + std::shared_ptr f = r.GetFrame(frame_number); + + // Print frame numbers + cout << frame_number << " [" << f->number << "], " << flush; + if (frame_number % 10 == 0) + cout << endl; + } + } + cout << "Completed successfully!" << endl; + + // Close reader + r.Close(); + + return 0; +} \ No newline at end of file diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FFmpegReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FFmpegReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FFmpegReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FFmpegReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -37,7 +37,7 @@ audio_pts_offset(99999), video_pts_offset(99999), path(path), is_video_seek(true), check_interlace(false), check_fps(false), enable_seek(true), is_open(false), seek_audio_frame_found(0), seek_video_frame_found(0), prev_samples(0), prev_pts(0), pts_total(0), pts_counter(0), is_duration_known(false), largest_frame_processed(0), - current_video_frame(0), has_missing_frames(false), num_packets_since_video_frame(0), num_checks_since_final(0) { + current_video_frame(0), has_missing_frames(false), num_packets_since_video_frame(0), num_checks_since_final(0), packet(NULL) { // Initialize FFMpeg, and register all formats and codecs av_register_all(); @@ -58,7 +58,7 @@ audio_pts_offset(99999), video_pts_offset(99999), path(path), is_video_seek(true), check_interlace(false), check_fps(false), enable_seek(true), is_open(false), seek_audio_frame_found(0), seek_video_frame_found(0), prev_samples(0), prev_pts(0), pts_total(0), pts_counter(0), is_duration_known(false), largest_frame_processed(0), - current_video_frame(0), has_missing_frames(false), num_packets_since_video_frame(0), num_checks_since_final(0) { + current_video_frame(0), has_missing_frames(false), num_packets_since_video_frame(0), num_checks_since_final(0), packet(NULL) { // Initialize FFMpeg, and register all formats and codecs av_register_all(); @@ -393,7 +393,7 @@ } -tr1::shared_ptr FFmpegReader::GetFrame(long int requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks) +std::shared_ptr FFmpegReader::GetFrame(long int requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks) { // Check for open reader (or throw exception) if (!is_open) @@ -412,7 +412,7 @@ ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::GetFrame", "requested_frame", requested_frame, "last_frame", last_frame, "", -1, "", -1, "", -1, "", -1); // Check the cache for this frame - tr1::shared_ptr frame = final_cache.GetFrame(requested_frame); + std::shared_ptr frame = final_cache.GetFrame(requested_frame); if (frame) { // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::GetFrame", "returned cached frame", requested_frame, "", -1, "", -1, "", -1, "", -1, "", -1); @@ -475,7 +475,7 @@ } // Read the stream until we find the requested Frame -tr1::shared_ptr FFmpegReader::ReadStream(long int requested_frame) +std::shared_ptr FFmpegReader::ReadStream(long int requested_frame) { // Allocate video frame bool end_of_stream = false; @@ -506,9 +506,21 @@ // Get the next packet into a local variable called packet packet_error = GetNextPacket(); + int processing_video_frames_size = 0; + int processing_audio_frames_size = 0; + { + const GenericScopedLock lock(processingCriticalSection); + processing_video_frames_size = processing_video_frames.size(); + processing_audio_frames_size = processing_audio_frames.size(); + } + // Wait if too many frames are being processed - while (processing_video_frames.size() + processing_audio_frames.size() >= minimum_packets) + while (processing_video_frames_size + processing_audio_frames_size >= minimum_packets) { usleep(2500); + const GenericScopedLock lock(processingCriticalSection); + processing_video_frames_size = processing_video_frames.size(); + processing_audio_frames_size = processing_audio_frames.size(); + } // Get the next packet (if any) if (packet_error < 0) @@ -519,7 +531,7 @@ } // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ReadStream (GetNextPacket)", "requested_frame", requested_frame, "processing_video_frames.size()", processing_video_frames.size(), "processing_audio_frames.size()", processing_audio_frames.size(), "minimum_packets", minimum_packets, "packets_processed", packets_processed, "is_seeking", is_seeking); + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ReadStream (GetNextPacket)", "requested_frame", requested_frame, "processing_video_frames_size", processing_video_frames_size, "processing_audio_frames_size", processing_audio_frames_size, "minimum_packets", minimum_packets, "packets_processed", packets_processed, "is_seeking", is_seeking); // Video packet if (info.has_video && packet->stream_index == videoStream) @@ -535,9 +547,6 @@ check_seek = false; if (check_seek) { - // Remove packet (since this packet is pointless) - RemoveAVPacket(packet); - // Jump to the next iteration of this loop continue; } @@ -570,9 +579,6 @@ check_seek = false; if (check_seek) { - // Remove packet (since this packet is pointless) - RemoveAVPacket(packet); - // Jump to the next iteration of this loop continue; } @@ -621,7 +627,7 @@ CheckWorkingFrames(end_of_stream, requested_frame); // Return requested frame (if found) - tr1::shared_ptr frame = final_cache.GetFrame(requested_frame); + std::shared_ptr frame = final_cache.GetFrame(requested_frame); if (frame) // Return prepared frame return frame; @@ -635,7 +641,7 @@ } else { // The largest processed frame is no longer in cache, return a blank frame - tr1::shared_ptr f = CreateFrame(largest_frame_processed); + std::shared_ptr f = CreateFrame(largest_frame_processed); f->AddColor(info.width, info.height, "#000"); return f; } @@ -650,17 +656,17 @@ AVPacket *next_packet = new AVPacket(); found_packet = av_read_frame(pFormatCtx, next_packet); + if (packet) { + // Remove previous packet before getting next one + RemoveAVPacket(packet); + packet = NULL; + } + if (found_packet >= 0) { // Update current packet pointer packet = next_packet; } - else - { - // Free packet, since it's unused - av_free_packet(next_packet); - delete next_packet; - } // Return if packet was found (or error number) return found_packet; @@ -681,16 +687,9 @@ { // AVFrames are clobbered on the each call to avcodec_decode_video, so we // must make a copy of the image data before this method is called again. - AVPicture *copyFrame = new AVPicture(); - avpicture_alloc(copyFrame, pCodecCtx->pix_fmt, info.width, info.height); - av_picture_copy(copyFrame, (AVPicture *) next_frame, pCodecCtx->pix_fmt, info.width, info.height); - - #pragma omp critical (packet_cache) - { - // add to AVFrame cache (if frame finished) - frames[copyFrame] = copyFrame; - pFrame = frames[copyFrame]; - } + pFrame = new AVPicture(); + avpicture_alloc(pFrame, pCodecCtx->pix_fmt, info.width, info.height); + av_picture_copy(pFrame, (AVPicture *) next_frame, pCodecCtx->pix_fmt, info.width, info.height); // Detect interlaced frame (only once) if (!check_interlace) @@ -699,12 +698,6 @@ info.interlaced_frame = next_frame->interlaced_frame; info.top_field_first = next_frame->top_field_first; } - - } - else - { - // Remove packet (since this packet is pointless) - RemoveAVPacket(packet); } // deallocate the frame @@ -774,7 +767,6 @@ { // Remove frame and packet RemoveAVFrame(pFrame); - RemoveAVPacket(packet); // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessVideoPacket (Skipped)", "requested_frame", requested_frame, "current_frame", current_frame, "", -1, "", -1, "", -1, "", -1); @@ -791,14 +783,13 @@ int height = info.height; int width = info.width; long int video_length = info.video_length; - AVPacket *my_packet = packet; - AVPicture *my_frame = frames[pFrame]; + AVPicture *my_frame = pFrame; // Add video frame to list of processing video frames const GenericScopedLock lock(processingCriticalSection); processing_video_frames[current_frame] = current_frame; - #pragma omp task firstprivate(current_frame, my_packet, my_frame, height, width, video_length, pix_fmt) + #pragma omp task firstprivate(current_frame, my_frame, height, width, video_length, pix_fmt) { // Create variables for a RGB Frame (since most videos are not in RGB, we must convert it) AVFrame *pFrameRGB = NULL; @@ -833,6 +824,7 @@ // Determine required buffer size and allocate buffer numBytes = avpicture_get_size(PIX_FMT_RGBA, width, height); + #pragma omp critical (video_buffer) buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t)); // Assign appropriate parts of buffer to image planes in pFrameRGB @@ -848,7 +840,7 @@ original_height, pFrameRGB->data, pFrameRGB->linesize); // Create or get the existing frame object - tr1::shared_ptr f = CreateFrame(current_frame); + std::shared_ptr f = CreateFrame(current_frame); // Add Image data to frame f->AddImage(width, height, 4, QImage::Format_RGBA8888, buffer); @@ -857,6 +849,7 @@ working_cache.Add(f); // Keep track of last last_video_frame + #pragma omp critical (video_buffer) last_video_frame = f; // Free the RGB image @@ -865,7 +858,6 @@ // Remove frame and packet RemoveAVFrame(my_frame); - RemoveAVPacket(my_packet); sws_freeContext(img_convert_ctx); // Remove video frame from list of processing video frames @@ -892,9 +884,6 @@ // Are we close enough to decode the frame's audio? if (target_frame < (requested_frame - 20)) { - // Remove packet - RemoveAVPacket(packet); - // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (Skipped)", "requested_frame", requested_frame, "target_frame", target_frame, "starting_sample", starting_sample, "", -1, "", -1, "", -1); @@ -902,9 +891,6 @@ return; } - // Init some local variables (for OpenMP) - AVPacket *my_packet = packet; - // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (Before)", "requested_frame", requested_frame, "target_frame", target_frame, "starting_sample", starting_sample, "", -1, "", -1, "", -1); @@ -918,7 +904,7 @@ // re-initialize buffer size (it gets changed in the avcodec_decode_audio2 method call) int buf_size = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE; - int used = avcodec_decode_audio4(aCodecCtx, audio_frame, &frame_finished, my_packet); + int used = avcodec_decode_audio4(aCodecCtx, audio_frame, &frame_finished, packet); if (frame_finished) { @@ -989,192 +975,176 @@ } + // Allocate audio buffer + int16_t *audio_buf = new int16_t[AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; - // Process the audio samples in a separate thread (this includes resampling to 16 bit integer, and storing - // in a openshot::Frame object). - #pragma omp task firstprivate(requested_frame, target_frame, starting_sample, my_packet, audio_frame) - { - // Allocate audio buffer - int16_t *audio_buf = new int16_t[AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; - - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (ReSample)", "packet_samples", packet_samples, "info.channels", info.channels, "info.sample_rate", info.sample_rate, "aCodecCtx->sample_fmt", aCodecCtx->sample_fmt, "AV_SAMPLE_FMT_S16", AV_SAMPLE_FMT_S16, "", -1); - - // Create output frame - AVFrame *audio_converted = AV_ALLOCATE_FRAME(); - AV_RESET_FRAME(audio_converted); - audio_converted->nb_samples = audio_frame->nb_samples; - av_samples_alloc(audio_converted->data, audio_converted->linesize, info.channels, audio_frame->nb_samples, AV_SAMPLE_FMT_S16, 0); - - AVAudioResampleContext *avr = NULL; - int nb_samples = 0; - #pragma ordered - { - // setup resample context - avr = avresample_alloc_context(); - av_opt_set_int(avr, "in_channel_layout", aCodecCtx->channel_layout, 0); - av_opt_set_int(avr, "out_channel_layout", aCodecCtx->channel_layout, 0); - av_opt_set_int(avr, "in_sample_fmt", aCodecCtx->sample_fmt, 0); - av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); - av_opt_set_int(avr, "in_sample_rate", info.sample_rate, 0); - av_opt_set_int(avr, "out_sample_rate", info.sample_rate, 0); - av_opt_set_int(avr, "in_channels", info.channels, 0); - av_opt_set_int(avr, "out_channels", info.channels, 0); - int r = avresample_open(avr); - - // Convert audio samples - nb_samples = avresample_convert(avr, // audio resample context - audio_converted->data, // output data pointers - audio_converted->linesize[0], // output plane size, in bytes. (0 if unknown) - audio_converted->nb_samples, // maximum number of samples that the output buffer can hold - audio_frame->data, // input data pointers - audio_frame->linesize[0], // input plane size, in bytes (0 if unknown) - audio_frame->nb_samples); // number of input samples to convert - } - - // Copy audio samples over original samples - memcpy(audio_buf, audio_converted->data[0], audio_converted->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16) * info.channels); - - // Deallocate resample buffer - avresample_close(avr); - avresample_free(&avr); - avr = NULL; - - // Free AVFrames - av_free(audio_converted->data[0]); - AV_FREE_FRAME(&audio_converted); - - long int starting_frame_number = -1; - bool partial_frame = true; - for (int channel_filter = 0; channel_filter < info.channels; channel_filter++) - { - // Array of floats (to hold samples for each channel) - starting_frame_number = target_frame; - int channel_buffer_size = packet_samples / info.channels; - float *channel_buffer = new float[channel_buffer_size]; - - // Init buffer array - for (int z = 0; z < channel_buffer_size; z++) - channel_buffer[z] = 0.0f; - - // Loop through all samples and add them to our Frame based on channel. - // Toggle through each channel number, since channel data is stored like (left right left right) - int channel = 0; - int position = 0; - for (int sample = 0; sample < packet_samples; sample++) - { - // Only add samples for current channel - if (channel_filter == channel) - { - // Add sample (convert from (-32768 to 32768) to (-1.0 to 1.0)) - channel_buffer[position] = audio_buf[sample] * (1.0f / (1 << 15)); + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (ReSample)", "packet_samples", packet_samples, "info.channels", info.channels, "info.sample_rate", info.sample_rate, "aCodecCtx->sample_fmt", aCodecCtx->sample_fmt, "AV_SAMPLE_FMT_S16", AV_SAMPLE_FMT_S16, "", -1); - // Increment audio position - position++; - } + // Create output frame + AVFrame *audio_converted = AV_ALLOCATE_FRAME(); + AV_RESET_FRAME(audio_converted); + audio_converted->nb_samples = audio_frame->nb_samples; + av_samples_alloc(audio_converted->data, audio_converted->linesize, info.channels, audio_frame->nb_samples, AV_SAMPLE_FMT_S16, 0); + + AVAudioResampleContext *avr = NULL; + int nb_samples = 0; + + // setup resample context + avr = avresample_alloc_context(); + av_opt_set_int(avr, "in_channel_layout", aCodecCtx->channel_layout, 0); + av_opt_set_int(avr, "out_channel_layout", aCodecCtx->channel_layout, 0); + av_opt_set_int(avr, "in_sample_fmt", aCodecCtx->sample_fmt, 0); + av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + av_opt_set_int(avr, "in_sample_rate", info.sample_rate, 0); + av_opt_set_int(avr, "out_sample_rate", info.sample_rate, 0); + av_opt_set_int(avr, "in_channels", info.channels, 0); + av_opt_set_int(avr, "out_channels", info.channels, 0); + int r = avresample_open(avr); + + // Convert audio samples + nb_samples = avresample_convert(avr, // audio resample context + audio_converted->data, // output data pointers + audio_converted->linesize[0], // output plane size, in bytes. (0 if unknown) + audio_converted->nb_samples, // maximum number of samples that the output buffer can hold + audio_frame->data, // input data pointers + audio_frame->linesize[0], // input plane size, in bytes (0 if unknown) + audio_frame->nb_samples); // number of input samples to convert + + // Copy audio samples over original samples + memcpy(audio_buf, audio_converted->data[0], audio_converted->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16) * info.channels); + + // Deallocate resample buffer + avresample_close(avr); + avresample_free(&avr); + avr = NULL; + + // Free AVFrames + av_free(audio_converted->data[0]); + AV_FREE_FRAME(&audio_converted); + + long int starting_frame_number = -1; + bool partial_frame = true; + for (int channel_filter = 0; channel_filter < info.channels; channel_filter++) + { + // Array of floats (to hold samples for each channel) + starting_frame_number = target_frame; + int channel_buffer_size = packet_samples / info.channels; + float *channel_buffer = new float[channel_buffer_size]; + + // Init buffer array + for (int z = 0; z < channel_buffer_size; z++) + channel_buffer[z] = 0.0f; + + // Loop through all samples and add them to our Frame based on channel. + // Toggle through each channel number, since channel data is stored like (left right left right) + int channel = 0; + int position = 0; + for (int sample = 0; sample < packet_samples; sample++) + { + // Only add samples for current channel + if (channel_filter == channel) + { + // Add sample (convert from (-32768 to 32768) to (-1.0 to 1.0)) + channel_buffer[position] = audio_buf[sample] * (1.0f / (1 << 15)); - // increment channel (if needed) - if ((channel + 1) < info.channels) - // move to next channel - channel ++; - else - // reset channel - channel = 0; + // Increment audio position + position++; } - // Loop through samples, and add them to the correct frames - int start = starting_sample; - int remaining_samples = channel_buffer_size; - float *iterate_channel_buffer = channel_buffer; // pointer to channel buffer - while (remaining_samples > 0) - { - // Get Samples per frame (for this frame number) - int samples_per_frame = Frame::GetSamplesPerFrame(starting_frame_number, info.fps, info.sample_rate, info.channels); - - // Calculate # of samples to add to this frame - int samples = samples_per_frame - start; - if (samples > remaining_samples) - samples = remaining_samples; - - // Create or get the existing frame object - tr1::shared_ptr f = CreateFrame(starting_frame_number); - - // Determine if this frame was "partially" filled in - if (samples_per_frame == start + samples) - partial_frame = false; - else - partial_frame = true; + // increment channel (if needed) + if ((channel + 1) < info.channels) + // move to next channel + channel ++; + else + // reset channel + channel = 0; + } - // Add samples for current channel to the frame. Reduce the volume to 98%, to prevent - // some louder samples from maxing out at 1.0 (not sure why this happens) - f->AddAudio(true, channel_filter, start, iterate_channel_buffer, samples, 0.98f); + // Loop through samples, and add them to the correct frames + int start = starting_sample; + int remaining_samples = channel_buffer_size; + float *iterate_channel_buffer = channel_buffer; // pointer to channel buffer + while (remaining_samples > 0) + { + // Get Samples per frame (for this frame number) + int samples_per_frame = Frame::GetSamplesPerFrame(starting_frame_number, info.fps, info.sample_rate, info.channels); + + // Calculate # of samples to add to this frame + int samples = samples_per_frame - start; + if (samples > remaining_samples) + samples = remaining_samples; + + // Create or get the existing frame object + std::shared_ptr f = CreateFrame(starting_frame_number); + + // Determine if this frame was "partially" filled in + if (samples_per_frame == start + samples) + partial_frame = false; + else + partial_frame = true; - // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (f->AddAudio)", "frame", starting_frame_number, "start", start, "samples", samples, "channel", channel_filter, "partial_frame", partial_frame, "samples_per_frame", samples_per_frame); + // Add samples for current channel to the frame. Reduce the volume to 98%, to prevent + // some louder samples from maxing out at 1.0 (not sure why this happens) + f->AddAudio(true, channel_filter, start, iterate_channel_buffer, samples, 0.98f); - // Add or update cache - working_cache.Add(f); + // Debug output + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (f->AddAudio)", "frame", starting_frame_number, "start", start, "samples", samples, "channel", channel_filter, "partial_frame", partial_frame, "samples_per_frame", samples_per_frame); - // Decrement remaining samples - remaining_samples -= samples; + // Add or update cache + working_cache.Add(f); - // Increment buffer (to next set of samples) - if (remaining_samples > 0) - iterate_channel_buffer += samples; + // Decrement remaining samples + remaining_samples -= samples; - // Increment frame number - starting_frame_number++; + // Increment buffer (to next set of samples) + if (remaining_samples > 0) + iterate_channel_buffer += samples; - // Reset starting sample # - start = 0; - } + // Increment frame number + starting_frame_number++; - // clear channel buffer - delete[] channel_buffer; - channel_buffer = NULL; - iterate_channel_buffer = NULL; + // Reset starting sample # + start = 0; } - // Clean up some arrays - delete[] audio_buf; - audio_buf = NULL; + // clear channel buffer + delete[] channel_buffer; + channel_buffer = NULL; + iterate_channel_buffer = NULL; + } - // Remove audio frame from list of processing audio frames - { - const GenericScopedLock lock(processingCriticalSection); - // Update all frames as completed - for (long int f = target_frame; f < starting_frame_number; f++) { - // Remove the frame # from the processing list. NOTE: If more than one thread is - // processing this frame, the frame # will be in this list multiple times. We are only - // removing a single instance of it here. - processing_audio_frames.erase(processing_audio_frames.find(f)); - - // Check and see if this frame is also being processed by another thread - if (processing_audio_frames.count(f) == 0) - // No other thread is processing it. Mark the audio as processed (final) - processed_audio_frames[f] = f; - } + // Clean up some arrays + delete[] audio_buf; + audio_buf = NULL; - if (target_frame == starting_frame_number) { - // This typically never happens, but just in case, remove the currently processing number - processing_audio_frames.erase(processing_audio_frames.find(target_frame)); - } + // Remove audio frame from list of processing audio frames + { + const GenericScopedLock lock(processingCriticalSection); + // Update all frames as completed + for (long int f = target_frame; f < starting_frame_number; f++) { + // Remove the frame # from the processing list. NOTE: If more than one thread is + // processing this frame, the frame # will be in this list multiple times. We are only + // removing a single instance of it here. + processing_audio_frames.erase(processing_audio_frames.find(f)); + + // Check and see if this frame is also being processed by another thread + if (processing_audio_frames.count(f) == 0) + // No other thread is processing it. Mark the audio as processed (final) + processed_audio_frames[f] = f; + } + + if (target_frame == starting_frame_number) { + // This typically never happens, but just in case, remove the currently processing number + processing_audio_frames.erase(processing_audio_frames.find(target_frame)); } - - // Remove this packet - RemoveAVPacket(my_packet); - - // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (After)", "requested_frame", requested_frame, "starting_frame", target_frame, "end_frame", starting_frame_number - 1, "", -1, "", -1, "", -1); - - } // end task - - - // TODO: Fix this bug. Wait on the task to complete. This is not ideal, but solves an issue with the - // audio_frame being modified by the next call to this method. I think this is a scope issue with OpenMP. - #pragma omp taskwait + } // Free audio frame AV_FREE_FRAME(&audio_frame); + + // Debug output + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (After)", "requested_frame", requested_frame, "starting_frame", target_frame, "end_frame", starting_frame_number - 1, "", -1, "", -1, "", -1); + } @@ -1188,12 +1158,24 @@ if (requested_frame > info.video_length) requested_frame = info.video_length; + int processing_video_frames_size = 0; + int processing_audio_frames_size = 0; + { + const GenericScopedLock lock(processingCriticalSection); + processing_video_frames_size = processing_video_frames.size(); + processing_audio_frames_size = processing_audio_frames.size(); + } + // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::Seek", "requested_frame", requested_frame, "seek_count", seek_count, "last_frame", last_frame, "processing_video_frames.size()", processing_video_frames.size(), "processing_audio_frames.size()", processing_audio_frames.size(), "", -1); + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::Seek", "requested_frame", requested_frame, "seek_count", seek_count, "last_frame", last_frame, "processing_video_frames_size", processing_video_frames_size, "processing_audio_frames_size", processing_audio_frames_size, "", -1); // Wait for any processing frames to complete - while (processing_video_frames.size() + processing_audio_frames.size() > 0) + while (processing_video_frames_size + processing_audio_frames_size > 0) { usleep(2500); + const GenericScopedLock lock(processingCriticalSection); + processing_video_frames_size = processing_video_frames.size(); + processing_audio_frames_size = processing_audio_frames.size(); + } // Clear working cache (since we are seeking to another location in the file) working_cache.Clear(); @@ -1206,7 +1188,6 @@ processing_video_frames.clear(); processed_video_frames.clear(); processed_audio_frames.clear(); - duplicate_video_frames.clear(); missing_audio_frames.clear(); missing_video_frames.clear(); missing_audio_frames_source.clear(); @@ -1392,8 +1373,6 @@ // Sometimes frames are duplicated due to identical (or similar) timestamps if (frame == previous_video_frame) { - duplicate_video_frames.insert(pair(frame, frame)); - // return -1 frame number frame = -1; } @@ -1522,14 +1501,14 @@ } // Create a new Frame (or return an existing one) and add it to the working queue. -tr1::shared_ptr FFmpegReader::CreateFrame(long int requested_frame) +std::shared_ptr FFmpegReader::CreateFrame(long int requested_frame) { // Check working cache - tr1::shared_ptr output = working_cache.GetFrame(requested_frame); + std::shared_ptr output = working_cache.GetFrame(requested_frame); if (!output) { // Create a new frame on the working cache - output = tr1::shared_ptr(new Frame(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels)); + output = std::make_shared(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels); output->SetPixelRatio(info.pixel_ratio.num, info.pixel_ratio.den); // update pixel ratio output->ChannelsLayout(info.channel_layout); // update audio channel layout from the parent reader output->SampleRate(info.sample_rate); // update the frame's sample rate of the parent reader @@ -1599,7 +1578,7 @@ checked_frames[missing_source_frame]++; // Get the previous frame of this missing frame (if it's available in missing cache) - tr1::shared_ptr parent_frame = missing_frames.GetFrame(missing_source_frame); + std::shared_ptr parent_frame = missing_frames.GetFrame(missing_source_frame); if (parent_frame == NULL) { parent_frame = final_cache.GetFrame(missing_source_frame); if (parent_frame != NULL) { @@ -1609,7 +1588,7 @@ } // Create blank missing frame - tr1::shared_ptr missing_frame = CreateFrame(requested_frame); + std::shared_ptr missing_frame = CreateFrame(requested_frame); // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckMissingFrame (Is Previous Video Frame Final)", "requested_frame", requested_frame, "missing_frame->number", missing_frame->number, "missing_source_frame", missing_source_frame, "", -1, "", -1, "", -1); @@ -1620,19 +1599,22 @@ ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckMissingFrame (AddImage from Previous Video Frame)", "requested_frame", requested_frame, "missing_frame->number", missing_frame->number, "missing_source_frame", missing_source_frame, "", -1, "", -1, "", -1); // Add this frame to the processed map (since it's already done) - missing_frame->AddImage(tr1::shared_ptr(new QImage(*parent_frame->GetImage()))); + std::shared_ptr parent_image = parent_frame->GetImage(); + if (parent_image) { + missing_frame->AddImage(std::shared_ptr(new QImage(*parent_image))); - processed_video_frames[missing_frame->number] = missing_frame->number; - processed_audio_frames[missing_frame->number] = missing_frame->number; + processed_video_frames[missing_frame->number] = missing_frame->number; + processed_audio_frames[missing_frame->number] = missing_frame->number; - // Move frame to final cache - final_cache.Add(missing_frame); + // Move frame to final cache + final_cache.Add(missing_frame); - // Remove frame from working cache - working_cache.Remove(missing_frame->number); + // Remove frame from working cache + working_cache.Remove(missing_frame->number); - // Update last_frame processed - last_frame = missing_frame->number; + // Update last_frame processed + last_frame = missing_frame->number; + } } } @@ -1650,7 +1632,7 @@ while (true) { // Get the front frame of working cache - tr1::shared_ptr f(working_cache.GetSmallestFrame()); + std::shared_ptr f(working_cache.GetSmallestFrame()); // Was a frame found? if (!f) @@ -1662,6 +1644,7 @@ // Init # of times this frame has been checked so far int checked_count = 0; + int checked_frames_size = 0; bool is_video_ready = false; bool is_audio_ready = false; @@ -1671,6 +1654,7 @@ is_audio_ready = processed_audio_frames.count(f->number); // Get check count for this frame + checked_frames_size = checked_frames.size(); if (!checked_count_tripped || f->number >= requested_frame) checked_count = checked_frames[f->number]; else @@ -1689,14 +1673,14 @@ // Make final any frames that get stuck (for whatever reason) if (checked_count >= max_checked_count && (!is_video_ready || !is_audio_ready)) { // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckWorkingFrames (exceeded checked_count)", "requested_frame", requested_frame, "frame_number", f->number, "is_video_ready", is_video_ready, "is_audio_ready", is_audio_ready, "checked_count", checked_count, "checked_frames.size()", checked_frames.size()); + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckWorkingFrames (exceeded checked_count)", "requested_frame", requested_frame, "frame_number", f->number, "is_video_ready", is_video_ready, "is_audio_ready", is_audio_ready, "checked_count", checked_count, "checked_frames_size", checked_frames_size); // Trigger checked count tripped mode (clear out all frames before requested frame) checked_count_tripped = true; if (info.has_video && !is_video_ready && last_video_frame) { // Copy image from last frame - f->AddImage(tr1::shared_ptr(new QImage(*last_video_frame->GetImage()))); + f->AddImage(std::shared_ptr(new QImage(*last_video_frame->GetImage()))); is_video_ready = true; } @@ -1708,7 +1692,7 @@ } // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckWorkingFrames", "requested_frame", requested_frame, "frame_number", f->number, "is_video_ready", is_video_ready, "is_audio_ready", is_audio_ready, "checked_count", checked_count, "checked_frames.size()", checked_frames.size()); + ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::CheckWorkingFrames", "requested_frame", requested_frame, "frame_number", f->number, "is_video_ready", is_video_ready, "is_audio_ready", is_audio_ready, "checked_count", checked_count, "checked_frames_size", checked_frames_size); // Check if working frame is final if ((!end_of_stream && is_video_ready && is_audio_ready) || end_of_stream || is_seek_trash) @@ -1792,9 +1776,6 @@ // Remove pFrame RemoveAVFrame(pFrame); - // remove packet - RemoveAVPacket(packet); - // Apply PTS offset pts += video_pts_offset; @@ -1816,13 +1797,7 @@ // Too far break; } - else - // remove packet - RemoveAVPacket(packet); } - else - // remove packet - RemoveAVPacket(packet); // Increment counters iterations++; @@ -1880,29 +1855,22 @@ // Remove AVFrame from cache (and deallocate it's memory) void FFmpegReader::RemoveAVFrame(AVPicture* remove_frame) { - #pragma omp critical (packet_cache) - { - // Remove pFrame (if exists) - if (frames.count(remove_frame)) - { - // Free memory - avpicture_free(frames[remove_frame]); - - // Remove from cache - frames.erase(remove_frame); - - // Delete the object - delete remove_frame; - } - - } // end omp critical + // Remove pFrame (if exists) + if (remove_frame) + { + // Free memory + avpicture_free(remove_frame); + + // Delete the object + delete remove_frame; + } } // Remove AVPacket from cache (and deallocate it's memory) void FFmpegReader::RemoveAVPacket(AVPacket* remove_packet) { // deallocate memory for packet - av_free_packet(remove_packet); + AV_FREE_PACKET(remove_packet); // Delete the object delete remove_packet; @@ -1914,6 +1882,7 @@ // Loop through frame numbers map::iterator itr; long int smallest_frame = -1; + const GenericScopedLock lock(processingCriticalSection); for(itr = processing_video_frames.begin(); itr != processing_video_frames.end(); ++itr) { if (itr->first < smallest_frame || smallest_frame == -1) diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FFmpegWriter.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FFmpegWriter.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FFmpegWriter.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FFmpegWriter.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -119,7 +119,7 @@ { AVCodec *new_codec = avcodec_find_encoder_by_name(codec.c_str()); if (new_codec == NULL) - throw InvalidCodec("A valid audio codec could not be found for this file.", path); + throw InvalidCodec("A valid video codec could not be found for this file.", path); else { // Set video codec info.vcodec = new_codec->name; @@ -332,6 +332,9 @@ throw InvalidFile("Could not open or write file.", path); } + // Force the output filename (which doesn't always happen for some reason) + snprintf(oc->filename, sizeof(oc->filename), "%s", path.c_str()); + // Write the stream header, if any // TODO: add avoptions / parameters instead of NULL avformat_write_header(oc, NULL); @@ -343,7 +346,7 @@ } // Add a frame to the queue waiting to be encoded. -void FFmpegWriter::WriteFrame(tr1::shared_ptr frame) throw(ErrorEncodingVideo, WriterClosed) +void FFmpegWriter::WriteFrame(std::shared_ptr frame) throw(ErrorEncodingVideo, WriterClosed) { // Check for open reader (or throw exception) if (!is_open) @@ -418,7 +421,7 @@ while (!queued_video_frames.empty()) { // Get front frame (from the queue) - tr1::shared_ptr frame = queued_video_frames.front(); + std::shared_ptr frame = queued_video_frames.front(); // Add to processed queue processed_frames.push_back(frame); @@ -439,7 +442,7 @@ while (!processed_frames.empty()) { // Get front frame (from the queue) - tr1::shared_ptr frame = processed_frames.front(); + std::shared_ptr frame = processed_frames.front(); if (info.has_video && video_st) { @@ -467,7 +470,7 @@ while (!deallocate_frames.empty()) { // Get front frame (from the queue) - tr1::shared_ptr frame = deallocate_frames.front(); + std::shared_ptr frame = deallocate_frames.front(); // Does this frame's AVFrame still exist if (av_frames.count(frame)) @@ -505,7 +508,7 @@ for (long int number = start; number <= length; number++) { // Get the frame - tr1::shared_ptr f = reader->GetFrame(number); + std::shared_ptr f = reader->GetFrame(number); // Encode frame WriteFrame(f); @@ -675,7 +678,7 @@ } // deallocate memory for packet - av_free_packet(&pkt); + AV_FREE_PACKET(&pkt); } @@ -761,7 +764,7 @@ } // Add an AVFrame to the cache -void FFmpegWriter::add_avframe(tr1::shared_ptr frame, AVFrame* av_frame) +void FFmpegWriter::add_avframe(std::shared_ptr frame, AVFrame* av_frame) { // Add AVFrame to map (if it does not already exist) if (!av_frames.count(frame)) @@ -960,8 +963,8 @@ AVCodec *codec; audio_codec = st->codec; - // Set number of threads equal to number of processors + 1 - audio_codec->thread_count = OPEN_MP_NUM_PROCESSORS; + // Set number of threads equal to number of processors (not to exceed 16) + audio_codec->thread_count = min(OPEN_MP_NUM_PROCESSORS, 16); // Find the audio encoder codec = avcodec_find_encoder(audio_codec->codec_id); @@ -1017,14 +1020,18 @@ AVCodec *codec; video_codec = st->codec; - // Set number of threads equal to number of processors + 1 - video_codec->thread_count = OPEN_MP_NUM_PROCESSORS; + // Set number of threads equal to number of processors (not to exceed 16) + video_codec->thread_count = min(OPEN_MP_NUM_PROCESSORS, 16); /* find the video encoder */ codec = avcodec_find_encoder(video_codec->codec_id); if (!codec) throw InvalidCodec("Could not find codec", path); + /* Force max_b_frames to 0 in some cases (i.e. for mjpeg image sequences */ + if(video_codec->max_b_frames && video_codec->codec_id != AV_CODEC_ID_MPEG4 && video_codec->codec_id != AV_CODEC_ID_MPEG1VIDEO && video_codec->codec_id != AV_CODEC_ID_MPEG2VIDEO) + video_codec->max_b_frames = 0; + /* open the codec */ if (avcodec_open2(video_codec, codec, NULL) < 0) throw InvalidCodec("Could not open codec", path); @@ -1056,7 +1063,7 @@ while (!queued_audio_frames.empty()) { // Get front frame (from the queue) - tr1::shared_ptr frame = queued_audio_frames.front(); + std::shared_ptr frame = queued_audio_frames.front(); // Get the audio details from this frame sample_rate_in_frame = frame->SampleRate(); @@ -1348,7 +1355,7 @@ AV_FREE_FRAME(&frame_final); // deallocate memory for packet - av_free_packet(&pkt); + AV_FREE_PACKET(&pkt); // Reset position audio_input_position = 0; @@ -1399,7 +1406,7 @@ } // process video frame -void FFmpegWriter::process_video_packet(tr1::shared_ptr frame) +void FFmpegWriter::process_video_packet(std::shared_ptr frame) { // Determine the height & width of the source image int source_image_width = frame->GetWidth(); @@ -1454,7 +1461,7 @@ } // write video frame -bool FFmpegWriter::write_video_packet(tr1::shared_ptr frame, AVFrame* frame_final) +bool FFmpegWriter::write_video_packet(std::shared_ptr frame, AVFrame* frame_final) { ZmqLogger::Instance()->AppendDebugMethod("FFmpegWriter::write_video_packet", "frame->number", frame->number, "oc->oformat->flags & AVFMT_RAWPICTURE", oc->oformat->flags & AVFMT_RAWPICTURE, "", -1, "", -1, "", -1, "", -1); @@ -1481,7 +1488,7 @@ } // Deallocate packet - av_free_packet(&pkt); + AV_FREE_PACKET(&pkt); } else { @@ -1559,7 +1566,7 @@ delete[] video_outbuf; // Deallocate packet - av_free_packet(&pkt); + AV_FREE_PACKET(&pkt); } // Success diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Frame.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Frame.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Frame.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Frame.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -35,7 +35,7 @@ channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false) { // Init the image magic and audio buffer - audio = tr1::shared_ptr(new juce::AudioSampleBuffer(channels, 0)); + audio = std::shared_ptr(new juce::AudioSampleBuffer(channels, 0)); // initialize the audio samples to zero (silence) audio->clear(); @@ -47,7 +47,7 @@ channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false) { // Init the image magic and audio buffer - audio = tr1::shared_ptr(new juce::AudioSampleBuffer(channels, 0)); + audio = std::shared_ptr(new juce::AudioSampleBuffer(channels, 0)); // initialize the audio samples to zero (silence) audio->clear(); @@ -59,7 +59,7 @@ channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false) { // Init the image magic and audio buffer - audio = tr1::shared_ptr(new juce::AudioSampleBuffer(channels, samples)); + audio = std::shared_ptr(new juce::AudioSampleBuffer(channels, samples)); // initialize the audio samples to zero (silence) audio->clear(); @@ -71,7 +71,7 @@ channel_layout(LAYOUT_STEREO), sample_rate(44100), qbuffer(NULL), has_audio_data(false), has_image_data(false) { // Init the image magic and audio buffer - audio = tr1::shared_ptr(new juce::AudioSampleBuffer(channels, samples)); + audio = std::shared_ptr(new juce::AudioSampleBuffer(channels, samples)); // initialize the audio samples to zero (silence) audio->clear(); @@ -89,8 +89,8 @@ void Frame::DeepCopy(const Frame& other) { number = other.number; - image = tr1::shared_ptr(new QImage(*(other.image))); - audio = tr1::shared_ptr(new juce::AudioSampleBuffer(*(other.audio))); + image = std::shared_ptr(new QImage(*(other.image))); + audio = std::shared_ptr(new juce::AudioSampleBuffer(*(other.audio))); pixel_ratio = Fraction(other.pixel_ratio.num, other.pixel_ratio.den); channels = other.channels; channel_layout = other.channel_layout; @@ -100,7 +100,7 @@ if (other.wave_image) - wave_image = tr1::shared_ptr(new QImage(*(other.wave_image))); + wave_image = std::shared_ptr(new QImage(*(other.wave_image))); } // Descructor @@ -117,11 +117,11 @@ // Only create the QApplication once static int argc = 1; static char* argv[1] = {NULL}; - previewApp = tr1::shared_ptr(new QApplication(argc, argv)); + previewApp = std::shared_ptr(new QApplication(argc, argv)); } // Get preview image - tr1::shared_ptr previewImage = GetImage(); + std::shared_ptr previewImage = GetImage(); // Update the image to reflect the correct pixel aspect ration (i.e. to fix non-squar pixels) if (pixel_ratio.num != 1 || pixel_ratio.den != 1) @@ -131,7 +131,7 @@ int new_height = previewImage->size().height() * pixel_ratio.Reciprocal().ToDouble(); // Resize to fix DAR - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); } // Create window @@ -152,7 +152,7 @@ } // Get an audio waveform image -tr1::shared_ptr Frame::GetWaveform(int width, int height, int Red, int Green, int Blue, int Alpha) +std::shared_ptr Frame::GetWaveform(int width, int height, int Red, int Green, int Blue, int Alpha) { // Clear any existing waveform image ClearWaveform(); @@ -207,7 +207,7 @@ } // Create blank image - wave_image = tr1::shared_ptr(new QImage(total_width, total_height, QImage::Format_RGBA8888)); + wave_image = std::shared_ptr(new QImage(total_width, total_height, QImage::Format_RGBA8888)); wave_image->fill(QColor(0,0,0,0)); // Load QPainter with wave_image device @@ -232,13 +232,13 @@ // Resize Image (if requested) if (width != total_width || height != total_height) { QImage scaled_wave_image = wave_image->scaled(width, height, Qt::IgnoreAspectRatio, Qt::FastTransformation); - wave_image = tr1::shared_ptr(new QImage(scaled_wave_image)); + wave_image = std::shared_ptr(new QImage(scaled_wave_image)); } } else { // No audio samples present - wave_image = tr1::shared_ptr(new QImage(width, height, QImage::Format_RGBA8888)); + wave_image = std::shared_ptr(new QImage(width, height, QImage::Format_RGBA8888)); wave_image->fill(QColor(QString::fromStdString("#000000"))); } @@ -273,7 +273,7 @@ // Only create the QApplication once static int argc = 1; static char* argv[1] = {NULL}; - previewApp = tr1::shared_ptr(new QApplication(argc, argv)); + previewApp = std::shared_ptr(new QApplication(argc, argv)); } // Create window @@ -410,13 +410,21 @@ // Get number of audio channels int Frame::GetAudioChannelsCount() { - return audio->getNumChannels(); + const GenericScopedLock lock(addingAudioSection); + if (audio) + return audio->getNumChannels(); + else + return 0; } // Get number of audio samples int Frame::GetAudioSamplesCount() { - return audio->getNumSamples(); + const GenericScopedLock lock(addingAudioSection); + if (audio) + return audio->getNumSamples(); + else + return 0; } juce::AudioSampleBuffer *Frame::GetAudioSampleBuffer() @@ -528,7 +536,7 @@ void Frame::Save(string path, float scale, string format, int quality) { // Get preview image - tr1::shared_ptr previewImage = GetImage(); + std::shared_ptr previewImage = GetImage(); // scale image if needed if (abs(scale) > 1.001 || abs(scale) < 0.999) @@ -544,11 +552,11 @@ int new_height = previewImage->size().height() * pixel_ratio.Reciprocal().ToDouble(); // Resize to fix DAR - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); } // Resize image - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(new_width * scale, new_height * scale, Qt::KeepAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(new_width * scale, new_height * scale, Qt::KeepAspectRatio, Qt::SmoothTransformation))); } // Save image @@ -560,7 +568,7 @@ string background_color, bool ignore_aspect, string format, int quality) throw(InvalidFile) { // Create blank thumbnail image & fill background color - tr1::shared_ptr thumbnail = tr1::shared_ptr(new QImage(new_width, new_height, QImage::Format_RGBA8888)); + std::shared_ptr thumbnail = std::shared_ptr(new QImage(new_width, new_height, QImage::Format_RGBA8888)); thumbnail->fill(QColor(QString::fromStdString(background_color))); // Create transform and painter @@ -570,7 +578,7 @@ // Get preview image - tr1::shared_ptr previewImage = GetImage(); + std::shared_ptr previewImage = GetImage(); // Update the image to reflect the correct pixel aspect ration (i.e. to fix non-squar pixels) if (pixel_ratio.num != 1 || pixel_ratio.den != 1) @@ -580,16 +588,16 @@ int aspect_height = previewImage->size().height() * pixel_ratio.Reciprocal().ToDouble(); // Resize to fix DAR - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(aspect_width, aspect_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(aspect_width, aspect_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); } // Resize frame image if (ignore_aspect) // Ignore aspect ratio - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); else // Maintain aspect ratio - previewImage = tr1::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); + previewImage = std::shared_ptr(new QImage(previewImage->scaled(new_width, new_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); // Composite frame image onto background (centered) int x = (new_width - previewImage->size().width()) / 2.0; // center @@ -601,14 +609,14 @@ // Overlay Image (if any) if (overlay_path != "") { // Open overlay - tr1::shared_ptr overlay = tr1::shared_ptr(new QImage()); + std::shared_ptr overlay = std::shared_ptr(new QImage()); overlay->load(QString::fromStdString(overlay_path)); // Set pixel format - overlay = tr1::shared_ptr(new QImage(overlay->convertToFormat(QImage::Format_RGBA8888))); + overlay = std::shared_ptr(new QImage(overlay->convertToFormat(QImage::Format_RGBA8888))); // Resize to fit - overlay = tr1::shared_ptr(new QImage(overlay->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + overlay = std::shared_ptr(new QImage(overlay->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); // Composite onto thumbnail painter.setCompositionMode(QPainter::CompositionMode_SourceOver); @@ -619,14 +627,14 @@ // Mask Image (if any) if (mask_path != "") { // Open mask - tr1::shared_ptr mask = tr1::shared_ptr(new QImage()); + std::shared_ptr mask = std::shared_ptr(new QImage()); mask->load(QString::fromStdString(mask_path)); // Set pixel format - mask = tr1::shared_ptr(new QImage(mask->convertToFormat(QImage::Format_RGBA8888))); + mask = std::shared_ptr(new QImage(mask->convertToFormat(QImage::Format_RGBA8888))); // Resize to fit - mask = tr1::shared_ptr(new QImage(mask->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + mask = std::shared_ptr(new QImage(mask->scaled(new_width, new_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); // Negate mask mask->invertPixels(); @@ -674,7 +682,7 @@ { // Create new image object, and fill with pixel data const GenericScopedLock lock(addingImageSection); - image = tr1::shared_ptr(new QImage(new_width, new_height, QImage::Format_RGBA8888)); + image = std::shared_ptr(new QImage(new_width, new_height, QImage::Format_RGBA8888)); // Fill with solid color image->fill(QColor(QString::fromStdString(color))); @@ -697,7 +705,7 @@ memcpy((unsigned char*)qbuffer, pixels_, buffer_size); // Create new image object, and fill with pixel data - image = tr1::shared_ptr(new QImage(qbuffer, new_width, new_height, new_width * bytes_per_pixel, type, (QImageCleanupFunction) &openshot::Frame::cleanUpBuffer, (void*) qbuffer)); + image = std::shared_ptr(new QImage(qbuffer, new_width, new_height, new_width * bytes_per_pixel, type, (QImageCleanupFunction) &openshot::Frame::cleanUpBuffer, (void*) qbuffer)); // Always convert to RGBA8888 (if different) if (image->format() != QImage::Format_RGBA8888) @@ -710,7 +718,7 @@ } // Add (or replace) pixel data to the frame -void Frame::AddImage(tr1::shared_ptr new_image) +void Frame::AddImage(std::shared_ptr new_image) { // Ignore blank images if (!new_image) @@ -731,7 +739,7 @@ } // Add (or replace) pixel data to the frame (for only the odd or even lines) -void Frame::AddImage(tr1::shared_ptr new_image, bool only_odd_lines) +void Frame::AddImage(std::shared_ptr new_image, bool only_odd_lines) { // Ignore blank new_image if (!new_image) @@ -773,41 +781,48 @@ // Resize audio container to hold more (or less) samples and channels void Frame::ResizeAudio(int channels, int length, int rate, ChannelLayout layout) { - // Resize JUCE audio buffer + const GenericScopedLock lock(addingAudioSection); + + // Resize JUCE audio buffer audio->setSize(channels, length, true, true, false); channel_layout = layout; sample_rate = rate; } // Add audio samples to a specific channel -void Frame::AddAudio(bool replaceSamples, int destChannel, int destStartSample, const float* source, int numSamples, float gainToApplyToSource = 1.0f) -{ - // Extend audio container to hold more (or less) samples and channels.. if needed - int new_length = destStartSample + numSamples; - int new_channel_length = audio->getNumChannels(); - if (destChannel >= new_channel_length) - new_channel_length = destChannel + 1; - if (new_length > audio->getNumSamples() || new_channel_length > audio->getNumChannels()) - audio->setSize(new_channel_length, new_length, true, true, false); - - // Clear the range of samples first (if needed) - if (replaceSamples) - audio->clear(destChannel, destStartSample, numSamples); - - // Add samples to frame's audio buffer - audio->addFrom(destChannel, destStartSample, source, numSamples, gainToApplyToSource); - has_audio_data = true; +void Frame::AddAudio(bool replaceSamples, int destChannel, int destStartSample, const float* source, int numSamples, float gainToApplyToSource = 1.0f) { + const GenericScopedLock lock(addingAudioSection); + #pragma omp critical (adding_audio) + { + // Extend audio container to hold more (or less) samples and channels.. if needed + int new_length = destStartSample + numSamples; + int new_channel_length = audio->getNumChannels(); + if (destChannel >= new_channel_length) + new_channel_length = destChannel + 1; + if (new_length > audio->getNumSamples() || new_channel_length > audio->getNumChannels()) + audio->setSize(new_channel_length, new_length, true, true, false); + + // Clear the range of samples first (if needed) + if (replaceSamples) + audio->clear(destChannel, destStartSample, numSamples); + + // Add samples to frame's audio buffer + audio->addFrom(destChannel, destStartSample, source, numSamples, gainToApplyToSource); + has_audio_data = true; + } } // Apply gain ramp (i.e. fading volume) void Frame::ApplyGainRamp(int destChannel, int destStartSample, int numSamples, float initial_gain = 0.0f, float final_gain = 1.0f) { - // Apply gain ramp + const GenericScopedLock lock(addingAudioSection); + + // Apply gain ramp audio->applyGainRamp(destChannel, destStartSample, numSamples, initial_gain, final_gain); } // Get pointer to Magick++ image object -tr1::shared_ptr Frame::GetImage() +std::shared_ptr Frame::GetImage() { // Check for blank image if (!image) @@ -819,7 +834,7 @@ #ifdef USE_IMAGEMAGICK // Get pointer to ImageMagick image object -tr1::shared_ptr Frame::GetMagickImage() +std::shared_ptr Frame::GetMagickImage() { // Check for blank image if (!image) @@ -830,7 +845,7 @@ QRgb const *tmpBits = (const QRgb*)image->bits(); // Create new image object, and fill with pixel data - tr1::shared_ptr magick_image = tr1::shared_ptr(new Magick::Image(image->width(), image->height(),"RGBA", Magick::CharPixel, tmpBits)); + std::shared_ptr magick_image = std::shared_ptr(new Magick::Image(image->width(), image->height(),"RGBA", Magick::CharPixel, tmpBits)); // Give image a transparent background color magick_image->backgroundColor(Magick::Color("none")); @@ -843,7 +858,7 @@ #ifdef USE_IMAGEMAGICK // Get pointer to QImage of frame -void Frame::AddMagickImage(tr1::shared_ptr new_image) +void Frame::AddMagickImage(std::shared_ptr new_image) { const int BPP = 4; const std::size_t bufferSize = new_image->columns() * new_image->rows() * BPP; @@ -867,7 +882,7 @@ } // Create QImage of frame data - image = tr1::shared_ptr(new QImage(qbuffer, width, height, width * BPP, QImage::Format_RGBA8888, (QImageCleanupFunction) &cleanUpBuffer, (void*) qbuffer)); + image = std::shared_ptr(new QImage(qbuffer, width, height, width * BPP, QImage::Format_RGBA8888, (QImageCleanupFunction) &cleanUpBuffer, (void*) qbuffer)); // Update height and width width = image->width(); @@ -956,7 +971,9 @@ // Add audio silence void Frame::AddAudioSilence(int numSamples) { - // Resize audio container + const GenericScopedLock lock(addingAudioSection); + + // Resize audio container audio->setSize(channels, numSamples, false, true, false); audio->clear(); has_audio_data = true; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FrameMapper.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FrameMapper.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/FrameMapper.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/FrameMapper.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -341,12 +341,12 @@ } // Get or generate a blank frame -tr1::shared_ptr FrameMapper::GetOrCreateFrame(long int number) +std::shared_ptr FrameMapper::GetOrCreateFrame(long int number) { - tr1::shared_ptr new_frame; + std::shared_ptr new_frame; // Init some basic properties about this frame (keep sample rate and # channels the same as the original reader for now) - int samples_in_frame = Frame::GetSamplesPerFrame(number, target, reader->info.sample_rate, reader->info.channels); + int samples_in_frame = Frame::GetSamplesPerFrame(number + timeline_frame_offset, target, reader->info.sample_rate, reader->info.channels); try { // Debug output @@ -373,17 +373,17 @@ ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1); // Create blank frame - new_frame = tr1::shared_ptr(new Frame(number, info.width, info.height, "#000000", samples_in_frame, reader->info.channels)); + new_frame = std::make_shared(number, info.width, info.height, "#000000", samples_in_frame, reader->info.channels); new_frame->SampleRate(reader->info.sample_rate); new_frame->ChannelsLayout(info.channel_layout); return new_frame; } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr FrameMapper::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr FrameMapper::GetFrame(long int requested_frame) throw(ReaderClosed) { // Check final cache, and just return the frame (if it's available) - tr1::shared_ptr final_frame = final_cache.GetFrame(requested_frame); + std::shared_ptr final_frame = final_cache.GetFrame(requested_frame); if (final_frame) return final_frame; // Create a scoped lock, allowing only a single thread to run the following code at one time @@ -399,193 +399,183 @@ if (final_frame) return final_frame; // Minimum number of frames to process (for performance reasons) - int minimum_frames = OPEN_MP_NUM_PROCESSORS; - - // Set the number of threads in OpenMP - omp_set_num_threads(OPEN_MP_NUM_PROCESSORS); - // Allow nested OpenMP sections - omp_set_nested(true); + // Dialing this down to 1 for now, as it seems to improve performance, and reduce export crashes + int minimum_frames = 1; // Debug output ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetFrame (Loop through frames)", "requested_frame", requested_frame, "minimum_frames", minimum_frames, "", -1, "", -1, "", -1, "", -1); - #pragma omp parallel + // Loop through all requested frames + for (long int frame_number = requested_frame; frame_number < requested_frame + minimum_frames; frame_number++) { - // Loop through all requested frames, each frame gets it's own thread - #pragma omp for ordered firstprivate(requested_frame, minimum_frames) - for (long int frame_number = requested_frame; frame_number < requested_frame + minimum_frames; frame_number++) - { - // Debug output - ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetFrame (inside omp for loop)", "frame_number", frame_number, "minimum_frames", minimum_frames, "requested_frame", requested_frame, "", -1, "", -1, "", -1); + // Debug output + ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::GetFrame (inside omp for loop)", "frame_number", frame_number, "minimum_frames", minimum_frames, "requested_frame", requested_frame, "", -1, "", -1, "", -1); - // Get the mapped frame - MappedFrame mapped = GetMappedFrame(frame_number); - tr1::shared_ptr mapped_frame; - - // Get the mapped frame (keeping the sample rate and channels the same as the original... for the moment) - mapped_frame = GetOrCreateFrame(mapped.Odd.Frame); - - // Get # of channels in the actual frame - int channels_in_frame = mapped_frame->GetAudioChannelsCount(); - int samples_in_frame = Frame::GetSamplesPerFrame(frame_number + timeline_frame_offset, target, mapped_frame->SampleRate(), channels_in_frame); - - // Determine if mapped frame is identical to source frame - // including audio sample distribution according to mapped.Samples, - // and frame_number. In some cases such as end of stream, the reader - // will return a frame with a different frame number. In these cases, - // we cannot use the frame as is, nor can we modify the frame number, - // otherwise the reader's cache object internals become invalid. - if (info.sample_rate == mapped_frame->SampleRate() && - info.channels == mapped_frame->GetAudioChannelsCount() && - info.channel_layout == mapped_frame->ChannelsLayout() && - mapped.Samples.total == mapped_frame->GetAudioSamplesCount() && - mapped.Samples.frame_start == mapped.Odd.Frame && - mapped.Samples.sample_start == 0 && - mapped_frame->number == frame_number &&// in some conditions (e.g. end of stream) - info.fps.num == reader->info.fps.num && - info.fps.den == reader->info.fps.den) { - // Add original frame to cache, and skip the rest (for performance reasons) - final_cache.Add(mapped_frame); - continue; - } + // Get the mapped frame + MappedFrame mapped = GetMappedFrame(frame_number); + std::shared_ptr mapped_frame; + + // Get the mapped frame (keeping the sample rate and channels the same as the original... for the moment) + mapped_frame = GetOrCreateFrame(mapped.Odd.Frame); + + // Get # of channels in the actual frame + int channels_in_frame = mapped_frame->GetAudioChannelsCount(); + int samples_in_frame = Frame::GetSamplesPerFrame(frame_number + timeline_frame_offset, target, mapped_frame->SampleRate(), channels_in_frame); + + // Determine if mapped frame is identical to source frame + // including audio sample distribution according to mapped.Samples, + // and frame_number. In some cases such as end of stream, the reader + // will return a frame with a different frame number. In these cases, + // we cannot use the frame as is, nor can we modify the frame number, + // otherwise the reader's cache object internals become invalid. + if (info.sample_rate == mapped_frame->SampleRate() && + info.channels == mapped_frame->GetAudioChannelsCount() && + info.channel_layout == mapped_frame->ChannelsLayout() && + mapped.Samples.total == mapped_frame->GetAudioSamplesCount() && + mapped.Samples.frame_start == mapped.Odd.Frame && + mapped.Samples.sample_start == 0 && + mapped_frame->number == frame_number &&// in some conditions (e.g. end of stream) + info.fps.num == reader->info.fps.num && + info.fps.den == reader->info.fps.den) { + // Add original frame to cache, and skip the rest (for performance reasons) + final_cache.Add(mapped_frame); + continue; + } + + // Create a new frame + std::shared_ptr frame = std::make_shared(frame_number, 1, 1, "#000000", samples_in_frame, channels_in_frame); + frame->SampleRate(mapped_frame->SampleRate()); + frame->ChannelsLayout(mapped_frame->ChannelsLayout()); + + + // Copy the image from the odd field + std::shared_ptr odd_frame; + odd_frame = GetOrCreateFrame(mapped.Odd.Frame); + + if (odd_frame) + frame->AddImage(std::shared_ptr(new QImage(*odd_frame->GetImage())), true); + if (mapped.Odd.Frame != mapped.Even.Frame) { + // Add even lines (if different than the previous image) + std::shared_ptr even_frame; + even_frame = GetOrCreateFrame(mapped.Even.Frame); + if (even_frame) + frame->AddImage(std::shared_ptr(new QImage(*even_frame->GetImage())), false); + } - // Create a new frame - tr1::shared_ptr frame = tr1::shared_ptr(new Frame(frame_number, 1, 1, "#000000", samples_in_frame, channels_in_frame)); - frame->SampleRate(mapped_frame->SampleRate()); - frame->ChannelsLayout(mapped_frame->ChannelsLayout()); - - - // Copy the image from the odd field - tr1::shared_ptr odd_frame; - #pragma omp ordered - odd_frame = GetOrCreateFrame(mapped.Odd.Frame); - - if (odd_frame) - frame->AddImage(tr1::shared_ptr(new QImage(*odd_frame->GetImage())), true); - if (mapped.Odd.Frame != mapped.Even.Frame) { - // Add even lines (if different than the previous image) - tr1::shared_ptr even_frame; - #pragma omp ordered - even_frame = GetOrCreateFrame(mapped.Even.Frame); - if (even_frame) - frame->AddImage(tr1::shared_ptr(new QImage(*even_frame->GetImage())), false); - } - - // Resample audio on frame (if needed) - bool need_resampling = false; - if (info.has_audio && - (info.sample_rate != frame->SampleRate() || - info.channels != frame->GetAudioChannelsCount() || - info.channel_layout != frame->ChannelsLayout())) - // Resample audio and correct # of channels if needed - need_resampling = true; + // Resample audio on frame (if needed) + bool need_resampling = false; + if (info.has_audio && + (info.sample_rate != frame->SampleRate() || + info.channels != frame->GetAudioChannelsCount() || + info.channel_layout != frame->ChannelsLayout())) + // Resample audio and correct # of channels if needed + need_resampling = true; - // create a copy of mapped.Samples that will be used by copy loop - SampleRange copy_samples = mapped.Samples; + // create a copy of mapped.Samples that will be used by copy loop + SampleRange copy_samples = mapped.Samples; - if (need_resampling) + if (need_resampling) + { + // Resampling needed, modify copy of SampleRange object that + // includes some additional input samples on first iteration, + // and continues the offset to ensure that the sample rate + // converter isn't input limited. + const int EXTRA_INPUT_SAMPLES = 20; + + // Extend end sample count by an addtional EXTRA_INPUT_SAMPLES samples + copy_samples.sample_end += EXTRA_INPUT_SAMPLES; + int samples_per_end_frame = + Frame::GetSamplesPerFrame(copy_samples.frame_end, original, + reader->info.sample_rate, reader->info.channels); + if (copy_samples.sample_end >= samples_per_end_frame) { - // Resampling needed, modify copy of SampleRange object that - // includes some additional input samples on first iteration, - // and continues the offset to ensure that the sample rate - // converter isn't input limited. - const int EXTRA_INPUT_SAMPLES = 20; - - // Extend end sample count by an addtional EXTRA_INPUT_SAMPLES samples - copy_samples.sample_end += EXTRA_INPUT_SAMPLES; - int samples_per_end_frame = - Frame::GetSamplesPerFrame(copy_samples.frame_end, original, + // check for wrapping + copy_samples.frame_end++; + copy_samples.sample_end -= samples_per_end_frame; + } + copy_samples.total += EXTRA_INPUT_SAMPLES; + + if (avr) { + // Sample rate conversion has been allocated on this clip, so + // this is not the first iteration. Extend start position by + // EXTRA_INPUT_SAMPLES to keep step with previous frame + copy_samples.sample_start += EXTRA_INPUT_SAMPLES; + int samples_per_start_frame = + Frame::GetSamplesPerFrame(copy_samples.frame_start, original, reader->info.sample_rate, reader->info.channels); - if (copy_samples.sample_end >= samples_per_end_frame) + if (copy_samples.sample_start >= samples_per_start_frame) { // check for wrapping - copy_samples.frame_end++; - copy_samples.sample_end -= samples_per_end_frame; - } - copy_samples.total += EXTRA_INPUT_SAMPLES; - - if (avr) { - // Sample rate conversion has been allocated on this clip, so - // this is not the first iteration. Extend start position by - // EXTRA_INPUT_SAMPLES to keep step with previous frame - copy_samples.sample_start += EXTRA_INPUT_SAMPLES; - int samples_per_start_frame = - Frame::GetSamplesPerFrame(copy_samples.frame_start, original, - reader->info.sample_rate, reader->info.channels); - if (copy_samples.sample_start >= samples_per_start_frame) - { - // check for wrapping - copy_samples.frame_start++; - copy_samples.sample_start -= samples_per_start_frame; - } - copy_samples.total -= EXTRA_INPUT_SAMPLES; + copy_samples.frame_start++; + copy_samples.sample_start -= samples_per_start_frame; } + copy_samples.total -= EXTRA_INPUT_SAMPLES; } + } - // Copy the samples - int samples_copied = 0; - long int starting_frame = copy_samples.frame_start; - while (info.has_audio && samples_copied < copy_samples.total) + // Copy the samples + int samples_copied = 0; + long int starting_frame = copy_samples.frame_start; + while (info.has_audio && samples_copied < copy_samples.total) + { + // Init number of samples to copy this iteration + int remaining_samples = copy_samples.total - samples_copied; + int number_to_copy = 0; + + // number of original samples on this frame + std::shared_ptr original_frame = GetOrCreateFrame(starting_frame); + int original_samples = original_frame->GetAudioSamplesCount(); + + // Loop through each channel + for (int channel = 0; channel < channels_in_frame; channel++) { - // Init number of samples to copy this iteration - int remaining_samples = copy_samples.total - samples_copied; - int number_to_copy = 0; + if (starting_frame == copy_samples.frame_start) + { + // Starting frame (take the ending samples) + number_to_copy = original_samples - copy_samples.sample_start; + if (number_to_copy > remaining_samples) + number_to_copy = remaining_samples; - // Loop through each channel - for (int channel = 0; channel < channels_in_frame; channel++) + // Add samples to new frame + frame->AddAudio(true, channel, samples_copied, original_frame->GetAudioSamples(channel) + copy_samples.sample_start, number_to_copy, 1.0); + } + else if (starting_frame > copy_samples.frame_start && starting_frame < copy_samples.frame_end) { - // number of original samples on this frame - tr1::shared_ptr original_frame = GetOrCreateFrame(starting_frame); - int original_samples = original_frame->GetAudioSamplesCount(); - - if (starting_frame == copy_samples.frame_start) - { - // Starting frame (take the ending samples) - number_to_copy = original_samples - copy_samples.sample_start; - if (number_to_copy > remaining_samples) - number_to_copy = remaining_samples; - - // Add samples to new frame - frame->AddAudio(true, channel, samples_copied, original_frame->GetAudioSamples(channel) + copy_samples.sample_start, number_to_copy, 1.0); - } - else if (starting_frame > copy_samples.frame_start && starting_frame < copy_samples.frame_end) - { - // Middle frame (take all samples) - number_to_copy = original_samples; - if (number_to_copy > remaining_samples) - number_to_copy = remaining_samples; - - // Add samples to new frame - frame->AddAudio(true, channel, samples_copied, original_frame->GetAudioSamples(channel), number_to_copy, 1.0); - } - else - { - // Ending frame (take the beginning samples) - number_to_copy = copy_samples.sample_end + 1; - if (number_to_copy > remaining_samples) - number_to_copy = remaining_samples; - - // Add samples to new frame - frame->AddAudio(false, channel, samples_copied, original_frame->GetAudioSamples(channel), number_to_copy, 1.0); - } + // Middle frame (take all samples) + number_to_copy = original_samples; + if (number_to_copy > remaining_samples) + number_to_copy = remaining_samples; + + // Add samples to new frame + frame->AddAudio(true, channel, samples_copied, original_frame->GetAudioSamples(channel), number_to_copy, 1.0); } + else + { + // Ending frame (take the beginning samples) + number_to_copy = copy_samples.sample_end + 1; + if (number_to_copy > remaining_samples) + number_to_copy = remaining_samples; - // increment frame - samples_copied += number_to_copy; - starting_frame++; + // Add samples to new frame + frame->AddAudio(false, channel, samples_copied, original_frame->GetAudioSamples(channel), number_to_copy, 1.0); + } } - // Resample audio on frame (if needed) - if (need_resampling) - // Resample audio and correct # of channels if needed - ResampleMappedAudio(frame, mapped.Odd.Frame); + // increment frame + samples_copied += number_to_copy; + starting_frame++; + } + + // Resample audio on frame (if needed) + if (need_resampling) + // Resample audio and correct # of channels if needed + ResampleMappedAudio(frame, mapped.Odd.Frame); - // Add frame to final cache - final_cache.Add(frame); + // Add frame to final cache + final_cache.Add(frame); - } // for loop - } // omp parallel + } // for loop // Return processed openshot::Frame return final_cache.GetFrame(requested_frame); @@ -773,7 +763,7 @@ } // Resample audio and map channels (if needed) -void FrameMapper::ResampleMappedAudio(tr1::shared_ptr frame, long int original_frame_number) +void FrameMapper::ResampleMappedAudio(std::shared_ptr frame, long int original_frame_number) { // Init audio buffers / variables int total_frame_samples = 0; @@ -836,33 +826,29 @@ ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::ResampleMappedAudio (preparing for resample)", "in_sample_fmt", AV_SAMPLE_FMT_S16, "out_sample_fmt", AV_SAMPLE_FMT_S16, "in_sample_rate", sample_rate_in_frame, "out_sample_rate", info.sample_rate, "in_channels", channels_in_frame, "out_channels", info.channels); int nb_samples = 0; - // Force the audio resampling to happen in order (1st thread to last thread), so the waveform - // is smooth and continuous. - #pragma omp ordered - { - // setup resample context - if (!avr) { - avr = avresample_alloc_context(); - av_opt_set_int(avr, "in_channel_layout", channel_layout_in_frame, 0); - av_opt_set_int(avr, "out_channel_layout", info.channel_layout, 0); - av_opt_set_int(avr, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); - av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); - av_opt_set_int(avr, "in_sample_rate", sample_rate_in_frame, 0); - av_opt_set_int(avr, "out_sample_rate", info.sample_rate, 0); - av_opt_set_int(avr, "in_channels", channels_in_frame, 0); - av_opt_set_int(avr, "out_channels", info.channels, 0); - avresample_open(avr); - } - // Convert audio samples - nb_samples = avresample_convert(avr, // audio resample context - audio_converted->data, // output data pointers - audio_converted->linesize[0], // output plane size, in bytes. (0 if unknown) - audio_converted->nb_samples, // maximum number of samples that the output buffer can hold - audio_frame->data, // input data pointers - audio_frame->linesize[0], // input plane size, in bytes (0 if unknown) - audio_frame->nb_samples); // number of input samples to convert - } + // setup resample context + if (!avr) { + avr = avresample_alloc_context(); + av_opt_set_int(avr, "in_channel_layout", channel_layout_in_frame, 0); + av_opt_set_int(avr, "out_channel_layout", info.channel_layout, 0); + av_opt_set_int(avr, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0); + av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + av_opt_set_int(avr, "in_sample_rate", sample_rate_in_frame, 0); + av_opt_set_int(avr, "out_sample_rate", info.sample_rate, 0); + av_opt_set_int(avr, "in_channels", channels_in_frame, 0); + av_opt_set_int(avr, "out_channels", info.channels, 0); + avresample_open(avr); + } + + // Convert audio samples + nb_samples = avresample_convert(avr, // audio resample context + audio_converted->data, // output data pointers + audio_converted->linesize[0], // output plane size, in bytes. (0 if unknown) + audio_converted->nb_samples, // maximum number of samples that the output buffer can hold + audio_frame->data, // input data pointers + audio_frame->linesize[0], // input plane size, in bytes (0 if unknown) + audio_frame->nb_samples); // number of input samples to convert // Create a new array (to hold all resampled S16 audio samples) int16_t* resampled_samples = new int16_t[(nb_samples * info.channels)]; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ImageReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ImageReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ImageReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ImageReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -55,7 +55,7 @@ try { // load image - image = tr1::shared_ptr(new Magick::Image(path)); + image = std::shared_ptr(new Magick::Image(path)); // Give image a transparent background color image->backgroundColor(Magick::Color("none")); @@ -113,14 +113,14 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr ImageReader::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr ImageReader::GetFrame(long int requested_frame) throw(ReaderClosed) { // Check for open reader (or throw exception) if (!is_open) throw ReaderClosed("The FFmpegReader is closed. Call Open() before calling this method.", path); // Create or get frame object - tr1::shared_ptr image_frame(new Frame(requested_frame, image->size().width(), image->size().height(), "#000000", 0, 2)); + std::shared_ptr image_frame(new Frame(requested_frame, image->size().width(), image->size().height(), "#000000", 0, 2)); // Add Image data to frame image_frame->AddMagickImage(image); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ImageWriter.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ImageWriter.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/ImageWriter.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/ImageWriter.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -86,7 +86,7 @@ } // Add a frame to the queue waiting to be encoded. -void ImageWriter::WriteFrame(tr1::shared_ptr frame) throw(WriterClosed) +void ImageWriter::WriteFrame(std::shared_ptr frame) throw(WriterClosed) { // Check for open reader (or throw exception) if (!is_open) @@ -94,7 +94,7 @@ // Copy and resize image - tr1::shared_ptr frame_image = frame->GetMagickImage(); + std::shared_ptr frame_image = frame->GetMagickImage(); frame_image->magick( info.vcodec ); frame_image->backgroundColor(Magick::Color("none")); frame_image->matte(true); @@ -128,7 +128,7 @@ for (long int number = start; number <= length; number++) { // Get the frame - tr1::shared_ptr f = reader->GetFrame(number); + std::shared_ptr f = reader->GetFrame(number); // Encode frame WriteFrame(f); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/AudioPlaybackThread.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/AudioPlaybackThread.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/AudioPlaybackThread.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/AudioPlaybackThread.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -103,10 +103,10 @@ } // Get the current frame object (which is filling the buffer) - tr1::shared_ptr AudioPlaybackThread::getFrame() + std::shared_ptr AudioPlaybackThread::getFrame() { if (source) return source->getFrame(); - return tr1::shared_ptr(); + return std::shared_ptr(); } // Get the currently playing frame number diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/PlayerPrivate.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/PlayerPrivate.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/PlayerPrivate.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/PlayerPrivate.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -135,7 +135,7 @@ } // Get the next displayed frame (based on speed and direction) - tr1::shared_ptr PlayerPrivate::getFrame() + std::shared_ptr PlayerPrivate::getFrame() { try { // Get the next frame (based on speed) @@ -162,7 +162,7 @@ } catch (const OutOfBoundsFrame & e) { // ... } - return tr1::shared_ptr(); + return std::shared_ptr(); } // Start video/audio playback diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/VideoRenderer.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/VideoRenderer.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Qt/VideoRenderer.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Qt/VideoRenderer.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -45,7 +45,7 @@ } -void VideoRenderer::render(tr1::shared_ptr image) +void VideoRenderer::render(std::shared_ptr image) { if (image) emit present(*image); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/QtImageReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/QtImageReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/QtImageReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/QtImageReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -52,11 +52,11 @@ if (!is_open) { // Attempt to open file - image = tr1::shared_ptr(new QImage()); + image = std::shared_ptr(new QImage()); bool success = image->load(QString::fromStdString(path)); // Set pixel format - image = tr1::shared_ptr(new QImage(image->convertToFormat(QImage::Format_RGBA8888))); + image = std::shared_ptr(new QImage(image->convertToFormat(QImage::Format_RGBA8888))); if (!success) // raise exception @@ -111,23 +111,30 @@ } } +void QtImageReader::SetMaxSize(int width, int height) +{ + // Determine if we need to scale the image (for performance reasons) + // The timeline passes its size to the clips, which pass their size to the readers, and eventually here + // A max_width/max_height = 0 means do not scale (probably because we are scaling the image larger than 100%) + + // Remove cache that is no longer valid (if needed) + if (cached_image && (cached_image->width() != width && cached_image->height() != height)) + // Expire this cache + cached_image.reset(); + + max_width = width; + max_height = height; +} + // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr QtImageReader::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr QtImageReader::GetFrame(long int requested_frame) throw(ReaderClosed) { // Check for open reader (or throw exception) if (!is_open) throw ReaderClosed("The Image is closed. Call Open() before calling this method.", path); - // Determine if we need to scale the image (for performance reasons) - // The timeline passes its size to the clips, which pass their size to the readers, and eventually here - // A max_width/max_height = 0 means do not scale (probably because we are scaling the image larger than 100%) if (max_width != 0 && max_height != 0 && max_width < info.width && max_height < info.height) { - // Remove cache that is no longer valid (if needed) - if (cached_image && !(cached_image->width() == max_width || cached_image->height() == max_height)) - // Expire this cache - cached_image.reset(); - // Scale image smaller (or use a previous scaled image) if (!cached_image) { // Create a scoped lock, allowing only a single thread to run the following code at one time @@ -135,12 +142,12 @@ // We need to resize the original image to a smaller image (for performance reasons) // Only do this once, to prevent tons of unneeded scaling operations - cached_image = tr1::shared_ptr(new QImage(image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); - cached_image = tr1::shared_ptr(new QImage(cached_image->convertToFormat(QImage::Format_RGBA8888))); + cached_image = std::shared_ptr(new QImage(image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); + cached_image = std::shared_ptr(new QImage(cached_image->convertToFormat(QImage::Format_RGBA8888))); } // Create or get frame object - tr1::shared_ptr image_frame(new Frame(requested_frame, cached_image->width(), cached_image->height(), "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels)); + std::shared_ptr image_frame(new Frame(requested_frame, cached_image->width(), cached_image->height(), "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels)); // Add Image data to frame image_frame->AddImage(cached_image); @@ -151,7 +158,7 @@ } else { // Use original image (higher quality but slower) // Create or get frame object - tr1::shared_ptr image_frame(new Frame(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels)); + std::shared_ptr image_frame(new Frame(requested_frame, info.width, info.height, "#000000", Frame::GetSamplesPerFrame(requested_frame, info.fps, info.sample_rate, info.channels), info.channels)); // Add Image data to frame image_frame->AddImage(image); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/RendererBase.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/RendererBase.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/RendererBase.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/RendererBase.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -36,7 +36,7 @@ { } -void RendererBase::paint(const std::tr1::shared_ptr & frame) +void RendererBase::paint(const std::shared_ptr & frame) { if (frame) this->render(frame->GetImage()); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/TextReader.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/TextReader.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/TextReader.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/TextReader.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -52,7 +52,7 @@ if (!is_open) { // create image - image = tr1::shared_ptr(new Magick::Image(Magick::Geometry(width,height), Magick::Color(background_color))); + image = std::shared_ptr(new Magick::Image(Magick::Geometry(width,height), Magick::Color(background_color))); // Give image a transparent background color image->backgroundColor(Magick::Color("none")); @@ -143,15 +143,15 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr TextReader::GetFrame(long int requested_frame) throw(ReaderClosed) +std::shared_ptr TextReader::GetFrame(long int requested_frame) throw(ReaderClosed) { if (image) { // Create or get frame object - tr1::shared_ptr image_frame(new Frame(requested_frame, image->size().width(), image->size().height(), "#000000", 0, 2)); + std::shared_ptr image_frame(new Frame(requested_frame, image->size().width(), image->size().height(), "#000000", 0, 2)); // Add Image data to frame - tr1::shared_ptr copy_image(new Magick::Image(*image.get())); + std::shared_ptr copy_image(new Magick::Image(*image.get())); copy_image->modifyImage(); // actually copy the image data to this object //TODO: Reimplement this with QImage //image_frame->AddImage(copy_image); @@ -160,7 +160,7 @@ return image_frame; } else { // return empty frame - tr1::shared_ptr image_frame(new Frame(1, 640, 480, "#000000", 0, 2)); + std::shared_ptr image_frame(new Frame(1, 640, 480, "#000000", 0, 2)); // return frame object return image_frame; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Timeline.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Timeline.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/src/Timeline.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/src/Timeline.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -130,6 +130,11 @@ // Update timeline offset float time_diff = 0 - clip->Position() + clip->Start(); int clip_offset = -round(time_diff * info.fps.ToFloat()); + + if (clip_offset != 0) + // Reduce negative offset by 1 (since we want to avoid frame 0) + clip_offset += 1; + clip_mapped_reader->SetTimelineFrameOffset(clip_offset); // Update clip reader @@ -165,7 +170,7 @@ } // Apply effects to the source frame (if any) -tr1::shared_ptr Timeline::apply_effects(tr1::shared_ptr frame, long int timeline_frame_number, int layer) +std::shared_ptr Timeline::apply_effects(std::shared_ptr frame, long int timeline_frame_number, int layer) { // Debug output ZmqLogger::Instance()->AppendDebugMethod("Timeline::apply_effects", "frame->number", frame->number, "timeline_frame_number", timeline_frame_number, "layer", layer, "", -1, "", -1, "", -1); @@ -207,9 +212,9 @@ } // Get or generate a blank frame -tr1::shared_ptr Timeline::GetOrCreateFrame(Clip* clip, long int number) +std::shared_ptr Timeline::GetOrCreateFrame(Clip* clip, long int number) { - tr1::shared_ptr new_frame; + std::shared_ptr new_frame; // Init some basic properties about this frame int samples_in_frame = Frame::GetSamplesPerFrame(number, info.fps, info.sample_rate, info.channels); @@ -222,7 +227,7 @@ clip->SetMaxSize(info.width, info.height); // Attempt to get a frame (but this could fail if a reader has just been closed) - new_frame = tr1::shared_ptr(clip->GetFrame(number)); + new_frame = std::shared_ptr(clip->GetFrame(number)); // Return real frame return new_frame; @@ -239,17 +244,17 @@ ZmqLogger::Instance()->AppendDebugMethod("Timeline::GetOrCreateFrame (create blank)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1); // Create blank frame - new_frame = tr1::shared_ptr(new Frame(number, max_width, max_height, "#000000", samples_in_frame, info.channels)); + new_frame = std::make_shared(number, max_width, max_height, "#000000", samples_in_frame, info.channels); new_frame->SampleRate(info.sample_rate); new_frame->ChannelsLayout(info.channel_layout); return new_frame; } // Process a new layer of video or audio -void Timeline::add_layer(tr1::shared_ptr new_frame, Clip* source_clip, long int clip_frame_number, long int timeline_frame_number, bool is_top_clip) +void Timeline::add_layer(std::shared_ptr new_frame, Clip* source_clip, long int clip_frame_number, long int timeline_frame_number, bool is_top_clip) { // Get the clip's frame & image - tr1::shared_ptr source_frame = GetOrCreateFrame(source_clip, clip_frame_number); + std::shared_ptr source_frame = GetOrCreateFrame(source_clip, clip_frame_number); // No frame found... so bail if (!source_frame) @@ -271,8 +276,8 @@ int alpha = source_clip->wave_color.alpha.GetInt(clip_frame_number); // Generate Waveform Dynamically (the size of the timeline) - tr1::shared_ptr source_image = source_frame->GetWaveform(max_width, max_height, red, green, blue, alpha); - source_frame->AddImage(tr1::shared_ptr(source_image)); + std::shared_ptr source_image = source_frame->GetWaveform(max_width, max_height, red, green, blue, alpha); + source_frame->AddImage(std::shared_ptr(source_image)); } /* Apply effects to the source frame (if any). If multiple clips are overlapping, only process the @@ -281,7 +286,7 @@ source_frame = apply_effects(source_frame, timeline_frame_number, source_clip->Layer()); // Declare an image to hold the source frame's image - tr1::shared_ptr source_image; + std::shared_ptr source_image; /* COPY AUDIO - with correct volume */ if (source_clip->Reader()->info.has_audio) { @@ -375,7 +380,7 @@ { case (SCALE_FIT): // keep aspect ratio - source_image = tr1::shared_ptr(new QImage(source_image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); + source_image = std::shared_ptr(new QImage(source_image->scaled(max_width, max_height, Qt::KeepAspectRatio, Qt::SmoothTransformation))); source_width = source_image->width(); source_height = source_image->height(); @@ -385,7 +390,7 @@ case (SCALE_STRETCH): // ignore aspect ratio - source_image = tr1::shared_ptr(new QImage(source_image->scaled(max_width, max_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); + source_image = std::shared_ptr(new QImage(source_image->scaled(max_width, max_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation))); source_width = source_image->width(); source_height = source_image->height(); @@ -399,9 +404,9 @@ // respect aspect ratio if (width_size.width() >= max_width && width_size.height() >= max_height) - source_image = tr1::shared_ptr(new QImage(source_image->scaled(width_size.width(), width_size.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation))); + source_image = std::shared_ptr(new QImage(source_image->scaled(width_size.width(), width_size.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation))); else - source_image = tr1::shared_ptr(new QImage(source_image->scaled(height_size.width(), height_size.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation))); // height is larger, so resize to it + source_image = std::shared_ptr(new QImage(source_image->scaled(height_size.width(), height_size.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation))); // height is larger, so resize to it source_width = source_image->width(); source_height = source_image->height(); @@ -504,7 +509,7 @@ ZmqLogger::Instance()->AppendDebugMethod("Timeline::add_layer (Transform: Composite Image Layer: Prepare)", "source_frame->number", source_frame->number, "offset_x", offset_x, "offset_y", offset_y, "new_frame->GetImage()->width()", new_frame->GetImage()->width(), "transformed", transformed, "", -1); /* COMPOSITE SOURCE IMAGE (LAYER) ONTO FINAL IMAGE */ - tr1::shared_ptr new_image = new_frame->GetImage(); + std::shared_ptr new_image = new_frame->GetImage(); // Load timeline's new frame image into a QPainter QPainter painter(new_image.get()); @@ -629,14 +634,14 @@ } // Get an openshot::Frame object for a specific frame number of this reader. -tr1::shared_ptr Timeline::GetFrame(long int requested_frame) throw(ReaderClosed, OutOfBoundsFrame) +std::shared_ptr Timeline::GetFrame(long int requested_frame) throw(ReaderClosed, OutOfBoundsFrame) { // Adjust out of bounds frame number if (requested_frame < 1) requested_frame = 1; // Check cache - tr1::shared_ptr frame = final_cache->GetFrame(requested_frame); + std::shared_ptr frame = final_cache->GetFrame(requested_frame); if (frame) { // Debug output ZmqLogger::Instance()->AppendDebugMethod("Timeline::GetFrame (Cached frame found)", "requested_frame", requested_frame, "", -1, "", -1, "", -1, "", -1, "", -1); @@ -714,7 +719,7 @@ int samples_in_frame = Frame::GetSamplesPerFrame(frame_number, info.fps, info.sample_rate, info.channels); // Create blank frame (which will become the requested frame) - tr1::shared_ptr new_frame(tr1::shared_ptr(new Frame(frame_number, max_width, max_height, "#000000", samples_in_frame, info.channels))); + std::shared_ptr new_frame(std::make_shared(frame_number, max_width, max_height, "#000000", samples_in_frame, info.channels)); new_frame->AddAudioSilence(samples_in_frame); new_frame->SampleRate(info.sample_rate); new_frame->ChannelsLayout(info.channel_layout); @@ -1134,8 +1139,23 @@ long int old_ending_frame = ((existing_clip->Position() + existing_clip->Duration()) * info.fps.ToDouble()) + 1; final_cache->Remove(old_starting_frame - 8, old_ending_frame + 8); + // Remove cache on clip's Reader (if found) + if (existing_clip->Reader() && existing_clip->Reader()->GetCache()) + existing_clip->Reader()->GetCache()->Remove(old_starting_frame - 8, old_ending_frame + 8); + // Update clip properties from JSON existing_clip->SetJsonValue(change["value"]); + + // Clear any cached image sizes (since size might have changed) + existing_clip->SetMaxSize(0, 0); // force clearing of cached image size + if (existing_clip->Reader()) { + existing_clip->Reader()->SetMaxSize(0, 0); + if (existing_clip->Reader()->Name() == "FrameMapper") { + FrameMapper *nested_reader = (FrameMapper *) existing_clip->Reader(); + if (nested_reader->Reader()) + nested_reader->Reader()->SetMaxSize(0, 0); + } + } } } else if (change_type == "delete") { diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Cache_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Cache_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Cache_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Cache_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -41,7 +41,7 @@ for (int i = 0; i < 50; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; c.Add(f); } @@ -59,7 +59,7 @@ for (int i = 30; i > 0; i--) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame(i, 320, 240, "#000000")); + std::shared_ptr f(new Frame(i, 320, 240, "#000000")); f->AddColor(320, 240, "#000000"); c.Add(f); } @@ -71,7 +71,7 @@ for (int i = 10; i > 0; i--) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame(i, 320, 240, "#000000")); + std::shared_ptr f(new Frame(i, 320, 240, "#000000")); f->AddColor(320, 240, "#000000"); c.Add(f); } @@ -98,7 +98,7 @@ for (int i = 0; i < 10; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; c.Add(f); } @@ -122,7 +122,7 @@ for (int i = 0; i < 10; i++) { // Add blank frame to the cache (each frame is #1) - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); c.Add(f); } @@ -139,7 +139,7 @@ for (int i = 1; i < 6; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; c.Add(f); } @@ -165,9 +165,9 @@ Frame *green = new Frame(3, 500, 500, "green"); // Add frames to cache - c.Add(tr1::shared_ptr(red)); - c.Add(tr1::shared_ptr(blue)); - c.Add(tr1::shared_ptr(green)); + c.Add(std::shared_ptr(red)); + c.Add(std::shared_ptr(blue)); + c.Add(std::shared_ptr(green)); // Get frames CHECK_EQUAL(true, c.GetFrame(0) == NULL); @@ -190,9 +190,9 @@ Frame *green = new Frame(3, 500, 500, "green"); // Add frames to cache - c.Add(tr1::shared_ptr(red)); - c.Add(tr1::shared_ptr(blue)); - c.Add(tr1::shared_ptr(green)); + c.Add(std::shared_ptr(red)); + c.Add(std::shared_ptr(blue)); + c.Add(std::shared_ptr(green)); // Check if frame 1 is the front CHECK_EQUAL(1, c.GetSmallestFrame()->number); @@ -218,9 +218,9 @@ Frame *green = new Frame(3, 500, 500, "green"); // Add frames to cache - c.Add(tr1::shared_ptr(red)); - c.Add(tr1::shared_ptr(blue)); - c.Add(tr1::shared_ptr(green)); + c.Add(std::shared_ptr(red)); + c.Add(std::shared_ptr(blue)); + c.Add(std::shared_ptr(green)); // Check if count is 3 CHECK_EQUAL(3, c.Count()); @@ -256,7 +256,7 @@ for (int i = 0; i < 20; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; c.Add(f); } @@ -281,7 +281,7 @@ for (int i = 1; i <= 20; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; // Add some picture data f->AddColor(1280, 720, "Blue"); @@ -309,7 +309,7 @@ for (int i = 0; i < 20; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; // Add some picture data f->AddColor(1280, 720, "Blue"); @@ -329,7 +329,7 @@ CHECK_EQUAL(4 * 1024, c.GetMaxBytes()); // Read frames from disk cache - tr1::shared_ptr f = c.GetFrame(5); + std::shared_ptr f = c.GetFrame(5); CHECK_EQUAL(320, f->GetWidth()); CHECK_EQUAL(180, f->GetHeight()); CHECK_EQUAL(2, f->GetAudioChannelsCount()); @@ -360,7 +360,7 @@ for (int i = 1; i <= 20; i++) { // Add blank frame to the cache - tr1::shared_ptr f(new Frame()); + std::shared_ptr f(new Frame()); f->number = i; // Add some picture data f->AddColor(1280, 720, "Blue"); @@ -389,31 +389,31 @@ CacheDisk c("", "PPM", 1.0, 0.25); // Add some frames (out of order) - tr1::shared_ptr f3(new Frame(3, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f3(new Frame(3, 1280, 720, "Blue", 500, 2)); c.Add(f3); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("1", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f1(new Frame(1, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f1(new Frame(1, 1280, 720, "Blue", 500, 2)); c.Add(f1); CHECK_EQUAL(2, c.JsonValue()["ranges"].size()); CHECK_EQUAL("2", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f2(new Frame(2, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f2(new Frame(2, 1280, 720, "Blue", 500, 2)); c.Add(f2); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("3", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f5(new Frame(5, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f5(new Frame(5, 1280, 720, "Blue", 500, 2)); c.Add(f5); CHECK_EQUAL(2, c.JsonValue()["ranges"].size()); CHECK_EQUAL("4", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f4(new Frame(4, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f4(new Frame(4, 1280, 720, "Blue", 500, 2)); c.Add(f4); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("5", c.JsonValue()["version"].asString()); @@ -429,31 +429,31 @@ CacheMemory c; // Add some frames (out of order) - tr1::shared_ptr f3(new Frame(3, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f3(new Frame(3, 1280, 720, "Blue", 500, 2)); c.Add(f3); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("1", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f1(new Frame(1, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f1(new Frame(1, 1280, 720, "Blue", 500, 2)); c.Add(f1); CHECK_EQUAL(2, c.JsonValue()["ranges"].size()); CHECK_EQUAL("2", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f2(new Frame(2, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f2(new Frame(2, 1280, 720, "Blue", 500, 2)); c.Add(f2); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("3", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f5(new Frame(5, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f5(new Frame(5, 1280, 720, "Blue", 500, 2)); c.Add(f5); CHECK_EQUAL(2, c.JsonValue()["ranges"].size()); CHECK_EQUAL("4", c.JsonValue()["version"].asString()); // Add some frames (out of order) - tr1::shared_ptr f4(new Frame(4, 1280, 720, "Blue", 500, 2)); + std::shared_ptr f4(new Frame(4, 1280, 720, "Blue", 500, 2)); c.Add(f4); CHECK_EQUAL(1, c.JsonValue()["ranges"].size()); CHECK_EQUAL("5", c.JsonValue()["version"].asString()); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Clip_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Clip_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Clip_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Clip_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -214,7 +214,7 @@ c10.AddEffect(&n); // Get frame 1 - tr1::shared_ptr f = c10.GetFrame(500); + std::shared_ptr f = c10.GetFrame(500); // Get the image data const unsigned char* pixels = f->GetPixels(10); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/CMakeLists.txt libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/CMakeLists.txt --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/CMakeLists.txt 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/CMakeLists.txt 2017-09-08 04:16:46.000000000 +0000 @@ -31,7 +31,7 @@ IF (WIN32) STRING(REPLACE "/" "\\\\" TEST_MEDIA_PATH "${openshot_SOURCE_DIR}/src/examples/") add_definitions( -DIGNORE_JUCE_HYPOT=1 -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH}" ) - SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath -std=c++0x") + SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath") ENDIF(WIN32) ################### UNITTEST++ ##################### diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/FFmpegReader_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/FFmpegReader_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/FFmpegReader_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/FFmpegReader_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -58,7 +58,7 @@ r.Open(); // Get frame 1 - tr1::shared_ptr f = r.GetFrame(1); + std::shared_ptr f = r.GetFrame(1); // Get the number of channels and samples float *samples = f->GetAudioSamples(0); @@ -88,7 +88,7 @@ r.Open(); // Get frame 1 - tr1::shared_ptr f = r.GetFrame(1); + std::shared_ptr f = r.GetFrame(1); // Get the image data const unsigned char* pixels = f->GetPixels(10); @@ -126,7 +126,7 @@ r.Open(); // Get frame - tr1::shared_ptr f = r.GetFrame(1); + std::shared_ptr f = r.GetFrame(1); CHECK_EQUAL(1, f->number); // Get frame @@ -183,7 +183,7 @@ r.Open(); // Get frame that requires a seek - tr1::shared_ptr f = r.GetFrame(1200); + std::shared_ptr f = r.GetFrame(1200); CHECK_EQUAL(1200, f->number); // Close and Re-open the reader diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/FFmpegWriter_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/FFmpegWriter_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/FFmpegWriter_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/FFmpegWriter_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -66,7 +66,7 @@ CHECK_EQUAL(1, r1.info.fps.den); // Get a specific frame - tr1::shared_ptr f = r1.GetFrame(8); + std::shared_ptr f = r1.GetFrame(8); // Get the image data for row 500 const unsigned char* pixels = f->GetPixels(500); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/ImageWriter_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/ImageWriter_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/ImageWriter_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/ImageWriter_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -66,7 +66,7 @@ CHECK_EQUAL(r.info.height, r1.info.height); // Get a specific frame - tr1::shared_ptr f = r1.GetFrame(8); + std::shared_ptr f = r1.GetFrame(8); // Get the image data for row 500 const unsigned char* pixels = f->GetPixels(500); diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/ReaderBase_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/ReaderBase_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/ReaderBase_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/ReaderBase_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -41,7 +41,7 @@ public: TestReader() { }; CacheBase* GetCache() { return NULL; }; - tr1::shared_ptr GetFrame(long int number) { tr1::shared_ptr f(new Frame()); return f; } + std::shared_ptr GetFrame(long int number) { std::shared_ptr f(new Frame()); return f; } void Close() { }; void Open() { }; string Json() { }; diff -Nru libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Timeline_Tests.cpp libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Timeline_Tests.cpp --- libopenshot-0.1.7+0+601+114+201706010453+daily~ubuntu15.04.1/tests/Timeline_Tests.cpp 2017-06-01 04:53:32.000000000 +0000 +++ libopenshot-0.1.8+0+612+116+201709080416+daily~ubuntu15.04.1/tests/Timeline_Tests.cpp 2017-09-08 04:16:46.000000000 +0000 @@ -112,7 +112,7 @@ t.Open(); // Get frame - tr1::shared_ptr f = t.GetFrame(1); + std::shared_ptr f = t.GetFrame(1); // Get the image data int pixel_row = 200; @@ -435,7 +435,7 @@ t.Open(); // Get frame - tr1::shared_ptr f = t.GetFrame(1); + std::shared_ptr f = t.GetFrame(1); // Close reader t.Close();