00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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_CODEC_I420, 3, 2},
00049 {B_YUV422, "B_YUV422", VLC_FOURCC('Y','4','2','2'), 3, 2},
00050 {B_YCbCr422, "B_YCbCr422", VLC_CODEC_YUYV, 3, 2},
00051 {B_RGB32, "B_RGB32", VLC_CODEC_RGB32, 1, 4},
00052 {B_RGB16, "B_RGB16", VLC_CODEC_RGB16, 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();
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 int fMouseHideTimeout;
00126 bool fCursorHidden;
00127 bool fCursorInside;
00128 bool fIgnoreDoubleClick;
00129 };
00130
00131
00132 class VideoWindow : public BWindow
00133 {
00134 public:
00135 VideoWindow(int v_width,
00136 int v_height,
00137 BRect frame,
00138 vout_thread_t *p_vout);
00139 virtual ~VideoWindow();
00140
00141
00142 virtual void MessageReceived(BMessage* message);
00143 virtual void Zoom(BPoint origin,
00144 float width, float height);
00145 virtual void FrameResized(float width, float height);
00146 virtual void FrameMoved(BPoint origin);
00147 virtual void ScreenChanged(BRect frame,
00148 color_space mode);
00149 virtual void WindowActivated(bool active);
00150
00151
00152 void drawBuffer(int bufferIndex);
00153
00154 void ToggleInterfaceShowing();
00155 void SetInterfaceShowing(bool showIt);
00156
00157 void SetCorrectAspectRatio(bool doIt);
00158 bool CorrectAspectRatio() const;
00159 void ToggleFullScreen();
00160 void SetFullScreen(bool doIt);
00161 bool IsFullScreen() const;
00162 void SetOnTop(bool doIt);
00163 bool IsOnTop() const;
00164 void SetSyncToRetrace(bool doIt);
00165 bool IsSyncedToRetrace() const;
00166 inline status_t InitCheck() const
00167 { return fInitStatus; }
00168
00169
00170
00171 int32_t i_width;
00172 int32_t i_height;
00173 BRect winSize;
00174 BBitmap *bitmap[3];
00175
00176 VLCView *view;
00177 int i_buffer;
00178 volatile bool teardownwindow;
00179 thread_id fDrawThreadID;
00180 int mode;
00181 int bitmap_count;
00182 int colspace_index;
00183
00184 private:
00185 status_t _AllocateBuffers(int width,
00186 int height,
00187 int* mode);
00188 void _FreeBuffers();
00189 void _BlankBitmap(BBitmap* bitmap) const;
00190 void _SetVideoSize(uint32_t mode);
00191 void _SetToSettings();
00192
00193 vout_thread_t *p_vout;
00194
00195 int32_t fTrueWidth;
00196 int32_t fTrueHeight;
00197 window_feel fCachedFeel;
00198 bool fInterfaceShowing;
00199 status_t fInitStatus;
00200 VideoSettings* fSettings;
00201 };
00202
00203 #endif // BEOS_VIDEO_WINDOW_H
00204