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>
55 #ifdef USE_IMAGEMAGICK
58 #include "JuceLibraryCode/JuceHeader.h"
117 tr1::shared_ptr<QImage> image;
118 tr1::shared_ptr<QImage> wave_image;
119 tr1::shared_ptr<juce::AudioSampleBuffer> audio;
120 tr1::shared_ptr<QApplication> previewApp;
121 CriticalSection addingImageSection;
122 const unsigned char *qbuffer;
131 int constrain(
int color_value);
142 Frame(
long int number,
int width,
int height,
string color);
145 Frame(
long int number,
int samples,
int channels);
148 Frame(
long int number,
int width,
int height,
string color,
int samples,
int channels);
160 void AddColor(
int width,
int height,
string color);
163 void AddImage(
int width,
int height,
int bytes_per_pixel, QImage::Format type,
const unsigned char *pixels_);
166 void AddImage(tr1::shared_ptr<QImage> new_image);
169 void AddImage(tr1::shared_ptr<QImage> new_image,
bool only_odd_lines);
171 #ifdef USE_IMAGEMAGICK
173 void AddMagickImage(tr1::shared_ptr<Magick::Image> new_image);
177 void AddAudio(
bool replaceSamples,
int destChannel,
int destStartSample,
const float* source,
int numSamples,
float gainToApplyToSource);
180 void AddAudioSilence(
int numSamples);
183 void ApplyGainRamp(
int destChannel,
int destStartSample,
int numSamples,
float initial_gain,
float final_gain);
193 static void cleanUpBuffer(
void *info);
196 void ClearWaveform();
199 void DeepCopy(
const Frame& other);
205 void DisplayWaveform();
208 float* GetAudioSamples(
int channel);
211 float* GetInterleavedAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
214 float* GetPlanarAudioSamples(
int new_sample_rate,
AudioResampler* resampler,
int* sample_count);
217 int GetAudioChannelsCount();
220 int GetAudioSamplesCount();
222 juce::AudioSampleBuffer *GetAudioSampleBuffer();
228 tr1::shared_ptr<QImage> GetImage();
230 #ifdef USE_IMAGEMAGICK
232 tr1::shared_ptr<Magick::Image> GetMagickImage();
239 const unsigned char* GetPixels();
242 const unsigned char* GetPixels(
int row);
248 int GetSamplesPerFrame(
Fraction fps,
int sample_rate,
int channels);
251 static int GetSamplesPerFrame(
long int frame_number,
Fraction fps,
int sample_rate,
int channels);
254 tr1::shared_ptr<QImage> GetWaveform(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
257 const unsigned char* GetWaveformPixels(
int width,
int height,
int Red,
int Green,
int Blue,
int Alpha);
263 void ResizeAudio(
int channels,
int length,
int sample_rate,
ChannelLayout channel_layout);
269 void SampleRate(
int orig_sample_rate) { sample_rate = orig_sample_rate; };
272 void Save(
string path,
float scale,
string format=
"PNG",
int quality=100);
275 void SetFrameNumber(
int number);
278 void SetPixelRatio(
int num,
int den);
282 void Thumbnail(
string path,
int new_width,
int new_height,
string mask_path,
string overlay_path,
283 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 ChannelLayout class.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
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.