1 /* 2 * Copyright 2006-2010 Stephan Aßmus <superstippi@gmx.de> 3 * All rights reserved. Distributed under the terms of the MIT license. 4 */ 5 #ifndef VIDEO_VIEW_H 6 #define VIDEO_VIEW_H 7 8 9 #include <View.h> 10 11 #include "ListenerAdapter.h" 12 #include "VideoTarget.h" 13 14 15 enum { 16 M_HIDE_FULL_SCREEN_CONTROLS = 'hfsc' 17 }; 18 19 20 class SubtitleBitmap; 21 22 23 class VideoView : public BView, public VideoTarget { 24 public: 25 VideoView(BRect frame, const char* name, 26 uint32 resizeMask); 27 virtual ~VideoView(); 28 29 // BView interface 30 virtual void Draw(BRect updateRect); 31 virtual void MessageReceived(BMessage* message); 32 virtual void Pulse(); 33 virtual void MouseMoved(BPoint where, uint32 transit, 34 const BMessage* dragMessage = NULL); 35 36 // VideoTarget interface 37 virtual void SetBitmap(const BBitmap* bitmap); 38 39 // VideoView 40 void GetOverlayScaleLimits(float* minScale, 41 float* maxScale) const; 42 43 void OverlayScreenshotPrepare(); 44 void OverlayScreenshotCleanup(); 45 46 bool UseOverlays() const; 47 bool IsOverlayActive(); 48 void DisableOverlay(); 49 50 void SetPlaying(bool playing); 51 void SetFullscreen(bool fullScreen); 52 void SetVideoFrame(const BRect& frame); 53 54 void SetSubTitle(const char* text); 55 void SetSubTitleMaxBottom(float bottom); 56 57 private: 58 void _DrawBitmap(const BBitmap* bitmap); 59 void _DrawSubtitle(); 60 void _AdoptGlobalSettings(); 61 void _SetOverlayMode(bool overlayMode); 62 void _LayoutSubtitle(); 63 64 private: 65 BRect fVideoFrame; 66 bool fOverlayMode; 67 overlay_restrictions fOverlayRestrictions; 68 rgb_color fOverlayKeyColor; 69 bool fIsPlaying; 70 bool fIsFullscreen; 71 bigtime_t fLastMouseMove; 72 73 SubtitleBitmap* fSubtitleBitmap; 74 BRect fSubtitleFrame; 75 float fSubtitleMaxButtom; 76 bool fHasSubtitle; 77 bool fSubtitleChanged; 78 79 // Settings values: 80 ListenerAdapter fGlobalSettingsListener; 81 bool fUseOverlays; 82 bool fUseBilinearScaling; 83 uint32 fSubtitlePlacement; 84 }; 85 86 #endif // VIDEO_VIEW_H 87