xref: /haiku/src/apps/mediaplayer/ControllerObserver.h (revision c8ccdf52032feea5e7853631dee57cf7f6302c5d)
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 	MSG_CONTROLLER_SUB_TITLE_TRACK_CHANGED	= 'cnst',
23 
24 	MSG_CONTROLLER_VIDEO_STATS_CHANGED		= 'cnvs',
25 	MSG_CONTROLLER_AUDIO_STATS_CHANGED		= 'cnas',
26 
27 	MSG_CONTROLLER_PLAYBACK_STATE_CHANGED	= 'cnps',
28 	MSG_CONTROLLER_POSITION_CHANGED			= 'cnpc',
29 	MSG_CONTROLLER_SEEK_HANDLED				= 'cnsh',
30 	MSG_CONTROLLER_VOLUME_CHANGED			= 'cnvc',
31 	MSG_CONTROLLER_MUTED_CHANGED			= 'cnmc'
32 };
33 
34 enum {
35 	OBSERVE_FILE_CHANGES					= 0x0001,
36 	OBSERVE_TRACK_CHANGES					= 0x0002,
37 	OBSERVE_STAT_CHANGES					= 0x0004,
38 	OBSERVE_PLAYBACK_STATE_CHANGES			= 0x0008,
39 	OBSERVE_POSITION_CHANGES				= 0x0010,
40 	OBSERVE_VOLUME_CHANGES					= 0x0020,
41 
42 	OBSERVE_ALL_CHANGES						= 0xffff
43 };
44 
45 
46 class ControllerObserver
47 	: public Controller::Listener, public AbstractLOAdapter {
48 public:
49 						ControllerObserver(BHandler* target,
50 							uint32 observeFlags = OBSERVE_ALL_CHANGES);
51 	virtual				~ControllerObserver();
52 
53 	// Controller::Listener interface
54 	virtual	void		FileFinished();
55 	virtual	void		FileChanged(PlaylistItem* item, status_t result);
56 
57 	virtual	void		VideoTrackChanged(int32 index);
58 	virtual	void		AudioTrackChanged(int32 index);
59 	virtual	void		SubTitleTrackChanged(int32 index);
60 
61 	virtual	void		VideoStatsChanged();
62 	virtual	void		AudioStatsChanged();
63 
64 	virtual	void		PlaybackStateChanged(uint32 state);
65 	virtual	void		PositionChanged(float position);
66 	virtual	void		SeekHandled(int64 seekFrame);
67 	virtual	void		VolumeChanged(float volume);
68 	virtual	void		MutedChanged(bool muted);
69 
70 private:
71 			uint32		fObserveFlags;
72 };
73 
74 #endif // CONTROLLER_OBSERVER_H
75