~mbranton/libopenshot/alpha-channel-fix

« back to all changes in this revision

Viewing changes to include/ClipBase.h

  • Committer: Jonathan Thomas
  • Date: 2016-09-14 09:11:12 UTC
  • Revision ID: jonathan@openshot.org-20160914091112-mcxg747f4zniwscx
Added SetMaxSize for image optimizations in QImageReader and FFmpegReader, which lets the timeline pass down the max size to all clips and readers, so they can optionally optimize the size of images (especially useful for optimizing preview performance). Removed convoluted image scaling code in FFmpegReader, and replaced with simpler version. Also, fixed a few regressions from the new Caching code, primarily a crash when reaching the end of the last clip on the timeline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                float start; ///< The position in seconds to start playing (used to trim the beginning of a clip)
58
58
                float end; ///< The position in seconds to end playing (used to trim the ending of a clip)
59
59
                string previous_properties; ///< This string contains the previous JSON properties
 
60
                int max_width; ///< The maximum image width needed by this clip (used for optimizations)
 
61
                int max_height; ///< The maximium image height needed by this clip (used for optimizations)
60
62
 
61
63
                /// Generate JSON for a property
62
64
                Json::Value add_property_json(string name, float value, string type, string memo, bool contains_point, int number_of_points, float min_value, float max_value, InterpolationType intepolation, int closest_point_x, bool readonly);
66
68
 
67
69
        public:
68
70
 
 
71
                /// Constructor for the base clip
 
72
                ClipBase() { max_width = 0; max_height = 0; };
 
73
 
69
74
                // Compare a clip using the Position() property
70
75
                bool operator< ( ClipBase& a) { return (Position() < a.Position()); }
71
76
                bool operator<= ( ClipBase& a) { return (Position() <= a.Position()); }
87
92
                void Start(float value) { start = value; } ///< Set start position (in seconds) of clip (trim start of video)
88
93
                void End(float value) { end = value; } ///< Set end position (in seconds) of clip (trim end of video)
89
94
 
 
95
                /// Set Max Image Size (used for performance optimization)
 
96
                void SetMaxSize(int width, int height) { max_width = width; max_height = height;  };
 
97
 
90
98
                /// Get and Set JSON methods
91
99
                virtual string Json() = 0; ///< Generate JSON string of this object
92
100
                virtual void SetJson(string value) throw(InvalidJSON) = 0; ///< Load JSON string into this object