diff --git a/include/AudioReaderSource.h b/include/AudioReaderSource.h index 5510e84f..92fd6db4 100644 --- a/include/AudioReaderSource.h +++ b/include/AudioReaderSource.h @@ -64,7 +64,7 @@ namespace openshot 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 - int frame_position; /// The position of the current frame's buffer + 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 @@ -121,7 +121,7 @@ namespace openshot tr1::shared_ptr getFrame() const { return frame; } /// Get the estimate frame that is playing at this moment - int getEstimatedFrame() const { return int(estimated_frame); } + long int getEstimatedFrame() const { return long(estimated_frame); } /// Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) void setSpeed(int new_speed) { speed = new_speed; } diff --git a/include/Coordinate.h b/include/Coordinate.h index 2430120b..306d2a98 100644 --- a/include/Coordinate.h +++ b/include/Coordinate.h @@ -55,11 +55,11 @@ namespace openshot { private: bool increasing; ///< Is the Y value increasing or decreasing? Fraction repeated; ///< Fraction of repeated Y values (for example, 1/3 would be the first Y value of 3 repeated values) - float delta; ///< This difference in Y value (from the previous unique Y value) + double delta; ///< This difference in Y value (from the previous unique Y value) public: - float X; ///< The X value of the coordinate (usually representing the frame #) - float Y; ///< The Y value of the coordinate (usually representing the value of the property being animated) + double X; ///< The X value of the coordinate (usually representing the frame #) + double Y; ///< The Y value of the coordinate (usually representing the value of the property being animated) /// The default constructor, which defaults to (0,0) Coordinate(); @@ -67,7 +67,7 @@ namespace openshot { /// @brief Constructor which also sets the X and Y /// @param x The X coordinate (usually representing the frame #) /// @param y The Y coordinate (usually representing the value of the property being animated) - Coordinate(float x, float y); + Coordinate(double x, double y); /// @brief Set the repeating Fraction (used internally on the timeline, to track changes to coordinates) /// @param is_repeated The fraction representing how many times this coordinate Y value repeats (only used on the timeline) @@ -85,7 +85,7 @@ namespace openshot { /// @brief Set the delta / difference between previous coordinate value (used internally on the timeline, to track changes to coordinates) /// @param new_delta Indicates how much this Y value differs from the previous Y value - void Delta(float new_delta) { delta=new_delta; } + void Delta(double new_delta) { delta=new_delta; } /// Get the delta / difference between previous coordinate value (used internally on the timeline, to track changes to coordinates) float Delta() { return delta; } diff --git a/include/FFmpegReader.h b/include/FFmpegReader.h index 24f77013..1250a459 100644 --- a/include/FFmpegReader.h +++ b/include/FFmpegReader.h @@ -58,9 +58,9 @@ namespace openshot */ struct AudioLocation { - int frame; + long int frame; int sample_start; - int is_near(AudioLocation location, int samples_per_frame, int amount); + bool is_near(AudioLocation location, int samples_per_frame, long int amount); }; /** diff --git a/include/Frame.h b/include/Frame.h index ac9d483d..df050cb5 100644 --- a/include/Frame.h +++ b/include/Frame.h @@ -276,7 +276,7 @@ namespace openshot void Save(string path, float scale, string format="PNG", int quality=100); /// Set frame number - void SetFrameNumber(int number); + void SetFrameNumber(long int number); /// Set Pixel Aspect Ratio void SetPixelRatio(int num, int den); diff --git a/include/KeyFrame.h b/include/KeyFrame.h index 6ee68c31..4e66036f 100644 --- a/include/KeyFrame.h +++ b/include/KeyFrame.h @@ -96,16 +96,16 @@ namespace openshot { Keyframe(); /// Constructor which sets the default point & coordinate at X=0 - Keyframe(float value); + Keyframe(double value); /// Add a new point on the key-frame. Each point has a primary coordinate, a left handle, and a right handle. void AddPoint(Point p); /// Add a new point on the key-frame, with some defaults set (BEZIER) - void AddPoint(float x, float y); + void AddPoint(double x, double y); /// Add a new point on the key-frame, with a specific interpolation type - void AddPoint(float x, float y, InterpolationType interpolate); + void AddPoint(double x, double y, InterpolationType interpolate); /// Does this keyframe contain a specific point bool Contains(Point p); @@ -117,7 +117,7 @@ namespace openshot { long int FindIndex(Point p) throw(OutOfBoundsPoint); /// Get the value at a specific index - float GetValue(long int index); + double GetValue(long int index); /// Get the rounded INT value at a specific index int GetInt(long int index); @@ -129,7 +129,7 @@ namespace openshot { Fraction GetRepeatFraction(long int index); /// Get the change in Y value (from the previous Y value) - float GetDelta(long int index); + double GetDelta(long int index); /// Get a point at a specific index Point& GetPoint(long int index) throw(OutOfBoundsPoint); @@ -178,7 +178,7 @@ namespace openshot { /// Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe) /// 1.0 = same size, 1.05 = 5% increase, etc... - void ScalePoints(float scale); + void ScalePoints(double scale); /// Replace an existing point with a new point void UpdatePoint(long int index, Point p); diff --git a/include/PlayerBase.h b/include/PlayerBase.h index 733ebeee..01e7b148 100644 --- a/include/PlayerBase.h +++ b/include/PlayerBase.h @@ -81,7 +81,7 @@ namespace openshot virtual int Position() = 0; /// Seek to a specific frame in the player - virtual void Seek(int new_frame) = 0; + virtual void Seek(long int new_frame) = 0; /// Get the Playback speed virtual float Speed() = 0; diff --git a/include/Qt/AudioPlaybackThread.h b/include/Qt/AudioPlaybackThread.h index c73f99b4..37718b58 100644 --- a/include/Qt/AudioPlaybackThread.h +++ b/include/Qt/AudioPlaybackThread.h @@ -81,13 +81,13 @@ namespace openshot tr1::shared_ptr getFrame(); /// Get the current frame number being played - int getCurrentFramePosition(); + long int getCurrentFramePosition(); /// Play the audio void Play(); /// Seek the audio thread - void Seek(int new_position); + void Seek(long int new_position); /// Stop the audio playback void Stop(); diff --git a/include/Qt/PlayerPrivate.h b/include/Qt/PlayerPrivate.h index 3c6549d6..6a326849 100644 --- a/include/Qt/PlayerPrivate.h +++ b/include/Qt/PlayerPrivate.h @@ -47,15 +47,15 @@ namespace openshot class PlayerPrivate : Thread { tr1::shared_ptr frame; /// The current frame - int video_position; /// The current frame position. - int audio_position; /// The current frame position. + long int video_position; /// The current frame position. + long int audio_position; /// The current frame position. ReaderBase *reader; /// The reader which powers this player AudioPlaybackThread *audioPlayback; /// The audio thread VideoPlaybackThread *videoPlayback; /// The video thread VideoCacheThread *videoCache; /// The cache thread int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) RendererBase *renderer; - int last_video_position; /// The last frame actually displayed + long int last_video_position; /// The last frame actually displayed /// Constructor PlayerPrivate(RendererBase *rb); diff --git a/include/Qt/VideoCacheThread.h b/include/Qt/VideoCacheThread.h index d8fe5da3..e90d0fa7 100644 --- a/include/Qt/VideoCacheThread.h +++ b/include/Qt/VideoCacheThread.h @@ -45,8 +45,8 @@ namespace openshot std::tr1::shared_ptr frame; int speed; bool is_playing; - int position; - int current_display_frame; + long int position; + long int current_display_frame; ReaderBase *reader; int max_frames; @@ -56,7 +56,7 @@ namespace openshot ~VideoCacheThread(); /// Get the currently playing frame number (if any) - int getCurrentFramePosition(); + long int getCurrentFramePosition(); /// Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) int getSpeed() const { return speed; } @@ -65,10 +65,10 @@ namespace openshot void Play(); /// Seek the reader to a particular frame number - void Seek(int new_position); + void Seek(long int new_position); /// Set the currently displaying frame number - void setCurrentFramePosition(int current_frame_number); + void setCurrentFramePosition(long int current_frame_number); /// Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...) void setSpeed(int new_speed) { speed = new_speed; } diff --git a/include/Qt/VideoPlaybackThread.h b/include/Qt/VideoPlaybackThread.h index 5160cd70..86f6a598 100644 --- a/include/Qt/VideoPlaybackThread.h +++ b/include/Qt/VideoPlaybackThread.h @@ -54,7 +54,7 @@ namespace openshot ~VideoPlaybackThread(); /// Get the currently playing frame number (if any) - int getCurrentFramePosition(); + long int getCurrentFramePosition(); /// Start the thread void run(); diff --git a/include/QtPlayer.h b/include/QtPlayer.h index 0d29b7fe..457b1613 100644 --- a/include/QtPlayer.h +++ b/include/QtPlayer.h @@ -72,7 +72,7 @@ namespace openshot int Position(); /// Seek to a specific frame in the player - void Seek(int new_frame); + void Seek(long int new_frame); /// Set the source URL/path of this player (which will create an internal Reader) void SetSource(const std::string &source); diff --git a/src/Coordinate.cpp b/src/Coordinate.cpp index 0d5528c2..c73e0fab 100644 --- a/src/Coordinate.cpp +++ b/src/Coordinate.cpp @@ -36,7 +36,7 @@ Coordinate::Coordinate() : } // Constructor which also allows the user to set the X and Y -Coordinate::Coordinate(float x, float y) : +Coordinate::Coordinate(double x, double y) : X(x), Y(y), increasing(true), repeated(1,1), delta(0.0) { } diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 7ef5b191..1e816265 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -83,7 +83,7 @@ FFmpegReader::~FFmpegReader() { } // This struct holds the associated video frame and starting sample # for an audio packet. -int AudioLocation::is_near(AudioLocation location, int samples_per_frame, int amount) +bool AudioLocation::is_near(AudioLocation location, int samples_per_frame, long int amount) { // Is frame even close to this one? if (abs(location.frame - frame) >= 2) @@ -92,7 +92,7 @@ int AudioLocation::is_near(AudioLocation location, int samples_per_frame, int am // Note that samples_per_frame can vary slightly frame to frame when the // audio sampling rate is not an integer multiple of the video fps. - int diff = samples_per_frame * (location.frame - frame) + location.sample_start - sample_start; + long int diff = samples_per_frame * (location.frame - frame) + location.sample_start - sample_start; if (abs(diff) <= amount) // close return true; @@ -937,9 +937,9 @@ void FFmpegReader::ProcessAudioPacket(long int requested_frame, long int target_ int pts_remaining_samples = packet_samples / info.channels; // Adjust for zero based array // DEBUG (FOR AUDIO ISSUES) - Get the audio packet start time (in seconds) - int adjusted_pts = packet->pts + audio_pts_offset; + long int adjusted_pts = packet->pts + audio_pts_offset; double audio_seconds = double(adjusted_pts) * info.audio_timebase.ToDouble(); - double sample_seconds = float(pts_total) / info.sample_rate; + double sample_seconds = double(pts_total) / info.sample_rate; // Debug output ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ProcessAudioPacket (Decode Info A)", "pts_counter", pts_counter, "PTS", adjusted_pts, "Offset", audio_pts_offset, "PTS Diff", adjusted_pts - prev_pts, "Samples", pts_remaining_samples, "Sample PTS ratio", float(adjusted_pts - prev_pts) / pts_remaining_samples); @@ -1042,7 +1042,7 @@ void FFmpegReader::ProcessAudioPacket(long int requested_frame, long int target_ av_free(audio_converted->data[0]); AV_FREE_FRAME(&audio_converted); - int starting_frame_number = -1; + long int starting_frame_number = -1; bool partial_frame = true; for (int channel_filter = 0; channel_filter < info.channels; channel_filter++) { @@ -1323,7 +1323,7 @@ void FFmpegReader::Seek(long int requested_frame) throw(TooManySeeks) // Get the PTS for the current video packet long int FFmpegReader::GetVideoPTS() { - int current_pts = 0; + long int current_pts = 0; if(packet->dts != AV_NOPTS_VALUE) current_pts = packet->dts; @@ -1445,7 +1445,7 @@ AudioLocation FFmpegReader::GetAudioPTSLocation(long int pts) double frame = (audio_seconds * info.fps.ToDouble()) + 1; // Frame # as a whole number (no more decimals) - int whole_frame = int(frame); + long int whole_frame = long(frame); // Remove the whole number, and only get the decimal of the frame double sample_start_percentage = frame - double(whole_frame); @@ -1469,7 +1469,7 @@ AudioLocation FFmpegReader::GetAudioPTSLocation(long int pts) if (previous_packet_location.frame != -1) { if (location.is_near(previous_packet_location, samples_per_frame, samples_per_frame)) { - int orig_frame = location.frame; + long int orig_frame = location.frame; int orig_start = location.sample_start; // Update sample start, to prevent gaps in audio @@ -1882,7 +1882,7 @@ long int FFmpegReader::GetSmallestVideoFrame() { // Loop through frame numbers map::iterator itr; - int smallest_frame = -1; + long int smallest_frame = -1; for(itr = processing_video_frames.begin(); itr != processing_video_frames.end(); ++itr) { if (itr->first < smallest_frame || smallest_frame == -1) @@ -1898,7 +1898,7 @@ long int FFmpegReader::GetSmallestAudioFrame() { // Loop through frame numbers map::iterator itr; - int smallest_frame = -1; + long int smallest_frame = -1; const GenericScopedLock lock(processingCriticalSection); for(itr = processing_audio_frames.begin(); itr != processing_audio_frames.end(); ++itr) { diff --git a/src/Fraction.cpp b/src/Fraction.cpp index 33d066f0..2d9c449c 100644 --- a/src/Fraction.cpp +++ b/src/Fraction.cpp @@ -49,7 +49,7 @@ double Fraction::ToDouble() { // Return a rounded integer of the frame rate (for example 30000/1001 returns 30 fps) int Fraction::ToInt() { - return round((float) num / den); + return round((double) num / den); } // Calculate the greatest common denominator diff --git a/src/Frame.cpp b/src/Frame.cpp index a1200b9b..18103ea7 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -466,7 +466,7 @@ void Frame::SetPixelRatio(int num, int den) } // Set frame number -void Frame::SetFrameNumber(int new_number) +void Frame::SetFrameNumber(long int new_number) { number = new_number; } diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index fcf90eb9..76c6a1e3 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -219,7 +219,7 @@ void FrameMapper::Init() Field Even(0, true); // temp field used to track the EVEN field // Variables used to remap audio samples - int start_samples_frame = 1; + long int start_samples_frame = 1; int start_samples_position = 0; for (long int field = 1; field <= fields.size(); field++) @@ -242,7 +242,7 @@ void FrameMapper::Init() // Determine the range of samples (from the original rate). Resampling happens in real-time when // calling the GetFrame() method. So this method only needs to redistribute the original samples with // the original sample rate. - int end_samples_frame = start_samples_frame; + long int end_samples_frame = start_samples_frame; int end_samples_position = start_samples_position; int remaining_samples = Frame::GetSamplesPerFrame(frame_number, target, reader->info.sample_rate, reader->info.channels); @@ -515,7 +515,7 @@ tr1::shared_ptr FrameMapper::GetFrame(long int requested_frame) throw(Rea // Copy the samples int samples_copied = 0; - int starting_frame = copy_samples.frame_start; + 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 diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 6c0c8178..c87d7e53 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -53,7 +53,7 @@ void Keyframe::ReorderPoints() { } // Constructor which sets the default point & coordinate at X=0 -Keyframe::Keyframe(float value) : needs_update(true) { +Keyframe::Keyframe(double value) : needs_update(true) { // Init the factorial table, needed by bezier curves CreateFactorialTable(); @@ -87,7 +87,7 @@ void Keyframe::AddPoint(Point p) { } // Add a new point on the key-frame, with some defaults set (BEZIER) -void Keyframe::AddPoint(float x, float y) +void Keyframe::AddPoint(double x, double y) { // Create a point Point new_point(x, y, BEZIER); @@ -97,7 +97,7 @@ void Keyframe::AddPoint(float x, float y) } // Add a new point on the key-frame, with a specific interpolation type -void Keyframe::AddPoint(float x, float y, InterpolationType interpolate) +void Keyframe::AddPoint(double x, double y, InterpolationType interpolate) { // Create a point Point new_point(x, y, interpolate); @@ -223,7 +223,7 @@ Point Keyframe::GetMaxPoint() { } // Get the value at a specific index -float Keyframe::GetValue(long int index) +double Keyframe::GetValue(long int index) { // Check if it needs to be processed if (needs_update) @@ -407,7 +407,7 @@ Fraction Keyframe::GetRepeatFraction(long int index) } // Get the change in Y value (from the previous Y value) -float Keyframe::GetDelta(long int index) +double Keyframe::GetDelta(long int index) { // Check if it needs to be processed if (needs_update) @@ -653,13 +653,13 @@ void Keyframe::ProcessSegment(int Segment, Point p1, Point p2) { // creating a straight line with coordinates. case LINEAR: { // Get the difference in value - float current_value = p1.co.Y; - float value_difference = p2.co.Y - p1.co.Y; - float value_increment = 0.0f; + double current_value = p1.co.Y; + double value_difference = p2.co.Y - p1.co.Y; + double value_increment = 0.0f; // Get the increment value, but take into account the // first segment has 1 extra value - value_increment = value_difference / (float) (number_of_values); + value_increment = value_difference / (double) (number_of_values); if (Segment == 0) // Add an extra value to the first segment @@ -690,8 +690,8 @@ void Keyframe::ProcessSegment(int Segment, Point p1, Point p2) { number_of_values *= 4; // We need a higher resolution curve (4X) // Diff between points - float X_diff = p2.co.X - p1.co.X; - float Y_diff = p2.co.Y - p1.co.Y; + double X_diff = p2.co.X - p1.co.X; + double Y_diff = p2.co.Y - p1.co.Y; vector segment_coordinates; segment_coordinates.push_back(p1.co); @@ -717,8 +717,8 @@ void Keyframe::ProcessSegment(int Segment, Point p1, Point p2) { jcount = 0; - float new_x = 0.0f; - float new_y = 0.0f; + double new_x = 0.0f; + double new_y = 0.0f; for (long int i = 0; i < npts; i++) { Coordinate co = segment_coordinates[i]; @@ -741,7 +741,7 @@ void Keyframe::ProcessSegment(int Segment, Point p1, Point p2) { // Loop through the raw coordinates, and map them correctly to frame numbers. For example, // we can't have duplicate X values, since X represents our frame numbers. long int current_frame = p1.co.X; - float current_value = p1.co.Y; + double current_value = p1.co.Y; for (long int i = 0; i < raw_coordinates.size(); i++) { // Get the raw coordinate @@ -855,7 +855,7 @@ double Keyframe::Bernstein(long int n, long int i, double t) { // Scale all points by a percentage (good for evenly lengthening or shortening an openshot::Keyframe) // 1.0 = same size, 1.05 = 5% increase, etc... -void Keyframe::ScalePoints(float scale) +void Keyframe::ScalePoints(double scale) { // Loop through each point (skipping the 1st point) for (long int point_index = 0; point_index < Points.size(); point_index++) { diff --git a/src/Qt/AudioPlaybackThread.cpp b/src/Qt/AudioPlaybackThread.cpp index 689b4ef7..2b4da093 100644 --- a/src/Qt/AudioPlaybackThread.cpp +++ b/src/Qt/AudioPlaybackThread.cpp @@ -80,13 +80,13 @@ namespace openshot } // Get the currently playing frame number - int AudioPlaybackThread::getCurrentFramePosition() + long int AudioPlaybackThread::getCurrentFramePosition() { return source ? source->getEstimatedFrame() : 0; } // Seek the audio thread - void AudioPlaybackThread::Seek(int new_position) + void AudioPlaybackThread::Seek(long int new_position) { source->Seek(new_position); } diff --git a/src/Qt/PlayerPrivate.cpp b/src/Qt/PlayerPrivate.cpp index b66b4227..ad742437 100644 --- a/src/Qt/PlayerPrivate.cpp +++ b/src/Qt/PlayerPrivate.cpp @@ -90,7 +90,7 @@ namespace openshot last_video_position = video_position; // How many frames ahead or behind is the video thread? - int video_frame_diff = 0; + long int video_frame_diff = 0; if (reader->info.has_audio && reader->info.has_video) { if (speed != 1) // Set audio frame again (since we are not in normal speed, and not paused) diff --git a/src/Qt/VideoCacheThread.cpp b/src/Qt/VideoCacheThread.cpp index 46d81ed8..896d40a8 100644 --- a/src/Qt/VideoCacheThread.cpp +++ b/src/Qt/VideoCacheThread.cpp @@ -42,7 +42,7 @@ namespace openshot } // Get the currently playing frame number (if any) - int VideoCacheThread::getCurrentFramePosition() + long int VideoCacheThread::getCurrentFramePosition() { if (frame) return frame->number; @@ -51,13 +51,13 @@ namespace openshot } // Set the currently playing frame number (if any) - void VideoCacheThread::setCurrentFramePosition(int current_frame_number) + void VideoCacheThread::setCurrentFramePosition(long int current_frame_number) { current_display_frame = current_frame_number; } // Seek the reader to a particular frame number - void VideoCacheThread::Seek(int new_position) + void VideoCacheThread::Seek(long int new_position) { position = new_position; } diff --git a/src/Qt/VideoPlaybackThread.cpp b/src/Qt/VideoPlaybackThread.cpp index 0e6d0e55..2ab3cbf1 100644 --- a/src/Qt/VideoPlaybackThread.cpp +++ b/src/Qt/VideoPlaybackThread.cpp @@ -43,7 +43,7 @@ namespace openshot } // Get the currently playing frame number (if any) - int VideoPlaybackThread::getCurrentFramePosition() + long int VideoPlaybackThread::getCurrentFramePosition() { if (frame) return frame->number; diff --git a/src/QtPlayer.cpp b/src/QtPlayer.cpp index fa7f8b87..23e2fae0 100644 --- a/src/QtPlayer.cpp +++ b/src/QtPlayer.cpp @@ -108,7 +108,7 @@ int QtPlayer::Position() return p->video_position; } -void QtPlayer::Seek(int new_frame) +void QtPlayer::Seek(long int new_frame) { // Check for seek if (new_frame > 0) {