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