Files
oak-editor/project/clip.h
T
2018-06-13 22:39:05 -07:00

96 lines
1.7 KiB
C++

#ifndef CLIP_H
#define CLIP_H
#include <QWaitCondition>
#include <QMutex>
#include <QVector>
class Cacher;
class Effect;
struct Sequence;
struct Media;
struct MediaStream;
struct AVFormatContext;
struct AVStream;
struct AVCodec;
struct AVCodecContext;
struct AVFrame;
struct AVPacket;
struct SwsContext;
struct SwrContext;
class QOpenGLTexture;
class QPixmap;
struct ClipCache {
AVFrame** frames;
long offset;
bool written;
bool unread;
QMutex mutex;
};
struct Clip
{
Clip();
~Clip();
Clip* copy();
void init();
void reset();
bool undeletable;
// timeline variables
QString name;
long clip_in;
long timeline_in;
long timeline_out;
int track;
uint8_t color_r;
uint8_t color_g;
uint8_t color_b;
long getLength();
// inherited information (should be copied in copy())
Media* media; // attached media
MediaStream* media_stream;
Sequence* sequence;
// other variables (should be "duplicated" in copy())
QList<Effect*> effects;
QVector<Clip*> linked;
// media handling
AVFormatContext* formatCtx;
AVStream* stream;
AVCodec* codec;
AVCodecContext* codecCtx;
AVPacket* pkt;
AVFrame* frame;
bool pkt_written;
bool reached_end;
bool open;
// caching functions
bool multithreaded;
Cacher* cacher;
QWaitCondition can_cache;
uint16_t cache_size;
ClipCache cache_A;
ClipCache cache_B;
QMutex lock;
QMutex open_lock;
// video playback variables
SwsContext* sws_ctx;
QOpenGLTexture* texture;
long texture_frame;
// audio playback variables
SwrContext* swr_ctx;
int frame_sample_index;
int audio_buffer_write;
bool reset_audio;
};
#endif // CLIP_H