xref: /haiku/headers/private/media/MediaRosterEx.h (revision 1294543de9ac0eff000eaea1b18368c36435d08e)
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 #ifndef _MEDIA_T_LIST_H
11 	#include "TList.h"
12 #endif
13 #ifndef _DATA_EXCHANGE_H
14 	#include "DataExchange.h"
15 #endif
16 #ifndef _MEDIA_NODE_H
17 	#include <MediaNode.h>
18 #endif
19 #ifndef _MEDIA_ADD_ON_H
20 	#include <MediaAddOn.h>
21 #endif
22 
23 namespace BPrivate { namespace media {
24 
25 /* The BMediaRosterEx class is an extension to the BMediaRoster.
26  * It provides functionality that can be used by the implementation
27  * of media_server, media_addon_server and libmedia.so.
28  * To access it, convert any BMediaRoster pointer in a BMediaRosterEx
29  * pointer using the inline function provided below.
30  */
31 class BMediaRosterEx : public BMediaRoster
32 {
33 public:
34 	BMediaRosterEx(status_t * out_error);
35 	status_t SaveNodeConfiguration(BMediaNode *node);
36 	status_t LoadNodeConfiguration(media_addon_id addonid, int32 flavorid, BMessage *out_msg);
37 
38 	status_t IncrementAddonFlavorInstancesCount(media_addon_id addonid, int32 flavorid);
39 	status_t DecrementAddonFlavorInstancesCount(media_addon_id addonid, int32 flavorid);
40 	status_t ReleaseNodeAll(const media_node& node);
41 
42 	status_t SetNodeCreator(media_node_id node, team_id creator);
43 
44 	status_t RegisterNode(BMediaNode * node, media_addon_id addonid, int32 flavorid);
45 	status_t InstantiateDormantNode(media_addon_id addonid, int32 flavorid, team_id creator, media_node *out_node);
46 	status_t GetDormantFlavorInfo(media_addon_id addonid, int32 flavorid, dormant_flavor_info *out_flavor);
47 	status_t GetNode(node_type type, media_node * out_node, int32 * out_input_id = NULL, BString * out_input_name = NULL);
48 	status_t SetNode(node_type type, const media_node *node, const dormant_node_info *info = NULL, const media_input *input = NULL);
49 	status_t GetAllOutputs(const media_node & node, List<media_output> *list);
50 	status_t GetAllOutputs(BBufferProducer *node, List<media_output> *list);
51 	status_t GetAllInputs(const media_node & node, List<media_input> *list);
52 	status_t GetAllInputs(BBufferConsumer *node, List<media_input> *list);
53 	status_t PublishOutputs(const media_node & node, List<media_output> *list);
54 	status_t PublishInputs(const media_node & node, List<media_input> *list);
55 
56 	BTimeSource *MakeTimeSourceObject(media_node_id timesource_id);
57 
58 private:
59 	friend class BMediaRoster;
60 };
61 
62 /* The pointer returned by BMediaRoster::Roster() is always a
63  * BMediaRosterEx object pointer. Use this to convert it.
64  */
65 inline BMediaRosterEx * MediaRosterEx(BMediaRoster *mediaroster)
66 {
67 	return static_cast<BMediaRosterEx *>(mediaroster);
68 }
69 
70 
71 } } // BPrivate::media
72 using namespace BPrivate::media;
73 
74 #endif
75