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