xref: /haiku/headers/private/media/MediaRosterEx.h (revision e79e4e7c9e432c90415f79809b7160e864f79001)
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 	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 
41 	status_t SetNodeCreator(media_node_id node, team_id creator);
42 
43 	status_t RegisterNode(BMediaNode * node, media_addon_id addonid, int32 flavorid);
44 	status_t InstantiateDormantNode(media_addon_id addonid, int32 flavorid, team_id creator, media_node *out_node);
45 	status_t GetDormantFlavorInfo(media_addon_id addonid, int32 flavorid, dormant_flavor_info *out_flavor);
46 	status_t GetNode(node_type type, media_node * out_node, int32 * out_input_id = NULL, BString * out_input_name = NULL);
47 	status_t SetNode(node_type type, const media_node *node, const dormant_node_info *info = NULL, const media_input *input = NULL);
48 	status_t GetAllOutputs(const media_node & node, List<media_output> *list);
49 	status_t GetAllOutputs(BBufferProducer *node, List<media_output> *list);
50 	status_t GetAllInputs(const media_node & node, List<media_input> *list);
51 	status_t GetAllInputs(BBufferConsumer *node, List<media_input> *list);
52 	status_t PublishOutputs(const media_node & node, List<media_output> *list);
53 	status_t PublishInputs(const media_node & node, List<media_input> *list);
54 
55 	BTimeSource *MakeTimeSourceObject(media_node_id timesource_id);
56 
57 private:
58 	friend class BMediaRoster;
59 };
60 
61 /* The pointer returned by BMediaRoster::Roster() is always a
62  * BMediaRosterEx object pointer. Use this to convert it.
63  */
64 inline BMediaRosterEx * MediaRosterEx(BMediaRoster *mediaroster)
65 {
66 	return static_cast<BMediaRosterEx *>(mediaroster);
67 }
68 
69 
70 } } // BPrivate::media
71 using namespace BPrivate::media;
72 
73 #endif
74