add Autosave continuous backups by Andras Reuss and Andrew-R
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / playtransport.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef PLAYTRANSPORT_H
23 #define PLAYTRANSPORT_H
24
25 #include "edl.inc"
26 #include "guicast.h"
27 #include "mwindow.inc"
28 #include "playbackengine.inc"
29 #include "playtransport.inc"
30
31 #define PLAY_MODE 0
32 #define LOOP_MODE 1
33
34 class PlayTransport
35 {
36 public:
37         PlayTransport(MWindow *mwindow, BC_WindowBase *subwindow, int x, int y);
38         virtual ~PlayTransport();
39
40         void create_objects();
41         void reposition_buttons(int x, int y);
42
43         virtual void goto_start();
44         virtual void goto_end();
45
46 // Set the playback engine to control
47         void set_engine(PlaybackEngine *engine);
48         static int get_transport_width(MWindow *mwindow);
49         int flip_vertical(int vertical, int &x, int &y);
50         int keypress_event();
51         int do_keypress(int key);
52 // Abstract transport send_command.
53 // wait_tracking - causes stop to wail until the final tracking position
54 // is updated before returning
55 // use_inout - causes the in/out points to determine the beginning and end
56 // of playback
57 // update_refresh - causes a frame advance to be issued after STOP to update
58 // the refresh frame.
59 // toggle_audio - reverses audio playback enable in RenderEngine::get_duty
60 // loop_play - sets play_loop and plays btwn start/end position (in a loop)
61 // speed - play speed for SLOW/FAST playback, zero defaults to slow=.5,fast=2.
62         void handle_transport(int command, int wait_tracking=0,
63                 int use_inout=0, int toggle_audio=0, int loop_play=0, float speed=0);
64         int set_transport(int mode);
65         int get_w();
66         int is_stopped();
67 // Get the EDL to play back with default to mwindow->edl
68         virtual EDL* get_edl();
69         void change_position(double position);
70         virtual bool use_mixers() { return false; }
71
72 // playback parameters
73         int reverse;
74         float speed;
75
76         PTransportButton *active_button;
77         PlayButton *forward_play;
78         FramePlayButton *frame_forward_play;
79         ReverseButton *reverse_play;
80         FrameReverseButton *frame_reverse_play;
81         FastReverseButton *fast_reverse;
82         FastPlayButton *fast_play;
83         RewindButton *rewind_button;
84         StopButton *stop_button;
85         EndButton *end_button;
86         MWindow *mwindow;
87         BC_WindowBase *subwindow;
88
89         PlaybackEngine *engine;
90         int using_inout, status;
91         int x, y;
92 };
93
94 // Should be toggle
95
96 class PTransportButton : public BC_Button
97 {
98 public:
99         PTransportButton(MWindow *mwindow, PlayTransport *transport, int x, int y, VFrame **data);
100         virtual ~PTransportButton();
101         void set_mode(int mode);
102         void loop_mode(int dir);
103         int play_command(const char *lock_msg, int command);
104
105         int mode;
106         MWindow *mwindow;
107         PlayTransport *transport;
108 };
109
110 class RewindButton : public PTransportButton
111 {
112 public:
113         RewindButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
114         int handle_event();
115 };
116
117 class FastReverseButton : public PTransportButton
118 {
119 public:
120         FastReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
121         int handle_event();
122 };
123
124 class ReverseButton : public PTransportButton
125 {
126 public:
127         ReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
128         int handle_event();
129 };
130
131 class FrameReverseButton : public PTransportButton
132 {
133 public:
134         FrameReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
135         int handle_event();
136 };
137
138 class PlayButton : public PTransportButton
139 {
140 public:
141         PlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
142         int handle_event();
143 };
144
145 class FramePlayButton : public PTransportButton
146 {
147 public:
148         FramePlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
149         int handle_event();
150 };
151
152 class FastPlayButton : public PTransportButton
153 {
154 public:
155         FastPlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
156         int handle_event();
157 };
158
159
160
161 class EndButton : public PTransportButton
162 {
163 public:
164         EndButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
165         int handle_event();
166 };
167
168 class StopButton : public PTransportButton
169 {
170 public:
171         StopButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
172         int handle_event();
173 };
174
175 #endif