Big update! Updating all "long int" frame number types to int64_t, so all 3 OSes will produce the same depth and precision on frame numbers. Also removing variable bitrate support temporarily, since it causes more problems than it solves.

This commit is contained in:
Jonathan Thomas
2017-09-28 16:03:01 -05:00
parent db740765a1
commit c95db460d6
82 changed files with 479 additions and 471 deletions

View File

@@ -79,13 +79,13 @@ namespace openshot
/// @brief Set the next read position of this source
/// @param newPosition The sample # to start reading from
void setNextReadPosition (long long newPosition);
void setNextReadPosition (int64 newPosition);
/// Get the next read position of this source
long long getNextReadPosition() const;
int64 getNextReadPosition() const;
/// Get the total length (in samples) of this audio source
long long getTotalLength() const;
int64 getTotalLength() const;
/// Determines if this audio source should repeat when it reaches the end
bool isLooping() const;

View File

@@ -61,10 +61,10 @@ namespace openshot
int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
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
int64_t original_frame_number; /// The current frame to read from
int64_t frame_number; /// The current frame number
std::shared_ptr<Frame> frame; /// The current frame object that is being read
long int frame_position; /// The position of the current frame's buffer
int64_t 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
@@ -80,7 +80,7 @@ namespace openshot
/// @param audio_reader This reader provides constant samples from a ReaderBase derived class
/// @param starting_frame_number This is the frame number to start reading samples from the reader.
/// @param buffer_size The max number of samples to keep in the buffer at one time.
AudioReaderSource(ReaderBase *audio_reader, int64 starting_frame_number, int buffer_size);
AudioReaderSource(ReaderBase *audio_reader, int64_t starting_frame_number, int buffer_size);
/// Destructor
~AudioReaderSource();
@@ -97,13 +97,13 @@ namespace openshot
/// @brief Set the next read position of this source
/// @param newPosition The sample # to start reading from
void setNextReadPosition (long long newPosition);
void setNextReadPosition (int64 newPosition);
/// Get the next read position of this source
long long getNextReadPosition() const;
int64 getNextReadPosition() const;
/// Get the total length (in samples) of this audio source
long long getTotalLength() const;
int64 getTotalLength() const;
/// Determines if this audio source should repeat when it reaches the end
bool isLooping() const;
@@ -121,7 +121,7 @@ namespace openshot
std::shared_ptr<Frame> getFrame() const { return frame; }
/// Get the estimate frame that is playing at this moment
long int getEstimatedFrame() const { return long(estimated_frame); }
int64_t getEstimatedFrame() const { return int64_t(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; }
@@ -134,7 +134,7 @@ namespace openshot
ReaderBase* Reader() const { return reader; }
/// Seek to a specific frame
void Seek(int64 new_position) { frame_number = new_position; estimated_frame = new_position; }
void Seek(int64_t new_position) { frame_number = new_position; estimated_frame = new_position; }
};

View File

@@ -46,7 +46,7 @@ namespace openshot {
{
protected:
string cache_type; ///< This is a friendly type name of the derived cache instance
long long int max_bytes; ///< This is the max number of bytes to cache (0 = no limit)
int64_t max_bytes; ///< This is the max number of bytes to cache (0 = no limit)
/// Section lock for multiple threads
CriticalSection *cacheCriticalSection;
@@ -58,7 +58,7 @@ namespace openshot {
/// @brief Constructor that sets the max bytes to cache
/// @param max_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
CacheBase(long long int max_bytes);
CacheBase(int64_t max_bytes);
/// @brief Add a Frame to the cache
/// @param frame The openshot::Frame object needing to be cached.
@@ -68,33 +68,33 @@ namespace openshot {
virtual void Clear() = 0;
/// Count the frames in the queue
virtual long int Count() = 0;
virtual int64_t Count() = 0;
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
virtual std::shared_ptr<Frame> GetFrame(long int frame_number) = 0;
virtual std::shared_ptr<Frame> GetFrame(int64_t frame_number) = 0;
/// Gets the maximum bytes value
virtual long long int GetBytes() = 0;
virtual int64_t GetBytes() = 0;
/// Get the smallest frame number
virtual std::shared_ptr<Frame> GetSmallestFrame() = 0;
/// @brief Remove a specific frame
/// @param frame_number The frame number of the cached frame
virtual void Remove(long int frame_number) = 0;
virtual void Remove(int64_t frame_number) = 0;
/// @brief Remove a range of frames
/// @param start_frame_number The starting frame number of the cached frame
/// @param end_frame_number The ending frame number of the cached frame
virtual void Remove(long int start_frame_number, long int end_frame_number) = 0;
virtual void Remove(int64_t start_frame_number, int64_t end_frame_number) = 0;
/// Gets the maximum bytes value
long long int GetMaxBytes() { return max_bytes; };
int64_t GetMaxBytes() { return max_bytes; };
/// @brief Set maximum bytes to a different amount
/// @param number_of_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
void SetMaxBytes(long long int number_of_bytes) { max_bytes = number_of_bytes; };
void SetMaxBytes(int64_t number_of_bytes) { max_bytes = number_of_bytes; };
/// @brief Set maximum bytes to a different amount based on a ReaderInfo struct
/// @param number_of_frames The maximum number of frames to hold in cache
@@ -102,7 +102,7 @@ namespace openshot {
/// @param height The height of the frame's image
/// @param sample_rate The sample rate of the frame's audio data
/// @param channels The number of audio channels in the frame
void SetMaxBytesFromInfo(long int number_of_frames, int width, int height, int sample_rate, int channels);
void SetMaxBytesFromInfo(int64_t number_of_frames, int width, int height, int sample_rate, int channels);
/// Get and Set JSON methods
virtual string Json() = 0; ///< Generate JSON string of this object

View File

@@ -50,18 +50,18 @@ namespace openshot {
class CacheDisk : public CacheBase {
private:
QDir path; ///< This is the folder path of the cache directory
map<long int, long int> frames; ///< This map holds the frame number and Frame objects
deque<long int> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
map<int64_t, int64_t> frames; ///< This map holds the frame number and Frame objects
deque<int64_t> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
string image_format;
float image_quality;
float image_scale;
long long int frame_size_bytes; ///< The size of the cached frame in bytes
int64_t frame_size_bytes; ///< The size of the cached frame in bytes
bool needs_range_processing; ///< Something has changed, and the range data needs to be re-calculated
string json_ranges; ///< JSON ranges of frame numbers
vector<long int> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<long int, long int> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
long int range_version; ///< The version of the JSON range data (incremented with each change)
vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
int64_t range_version; ///< The version of the JSON range data (incremented with each change)
/// Clean up cached frames that exceed the max number of bytes
void CleanUp();
@@ -86,7 +86,7 @@ namespace openshot {
/// @param quality The quality of the image (1.0=highest quality/slowest speed, 0.0=worst quality/fastest speed)
/// @param scale The scale factor for the preview images (1.0 = original size, 0.5=half size, 0.25=quarter size, etc...)
/// @param max_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
CacheDisk(string cache_path, string format, float quality, float scale, long long int max_bytes);
CacheDisk(string cache_path, string format, float quality, float scale, int64_t max_bytes);
// Default destructor
~CacheDisk();
@@ -99,30 +99,30 @@ namespace openshot {
void Clear();
/// Count the frames in the queue
long int Count();
int64_t Count();
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
std::shared_ptr<Frame> GetFrame(long int frame_number);
std::shared_ptr<Frame> GetFrame(int64_t frame_number);
/// Gets the maximum bytes value
long long int GetBytes();
int64_t GetBytes();
/// Get the smallest frame number
std::shared_ptr<Frame> GetSmallestFrame();
/// @brief Move frame to front of queue (so it lasts longer)
/// @param frame_number The frame number of the cached frame
void MoveToFront(long int frame_number);
void MoveToFront(int64_t frame_number);
/// @brief Remove a specific frame
/// @param frame_number The frame number of the cached frame
void Remove(long int frame_number);
void Remove(int64_t frame_number);
/// @brief Remove a range of frames
/// @param start_frame_number The starting frame number of the cached frame
/// @param end_frame_number The ending frame number of the cached frame
void Remove(long int start_frame_number, long int end_frame_number);
void Remove(int64_t start_frame_number, int64_t end_frame_number);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object

View File

@@ -47,14 +47,14 @@ namespace openshot {
*/
class CacheMemory : public CacheBase {
private:
map<long int, std::shared_ptr<Frame> > frames; ///< This map holds the frame number and Frame objects
deque<long int> frame_numbers; ///< This queue holds a sequential list of cached Frame numbers
map<int64_t, std::shared_ptr<Frame> > frames; ///< This map holds the frame number and Frame objects
deque<int64_t> 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
string json_ranges; ///< JSON ranges of frame numbers
vector<long int> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<long int, long int> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
long int range_version; ///< The version of the JSON range data (incremented with each change)
vector<int64_t> ordered_frame_numbers; ///< Ordered list of frame numbers used by cache
map<int64_t, int64_t> frame_ranges; ///< This map holds the ranges of frames, useful for quickly displaying the contents of the cache
int64_t range_version; ///< The version of the JSON range data (incremented with each change)
/// Clean up cached frames that exceed the max number of bytes
void CleanUp();
@@ -68,7 +68,7 @@ namespace openshot {
/// @brief Constructor that sets the max bytes to cache
/// @param max_bytes The maximum bytes to allow in the cache. Once exceeded, the cache will purge the oldest frames.
CacheMemory(long long int max_bytes);
CacheMemory(int64_t max_bytes);
// Default destructor
~CacheMemory();
@@ -81,30 +81,30 @@ namespace openshot {
void Clear();
/// Count the frames in the queue
long int Count();
int64_t Count();
/// @brief Get a frame from the cache
/// @param frame_number The frame number of the cached frame
std::shared_ptr<Frame> GetFrame(long int frame_number);
std::shared_ptr<Frame> GetFrame(int64_t frame_number);
/// Gets the maximum bytes value
long long int GetBytes();
int64_t GetBytes();
/// Get the smallest frame number
std::shared_ptr<Frame> GetSmallestFrame();
/// @brief Move frame to front of queue (so it lasts longer)
/// @param frame_number The frame number of the cached frame
void MoveToFront(long int frame_number);
void MoveToFront(int64_t frame_number);
/// @brief Remove a specific frame
/// @param frame_number The frame number of the cached frame
void Remove(long int frame_number);
void Remove(int64_t frame_number);
/// @brief Remove a range of frames
/// @param start_frame_number The starting frame number of the cached frame
/// @param end_frame_number The ending frame number of the cached frame
void Remove(long int start_frame_number, long int end_frame_number);
void Remove(int64_t start_frame_number, int64_t end_frame_number);
/// Get and Set JSON methods
string Json(); ///< Generate JSON string of this object

View File

@@ -58,8 +58,8 @@ namespace openshot
*/
struct ChunkLocation
{
int number; ///< The chunk number
int frame; ///< The frame number
int64_t number; ///< The chunk number
int64_t frame; ///< The frame number
};
/**
@@ -106,7 +106,7 @@ namespace openshot
private:
string path;
bool is_open;
int chunk_size;
int64_t chunk_size;
FFmpegReader *local_reader;
ChunkLocation previous_location;
ChunkVersion version;
@@ -116,10 +116,10 @@ namespace openshot
bool does_folder_exist(string path);
/// Find the location of a frame in a chunk
ChunkLocation find_chunk_frame(long int requested_frame);
ChunkLocation find_chunk_frame(int64_t requested_frame);
/// get a formatted path of a specific chunk
string get_chunk_path(int chunk_number, string folder, string extension);
string get_chunk_path(int64_t chunk_number, string folder, string extension);
/// Load JSON meta data about this chunk folder
void load_json();
@@ -137,11 +137,11 @@ namespace openshot
/// @brief Get the chunk size (number of frames to write in each chunk)
/// @returns The number of frames in this chunk
int GetChunkSize() { return chunk_size; };
int64_t GetChunkSize() { return chunk_size; };
/// @brief Set the chunk size (number of frames to write in each chunk)
/// @param new_size The number of frames per chunk
void SetChunkSize(int new_size) { chunk_size = new_size; };
void SetChunkSize(int64_t new_size) { chunk_size = new_size; };
/// Get the cache object used by this reader (always return NULL for this reader)
CacheMemory* GetCache() { return NULL; };
@@ -149,7 +149,7 @@ namespace openshot
/// @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
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed, ChunkNotFound);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed, ChunkNotFound);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };

View File

@@ -81,9 +81,9 @@ namespace openshot
{
private:
string path;
int chunk_count;
int chunk_size;
int frame_count;
int64_t chunk_count;
int64_t chunk_size;
int64_t frame_count;
bool is_open;
bool is_writing;
ReaderBase *local_reader;
@@ -100,7 +100,7 @@ namespace openshot
void create_folder(string path);
/// get a formatted path of a specific chunk
string get_chunk_path(int chunk_number, string folder, string extension);
string get_chunk_path(int64_t chunk_number, string folder, string extension);
/// check for valid chunk json
bool is_chunk_valid();
@@ -119,7 +119,7 @@ namespace openshot
void Close();
/// Get the chunk size (number of frames to write in each chunk)
int GetChunkSize() { return chunk_size; };
int64_t GetChunkSize() { return chunk_size; };
/// Determine if writer is open or closed
bool IsOpen() { return is_open; };
@@ -129,7 +129,7 @@ namespace openshot
/// @brief Set the chunk size (number of frames to write in each chunk)
/// @param new_size The number of frames to write in this chunk file
void SetChunkSize(int new_size) { chunk_size = new_size; };
void SetChunkSize(int64_t new_size) { chunk_size = new_size; };
/// @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.
@@ -138,13 +138,13 @@ namespace openshot
/// @brief Write a block of frames from a reader
/// @param start The starting frame number to write (of the reader passed into the constructor)
/// @param length The number of frames to write (of the reader passed into the constructor)
void WriteFrame(int start, int length) throw(WriterClosed);
void WriteFrame(int64_t start, int64_t length) throw(WriterClosed);
/// @brief Write a block of frames from a reader
/// @param reader The reader containing the frames you need
/// @param start The starting frame number to write
/// @param length The number of frames to write
void WriteFrame(ReaderBase* reader, int start, int length) throw(WriterClosed);
void WriteFrame(ReaderBase* reader, int64_t start, int64_t length) throw(WriterClosed);
};

View File

@@ -124,7 +124,7 @@ namespace openshot {
bool manage_reader;
/// Adjust frame number minimum value
long int adjust_frame_number_minimum(long int frame_number);
int64_t adjust_frame_number_minimum(int64_t frame_number);
/// Apply effects to the source frame (if any)
std::shared_ptr<Frame> apply_effects(std::shared_ptr<Frame> frame);
@@ -133,10 +133,10 @@ namespace openshot {
string get_file_extension(string path);
/// Get a frame object or create a blank one
std::shared_ptr<Frame> GetOrCreateFrame(long int number);
std::shared_ptr<Frame> GetOrCreateFrame(int64_t number);
/// Adjust the audio and image of a time mapped frame
std::shared_ptr<Frame> get_time_mapped_frame(std::shared_ptr<Frame> frame, long int frame_number) throw(ReaderClosed);
std::shared_ptr<Frame> get_time_mapped_frame(std::shared_ptr<Frame> frame, int64_t frame_number) throw(ReaderClosed);
/// Init default settings for a clip
void init_settings();
@@ -181,7 +181,7 @@ namespace openshot {
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed);
/// Open the internal reader
void Open() throw(InvalidFile, ReaderClosed);
@@ -205,7 +205,7 @@ namespace openshot {
/// Get all properties for a specific frame (perfect for a UI to display the current state
/// of all properties at any time)
string PropertiesJSON(long int requested_frame);
string PropertiesJSON(int64_t requested_frame);
/// @brief Remove an effect from the clip
/// @param effect Remove an effect from the clip.

View File

@@ -62,7 +62,7 @@ namespace openshot {
int max_height; ///< The maximium image height needed by this clip (used for optimizations)
/// Generate JSON for a property
Json::Value add_property_json(string name, float value, string type, string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, long int requested_frame);
Json::Value add_property_json(string name, float value, string type, string memo, Keyframe* keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame);
/// Generate JSON choice for a property (dropdown properties)
Json::Value add_property_choice_json(string name, int value, int selected_value);
@@ -104,7 +104,7 @@ namespace openshot {
/// Get all properties for a specific frame (perfect for a UI to display the current state
/// of all properties at any time)
virtual string PropertiesJSON(long int requested_frame) = 0;
virtual string PropertiesJSON(int64_t requested_frame) = 0;
};

View File

@@ -60,7 +60,7 @@ namespace openshot {
Color(Keyframe Red, Keyframe Green, Keyframe Blue, Keyframe Alpha);
/// Get the HEX value of a color at a specific frame
string GetColorHex(long int frame_number);
string GetColorHex(int64_t frame_number);
/// Get the distance between 2 RGB pairs. (0=identical colors, 10=very close colors, 760=very different colors)
static long GetDistance(long R1, long G1, long B1, long R2, long G2, long B2);

View File

@@ -93,7 +93,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*);
// Extra methods
std::shared_ptr<openshot::Frame> GetFrame(long int requested_frame);
std::shared_ptr<openshot::Frame> GetFrame(int64_t requested_frame);
unsigned long GetCurrentFrameNumber();
private:

View File

@@ -107,7 +107,7 @@ namespace openshot
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed);
unsigned long GetCurrentFrameNumber();
/// Determine if reader is open or closed

View File

@@ -75,7 +75,7 @@ namespace openshot
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };

View File

@@ -84,7 +84,7 @@ namespace openshot
/// @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 std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, long int frame_number) = 0;
virtual std::shared_ptr<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t 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.

View File

@@ -57,10 +57,10 @@ namespace openshot {
{
public:
string file_path;
int frame_number;
int chunk_number;
int chunk_frame;
ChunkNotFound(string message, int frame_number, int chunk_number, int chunk_frame)
int64_t frame_number;
int64_t chunk_number;
int64_t chunk_frame;
ChunkNotFound(string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame)
: BaseException(message), frame_number(frame_number), chunk_number(chunk_number), chunk_frame(chunk_frame) { }
virtual ~ChunkNotFound() throw () {}
};
@@ -80,8 +80,8 @@ namespace openshot {
{
public:
string file_path;
int frame_number;
ErrorDecodingAudio(string message, int frame_number)
int64_t frame_number;
ErrorDecodingAudio(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorDecodingAudio() throw () {}
};
@@ -91,8 +91,8 @@ namespace openshot {
{
public:
string file_path;
int frame_number;
ErrorEncodingAudio(string message, int frame_number)
int64_t frame_number;
ErrorEncodingAudio(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingAudio() throw () {}
};
@@ -102,8 +102,8 @@ namespace openshot {
{
public:
string file_path;
int frame_number;
ErrorEncodingVideo(string message, int frame_number)
int64_t frame_number;
ErrorEncodingVideo(string message, int64_t frame_number)
: BaseException(message), frame_number(frame_number) { }
virtual ~ErrorEncodingVideo() throw () {}
};
@@ -202,9 +202,9 @@ namespace openshot {
class OutOfBoundsFrame : public BaseException
{
public:
int FrameRequested;
int MaxFrames;
OutOfBoundsFrame(string message, int frame_requested, int max_frames)
int64_t FrameRequested;
int64_t MaxFrames;
OutOfBoundsFrame(string message, int64_t frame_requested, int64_t max_frames)
: BaseException(message), FrameRequested(frame_requested), MaxFrames(max_frames) { }
virtual ~OutOfBoundsFrame() throw () {}
};

View File

@@ -58,9 +58,9 @@ namespace openshot
*/
struct AudioLocation
{
long int frame;
int64_t frame;
int sample_start;
bool is_near(AudioLocation location, int samples_per_frame, long int amount);
bool is_near(AudioLocation location, int samples_per_frame, int64_t amount);
};
/**
@@ -108,39 +108,39 @@ namespace openshot
CacheMemory working_cache;
CacheMemory missing_frames;
map<long int, long int> processing_video_frames;
multimap<long int, long int> processing_audio_frames;
map<long int, long int> processed_video_frames;
map<long int, long int> processed_audio_frames;
multimap<long int, long int> missing_video_frames;
multimap<long int, long int> missing_video_frames_source;
multimap<long int, long int> missing_audio_frames;
multimap<long int, long int> missing_audio_frames_source;
map<long int, int> checked_frames;
map<int64_t, int64_t> processing_video_frames;
multimap<int64_t, int64_t> processing_audio_frames;
map<int64_t, int64_t> processed_video_frames;
map<int64_t, int64_t> processed_audio_frames;
multimap<int64_t, int64_t> missing_video_frames;
multimap<int64_t, int64_t> missing_video_frames_source;
multimap<int64_t, int64_t> missing_audio_frames;
multimap<int64_t, int64_t> missing_audio_frames_source;
map<int64_t, int> checked_frames;
AudioLocation previous_packet_location;
// DEBUG VARIABLES (FOR AUDIO ISSUES)
int prev_samples;
long int prev_pts;
long int pts_total;
long int pts_counter;
long int num_packets_since_video_frame;
long int num_checks_since_final;
int64_t prev_pts;
int64_t pts_total;
int64_t pts_counter;
int64_t num_packets_since_video_frame;
int64_t num_checks_since_final;
std::shared_ptr<Frame> last_video_frame;
bool is_seeking;
long int seeking_pts;
long int seeking_frame;
int64_t seeking_pts;
int64_t seeking_frame;
bool is_video_seek;
int seek_count;
long int seek_audio_frame_found;
long int seek_video_frame_found;
int64_t seek_audio_frame_found;
int64_t seek_video_frame_found;
long int audio_pts_offset;
long int video_pts_offset;
long int last_frame;
long int largest_frame_processed;
long int current_video_frame; // can't reliably use PTS of video to determine this
int64_t audio_pts_offset;
int64_t video_pts_offset;
int64_t last_frame;
int64_t largest_frame_processed;
int64_t current_video_frame; // can't reliably use PTS of video to determine this
/// Check for the correct frames per second value by scanning the 1st few seconds of video packets.
void CheckFPS();
@@ -149,28 +149,28 @@ namespace openshot
bool CheckSeek(bool is_video);
/// Check if a frame is missing and attempt to replace it's frame image (and
bool CheckMissingFrame(long int requested_frame);
bool CheckMissingFrame(int64_t requested_frame);
/// Check the working queue, and move finished frames to the finished queue
void CheckWorkingFrames(bool end_of_stream, long int requested_frame);
void CheckWorkingFrames(bool end_of_stream, int64_t requested_frame);
/// Convert image to RGB format
void convert_image(long int current_frame, AVPicture *copyFrame, int width, int height, PixelFormat pix_fmt);
void convert_image(int64_t current_frame, AVPicture *copyFrame, int width, int height, PixelFormat pix_fmt);
/// Convert Frame Number into Audio PTS
long int ConvertFrameToAudioPTS(long int frame_number);
int64_t ConvertFrameToAudioPTS(int64_t frame_number);
/// Convert Frame Number into Video PTS
long int ConvertFrameToVideoPTS(long int frame_number);
int64_t ConvertFrameToVideoPTS(int64_t frame_number);
/// Convert Video PTS into Frame Number
long int ConvertVideoPTStoFrame(long int pts);
int64_t ConvertVideoPTStoFrame(int64_t pts);
/// Create a new Frame (or return an existing one) and add it to the working queue.
std::shared_ptr<Frame> CreateFrame(long int requested_frame);
std::shared_ptr<Frame> CreateFrame(int64_t requested_frame);
/// Calculate Starting video frame and sample # for an audio PTS
AudioLocation GetAudioPTSLocation(long int pts);
AudioLocation GetAudioPTSLocation(int64_t pts);
/// Get an AVFrame (if any)
bool GetAVFrame();
@@ -179,25 +179,25 @@ namespace openshot
int GetNextPacket();
/// Get the smallest video frame that is still being processed
long int GetSmallestVideoFrame();
int64_t GetSmallestVideoFrame();
/// Get the smallest audio frame that is still being processed
long int GetSmallestAudioFrame();
int64_t GetSmallestAudioFrame();
/// Get the PTS for the current video packet
long int GetVideoPTS();
int64_t GetVideoPTS();
/// Remove partial frames due to seek
bool IsPartialFrame(long int requested_frame);
bool IsPartialFrame(int64_t requested_frame);
/// Process a video packet
void ProcessVideoPacket(long int requested_frame);
void ProcessVideoPacket(int64_t requested_frame);
/// Process an audio packet
void ProcessAudioPacket(long int requested_frame, long int target_frame, int starting_sample);
void ProcessAudioPacket(int64_t requested_frame, int64_t target_frame, int starting_sample);
/// Read the stream until we find the requested Frame
std::shared_ptr<Frame> ReadStream(long int requested_frame);
std::shared_ptr<Frame> ReadStream(int64_t requested_frame);
/// Remove AVFrame from cache (and deallocate it's memory)
void RemoveAVFrame(AVPicture*);
@@ -206,7 +206,7 @@ namespace openshot
void RemoveAVPacket(AVPacket*);
/// Seek to a specific Frame. This is not always frame accurate, it's more of an estimation on many codecs.
void Seek(long int requested_frame) throw(TooManySeeks);
void Seek(int64_t requested_frame) throw(TooManySeeks);
/// Update PTS Offset (if any)
void UpdatePTSOffset(bool is_video);
@@ -247,7 +247,7 @@ namespace openshot
///
/// @returns The requested frame of video
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(OutOfBoundsFrame, ReaderClosed, TooManySeeks);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };

View File

@@ -147,8 +147,8 @@ namespace openshot
int cache_size;
bool is_writing;
bool is_open;
int64 write_video_count;
int64 write_audio_count;
int64_t write_video_count;
int64_t write_audio_count;
bool prepare_streams;
bool write_header;
@@ -322,7 +322,7 @@ namespace openshot
/// @param reader A openshot::ReaderBase object which will provide frames to be written
/// @param start The starting frame number of the reader
/// @param length The number of frames to write
void WriteFrame(ReaderBase* reader, long int start, long int length) throw(ErrorEncodingVideo, WriterClosed);
void WriteFrame(ReaderBase* reader, int64_t start, int64_t length) throw(ErrorEncodingVideo, WriterClosed);
/// @brief Write the file trailer (after all frames are written). This is called automatically
/// by the Close() method if this method has not yet been called.

View File

@@ -133,7 +133,7 @@ namespace openshot
int constrain(int color_value);
public:
long int number; ///< This is the frame number (starting at 1)
int64_t number; ///< This is the frame number (starting at 1)
bool has_audio_data; ///< This frame has been loaded with audio data
bool has_image_data; ///< This frame has been loaded with pixel data
@@ -141,13 +141,13 @@ namespace openshot
Frame();
/// Constructor - image only (48kHz audio silence)
Frame(long int number, int width, int height, string color);
Frame(int64_t number, int width, int height, string color);
/// Constructor - audio only (300x200 blank image)
Frame(long int number, int samples, int channels);
Frame(int64_t number, int samples, int channels);
/// Constructor - image & audio
Frame(long int number, int width, int height, string color, int samples, int channels);
Frame(int64_t number, int width, int height, string color, int samples, int channels);
/// Copy constructor
Frame ( const Frame &other );
@@ -227,7 +227,7 @@ namespace openshot
juce::AudioSampleBuffer *GetAudioSampleBuffer();
/// Get the size in bytes of this frame (rough estimate)
int64 GetBytes();
int64_t GetBytes();
/// Get pointer to Qt QImage image object
std::shared_ptr<QImage> GetImage();
@@ -253,7 +253,7 @@ namespace openshot
int GetSamplesPerFrame(Fraction fps, int sample_rate, int channels);
/// Calculate the # of samples per video frame (for a specific frame number and frame rate)
static int GetSamplesPerFrame(long int frame_number, Fraction fps, int sample_rate, int channels);
static int GetSamplesPerFrame(int64_t frame_number, Fraction fps, int sample_rate, int channels);
/// Get an audio waveform image
std::shared_ptr<QImage> GetWaveform(int width, int height, int Red, int Green, int Blue, int Alpha);
@@ -277,7 +277,7 @@ namespace openshot
void Save(string path, float scale, string format="PNG", int quality=100);
/// Set frame number
void SetFrameNumber(long int number);
void SetFrameNumber(int64_t number);
/// Set Pixel Aspect Ratio
void SetPixelRatio(int num, int den);

View File

@@ -72,12 +72,12 @@ namespace openshot
*/
struct Field
{
long int Frame;
int64_t Frame;
bool isOdd;
Field() : Frame(0), isOdd(true) { };
Field(long int frame, bool isodd)
Field(int64_t frame, bool isodd)
{
Frame = frame;
isOdd = isodd;
@@ -92,10 +92,10 @@ namespace openshot
*/
struct SampleRange
{
int frame_start;
int64_t frame_start;
int sample_start;
int frame_end;
int64_t frame_end;
int sample_end;
int total;
@@ -147,14 +147,14 @@ namespace openshot
CacheMemory final_cache; // Cache of actual Frame objects
bool is_dirty; // When this is true, the next call to GetFrame will re-init the mapping
AVAudioResampleContext *avr; // Audio resampling context object
long int timeline_frame_offset; // Timeline frame offset
int64_t timeline_frame_offset; // Timeline frame offset
// Internal methods used by init
void AddField(long int frame);
void AddField(int64_t frame);
void AddField(Field field);
// Get Frame or Generate Blank Frame
std::shared_ptr<Frame> GetOrCreateFrame(long int number);
std::shared_ptr<Frame> GetOrCreateFrame(int64_t 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.
@@ -177,13 +177,13 @@ namespace openshot
void ChangeMapping(Fraction target_fps, PulldownType pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout);
// Set offset relative to parent timeline
void SetTimelineFrameOffset(long int offset);
void SetTimelineFrameOffset(int64_t offset);
/// Close the openshot::FrameMapper and internal reader
void Close();
/// Get a frame based on the target frame rate and the new frame number of a frame
MappedFrame GetMappedFrame(long int TargetFrameNumber) throw(OutOfBoundsFrame);
MappedFrame GetMappedFrame(int64_t TargetFrameNumber) throw(OutOfBoundsFrame);
/// Get the cache object used by this reader
CacheMemory* GetCache() { return &final_cache; };
@@ -194,7 +194,7 @@ namespace openshot
///
/// @returns The requested frame of video
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed);
/// Determine if reader is open or closed
bool IsOpen();
@@ -218,7 +218,7 @@ namespace openshot
ReaderBase* Reader() throw(ReaderClosed);
/// Resample audio and map channels (if needed)
void ResampleMappedAudio(std::shared_ptr<Frame> frame, long int original_frame_number);
void ResampleMappedAudio(std::shared_ptr<Frame> frame, int64_t original_frame_number);
};
}

View File

@@ -93,7 +93,7 @@ namespace openshot
///
/// @returns The requested frame (containing the image)
/// @param requested_frame The frame number that is requested.
std::shared_ptr<Frame> GetFrame(long int requested_frame) throw(ReaderClosed);
std::shared_ptr<Frame> GetFrame(int64_t requested_frame) throw(ReaderClosed);
/// Determine if reader is open or closed
bool IsOpen() { return is_open; };

Some files were not shown because too many files have changed in this diff Show More