MediaClientDefs.h revision d64dd7be
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 uint64 media_client_id;
17typedef uint64 media_client_kinds;
18typedef uint64 media_connection_kinds;
19typedef uint64 media_connection_id;
20
21
22enum 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
31enum media_connection_kind {
32	B_MEDIA_INPUT = 0,
33	B_MEDIA_OUTPUT = 1
34};
35
36
37typedef struct media_client {
38	media_client_id				Id() const;
39	media_client_kinds			Kinds() const;
40
41	BMessage*					ToMessage();
42
43private:
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
55typedef 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
68private:
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	media_connection_id			id;
78
79	media_client				client;
80	// TODO really needed?
81	media_client				remote_client;
82
83    media_source				source;
84    media_destination			destination;
85    media_format				format;
86    char						name[B_MEDIA_NAME_LENGTH];
87
88	media_connection_kinds		kinds;
89	uint32						padding[16];
90
91	friend class BMediaClient;
92	friend class BMediaClientNode;
93	friend class BMediaConnection;
94	friend class BMediaInput;
95	friend class BMediaOutput;
96} media_connection;
97
98
99}
100
101}
102
103using namespace BPrivate::media;
104
105#endif
106