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