haiku/headers/private/media/Notifications.h

105 lines
3.7 KiB
C
Raw Normal View History

Sorry for this large commit in advance; it's not really possible to divide this into smaller parts: media_addon_server: * Removed (broken) use of (broken and inefficient) home-brewn Map, and List classes. This also fixes a crash on shutdown when used with the malloc_debug implementation. It's using stl::vector, and stl::map now instead. _shared_buffer_list: * Renamed _shared_buffer_list to SharedBufferList, and put it into the BPrivate namespace. Also, made a class out of it. * Separated shared buffer list creation from cloning. * Enlarged maximum number of buffers to something that is not that evil, but actually uses the space it has (ie. is a useful multiple of shared_buffer_info that fills a multiple of B_PAGE_SIZE as much as possible). * No longer drops into the debugger if the * The list that is currently used is very inefficient for the features it provides though (no change there). _buffer_id_cache: * Renamed to BufferCache, and put it into the private namespace * It now deletes its buffers on deletion; since the BBufferConsumer will be gone, too, at this point, there is little chance that there are still buffers in use. * Also, it's now using std::map instead of the (see above) Map class. BBuffer: * Got rid of the fBufferID member. Misc.: * Got rid of the global "team" variable; the media kit is now using the private app kit's current_team() now. * Added a lot of missing error checks (mostly memory allocations). * Renamed fields like "flavorid" to flavor_id, renamed "dfi_*" fields to something more detailed. * Moved ServerInterface.h from src/servers/media/ to headers/private/media. * Notifications.h was not self contained. * Added missing licenses. * Lots of cleanups, and coding style fixes. What this doesn't fix: * Bug #4954 which started all this (this comes next, though) * Deinitialization is broken, as the PortPool is uninitialized too early, and still used afterwards. * The strange add-on monitoring code in the media_addon_server git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-05 14:11:28 +03:00
/*
* Copyright 2002, Marcus Overhagen. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _NOTIFICATIONS_H
#define _NOTIFICATIONS_H
Sorry for this large commit in advance; it's not really possible to divide this into smaller parts: media_addon_server: * Removed (broken) use of (broken and inefficient) home-brewn Map, and List classes. This also fixes a crash on shutdown when used with the malloc_debug implementation. It's using stl::vector, and stl::map now instead. _shared_buffer_list: * Renamed _shared_buffer_list to SharedBufferList, and put it into the BPrivate namespace. Also, made a class out of it. * Separated shared buffer list creation from cloning. * Enlarged maximum number of buffers to something that is not that evil, but actually uses the space it has (ie. is a useful multiple of shared_buffer_info that fills a multiple of B_PAGE_SIZE as much as possible). * No longer drops into the debugger if the * The list that is currently used is very inefficient for the features it provides though (no change there). _buffer_id_cache: * Renamed to BufferCache, and put it into the private namespace * It now deletes its buffers on deletion; since the BBufferConsumer will be gone, too, at this point, there is little chance that there are still buffers in use. * Also, it's now using std::map instead of the (see above) Map class. BBuffer: * Got rid of the fBufferID member. Misc.: * Got rid of the global "team" variable; the media kit is now using the private app kit's current_team() now. * Added a lot of missing error checks (mostly memory allocations). * Renamed fields like "flavorid" to flavor_id, renamed "dfi_*" fields to something more detailed. * Moved ServerInterface.h from src/servers/media/ to headers/private/media. * Notifications.h was not self contained. * Added missing licenses. * Lots of cleanups, and coding style fixes. What this doesn't fix: * Bug #4954 which started all this (this comes next, though) * Deinitialization is broken, as the PortPool is uninitialized too early, and still used afterwards. * The strange add-on monitoring code in the media_addon_server git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-05 14:11:28 +03:00
#include <MediaNode.h>
#define NOTIFICATION_PARAM_WHAT "be:media:internal:what"
#define NOTIFICATION_PARAM_TEAM "be:media:internal:team"
#define NOTIFICATION_PARAM_MESSENGER "be:media:internal:messenger"
namespace BPrivate {
namespace media {
namespace notifications {
/*! This are the possible notifications that can be watched.
The notifications marked with "N" are only send when the
media_node specific BMediaRoster::StartWatching() is used
and the notification belongs to the watched node.
In addition, anyone watching a specific node will also receive
error notifications generated by BMediaNode::ReportError()
B_MEDIA_WILDCARD used to match any notification in
Start/StopWatching
B_MEDIA_NODE_CREATED "media_node_id" (multiple items)
B_MEDIA_NODE_DELETED "media_node_id" (multiple items)
B_MEDIA_CONNECTION_MADE "output", "input", "format"
B_MEDIA_CONNECTION_BROKEN "source", "destination"
B_MEDIA_BUFFER_CREATED "clone_info" -- handled by BMediaRoster
B_MEDIA_BUFFER_DELETED "media_buffer_id" -- handled by
BMediaRoster
B_MEDIA_TRANSPORT_STATE "state", "location", "realtime"
B_MEDIA_PARAMETER_CHANGED N "node", "parameter"
B_MEDIA_FORMAT_CHANGED N "source", "destination", "format"
B_MEDIA_WEB_CHANGED N "node"
B_MEDIA_DEFAULT_CHANGED "default", "node" -- handled by
BMediaRoster
B_MEDIA_NEW_PARAMETER_VALUE N "node", "parameter", "when", "value"
B_MEDIA_NODE_STOPPED N "node", "when"
B_MEDIA_FLAVORS_CHANGED "be:addon_id", "be:new_count",
"be:gone_count"
*/
// used for BMediaRoster::StartWatching() parameter validation
bool IsValidNotificationRequest(bool node_specific, int32 notification);
// called by BMediaRoster::StartWatching()
status_t Register(const BMessenger& notifyHandler, const media_node& node,
int32 notification);
// called by BMediaRoster::StopWatching()
status_t Unregister(const BMessenger& notifyHandler, const media_node& node,
int32 notification);
// called by BMediaNode::ReportError()
status_t ReportError(const media_node& node, BMediaNode::node_error what,
const BMessage* info);
void NodesCreated(const media_node_id* ids, int32 count);
void NodesDeleted(const media_node_id* ids, int32 count);
void ConnectionMade(const media_input& input, const media_output& output,
const media_format& format);
void ConnectionBroken(const media_source& source,
const media_destination& destination);
void BuffersCreated(area_info* areas, int32 count);
void BuffersDeleted(const media_buffer_id* ids, int32 count);
// called by BMediaNode::NodeStopped()
void NodeStopped(const media_node& node, bigtime_t when);
// called by BControllable::BroadcastChangedParameter()
status_t ParameterChanged(const media_node& node, int32 parameterID);
// called by BControllable::SetParameterWeb()
void WebChanged(const media_node& node);
// called by BControllable::BroadcastNewParameterValue()
status_t NewParameterValue(const media_node& node, int32 parameterID,
bigtime_t when, const void* parameter, size_t parameterSize);
// called by the media_addon_server AFTER a flavor change has been
// handled. NOT CALLED by BMediaAddOn::NotifyFlavorChange()
void FlavorsChanged(media_addon_id addOnID, int32 newCount,
int32 goneCount);
void FormatChanged(const media_source& source,
const media_destination& destination,
const media_format& format);
// TODO: missing: B_MEDIA_TRANSPORT_STATE "state", "location", "realtime"
// TODO: missing: B_MEDIA_DEFAULT_CHANGED "default", "node"
} // namespace notifications
} // namespace media
} // namespace BPrivate
#endif // _NOTIFICATIONS_H