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 tr1::shared_ptr<QImage> image;
119 tr1::shared_ptr<QImage> wave_image;
120 tr1::shared_ptr<juce::AudioSampleBuffer> audio;
121 tr1::shared_ptr<QApplication> previewApp;
122 CriticalSection addingImageSection;
123 const unsigned char *qbuffer;
132 int constrain(
int color_value);
143 Frame(
long int number,
int width,
int height,
string color);
146 Frame(
long int number,
int samples,
int channels);
149 Frame(
long int number,
int width,
int height,
string color,
int samples,
int channels);
161 void AddColor(
int width,
int height,
string color);
164 void AddImage(
int width,
int height,
int bytes_per_pixel, QImage::Format type,
const unsigned char *pixels_);
167 void AddImage(tr1::shared_ptr<QImage> new_image);
170 void AddImage(tr1::shared_ptr<QImage> new_image,
bool only_odd_lines);
172 #ifdef USE_IMAGEMAGICK 174 void AddMagickImage(tr1::shared_ptr<Magick::Image> new_image);
178 void AddAudio(
bool replaceSamples,
int destChannel,
int destStartSample,
const float* source,
int numSamples,
float gainToApplyToSource);
181 void AddAudioSilence(
int numSamples);
184 void ApplyGainRamp(
int destChannel,
int destStartSample,
int numSamples,
float initial_gain,
float final_gain);
194 static void cleanUpBuffer(
void *info);
197 void ClearWaveform();
200 void DeepCopy(
const Frame& other);
206 void DisplayWaveform();
209 float GetAudioSample(
int channel,
int sample,
int magnitude_range);
212 float* GetAudioSamples(
int channel);
215 float* GetInterleavedAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
218 float* GetPlanarAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
221 int GetAudioChannelsCount();
224 int GetAudioSamplesCount();
226 juce::AudioSampleBuffer *GetAudioSampleBuffer();
232 tr1::shared_ptr<QImage> GetImage();
234 #ifdef USE_IMAGEMAGICK 236 tr1::shared_ptr<Magick::Image> GetMagickImage();
243 const unsigned char* GetPixels();
246 const unsigned char* GetPixels(
int row);
252 int GetSamplesPerFrame(
Fraction fps,
int sample_rate,
int channels);
255 static int GetSamplesPerFrame(
long int frame_number,
Fraction fps,
int sample_rate,
int channels);
258 tr1::shared_ptr<QImage> GetWaveform(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
261 const unsigned char* GetWaveformPixels(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
267 void ResizeAudio(
int channels,
int length,
int sample_rate,
ChannelLayout channel_layout);
273 void SampleRate(
int orig_sample_rate) { sample_rate = orig_sample_rate; };
276 void Save(
string path,
float scale,
string format=
"PNG",
int quality=100);
279 void SetFrameNumber(
int number);
282 void SetPixelRatio(
int num,
int den);
286 void Thumbnail(
string path,
int new_width,
int new_height,
string mask_path,
string overlay_path,
287 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.