xref: /haiku/headers/private/media/experimental/MediaClientDefs.h (revision 7561d9ac5d923cfbdd36a111157950f66264a601)
1 /*
2  * Copyright 2015, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef _MEDIA_CLIENT_DEFS_H
7 #define _MEDIA_CLIENT_DEFS_H
8 
9 #include <MediaDefs.h>
10 #include <MediaNode.h>
11 
12 
13 namespace BPrivate { namespace media {
14 
15 
16 typedef uint64 media_client_id;
17 typedef uint64 media_client_kinds;
18 typedef uint64 media_connection_kinds;
19 typedef uint64 media_connection_id;
20 
21 
22 enum media_client_kind {
23 	// The client can receive media data.
24 	B_MEDIA_RECORDER		= 0x000000001,
25 	// The client can send media data to another client.
26 	B_MEDIA_PLAYER			= 0x000000002,
27 	// The client specify a control GUI which can be used to configure it.
28 	B_MEDIA_CONTROLLABLE	= 0x000000004
29 };
30 
31 enum media_connection_kind {
32 	B_MEDIA_INPUT = 0,
33 	B_MEDIA_OUTPUT = 1
34 };
35 
36 
37 typedef struct media_client {
38 	media_client_id				Id() const;
39 	media_client_kinds			Kinds() const;
40 
41 	BMessage*					ToMessage();
42 
43 private:
44 	media_client_kinds			kinds;
45 
46 	media_node					node;
47 	uint32						padding[16];
48 
49 	friend class BMediaClient;
50 	friend class BMediaConnection;
51 	friend class media_connection;
52 } media_client;
53 
54 
55 typedef struct media_connection {
56 	media_connection_id			Id() const;
57 	media_connection_kinds		Kinds() const;
58 
59 	const media_client&			Client() const;
60 
61 	const char*					Name() const;
62 
63 	bool						IsInput() const;
64 	bool						IsOutput() const;
65 
66 	BMessage*					ToMessage() const;
67 
68 private:
69 	media_input					MediaInput() const;
70 	media_output				MediaOutput() const;
71 
72 	const media_source&			Source() const;
73 	const media_destination&	Destination() const;
74 
75 	media_node					RemoteNode() const;
76 
77 private:
78 	media_connection_id			id;
79 
80 	media_client				client;
81 	// TODO really needed?
82 	media_client				remote_client;
83 
84     media_source				source;
85     media_destination			destination;
86     media_format				format;
87     char						name[B_MEDIA_NAME_LENGTH];
88 
89 	media_connection_kinds		kinds;
90 	uint32						padding[16];
91 
92 	friend class BMediaClient;
93 	friend class BMediaClientNode;
94 	friend class BMediaConnection;
95 	friend class BMediaInput;
96 	friend class BMediaOutput;
97 } media_connection;
98 
99 
100 }
101 
102 }
103 
104 using namespace BPrivate::media;
105 
106 #endif
107