updated to include the same features/bugs as the screenshot in today's news.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -128,9 +128,9 @@ virtual status_t _Reserved_Controllable_13(void *);
|
||||
virtual status_t _Reserved_Controllable_14(void *);
|
||||
virtual status_t _Reserved_Controllable_15(void *);
|
||||
|
||||
BParameterWeb * _mWeb;
|
||||
sem_id _m_webSem;
|
||||
int32 _m_webBen;
|
||||
BParameterWeb * fWeb;
|
||||
sem_id fSem;
|
||||
int32 fBen;
|
||||
uint32 _reserved_controllable_[14];
|
||||
};
|
||||
|
||||
|
||||
@@ -307,6 +307,8 @@ virtual status_t _Reserved_MediaNode_15(void *);
|
||||
const char * name,
|
||||
media_node_id id,
|
||||
uint32 kinds);
|
||||
|
||||
void _InitObject(const char *, media_node_id, uint64);
|
||||
|
||||
media_node_id fNodeID;
|
||||
BTimeSource * fTimeSource;
|
||||
@@ -317,11 +319,18 @@ virtual status_t _Reserved_MediaNode_15(void *);
|
||||
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_[13];
|
||||
uint32 _reserved_media_node_[8];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ enum {
|
||||
|
||||
// Raw port based communication
|
||||
enum {
|
||||
SERVER_GET_NODE = 0x1000,
|
||||
SERVER_MESSAGE_START = 0x100,
|
||||
SERVER_GET_NODE,
|
||||
SERVER_SET_NODE,
|
||||
SERVER_PUBLISH_INPUTS,
|
||||
SERVER_PUBLISH_OUTPUTS,
|
||||
@@ -80,17 +81,63 @@ enum {
|
||||
SERVER_UNREGISTER_NODE,
|
||||
SERVER_GET_DORMANT_NODE_FOR,
|
||||
SERVER_GET_INSTANCES_FOR,
|
||||
CONSUMER_GET_NEXT_INPUT = 0x2000,
|
||||
SERVER_MESSAGE_END,
|
||||
NODE_MESSAGE_START = 0x200,
|
||||
|
||||
NODE_START,
|
||||
NODE_STOP,
|
||||
NODE_SEEK,
|
||||
NODE_SET_RUN_MODE,
|
||||
NODE_TIME_WARP,
|
||||
NODE_PREROLL,
|
||||
NODE_SET_TIMESOURCE,
|
||||
NODE_REQUEST_COMPLETED,
|
||||
|
||||
NODE_MESSAGE_END,
|
||||
CONSUMER_MESSAGE_START = 0x300,
|
||||
CONSUMER_GET_NEXT_INPUT,
|
||||
CONSUMER_DISPOSE_INPUT_COOKIE,
|
||||
CONSUMER_ACCEPT_FORMAT,
|
||||
CONSUMER_CONNECTED,
|
||||
CONSUMER_DISCONNECTED,
|
||||
PRODUCER_GET_NEXT_OUTPUT = 0x3000,
|
||||
|
||||
CONSUMER_BUFFER_RECEIVED,
|
||||
CONSUMER_PRODUCER_DATA_STATUS,
|
||||
CONSUMER_GET_LATENCY_FOR,
|
||||
CONSUMER_FORMAT_CHANGED,
|
||||
CONSUMER_SEEK_TAG_REQUESTED,
|
||||
|
||||
CONSUMER_MESSAGE_END,
|
||||
PRODUCER_MESSAGE_START = 0x400,
|
||||
PRODUCER_GET_NEXT_OUTPUT,
|
||||
PRODUCER_DISPOSE_OUTPUT_COOKIE,
|
||||
PRODUCER_FORMAT_PROPOSAL,
|
||||
PRODUCER_PREPARE_TO_CONNECT,
|
||||
PRODUCER_CONNECT,
|
||||
PRODUCER_DISCONNECT,
|
||||
|
||||
PRODUCER_LATE_NOTICE_RECEIVED,
|
||||
PRODUCER_LATENCY_CHANGED,
|
||||
PRODUCER_ADDITIONAL_BUFFER_REQUESTED,
|
||||
PRODUCER_VIDEO_CLIPPING_CHANGED,
|
||||
PRODUCER_FORMAT_CHANGE_REQUESTED,
|
||||
PRODUCER_SET_BUFFER_GROUP,
|
||||
PRODUCER_GET_LATENCY,
|
||||
PRODUCER_GET_INITIAL_LATENCY,
|
||||
PRODUCER_FORMAT_SUGGESTION_REQUESTED,
|
||||
PRODUCER_SET_PLAY_RATE,
|
||||
PRODUCER_ENABLE_OUTPUT,
|
||||
|
||||
PRODUCER_MESSAGE_END,
|
||||
FILEINTERFACE_MESSAGE_START = 0x500,
|
||||
FILEINTERFACE_MESSAGE_END,
|
||||
CONTROLLABLE_MESSAGE_START = 0x600,
|
||||
CONTROLLABLE_MESSAGE_END,
|
||||
TIMESOURECE_MESSAGE_START = 0x700,
|
||||
|
||||
TIMESOURCE_OP, // datablock is a struct time_source_op_info
|
||||
|
||||
TIMESOURECE_MESSAGE_END,
|
||||
};
|
||||
|
||||
// used by SERVER_GET_NODE and SERVER_SET_NODE
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <BufferGroup.h>
|
||||
#include <Buffer.h>
|
||||
#include <malloc.h>
|
||||
#define DEBUG 3
|
||||
#include "debug.h"
|
||||
#include "DataExchange.h"
|
||||
#include "ServerInterface.h"
|
||||
@@ -326,7 +327,8 @@ BBufferConsumer::HandleMessage(int32 message,
|
||||
const void *rawdata,
|
||||
size_t size)
|
||||
{
|
||||
CALLED();
|
||||
// CALLED();
|
||||
TRACE("BBufferConsumer::HandleMessage %#lx, node %ld\n", message, ID());
|
||||
status_t rv;
|
||||
switch (message) {
|
||||
case CONSUMER_ACCEPT_FORMAT:
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
#include <BufferProducer.h>
|
||||
#include <BufferGroup.h>
|
||||
#include <Buffer.h>
|
||||
#include "PortPool.h"
|
||||
#define DEBUG 3
|
||||
#include "debug.h"
|
||||
#include "PortPool.h"
|
||||
#include "DataExchange.h"
|
||||
#include "ServerInterface.h"
|
||||
|
||||
@@ -103,7 +104,8 @@ BBufferProducer::HandleMessage(int32 message,
|
||||
const void *rawdata,
|
||||
size_t size)
|
||||
{
|
||||
CALLED();
|
||||
// CALLED();
|
||||
TRACE("BBufferProducer::HandleMessage %#lx, node %ld\n", message, fNodeID);
|
||||
status_t rv;
|
||||
switch (message) {
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* FILE: Controllable.cpp
|
||||
* DESCR:
|
||||
***********************************************************************/
|
||||
#include <OS.h>
|
||||
#include <Controllable.h>
|
||||
#include "debug.h"
|
||||
#include "Notifications.h"
|
||||
@@ -13,7 +14,9 @@
|
||||
|
||||
BControllable::~BControllable()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (fSem > 0)
|
||||
delete_sem(fSem);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -23,17 +26,28 @@ BControllable::~BControllable()
|
||||
BParameterWeb *
|
||||
BControllable::Web()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
CALLED();
|
||||
BParameterWeb *temp;
|
||||
LockParameterWeb();
|
||||
temp = fWeb;
|
||||
UnlockParameterWeb();
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BControllable::LockParameterWeb()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return false;
|
||||
CALLED();
|
||||
status_t rv;
|
||||
if (fSem <= 0)
|
||||
return false;
|
||||
if (atomic_add(&fBen, 1) > 0) {
|
||||
while (B_INTERRUPTED == (rv = acquire_sem(fSem)))
|
||||
;
|
||||
return rv == B_OK;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -43,14 +57,21 @@ BControllable::LockParameterWeb()
|
||||
void
|
||||
BControllable::UnlockParameterWeb()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (fSem <= 0)
|
||||
return;
|
||||
if (atomic_add(&fBen, -1) > 1)
|
||||
release_sem(fSem);
|
||||
}
|
||||
|
||||
|
||||
BControllable::BControllable()
|
||||
: BMediaNode("XXX fixme")
|
||||
BControllable::BControllable() :
|
||||
BMediaNode("XXX fixme"),
|
||||
fWeb(0),
|
||||
fSem(create_sem(0, "BControllable lock")),
|
||||
fBen(0)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
|
||||
AddNodeKind(B_CONTROLLABLE);
|
||||
}
|
||||
@@ -59,11 +80,16 @@ BControllable::BControllable()
|
||||
status_t
|
||||
BControllable::SetParameterWeb(BParameterWeb *web)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
BPrivate::media::notifications::WebChanged(Node());
|
||||
CALLED();
|
||||
BParameterWeb *old;
|
||||
LockParameterWeb();
|
||||
old = fWeb;
|
||||
fWeb = web;
|
||||
UnlockParameterWeb();
|
||||
if (old != web && web != 0)
|
||||
BPrivate::media::notifications::WebChanged(Node());
|
||||
|
||||
return B_ERROR;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +98,7 @@ BControllable::HandleMessage(int32 message,
|
||||
const void *data,
|
||||
size_t size)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
TRACE("BControllable::HandleMessage %#lx, node %ld\n", message, ID());
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "DataExchange.h"
|
||||
#include "ServerInterface.h" // NEW_MEDIA_SERVER_SIGNATURE
|
||||
|
||||
#define TIMEOUT 100000
|
||||
#define TIMEOUT 2000000
|
||||
|
||||
namespace BPrivate {
|
||||
namespace media {
|
||||
@@ -103,9 +103,9 @@ status_t QueryAddonServer(int32 msgcode, request_data *request, int requestsize,
|
||||
status_t SendToPort(port_id sendport, int32 msgcode, void *msg, int size)
|
||||
{
|
||||
status_t rv;
|
||||
rv = write_port(sendport, msgcode, msg, size);
|
||||
rv = write_port_etc(sendport, msgcode, msg, size, B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||
if (rv != B_OK)
|
||||
TRACE("SendToPort: write_port failed, port %#lx, error %#lx (%s)\n", sendport, rv, strerror(rv));
|
||||
TRACE("SendToPort: write_port failed, port %ld, error %#lx (%s)\n", sendport, rv, strerror(rv));
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -117,18 +117,18 @@ status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, in
|
||||
|
||||
request->reply_port = _PortPool->GetPort();
|
||||
|
||||
rv = write_port(requestport, msgcode, request, requestsize);
|
||||
rv = write_port_etc(requestport, msgcode, request, requestsize, B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||
if (rv != B_OK) {
|
||||
TRACE("QueryPort: write_port failed, port %#lx, error %#lx (%s)\n", requestport, rv, strerror(rv));
|
||||
TRACE("QueryPort: write_port failed, port %ld, error %#lx (%s)\n", requestport, rv, strerror(rv));
|
||||
_PortPool->PutPort(request->reply_port);
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = read_port(request->reply_port, &code, reply, replysize);
|
||||
rv = read_port_etc(request->reply_port, &code, reply, replysize, B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||
_PortPool->PutPort(request->reply_port);
|
||||
|
||||
if (rv < B_OK)
|
||||
TRACE("QueryPort: read_port failed, port %#lx, error %#lx (%s)\n", request->reply_port, rv, strerror(rv));
|
||||
TRACE("QueryPort: read_port failed, port %ld, error %#lx (%s)\n", request->reply_port, rv, strerror(rv));
|
||||
|
||||
return (rv < B_OK) ? rv : reply->result;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* DESCR:
|
||||
***********************************************************************/
|
||||
#include <FileInterface.h>
|
||||
#define DEBUG 3
|
||||
#include "debug.h"
|
||||
|
||||
/*************************************************************
|
||||
@@ -39,7 +40,7 @@ BFileInterface::HandleMessage(int32 message,
|
||||
const void *data,
|
||||
size_t size)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
TRACE("BFileInterface::HandleMessage %#lx, node %ld\n", message, ID());
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <MediaAddOn.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#define DEBUG 3
|
||||
#include "debug.h"
|
||||
#include "PortPool.h"
|
||||
#include "ServerInterface.h"
|
||||
@@ -37,14 +38,12 @@ dormant_node_info::dormant_node_info()
|
||||
: addon(-1),
|
||||
flavor_id(-1)
|
||||
{
|
||||
CALLED();
|
||||
name[0] = '\0';
|
||||
}
|
||||
|
||||
// final
|
||||
dormant_node_info::~dormant_node_info()
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -63,7 +62,6 @@ flavor_info &flavor_info::operator=(const flavor_info &other)
|
||||
// final & verified
|
||||
dormant_flavor_info::dormant_flavor_info()
|
||||
{
|
||||
CALLED();
|
||||
name = 0;
|
||||
info = 0;
|
||||
kinds = 0;
|
||||
@@ -82,7 +80,6 @@ dormant_flavor_info::dormant_flavor_info()
|
||||
/* virtual */
|
||||
dormant_flavor_info::~dormant_flavor_info()
|
||||
{
|
||||
CALLED();
|
||||
delete [] name;
|
||||
delete [] info;
|
||||
delete [] in_formats;
|
||||
@@ -99,7 +96,6 @@ dormant_flavor_info::dormant_flavor_info(const dormant_flavor_info &clone)
|
||||
dormant_flavor_info &
|
||||
dormant_flavor_info::operator=(const dormant_flavor_info &clone)
|
||||
{
|
||||
CALLED();
|
||||
// call operator=(const flavor_info &clone) to copy the flavor_info base class
|
||||
*this = static_cast<const flavor_info>(clone);
|
||||
// copy the dormant_node_info member variable
|
||||
@@ -111,7 +107,6 @@ dormant_flavor_info::operator=(const dormant_flavor_info &clone)
|
||||
dormant_flavor_info &
|
||||
dormant_flavor_info::operator=(const flavor_info &clone)
|
||||
{
|
||||
CALLED();
|
||||
delete [] name;
|
||||
delete [] info;
|
||||
delete [] in_formats;
|
||||
@@ -161,7 +156,6 @@ dormant_flavor_info::operator=(const flavor_info &clone)
|
||||
void
|
||||
dormant_flavor_info::set_name(const char *in_name)
|
||||
{
|
||||
CALLED();
|
||||
delete [] name;
|
||||
name = newstrdup(in_name);
|
||||
}
|
||||
@@ -170,7 +164,6 @@ dormant_flavor_info::set_name(const char *in_name)
|
||||
void
|
||||
dormant_flavor_info::set_info(const char *in_info)
|
||||
{
|
||||
CALLED();
|
||||
delete [] info;
|
||||
info = newstrdup(in_info);
|
||||
}
|
||||
@@ -179,7 +172,6 @@ dormant_flavor_info::set_info(const char *in_info)
|
||||
void
|
||||
dormant_flavor_info::add_in_format(const media_format &in_format)
|
||||
{
|
||||
CALLED();
|
||||
media_format *temp;
|
||||
temp = new media_format[in_format_count + 1];
|
||||
for (int i = 0; i < in_format_count; i++)
|
||||
@@ -194,7 +186,6 @@ dormant_flavor_info::add_in_format(const media_format &in_format)
|
||||
void
|
||||
dormant_flavor_info::add_out_format(const media_format &out_format)
|
||||
{
|
||||
CALLED();
|
||||
media_format *temp;
|
||||
temp = new media_format[out_format_count + 1];
|
||||
for (int i = 0; i < out_format_count; i++)
|
||||
@@ -209,7 +200,6 @@ dormant_flavor_info::add_out_format(const media_format &out_format)
|
||||
/* virtual */ bool
|
||||
dormant_flavor_info::IsFixedSize() const
|
||||
{
|
||||
CALLED();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -217,7 +207,6 @@ dormant_flavor_info::IsFixedSize() const
|
||||
/* virtual */ type_code
|
||||
dormant_flavor_info::TypeCode() const
|
||||
{
|
||||
CALLED();
|
||||
return FLATTEN_TYPECODE;
|
||||
}
|
||||
|
||||
@@ -254,7 +243,6 @@ dormant_flavor_info::FlattenedSize() const
|
||||
dormant_flavor_info::Flatten(void *buffer,
|
||||
ssize_t size) const
|
||||
{
|
||||
CALLED();
|
||||
if (size < FlattenedSize())
|
||||
return B_ERROR;
|
||||
|
||||
@@ -307,7 +295,6 @@ dormant_flavor_info::Unflatten(type_code c,
|
||||
const void *buffer,
|
||||
ssize_t size)
|
||||
{
|
||||
CALLED();
|
||||
if (c != FLATTEN_TYPECODE)
|
||||
return B_ERROR;
|
||||
if (size < 8)
|
||||
|
||||
@@ -359,7 +359,7 @@ bool operator==(const media_format & a, const media_format & b)
|
||||
bool format_is_compatible(const media_format & a, const media_format & b) /* a is the format you want to feed to something accepting b */
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool string_for_format(const media_format & f, char * buf, size_t size)
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
#include <Controllable.h>
|
||||
#include <FileInterface.h>
|
||||
#include <string.h>
|
||||
#include "SystemTimeSource.h"
|
||||
#define DEBUG 3
|
||||
#include <Debug.h>
|
||||
#include "debug.h"
|
||||
#include "DataExchange.h"
|
||||
#include "SystemTimeSource.h"
|
||||
#include "ServerInterface.h"
|
||||
#include "Notifications.h"
|
||||
|
||||
@@ -30,13 +32,11 @@ media_node::media_node()
|
||||
port(-1),
|
||||
kind(0)
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
// final & verified
|
||||
media_node::~media_node()
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -53,14 +53,12 @@ media_node media_node::null;
|
||||
// final
|
||||
media_input::media_input()
|
||||
{
|
||||
CALLED();
|
||||
name[0] = '\0';
|
||||
}
|
||||
|
||||
// final
|
||||
media_input::~media_input()
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -70,14 +68,12 @@ media_input::~media_input()
|
||||
// final
|
||||
media_output::media_output()
|
||||
{
|
||||
CALLED();
|
||||
name[0] = '\0';
|
||||
}
|
||||
|
||||
// final
|
||||
media_output::~media_output()
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -88,14 +84,12 @@ media_output::~media_output()
|
||||
live_node_info::live_node_info()
|
||||
: hint_point(0.0f,0.0f)
|
||||
{
|
||||
CALLED();
|
||||
name[0] = '\0';
|
||||
}
|
||||
|
||||
// final & verified
|
||||
live_node_info::~live_node_info()
|
||||
{
|
||||
CALLED();
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -194,6 +188,8 @@ BTimeSource *
|
||||
BMediaNode::TimeSource() const
|
||||
{
|
||||
CALLED();
|
||||
if (fTimeSource == 0)
|
||||
const_cast<BMediaNode *>(this)->fTimeSource = new _SysTimeSource;
|
||||
return fTimeSource;
|
||||
}
|
||||
|
||||
@@ -269,15 +265,11 @@ BMediaNode::TimerExpired(bigtime_t notifyPoint,
|
||||
}
|
||||
|
||||
|
||||
// terrible hack to call the other constructor
|
||||
// BMediaNode::BMediaNode(const char *name, media_node_id id, uint32 kinds)
|
||||
extern "C" void __10BMediaNodePCclUl(BMediaNode *self, const char *name, media_node_id id, uint32 kinds);
|
||||
|
||||
/* explicit */
|
||||
BMediaNode::BMediaNode(const char *name)
|
||||
{
|
||||
CALLED();
|
||||
__10BMediaNodePCclUl(this,name,-1,0);
|
||||
TRACE("BMediaNode::BMediaNode: name '%s'\n", name);
|
||||
_InitObject(name, -1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -287,6 +279,7 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
|
||||
void *_reserved_)
|
||||
{
|
||||
CALLED();
|
||||
ASSERT(this != 0);
|
||||
// This function waits until either real time specified by
|
||||
// waitUntil or a message is received on the control port.
|
||||
// The flags are currently unused and should be 0.
|
||||
@@ -298,10 +291,59 @@ BMediaNode::WaitForMessage(bigtime_t waitUntil,
|
||||
size = read_port_etc(fControlPort, &message, data, sizeof(data), B_ABSOLUTE_TIMEOUT, waitUntil);
|
||||
if (size <= 0) {
|
||||
if (size != B_TIMED_OUT)
|
||||
TRACE("read_port_etc error 0x%08lx\n",size);
|
||||
TRACE("BMediaNode::WaitForMessage: read_port_etc error 0x%08lx\n",size);
|
||||
return size; // returns the error code
|
||||
}
|
||||
|
||||
TRACE("BMediaNode::WaitForMessage %#lx, node %ld, this %p\n", message, fNodeID, this);
|
||||
|
||||
if (message > NODE_MESSAGE_START && message < NODE_MESSAGE_END) {
|
||||
TRACE("BMediaNode::WaitForMessage calling BMediaNode\n");
|
||||
if (B_OK == BMediaNode::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (message > PRODUCER_MESSAGE_START && message < PRODUCER_MESSAGE_END) {
|
||||
if (!fProducerThis)
|
||||
fProducerThis = dynamic_cast<BBufferProducer *>(this);
|
||||
TRACE("BMediaNode::WaitForMessage calling BBufferProducer %p\n", fProducerThis);
|
||||
if (fProducerThis && B_OK == fProducerThis->BBufferProducer::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (message > CONSUMER_MESSAGE_START && message < CONSUMER_MESSAGE_END) {
|
||||
if (!fConsumerThis)
|
||||
fConsumerThis = dynamic_cast<BBufferConsumer *>(this);
|
||||
TRACE("BMediaNode::WaitForMessage calling BBufferConsumer %p\n", fConsumerThis);
|
||||
if (fConsumerThis && B_OK == fConsumerThis->BBufferConsumer::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (message > FILEINTERFACE_MESSAGE_START && message < FILEINTERFACE_MESSAGE_END) {
|
||||
if (!fFileInterfaceThis)
|
||||
fFileInterfaceThis = dynamic_cast<BFileInterface *>(this);
|
||||
TRACE("BMediaNode::WaitForMessage calling BFileInterface %p\n", fFileInterfaceThis);
|
||||
if (fFileInterfaceThis && B_OK == fFileInterfaceThis->BFileInterface::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (fControllableThis && message > CONTROLLABLE_MESSAGE_START && message < CONTROLLABLE_MESSAGE_END) {
|
||||
if (!fControllableThis)
|
||||
fControllableThis = dynamic_cast<BControllable *>(this);
|
||||
TRACE("BMediaNode::WaitForMessage calling BControllable %p\n", fControllableThis);
|
||||
if (fControllableThis && B_OK == fControllableThis->BControllable::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
if (fTimeSourceThis && message > TIMESOURECE_MESSAGE_START && message < TIMESOURECE_MESSAGE_END) {
|
||||
if (!fTimeSourceThis)
|
||||
fTimeSourceThis = dynamic_cast<BTimeSource *>(this);
|
||||
TRACE("BMediaNode::WaitForMessage calling BTimeSource %p\n", fTimeSourceThis);
|
||||
if (fTimeSourceThis && B_OK == fTimeSourceThis->BTimeSource::HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
TRACE("BMediaNode::WaitForMessage calling default\n");
|
||||
if (B_OK == HandleMessage(message, data, size))
|
||||
return B_OK;
|
||||
|
||||
@@ -392,6 +434,7 @@ BMediaNode::Preroll()
|
||||
BMediaNode::SetTimeSource(BTimeSource *time_source)
|
||||
{
|
||||
CALLED();
|
||||
return;// XXX
|
||||
|
||||
// this is a hook function, and
|
||||
// may be overriden by derived classes.
|
||||
@@ -418,7 +461,8 @@ BMediaNode::HandleMessage(int32 message,
|
||||
const void *data,
|
||||
size_t size)
|
||||
{
|
||||
CALLED();
|
||||
// CALLED();
|
||||
TRACE("BMediaNode::HandleMessage %#lx, node %ld\n", message, fNodeID);
|
||||
switch (message) {
|
||||
case NODE_START:
|
||||
{
|
||||
@@ -496,7 +540,7 @@ BMediaNode::HandleBadMessage(int32 code,
|
||||
CALLED();
|
||||
|
||||
TRACE("BMediaNode::HandleBadMessage: code %#08lx, buffer %p, size %ld\n", code, buffer, size);
|
||||
if (code < 0x1000) {
|
||||
if (code < NODE_MESSAGE_START || code > TIMESOURECE_MESSAGE_END) {
|
||||
TRACE("BMediaNode::HandleBadMessage: unknown code!\n");
|
||||
} else {
|
||||
/* All messages targeted to nodes should be handled here,
|
||||
@@ -513,7 +557,7 @@ BMediaNode::HandleBadMessage(int32 code,
|
||||
void
|
||||
BMediaNode::AddNodeKind(uint64 kind)
|
||||
{
|
||||
CALLED();
|
||||
TRACE("BMediaNode::AddNodeKind: node %ld, this %p\n", fNodeID, this);
|
||||
|
||||
fKinds |= kind;
|
||||
}
|
||||
@@ -691,32 +735,44 @@ BMediaNode::BMediaNode(const BMediaNode &clone)
|
||||
BMediaNode &BMediaNode::operator=(const BMediaNode &clone)
|
||||
*/
|
||||
|
||||
BMediaNode::BMediaNode(const char *name,
|
||||
media_node_id id,
|
||||
uint32 kinds) :
|
||||
fNodeID(id),
|
||||
fTimeSource(0),
|
||||
fRefCount(1),
|
||||
fRunMode(B_INCREASE_LATENCY),
|
||||
fKinds(kinds),
|
||||
fTimeSourceID(0),
|
||||
fControlPort(-1)
|
||||
void
|
||||
BMediaNode::_InitObject(const char *name, media_node_id id, uint64 kinds)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
// initialize node name
|
||||
TRACE("BMediaNode::_InitObject: nodeid %ld, this %p\n", id, this);
|
||||
|
||||
fNodeID = id;
|
||||
fTimeSource = 0;
|
||||
fRefCount = 1;
|
||||
fName[0] = 0;
|
||||
if (name) {
|
||||
strncpy(fName,name,B_MEDIA_NAME_LENGTH - 1);
|
||||
strncpy(fName, name, B_MEDIA_NAME_LENGTH - 1);
|
||||
fName[B_MEDIA_NAME_LENGTH - 1] = 0;
|
||||
}
|
||||
TRACE("BMediaNode::BMediaNode: node name is: %s\n",fName);
|
||||
fRunMode = B_INCREASE_LATENCY;
|
||||
_mChangeCount = 0; // deprecated
|
||||
_mChangeCountReserved = 0; // deprecated
|
||||
fKinds = kinds;
|
||||
fTimeSourceID = -1;
|
||||
fProducerThis = 0;
|
||||
fConsumerThis = 0;
|
||||
fFileInterfaceThis = 0;
|
||||
fControllableThis = 0;
|
||||
fTimeSourceThis = 0;
|
||||
|
||||
// create control port
|
||||
fControlPort = create_port(64,fName);
|
||||
}
|
||||
|
||||
|
||||
BMediaNode::BMediaNode(const char *name,
|
||||
media_node_id id,
|
||||
uint32 kinds)
|
||||
{
|
||||
TRACE("BMediaNode::BMediaNode: name '%s', nodeid %ld, kinds %#lx\n", name, id, kinds);
|
||||
_InitObject(name, id, kinds);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* protected BMediaNode
|
||||
*************************************************************/
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <OS.h>
|
||||
#include <String.h>
|
||||
#include <TimeSource.h>
|
||||
#undef DEBUG
|
||||
#define DEBUG 3
|
||||
#include <Debug.h>
|
||||
#include "debug.h"
|
||||
@@ -1305,13 +1304,10 @@ BMediaRoster::RegisterNode(BMediaNode * node)
|
||||
ASSERT(reply.nodeid == node->Node().node);
|
||||
ASSERT(reply.nodeid == node->ID());
|
||||
|
||||
TRACE("BMediaRoster::RegisterNode: before callback: port %ld, name '%s'\n", node->ControlPort(), node->Name());
|
||||
|
||||
// call the callback
|
||||
node->NodeRegistered();
|
||||
|
||||
TRACE("BMediaRoster::RegisterNode: after callback: port %ld, name '%s'\n", node->ControlPort(), node->Name());
|
||||
|
||||
/*
|
||||
// register existing inputs and outputs with the
|
||||
// media_server, this allows GetLiveNodes() to work
|
||||
// with created, but unconnected nodes.
|
||||
@@ -1324,10 +1320,18 @@ BMediaRoster::RegisterNode(BMediaNode * node)
|
||||
if (B_OK == GetAllInputs(node->Node(), &stack))
|
||||
PublishInputs(node->Node(), &stack);
|
||||
}
|
||||
*/
|
||||
|
||||
BPrivate::media::notifications::NodesCreated(&reply.nodeid, 1);
|
||||
|
||||
|
||||
TRACE("BMediaRoster::RegisterNode: registered node %s, id %ld, addon %ld, flavor %ld\n", node->Name(), node->ID(), addon_id, addon_flavor_id);
|
||||
/*
|
||||
TRACE("BMediaRoster::RegisterNode: registered node name '%s', id %ld, addon %ld, flavor %ld\n", node->Name(), node->ID(), addon_id, addon_flavor_id);
|
||||
TRACE("BMediaRoster::RegisterNode: node this %p\n", node);
|
||||
TRACE("BMediaRoster::RegisterNode: node fConsumerThis %p\n", node->fConsumerThis);
|
||||
TRACE("BMediaRoster::RegisterNode: node fProducerThis %p\n", node->fProducerThis);
|
||||
TRACE("BMediaRoster::RegisterNode: node fFileInterfaceThis %p\n", node->fFileInterfaceThis);
|
||||
TRACE("BMediaRoster::RegisterNode: node fControllableThis %p\n", node->fControllableThis);
|
||||
TRACE("BMediaRoster::RegisterNode: node fTimeSourceThis %p\n", node->fTimeSourceThis);
|
||||
*/
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -1341,11 +1345,11 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (node->fRefCount != 0) {
|
||||
TRACE("BMediaRoster::UnregisterNode: Warning node %s has local reference count of %ld\n", node->Name(), node->fRefCount);
|
||||
TRACE("BMediaRoster::UnregisterNode: Warning node name '%s' has local reference count of %ld\n", node->Name(), node->fRefCount);
|
||||
// no return here, we continue and unregister!
|
||||
}
|
||||
if (node->ID() == -2) {
|
||||
TRACE("BMediaRoster::UnregisterNode: Warning node %s already unregistered\n", node->Name());
|
||||
TRACE("BMediaRoster::UnregisterNode: Warning node name '%s' already unregistered\n", node->Name());
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -1361,7 +1365,7 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
|
||||
|
||||
rv = QueryServer(SERVER_UNREGISTER_NODE, &request, sizeof(request), &reply, sizeof(reply));
|
||||
if (rv != B_OK) {
|
||||
TRACE("BMediaRoster::UnregisterNode: failed to unregister node %s (error %#lx)\n", node->Name(), rv);
|
||||
TRACE("BMediaRoster::UnregisterNode: failed to unregister node name '%s' (error %#lx)\n", node->Name(), rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1379,7 +1383,6 @@ BMediaRoster::UnregisterNode(BMediaNode * node)
|
||||
/* static */ BMediaRoster *
|
||||
BMediaRoster::Roster(status_t* out_error)
|
||||
{
|
||||
CALLED();
|
||||
static BLocker locker("BMediaRoster::Roster locker");
|
||||
locker.Lock();
|
||||
if (_sDefault == NULL) {
|
||||
@@ -1400,7 +1403,6 @@ BMediaRoster::Roster(status_t* out_error)
|
||||
/* static */ BMediaRoster *
|
||||
BMediaRoster::CurrentRoster()
|
||||
{
|
||||
CALLED();
|
||||
return _sDefault;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
*/
|
||||
#include <Messenger.h>
|
||||
#include <MediaNode.h>
|
||||
#define DEBUG 1
|
||||
#include "debug.h"
|
||||
#include "DataExchange.h"
|
||||
#include "Notifications.h"
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
// XXX This works only as long a BTimeSource is only supporting realtime
|
||||
|
||||
#include <OS.h>
|
||||
//#include <MediaRoster.h>
|
||||
#include "SystemTimeSource.h"
|
||||
|
||||
_SysTimeSource::_SysTimeSource() :
|
||||
BMediaNode("time source")
|
||||
BMediaNode("system time source")
|
||||
{
|
||||
// BMediaRoster::Roster()->RegisterNode(this); // XXX
|
||||
}
|
||||
|
||||
/* virtual */ status_t
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
***********************************************************************/
|
||||
#include <TimeSource.h>
|
||||
#include "debug.h"
|
||||
#include "DataExchange.h"
|
||||
#include "ServerInterface.h"
|
||||
|
||||
// XXX This BTimeSource only works for realtime, nothing else is implemented
|
||||
@@ -125,7 +126,8 @@ BTimeSource::HandleMessage(int32 message,
|
||||
const void *rawdata,
|
||||
size_t size)
|
||||
{
|
||||
CALLED();
|
||||
TRACE("BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID);
|
||||
|
||||
switch (message) {
|
||||
case TIMESOURCE_OP:
|
||||
{
|
||||
@@ -144,7 +146,7 @@ BTimeSource::PublishTime(bigtime_t performance_time,
|
||||
bigtime_t real_time,
|
||||
float drift)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
// UNIMPLEMENTED(); //XXX
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <Messenger.h>
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaAddOn.h>
|
||||
#define DEBUG 1
|
||||
#define DEBUG 3
|
||||
#include <Debug.h>
|
||||
#include "debug.h"
|
||||
#include "NodeManager.h"
|
||||
@@ -172,6 +172,7 @@ status_t
|
||||
NodeManager::GetClone(media_node *node, char *input_name, int32 *input_id, node_type type, team_id team)
|
||||
{
|
||||
TRACE("!!! NodeManager::GetClone not implemented\n");
|
||||
*node = media_node::null;
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,37 +53,12 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
NODE_START,
|
||||
NODE_STOP,
|
||||
NODE_SEEK,
|
||||
NODE_SET_RUN_MODE,
|
||||
NODE_TIME_WARP,
|
||||
NODE_PREROLL,
|
||||
NODE_SET_TIMESOURCE,
|
||||
NODE_REQUEST_COMPLETED,
|
||||
CONSUMER_BUFFER_RECEIVED,
|
||||
CONSUMER_PRODUCER_DATA_STATUS,
|
||||
CONSUMER_GET_LATENCY_FOR,
|
||||
CONSUMER_FORMAT_CHANGED,
|
||||
CONSUMER_SEEK_TAG_REQUESTED,
|
||||
PRODUCER_LATE_NOTICE_RECEIVED,
|
||||
PRODUCER_LATENCY_CHANGED,
|
||||
PRODUCER_ADDITIONAL_BUFFER_REQUESTED,
|
||||
PRODUCER_VIDEO_CLIPPING_CHANGED,
|
||||
PRODUCER_FORMAT_CHANGE_REQUESTED,
|
||||
PRODUCER_SET_BUFFER_GROUP,
|
||||
PRODUCER_GET_LATENCY,
|
||||
PRODUCER_GET_INITIAL_LATENCY,
|
||||
PRODUCER_FORMAT_SUGGESTION_REQUESTED,
|
||||
PRODUCER_SET_PLAY_RATE,
|
||||
PRODUCER_ENABLE_OUTPUT,
|
||||
ADDONSERVER_INSTANTIATE_DORMANT_NODE,
|
||||
SERVER_REGISTER_MEDIAADDON,
|
||||
SERVER_UNREGISTER_MEDIAADDON,
|
||||
SERVER_GET_MEDIAADDON_REF,
|
||||
ADDONSERVER_RESCAN_MEDIAADDON_FLAVORS,
|
||||
SERVER_REGISTER_DORMANT_NODE,
|
||||
TIMESOURCE_OP, // datablock is a struct time_source_op_info
|
||||
SERVER_GET_DORMANT_NODES,
|
||||
SERVER_GET_DORMANT_FLAVOR_INFO,
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user