11233b2b1030cd363e30e837cb87b15d198b0382
[goodguy/history.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 PAUSE_MODE 1
33 #define PAUSEDOWN_MODE 2
34
35 class PlayTransport
36 {
37 public:
38         PlayTransport(MWindow *mwindow, BC_WindowBase *subwindow, int x, int y);
39         virtual ~PlayTransport();
40
41         void create_objects();
42         void reposition_buttons(int x, int y);
43
44         virtual void goto_start();
45         virtual void goto_end();
46
47 // Set the playback engine to control
48         void set_engine(PlaybackEngine *engine);
49         static int get_transport_width(MWindow *mwindow);
50         int flip_vertical(int vertical, int &x, int &y);
51         int keypress_event();
52 // Abstract TransportQue::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         void handle_transport(int command, int wait_tracking=0,
61                 int use_inout=0, int update_refresh=1, int toggle_audio=0);
62         int pause_transport();
63         int reset_transport();
64         int get_w();
65 // Get the EDL to play back with default to mwindow->edl
66         virtual EDL* get_edl();
67         void change_position(double position);
68
69 // playback parameters
70         int reverse;
71         float speed;
72
73         PTransportButton *active_button;
74         PlayButton *forward_play;
75         FramePlayButton *frame_forward_play;
76         ReverseButton *reverse_play;
77         FrameReverseButton *frame_reverse_play;
78         FastReverseButton *fast_reverse;
79         FastPlayButton *fast_play;
80         RewindButton *rewind_button;
81         StopButton *stop_button;
82         EndButton *end_button;
83         MWindow *mwindow;
84         BC_WindowBase *subwindow;
85
86         PlaybackEngine *engine;
87         int using_inout, status;
88         int x, y;
89 };
90
91 // Should be toggle
92
93 class PTransportButton : public BC_Button
94 {
95 public:
96         PTransportButton(MWindow *mwindow, PlayTransport *transport, int x, int y, VFrame **data);
97         virtual ~PTransportButton();
98         virtual int set_mode(int mode);
99
100         int mode;
101         MWindow *mwindow;
102         PlayTransport *transport;
103 };
104
105 class RewindButton : public PTransportButton
106 {
107 public:
108         RewindButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
109         int handle_event();
110 };
111
112 class FastReverseButton : public PTransportButton
113 {
114 public:
115         FastReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
116         int handle_event();
117 };
118
119 class ReverseButton : public PTransportButton
120 {
121 public:
122         ReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
123         int handle_event();
124 };
125
126 class FrameReverseButton : public PTransportButton
127 {
128 public:
129         FrameReverseButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
130         int handle_event();
131 };
132
133 class PlayButton : public PTransportButton
134 {
135 public:
136         PlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
137         int handle_event();
138 };
139
140 class FramePlayButton : public PTransportButton
141 {
142 public:
143         FramePlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
144         int handle_event();
145 };
146
147 class FastPlayButton : public PTransportButton
148 {
149 public:
150         FastPlayButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
151         int handle_event();
152 };
153
154
155
156 class EndButton : public PTransportButton
157 {
158 public:
159         EndButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
160         int handle_event();
161 };
162
163 class StopButton : public PTransportButton
164 {
165 public:
166         StopButton(MWindow *mwindow, PlayTransport *transport, int x, int y);
167         int handle_event();
168 };
169
170 #endif