MediaClientDefs.h revision 0cc5ecb8
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
13namespace BPrivate { namespace media {
14
15
16typedef int64 media_client_id;
17typedef int64 media_connection_id;
18
19typedef uint64 media_client_kinds;
20typedef uint64 media_connection_kinds;
21
22
23enum media_client_kind {
24	// The client can receive media data.
25	B_MEDIA_RECORDER		= 0x000000001,
26	// The client can send media data to another client.
27	B_MEDIA_PLAYER			= 0x000000002,
28	// The client specify a control GUI which can be used to configure it.
29	B_MEDIA_CONTROLLABLE	= 0x000000004
30};
31
32enum media_connection_kind {
33	B_MEDIA_INPUT = 0,
34	B_MEDIA_OUTPUT = 1
35};
36
37
38typedef struct media_client {
39	media_client_id				Id() const;
40	media_client_kinds			Kinds() const;
41
42	BMessage*					ToMessage();
43
44private:
45	media_client_kinds			kinds;
46
47	media_node					node;
48	uint32						padding[16];
49
50	friend class BMediaClient;
51	friend class BMediaConnection;
52	friend class media_connection;
53} media_client;
54
55
56typedef struct media_connection {
57	media_connection_id			Id() const;
58	media_connection_kinds		Kinds() const;
59
60	const media_client&			Client() const;
61
62	const char*					Name() const;
63
64	bool						IsInput() const;
65	bool						IsOutput() const;
66
67	BMessage*					ToMessage() const;
68
69private:
70	media_input					_MediaInput() const;
71	media_output				_MediaOutput() const;
72
73	const media_source&			_Source() const;
74	const media_destination&	_Destination() const;
75
76	media_node					_Node() const;
77	media_node					_RemoteNode() const;
78
79	media_connection_id			id;
80
81	media_client				client;
82
83	media_node					remote_node;
84
85    media_source				source;
86    media_destination			destination;
87    media_format				format;
88    char						name[B_MEDIA_NAME_LENGTH];
89
90	media_connection_kinds		kinds;
91	uint32						padding[16];
92
93	friend class BMediaClient;
94	friend class BMediaClientNode;
95	friend class BMediaConnection;
96	friend class BMediaInput;
97	friend class BMediaOutput;
98} media_connection;
99
100
101}
102
103}
104
105using namespace BPrivate::media;
106
107#endif
108