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
11// Used by Haiku apps to make media services notifications
12void
13progress_startup(int stage,
14	bool (*progress)(int stage, const char* message, void* cookie),
15	void* cookie);
16
17void
18progress_shutdown(int stage,
19	bool (*progress)(int stage, const char* message, void* cookie),
20	void* cookie);
21
22
23#define IS_INVALID_NODE(_node) 			((_node).node <= 0 || (_node).port <= 0)
24#define IS_INVALID_NODEID(_id) 			((_id) <= 0)
25#define IS_INVALID_SOURCE(_src)			((_src).port <= 0)
26#define IS_INVALID_DESTINATION(_dest) 	((_dest).port <= 0)
27
28#define NODE_JUST_CREATED_ID			-1
29#define NODE_UNREGISTERED_ID			-2
30#define NODE_SYSTEM_TIMESOURCE_ID		1
31
32#define BAD_MEDIA_SERVER_PORT			-222
33#define BAD_MEDIA_ADDON_SERVER_PORT		-444
34
35#define IS_SYSTEM_TIMESOURCE(_node)		((_node).node == NODE_SYSTEM_TIMESOURCE_ID)
36
37#define NODE_KIND_USER_MASK 			0x00000000FFFFFFFFULL
38#define NODE_KIND_COMPARE_MASK 			0x000000007FFFFFFFULL
39#define NODE_KIND_NO_REFCOUNTING		0x0000000080000000ULL
40#define NODE_KIND_SHADOW_TIMESOURCE		0x0000000100000000ULL
41
42#define ROUND_UP_TO_PAGE(size)			(((size) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1))
43
44#define MEDIA_SERVER_PORT_NAME			"__media_server_port"
45#define MEDIA_ADDON_SERVER_PORT_NAME	"__media_addon_server_port"
46
47extern const char *B_MEDIA_ADDON_SERVER_SIGNATURE;
48
49namespace BPrivate { namespace media {
50	extern team_id team;
51} } // BPrivate::media
52
53using namespace BPrivate::media;
54
55#endif
56