xref: /haiku/headers/private/media/Notifications.h (revision 559a6a891c31b05473b9a50bcf62bbd851633d6c)
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 
17 namespace BPrivate {
18 namespace media {
19 namespace 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
52 bool		IsValidNotificationRequest(bool node_specific, int32 notification);
53 
54 // called by BMediaRoster::StartWatching()
55 status_t	Register(const BMessenger& notifyHandler, const media_node& node,
56 				int32 notification);
57 
58 // called by BMediaRoster::StopWatching()
59 status_t	Unregister(const BMessenger& notifyHandler, const media_node& node,
60 				int32 notification);
61 
62 // called by BMediaNode::ReportError()
63 status_t	ReportError(const media_node& node, BMediaNode::node_error what,
64 				const BMessage* info);
65 
66 void		NodesCreated(const media_node_id* ids, int32 count);
67 void		NodesDeleted(const media_node_id* ids, int32 count);
68 void		ConnectionMade(const media_input& input, const media_output& output,
69 				const media_format& format);
70 void		ConnectionBroken(const media_source& source,
71 				const media_destination& destination);
72 void		BuffersCreated(area_info* areas, int32 count);
73 void		BuffersDeleted(const media_buffer_id* ids, int32 count);
74 
75 // called by BMediaNode::NodeStopped()
76 void		NodeStopped(const media_node& node, bigtime_t when);
77 
78 // called by BControllable::BroadcastChangedParameter()
79 status_t	ParameterChanged(const media_node& node, int32 parameterID);
80 
81 // called by BControllable::SetParameterWeb()
82 void		WebChanged(const media_node& node);
83 
84 // called by BControllable::BroadcastNewParameterValue()
85 status_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()
90 void		FlavorsChanged(media_addon_id addOnID, int32 newCount,
91 				int32 goneCount);
92 
93 void		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