13 #ifndef OPENSHOT_FRAME_H 14 #define OPENSHOT_FRAME_H 17 #define int64 opencv_broken_int 18 #define uint64 opencv_broken_uint 19 #include <opencv2/imgproc/imgproc.hpp> 43 class AudioBufferSource;
93 std::shared_ptr<QImage> image;
94 std::shared_ptr<QImage> wave_image;
96 std::shared_ptr<QApplication> previewApp;
97 std::recursive_mutex addingImageMutex;
98 std::recursive_mutex addingAudioMutex;
106 int64_t max_audio_sample;
114 int constrain(
int color_value);
117 std::shared_ptr<juce::AudioBuffer<float>>
audio;
127 Frame(int64_t number,
int width,
int height, std::string color);
130 Frame(int64_t number,
int samples,
int channels);
133 Frame(int64_t number,
int width,
int height, std::string color,
int samples,
int channels);
145 void AddColor(
int new_width,
int new_height, std::string new_color);
148 void AddColor(
const QColor& new_color);
151 void AddImage(
int new_width,
int new_height,
int bytes_per_pixel, QImage::Format type,
const unsigned char *pixels_);
154 void AddImage(std::shared_ptr<QImage> new_image);
157 void AddImage(std::shared_ptr<QImage> new_image,
bool only_odd_lines);
160 void AddAudio(
bool replaceSamples,
int destChannel,
int destStartSample,
const float* source,
int numSamples,
float gainToApplyToSource);
163 void AddAudioSilence(
int numSamples);
166 void ApplyGainRamp(
int destChannel,
int destStartSample,
int numSamples,
float initial_gain,
float final_gain);
176 void ClearWaveform();
179 void DeepCopy(
const Frame& other);
185 void DisplayWaveform();
188 float GetAudioSample(
int channel,
int sample,
int magnitude_range);
191 float* GetAudioSamples(
int channel);
194 float* GetInterleavedAudioSamples(
int* sample_count);
197 int GetAudioChannelsCount();
200 int GetAudioSamplesCount();
208 std::shared_ptr<QImage> GetImage();
214 const unsigned char* GetPixels();
217 const unsigned char* GetPixels(
int row);
220 bool CheckPixel(
int row,
int col,
int red,
int green,
int blue,
int alpha,
int threshold);
229 static int GetSamplesPerFrame(int64_t frame_number,
openshot::Fraction fps,
int sample_rate,
int channels);
232 std::shared_ptr<QImage> GetWaveform(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
235 const unsigned char* GetWaveformPixels(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
247 void SampleRate(
int orig_sample_rate) { sample_rate = orig_sample_rate; };
254 void Save(std::string
path,
float scale, std::string format=
"PNG",
int quality=100);
257 void SetFrameNumber(int64_t number);
260 void SetPixelRatio(
int num,
int den);
264 void Thumbnail(std::string path,
int new_width,
int new_height, std::string mask_path, std::string overlay_path,
265 std::string background_color,
bool ignore_aspect, std::string format=
"png",
int quality=100,
float rotate=0.0);
271 cv::Mat Qimage2mat( std::shared_ptr<QImage>& qimage);
275 std::shared_ptr<QImage> Mat2Qimage(cv::Mat img);
278 cv::Mat GetImageCV();
281 void SetImageCV(cv::Mat _image);
openshot::Fraction GetPixelRatio()
Set Pixel Aspect Ratio.
Header file for Fraction class.
This class represents a single frame of video (i.e. image & audio data)
int64_t number
This is the frame number (starting at 1)
bool has_audio_data
This frame has been loaded with audio data.
This class represents a fraction.
Header file for ChannelLayout class.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
void ChannelsLayout(openshot::ChannelLayout new_channel_layout)
This namespace is the default namespace for all code in the openshot library.
std::shared_ptr< juce::AudioBuffer< float > > audio
bool has_image_data
This frame has been loaded with pixel data.
void SampleRate(int orig_sample_rate)
Set the original sample rate of this frame's audio data.