xref: /haiku/src/servers/media/DefaultManager.h (revision 5d8765c0af90461ec6f9278592c000940db2b46e)
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 <MediaRoster.h>
25 #include <Message.h>
26 
27 class NodeManager;
28 
29 
30 class DefaultManager {
31 public:
32 								DefaultManager();
33 								~DefaultManager();
34 
35 			status_t 			LoadState();
36 			status_t			SaveState(NodeManager *node_manager);
37 
38 			status_t			Set(media_node_id nodeid,
39 									const char *input_name, int32 input_id,
40 									node_type type);
41 			status_t			Get(media_node_id *nodeid, char *input_name,
42 									int32 *input_id, node_type type);
43 			status_t			Rescan();
44 
45 			void				Dump();
46 
47 			void 				CleanupTeam(team_id team);
48 
49 private:
50 			static int32		rescan_thread(void *arg);
51 			void				_RescanThread();
52 
53 			void				_FindPhysical(volatile media_node_id *id,
54 									uint32 default_type, bool isInput,
55 									media_type type);
56 			void				_FindAudioMixer();
57 			void				_FindTimeSource();
58 
59 			status_t			_ConnectMixerToOutput();
60 
61 private:
62 			volatile bool 		fMixerConnected;
63 			volatile media_node_id fPhysicalVideoOut;
64 			volatile media_node_id fPhysicalVideoIn;
65 			volatile media_node_id fPhysicalAudioOut;
66 			volatile media_node_id fPhysicalAudioIn;
67 			volatile media_node_id fSystemTimeSource;
68 			volatile media_node_id fTimeSource;
69 			volatile media_node_id fAudioMixer;
70 			volatile int32 		fPhysicalAudioOutInputID;
71 			char fPhysicalAudioOutInputName[B_MEDIA_NAME_LENGTH];
72 
73 			BList				fMsgList;
74 
75 			uint32				fBeginHeader[3];
76 			uint32				fEndHeader[3];
77 			thread_id			fRescanThread;
78 			int32 				fRescanRequested;
79 			BLocker				fRescanLock;
80 			BMediaRoster*		fRoster;
81 };
82 
83 #endif // _DEFAULT_MANAGER_H
84