28 #ifndef OPENSHOT_FRAME_H 29 #define OPENSHOT_FRAME_H 32 #ifndef __JUCE_UNITTEST_JUCEHEADER__ 33 #define __JUCE_UNITTEST_JUCEHEADER__ 43 #include <QtWidgets/QApplication> 44 #include <QtGui/QImage> 45 #include <QtGui/QColor> 46 #include <QtGui/QBitmap> 47 #include <QtCore/QString> 48 #include <QtCore/QVector> 49 #include <QtGui/QPainter> 50 #include <QtWidgets/QHBoxLayout> 51 #include <QtWidgets/QWidget> 52 #include <QtWidgets/QLabel> 56 #ifdef USE_IMAGEMAGICK 59 #include "JuceLibraryCode/JuceHeader.h" 118 std::shared_ptr<QImage> image;
119 std::shared_ptr<QImage> wave_image;
120 std::shared_ptr<juce::AudioSampleBuffer> audio;
121 std::shared_ptr<QApplication> previewApp;
122 CriticalSection addingImageSection;
123 CriticalSection addingAudioSection;
124 const unsigned char *qbuffer;
133 int constrain(
int color_value);
144 Frame(
long int number,
int width,
int height,
string color);
147 Frame(
long int number,
int samples,
int channels);
150 Frame(
long int number,
int width,
int height,
string color,
int samples,
int channels);
162 void AddColor(
int new_width,
int new_height,
string color);
165 void AddImage(
int new_width,
int new_height,
int bytes_per_pixel, QImage::Format type,
const unsigned char *pixels_);
168 void AddImage(std::shared_ptr<QImage> new_image);
171 void AddImage(std::shared_ptr<QImage> new_image,
bool only_odd_lines);
173 #ifdef USE_IMAGEMAGICK 175 void AddMagickImage(std::shared_ptr<Magick::Image> new_image);
179 void AddAudio(
bool replaceSamples,
int destChannel,
int destStartSample,
const float* source,
int numSamples,
float gainToApplyToSource);
182 void AddAudioSilence(
int numSamples);
185 void ApplyGainRamp(
int destChannel,
int destStartSample,
int numSamples,
float initial_gain,
float final_gain);
195 static void cleanUpBuffer(
void *info);
198 void ClearWaveform();
201 void DeepCopy(
const Frame& other);
207 void DisplayWaveform();
210 float GetAudioSample(
int channel,
int sample,
int magnitude_range);
213 float* GetAudioSamples(
int channel);
216 float* GetInterleavedAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
219 float* GetPlanarAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
222 int GetAudioChannelsCount();
225 int GetAudioSamplesCount();
227 juce::AudioSampleBuffer *GetAudioSampleBuffer();
233 std::shared_ptr<QImage> GetImage();
235 #ifdef USE_IMAGEMAGICK 237 std::shared_ptr<Magick::Image> GetMagickImage();
244 const unsigned char* GetPixels();
247 const unsigned char* GetPixels(
int row);
253 int GetSamplesPerFrame(
Fraction fps,
int sample_rate,
int channels);
256 static int GetSamplesPerFrame(
long int frame_number,
Fraction fps,
int sample_rate,
int channels);
259 std::shared_ptr<QImage> GetWaveform(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
262 const unsigned char* GetWaveformPixels(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
268 void ResizeAudio(
int channels,
int length,
int sample_rate,
ChannelLayout channel_layout);
274 void SampleRate(
int orig_sample_rate) { sample_rate = orig_sample_rate; };
277 void Save(
string path,
float scale,
string format=
"PNG",
int quality=100);
280 void SetFrameNumber(
long int number);
283 void SetPixelRatio(
int num,
int den);
287 void Thumbnail(
string path,
int new_width,
int new_height,
string mask_path,
string overlay_path,
288 string background_color,
bool ignore_aspect,
string format=
"png",
int quality=100)
throw(
InvalidFile);
Header file for Fraction class.
void ChannelsLayout(ChannelLayout new_channel_layout)
This class represents a single frame of video (i.e. image & audio data)
Header file for AudioBufferSource class.
long int number
This is the frame number (starting at 1)
Fraction GetPixelRatio()
Set Pixel Aspect Ratio.
Header file for AudioResampler class.
Exception for files that can not be found or opened.
bool has_audio_data
This frame has been loaded with audio data.
This class represents a fraction.
Header file for ZeroMQ-based Logger class.
Header file for ChannelLayout class.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
This namespace is the default namespace for all code in the openshot library.
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.
This class is used to resample audio data for many sequential frames.