]> git.sesse.net Git - vlc/blob - modules/gui/beos/VideoWindow.h
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / beos / VideoWindow.h
1 /*****************************************************************************
2  * VideoWindow.h: BeOS video window class prototype
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8  *          Tony Castley <tcastley@mail.powerup.com.au>
9  *          Richard Shepherd <richard@rshepherd.demon.co.uk>
10  *          Stephan Aßmus <stippi@yellowbites.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #ifndef BEOS_VIDEO_WINDOW_H
28 #define BEOS_VIDEO_WINDOW_H
29
30 #include <View.h>
31 #include <Window.h>
32
33 #define BITMAP  0
34 #define OVERLAY 1
35 #define OPENGL  2
36
37 typedef struct colorcombo
38 {
39     color_space colspace;
40     const char *name;
41     uint32_t chroma;
42     int planes;
43     int pixel_bytes;
44 } colorcombo;
45
46 colorcombo colspace[]=
47 {
48     {B_YCbCr420, "B_YCbCr420", VLC_FOURCC('I','4','2','0'), 3, 2},
49     {B_YUV422,   "B_YUV422",   VLC_FOURCC('Y','4','2','2'), 3, 2},
50     {B_YCbCr422, "B_YCbCr422", VLC_FOURCC('Y','U','Y','2'), 3, 2},
51     {B_RGB32,    "B_RGB32",    VLC_FOURCC('R','V','3','2'), 1, 4},
52     {B_RGB16,    "B_RGB16",    VLC_FOURCC('R','V','1','6'), 1, 2}
53 };
54
55 #define COLOR_COUNT 5
56 #define DEFAULT_COL 3
57
58 class VideoSettings
59 {
60  public:
61                             VideoSettings( const VideoSettings& clone );
62     virtual                    ~VideoSettings();
63
64     static    VideoSettings*    DefaultSettings();
65
66     enum
67     {
68         SIZE_OTHER            = 0,
69         SIZE_50                = 1,
70         SIZE_100            = 2,
71         SIZE_200            = 3,
72     };
73
74             void            SetVideoSize( uint32_t mode );
75     inline    uint32_t            VideoSize() const
76                                 { return fVideoSize; }
77     enum
78     {
79         FLAG_CORRECT_RATIO    = 0x0001,
80         FLAG_SYNC_RETRACE    = 0x0002,
81         FLAG_ON_TOP_ALL        = 0x0004,
82         FLAG_FULL_SCREEN    = 0x0008,
83     };
84
85     inline    void            SetFlags( uint32_t flags )
86                                 { fFlags = flags; }
87     inline    void            AddFlags( uint32_t flags )
88                                 { fFlags |= flags; }
89     inline    void            ClearFlags( uint32_t flags )
90                                 { fFlags &= ~flags; }
91     inline    bool            HasFlags( uint32_t flags ) const
92                                 { return fFlags & flags; }
93     inline    uint32_t            Flags() const
94                                 { return fFlags; }
95
96  private:
97                             VideoSettings(); // reserved for default settings
98
99     static    VideoSettings    fDefaultSettings;
100
101             uint32_t            fVideoSize;
102             uint32_t            fFlags;
103             BMessage*        fSettings;
104 };
105
106
107 class VLCView : public BView
108 {
109  public:
110                             VLCView( BRect bounds, vout_thread_t *p_vout );
111     virtual                    ~VLCView();
112
113     virtual    void            AttachedToWindow();
114     virtual    void            MouseDown(BPoint where);
115     virtual    void            MouseUp(BPoint where);
116     virtual    void            MouseMoved(BPoint where, uint32 transit,
117                                        const BMessage* dragMessage);
118     virtual    void            Pulse();
119     virtual    void            Draw(BRect updateRect);
120
121  private:
122             vout_thread_t   *p_vout;
123
124             bigtime_t        fLastMouseMovedTime;
125             bool            fCursorHidden;
126             bool            fCursorInside;
127             bool            fIgnoreDoubleClick;
128 };
129
130
131 class VideoWindow : public BWindow
132 {
133 public:
134                             VideoWindow(int v_width,
135                                         int v_height,
136                                         BRect frame,
137                                         vout_thread_t *p_vout);
138     virtual                    ~VideoWindow();
139
140                             // BWindow
141     virtual    void            MessageReceived(BMessage* message);
142     virtual    void            Zoom(BPoint origin,
143                                  float width, float height);
144     virtual    void            FrameResized(float width, float height);
145     virtual    void            FrameMoved(BPoint origin);
146     virtual    void            ScreenChanged(BRect frame,
147                                           color_space mode);
148     virtual    void            WindowActivated(bool active);
149
150                             // VideoWindow
151             void            drawBuffer(int bufferIndex);
152
153             void            ToggleInterfaceShowing();
154             void            SetInterfaceShowing(bool showIt);
155
156             void            SetCorrectAspectRatio(bool doIt);
157             bool            CorrectAspectRatio() const;
158             void            ToggleFullScreen();
159             void            SetFullScreen(bool doIt);
160             bool            IsFullScreen() const;
161             void            SetOnTop(bool doIt);
162             bool            IsOnTop() const;
163             void            SetSyncToRetrace(bool doIt);
164             bool            IsSyncedToRetrace() const;
165     inline    status_t        InitCheck() const
166                                 { return fInitStatus; }
167
168
169     // this is the hook controling direct screen connection
170     int32_t         i_width;     // aspect corrected bitmap size
171     int32_t         i_height;
172     BRect           winSize;     // current window size
173     BBitmap            *bitmap[3];
174 //    BBitmap         *overlaybitmap;
175     VLCView            *view;
176     int             i_buffer;
177     volatile bool    teardownwindow;
178     thread_id       fDrawThreadID;
179     int             mode;
180     int             bitmap_count;
181     int             colspace_index;
182
183 private:
184             status_t        _AllocateBuffers(int width,
185                                              int height,
186                                              int* mode);
187             void            _FreeBuffers();
188             void            _BlankBitmap(BBitmap* bitmap) const;
189             void            _SetVideoSize(uint32_t mode);
190             void            _SetToSettings();
191
192     vout_thread_t   *p_vout;
193
194     int32_t            fTrueWidth;     // incomming bitmap size
195     int32_t            fTrueHeight;
196     window_feel        fCachedFeel;
197     bool            fInterfaceShowing;
198     status_t        fInitStatus;
199     VideoSettings*    fSettings;
200 };
201
202 #endif    // BEOS_VIDEO_WINDOW_H
203