1/*
2 * Copyright 2002, Marcus Overhagen. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _NOTIFICATIONS_H
6#define _NOTIFICATIONS_H
7
8
9#include <MediaNode.h>
10
11
12#define NOTIFICATION_PARAM_WHAT "be:media:internal:what"
13#define NOTIFICATION_PARAM_TEAM "be:media:internal:team"
14#define NOTIFICATION_PARAM_MESSENGER "be:media:internal:messenger"
15
16
17namespace BPrivate {
18namespace media {
19namespace notifications {
20
21
22/*!	This are the possible notifications that can be watched.
23	The notifications marked with "N" are only send when the
24	media_node specific BMediaRoster::StartWatching() is used
25	and the notification belongs to the watched node.
26
27	In addition, anyone watching a specific node will also receive
28	error notifications generated by BMediaNode::ReportError()
29
30	B_MEDIA_WILDCARD 					used to match any notification in
31										Start/StopWatching
32	B_MEDIA_NODE_CREATED 				"media_node_id" (multiple items)
33	B_MEDIA_NODE_DELETED				"media_node_id" (multiple items)
34	B_MEDIA_CONNECTION_MADE				"output", "input", "format"
35	B_MEDIA_CONNECTION_BROKEN			"source", "destination"
36	B_MEDIA_BUFFER_CREATED				"clone_info" -- handled by BMediaRoster
37	B_MEDIA_BUFFER_DELETED				"media_buffer_id" -- handled by
38										BMediaRoster
39	B_MEDIA_TRANSPORT_STATE				"state", "location", "realtime"
40	B_MEDIA_PARAMETER_CHANGED		N 	"node", "parameter"
41	B_MEDIA_FORMAT_CHANGED			N 	"source", "destination", "format"
42	B_MEDIA_WEB_CHANGED				N 	"node"
43	B_MEDIA_DEFAULT_CHANGED				"default", "node" -- handled by
44										BMediaRoster
45	B_MEDIA_NEW_PARAMETER_VALUE		N 	"node", "parameter", "when", "value"
46	B_MEDIA_NODE_STOPPED			N 	"node", "when"
47	B_MEDIA_FLAVORS_CHANGED				"be:addon_id", "be:new_count",
48										"be:gone_count"
49*/
50
51// used for BMediaRoster::StartWatching() parameter validation
52bool		IsValidNotificationRequest(bool node_specific, int32 notification);
53
54// called by BMediaRoster::StartWatching()
55status_t	Register(const BMessenger& notifyHandler, const media_node& node,
56				int32 notification);
57
58// called by BMediaRoster::StopWatching()
59status_t	Unregister(const BMessenger& notifyHandler, const media_node& node,
60				int32 notification);
61
62// called by BMediaNode::ReportError()
63status_t	ReportError(const media_node& node, BMediaNode::node_error what,
64				const BMessage* info);
65
66void		NodesCreated(const media_node_id* ids, int32 count);
67void		NodesDeleted(const media_node_id* ids, int32 count);
68void		ConnectionMade(const media_input& input, const media_output& output,
69				const media_format& format);
70void		ConnectionBroken(const media_source& source,
71				const media_destination& destination);
72void		BuffersCreated(area_info* areas, int32 count);
73void		BuffersDeleted(const media_buffer_id* ids, int32 count);
74
75// called by BMediaNode::NodeStopped()
76void		NodeStopped(const media_node& node, bigtime_t when);
77
78// called by BControllable::BroadcastChangedParameter()
79status_t	ParameterChanged(const media_node& node, int32 parameterID);
80
81// called by BControllable::SetParameterWeb()
82void		WebChanged(const media_node& node);
83
84// called by BControllable::BroadcastNewParameterValue()
85status_t	NewParameterValue(const media_node& node, int32 parameterID,
86				bigtime_t when, const void* parameter, size_t parameterSize);
87
88// called by the media_addon_server AFTER a flavor change has been
89// handled. NOT CALLED by BMediaAddOn::NotifyFlavorChange()
90void		FlavorsChanged(media_addon_id addOnID, int32 newCount,
91				int32 goneCount);
92
93void		FormatChanged(const media_source& source,
94				const media_destination& destination,
95				const media_format& format);
96
97// TODO: missing: B_MEDIA_TRANSPORT_STATE	"state", "location", "realtime"
98// TODO: missing: B_MEDIA_DEFAULT_CHANGED	"default", "node"
99
100}	// namespace notifications
101}	// namespace media
102}	// namespace BPrivate
103
104#endif // _NOTIFICATIONS_H
105