xref: /haiku/src/servers/media/DefaultManager.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2010, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Marcus Overhagen
7  *		Jérôme Duval
8  */
9 /*
10  * Copyright 2002, Marcus Overhagen. All rights reserved.
11  * Distributed under the terms of the MIT License.
12  */
13 #ifndef _DEFAULT_MANAGER_H
14 #define _DEFAULT_MANAGER_H
15 
16 
17 /*!	Manager for defaults (audio and video, input and output)
18 */
19 
20 
21 #include "DataExchange.h"
22 
23 #include <Autolock.h>
24 #include <Message.h>
25 
26 class NodeManager;
27 
28 
29 class DefaultManager {
30 public:
31 								DefaultManager();
32 								~DefaultManager();
33 
34 			status_t 			LoadState();
35 			status_t			SaveState(NodeManager *node_manager);
36 
37 			status_t			Set(media_node_id nodeid,
38 									const char *input_name, int32 input_id,
39 									node_type type);
40 			status_t			Get(media_node_id *nodeid, char *input_name,
41 									int32 *input_id, node_type type);
42 			status_t			Rescan();
43 
44 			void				Dump();
45 
46 			void 				CleanupTeam(team_id team);
47 
48 private:
49 			static int32		rescan_thread(void *arg);
50 			void				_RescanThread();
51 
52 			void				_FindPhysical(volatile media_node_id *id,
53 									uint32 default_type, bool isInput,
54 									media_type type);
55 			void				_FindAudioMixer();
56 			void				_FindTimeSource();
57 
58 			status_t			_ConnectMixerToOutput();
59 
60 private:
61 			volatile bool 		fMixerConnected;
62 			volatile media_node_id fPhysicalVideoOut;
63 			volatile media_node_id fPhysicalVideoIn;
64 			volatile media_node_id fPhysicalAudioOut;
65 			volatile media_node_id fPhysicalAudioIn;
66 			volatile media_node_id fSystemTimeSource;
67 			volatile media_node_id fTimeSource;
68 			volatile media_node_id fAudioMixer;
69 			volatile int32 		fPhysicalAudioOutInputID;
70 			char fPhysicalAudioOutInputName[B_MEDIA_NAME_LENGTH];
71 
72 			BList				fMsgList;
73 
74 			uint32				fBeginHeader[3];
75 			uint32				fEndHeader[3];
76 			thread_id			fRescanThread;
77 			vint32 				fRescanRequested;
78 			BLocker				fRescanLock;
79 };
80 
81 #endif // _DEFAULT_MANAGER_H
82