1 /*****************************************************************************
2 * VideoWindow.h: BeOS video window class prototype
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
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>
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
27 #ifndef BEOS_VIDEO_WINDOW_H
28 #define BEOS_VIDEO_WINDOW_H
37 typedef struct colorcombo
46 colorcombo colspace[]=
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}
61 VideoSettings( const VideoSettings& clone );
62 virtual ~VideoSettings();
64 static VideoSettings* DefaultSettings();
74 void SetVideoSize( uint32_t mode );
75 inline uint32_t VideoSize() const
76 { return fVideoSize; }
79 FLAG_CORRECT_RATIO = 0x0001,
80 FLAG_SYNC_RETRACE = 0x0002,
81 FLAG_ON_TOP_ALL = 0x0004,
82 FLAG_FULL_SCREEN = 0x0008,
85 inline void SetFlags( uint32_t flags )
87 inline void AddFlags( uint32_t flags )
89 inline void ClearFlags( uint32_t flags )
91 inline bool HasFlags( uint32_t flags ) const
92 { return fFlags & flags; }
93 inline uint32_t Flags() const
97 VideoSettings(); // reserved for default settings
99 static VideoSettings fDefaultSettings;
107 class VLCView : public BView
110 VLCView( BRect bounds, vout_thread_t *p_vout );
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 virtual void KeyUp(const char* bytes, int32 numBytes);
123 vout_thread_t *p_vout;
125 bigtime_t fLastMouseMovedTime;
128 bool fIgnoreDoubleClick;
132 class VideoWindow : public BWindow
135 VideoWindow(int v_width,
138 vout_thread_t *p_vout);
139 virtual ~VideoWindow();
142 virtual void MessageReceived(BMessage* message);
143 virtual void Zoom(BPoint origin,
144 float width, float height);
145 virtual void FrameResized(float width, float height);
146 virtual void FrameMoved(BPoint origin);
147 virtual void ScreenChanged(BRect frame,
149 virtual void WindowActivated(bool active);
152 void drawBuffer(int bufferIndex);
154 void ToggleInterfaceShowing();
155 void SetInterfaceShowing(bool showIt);
157 void SetCorrectAspectRatio(bool doIt);
158 bool CorrectAspectRatio() const;
159 void ToggleFullScreen();
160 void SetFullScreen(bool doIt);
161 bool IsFullScreen() const;
162 void SetOnTop(bool doIt);
163 bool IsOnTop() const;
164 void SetSyncToRetrace(bool doIt);
165 bool IsSyncedToRetrace() const;
166 inline status_t InitCheck() const
167 { return fInitStatus; }
170 // this is the hook controling direct screen connection
171 int32_t i_width; // aspect corrected bitmap size
173 BRect winSize; // current window size
175 // BBitmap *overlaybitmap;
178 volatile bool teardownwindow;
179 thread_id fDrawThreadID;
185 status_t _AllocateBuffers(int width,
189 void _BlankBitmap(BBitmap* bitmap) const;
190 void _SetVideoSize(uint32_t mode);
191 void _SetToSettings();
193 void _SaveScreenShot( BBitmap* bitmap,
195 uint32_t translatorID ) const;
196 static int32 _save_screen_shot( void* cookie );
198 struct screen_shot_info
202 uint32_t translatorID;
207 vout_thread_t *p_vout;
209 int32_t fTrueWidth; // incomming bitmap size
211 window_feel fCachedFeel;
212 bool fInterfaceShowing;
213 status_t fInitStatus;
214 VideoSettings* fSettings;
217 #endif // BEOS_VIDEO_WINDOW_H