Olive
clip.h
1 #ifndef CLIP_H
2 #define CLIP_H
3 
4 #include <QWaitCondition>
5 #include <QMutex>
6 #include <QVector>
7 
8 #include "marker.h"
9 
10 class Cacher;
11 class Effect;
12 class Transition;
13 class QOpenGLFramebufferObject;
14 class ComboAction;
15 class Media;
16 struct Sequence;
17 struct Footage;
18 struct FootageStream;
19 
20 struct AVFormatContext;
21 struct AVStream;
22 struct AVCodec;
23 struct AVCodecContext;
24 struct AVFrame;
25 struct AVPacket;
26 struct SwsContext;
27 struct SwrContext;
28 struct AVFilterGraph;
29 struct AVFilterContext;
30 struct AVDictionary;
31 class QOpenGLTexture;
32 
33 class Clip {
34 public:
35  Clip(Sequence* s);
36  ~Clip();
37  Clip* copy(Sequence* s, bool duplicate_transitions = true);
38  void reset_audio();
39  void reset();
40  void refresh();
41  long get_clip_in_with_transition();
42  long get_timeline_in_with_transition();
43  long get_timeline_out_with_transition();
44  long getLength();
45  double getMediaFrameRate();
46  long getMaximumLength();
47  void recalculateMaxLength();
48  int getWidth();
49  int getHeight();
50  void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
51  Sequence* sequence;
52 
53  // queue functions
54  void queue_clear();
55  void queue_remove_earliest();
56 
57  // timeline variables (should be copied in copy())
58  bool enabled;
59  long clip_in;
60  long timeline_in;
61  long timeline_out;
62  int track;
63  QString name;
64  quint8 color_r;
65  quint8 color_g;
66  quint8 color_b;
67  Media* media;
68  int media_stream;
69  double speed;
70  double cached_fr;
71  bool reverse;
72  bool maintain_audio_pitch;
73  bool autoscale;
74 
75  // markers
76  QVector<Marker>& get_markers();
77 
78  // other variables (should be deep copied/duplicated in copy())
79  QList<Effect*> effects;
80  QVector<int> linked;
81  int opening_transition;
82  Transition* get_opening_transition();
83  int closing_transition;
84  Transition* get_closing_transition();
85 
86  // media handling
87  AVFormatContext* formatCtx;
88  AVStream* stream;
89  AVCodec* codec;
90  AVCodecContext* codecCtx;
91  AVPacket* pkt;
92  AVFrame* frame;
93  AVDictionary* opts;
94  long calculated_length;
95 
96  // temporary variables
97  int load_id;
98  bool undeletable;
99  bool reached_end;
100  bool pkt_written;
101  bool open;
102  bool finished_opening;
103  bool replaced;
104  bool ignore_reverse;
105  int pix_fmt;
106 
107  // caching functions
108  bool use_existing_frame;
109  bool multithreaded;
110  Cacher* cacher;
111  QWaitCondition can_cache;
112  int max_queue_size;
113  QVector<AVFrame*> queue;
114  QMutex queue_lock;
115  QMutex lock;
116  QMutex open_lock;
117  int64_t last_invalid_ts;
118 
119  // converters/filters
120  AVFilterGraph* filter_graph;
121  AVFilterContext* buffersink_ctx;
122  AVFilterContext* buffersrc_ctx;
123 
124  // video playback variables
125  QOpenGLFramebufferObject** fbo;
126  QOpenGLTexture* texture;
127  long texture_frame;
128 
129  // audio playback variables
130  int64_t reverse_target;
131  int frame_sample_index;
132  qint64 audio_buffer_write;
133  bool audio_reset;
134  bool audio_just_reset;
135  long audio_target_frame;
136 private:
137  QVector<Marker> markers;
138 };
139 
140 #endif // CLIP_H
Definition: sequence.h:13
Definition: undo.h:32
Definition: effect.h:146
Definition: cacher.h:9
Definition: media.h:20
Definition: footage.h:25
Definition: clip.h:33
Definition: transition.h:19
Definition: footage.h:46