Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

VideoWindow.h

00001 /*****************************************************************************
00002  * VideoWindow.h: BeOS video window class prototype
00003  *****************************************************************************
00004  * Copyright (C) 1999, 2000, 2001 the VideoLAN team
00005  * $Id: VideoWindow.h 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Jean-Marc Dressler <[email protected]>
00008  *          Tony Castley <[email protected]>
00009  *          Richard Shepherd <[email protected]>
00010  *          Stephan Aßmus <[email protected]>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00025  *****************************************************************************/
00026 
00027 #ifndef BEOS_VIDEO_WINDOW_H
00028 #define BEOS_VIDEO_WINDOW_H
00029 
00030 #include <View.h>
00031 #include <Window.h>
00032 
00033 #define BITMAP  0
00034 #define OVERLAY 1
00035 #define OPENGL  2
00036 
00037 typedef struct colorcombo
00038 {
00039         color_space colspace;
00040         const char *name;
00041         uint32_t chroma;
00042         int planes;
00043         int pixel_bytes;
00044 } colorcombo;
00045 
00046 colorcombo colspace[]=
00047 {
00048         {B_YCbCr420, "B_YCbCr420", VLC_FOURCC('I','4','2','0'), 3, 2},
00049         {B_YUV422,   "B_YUV422",   VLC_FOURCC('Y','4','2','2'), 3, 2},
00050         {B_YCbCr422, "B_YCbCr422", VLC_FOURCC('Y','U','Y','2'), 3, 2},
00051         {B_RGB32,    "B_RGB32",    VLC_FOURCC('R','V','3','2'), 1, 4},
00052         {B_RGB16,    "B_RGB16",    VLC_FOURCC('R','V','1','6'), 1, 2}
00053 };
00054 
00055 #define COLOR_COUNT 5
00056 #define DEFAULT_COL 3
00057 
00058 class VideoSettings
00059 {
00060  public:
00061                                                         VideoSettings( const VideoSettings& clone );
00062         virtual                                 ~VideoSettings();
00063 
00064         static  VideoSettings*  DefaultSettings();
00065 
00066         enum
00067         {
00068                 SIZE_OTHER                      = 0,
00069                 SIZE_50                         = 1,
00070                 SIZE_100                        = 2,
00071                 SIZE_200                        = 3,
00072         };
00073 
00074                         void                    SetVideoSize( uint32_t mode );
00075         inline  uint32_t                        VideoSize() const
00076                                                                 { return fVideoSize; }
00077         enum
00078         {
00079                 FLAG_CORRECT_RATIO      = 0x0001,
00080                 FLAG_SYNC_RETRACE       = 0x0002,
00081                 FLAG_ON_TOP_ALL         = 0x0004,
00082                 FLAG_FULL_SCREEN        = 0x0008,
00083         };
00084 
00085         inline  void                    SetFlags( uint32_t flags )
00086                                                                 { fFlags = flags; }
00087         inline  void                    AddFlags( uint32_t flags )
00088                                                                 { fFlags |= flags; }
00089         inline  void                    ClearFlags( uint32_t flags )
00090                                                                 { fFlags &= ~flags; }
00091         inline  bool                    HasFlags( uint32_t flags ) const
00092                                                                 { return fFlags & flags; }
00093         inline  uint32_t                        Flags() const
00094                                                                 { return fFlags; }
00095 
00096  private:
00097                                                         VideoSettings(); // reserved for default settings
00098 
00099         static  VideoSettings   fDefaultSettings;
00100 
00101                         uint32_t                        fVideoSize;
00102                         uint32_t                        fFlags;
00103                         BMessage*               fSettings;
00104 };
00105 
00106 
00107 class VLCView : public BView
00108 {
00109  public:
00110                                                         VLCView( BRect bounds, vout_thread_t *p_vout );
00111         virtual                                 ~VLCView();
00112 
00113         virtual void                    AttachedToWindow();
00114         virtual void                    MouseDown(BPoint where);
00115         virtual void                    MouseUp(BPoint where);
00116         virtual void                    MouseMoved(BPoint where, uint32 transit,
00117                                                                            const BMessage* dragMessage);
00118         virtual void                    Pulse();
00119         virtual void                    Draw(BRect updateRect);
00120 
00121  private:
00122             vout_thread_t   *p_vout;
00123 
00124                         bigtime_t               fLastMouseMovedTime;
00125                         bool                    fCursorHidden;
00126                         bool                    fCursorInside;
00127                         bool                    fIgnoreDoubleClick;
00128 };
00129 
00130 
00131 class VideoWindow : public BWindow
00132 {
00133 public:
00134                                                         VideoWindow(int v_width,
00135                                                                                 int v_height,
00136                                                                                 BRect frame,
00137                                                                                 vout_thread_t *p_vout);
00138         virtual                                 ~VideoWindow();
00139 
00140                                                         // BWindow
00141         virtual void                    MessageReceived(BMessage* message);
00142         virtual void                    Zoom(BPoint origin,
00143                                                                  float width, float height);
00144         virtual void                    FrameResized(float width, float height);
00145         virtual void                    FrameMoved(BPoint origin);
00146         virtual void                    ScreenChanged(BRect frame,
00147                                                                                   color_space mode);
00148         virtual void                    WindowActivated(bool active);
00149 
00150                                                         // VideoWindow
00151                         void                    drawBuffer(int bufferIndex);
00152 
00153                         void                    ToggleInterfaceShowing();
00154                         void                    SetInterfaceShowing(bool showIt);
00155 
00156                         void                    SetCorrectAspectRatio(bool doIt);
00157                         bool                    CorrectAspectRatio() const;
00158                         void                    ToggleFullScreen();
00159                         void                    SetFullScreen(bool doIt);
00160                         bool                    IsFullScreen() const;
00161                         void                    SetOnTop(bool doIt);
00162                         bool                    IsOnTop() const;
00163                         void                    SetSyncToRetrace(bool doIt);
00164                         bool                    IsSyncedToRetrace() const;
00165         inline  status_t                InitCheck() const
00166                                                                 { return fInitStatus; }
00167 
00168 
00169     // this is the hook controling direct screen connection
00170     int32_t         i_width;     // aspect corrected bitmap size
00171     int32_t         i_height;
00172     BRect           winSize;     // current window size
00173     BBitmap             *bitmap[3];
00174 //    BBitmap         *overlaybitmap;
00175     VLCView             *view;
00176     int             i_buffer;
00177         volatile bool   teardownwindow;
00178     thread_id       fDrawThreadID;
00179     int             mode;
00180     int             bitmap_count;
00181     int             colspace_index;
00182 
00183 private:
00184                         status_t                _AllocateBuffers(int width,
00185                                                                                          int height,
00186                                                                                          int* mode);
00187                         void                    _FreeBuffers();
00188                         void                    _BlankBitmap(BBitmap* bitmap) const;
00189                         void                    _SetVideoSize(uint32_t mode);
00190                         void                    _SetToSettings();
00191 
00192     vout_thread_t   *p_vout;
00193 
00194         int32_t                 fTrueWidth;     // incomming bitmap size
00195         int32_t                 fTrueHeight;
00196         window_feel             fCachedFeel;
00197         bool                    fInterfaceShowing;
00198         status_t                fInitStatus;
00199         VideoSettings*  fSettings;
00200 };
00201 
00202 #endif  // BEOS_VIDEO_WINDOW_H
00203 

Generated on Tue Dec 20 10:14:38 2005 for vlc-0.8.4a by  doxygen 1.4.2