xref: /haiku/headers/private/media/MediaMisc.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
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_MISC_H_
9 #define _MEDIA_MISC_H_
10 
11 #define IS_INVALID_NODE(_node) 			((_node).node <= 0 || (_node).port <= 0)
12 #define IS_INVALID_NODEID(_id) 			((_id) <= 0)
13 #define IS_INVALID_SOURCE(_src)			((_src).port <= 0)
14 #define IS_INVALID_DESTINATION(_dest) 	((_dest).port <= 0)
15 
16 #define NODE_JUST_CREATED_ID			-1
17 #define NODE_UNREGISTERED_ID			-2
18 #define NODE_SYSTEM_TIMESOURCE_ID		1
19 
20 #define BAD_MEDIA_SERVER_PORT			-222
21 #define BAD_MEDIA_ADDON_SERVER_PORT		-444
22 
23 #define IS_SYSTEM_TIMESOURCE(_node)		((_node).node == NODE_SYSTEM_TIMESOURCE_ID)
24 
25 #define NODE_KIND_USER_MASK 			0x00000000FFFFFFFFULL
26 #define NODE_KIND_COMPARE_MASK 			0x000000007FFFFFFFULL
27 #define NODE_KIND_NO_REFCOUNTING		0x0000000080000000ULL
28 #define NODE_KIND_SHADOW_TIMESOURCE		0x0000000100000000ULL
29 
30 #define ROUND_UP_TO_PAGE(size)			(((size) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1))
31 
32 #define MEDIA_SERVER_PORT_NAME			"__media_server_port"
33 #define MEDIA_ADDON_SERVER_PORT_NAME	"__media_addon_server_port"
34 
35 extern const char *B_MEDIA_ADDON_SERVER_SIGNATURE;
36 
37 namespace BPrivate { namespace media {
38 	extern team_id team;
39 } } // BPrivate::media
40 
41 using namespace BPrivate::media;
42 
43 #endif
44