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
47#define BUFFER_TO_RECLAIM				0x20000000
48#define BUFFER_MARKED_FOR_DELETION		0x40000000
49
50
51extern const char *B_MEDIA_ADDON_SERVER_SIGNATURE;
52
53namespace BPrivate { namespace media {
54	extern team_id team;
55} } // BPrivate::media
56
57using namespace BPrivate::media;
58
59#endif
60