1/*
2 * Copyright (c) 2003 Marcus Overhagen.
3 * All Rights Reserved.
4 *
5 * This file may be used under the terms of the MIT License.
6 */
7#ifndef _MEDIA_ROSTER_EX_H_
8#define _MEDIA_ROSTER_EX_H_
9
10
11#ifndef _MEDIA_T_LIST_H
12	#include "TList.h"
13#endif
14#ifndef _DATA_EXCHANGE_H
15	#include "DataExchange.h"
16#endif
17#ifndef _MEDIA_NODE_H
18	#include <MediaNode.h>
19#endif
20#ifndef _MEDIA_ADD_ON_H
21	#include <MediaAddOn.h>
22#endif
23
24
25namespace BPrivate { namespace media {
26
27
28/* The BMediaRosterEx class is an extension to the BMediaRoster.
29 * It provides functionality that can be used by the implementation
30 * of media_server, media_addon_server and libmedia.so.
31 * To access it, convert any BMediaRoster pointer in a BMediaRosterEx
32 * pointer using the inline function provided below.
33 */
34class BMediaRosterEx : public BMediaRoster
35{
36public:
37							BMediaRosterEx(status_t* out_error);
38		virtual				~BMediaRosterEx();
39
40		virtual void		Quit();
41
42		status_t			SaveNodeConfiguration(BMediaNode* node);
43		status_t 			LoadNodeConfiguration(media_addon_id addonid,
44							int32 flavorid, BMessage* out_msg);
45
46		status_t			IncrementAddonFlavorInstancesCount(
47							media_addon_id addonid, int32 flavorid);
48
49		status_t			DecrementAddonFlavorInstancesCount(
50							media_addon_id addonid, int32 flavorid);
51
52		status_t			ReleaseNodeAll(const media_node& node);
53
54		status_t			SetNodeCreator(media_node_id node, team_id creator);
55
56		status_t			RegisterNode(BMediaNode* node, media_addon_id addonid,
57								int32 flavorid);
58
59		status_t			InstantiateDormantNode(media_addon_id addonid,
60								int32 flavorid, team_id creator, media_node* out_node);
61
62		status_t			GetDormantFlavorInfo(media_addon_id addonid,
63								int32 flavorid, dormant_flavor_info* out_flavor);
64
65		status_t			GetNode(node_type type, media_node* out_node,
66								int32* out_input_id = NULL,
67								BString* out_input_name = NULL);
68
69		status_t			SetNode(node_type type, const media_node* node,
70								const dormant_node_info* info = NULL,
71								const media_input *input = NULL);
72
73		status_t			GetAllOutputs(const media_node& node,
74								List<media_output>* list);
75
76		status_t			GetAllOutputs(BBufferProducer* node,
77								List<media_output>* list);
78
79		status_t			GetAllInputs(const media_node& node,
80								List<media_input>* list);
81
82		status_t			GetAllInputs(BBufferConsumer* node,
83								List<media_input>* list);
84
85		status_t			PublishOutputs(const media_node& node,
86								List<media_output>* list);
87
88		status_t			PublishInputs(const media_node& node,
89								List<media_input>* list);
90
91		BTimeSource*		MakeTimeSourceObject(media_node_id timesource_id);
92
93		status_t			BuildConnections();
94
95		void				RegisterLocalNode(BMediaNode* node);
96		void				UnregisterLocalNode(BMediaNode* node);
97
98		void				EnableLaunchNotification(bool enable,
99								bool autoExit);
100
101private:
102		bool				fLaunchNotification;
103		bool				fAutoExit;
104
105	friend class BMediaRoster;
106};
107
108/* The pointer returned by BMediaRoster::Roster() is always a
109 * BMediaRosterEx object pointer. Use this to convert it.
110 */
111inline BMediaRosterEx* MediaRosterEx(BMediaRoster* mediaroster)
112{
113	return static_cast<BMediaRosterEx*>(mediaroster);
114}
115
116
117} } // BPrivate::media
118using namespace BPrivate::media;
119
120#endif
121