* Rewrote header, adjusted source.

+alphabranch


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32783 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-08-28 14:01:15 +00:00
parent 6abeda1091
commit 17a5db77c0
2 changed files with 308 additions and 329 deletions
+263 -282
View File
@@ -1,24 +1,17 @@
/******************************************************************************* /*
/ * Copyright 2009, Haiku, Inc. All rights reserved.
/ File: MediaNode.h * Distributed under the terms of the MIT License.
/ */
/ Description: BMediaNode is the indirect base class for all Media Kit participants. #ifndef _MEDIA_NODE_H
/ However, you should use the more specific BBufferConsumer, BBufferProducer
/ and others rather than BMediaNode directly. It's OK to multiply inherit.
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_MEDIA_NODE_H)
#define _MEDIA_NODE_H #define _MEDIA_NODE_H
#include <MediaDefs.h> #include <MediaDefs.h>
#include <Point.h> #include <Point.h>
#include <new> #include <new>
class BBufferConsumer; class BBufferConsumer;
class BBufferProducer; class BBufferProducer;
class BControllable; class BControllable;
@@ -28,90 +21,97 @@ class BTimeSource;
class media_node { class media_node {
public: public:
media_node();
~media_node();
media_node(); media_node_id node;
~media_node(); port_id port;
uint32 kind;
media_node_id node; static media_node null;
port_id port;
uint32 kind;
static media_node null;
private: private:
uint32 _reserved_[3]; uint32 _reserved_[3];
}; };
struct media_input { struct media_input {
media_input(); media_input();
~media_input(); ~media_input();
media_node node;
media_source source; media_node node;
media_destination destination; media_source source;
media_format format; media_destination destination;
char name[B_MEDIA_NAME_LENGTH]; media_format format;
char name[B_MEDIA_NAME_LENGTH];
private: private:
uint32 _reserved_media_input_[4]; uint32 _reserved_media_input_[4];
}; };
struct media_output { struct media_output {
media_output(); media_output();
~media_output(); ~media_output();
media_node node;
media_source source; media_node node;
media_destination destination; media_source source;
media_format format; media_destination destination;
char name[B_MEDIA_NAME_LENGTH]; media_format format;
char name[B_MEDIA_NAME_LENGTH];
private: private:
uint32 _reserved_media_output_[4]; uint32 _reserved_media_output_[4];
}; };
struct live_node_info { struct live_node_info {
live_node_info(); live_node_info();
~live_node_info(); ~live_node_info();
media_node node;
BPoint hint_point; media_node node;
char name[B_MEDIA_NAME_LENGTH]; BPoint hint_point;
char name[B_MEDIA_NAME_LENGTH];
private: private:
char reserved[160]; char reserved[160];
}; };
struct media_request_info struct media_request_info {
{ enum what_code {
enum what_code B_SET_VIDEO_CLIPPING_FOR = 1,
{ B_REQUEST_FORMAT_CHANGE,
B_SET_VIDEO_CLIPPING_FOR = 1, B_SET_OUTPUT_ENABLED,
B_REQUEST_FORMAT_CHANGE, B_SET_OUTPUT_BUFFERS_FOR,
B_SET_OUTPUT_ENABLED,
B_SET_OUTPUT_BUFFERS_FOR,
B_FORMAT_CHANGED = 4097 B_FORMAT_CHANGED = 4097
}; };
what_code what;
int32 change_tag; what_code what;
status_t status; int32 change_tag;
int32 cookie; status_t status;
void * user_data; int32 cookie;
media_source source; void* user_data;
media_destination destination; media_source source;
media_format format; media_destination destination;
uint32 _reserved_[32]; media_format format;
uint32 _reserved_[32];
}; };
struct media_node_attribute
{ struct media_node_attribute {
enum { enum {
B_R40_COMPILED = 1, // has this attribute if compiled using R4.0 headers B_R40_COMPILED = 1,
B_USER_ATTRIBUTE_NAME = 0x1000000, B_USER_ATTRIBUTE_NAME = 0x1000000,
B_FIRST_USER_ATTRIBUTE B_FIRST_USER_ATTRIBUTE
}; };
uint32 what;
uint32 flags; // per attribute uint32 what;
int64 data; // per attribute uint32 flags;
int64 data;
}; };
@@ -122,239 +122,220 @@ namespace BPrivate { namespace media {
} } // BPrivate::media } } // BPrivate::media
class BMediaNode /*! BMediaNode is the indirect base class for all Media Kit participants.
{ However, you should use the more specific BBufferConsumer, BBufferProducer
and others rather than BMediaNode directly. It's OK to multiply inherit.
*/
class BMediaNode {
protected: protected:
/* this has to be on top rather than bottom to force a vtable in mwcc */ // NOTE: Call Release() to destroy a node.
virtual ~BMediaNode(); /* should be called through Release() */ virtual ~BMediaNode();
public: public:
enum run_mode {
B_OFFLINE = 1,
// This mode has realtime constraint.
B_DECREASE_PRECISION,
// When late, try to catch up by reducing quality.
B_INCREASE_LATENCY,
// When late, increase the presentation time offset.
B_DROP_DATA,
// When late, try to catch up by dropping buffers.
B_RECORDING
// For nodes on the receiving end of recording.
// Buffers will always be late.
};
enum run_mode { BMediaNode* Acquire();
B_OFFLINE = 1, /* data accurate, no realtime constraint */ BMediaNode* Release();
B_DECREASE_PRECISION, /* when slipping, try to catch up */
B_INCREASE_LATENCY, /* when slipping, increase playout delay */
B_DROP_DATA, /* when slipping, skip data */
B_RECORDING /* you're on the receiving end of recording; buffers are guaranteed to be late */
};
const char* Name() const;
media_node_id ID() const;
uint64 Kinds() const;
media_node Node() const;
run_mode RunMode() const;
BTimeSource* TimeSource() const;
BMediaNode * Acquire(); /* return itself */ // ID of the port used to listen to control messages.
BMediaNode * Release(); /* release will decrement refcount, and delete if 0 */ virtual port_id ControlPort() const;
const char * Name() const; // Who instantiated this node or NULL for application internal class.
media_node_id ID() const; virtual BMediaAddOn* AddOn(int32* internalID) const = 0;
uint64 Kinds() const;
media_node Node() const;
run_mode RunMode() const;
BTimeSource * TimeSource() const;
/* this port is what a media node listens to for commands */ // Message constants which will be sent to anyone watching the
virtual port_id ControlPort() const; // MediaRoster. The message field "be:node_id" will contain the node ID.
enum node_error {
virtual BMediaAddOn* AddOn( // Note that these belong with the notifications in
int32 * internal_id) const = 0; /* Who instantiated you -- or NULL for app class */ // MediaDefs.h! They are here to provide compiler type
// checking in ReportError().
/* These will be sent to anyone watching the MediaRoster. */ B_NODE_FAILED_START = 'TRI0',
/* The message field "be:node_id" will contain the node ID. */ B_NODE_FAILED_STOP = 'TRI1',
enum node_error { B_NODE_FAILED_SEEK = 'TRI2',
/* Note that these belong with the notifications in MediaDefs.h! */ B_NODE_FAILED_SET_RUN_MODE = 'TRI3',
/* They are here to provide compiler type checking in ReportError(). */ B_NODE_FAILED_TIME_WARP = 'TRI4',
B_NODE_FAILED_START = 'TRI0', B_NODE_FAILED_PREROLL = 'TRI5',
B_NODE_FAILED_STOP, // TRI1 B_NODE_FAILED_SET_TIME_SOURCE_FOR = 'TRI6',
B_NODE_FAILED_SEEK, // TRI2 B_NODE_IN_DISTRESS = 'TRI7'
B_NODE_FAILED_SET_RUN_MODE, // TRI3 // What field 'TRIA' and up are used in MediaDefs.h
B_NODE_FAILED_TIME_WARP, // TRI4 };
B_NODE_FAILED_PREROLL, // TRI5
B_NODE_FAILED_SET_TIME_SOURCE_FOR, // TRI6
/* display this node with a blinking exclamation mark or something */
B_NODE_IN_DISTRESS // TRI7
/* TRIA and up are used in MediaDefs.h */
};
protected: protected:
// Sends one of the above codes to anybody who's watching. You can
// provide an optional message with additional information.
status_t ReportError(node_error what,
const BMessage* info = NULL);
/* Send one of the above codes to anybody who's watching. */ // When you've handled a stop request, call this function. If anyone is
status_t ReportError( // listening for stop information from you, they will be notified.
node_error what, // Especially important for offline capable Nodes.
const BMessage * info = NULL); /* String "message" for instance */ status_t NodeStopped(bigtime_t performanceTime);
void TimerExpired(bigtime_t notifyPerformanceTime,
int32 cookie, status_t error = B_OK);
/* When you've handled a stop request, call this function. If anyone is */ // NOTE: Constructor initializes the reference count to 1.
/* listening for stop information from you, they will be notified. Especially */ explicit BMediaNode(const char* name);
/* important for offline capable Nodes. */
status_t NodeStopped(
bigtime_t whenPerformance); // performance time
void TimerExpired(
bigtime_t notifyPoint, // performance time
int32 cookie,
status_t error = B_OK);
explicit BMediaNode( /* constructor sets refcount to 1 */ status_t WaitForMessage(bigtime_t waitUntil,
const char * name); uint32 flags = 0, void* _reserved_ = 0);
status_t WaitForMessage( // These don't return errors; instead, they use the global error condition
bigtime_t waitUntil, // reporter. A node is required to have a queue of at least one pending
uint32 flags = 0, // command (plus TimeWarp) and is recommended to allow for at least one
void * _reserved_ = 0); // pending command of each type. Allowing an arbitrary number of
// outstanding commands might be nice, but apps cannot depend on that
// happening.
virtual void Start(bigtime_t atPerformanceTime);
virtual void Stop(bigtime_t atPerformanceTime,
bool immediate);
virtual void Seek(bigtime_t toMediaTime,
bigtime_t atPerformanceTime);
virtual void SetRunMode(run_mode mode);
virtual void TimeWarp(bigtime_t atRealTime,
bigtime_t toPerformanceTime);
virtual void Preroll();
virtual void SetTimeSource(BTimeSource* timeSource);
/* These don't return errors; instead, they use the global error condition reporter. */ public:
/* A node is required to have a queue of at least one pending command (plus TimeWarp) */ virtual status_t HandleMessage(int32 message, const void* data,
/* and is recommended to allow for at least one pending command of each type. */ size_t size);
/* Allowing an arbitrary number of outstanding commands might be nice, but apps */
/* cannot depend on that happening. */ // Call this with messages you and your superclasses don't recognize.
virtual void Start( void HandleBadMessage(int32 code,
bigtime_t performance_time); const void* buffer, size_t size);
virtual void Stop(
bigtime_t performance_time, // Called from derived system classes; you don't need to
bool immediate); void AddNodeKind(uint64 kind);
virtual void Seek(
bigtime_t media_time, // These just call the default global versions for now.
bigtime_t performance_time); void* operator new(size_t size);
virtual void SetRunMode( void* operator new(size_t size,
run_mode mode); const std::nothrow_t&) throw();
virtual void TimeWarp( void operator delete(void* ptr);
bigtime_t at_real_time, void operator delete(void* ptr,
bigtime_t to_performance_time); const std::nothrow_t&) throw();
virtual void Preroll();
virtual void SetTimeSource( protected:
BTimeSource * time_source); // Hook method which is called when requests have completed, or failed.
virtual status_t RequestCompleted(
const media_request_info & info);
virtual status_t DeleteHook(BMediaNode* node);
virtual void NodeRegistered();
public: public:
virtual status_t HandleMessage( // Fill out your attributes in the provided array, returning however
int32 message, // many you have.
const void * data, virtual status_t GetNodeAttributes(
size_t size); media_node_attribute* _attributes,
void HandleBadMessage( /* call this with messages you and your superclasses don't recognize */ size_t inMaxCount);
int32 code,
const void * buffer,
size_t size);
/* Called from derived system classes; you don't need to */ virtual status_t AddTimer(bigtime_t atPerformanceTime,
void AddNodeKind( int32 cookie);
uint64 kind);
// These were not in 4.0.
// We added them in 4.1 for future use. They just call
// the default global versions for now.
void * operator new(
size_t size);
void * operator new(
size_t size,
const std::nothrow_t &) throw();
void operator delete(
void * ptr);
#if !__MWERKS__
// there's a bug in MWCC under R4.1 and earlier
void operator delete(
void * ptr,
const std::nothrow_t &) throw();
#endif
protected:
/* Called when requests have completed, or failed. */
virtual status_t RequestCompleted( /* reserved 0 */
const media_request_info & info);
private: private:
friend class BTimeSource; friend class BTimeSource;
friend class BMediaRoster; friend class BMediaRoster;
friend class BBufferProducer; // for getting _mNodeID friend class BBufferProducer;
friend class BPrivate::media::TimeSourceObject; friend class BPrivate::media::TimeSourceObject;
friend class BPrivate::media::SystemTimeSourceObject; friend class BPrivate::media::SystemTimeSourceObject;
friend class BPrivate::media::BMediaRosterEx; friend class BPrivate::media::BMediaRosterEx;
// Deprecated in 4.1 // Deprecated in BeOS R4.1
int32 IncrementChangeTag(); int32 IncrementChangeTag();
int32 ChangeTag(); int32 ChangeTag();
int32 MintChangeTag(); int32 MintChangeTag();
status_t ApplyChangeTag( status_t ApplyChangeTag(int32 previouslyReserved);
int32 previously_reserved);
/* Mmmh, stuffing! */
protected:
virtual status_t DeleteHook(BMediaNode * node); /* reserved 1 */
virtual void NodeRegistered(); /* reserved 2 */
public:
/* fill out your attributes in the provided array, returning however many you have. */
virtual status_t GetNodeAttributes( /* reserved 3 */
media_node_attribute * outAttributes,
size_t inMaxCount);
virtual status_t AddTimer(
bigtime_t at_performance_time,
int32 cookie);
private: private:
// FBC padding and forbidden methods
status_t _Reserved_MediaNode_0(void*);
// RequestCompletionHook()
status_t _Reserved_MediaNode_1(void*);
// DeleteHook()
status_t _Reserved_MediaNode_2(void*);
// NodeRegistered()
status_t _Reserved_MediaNode_3(void*);
// GetNodeAttributes()
status_t _Reserved_MediaNode_4(void*);
// AddTimer()
virtual status_t _Reserved_MediaNode_5(void*);
virtual status_t _Reserved_MediaNode_6(void*);
virtual status_t _Reserved_MediaNode_7(void*);
virtual status_t _Reserved_MediaNode_8(void*);
virtual status_t _Reserved_MediaNode_9(void*);
virtual status_t _Reserved_MediaNode_10(void*);
virtual status_t _Reserved_MediaNode_11(void*);
virtual status_t _Reserved_MediaNode_12(void*);
virtual status_t _Reserved_MediaNode_13(void*);
virtual status_t _Reserved_MediaNode_14(void*);
virtual status_t _Reserved_MediaNode_15(void*);
status_t _Reserved_MediaNode_0(void *); /* DeleteHook() */ BMediaNode();
status_t _Reserved_MediaNode_1(void *); /* RequestCompletionHook() */ BMediaNode(const BMediaNode& other);
status_t _Reserved_MediaNode_2(void *); /* NodeRegistered() */ BMediaNode& operator=(const BMediaNode& other);
status_t _Reserved_MediaNode_3(void *); /* GetNodeAttributes() */
status_t _Reserved_MediaNode_4(void *); /* AddTimer() */
virtual status_t _Reserved_MediaNode_5(void *);
virtual status_t _Reserved_MediaNode_6(void *);
virtual status_t _Reserved_MediaNode_7(void *);
virtual status_t _Reserved_MediaNode_8(void *);
virtual status_t _Reserved_MediaNode_9(void *);
virtual status_t _Reserved_MediaNode_10(void *);
virtual status_t _Reserved_MediaNode_11(void *);
virtual status_t _Reserved_MediaNode_12(void *);
virtual status_t _Reserved_MediaNode_13(void *);
virtual status_t _Reserved_MediaNode_14(void *);
virtual status_t _Reserved_MediaNode_15(void *);
BMediaNode(); /* private unimplemented */
BMediaNode(
const BMediaNode & clone);
BMediaNode & operator=(
const BMediaNode & clone);
BMediaNode( /* constructor sets refcount to 1 */
const char * name,
media_node_id id,
uint32 kinds);
void _InitObject(const char *, media_node_id, uint64);
media_node_id fNodeID;
BTimeSource * fTimeSource;
int32 fRefCount;
char fName[B_MEDIA_NAME_LENGTH];
run_mode fRunMode;
int32 _mChangeCount; // deprecated
int32 _mChangeCountReserved; // deprecated
uint64 fKinds;
media_node_id fTimeSourceID;
BBufferProducer * fProducerThis;
BBufferConsumer * fConsumerThis;
BFileInterface * fFileInterfaceThis;
BControllable * fControllableThis;
BTimeSource * fTimeSourceThis;
bool _mReservedBool[4];
mutable port_id fControlPort;
uint32 _reserved_media_node_[8];
protected:
static int32 NewChangeTag(); // for use by BBufferConsumer, mostly
private: private:
// dont' rename this one, it's static and needed for binary compatibility BMediaNode(const char* name,
static int32 _m_changeTag; // not to be confused with _mChangeCount media_node_id id, uint32 kinds);
void _InitObject(const char* name,
media_node_id id, uint64 kinds);
private:
media_node_id fNodeID;
BTimeSource* fTimeSource;
int32 fRefCount;
char fName[B_MEDIA_NAME_LENGTH];
run_mode fRunMode;
int32 _reserved[2];
uint64 fKinds;
media_node_id fTimeSourceID;
BBufferProducer* fProducerThis;
BBufferConsumer* fConsumerThis;
BFileInterface* fFileInterfaceThis;
BControllable* fControllableThis;
BTimeSource* fTimeSourceThis;
bool _reservedBool[4];
mutable port_id fControlPort;
uint32 _reserved_media_node_[8];
protected:
static int32 NewChangeTag();
// for use by BBufferConsumer, mostly
private:
// NOTE: Dont' rename this one, it's static and needed for binary
// compatibility
static int32 _m_changeTag;
// not to be confused with _mChangeCount
}; };
#endif // _MEDIA_NODE_H
#endif /* _MEDIA_NODE_H */
+45 -47
View File
@@ -60,7 +60,7 @@ using std::nothrow_t;
int32 BMediaNode::_m_changeTag = 0; int32 BMediaNode::_m_changeTag = 0;
/************************************************************* /*************************************************************
* media_node * media_node
*************************************************************/ *************************************************************/
// final & verified // final & verified
@@ -84,7 +84,7 @@ media_node::~media_node()
media_node media_node::null; media_node media_node::null;
/************************************************************* /*************************************************************
* media_input * media_input
*************************************************************/ *************************************************************/
// final // final
@@ -99,7 +99,7 @@ media_input::~media_input()
} }
/************************************************************* /*************************************************************
* media_output * media_output
*************************************************************/ *************************************************************/
// final // final
@@ -114,7 +114,7 @@ media_output::~media_output()
} }
/************************************************************* /*************************************************************
* live_node_info * live_node_info
*************************************************************/ *************************************************************/
// final & verified // final & verified
@@ -137,8 +137,8 @@ live_node_info::~live_node_info()
BMediaNode::~BMediaNode() BMediaNode::~BMediaNode()
{ {
CALLED(); CALLED();
// BeBook: UnregisterNode() unregisters a node from the Media Server. It's called automatically // BeBook: UnregisterNode() unregisters a node from the Media Server. It's called automatically
// BeBook: by the BMediaNode destructor, but it might be convenient to call it sometime before // BeBook: by the BMediaNode destructor, but it might be convenient to call it sometime before
// BeBook: you delete your node instance, depending on your implementation and circumstances. // BeBook: you delete your node instance, depending on your implementation and circumstances.
// first we remove the time source // first we remove the time source
@@ -153,7 +153,7 @@ BMediaNode::~BMediaNode()
// shadow object, and the real one still exists // shadow object, and the real one still exists
if (0 == (fKinds & NODE_KIND_SHADOW_TIMESOURCE)) { if (0 == (fKinds & NODE_KIND_SHADOW_TIMESOURCE)) {
BMediaRoster::Roster()->UnregisterNode(this); BMediaRoster::Roster()->UnregisterNode(this);
if (fControlPort > 0) if (fControlPort > 0)
delete_port(fControlPort); delete_port(fControlPort);
} else { } else {
@@ -239,13 +239,13 @@ BTimeSource *
BMediaNode::TimeSource() const BMediaNode::TimeSource() const
{ {
PRINT(7, "CALLED BMediaNode::TimeSource()\n"); PRINT(7, "CALLED BMediaNode::TimeSource()\n");
// return the currently assigned time source // return the currently assigned time source
if (fTimeSource != 0) if (fTimeSource != 0)
return fTimeSource; return fTimeSource;
TRACE("BMediaNode::TimeSource node %ld enter\n", ID()); TRACE("BMediaNode::TimeSource node %ld enter\n", ID());
// If the node doesn't have a time source object, we need to create one. // If the node doesn't have a time source object, we need to create one.
// If the node is still unregistered, we can't call MakeTimeSourceFor(), // If the node is still unregistered, we can't call MakeTimeSourceFor(),
// but since the node does still have the default system time source, we // but since the node does still have the default system time source, we
@@ -305,7 +305,7 @@ BMediaNode::ReportError(node_error what,
ERROR("BMediaNode::ReportError: invalid what!\n"); ERROR("BMediaNode::ReportError: invalid what!\n");
return B_BAD_VALUE; return B_BAD_VALUE;
} }
// Transmits the error code specified by what to anyone // Transmits the error code specified by what to anyone
// that's receiving notifications from this node // that's receiving notifications from this node
return BPrivate::media::notifications::ReportError(Node(), what, info); return BPrivate::media::notifications::ReportError(Node(), what, info);
@@ -318,14 +318,14 @@ BMediaNode::NodeStopped(bigtime_t whenPerformance)
UNIMPLEMENTED(); UNIMPLEMENTED();
// called by derived classes when they have // called by derived classes when they have
// finished handling a stop request. // finished handling a stop request.
// notify anyone who is listening for stop notifications! // notify anyone who is listening for stop notifications!
BPrivate::media::notifications::NodeStopped(Node(), whenPerformance); BPrivate::media::notifications::NodeStopped(Node(), whenPerformance);
// XXX If your node is a BBufferProducer, downstream consumers // XXX If your node is a BBufferProducer, downstream consumers
// XXX will be notified that your node stopped (automatically, no less) // XXX will be notified that your node stopped (automatically, no less)
// XXX through the BBufferConsumer::ProducerDataStatus(B_PRODUCER_STOPPED) call. // XXX through the BBufferConsumer::ProducerDataStatus(B_PRODUCER_STOPPED) call.
return B_OK; return B_OK;
} }
@@ -337,8 +337,8 @@ BMediaNode::TimerExpired(bigtime_t notifyPoint,
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
// Used with AddTimer // Used with AddTimer
// This will, in turn, cause the BMediaRoster::SyncToNode() call // This will, in turn, cause the BMediaRoster::SyncToNode() call
// that instigated the timer to return to the caller. // that instigated the timer to return to the caller.
// Probably only important to classes derived from BTimeSource. // Probably only important to classes derived from BTimeSource.
} }
@@ -358,9 +358,9 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
{ {
TRACE("entering: BMediaNode::WaitForMessage()\n"); TRACE("entering: BMediaNode::WaitForMessage()\n");
// This function waits until either real time specified by // This function waits until either real time specified by
// waitUntil or a message is received on the control port. // waitUntil or a message is received on the control port.
// The flags are currently unused and should be 0. // The flags are currently unused and should be 0.
char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used char data[B_MEDIA_MESSAGE_SIZE]; // about 16 KByte stack used
int32 message; int32 message;
@@ -382,7 +382,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
if (B_OK == BMediaNode::HandleMessage(message, data, size)) if (B_OK == BMediaNode::HandleMessage(message, data, size))
return B_OK; return B_OK;
} }
if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) { if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) {
if (!fProducerThis) if (!fProducerThis)
fProducerThis = dynamic_cast<BBufferProducer *>(this); fProducerThis = dynamic_cast<BBufferProducer *>(this);
@@ -448,7 +448,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
return B_OK; return B_OK;
HandleBadMessage(message, data, size); HandleBadMessage(message, data, size);
return B_ERROR; return B_ERROR;
} }
@@ -458,8 +458,8 @@ BMediaNode::Start(bigtime_t performance_time)
{ {
CALLED(); CALLED();
// This hook function is called when a node is started // This hook function is called when a node is started
// by a call to the BMediaRoster. The specified // by a call to the BMediaRoster. The specified
// performanceTime, the time at which the node // performanceTime, the time at which the node
// should start running, may be in the future. // should start running, may be in the future.
// It may be overriden by derived classes. // It may be overriden by derived classes.
// The BMediaEventLooper class handles this event! // The BMediaEventLooper class handles this event!
@@ -473,8 +473,8 @@ BMediaNode::Stop(bigtime_t performance_time,
{ {
CALLED(); CALLED();
// This hook function is called when a node is stopped // This hook function is called when a node is stopped
// by a call to the BMediaRoster. The specified // by a call to the BMediaRoster. The specified
// performanceTime, the time at which the node // performanceTime, the time at which the node
// should stop running, may be in the future. // should stop running, may be in the future.
// It may be overriden by derived classes. // It may be overriden by derived classes.
// The BMediaEventLooper class handles this event! // The BMediaEventLooper class handles this event!
@@ -488,8 +488,8 @@ BMediaNode::Seek(bigtime_t media_time,
{ {
CALLED(); CALLED();
// This hook function is called when a node is asked // This hook function is called when a node is asked
// to seek to the specified mediaTime by a call to // to seek to the specified mediaTime by a call to
// the BMediaRoster. The specified performanceTime, // the BMediaRoster. The specified performanceTime,
// the time at which the node should begin the seek // the time at which the node should begin the seek
// operation, may be in the future. // operation, may be in the future.
// It may be overriden by derived classes. // It may be overriden by derived classes.
@@ -503,9 +503,9 @@ BMediaNode::SetRunMode(run_mode mode)
{ {
CALLED(); CALLED();
// this is a hook function, and // this is a hook function, and
// may be overriden by derived classes. // may be overriden by derived classes.
// the functionality here is only to // the functionality here is only to
// support those people that don't // support those people that don't
// use the roster to set the run mode // use the roster to set the run mode
@@ -534,12 +534,12 @@ BMediaNode::Preroll()
BMediaNode::SetTimeSource(BTimeSource *time_source) BMediaNode::SetTimeSource(BTimeSource *time_source)
{ {
CALLED(); CALLED();
// this is a hook function, and // this is a hook function, and
// may be overriden by derived classes. // may be overriden by derived classes.
if (time_source == NULL || time_source == fTimeSource) if (time_source == NULL || time_source == fTimeSource)
return; return;
// we just trip into debugger, code that tries to do this is broken. // we just trip into debugger, code that tries to do this is broken.
debugger("BMediaNode::SetTimeSource() can't be used to set a timesource, use BMediaRoster::SetTimeSourceFor()!\n"); debugger("BMediaNode::SetTimeSource() can't be used to set a timesource, use BMediaRoster::SetTimeSourceFor()!\n");
} }
@@ -570,10 +570,10 @@ BMediaNode::HandleMessage(int32 message,
BMessage msg(NODE_FINAL_RELEASE); BMessage msg(NODE_FINAL_RELEASE);
msg.AddPointer("node", this); msg.AddPointer("node", this);
BMediaRoster::Roster()->PostMessage(&msg); BMediaRoster::Roster()->PostMessage(&msg);
return B_OK; return B_OK;
} }
case NODE_START: case NODE_START:
{ {
const node_start_command *command = static_cast<const node_start_command *>(data); const node_start_command *command = static_cast<const node_start_command *>(data);
@@ -622,15 +622,15 @@ BMediaNode::HandleMessage(int32 message,
Preroll(); Preroll();
return B_OK; return B_OK;
} }
case NODE_SET_TIMESOURCE: case NODE_SET_TIMESOURCE:
{ {
const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data); const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data);
TRACE("BMediaNode::HandleMessage NODE_SET_TIMESOURCE, node %ld, timesource %ld enter\n", fNodeID, command->timesource_id); TRACE("BMediaNode::HandleMessage NODE_SET_TIMESOURCE, node %ld, timesource %ld enter\n", fNodeID, command->timesource_id);
fTimeSourceID = command->timesource_id; fTimeSourceID = command->timesource_id;
if (fTimeSource) { if (fTimeSource) {
// as this node already had a timesource, we need // as this node already had a timesource, we need
// we need to remove this node from time source control // we need to remove this node from time source control
@@ -651,7 +651,7 @@ BMediaNode::HandleMessage(int32 message,
return B_OK; return B_OK;
} }
case NODE_GET_TIMESOURCE: case NODE_GET_TIMESOURCE:
{ {
const node_get_timesource_request *request = static_cast<const node_get_timesource_request *>(data); const node_get_timesource_request *request = static_cast<const node_get_timesource_request *>(data);
@@ -669,7 +669,7 @@ BMediaNode::HandleMessage(int32 message,
RequestCompleted(command->info); RequestCompleted(command->info);
return B_OK; return B_OK;
} }
}; };
return B_ERROR; return B_ERROR;
} }
@@ -728,8 +728,8 @@ BMediaNode::operator delete(void *ptr)
::operator delete(ptr); ::operator delete(ptr);
} }
void void
BMediaNode::operator delete(void * ptr, BMediaNode::operator delete(void * ptr,
const nothrow_t &) throw() const nothrow_t &) throw()
{ {
CALLED(); CALLED();
@@ -746,7 +746,7 @@ BMediaNode::RequestCompleted(const media_request_info &info)
CALLED(); CALLED();
// This function is called whenever a request issued by the node is completed. // This function is called whenever a request issued by the node is completed.
// May be overriden by derived classes. // May be overriden by derived classes.
// info.change_tag can be used to match up requests against // info.change_tag can be used to match up requests against
// the accompaning calles from // the accompaning calles from
// BBufferConsumer::RequestFormatChange() // BBufferConsumer::RequestFormatChange()
// BBufferConsumer::SetOutputBuffersFor() // BBufferConsumer::SetOutputBuffersFor()
@@ -826,7 +826,7 @@ BMediaNode::DeleteHook(BMediaNode *node)
BMediaNode::NodeRegistered() BMediaNode::NodeRegistered()
{ {
CALLED(); CALLED();
// The Media Server calls this hook function after the node has been registered. // The Media Server calls this hook function after the node has been registered.
// May be overriden by derived classes. // May be overriden by derived classes.
} }
@@ -891,8 +891,6 @@ BMediaNode::_InitObject(const char *name, media_node_id id, uint64 kinds)
fName[B_MEDIA_NAME_LENGTH - 1] = 0; fName[B_MEDIA_NAME_LENGTH - 1] = 0;
} }
fRunMode = B_INCREASE_LATENCY; fRunMode = B_INCREASE_LATENCY;
_mChangeCount = 0; // deprecated
_mChangeCountReserved = 0; // deprecated
fKinds = kinds; fKinds = kinds;
fProducerThis = 0; fProducerThis = 0;
fConsumerThis = 0; fConsumerThis = 0;
@@ -902,7 +900,7 @@ BMediaNode::_InitObject(const char *name, media_node_id id, uint64 kinds)
// create control port // create control port
fControlPort = create_port(64, fName); fControlPort = create_port(64, fName);
// nodes are assigned the system time source by default // nodes are assigned the system time source by default
fTimeSourceID = NODE_SYSTEM_TIMESOURCE_ID; fTimeSourceID = NODE_SYSTEM_TIMESOURCE_ID;
@@ -930,7 +928,7 @@ BMediaNode::BMediaNode(const char *name,
BMediaNode::NewChangeTag() BMediaNode::NewChangeTag()
{ {
CALLED(); CALLED();
// change tags have been used in BeOS R4 to match up // change tags have been used in BeOS R4 to match up
// format change requests between producer and consumer, // format change requests between producer and consumer,
// This has changed starting with R4.5 // This has changed starting with R4.5
// now "change tags" are used with // now "change tags" are used with