xref: /haiku/src/apps/mediaplayer/ControllerObserver.h (revision bea66afaeb8d038d8918106a430a56b6e9fb3109)
1 /*
2  * Copyright 2007-2009, 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 
12 #include "AbstractLOAdapter.h"
13 #include "Controller.h"
14 
15 
16 enum {
17 	MSG_CONTROLLER_FILE_FINISHED			= 'cnff',
18 	MSG_CONTROLLER_FILE_CHANGED				= 'cnfc',
19 
20 	MSG_CONTROLLER_VIDEO_TRACK_CHANGED		= 'cnvt',
21 	MSG_CONTROLLER_AUDIO_TRACK_CHANGED		= 'cnat',
22 
23 	MSG_CONTROLLER_VIDEO_STATS_CHANGED		= 'cnvs',
24 	MSG_CONTROLLER_AUDIO_STATS_CHANGED		= 'cnas',
25 
26 	MSG_CONTROLLER_PLAYBACK_STATE_CHANGED	= 'cnps',
27 	MSG_CONTROLLER_POSITION_CHANGED			= 'cnpc',
28 	MSG_CONTROLLER_VOLUME_CHANGED			= 'cnvc',
29 	MSG_CONTROLLER_MUTED_CHANGED			= 'cnmc'
30 };
31 
32 enum {
33 	OBSERVE_FILE_CHANGES					= 0x0001,
34 	OBSERVE_TRACK_CHANGES					= 0x0002,
35 	OBSERVE_STAT_CHANGES					= 0x0004,
36 	OBSERVE_PLAYBACK_STATE_CHANGES			= 0x0008,
37 	OBSERVE_POSITION_CHANGES				= 0x0010,
38 	OBSERVE_VOLUME_CHANGES					= 0x0020,
39 
40 	OBSERVE_ALL_CHANGES						= 0xffff
41 };
42 
43 
44 class ControllerObserver
45 	: public Controller::Listener, public AbstractLOAdapter {
46 public:
47 						ControllerObserver(BHandler* target,
48 							uint32 observeFlags = OBSERVE_ALL_CHANGES);
49 	virtual				~ControllerObserver();
50 
51 	// Controller::Listener interface
52 	virtual	void		FileFinished();
53 	virtual	void		FileChanged(PlaylistItem* item, status_t result);
54 
55 	virtual	void		VideoTrackChanged(int32 index);
56 	virtual	void		AudioTrackChanged(int32 index);
57 
58 	virtual	void		VideoStatsChanged();
59 	virtual	void		AudioStatsChanged();
60 
61 	virtual	void		PlaybackStateChanged(uint32 state);
62 	virtual	void		PositionChanged(float position);
63 	virtual	void		VolumeChanged(float volume);
64 	virtual	void		MutedChanged(bool muted);
65 
66 private:
67 			uint32		fObserveFlags;
68 };
69 
70 #endif // CONTROLLER_OBSERVER_H
71