1 /* 2 * Copyright 2007, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 #ifndef CONTROLLER_OBSERVER_H 9 #define CONTROLLER_OBSERVER_H 10 11 #include "AbstractLOAdapter.h" 12 #include "Controller.h" 13 14 enum { 15 MSG_CONTROLLER_FILE_FINISHED = 'cnff', 16 MSG_CONTROLLER_FILE_CHANGED = 'cnfc', 17 18 MSG_CONTROLLER_VIDEO_TRACK_CHANGED = 'cnvt', 19 MSG_CONTROLLER_AUDIO_TRACK_CHANGED = 'cnat', 20 21 MSG_CONTROLLER_VIDEO_STATS_CHANGED = 'cnvs', 22 MSG_CONTROLLER_AUDIO_STATS_CHANGED = 'cnas', 23 24 MSG_CONTROLLER_PLAYBACK_STATE_CHANGED = 'cnps', 25 MSG_CONTROLLER_POSITION_CHANGED = 'cnpc', 26 MSG_CONTROLLER_VOLUME_CHANGED = 'cnvc', 27 MSG_CONTROLLER_MUTED_CHANGED = 'cnmc' 28 }; 29 30 enum { 31 OBSERVE_FILE_CHANGES = 0x0001, 32 OBSERVE_TRACK_CHANGES = 0x0002, 33 OBSERVE_STAT_CHANGES = 0x0004, 34 OBSERVE_PLAYBACK_STATE_CHANGES = 0x0008, 35 OBSERVE_POSITION_CHANGES = 0x0010, 36 OBSERVE_VOLUME_CHANGES = 0x0020, 37 38 OBSERVE_ALL_CHANGES = 0xffff 39 }; 40 41 class ControllerObserver : public Controller::Listener, 42 public AbstractLOAdapter { 43 public: 44 ControllerObserver(BHandler* target, 45 uint32 observeFlags = OBSERVE_ALL_CHANGES); 46 virtual ~ControllerObserver(); 47 48 // Controller::Listener interface 49 virtual void FileFinished(); 50 virtual void FileChanged(); 51 52 virtual void VideoTrackChanged(int32 index); 53 virtual void AudioTrackChanged(int32 index); 54 55 virtual void VideoStatsChanged(); 56 virtual void AudioStatsChanged(); 57 58 virtual void PlaybackStateChanged(uint32 state); 59 virtual void PositionChanged(float position); 60 virtual void VolumeChanged(float volume); 61 virtual void MutedChanged(bool muted); 62 63 private: 64 uint32 fObserveFlags; 65 }; 66 67 #endif // CONTROLLER_OBSERVER_H 68