64 bit fixes for libmedia.so, ActivityMonitor, and Sudoku.
* Alex, I feel your pain :-)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
* Copyright 2009-2012, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _MEDIA_NODE_H
|
#ifndef _MEDIA_NODE_H
|
||||||
@@ -92,7 +92,7 @@ struct media_request_info {
|
|||||||
what_code what;
|
what_code what;
|
||||||
int32 change_tag;
|
int32 change_tag;
|
||||||
status_t status;
|
status_t status;
|
||||||
int32 cookie;
|
void* cookie;
|
||||||
void* user_data;
|
void* user_data;
|
||||||
media_source source;
|
media_source source;
|
||||||
media_destination destination;
|
media_destination destination;
|
||||||
@@ -115,11 +115,13 @@ struct media_node_attribute {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate { namespace media {
|
namespace BPrivate {
|
||||||
class TimeSourceObject;
|
namespace media {
|
||||||
class SystemTimeSourceObject;
|
class TimeSourceObject;
|
||||||
class BMediaRosterEx;
|
class SystemTimeSourceObject;
|
||||||
} } // BPrivate::media
|
class BMediaRosterEx;
|
||||||
|
}
|
||||||
|
} // BPrivate::media
|
||||||
|
|
||||||
|
|
||||||
/*! BMediaNode is the indirect base class for all Media Kit participants.
|
/*! BMediaNode is the indirect base class for all Media Kit participants.
|
||||||
@@ -338,4 +340,5 @@ private:
|
|||||||
// not to be confused with _mChangeCount
|
// not to be confused with _mChangeCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _MEDIA_NODE_H
|
#endif // _MEDIA_NODE_H
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
interval /= 1000;
|
interval /= 1000;
|
||||||
|
|
||||||
// Find closest index
|
// Find closest index
|
||||||
int32 bestDiff = LONG_MAX;
|
int32 bestDiff = INT32_MAX;
|
||||||
uint32 bestIndex = 0;
|
uint32 bestIndex = 0;
|
||||||
for (uint32 i = 0; i < kNumUpdateIntervals; i++) {
|
for (uint32 i = 0; i < kNumUpdateIntervals; i++) {
|
||||||
int32 diff = abs(kUpdateIntervals[i] - interval);
|
int32 diff = abs(kUpdateIntervals[i] - interval);
|
||||||
|
|||||||
@@ -221,6 +221,12 @@ PartitionListRow::PartitionListRow(BPartition* partition)
|
|||||||
if (partition->ContainsFileSystem()) {
|
if (partition->ContainsFileSystem()) {
|
||||||
SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
|
SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
|
||||||
SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
|
SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
|
||||||
|
} else if (partition->IsDevice()) {
|
||||||
|
if (partition->Name() != NULL && partition->Name()[0])
|
||||||
|
SetField(new BStringField(partition->Name()), kVolumeNameColumn);
|
||||||
|
else
|
||||||
|
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
||||||
|
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||||
} else if (partition->CountChildren() > 0) {
|
} else if (partition->CountChildren() > 0) {
|
||||||
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||||
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ SudokuField::Dump()
|
|||||||
for (uint32 x = 0; x < fSize; x++) {
|
for (uint32 x = 0; x < fSize; x++) {
|
||||||
if (x != 0 && x % fBlockSize == 0)
|
if (x != 0 && x % fBlockSize == 0)
|
||||||
putchar(' ');
|
putchar(' ');
|
||||||
printf("%lu", ValueAt(x, y));
|
printf("%" B_PRIu32, ValueAt(x, y));
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2011, Axel Dörfler, [email protected].
|
* Copyright 2007-2012, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ SudokuGenerator::Generate(SudokuField* target, uint32 fieldsLeft,
|
|||||||
if (removeCount <= 0 || *quit)
|
if (removeCount <= 0 || *quit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf(" remove count = %ld\n", removeCount);
|
printf(" remove count = %" B_PRId32 "\n", removeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the remaining values to be initial values
|
// set the remaining values to be initial values
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ void
|
|||||||
SudokuView::InitObject(const BMessage* archive)
|
SudokuView::InitObject(const BMessage* archive)
|
||||||
{
|
{
|
||||||
fField = NULL;
|
fField = NULL;
|
||||||
fShowHintX = ~0UL;
|
fShowHintX = UINT32_MAX;
|
||||||
fValueHintValue = ~0UL;
|
fValueHintValue = UINT32_MAX;
|
||||||
fLastHintValue = ~0UL;
|
fLastHintValue = UINT32_MAX;
|
||||||
fLastField = ~0UL;
|
fLastField = UINT32_MAX;
|
||||||
fKeyboardX = 0;
|
fKeyboardX = 0;
|
||||||
fKeyboardY = 0;
|
fKeyboardY = 0;
|
||||||
fShowKeyboardFocus = false;
|
fShowKeyboardFocus = false;
|
||||||
@@ -220,7 +220,7 @@ SudokuView::SetTo(entry_ref& ref)
|
|||||||
|
|
||||||
_PushUndo();
|
_PushUndo();
|
||||||
status = fField->SetTo(_BaseCharacter(), buffer);
|
status = fField->SetTo(_BaseCharacter(), buffer);
|
||||||
fValueHintValue = ~0UL;
|
fValueHintValue = UINT32_MAX;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return status;
|
return status;
|
||||||
@@ -243,7 +243,7 @@ SudokuView::SetTo(const char* data)
|
|||||||
|
|
||||||
_PushUndo();
|
_PushUndo();
|
||||||
status = fField->SetTo(_BaseCharacter(), buffer);
|
status = fField->SetTo(_BaseCharacter(), buffer);
|
||||||
fValueHintValue = ~0UL;
|
fValueHintValue = UINT32_MAX;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ SudokuView::SetTo(SudokuField* field)
|
|||||||
fField = field;
|
fField = field;
|
||||||
|
|
||||||
fBlockSize = fField->BlockSize();
|
fBlockSize = fField->BlockSize();
|
||||||
fValueHintValue = ~0UL;
|
fValueHintValue = UINT32_MAX;
|
||||||
FrameResized(0, 0);
|
FrameResized(0, 0);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -757,12 +757,12 @@ SudokuView::_SetValueHintValue(uint32 value)
|
|||||||
if (value == fValueHintValue)
|
if (value == fValueHintValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fValueHintValue != ~0UL)
|
if (fValueHintValue != UINT32_MAX)
|
||||||
_InvalidateValue(fValueHintValue, true);
|
_InvalidateValue(fValueHintValue, true);
|
||||||
|
|
||||||
fValueHintValue = value;
|
fValueHintValue = value;
|
||||||
|
|
||||||
if (fValueHintValue != ~0UL)
|
if (fValueHintValue != UINT32_MAX)
|
||||||
_InvalidateValue(fValueHintValue, true);
|
_InvalidateValue(fValueHintValue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -770,13 +770,13 @@ SudokuView::_SetValueHintValue(uint32 value)
|
|||||||
void
|
void
|
||||||
SudokuView::_RemoveHint()
|
SudokuView::_RemoveHint()
|
||||||
{
|
{
|
||||||
if (fShowHintX == ~0UL)
|
if (fShowHintX == UINT32_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 x = fShowHintX;
|
uint32 x = fShowHintX;
|
||||||
uint32 y = fShowHintY;
|
uint32 y = fShowHintY;
|
||||||
fShowHintX = ~0;
|
fShowHintX = UINT32_MAX;
|
||||||
fShowHintY = ~0;
|
fShowHintY = UINT32_MAX;
|
||||||
|
|
||||||
_InvalidateField(x, y);
|
_InvalidateField(x, y);
|
||||||
}
|
}
|
||||||
@@ -912,7 +912,7 @@ SudokuView::MouseDown(BPoint where)
|
|||||||
fField->SetHintMaskAt(x, y, hintMask);
|
fField->SetHintMaskAt(x, y, hintMask);
|
||||||
|
|
||||||
if (value + 1 != fValueHintValue) {
|
if (value + 1 != fValueHintValue) {
|
||||||
_SetValueHintValue(~0UL);
|
_SetValueHintValue(UINT32_MAX);
|
||||||
_InvalidateHintField(x, y, hintX, hintY);
|
_InvalidateHintField(x, y, hintX, hintY);
|
||||||
} else
|
} else
|
||||||
_InvalidateField(x, y);
|
_InvalidateField(x, y);
|
||||||
@@ -1107,7 +1107,7 @@ SudokuView::MessageReceived(BMessage* message)
|
|||||||
solver.SetTo(fField);
|
solver.SetTo(fField);
|
||||||
bigtime_t start = system_time();
|
bigtime_t start = system_time();
|
||||||
solver.ComputeSolutions();
|
solver.ComputeSolutions();
|
||||||
printf("found %ld solutions in %g msecs\n",
|
printf("found %" B_PRIu32 " solutions in %g msecs\n",
|
||||||
solver.CountSolutions(), (system_time() - start) / 1000.0);
|
solver.CountSolutions(), (system_time() - start) / 1000.0);
|
||||||
if (solver.CountSolutions() > 0) {
|
if (solver.CountSolutions() > 0) {
|
||||||
_PushUndo();
|
_PushUndo();
|
||||||
@@ -1129,7 +1129,7 @@ SudokuView::MessageReceived(BMessage* message)
|
|||||||
solver.SetTo(fField);
|
solver.SetTo(fField);
|
||||||
bigtime_t start = system_time();
|
bigtime_t start = system_time();
|
||||||
solver.ComputeSolutions();
|
solver.ComputeSolutions();
|
||||||
printf("found %ld solutions in %g msecs\n",
|
printf("found %" B_PRIu32 " solutions in %g msecs\n",
|
||||||
solver.CountSolutions(), (system_time() - start) / 1000.0);
|
solver.CountSolutions(), (system_time() - start) / 1000.0);
|
||||||
if (solver.CountSolutions() > 0) {
|
if (solver.CountSolutions() > 0) {
|
||||||
_PushUndo();
|
_PushUndo();
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ private:
|
|||||||
void _InvalidateField(uint32 x, uint32 y);
|
void _InvalidateField(uint32 x, uint32 y);
|
||||||
void _InvalidateValue(uint32 value,
|
void _InvalidateValue(uint32 value,
|
||||||
bool invalidateHint = false,
|
bool invalidateHint = false,
|
||||||
uint32 x = ~0UL, uint32 y = ~0UL);
|
uint32 x = UINT32_MAX,
|
||||||
|
uint32 y = UINT32_MAX);
|
||||||
void _InvalidateKeyboardFocus(uint32 x, uint32 y);
|
void _InvalidateKeyboardFocus(uint32 x, uint32 y);
|
||||||
void _InsertKey(char rawKey, int32 modifiers);
|
void _InsertKey(char rawKey, int32 modifiers);
|
||||||
void _SetValueHintValue(uint32 value);
|
void _SetValueHintValue(uint32 value);
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ BBufferGroup::BBufferGroup(size_t size, int32 count, uint32 placement,
|
|||||||
// don't allow all placement parameter values
|
// don't allow all placement parameter values
|
||||||
if (placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS) {
|
if (placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_ADDRESS) {
|
||||||
ERROR("BBufferGroup: placement != B_ANY_ADDRESS "
|
ERROR("BBufferGroup: placement != B_ANY_ADDRESS "
|
||||||
"&& placement != B_ANY_KERNEL_ADDRESS (0x%08lx)\n", placement);
|
"&& placement != B_ANY_KERNEL_ADDRESS (0x%#" B_PRIx32 ")\n",
|
||||||
|
placement);
|
||||||
placement = B_ANY_ADDRESS;
|
placement = B_ANY_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Axel Dörfler, [email protected].
|
* Copyright 2010-2012, Axel Dörfler, [email protected].
|
||||||
* Copyright 2002-2003, Marcus Overhagen, <[email protected]>.
|
* Copyright 2002-2003, Marcus Overhagen, <[email protected]>.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -82,7 +82,7 @@ BBufferProducer::GetLatency(bigtime_t* _latency)
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
// The default implementation of GetLatency() finds the maximum
|
// The default implementation of GetLatency() finds the maximum
|
||||||
// latency of your currently-available outputs by iterating over
|
// latency of your currently-available outputs by iterating over
|
||||||
// them, and returns that value in outLatency
|
// them, and returns that value in outLatency
|
||||||
|
|
||||||
int32 cookie;
|
int32 cookie;
|
||||||
@@ -95,7 +95,7 @@ BBufferProducer::GetLatency(bigtime_t* _latency)
|
|||||||
while (GetNextOutput(&cookie, &output) == B_OK) {
|
while (GetNextOutput(&cookie, &output) == B_OK) {
|
||||||
if (output.destination == media_destination::null)
|
if (output.destination == media_destination::null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (output.node.node == fNodeID) {
|
if (output.node.node == fNodeID) {
|
||||||
// avoid port writes (deadlock) if loopback connection
|
// avoid port writes (deadlock) if loopback connection
|
||||||
if (fConsumerThis == NULL)
|
if (fConsumerThis == NULL)
|
||||||
@@ -113,7 +113,8 @@ BBufferProducer::GetLatency(bigtime_t* _latency)
|
|||||||
*_latency = latency;
|
*_latency = latency;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("BBufferProducer::GetLatency: node %ld, name \"%s\" has max latency %Ld\n", fNodeID, fName, *_latency);
|
printf("BBufferProducer::GetLatency: node %" B_PRId32 ", name \"%s\" has "
|
||||||
|
"max latency %" B_PRId64 "\n", fNodeID, fName, *_latency);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +277,7 @@ BBufferProducer::HandleMessage(int32 message, const void* data, size_t size)
|
|||||||
= media_request_info::B_SET_OUTPUT_BUFFERS_FOR;
|
= media_request_info::B_SET_OUTPUT_BUFFERS_FOR;
|
||||||
replycommand.info.change_tag = command->change_tag;
|
replycommand.info.change_tag = command->change_tag;
|
||||||
replycommand.info.status = status;
|
replycommand.info.status = status;
|
||||||
replycommand.info.cookie = (int32)group;
|
replycommand.info.cookie = group;
|
||||||
replycommand.info.user_data = command->user_data;
|
replycommand.info.user_data = command->user_data;
|
||||||
replycommand.info.source = command->source;
|
replycommand.info.source = command->source;
|
||||||
replycommand.info.destination = command->destination;
|
replycommand.info.destination = command->destination;
|
||||||
@@ -544,7 +545,7 @@ BBufferProducer::FindSeekTag(const media_destination& destination,
|
|||||||
request.destination = destination;
|
request.destination = destination;
|
||||||
request.target_time = targetTime;
|
request.target_time = targetTime;
|
||||||
request.flags = flags;
|
request.flags = flags;
|
||||||
|
|
||||||
status_t status = QueryPort(destination.port, CONSUMER_SEEK_TAG_REQUESTED,
|
status_t status = QueryPort(destination.port, CONSUMER_SEEK_TAG_REQUESTED,
|
||||||
&request, sizeof(request), &reply, sizeof(reply));
|
&request, sizeof(request), &reply, sizeof(reply));
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2009-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -367,7 +367,8 @@ BControllable::StartControlPanel(BMessenger* _messenger)
|
|||||||
ERROR("BControllable::StartControlPanel Error launching application\n");
|
ERROR("BControllable::StartControlPanel Error launching application\n");
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
printf("BControllable::StartControlPanel done with id: %ld\n", team);
|
printf("BControllable::StartControlPanel done with id: %" B_PRId32 "\n",
|
||||||
|
team);
|
||||||
|
|
||||||
if (_messenger)
|
if (_messenger)
|
||||||
*_messenger = BMessenger(NULL, team);
|
*_messenger = BMessenger(NULL, team);
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ SendToPort(port_id sendPort, int32 msgCode, command_data* msg, size_t size)
|
|||||||
status_t status = write_port_etc(sendPort, msgCode, msg, size,
|
status_t status = write_port_etc(sendPort, msgCode, msg, size,
|
||||||
B_RELATIVE_TIMEOUT, TIMEOUT);
|
B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("SendToPort: write_port failed, msgcode 0x%lx, port %ld: %s\n",
|
ERROR("SendToPort: write_port failed, msgcode 0x%" B_PRIx32 ", port %"
|
||||||
msgCode, sendPort, strerror(status));
|
B_PRId32 ": %s\n", msgCode, sendPort, strerror(status));
|
||||||
if (status == B_BAD_PORT_ID && sendPort == sMediaServerPort) {
|
if (status == B_BAD_PORT_ID && sendPort == sMediaServerPort) {
|
||||||
find_media_server_port();
|
find_media_server_port();
|
||||||
sendPort = sMediaServerPort;
|
sendPort = sMediaServerPort;
|
||||||
@@ -149,8 +149,9 @@ SendToPort(port_id sendPort, int32 msgCode, command_data* msg, size_t size)
|
|||||||
status = write_port_etc(sendPort, msgCode, msg, size,
|
status = write_port_etc(sendPort, msgCode, msg, size,
|
||||||
B_RELATIVE_TIMEOUT, TIMEOUT);
|
B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("SendToPort: retrying write_port failed, msgCode 0x%lx, "
|
ERROR("SendToPort: retrying write_port failed, msgCode 0x%" B_PRIx32
|
||||||
"port %ld: %s\n", msgCode, sendPort, strerror(status));
|
", port %" B_PRId32 ": %s\n", msgCode, sendPort,
|
||||||
|
strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,8 +166,8 @@ QueryPort(port_id requestPort, int32 msgCode, request_data* request,
|
|||||||
status_t status = write_port_etc(requestPort, msgCode, request, requestSize,
|
status_t status = write_port_etc(requestPort, msgCode, request, requestSize,
|
||||||
B_RELATIVE_TIMEOUT, TIMEOUT);
|
B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("QueryPort: write_port failed, msgcode 0x%lx, port %ld: %s\n",
|
ERROR("QueryPort: write_port failed, msgcode 0x%" B_PRIx32 ", port %"
|
||||||
msgCode, requestPort, strerror(status));
|
B_PRId32 ": %s\n", msgCode, requestPort, strerror(status));
|
||||||
|
|
||||||
if (status == B_BAD_PORT_ID && requestPort == sMediaServerPort) {
|
if (status == B_BAD_PORT_ID && requestPort == sMediaServerPort) {
|
||||||
find_media_server_port();
|
find_media_server_port();
|
||||||
@@ -181,8 +182,9 @@ QueryPort(port_id requestPort, int32 msgCode, request_data* request,
|
|||||||
status = write_port_etc(requestPort, msgCode, request, requestSize,
|
status = write_port_etc(requestPort, msgCode, request, requestSize,
|
||||||
B_RELATIVE_TIMEOUT, TIMEOUT);
|
B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("QueryPort: retrying write_port failed, msgcode 0x%lx, port "
|
ERROR("QueryPort: retrying write_port failed, msgcode 0x%" B_PRIx32
|
||||||
"%ld: %s\n", msgCode, requestPort, strerror(status));
|
", port %" B_PRId32 ": %s\n", msgCode, requestPort,
|
||||||
|
strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,8 +193,8 @@ QueryPort(port_id requestPort, int32 msgCode, request_data* request,
|
|||||||
status = read_port_etc(request->reply_port, &code, reply, replySize,
|
status = read_port_etc(request->reply_port, &code, reply, replySize,
|
||||||
B_RELATIVE_TIMEOUT, TIMEOUT);
|
B_RELATIVE_TIMEOUT, TIMEOUT);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
ERROR("QueryPort: read_port failed, msgcode 0x%lx, port %ld: %s\n",
|
ERROR("QueryPort: read_port failed, msgcode 0x%" B_PRIx32 ", port %"
|
||||||
msgCode, request->reply_port, strerror(status));
|
B_PRId32 ": %s\n", msgCode, request->reply_port, strerror(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
return status < B_OK ? status : reply->result;
|
return status < B_OK ? status : reply->result;
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ DormantNodeManager::~DormantNodeManager()
|
|||||||
for (; iterator != fAddOnMap.end(); iterator++) {
|
for (; iterator != fAddOnMap.end(); iterator++) {
|
||||||
loaded_add_on_info& info = iterator->second;
|
loaded_add_on_info& info = iterator->second;
|
||||||
|
|
||||||
ERROR("Forcing unload of add-on id %ld with usecount %ld\n",
|
ERROR("Forcing unload of add-on id %" B_PRId32 " with usecount %"
|
||||||
info.add_on->AddonID(), info.use_count);
|
B_PRId32 "\n", info.add_on->AddonID(), info.use_count);
|
||||||
_UnloadAddOn(info.add_on, info.image);
|
_UnloadAddOn(info.add_on, info.image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ DormantNodeManager::~DormantNodeManager()
|
|||||||
BMediaAddOn*
|
BMediaAddOn*
|
||||||
DormantNodeManager::GetAddOn(media_addon_id id)
|
DormantNodeManager::GetAddOn(media_addon_id id)
|
||||||
{
|
{
|
||||||
TRACE("DormantNodeManager::GetAddon, id %ld\n", id);
|
TRACE("DormantNodeManager::GetAddon, id %" B_PRId32 "\n", id);
|
||||||
|
|
||||||
// first try to use a already loaded add-on
|
// first try to use a already loaded add-on
|
||||||
BMediaAddOn* addOn = _LookupAddOn(id);
|
BMediaAddOn* addOn = _LookupAddOn(id);
|
||||||
@@ -107,8 +107,8 @@ DormantNodeManager::GetAddOn(media_addon_id id)
|
|||||||
// ok, it's not loaded, try to get the path
|
// ok, it's not loaded, try to get the path
|
||||||
BPath path;
|
BPath path;
|
||||||
if (FindAddOnPath(&path, id) != B_OK) {
|
if (FindAddOnPath(&path, id) != B_OK) {
|
||||||
ERROR("DormantNodeManager::GetAddon: can't find path for add-on "
|
ERROR("DormantNodeManager::GetAddon: can't find path for add-on %"
|
||||||
"%ld\n", id);
|
B_PRId32 "\n", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,8 +116,8 @@ DormantNodeManager::GetAddOn(media_addon_id id)
|
|||||||
BMediaAddOn* newAddOn;
|
BMediaAddOn* newAddOn;
|
||||||
image_id image;
|
image_id image;
|
||||||
if (_LoadAddOn(path.Path(), id, &newAddOn, &image) != B_OK) {
|
if (_LoadAddOn(path.Path(), id, &newAddOn, &image) != B_OK) {
|
||||||
ERROR("DormantNodeManager::GetAddon: can't load add-on %ld from path "
|
ERROR("DormantNodeManager::GetAddon: can't load add-on %" B_PRId32
|
||||||
"%s\n",id, path.Path());
|
" from path %s\n",id, path.Path());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,13 +154,14 @@ DormantNodeManager::GetAddOn(media_addon_id id)
|
|||||||
void
|
void
|
||||||
DormantNodeManager::PutAddOn(media_addon_id id)
|
DormantNodeManager::PutAddOn(media_addon_id id)
|
||||||
{
|
{
|
||||||
TRACE("DormantNodeManager::PutAddon, id %ld\n", id);
|
TRACE("DormantNodeManager::PutAddon, id %" B_PRId32 "\n", id);
|
||||||
|
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
AddOnMap::iterator found = fAddOnMap.find(id);
|
AddOnMap::iterator found = fAddOnMap.find(id);
|
||||||
if (found == fAddOnMap.end()) {
|
if (found == fAddOnMap.end()) {
|
||||||
ERROR("DormantNodeManager::PutAddon: failed to find add-on %ld\n", id);
|
ERROR("DormantNodeManager::PutAddon: failed to find add-on %" B_PRId32
|
||||||
|
"\n", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +195,7 @@ DormantNodeManager::PutAddOnDelayed(media_addon_id id)
|
|||||||
media_addon_id
|
media_addon_id
|
||||||
DormantNodeManager::RegisterAddOn(const char* path)
|
DormantNodeManager::RegisterAddOn(const char* path)
|
||||||
{
|
{
|
||||||
TRACE("DormantNodeManager::RegisterAddon, path %s\n",path);
|
TRACE("DormantNodeManager::RegisterAddon, path %s\n", path);
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
status_t status = get_ref_for_path(path, &ref);
|
status_t status = get_ref_for_path(path, &ref);
|
||||||
@@ -222,7 +223,7 @@ DormantNodeManager::RegisterAddOn(const char* path)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("DormantNodeManager::RegisterAddon finished with id %ld\n",
|
TRACE("DormantNodeManager::RegisterAddon finished with id %" B_PRId32 "\n",
|
||||||
reply.add_on_id);
|
reply.add_on_id);
|
||||||
|
|
||||||
return reply.add_on_id;
|
return reply.add_on_id;
|
||||||
@@ -233,7 +234,7 @@ DormantNodeManager::RegisterAddOn(const char* path)
|
|||||||
void
|
void
|
||||||
DormantNodeManager::UnregisterAddOn(media_addon_id id)
|
DormantNodeManager::UnregisterAddOn(media_addon_id id)
|
||||||
{
|
{
|
||||||
TRACE("DormantNodeManager::UnregisterAddon id %ld\n",id);
|
TRACE("DormantNodeManager::UnregisterAddon id %" B_PRId32 "\n", id);
|
||||||
ASSERT(id > 0);
|
ASSERT(id > 0);
|
||||||
|
|
||||||
port_id port = find_port(MEDIA_SERVER_PORT_NAME);
|
port_id port = find_port(MEDIA_SERVER_PORT_NAME);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ media_source::~media_source()
|
|||||||
media_source media_source::null(-1, -1);
|
media_source media_source::null(-1, -1);
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -183,7 +183,7 @@ operator<(const media_node& a, const media_node& b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
media_multi_audio_format media_raw_audio_format::wildcard;
|
media_multi_audio_format media_raw_audio_format::wildcard;
|
||||||
@@ -352,7 +352,7 @@ multistream_format_matches(const media_multistream_format& a,
|
|||||||
switch ((a.format != 0) ? a.format : b.format) {
|
switch ((a.format != 0) ? a.format : b.format) {
|
||||||
default:
|
default:
|
||||||
return true; // TODO: really?
|
return true; // TODO: really?
|
||||||
|
|
||||||
case media_multistream_format::B_VID:
|
case media_multistream_format::B_VID:
|
||||||
if (a.u.vid.frame_rate != 0 && b.u.vid.frame_rate != 0
|
if (a.u.vid.frame_rate != 0 && b.u.vid.frame_rate != 0
|
||||||
&& a.u.vid.frame_rate != b.u.vid.frame_rate) {
|
&& a.u.vid.frame_rate != b.u.vid.frame_rate) {
|
||||||
@@ -387,7 +387,7 @@ multistream_format_matches(const media_multistream_format& a,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case media_multistream_format::B_AVI:
|
case media_multistream_format::B_AVI:
|
||||||
if (a.u.avi.us_per_frame != 0 && b.u.avi.us_per_frame != 0
|
if (a.u.avi.us_per_frame != 0 && b.u.avi.us_per_frame != 0
|
||||||
&& a.u.avi.us_per_frame != b.u.avi.us_per_frame) {
|
&& a.u.avi.us_per_frame != b.u.avi.us_per_frame) {
|
||||||
@@ -444,10 +444,10 @@ encoded_audio_format_matches(const media_encoded_audio_format& a,
|
|||||||
return false;
|
return false;
|
||||||
if (!multi_audio_info_matches(a.multi_info, b.multi_info))
|
if (!multi_audio_info_matches(a.multi_info, b.multi_info))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (a.encoding == 0 && b.encoding == 0)
|
if (a.encoding == 0 && b.encoding == 0)
|
||||||
return true; // can't compare
|
return true; // can't compare
|
||||||
|
|
||||||
switch((a.encoding != 0) ? a.encoding : b.encoding) {
|
switch((a.encoding != 0) ? a.encoding : b.encoding) {
|
||||||
case media_encoded_audio_format::B_ANY:
|
case media_encoded_audio_format::B_ANY:
|
||||||
default:
|
default:
|
||||||
@@ -488,7 +488,7 @@ encoded_video_format_matches(const media_encoded_video_format& a,
|
|||||||
|
|
||||||
if (a.encoding == 0 && b.encoding == 0)
|
if (a.encoding == 0 && b.encoding == 0)
|
||||||
return true; // can't compare
|
return true; // can't compare
|
||||||
|
|
||||||
switch((a.encoding != 0) ? a.encoding : b.encoding) {
|
switch((a.encoding != 0) ? a.encoding : b.encoding) {
|
||||||
case media_encoded_video_format::B_ANY:
|
case media_encoded_video_format::B_ANY:
|
||||||
default:
|
default:
|
||||||
@@ -592,7 +592,7 @@ multistream_format_specialize(media_multistream_format* format,
|
|||||||
format->flags = other->flags;
|
format->flags = other->flags;
|
||||||
if (format->format == 0)
|
if (format->format == 0)
|
||||||
format->format = other->format;
|
format->format = other->format;
|
||||||
|
|
||||||
switch (format->format) {
|
switch (format->format) {
|
||||||
case media_multistream_format::B_VID:
|
case media_multistream_format::B_VID:
|
||||||
if (format->u.vid.frame_rate == 0)
|
if (format->u.vid.frame_rate == 0)
|
||||||
@@ -636,7 +636,8 @@ multistream_format_specialize(media_multistream_format* format,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR("media_format::SpecializeTo can't specialize "
|
ERROR("media_format::SpecializeTo can't specialize "
|
||||||
"media_multistream_format of format %ld\n", format->format);
|
"media_multistream_format of format %" B_PRId32 "\n",
|
||||||
|
format->format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,21 +689,21 @@ media_format::Matches(const media_format* other) const
|
|||||||
// TODO: How do we compare two formats with no type?
|
// TODO: How do we compare two formats with no type?
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != 0 && other->type != 0 && type != other->type)
|
if (type != 0 && other->type != 0 && type != other->type)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch ((type != 0) ? type : other->type) {
|
switch ((type != 0) ? type : other->type) {
|
||||||
case B_MEDIA_RAW_AUDIO:
|
case B_MEDIA_RAW_AUDIO:
|
||||||
return multi_audio_format_matches(u.raw_audio, other->u.raw_audio);
|
return multi_audio_format_matches(u.raw_audio, other->u.raw_audio);
|
||||||
|
|
||||||
case B_MEDIA_RAW_VIDEO:
|
case B_MEDIA_RAW_VIDEO:
|
||||||
return raw_video_format_matches(u.raw_video, other->u.raw_video);
|
return raw_video_format_matches(u.raw_video, other->u.raw_video);
|
||||||
|
|
||||||
case B_MEDIA_MULTISTREAM:
|
case B_MEDIA_MULTISTREAM:
|
||||||
return multistream_format_matches(u.multistream,
|
return multistream_format_matches(u.multistream,
|
||||||
other->u.multistream);
|
other->u.multistream);
|
||||||
|
|
||||||
case B_MEDIA_ENCODED_AUDIO:
|
case B_MEDIA_ENCODED_AUDIO:
|
||||||
return encoded_audio_format_matches(u.encoded_audio,
|
return encoded_audio_format_matches(u.encoded_audio,
|
||||||
other->u.encoded_audio);
|
other->u.encoded_audio);
|
||||||
@@ -710,7 +711,7 @@ media_format::Matches(const media_format* other) const
|
|||||||
case B_MEDIA_ENCODED_VIDEO:
|
case B_MEDIA_ENCODED_VIDEO:
|
||||||
return encoded_video_format_matches(u.encoded_video,
|
return encoded_video_format_matches(u.encoded_video,
|
||||||
other->u.encoded_video);
|
other->u.encoded_video);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true; // TODO: really?
|
return true; // TODO: really?
|
||||||
}
|
}
|
||||||
@@ -727,16 +728,16 @@ media_format::SpecializeTo(const media_format* otherFormat)
|
|||||||
"wildcard format\n");
|
"wildcard format\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
type = otherFormat->type;
|
type = otherFormat->type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case B_MEDIA_RAW_AUDIO:
|
case B_MEDIA_RAW_AUDIO:
|
||||||
multi_audio_format_specialize(&u.raw_audio,
|
multi_audio_format_specialize(&u.raw_audio,
|
||||||
&otherFormat->u.raw_audio);
|
&otherFormat->u.raw_audio);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case B_MEDIA_RAW_VIDEO:
|
case B_MEDIA_RAW_VIDEO:
|
||||||
raw_video_format_specialize(&u.raw_video,
|
raw_video_format_specialize(&u.raw_video,
|
||||||
&otherFormat->u.raw_video);
|
&otherFormat->u.raw_video);
|
||||||
@@ -746,7 +747,7 @@ media_format::SpecializeTo(const media_format* otherFormat)
|
|||||||
multistream_format_specialize(&u.multistream,
|
multistream_format_specialize(&u.multistream,
|
||||||
&otherFormat->u.multistream);
|
&otherFormat->u.multistream);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case B_MEDIA_ENCODED_AUDIO:
|
case B_MEDIA_ENCODED_AUDIO:
|
||||||
encoded_audio_format_specialize(&u.encoded_audio,
|
encoded_audio_format_specialize(&u.encoded_audio,
|
||||||
&otherFormat->u.encoded_audio);
|
&otherFormat->u.encoded_audio);
|
||||||
@@ -756,7 +757,7 @@ media_format::SpecializeTo(const media_format* otherFormat)
|
|||||||
encoded_video_format_specialize(&u.encoded_video,
|
encoded_video_format_specialize(&u.encoded_video,
|
||||||
&otherFormat->u.encoded_video);
|
&otherFormat->u.encoded_video);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR("media_format::SpecializeTo can't specialize format "
|
ERROR("media_format::SpecializeTo can't specialize format "
|
||||||
"type %d\n", type);
|
"type %d\n", type);
|
||||||
@@ -769,7 +770,7 @@ media_format::SetMetaData(const void* data, size_t size)
|
|||||||
{
|
{
|
||||||
if (!data || size < 0 || size > META_DATA_MAX_SIZE)
|
if (!data || size < 0 || size > META_DATA_MAX_SIZE)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
void* new_addr;
|
void* new_addr;
|
||||||
area_id new_area;
|
area_id new_area;
|
||||||
if (size < META_DATA_AREA_MIN_SIZE) {
|
if (size < META_DATA_AREA_MIN_SIZE) {
|
||||||
@@ -792,9 +793,9 @@ media_format::SetMetaData(const void* data, size_t size)
|
|||||||
meta_data = new_addr;
|
meta_data = new_addr;
|
||||||
meta_data_size = size;
|
meta_data_size = size;
|
||||||
meta_data_area = new_area;
|
meta_data_area = new_area;
|
||||||
|
|
||||||
memcpy(meta_data, data, size);
|
memcpy(meta_data, data, size);
|
||||||
|
|
||||||
if (meta_data_area > 0)
|
if (meta_data_area > 0)
|
||||||
set_area_protection(meta_data_area, B_READ_AREA);
|
set_area_protection(meta_data_area, B_READ_AREA);
|
||||||
|
|
||||||
@@ -857,7 +858,7 @@ media_format::operator=(const media_format& clone)
|
|||||||
// clone or copy the meta data
|
// clone or copy the meta data
|
||||||
if (clone.meta_data) {
|
if (clone.meta_data) {
|
||||||
if (clone.meta_data_area != B_BAD_VALUE) {
|
if (clone.meta_data_area != B_BAD_VALUE) {
|
||||||
meta_data_area = clone_area("meta_data_clone_area", &meta_data,
|
meta_data_area = clone_area("meta_data_clone_area", &meta_data,
|
||||||
B_ANY_ADDRESS, B_READ_AREA, clone.meta_data_area);
|
B_ANY_ADDRESS, B_READ_AREA, clone.meta_data_area);
|
||||||
if (meta_data_area < 0) {
|
if (meta_data_area < 0) {
|
||||||
// whoops, we just lost our meta data
|
// whoops, we just lost our meta data
|
||||||
@@ -1011,7 +1012,7 @@ operator==(const media_multistream_format& a,
|
|||||||
switch (a.format) {
|
switch (a.format) {
|
||||||
case media_multistream_format::B_VID:
|
case media_multistream_format::B_VID:
|
||||||
return a.u.vid == b.u.vid;
|
return a.u.vid == b.u.vid;
|
||||||
|
|
||||||
case media_multistream_format::B_AVI:
|
case media_multistream_format::B_AVI:
|
||||||
return a.u.avi == b.u.avi;
|
return a.u.avi == b.u.avi;
|
||||||
|
|
||||||
@@ -1031,30 +1032,30 @@ operator==(const media_format& a, const media_format& b)
|
|||||||
|| a.deny_flags != b.deny_flags) {
|
|| a.deny_flags != b.deny_flags) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (a.type) {
|
switch (a.type) {
|
||||||
case B_MEDIA_RAW_AUDIO:
|
case B_MEDIA_RAW_AUDIO:
|
||||||
return a.u.raw_audio == b.u.raw_audio;
|
return a.u.raw_audio == b.u.raw_audio;
|
||||||
|
|
||||||
case B_MEDIA_RAW_VIDEO:
|
case B_MEDIA_RAW_VIDEO:
|
||||||
return a.u.raw_video == b.u.raw_video;
|
return a.u.raw_video == b.u.raw_video;
|
||||||
|
|
||||||
case B_MEDIA_MULTISTREAM:
|
case B_MEDIA_MULTISTREAM:
|
||||||
return a.u.multistream == b.u.multistream;
|
return a.u.multistream == b.u.multistream;
|
||||||
|
|
||||||
case B_MEDIA_ENCODED_AUDIO:
|
case B_MEDIA_ENCODED_AUDIO:
|
||||||
return a.u.encoded_audio == b.u.encoded_audio;
|
return a.u.encoded_audio == b.u.encoded_audio;
|
||||||
|
|
||||||
case B_MEDIA_ENCODED_VIDEO:
|
case B_MEDIA_ENCODED_VIDEO:
|
||||||
return a.u.encoded_video == b.u.encoded_video;
|
return a.u.encoded_video == b.u.encoded_video;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true; // TODO: really?
|
return true; // TODO: really?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
/*! return \c true if a and b are compatible (accounting for wildcards)
|
/*! return \c true if a and b are compatible (accounting for wildcards)
|
||||||
@@ -1072,17 +1073,18 @@ string_for_format(const media_format& f, char* buf, size_t size)
|
|||||||
{
|
{
|
||||||
char encoding[10]; /* maybe Be wanted to use some 4CCs ? */
|
char encoding[10]; /* maybe Be wanted to use some 4CCs ? */
|
||||||
const char* videoOrientation = "0"; /* I'd use "NC", R5 uses 0. */
|
const char* videoOrientation = "0"; /* I'd use "NC", R5 uses 0. */
|
||||||
|
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return false;
|
return false;
|
||||||
switch (f.type) {
|
switch (f.type) {
|
||||||
case B_MEDIA_RAW_AUDIO:
|
case B_MEDIA_RAW_AUDIO:
|
||||||
snprintf(buf, size,
|
snprintf(buf, size,
|
||||||
"raw_audio;%g;%ld;0x%lx;%ld;0x%lx;0x%08lx;%d;0x%04x",
|
"raw_audio;%g;%" B_PRIu32 ";0x%" B_PRIx32 ";%" B_PRIu32 ";0x%"
|
||||||
f.u.raw_audio.frame_rate,
|
B_PRIxSIZE ";0x%#" B_PRIx32 ";%d;0x%04x",
|
||||||
f.u.raw_audio.channel_count,
|
f.u.raw_audio.frame_rate,
|
||||||
f.u.raw_audio.format,
|
f.u.raw_audio.channel_count,
|
||||||
f.u.raw_audio.byte_order,
|
f.u.raw_audio.format,
|
||||||
|
f.u.raw_audio.byte_order,
|
||||||
f.u.raw_audio.buffer_size,
|
f.u.raw_audio.buffer_size,
|
||||||
f.u.raw_audio.channel_mask,
|
f.u.raw_audio.channel_mask,
|
||||||
f.u.raw_audio.valid_bits,
|
f.u.raw_audio.valid_bits,
|
||||||
@@ -1093,9 +1095,8 @@ string_for_format(const media_format& f, char* buf, size_t size)
|
|||||||
videoOrientation = "TopLR";
|
videoOrientation = "TopLR";
|
||||||
else if (f.u.raw_video.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
|
else if (f.u.raw_video.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
|
||||||
videoOrientation = "BotLR";
|
videoOrientation = "BotLR";
|
||||||
// snprintf(buf, size, "raw_video;%g;%ld;%ld;%ld;%s;%d;%d;%d;%d;%d;%d;"
|
snprintf(buf, size, "raw_video;%g;0x%x;%" B_PRIu32 ";%" B_PRIu32 ";%"
|
||||||
// "%d;%d",
|
B_PRIu32 ";%" B_PRIu32 ";%s;%d;%d",
|
||||||
snprintf(buf, size, "raw_video;%g;0x%x;%ld;%ld;%ld;%ld;%s;%d;%d",
|
|
||||||
f.u.raw_video.field_rate,
|
f.u.raw_video.field_rate,
|
||||||
f.u.raw_video.display.format,
|
f.u.raw_video.display.format,
|
||||||
f.u.raw_video.interlace,
|
f.u.raw_video.interlace,
|
||||||
@@ -1108,21 +1109,20 @@ string_for_format(const media_format& f, char* buf, size_t size)
|
|||||||
return true;
|
return true;
|
||||||
case B_MEDIA_ENCODED_AUDIO:
|
case B_MEDIA_ENCODED_AUDIO:
|
||||||
snprintf(encoding, 10, "%d", f.u.encoded_audio.encoding);
|
snprintf(encoding, 10, "%d", f.u.encoded_audio.encoding);
|
||||||
snprintf(buf, size,
|
snprintf(buf, size,
|
||||||
"caudio;%s;%g;%ld;(%g;%ld;0x%lx;%ld;0x%lx;0x%08lx;%d;0x%04x)",
|
"caudio;%s;%g;%ld;(%g;%" B_PRIu32 ";0x%" B_PRIx32 ";%" B_PRIu32
|
||||||
encoding, // f.u.encoded_audio.encoding,
|
";0x%" B_PRIxSIZE ";0x%08" B_PRIx32 ";%d;0x%04x)",
|
||||||
f.u.encoded_audio.bit_rate,
|
encoding,
|
||||||
f.u.encoded_audio.frame_size,
|
f.u.encoded_audio.bit_rate,
|
||||||
// (
|
f.u.encoded_audio.frame_size,
|
||||||
f.u.encoded_audio.output.frame_rate,
|
f.u.encoded_audio.output.frame_rate,
|
||||||
f.u.encoded_audio.output.channel_count,
|
f.u.encoded_audio.output.channel_count,
|
||||||
f.u.encoded_audio.output.format,
|
f.u.encoded_audio.output.format,
|
||||||
f.u.encoded_audio.output.byte_order,
|
f.u.encoded_audio.output.byte_order,
|
||||||
f.u.encoded_audio.output.buffer_size,
|
f.u.encoded_audio.output.buffer_size,
|
||||||
f.u.encoded_audio.multi_info.channel_mask,
|
f.u.encoded_audio.multi_info.channel_mask,
|
||||||
f.u.encoded_audio.multi_info.valid_bits,
|
f.u.encoded_audio.multi_info.valid_bits,
|
||||||
f.u.encoded_audio.multi_info.matrix_mask);
|
f.u.encoded_audio.multi_info.matrix_mask);
|
||||||
// )
|
|
||||||
return true;
|
return true;
|
||||||
case B_MEDIA_ENCODED_VIDEO:
|
case B_MEDIA_ENCODED_VIDEO:
|
||||||
snprintf(encoding, 10, "%d", f.u.encoded_video.encoding);
|
snprintf(encoding, 10, "%d", f.u.encoded_video.encoding);
|
||||||
@@ -1130,23 +1130,22 @@ string_for_format(const media_format& f, char* buf, size_t size)
|
|||||||
videoOrientation = "TopLR";
|
videoOrientation = "TopLR";
|
||||||
else if (f.u.encoded_video.output.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
|
else if (f.u.encoded_video.output.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
|
||||||
videoOrientation = "BotLR";
|
videoOrientation = "BotLR";
|
||||||
snprintf(buf, size,
|
snprintf(buf, size,
|
||||||
"cvideo;%s;%g;%g;%ld;(%g;0x%x;%ld;%ld;%ld;%ld;%s;%d;%d)",
|
"cvideo;%s;%g;%g;%" B_PRIuSIZE ";(%g;0x%x;%" B_PRIu32 ";%" B_PRIu32
|
||||||
encoding,
|
";%" B_PRIu32 ";%" B_PRIu32 ";%s;%d;%d)",
|
||||||
f.u.encoded_video.avg_bit_rate,
|
encoding,
|
||||||
f.u.encoded_video.max_bit_rate,
|
f.u.encoded_video.avg_bit_rate,
|
||||||
|
f.u.encoded_video.max_bit_rate,
|
||||||
f.u.encoded_video.frame_size,
|
f.u.encoded_video.frame_size,
|
||||||
// (
|
|
||||||
f.u.encoded_video.output.field_rate,
|
f.u.encoded_video.output.field_rate,
|
||||||
f.u.encoded_video.output.display.format,
|
f.u.encoded_video.output.display.format,
|
||||||
f.u.encoded_video.output.interlace,
|
f.u.encoded_video.output.interlace,
|
||||||
f.u.encoded_video.output.display.line_width,
|
f.u.encoded_video.output.display.line_width,
|
||||||
f.u.encoded_video.output.display.line_count,
|
f.u.encoded_video.output.display.line_count,
|
||||||
f.u.encoded_video.output.first_active,
|
f.u.encoded_video.output.first_active,
|
||||||
videoOrientation,
|
videoOrientation,
|
||||||
f.u.encoded_video.output.pixel_width_aspect,
|
f.u.encoded_video.output.pixel_width_aspect,
|
||||||
f.u.encoded_video.output.pixel_height_aspect);
|
f.u.encoded_video.output.pixel_height_aspect);
|
||||||
// )
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
snprintf(buf, size, "%d-", f.type);
|
snprintf(buf, size, "%d-", f.type);
|
||||||
@@ -1232,7 +1231,7 @@ shutdown_media_server(bigtime_t timeout,
|
|||||||
BMessage msg(B_QUIT_REQUESTED);
|
BMessage msg(B_QUIT_REQUESTED);
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
status_t err;
|
status_t err;
|
||||||
|
|
||||||
if ((err = msg.AddBool("be:_user_request", true)) != B_OK)
|
if ((err = msg.AddBool("be:_user_request", true)) != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -1266,7 +1265,7 @@ shutdown_media_server(bigtime_t timeout,
|
|||||||
progress(40, "Waiting for media_server to quit.", cookie);
|
progress(40, "Waiting for media_server to quit.", cookie);
|
||||||
snooze(200000);
|
snooze(200000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (be_roster->IsRunning(B_MEDIA_ADDON_SERVER_SIGNATURE)) {
|
if (be_roster->IsRunning(B_MEDIA_ADDON_SERVER_SIGNATURE)) {
|
||||||
progress(50, "Waiting for media_addon_server to quit.", cookie);
|
progress(50, "Waiting for media_addon_server to quit.", cookie);
|
||||||
snooze(200000);
|
snooze(200000);
|
||||||
@@ -1310,7 +1309,7 @@ launch_media_server(uint32 flags)
|
|||||||
err = B_MEDIA_SYSTEM_FAILURE;
|
err = B_MEDIA_SYSTEM_FAILURE;
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
snooze(2000000);
|
snooze(2000000);
|
||||||
|
|
||||||
BMessage msg(1); // this is a hack
|
BMessage msg(1); // this is a hack
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
BMessenger messenger(B_MEDIA_ADDON_SERVER_SIGNATURE);
|
BMessenger messenger(B_MEDIA_ADDON_SERVER_SIGNATURE);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ BMediaEventLooper::Start(bigtime_t performance_time)
|
|||||||
// 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.
|
||||||
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_START));
|
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_START));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,15 +97,15 @@ BMediaEventLooper::Stop(bigtime_t performance_time,
|
|||||||
bool immediate)
|
bool immediate)
|
||||||
{
|
{
|
||||||
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 performanceTime,
|
// by a call to the BMediaRoster. The specified performanceTime,
|
||||||
// the time at which the node should stop, may be in the future.
|
// the time at which the node should stop, may be in the future.
|
||||||
// If immediate is true, your node should ignore the performanceTime
|
// If immediate is true, your node should ignore the performanceTime
|
||||||
// value and synchronously stop performance. When Stop() returns,
|
// value and synchronously stop performance. When Stop() returns,
|
||||||
// you're promising not to write into any BBuffers you may have
|
// you're promising not to write into any BBuffers you may have
|
||||||
// received from your downstream consumers, and you promise not
|
// received from your downstream consumers, and you promise not
|
||||||
// to send any more buffers until Start() is called again.
|
// to send any more buffers until Start() is called again.
|
||||||
|
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
// always be sure to add to the front of the queue so we can make sure it is
|
// always be sure to add to the front of the queue so we can make sure it is
|
||||||
// handled before any buffers are sent!
|
// handled before any buffers are sent!
|
||||||
@@ -120,11 +120,11 @@ BMediaEventLooper::Seek(bigtime_t media_time,
|
|||||||
bigtime_t performance_time)
|
bigtime_t performance_time)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
// This hook function is called when a node is asked to seek to
|
// This hook function is called when a node is asked to seek to
|
||||||
// the specified mediaTime by a call to the BMediaRoster.
|
// the specified mediaTime by a call to the BMediaRoster.
|
||||||
// The specified performanceTime, the time at which the node
|
// The specified performanceTime, the time at which the node
|
||||||
// should begin the seek operation, may be in the future.
|
// should begin the seek operation, may be in the future.
|
||||||
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_SEEK, NULL,
|
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_SEEK, NULL,
|
||||||
BTimedEventQueue::B_NO_CLEANUP, 0, media_time, NULL));
|
BTimedEventQueue::B_NO_CLEANUP, 0, media_time, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,18 +134,18 @@ BMediaEventLooper::TimeWarp(bigtime_t at_real_time,
|
|||||||
bigtime_t to_performance_time)
|
bigtime_t to_performance_time)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
// This hook function is called when the time source to which the
|
// This hook function is called when the time source to which the
|
||||||
// node is slaved is repositioned (via a seek operation) such that
|
// node is slaved is repositioned (via a seek operation) such that
|
||||||
// there will be a sudden jump in the performance time progression
|
// there will be a sudden jump in the performance time progression
|
||||||
// as seen by the node. The to_performance_time argument indicates
|
// as seen by the node. The to_performance_time argument indicates
|
||||||
// the new performance time; the change should occur at the real
|
// the new performance time; the change should occur at the real
|
||||||
// time specified by the at_real_time argument.
|
// time specified by the at_real_time argument.
|
||||||
|
|
||||||
// place in the realtime queue
|
// place in the realtime queue
|
||||||
fRealTimeQueue.AddEvent(media_timed_event(at_real_time, BTimedEventQueue::B_WARP,
|
fRealTimeQueue.AddEvent(media_timed_event(at_real_time, BTimedEventQueue::B_WARP,
|
||||||
NULL, BTimedEventQueue::B_NO_CLEANUP, 0, to_performance_time, NULL));
|
NULL, BTimedEventQueue::B_NO_CLEANUP, 0, to_performance_time, NULL));
|
||||||
|
|
||||||
// BeBook: Your implementation of TimeWarp() should call through to BMediaNode::TimeWarp()
|
// BeBook: Your implementation of TimeWarp() should call through to BMediaNode::TimeWarp()
|
||||||
// BeBook: as well as all other inherited forms of TimeWarp()
|
// BeBook: as well as all other inherited forms of TimeWarp()
|
||||||
// XXX should we do this here?
|
// XXX should we do this here?
|
||||||
BMediaNode::TimeWarp(at_real_time, to_performance_time);
|
BMediaNode::TimeWarp(at_real_time, to_performance_time);
|
||||||
@@ -168,15 +168,16 @@ BMediaEventLooper::SetRunMode(run_mode mode)
|
|||||||
CALLED();
|
CALLED();
|
||||||
// The SetRunMode() hook function is called when someone requests that your node's run mode be changed.
|
// The SetRunMode() hook function is called when someone requests that your node's run mode be changed.
|
||||||
|
|
||||||
// bump or reduce priority when switching from/to offline run mode
|
// bump or reduce priority when switching from/to offline run mode
|
||||||
int32 priority;
|
int32 priority;
|
||||||
priority = (mode == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
|
priority = (mode == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
|
||||||
if (priority != fCurrentPriority) {
|
if (priority != fCurrentPriority) {
|
||||||
fCurrentPriority = priority;
|
fCurrentPriority = priority;
|
||||||
if (fControlThread > 0) {
|
if (fControlThread > 0) {
|
||||||
set_thread_priority(fControlThread, fCurrentPriority);
|
set_thread_priority(fControlThread, fCurrentPriority);
|
||||||
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
||||||
printf("BMediaEventLooper: SchedulingLatency is %Ld\n", fSchedulingLatency);
|
printf("BMediaEventLooper: SchedulingLatency is %" B_PRId64 "\n",
|
||||||
|
fSchedulingLatency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +189,9 @@ BMediaEventLooper::SetRunMode(run_mode mode)
|
|||||||
BMediaEventLooper::CleanUpEvent(const media_timed_event *event)
|
BMediaEventLooper::CleanUpEvent(const media_timed_event *event)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
// Implement this function to clean up after custom events you've created
|
// Implement this function to clean up after custom events you've created
|
||||||
// and added to your queue. It's called when a custom event is removed from
|
// and added to your queue. It's called when a custom event is removed from
|
||||||
// the queue, to let you handle any special tidying-up that the event might require.
|
// the queue, to let you handle any special tidying-up that the event might require.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -220,8 +221,8 @@ BMediaEventLooper::ControlLoop()
|
|||||||
if (RunState() == B_QUITTING)
|
if (RunState() == B_QUITTING)
|
||||||
return;
|
return;
|
||||||
// BMediaEventLooper compensates your performance time by adding the event latency
|
// BMediaEventLooper compensates your performance time by adding the event latency
|
||||||
// (see SetEventLatency()) and the scheduling latency (or, for real-time events,
|
// (see SetEventLatency()) and the scheduling latency (or, for real-time events,
|
||||||
// only the scheduling latency).
|
// only the scheduling latency).
|
||||||
|
|
||||||
latency = fEventLatency + fSchedulingLatency;
|
latency = fEventLatency + fSchedulingLatency;
|
||||||
waituntil = B_INFINITE_TIMEOUT;
|
waituntil = B_INFINITE_TIMEOUT;
|
||||||
@@ -349,17 +350,18 @@ BMediaEventLooper::SetPriority(int32 priority)
|
|||||||
// clamp to a valid value
|
// clamp to a valid value
|
||||||
if (priority < 5)
|
if (priority < 5)
|
||||||
priority = 5;
|
priority = 5;
|
||||||
|
|
||||||
if (priority > 120)
|
if (priority > 120)
|
||||||
priority = 120;
|
priority = 120;
|
||||||
|
|
||||||
fSetPriority = priority;
|
fSetPriority = priority;
|
||||||
fCurrentPriority = (RunMode() == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
|
fCurrentPriority = (RunMode() == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
|
||||||
|
|
||||||
if (fControlThread > 0) {
|
if (fControlThread > 0) {
|
||||||
set_thread_priority(fControlThread, fCurrentPriority);
|
set_thread_priority(fControlThread, fCurrentPriority);
|
||||||
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
||||||
printf("BMediaEventLooper: SchedulingLatency is %Ld\n", fSchedulingLatency);
|
printf("BMediaEventLooper: SchedulingLatency is %" B_PRId64 "\n",
|
||||||
|
fSchedulingLatency);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -375,7 +377,7 @@ BMediaEventLooper::SetRunState(run_state state)
|
|||||||
// also needed for correct terminating of the ControlLoop()
|
// also needed for correct terminating of the ControlLoop()
|
||||||
if (fRunState == B_QUITTING && state != B_TERMINATED)
|
if (fRunState == B_QUITTING && state != B_TERMINATED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fRunState = state;
|
fRunState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,10 +415,10 @@ void
|
|||||||
BMediaEventLooper::Run()
|
BMediaEventLooper::Run()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
if (fControlThread != -1)
|
if (fControlThread != -1)
|
||||||
return; // thread already running
|
return; // thread already running
|
||||||
|
|
||||||
// until now, the run state is B_UNREGISTERED, but we need to start in B_STOPPED state.
|
// until now, the run state is B_UNREGISTERED, but we need to start in B_STOPPED state.
|
||||||
SetRunState(B_STOPPED);
|
SetRunState(B_STOPPED);
|
||||||
|
|
||||||
@@ -427,7 +429,8 @@ BMediaEventLooper::Run()
|
|||||||
|
|
||||||
// get latency information
|
// get latency information
|
||||||
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
|
||||||
printf("BMediaEventLooper: SchedulingLatency is %Ld\n", fSchedulingLatency);
|
printf("BMediaEventLooper: SchedulingLatency is %" B_PRId64 "\n",
|
||||||
|
fSchedulingLatency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -438,7 +441,7 @@ BMediaEventLooper::Quit()
|
|||||||
|
|
||||||
if (fRunState == B_TERMINATED)
|
if (fRunState == B_TERMINATED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetRunState(B_QUITTING);
|
SetRunState(B_QUITTING);
|
||||||
close_port(ControlPort());
|
close_port(ControlPort());
|
||||||
if (fControlThread != -1) {
|
if (fControlThread != -1) {
|
||||||
@@ -463,23 +466,23 @@ BMediaEventLooper::DispatchEvent(const media_timed_event *event,
|
|||||||
case BTimedEventQueue::B_START:
|
case BTimedEventQueue::B_START:
|
||||||
SetRunState(B_STARTED);
|
SetRunState(B_STARTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTimedEventQueue::B_STOP:
|
case BTimedEventQueue::B_STOP:
|
||||||
SetRunState(B_STOPPED);
|
SetRunState(B_STOPPED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTimedEventQueue::B_SEEK:
|
case BTimedEventQueue::B_SEEK:
|
||||||
/* nothing */
|
/* nothing */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTimedEventQueue::B_WARP:
|
case BTimedEventQueue::B_WARP:
|
||||||
/* nothing */
|
/* nothing */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_DispatchCleanUp(event);
|
_DispatchCleanUp(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,8 +516,8 @@ BMediaEventLooper::_DispatchCleanUp(const media_timed_event *event)
|
|||||||
{
|
{
|
||||||
PRINT(6, "CALLED BMediaEventLooper::_DispatchCleanUp()\n");
|
PRINT(6, "CALLED BMediaEventLooper::_DispatchCleanUp()\n");
|
||||||
|
|
||||||
// this function to clean up after custom events you've created
|
// this function to clean up after custom events you've created
|
||||||
if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP)
|
if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP)
|
||||||
CleanUpEvent(event);
|
CleanUpEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
|
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
|
||||||
* Copyright 2008, Maurice Kalinowski. All rights reserved.
|
* Copyright 2008, Maurice Kalinowski. All rights reserved.
|
||||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2009-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -103,8 +103,8 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
|
|||||||
fStreamInfo[i].cookie = 0;
|
fStreamInfo[i].cookie = 0;
|
||||||
fStreamInfo[i].hasCookie = false;
|
fStreamInfo[i].hasCookie = false;
|
||||||
fStreamInfo[i].status = B_ERROR;
|
fStreamInfo[i].status = B_ERROR;
|
||||||
ERROR("MediaExtractor::MediaExtractor: AllocateCookie for stream "
|
ERROR("MediaExtractor::MediaExtractor: AllocateCookie for stream %"
|
||||||
"%ld failed\n", i);
|
B_PRId32 " failed\n", i);
|
||||||
} else
|
} else
|
||||||
fStreamInfo[i].hasCookie = true;
|
fStreamInfo[i].hasCookie = true;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
|
|||||||
!= B_OK) {
|
!= B_OK) {
|
||||||
fStreamInfo[i].status = B_ERROR;
|
fStreamInfo[i].status = B_ERROR;
|
||||||
ERROR("MediaExtractor::MediaExtractor: GetStreamInfo for "
|
ERROR("MediaExtractor::MediaExtractor: GetStreamInfo for "
|
||||||
"stream %ld failed\n", i);
|
"stream %" B_PRId32 " failed\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
|||||||
status_t status = fStreamInfo[stream].status;
|
status_t status = fStreamInfo[stream].status;
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("MediaExtractor::CreateDecoder can't create decoder for "
|
ERROR("MediaExtractor::CreateDecoder can't create decoder for "
|
||||||
"stream %ld: %s\n", stream, strerror(status));
|
"stream %" B_PRId32 ": %s\n", stream, strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,8 +346,8 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
|||||||
sizeof(formatString));
|
sizeof(formatString));
|
||||||
|
|
||||||
ERROR("MediaExtractor::CreateDecoder gPluginManager.CreateDecoder "
|
ERROR("MediaExtractor::CreateDecoder gPluginManager.CreateDecoder "
|
||||||
"failed for stream %ld, format: %s: %s\n", stream, formatString,
|
"failed for stream %" B_PRId32 ", format: %s: %s\n", stream,
|
||||||
strerror(status));
|
formatString, strerror(status));
|
||||||
#endif
|
#endif
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
|||||||
if (chunkProvider == NULL) {
|
if (chunkProvider == NULL) {
|
||||||
gPluginManager.DestroyDecoder(decoder);
|
gPluginManager.DestroyDecoder(decoder);
|
||||||
ERROR("MediaExtractor::CreateDecoder can't create chunk provider "
|
ERROR("MediaExtractor::CreateDecoder can't create chunk provider "
|
||||||
"for stream %ld\n", stream);
|
"for stream %" B_PRId32 "\n", stream);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,16 +367,16 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
|||||||
fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize);
|
fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
gPluginManager.DestroyDecoder(decoder);
|
gPluginManager.DestroyDecoder(decoder);
|
||||||
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %ld: %s\n",
|
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %" B_PRId32
|
||||||
stream, strerror(status));
|
": %s\n", stream, strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = gPluginManager.GetDecoderInfo(decoder, codecInfo);
|
status = gPluginManager.GetDecoderInfo(decoder, codecInfo);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
gPluginManager.DestroyDecoder(decoder);
|
gPluginManager.DestroyDecoder(decoder);
|
||||||
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream "
|
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream %"
|
||||||
"%ld: %s\n", stream, strerror(status));
|
B_PRId32 ": %s\n", stream, strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+215
-179
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008 Maurice Kalinowski, haiku@kaldience.com
|
* Copyright 2008 Maurice Kalinowski, haiku@kaldience.com
|
||||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2009-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||||
*
|
*
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -132,8 +132,8 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode* node)
|
|||||||
// NOTE: This node could have been created by an application,
|
// NOTE: This node could have been created by an application,
|
||||||
// it does not mean there is an error.
|
// it does not mean there is an error.
|
||||||
// TODO: this check incorrectly triggers on BeOS R5 BT848 node
|
// TODO: this check incorrectly triggers on BeOS R5 BT848 node
|
||||||
TRACE("BMediaRosterEx::SaveNodeConfiguration node %ld not instantiated "
|
TRACE("BMediaRosterEx::SaveNodeConfiguration node %" B_PRId32 " not "
|
||||||
"from BMediaAddOn!\n", node->ID());
|
"instantiated from BMediaAddOn!\n", node->ID());
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,8 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode* node)
|
|||||||
|
|
||||||
// TODO: fix this
|
// TODO: fix this
|
||||||
printf("### BMediaRosterEx::SaveNodeConfiguration should save addon-id "
|
printf("### BMediaRosterEx::SaveNodeConfiguration should save addon-id "
|
||||||
"%ld, flavor-id %ld config NOW!\n", addonID, flavorID);
|
"%" B_PRId32 ", flavor-id %" B_PRId32 " config NOW!\n", addonID,
|
||||||
|
flavorID);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +154,8 @@ BMediaRosterEx::LoadNodeConfiguration(media_addon_id addonID, int32 flavorID,
|
|||||||
// TODO: fix this
|
// TODO: fix this
|
||||||
_msg->MakeEmpty(); // to be fully R5 compliant
|
_msg->MakeEmpty(); // to be fully R5 compliant
|
||||||
printf("### BMediaRosterEx::LoadNodeConfiguration should load addon-id "
|
printf("### BMediaRosterEx::LoadNodeConfiguration should load addon-id "
|
||||||
"%ld, flavor-id %ld config NOW!\n", addonID, flavorID);
|
"%" B_PRId32 ", flavor-id %" B_PRId32 " config NOW!\n", addonID,
|
||||||
|
flavorID);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +201,8 @@ BMediaRosterEx::ReleaseNodeAll(const media_node& node)
|
|||||||
|
|
||||||
if (node.kind & NODE_KIND_NO_REFCOUNTING) {
|
if (node.kind & NODE_KIND_NO_REFCOUNTING) {
|
||||||
printf("BMediaRoster::ReleaseNodeAll, trying to release reference "
|
printf("BMediaRoster::ReleaseNodeAll, trying to release reference "
|
||||||
"counting disabled timesource, node %ld, port %ld, team %ld\n",
|
"counting disabled timesource, node %" B_PRId32 ", port %" B_PRId32
|
||||||
|
", team %" B_PRId32 "\n",
|
||||||
node.node, node.port, BPrivate::current_team());
|
node.node, node.port, BPrivate::current_team());
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -211,14 +214,16 @@ BMediaRosterEx::ReleaseNodeAll(const media_node& node)
|
|||||||
request.node = node;
|
request.node = node;
|
||||||
request.team = BPrivate::current_team();
|
request.team = BPrivate::current_team();
|
||||||
|
|
||||||
TRACE("BMediaRoster::ReleaseNodeAll, node %ld, port %ld, team %ld\n",
|
TRACE("BMediaRoster::ReleaseNodeAll, node %" B_PRId32 ", port %" B_PRId32
|
||||||
|
", team %" B_PRId32 "\n",
|
||||||
node.node, node.port, BPrivate::current_team());
|
node.node, node.port, BPrivate::current_team());
|
||||||
|
|
||||||
rv = QueryServer(SERVER_RELEASE_NODE_ALL, &request, sizeof(request), &reply,
|
rv = QueryServer(SERVER_RELEASE_NODE_ALL, &request, sizeof(request), &reply,
|
||||||
sizeof(reply));
|
sizeof(reply));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::ReleaseNodeAll FAILED, node %ld, port %ld, team "
|
ERROR("BMediaRoster::ReleaseNodeAll FAILED, node %" B_PRId32 ", port %"
|
||||||
"%ld!\n", node.node, node.port, BPrivate::current_team());
|
B_PRId32 ", team %" B_PRId32 "!\n", node.node, node.port,
|
||||||
|
BPrivate::current_team());
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -294,11 +299,11 @@ BMediaRosterEx::GetAllOutputs(const media_node& node, List<media_output>* list)
|
|||||||
status_t rv;
|
status_t rv;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
PRINT(4, "BMediaRosterEx::GetAllOutputs() node %ld, port %ld\n", node.node,
|
PRINT(4, "BMediaRosterEx::GetAllOutputs() node %" B_PRId32 ", port %"
|
||||||
node.port);
|
B_PRId32 "\n", node.node, node.port);
|
||||||
|
|
||||||
if (!(node.kind & B_BUFFER_PRODUCER)) {
|
if (!(node.kind & B_BUFFER_PRODUCER)) {
|
||||||
ERROR("BMediaRosterEx::GetAllOutputs: node %ld is not a "
|
ERROR("BMediaRosterEx::GetAllOutputs: node %" B_PRId32 " is not a "
|
||||||
"B_BUFFER_PRODUCER\n", node.node);
|
"B_BUFFER_PRODUCER\n", node.node);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
@@ -320,7 +325,7 @@ BMediaRosterEx::GetAllOutputs(const media_node& node, List<media_output>* list)
|
|||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
PRINT(3," next cookie %ld, ", cookie);
|
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
|
||||||
PRINT_OUTPUT("output ", reply.output);
|
PRINT_OUTPUT("output ", reply.output);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -340,7 +345,8 @@ BMediaRosterEx::GetAllOutputs(BBufferProducer* node, List<media_output>* list)
|
|||||||
int32 cookie;
|
int32 cookie;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
PRINT(4, "BMediaRosterEx::GetAllOutputs() (by pointer) node %ld, port %ld\n", node->ID(), node->ControlPort());
|
PRINT(4, "BMediaRosterEx::GetAllOutputs() (by pointer) node %" B_PRId32
|
||||||
|
", port %" B_PRId32 "\n", node->ID(), node->ControlPort());
|
||||||
|
|
||||||
result = B_OK;
|
result = B_OK;
|
||||||
cookie = 0;
|
cookie = 0;
|
||||||
@@ -354,7 +360,7 @@ BMediaRosterEx::GetAllOutputs(BBufferProducer* node, List<media_output>* list)
|
|||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
PRINT(3," next cookie %ld, ", cookie);
|
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
|
||||||
PRINT_OUTPUT("output ", output);
|
PRINT_OUTPUT("output ", output);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -370,11 +376,11 @@ BMediaRosterEx::GetAllInputs(const media_node& node, List<media_input>* list)
|
|||||||
status_t rv;
|
status_t rv;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
PRINT(4, "BMediaRosterEx::GetAllInputs() node %ld, port %ld\n", node.node,
|
PRINT(4, "BMediaRosterEx::GetAllInputs() node %" B_PRId32 ", port %"
|
||||||
node.port);
|
B_PRId32 "\n", node.node, node.port);
|
||||||
|
|
||||||
if (!(node.kind & B_BUFFER_CONSUMER)) {
|
if (!(node.kind & B_BUFFER_CONSUMER)) {
|
||||||
ERROR("BMediaRosterEx::GetAllInputs: node %ld is not a "
|
ERROR("BMediaRosterEx::GetAllInputs: node %" B_PRId32 " is not a "
|
||||||
"B_BUFFER_CONSUMER\n", node.node);
|
"B_BUFFER_CONSUMER\n", node.node);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
@@ -396,7 +402,7 @@ BMediaRosterEx::GetAllInputs(const media_node& node, List<media_input>* list)
|
|||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
PRINT(3," next cookie %ld, ", cookie);
|
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
|
||||||
PRINT_OUTPUT("input ", reply.input);
|
PRINT_OUTPUT("input ", reply.input);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -416,7 +422,8 @@ BMediaRosterEx::GetAllInputs(BBufferConsumer* node, List<media_input>* list)
|
|||||||
int32 cookie;
|
int32 cookie;
|
||||||
status_t result;
|
status_t result;
|
||||||
|
|
||||||
PRINT(4, "BMediaRosterEx::GetAllInputs() (by pointer) node %ld, port %ld\n", node->ID(), node->ControlPort());
|
PRINT(4, "BMediaRosterEx::GetAllInputs() (by pointer) node %" B_PRId32
|
||||||
|
", port %" B_PRId32 "\n", node->ID(), node->ControlPort());
|
||||||
|
|
||||||
result = B_OK;
|
result = B_OK;
|
||||||
cookie = 0;
|
cookie = 0;
|
||||||
@@ -430,7 +437,7 @@ BMediaRosterEx::GetAllInputs(BBufferConsumer* node, List<media_input>* list)
|
|||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
#if DEBUG >= 3
|
#if DEBUG >= 3
|
||||||
PRINT(3," next cookie %ld, ", cookie);
|
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
|
||||||
PRINT_INPUT("input ", input);
|
PRINT_INPUT("input ", input);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -450,7 +457,7 @@ BMediaRosterEx::PublishOutputs(const media_node& node, List<media_output>* list)
|
|||||||
status_t rv;
|
status_t rv;
|
||||||
|
|
||||||
count = list->CountItems();
|
count = list->CountItems();
|
||||||
TRACE("PublishOutputs: publishing %ld\n", count);
|
TRACE("PublishOutputs: publishing %" B_PRId32 "\n", count);
|
||||||
|
|
||||||
request.node = node;
|
request.node = node;
|
||||||
request.count = count;
|
request.count = count;
|
||||||
@@ -461,7 +468,7 @@ BMediaRosterEx::PublishOutputs(const media_node& node, List<media_output>* list)
|
|||||||
request.area = create_area("publish outputs", &start_addr,
|
request.area = create_area("publish outputs", &start_addr,
|
||||||
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (request.area < B_OK) {
|
if (request.area < B_OK) {
|
||||||
ERROR("PublishOutputs: failed to create area, %#lx\n",
|
ERROR("PublishOutputs: failed to create area, %#" B_PRIx32 "\n",
|
||||||
request.area);
|
request.area);
|
||||||
return (status_t)request.area;
|
return (status_t)request.area;
|
||||||
}
|
}
|
||||||
@@ -470,7 +477,7 @@ BMediaRosterEx::PublishOutputs(const media_node& node, List<media_output>* list)
|
|||||||
request.area = -1;
|
request.area = -1;
|
||||||
outputs = request.outputs;
|
outputs = request.outputs;
|
||||||
}
|
}
|
||||||
TRACE("PublishOutputs: area %ld\n", request.area);
|
TRACE("PublishOutputs: area %" B_PRId32 "\n", request.area);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0, list->Rewind(); list->GetNext(&output); i++) {
|
for (i = 0, list->Rewind(); list->GetNext(&output); i++) {
|
||||||
@@ -499,7 +506,7 @@ BMediaRosterEx::PublishInputs(const media_node& node, List<media_input>* list)
|
|||||||
status_t rv;
|
status_t rv;
|
||||||
|
|
||||||
count = list->CountItems();
|
count = list->CountItems();
|
||||||
TRACE("PublishInputs: publishing %ld\n", count);
|
TRACE("PublishInputs: publishing %" B_PRId32 "\n", count);
|
||||||
|
|
||||||
request.node = node;
|
request.node = node;
|
||||||
request.count = count;
|
request.count = count;
|
||||||
@@ -510,7 +517,8 @@ BMediaRosterEx::PublishInputs(const media_node& node, List<media_input>* list)
|
|||||||
request.area = create_area("publish inputs", &start_addr,
|
request.area = create_area("publish inputs", &start_addr,
|
||||||
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (request.area < B_OK) {
|
if (request.area < B_OK) {
|
||||||
ERROR("PublishInputs: failed to create area, %#lx\n", request.area);
|
ERROR("PublishInputs: failed to create area, %#" B_PRIx32 "\n",
|
||||||
|
request.area);
|
||||||
return (status_t)request.area;
|
return (status_t)request.area;
|
||||||
}
|
}
|
||||||
inputs = static_cast<media_input *>(start_addr);
|
inputs = static_cast<media_input *>(start_addr);
|
||||||
@@ -518,7 +526,7 @@ BMediaRosterEx::PublishInputs(const media_node& node, List<media_input>* list)
|
|||||||
request.area = -1;
|
request.area = -1;
|
||||||
inputs = request.inputs;
|
inputs = request.inputs;
|
||||||
}
|
}
|
||||||
TRACE("PublishInputs: area %ld\n", request.area);
|
TRACE("PublishInputs: area %" B_PRId32 "\n", request.area);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0, list->Rewind(); list->GetNext(&input); i++) {
|
for (i = 0, list->Rewind(); list->GetNext(&input); i++) {
|
||||||
@@ -766,8 +774,9 @@ BMediaRoster::ReleaseNode(const media_node& node)
|
|||||||
|
|
||||||
if (node.kind & NODE_KIND_NO_REFCOUNTING) {
|
if (node.kind & NODE_KIND_NO_REFCOUNTING) {
|
||||||
printf("BMediaRoster::ReleaseNode, trying to release reference "
|
printf("BMediaRoster::ReleaseNode, trying to release reference "
|
||||||
"counting disabled timesource, node %ld, port %ld, team %ld\n",
|
"counting disabled timesource, node %" B_PRId32 ", port %" B_PRId32
|
||||||
node.node, node.port, BPrivate::current_team());
|
", team %" B_PRId32 "\n", node.node, node.port,
|
||||||
|
BPrivate::current_team());
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,14 +787,16 @@ BMediaRoster::ReleaseNode(const media_node& node)
|
|||||||
request.node = node;
|
request.node = node;
|
||||||
request.team = BPrivate::current_team();
|
request.team = BPrivate::current_team();
|
||||||
|
|
||||||
TRACE("BMediaRoster::ReleaseNode, node %ld, port %ld, team %ld\n",
|
TRACE("BMediaRoster::ReleaseNode, node %" B_PRId32 ", port %" B_PRId32
|
||||||
node.node, node.port, BPrivate::current_team());
|
", team %" B_PRId32 "\n", node.node, node.port,
|
||||||
|
BPrivate::current_team());
|
||||||
|
|
||||||
rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply,
|
rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply,
|
||||||
sizeof(reply));
|
sizeof(reply));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::ReleaseNode FAILED, node %ld, port %ld, team "
|
ERROR("BMediaRoster::ReleaseNode FAILED, node %" B_PRId32 ", port %"
|
||||||
"%ld!\n", node.node, node.port, BPrivate::current_team());
|
B_PRId32 ", team %" B_PRId32 "!\n", node.node, node.port,
|
||||||
|
BPrivate::current_team());
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -808,13 +819,14 @@ BMediaRoster::MakeTimeSourceFor(const media_node& forNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IS_INVALID_NODE(forNode)) {
|
if (IS_INVALID_NODE(forNode)) {
|
||||||
ERROR("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %ld, "
|
ERROR("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %"
|
||||||
"port %ld, kinds 0x%lx\n", forNode.node, forNode.port,
|
B_PRId32 ", port %" B_PRId32 ", kinds 0x%" B_PRIx32 "\n",
|
||||||
forNode.kind);
|
forNode.node, forNode.port, forNode.kind);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("BMediaRoster::MakeTimeSourceFor: node %ld enter\n", forNode.node);
|
TRACE("BMediaRoster::MakeTimeSourceFor: node %" B_PRId32 " enter\n",
|
||||||
|
forNode.node);
|
||||||
|
|
||||||
node_get_timesource_request request;
|
node_get_timesource_request request;
|
||||||
node_get_timesource_reply reply;
|
node_get_timesource_reply reply;
|
||||||
@@ -831,7 +843,8 @@ BMediaRoster::MakeTimeSourceFor(const media_node& forNode)
|
|||||||
|
|
||||||
source = MediaRosterEx(this)->MakeTimeSourceObject(reply.timesource_id);
|
source = MediaRosterEx(this)->MakeTimeSourceObject(reply.timesource_id);
|
||||||
|
|
||||||
TRACE("BMediaRoster::MakeTimeSourceFor: node %ld leave\n", forNode.node);
|
TRACE("BMediaRoster::MakeTimeSourceFor: node %" B_PRId32 " leave\n",
|
||||||
|
forNode.node);
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
@@ -870,26 +883,26 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
media_node destnode;
|
media_node destnode;
|
||||||
rv = GetNodeFor(NodeIDFor(from.port), &sourcenode);
|
rv = GetNodeFor(NodeIDFor(from.port), &sourcenode);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: Can't find source node for port %ld\n",
|
ERROR("BMediaRoster::Connect: Can't find source node for port %"
|
||||||
from.port);
|
B_PRId32 "\n", from.port);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
ReleaseNode(sourcenode);
|
ReleaseNode(sourcenode);
|
||||||
rv = GetNodeFor(NodeIDFor(to.port), &destnode);
|
rv = GetNodeFor(NodeIDFor(to.port), &destnode);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: Can't find destination node for port "
|
ERROR("BMediaRoster::Connect: Can't find destination node for port "
|
||||||
"%ld\n", to.port);
|
"%" B_PRId32 "\n", to.port);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
ReleaseNode(destnode);
|
ReleaseNode(destnode);
|
||||||
|
|
||||||
if (!(sourcenode.kind & B_BUFFER_PRODUCER)) {
|
if (!(sourcenode.kind & B_BUFFER_PRODUCER)) {
|
||||||
ERROR("BMediaRoster::Connect: source node %ld is not a "
|
ERROR("BMediaRoster::Connect: source node %" B_PRId32 " is not a "
|
||||||
"B_BUFFER_PRODUCER\n", sourcenode.node);
|
"B_BUFFER_PRODUCER\n", sourcenode.node);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
if (!(destnode.kind & B_BUFFER_CONSUMER)) {
|
if (!(destnode.kind & B_BUFFER_CONSUMER)) {
|
||||||
ERROR("BMediaRoster::Connect: destination node %ld is not a "
|
ERROR("BMediaRoster::Connect: destination node %" B_PRId32 " is not a "
|
||||||
"B_BUFFER_CONSUMER\n", destnode.node);
|
"B_BUFFER_CONSUMER\n", destnode.node);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
@@ -907,7 +920,7 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
sizeof(request1), &reply1, sizeof(reply1));
|
sizeof(request1), &reply1, sizeof(reply1));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: aborted after "
|
ERROR("BMediaRoster::Connect: aborted after "
|
||||||
"BBufferProducer::FormatProposal, status = %#lx\n",rv);
|
"BBufferProducer::FormatProposal, status = %#" B_PRIx32 "\n",rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
// reply1.format now contains the format proposed by the producer
|
// reply1.format now contains the format proposed by the producer
|
||||||
@@ -925,7 +938,7 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
sizeof(request2), &reply2, sizeof(reply2));
|
sizeof(request2), &reply2, sizeof(reply2));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: aborted after "
|
ERROR("BMediaRoster::Connect: aborted after "
|
||||||
"BBufferConsumer::AcceptFormat, status = %#lx\n",rv);
|
"BBufferConsumer::AcceptFormat, status = %#" B_PRIx32 "\n",rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
// reply2.format now contains the format accepted by the consumer
|
// reply2.format now contains the format accepted by the consumer
|
||||||
@@ -945,7 +958,7 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
sizeof(request3), &reply3, sizeof(reply3));
|
sizeof(request3), &reply3, sizeof(reply3));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: aborted after "
|
ERROR("BMediaRoster::Connect: aborted after "
|
||||||
"BBufferProducer::PrepareToConnect, status = %#lx\n",rv);
|
"BBufferProducer::PrepareToConnect, status = %#" B_PRIx32 "\n", rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
// reply3.format is still our pretty media format
|
// reply3.format is still our pretty media format
|
||||||
@@ -971,7 +984,8 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
sizeof(request4), &reply4, sizeof(reply4));
|
sizeof(request4), &reply4, sizeof(reply4));
|
||||||
if (con_status != B_OK) {
|
if (con_status != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: aborting after "
|
ERROR("BMediaRoster::Connect: aborting after "
|
||||||
"BBufferConsumer::Connected, status = %#lx\n",con_status);
|
"BBufferConsumer::Connected, status = %#" B_PRIx32 "\n",
|
||||||
|
con_status);
|
||||||
// we do NOT return here!
|
// we do NOT return here!
|
||||||
}
|
}
|
||||||
// con_status contains the status code to be supplied to
|
// con_status contains the status code to be supplied to
|
||||||
@@ -999,7 +1013,7 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
|
|||||||
}
|
}
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::Connect: aborted after BBufferProducer::Connect()"
|
ERROR("BMediaRoster::Connect: aborted after BBufferProducer::Connect()"
|
||||||
", status = %#lx\n",rv);
|
", status = %#" B_PRIx32 "\n", rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
// reply5.name contains the name assigned to the connection by the producer
|
// reply5.name contains the name assigned to the connection by the producer
|
||||||
@@ -1091,26 +1105,27 @@ BMediaRoster::Disconnect(media_node_id source_nodeid,
|
|||||||
media_node destnode;
|
media_node destnode;
|
||||||
if (GetNodeFor(source_nodeid, &sourcenode) == B_OK) {
|
if (GetNodeFor(source_nodeid, &sourcenode) == B_OK) {
|
||||||
if (!(sourcenode.kind & B_BUFFER_PRODUCER)) {
|
if (!(sourcenode.kind & B_BUFFER_PRODUCER)) {
|
||||||
ERROR("BMediaRoster::Disconnect: source_nodeid %ld is not a "
|
ERROR("BMediaRoster::Disconnect: source_nodeid %" B_PRId32
|
||||||
"B_BUFFER_PRODUCER\n", source_nodeid);
|
" is not a B_BUFFER_PRODUCER\n", source_nodeid);
|
||||||
}
|
}
|
||||||
if (MediaRosterEx(this)->GetAllOutputs(sourcenode , &outlist) == B_OK)
|
if (MediaRosterEx(this)->GetAllOutputs(sourcenode , &outlist) == B_OK)
|
||||||
MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist);
|
MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist);
|
||||||
ReleaseNode(sourcenode);
|
ReleaseNode(sourcenode);
|
||||||
} else {
|
} else {
|
||||||
ERROR("BMediaRoster::Disconnect: GetNodeFor source_nodeid %ld failed\n", source_nodeid);
|
ERROR("BMediaRoster::Disconnect: GetNodeFor source_nodeid %" B_PRId32
|
||||||
|
" failed\n", source_nodeid);
|
||||||
}
|
}
|
||||||
if (GetNodeFor(destination_nodeid, &destnode) == B_OK) {
|
if (GetNodeFor(destination_nodeid, &destnode) == B_OK) {
|
||||||
if (!(destnode.kind & B_BUFFER_CONSUMER)) {
|
if (!(destnode.kind & B_BUFFER_CONSUMER)) {
|
||||||
ERROR("BMediaRoster::Disconnect: destination_nodeid %ld is not a "
|
ERROR("BMediaRoster::Disconnect: destination_nodeid %" B_PRId32
|
||||||
"B_BUFFER_CONSUMER\n", destination_nodeid);
|
" is not a B_BUFFER_CONSUMER\n", destination_nodeid);
|
||||||
}
|
}
|
||||||
if (MediaRosterEx(this)->GetAllInputs(destnode , &inlist) == B_OK)
|
if (MediaRosterEx(this)->GetAllInputs(destnode , &inlist) == B_OK)
|
||||||
MediaRosterEx(this)->PublishInputs(destnode, &inlist);
|
MediaRosterEx(this)->PublishInputs(destnode, &inlist);
|
||||||
ReleaseNode(destnode);
|
ReleaseNode(destnode);
|
||||||
} else {
|
} else {
|
||||||
ERROR("BMediaRoster::Disconnect: GetNodeFor destination_nodeid %ld "
|
ERROR("BMediaRoster::Disconnect: GetNodeFor destination_nodeid %"
|
||||||
"failed\n", destination_nodeid);
|
B_PRId32 " failed\n", destination_nodeid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send a notification
|
// send a notification
|
||||||
@@ -1124,45 +1139,47 @@ status_t
|
|||||||
BMediaRoster::Disconnect(const media_output& output, const media_input& input)
|
BMediaRoster::Disconnect(const media_output& output, const media_input& input)
|
||||||
{
|
{
|
||||||
if (IS_INVALID_NODEID(output.node.node)) {
|
if (IS_INVALID_NODEID(output.node.node)) {
|
||||||
printf("BMediaRoster::Disconnect: output.node.node %ld invalid\n",
|
printf("BMediaRoster::Disconnect: output.node.node %" B_PRId32
|
||||||
output.node.node);
|
" invalid\n", output.node.node);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
if (IS_INVALID_NODEID(input.node.node)) {
|
if (IS_INVALID_NODEID(input.node.node)) {
|
||||||
printf("BMediaRoster::Disconnect: input.node.node %ld invalid\n",
|
printf("BMediaRoster::Disconnect: input.node.node %" B_PRId32
|
||||||
input.node.node);
|
" invalid\n", input.node.node);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
if (!(output.node.kind & B_BUFFER_PRODUCER)) {
|
if (!(output.node.kind & B_BUFFER_PRODUCER)) {
|
||||||
printf("BMediaRoster::Disconnect: output.node.kind 0x%lx is no "
|
printf("BMediaRoster::Disconnect: output.node.kind 0x%" B_PRIx32
|
||||||
"B_BUFFER_PRODUCER\n", output.node.kind);
|
" is no B_BUFFER_PRODUCER\n", output.node.kind);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
if (!(input.node.kind & B_BUFFER_CONSUMER)) {
|
if (!(input.node.kind & B_BUFFER_CONSUMER)) {
|
||||||
printf("BMediaRoster::Disconnect: input.node.kind 0x%lx is no "
|
printf("BMediaRoster::Disconnect: input.node.kind 0x%" B_PRIx32
|
||||||
"B_BUFFER_PRODUCER\n", input.node.kind);
|
" is no B_BUFFER_PRODUCER\n", input.node.kind);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
if (input.source.port != output.source.port) {
|
if (input.source.port != output.source.port) {
|
||||||
printf("BMediaRoster::Disconnect: input.source.port %ld doesn't match "
|
printf("BMediaRoster::Disconnect: input.source.port %" B_PRId32
|
||||||
"output.source.port %ld\n", input.source.port, output.source.port);
|
" doesn't match output.source.port %" B_PRId32 "\n",
|
||||||
|
input.source.port, output.source.port);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
if (input.source.id != output.source.id) {
|
if (input.source.id != output.source.id) {
|
||||||
printf("BMediaRoster::Disconnect: input.source.id %ld doesn't match "
|
printf("BMediaRoster::Disconnect: input.source.id %" B_PRId32
|
||||||
"output.source.id %ld\n", input.source.id, output.source.id);
|
" doesn't match output.source.id %" B_PRId32 "\n", input.source.id,
|
||||||
|
output.source.id);
|
||||||
return B_MEDIA_BAD_SOURCE;
|
return B_MEDIA_BAD_SOURCE;
|
||||||
}
|
}
|
||||||
if (input.destination.port != output.destination.port) {
|
if (input.destination.port != output.destination.port) {
|
||||||
printf("BMediaRoster::Disconnect: input.destination.port %ld doesn't "
|
printf("BMediaRoster::Disconnect: input.destination.port %" B_PRId32
|
||||||
"match output.destination.port %ld\n", input.destination.port,
|
" doesn't match output.destination.port %" B_PRId32 "\n",
|
||||||
output.destination.port);
|
input.destination.port, output.destination.port);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
if (input.destination.id != output.destination.id) {
|
if (input.destination.id != output.destination.id) {
|
||||||
printf("BMediaRoster::Disconnect: input.destination.id %ld doesn't "
|
printf("BMediaRoster::Disconnect: input.destination.id %" B_PRId32
|
||||||
"match output.destination.id %ld\n", input.destination.id,
|
" doesn't match output.destination.id %" B_PRId32 "\n",
|
||||||
output.destination.id);
|
input.destination.id, output.destination.id);
|
||||||
return B_MEDIA_BAD_DESTINATION;
|
return B_MEDIA_BAD_DESTINATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1178,8 +1195,8 @@ BMediaRoster::StartNode(const media_node& node, bigtime_t atPerformanceTime)
|
|||||||
if (node.node <= 0)
|
if (node.node <= 0)
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
|
|
||||||
TRACE("BMediaRoster::StartNode, node %ld, at perf %Ld\n", node.node,
|
TRACE("BMediaRoster::StartNode, node %" B_PRId32 ", at perf %" B_PRId64
|
||||||
atPerformanceTime);
|
"\n", node.node, atPerformanceTime);
|
||||||
|
|
||||||
node_start_command command;
|
node_start_command command;
|
||||||
command.performance_time = atPerformanceTime;
|
command.performance_time = atPerformanceTime;
|
||||||
@@ -1196,8 +1213,8 @@ BMediaRoster::StopNode(const media_node& node, bigtime_t atPerformanceTime,
|
|||||||
if (IS_INVALID_NODE(node))
|
if (IS_INVALID_NODE(node))
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
|
|
||||||
TRACE("BMediaRoster::StopNode, node %ld, at perf %Ld %s\n", node.node,
|
TRACE("BMediaRoster::StopNode, node %" B_PRId32 ", at perf %" B_PRId64
|
||||||
atPerformanceTime, immediate ? "NOW" : "");
|
" %s\n", node.node, atPerformanceTime, immediate ? "NOW" : "");
|
||||||
|
|
||||||
node_stop_command command;
|
node_stop_command command;
|
||||||
command.performance_time = atPerformanceTime;
|
command.performance_time = atPerformanceTime;
|
||||||
@@ -1215,8 +1232,8 @@ BMediaRoster::SeekNode(const media_node& node, bigtime_t toMediaTime,
|
|||||||
if (IS_INVALID_NODE(node))
|
if (IS_INVALID_NODE(node))
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
|
|
||||||
TRACE("BMediaRoster::SeekNode, node %ld, at perf %Ld, to perf %Ld\n",
|
TRACE("BMediaRoster::SeekNode, node %" B_PRId32 ", at perf %" B_PRId64
|
||||||
node.node, atPerformanceTime, toMediaTime);
|
", to perf %" B_PRId64 "\n", node.node, atPerformanceTime, toMediaTime);
|
||||||
|
|
||||||
node_seek_command command;
|
node_seek_command command;
|
||||||
command.media_time = toMediaTime;
|
command.media_time = toMediaTime;
|
||||||
@@ -1232,26 +1249,27 @@ BMediaRoster::StartTimeSource(const media_node& node, bigtime_t atRealTime)
|
|||||||
CALLED();
|
CALLED();
|
||||||
if (IS_SYSTEM_TIMESOURCE(node)) {
|
if (IS_SYSTEM_TIMESOURCE(node)) {
|
||||||
// TODO: debug this
|
// TODO: debug this
|
||||||
//ERROR("BMediaRoster::StartTimeSource node %ld is system timesource\n", node.node);
|
//ERROR("BMediaRoster::StartTimeSource node %" B_PRId32 " is system timesource\n", node.node);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
// if (IS_SHADOW_TIMESOURCE(node)) {
|
// if (IS_SHADOW_TIMESOURCE(node)) {
|
||||||
// // TODO: debug this
|
// // TODO: debug this
|
||||||
// ERROR("BMediaRoster::StartTimeSource node %ld is shadow timesource\n", node.node);
|
// ERROR("BMediaRoster::StartTimeSource node %" B_PRId32 " is shadow timesource\n", node.node);
|
||||||
// return B_OK;
|
// return B_OK;
|
||||||
// }
|
// }
|
||||||
if (IS_INVALID_NODE(node)) {
|
if (IS_INVALID_NODE(node)) {
|
||||||
ERROR("BMediaRoster::StartTimeSource node %ld invalid\n", node.node);
|
ERROR("BMediaRoster::StartTimeSource node %" B_PRId32 " invalid\n",
|
||||||
return B_MEDIA_BAD_NODE;
|
|
||||||
}
|
|
||||||
if ((node.kind & B_TIME_SOURCE) == 0) {
|
|
||||||
ERROR("BMediaRoster::StartTimeSource node %ld is no timesource\n",
|
|
||||||
node.node);
|
node.node);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
|
if ((node.kind & B_TIME_SOURCE) == 0) {
|
||||||
|
ERROR("BMediaRoster::StartTimeSource node %" B_PRId32
|
||||||
|
" is no timesource\n", node.node);
|
||||||
|
return B_MEDIA_BAD_NODE;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("BMediaRoster::StartTimeSource, node %ld, at real %Ld\n", node.node,
|
TRACE("BMediaRoster::StartTimeSource, node %" B_PRId32 ", at real %"
|
||||||
atRealTime);
|
B_PRId64 "\n", node.node, atRealTime);
|
||||||
|
|
||||||
BTimeSource::time_source_op_info msg;
|
BTimeSource::time_source_op_info msg;
|
||||||
msg.op = BTimeSource::B_TIMESOURCE_START;
|
msg.op = BTimeSource::B_TIMESOURCE_START;
|
||||||
@@ -1277,17 +1295,18 @@ BMediaRoster::StopTimeSource(const media_node& node, bigtime_t atRealTime,
|
|||||||
// return B_OK;
|
// return B_OK;
|
||||||
// }
|
// }
|
||||||
if (IS_INVALID_NODE(node)) {
|
if (IS_INVALID_NODE(node)) {
|
||||||
ERROR("BMediaRoster::StopTimeSource node %ld invalid\n", node.node);
|
ERROR("BMediaRoster::StopTimeSource node %" B_PRId32 " invalid\n",
|
||||||
return B_MEDIA_BAD_NODE;
|
|
||||||
}
|
|
||||||
if ((node.kind & B_TIME_SOURCE) == 0) {
|
|
||||||
ERROR("BMediaRoster::StopTimeSource node %ld is no timesource\n",
|
|
||||||
node.node);
|
node.node);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
|
if ((node.kind & B_TIME_SOURCE) == 0) {
|
||||||
|
ERROR("BMediaRoster::StopTimeSource node %" B_PRId32 " is no "
|
||||||
|
"timesource\n", node.node);
|
||||||
|
return B_MEDIA_BAD_NODE;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("BMediaRoster::StopTimeSource, node %ld, at real %Ld %s\n",
|
TRACE("BMediaRoster::StopTimeSource, node %" B_PRId32 ", at real %" B_PRId64
|
||||||
node.node, atRealTime, immediate ? "NOW" : "");
|
" %s\n", node.node, atRealTime, immediate ? "NOW" : "");
|
||||||
|
|
||||||
BTimeSource::time_source_op_info msg;
|
BTimeSource::time_source_op_info msg;
|
||||||
msg.op = immediate ? BTimeSource::B_TIMESOURCE_STOP_IMMEDIATELY
|
msg.op = immediate ? BTimeSource::B_TIMESOURCE_STOP_IMMEDIATELY
|
||||||
@@ -1316,17 +1335,18 @@ BMediaRoster::SeekTimeSource(const media_node& node,
|
|||||||
// return B_OK;
|
// return B_OK;
|
||||||
// }
|
// }
|
||||||
if (IS_INVALID_NODE(node)) {
|
if (IS_INVALID_NODE(node)) {
|
||||||
ERROR("BMediaRoster::SeekTimeSource node %ld invalid\n", node.node);
|
ERROR("BMediaRoster::SeekTimeSource node %" B_PRId32 " invalid\n",
|
||||||
return B_MEDIA_BAD_NODE;
|
|
||||||
}
|
|
||||||
if ((node.kind & B_TIME_SOURCE) == 0) {
|
|
||||||
ERROR("BMediaRoster::SeekTimeSource node %ld is no timesource\n",
|
|
||||||
node.node);
|
node.node);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
|
if ((node.kind & B_TIME_SOURCE) == 0) {
|
||||||
|
ERROR("BMediaRoster::SeekTimeSource node %" B_PRId32
|
||||||
|
" is no timesource\n", node.node);
|
||||||
|
return B_MEDIA_BAD_NODE;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("BMediaRoster::SeekTimeSource, node %ld, at real %Ld, to perf %Ld\n",
|
TRACE("BMediaRoster::SeekTimeSource, node %" B_PRId32 ", at real %" B_PRId64
|
||||||
node.node, atRealTime, toPerformanceTime);
|
", to perf %" B_PRId64 "\n", node.node, atRealTime, toPerformanceTime);
|
||||||
|
|
||||||
BTimeSource::time_source_op_info msg;
|
BTimeSource::time_source_op_info msg;
|
||||||
msg.op = BTimeSource::B_TIMESOURCE_SEEK;
|
msg.op = BTimeSource::B_TIMESOURCE_SEEK;
|
||||||
@@ -1349,7 +1369,8 @@ BMediaRoster::SyncToNode(const media_node& node, bigtime_t atTime,
|
|||||||
status_t
|
status_t
|
||||||
BMediaRoster::SetRunModeNode(const media_node& node, BMediaNode::run_mode mode)
|
BMediaRoster::SetRunModeNode(const media_node& node, BMediaNode::run_mode mode)
|
||||||
{
|
{
|
||||||
TRACE("BMediaRoster::SetRunModeNode, node %ld, mode %d\n", node.node, mode);
|
TRACE("BMediaRoster::SetRunModeNode, node %" B_PRId32 ", mode %d\n",
|
||||||
|
node.node, mode);
|
||||||
if (IS_INVALID_NODE(node))
|
if (IS_INVALID_NODE(node))
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
|
|
||||||
@@ -1385,8 +1406,8 @@ status_t
|
|||||||
BMediaRoster::SetProducerRunModeDelay(const media_node& node,
|
BMediaRoster::SetProducerRunModeDelay(const media_node& node,
|
||||||
bigtime_t delay, BMediaNode::run_mode mode)
|
bigtime_t delay, BMediaNode::run_mode mode)
|
||||||
{
|
{
|
||||||
TRACE("BMediaRoster::SetProducerRunModeDelay, node %ld, delay %Ld, "
|
TRACE("BMediaRoster::SetProducerRunModeDelay, node %" B_PRId32 ", delay %"
|
||||||
"mode %d\n", node.node, delay, mode);
|
B_PRId64 ", mode %d\n", node.node, delay, mode);
|
||||||
if (IS_INVALID_NODE(node))
|
if (IS_INVALID_NODE(node))
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
if ((node.kind & B_BUFFER_PRODUCER) == 0)
|
if ((node.kind & B_BUFFER_PRODUCER) == 0)
|
||||||
@@ -1522,13 +1543,13 @@ BMediaRoster::GetFreeInputsFor(const media_node& node,
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (IS_INVALID_NODE(node)) {
|
if (IS_INVALID_NODE(node)) {
|
||||||
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld invalid\n",
|
ERROR("BMediaRoster::GetFreeInputsFor: node %" B_PRId32 ", port %"
|
||||||
node.node, node.port);
|
B_PRId32 " invalid\n", node.node, node.port);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
if ((node.kind & B_BUFFER_CONSUMER) == 0) {
|
if ((node.kind & B_BUFFER_CONSUMER) == 0) {
|
||||||
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld is not a "
|
ERROR("BMediaRoster::GetFreeInputsFor: node %" B_PRId32 ", port %"
|
||||||
"consumer\n", node.node, node.port);
|
B_PRId32 " is not a consumer\n", node.node, node.port);
|
||||||
return B_MEDIA_BAD_NODE;
|
return B_MEDIA_BAD_NODE;
|
||||||
}
|
}
|
||||||
if (out_free_inputs == NULL || out_total_count == NULL)
|
if (out_free_inputs == NULL || out_total_count == NULL)
|
||||||
@@ -1544,8 +1565,9 @@ BMediaRoster::GetFreeInputsFor(const media_node& node,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetFreeInputsFor node %ld, max %ld, filter-type "
|
PRINT(4, "BMediaRoster::GetFreeInputsFor node %" B_PRId32 ", max %" B_PRId32
|
||||||
"%ld\n", node.node, buf_num_inputs, filter_type);
|
", filter-type %" B_PRId32 "\n", node.node, buf_num_inputs,
|
||||||
|
filter_type);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&input);) {
|
for (i = 0, list.Rewind(); list.GetNext(&input);) {
|
||||||
@@ -1596,8 +1618,8 @@ BMediaRoster::GetConnectedInputsFor(const media_node& node,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetConnectedInputsFor node %ld, max %ld\n",
|
PRINT(4, "BMediaRoster::GetConnectedInputsFor node %" B_PRId32 ", max %"
|
||||||
node.node, buf_num_inputs);
|
B_PRId32 "\n", node.node, buf_num_inputs);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&input);) {
|
for (i = 0, list.Rewind(); list.GetNext(&input);) {
|
||||||
@@ -1639,8 +1661,8 @@ BMediaRoster::GetAllInputsFor(const media_node& node, media_input* out_inputs,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetAllInputsFor node %ld, max %ld\n", node.node,
|
PRINT(4, "BMediaRoster::GetAllInputsFor node %" B_PRId32 ", max %" B_PRId32
|
||||||
buf_num_inputs);
|
"\n", node.node, buf_num_inputs);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
|
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
|
||||||
@@ -1680,8 +1702,9 @@ BMediaRoster::GetFreeOutputsFor(const media_node& node,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetFreeOutputsFor node %ld, max %ld, filter-type "
|
PRINT(4, "BMediaRoster::GetFreeOutputsFor node %" B_PRId32 ", max %"
|
||||||
"%ld\n", node.node, buf_num_outputs, filter_type);
|
B_PRId32 ", filter-type %" B_PRId32 "\n", node.node, buf_num_outputs,
|
||||||
|
filter_type);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&output);) {
|
for (i = 0, list.Rewind(); list.GetNext(&output);) {
|
||||||
@@ -1732,8 +1755,8 @@ BMediaRoster::GetConnectedOutputsFor(const media_node& node,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %ld, max %ld\n",
|
PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %" B_PRId32 ", max %"
|
||||||
node.node, buf_num_outputs);
|
B_PRId32 "\n", node.node, buf_num_outputs);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&output);) {
|
for (i = 0, list.Rewind(); list.GetNext(&output);) {
|
||||||
@@ -1777,8 +1800,8 @@ BMediaRoster::GetAllOutputsFor(const media_node& node,
|
|||||||
if (B_OK != rv)
|
if (B_OK != rv)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
PRINT(4, "BMediaRoster::GetAllOutputsFor node %ld, max %ld\n", node.node,
|
PRINT(4, "BMediaRoster::GetAllOutputsFor node %" B_PRId32 ", max %" B_PRId32
|
||||||
buf_num_outputs);
|
"\n", node.node, buf_num_outputs);
|
||||||
|
|
||||||
int32 i;
|
int32 i;
|
||||||
for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
|
for (i = 0, list.Rewind(); list.GetNext(&output); i++) {
|
||||||
@@ -1935,8 +1958,8 @@ BMediaRosterEx::RegisterNode(BMediaNode* node, media_addon_id addOnID,
|
|||||||
request.team = BPrivate::current_team();
|
request.team = BPrivate::current_team();
|
||||||
|
|
||||||
TRACE("BMediaRoster::RegisterNode: sending SERVER_REGISTER_NODE: port "
|
TRACE("BMediaRoster::RegisterNode: sending SERVER_REGISTER_NODE: port "
|
||||||
"%ld, kinds 0x%Lx, team %ld, name '%s'\n", request.port, request.kinds,
|
"%" B_PRId32 ", kinds 0x%" B_PRIx64 ", team %" B_PRId32 ", name '%s'\n",
|
||||||
request.team, request.name);
|
request.port, request.kinds, request.team, request.name);
|
||||||
|
|
||||||
status_t status = QueryServer(SERVER_REGISTER_NODE, &request,
|
status_t status = QueryServer(SERVER_REGISTER_NODE, &request,
|
||||||
sizeof(request), &reply, sizeof(reply));
|
sizeof(request), &reply, sizeof(reply));
|
||||||
@@ -2059,8 +2082,9 @@ BMediaRoster::UnregisterNode(BMediaNode* node)
|
|||||||
status_t status = QueryServer(SERVER_UNREGISTER_NODE, &request,
|
status_t status = QueryServer(SERVER_UNREGISTER_NODE, &request,
|
||||||
sizeof(request), &reply, sizeof(reply));
|
sizeof(request), &reply, sizeof(reply));
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
ERROR("BMediaRoster::UnregisterNode: failed to unregister node id %ld, "
|
ERROR("BMediaRoster::UnregisterNode: failed to unregister node id %"
|
||||||
"name '%s': %s\n", node->ID(), node->Name(), strerror(status));
|
B_PRId32 ", name '%s': %s\n", node->ID(), node->Name(),
|
||||||
|
strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2135,16 +2159,16 @@ BMediaRoster::SetTimeSourceFor(media_node_id node, media_node_id time_source)
|
|||||||
media_node clone;
|
media_node clone;
|
||||||
status_t rv, result;
|
status_t rv, result;
|
||||||
|
|
||||||
TRACE("BMediaRoster::SetTimeSourceFor: node %ld will be assigned time "
|
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " will be assigned "
|
||||||
"source %ld\n", node, time_source);
|
"time source %" B_PRId32 "\n", node, time_source);
|
||||||
TRACE("BMediaRoster::SetTimeSourceFor: node %ld time source %ld enter\n",
|
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " time source %"
|
||||||
node, time_source);
|
B_PRId32 " enter\n", node, time_source);
|
||||||
|
|
||||||
// we need to get a clone of the node to have a port id
|
// we need to get a clone of the node to have a port id
|
||||||
rv = GetNodeFor(node, &clone);
|
rv = GetNodeFor(node, &clone);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id "
|
ERROR("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id %"
|
||||||
"%ld\n", node);
|
B_PRId32 "\n", node);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2156,20 +2180,20 @@ BMediaRoster::SetTimeSourceFor(media_node_id node, media_node_id time_source)
|
|||||||
rv = SendToPort(clone.port, NODE_SET_TIMESOURCE, &cmd, sizeof(cmd));
|
rv = SendToPort(clone.port, NODE_SET_TIMESOURCE, &cmd, sizeof(cmd));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::SetTimeSourceFor, sending NODE_SET_TIMESOURCE "
|
ERROR("BMediaRoster::SetTimeSourceFor, sending NODE_SET_TIMESOURCE "
|
||||||
"failed, node id %ld\n", node);
|
"failed, node id %" B_PRId32 "\n", node);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we release the clone
|
// we release the clone
|
||||||
rv = ReleaseNode(clone);
|
rv = ReleaseNode(clone);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id "
|
ERROR("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id %"
|
||||||
"%ld\n", node);
|
B_PRId32 "\n", node);
|
||||||
result = B_ERROR;
|
result = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("BMediaRoster::SetTimeSourceFor: node %ld time source %ld leave\n",
|
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " time source %"
|
||||||
node, time_source);
|
B_PRId32 " leave\n", node, time_source);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2202,7 +2226,7 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
|
|||||||
B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (area < B_OK) {
|
if (area < B_OK) {
|
||||||
ERROR("BMediaRoster::GetParameterWebFor couldn't create area of "
|
ERROR("BMediaRoster::GetParameterWebFor couldn't create area of "
|
||||||
"size %ld\n", size);
|
"size %" B_PRId32 "\n", size);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
request.max_size = size;
|
request.max_size = size;
|
||||||
@@ -2218,8 +2242,8 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
|
|||||||
if (reply.size == 0) {
|
if (reply.size == 0) {
|
||||||
// no parameter web available
|
// no parameter web available
|
||||||
// TODO: should we return an error?
|
// TODO: should we return an error?
|
||||||
ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter "
|
ERROR("BMediaRoster::GetParameterWebFor node %" B_PRId32
|
||||||
"web\n", node.node);
|
" has no parameter web\n", node.node);
|
||||||
*_web = new (std::nothrow) BParameterWeb();
|
*_web = new (std::nothrow) BParameterWeb();
|
||||||
delete_area(area);
|
delete_area(area);
|
||||||
return *_web != NULL ? B_OK : B_NO_MEMORY;
|
return *_web != NULL ? B_OK : B_NO_MEMORY;
|
||||||
@@ -2230,10 +2254,11 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
|
|||||||
if (*_web == NULL)
|
if (*_web == NULL)
|
||||||
rv = B_NO_MEMORY;
|
rv = B_NO_MEMORY;
|
||||||
else {
|
else {
|
||||||
printf("BMediaRoster::GetParameterWebFor Unflattening %ld "
|
printf("BMediaRoster::GetParameterWebFor Unflattening %"
|
||||||
"bytes, 0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx\n",
|
B_PRId32 " bytes, %#" B_PRIx32 ", %#" B_PRIx32 ", %#"
|
||||||
reply.size, ((uint32*)data)[0], ((uint32*)data)[1],
|
B_PRIx32 ", %#" B_PRIx32 "\n", reply.size,
|
||||||
((uint32*)data)[2], ((uint32*)data)[3]);
|
((uint32*)data)[0], ((uint32*)data)[1], ((uint32*)data)[2],
|
||||||
|
((uint32*)data)[3]);
|
||||||
|
|
||||||
rv = (*_web)->Unflatten(reply.code, data, reply.size);
|
rv = (*_web)->Unflatten(reply.code, data, reply.size);
|
||||||
}
|
}
|
||||||
@@ -2250,8 +2275,8 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
|
|||||||
// parameter web data was too large
|
// parameter web data was too large
|
||||||
// loop and try a larger size
|
// loop and try a larger size
|
||||||
}
|
}
|
||||||
ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter web "
|
ERROR("BMediaRoster::GetParameterWebFor node %" B_PRId32 " has no "
|
||||||
"larger than %ld\n", node.node, size);
|
"parameter web larger than %" B_PRId32 "\n", node.node, size);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2359,8 +2384,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
// media_addon_server context) the team-id of the team that
|
// media_addon_server context) the team-id of the team that
|
||||||
// requested the instantiation.
|
// requested the instantiation.
|
||||||
|
|
||||||
TRACE("BMediaRosterEx::InstantiateDormantNode: addonID %ld, flavorID "
|
TRACE("BMediaRosterEx::InstantiateDormantNode: addonID %" B_PRId32
|
||||||
"%ld\n", addonID, flavorID);
|
", flavorID %" B_PRId32 "\n", addonID, flavorID);
|
||||||
|
|
||||||
// Get flavor_info from the server
|
// Get flavor_info from the server
|
||||||
dormant_flavor_info info;
|
dormant_flavor_info info;
|
||||||
@@ -2368,8 +2393,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
rv = GetDormantFlavorInfo(addonID, flavorID, &info);
|
rv = GetDormantFlavorInfo(addonID, flavorID, &info);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRosterEx::InstantiateDormantNode error: failed to get "
|
ERROR("BMediaRosterEx::InstantiateDormantNode error: failed to get "
|
||||||
"dormant_flavor_info for addon-id %ld, flavor-id %ld\n", addonID,
|
"dormant_flavor_info for addon-id %" B_PRId32 ", flavor-id %"
|
||||||
flavorID);
|
B_PRId32 "\n", addonID, flavorID);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2388,7 +2413,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
rv = IncrementAddonFlavorInstancesCount(addonID, flavorID);
|
rv = IncrementAddonFlavorInstancesCount(addonID, flavorID);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRosterEx::InstantiateDormantNode error: can't create "
|
ERROR("BMediaRosterEx::InstantiateDormantNode error: can't create "
|
||||||
"more nodes for addon-id %ld, flavor-id %ld\n", addonID, flavorID);
|
"more nodes for addon-id %" B_PRId32 ", flavor-id %" B_PRId32 "\n",
|
||||||
|
addonID, flavorID);
|
||||||
// Put the addon back into the pool
|
// Put the addon back into the pool
|
||||||
gDormantNodeManager->PutAddOn(addonID);
|
gDormantNodeManager->PutAddOn(addonID);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -2398,8 +2424,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
rv = LoadNodeConfiguration(addonID, flavorID, &config);
|
rv = LoadNodeConfiguration(addonID, flavorID, &config);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRosterEx::InstantiateDormantNode: couldn't load "
|
ERROR("BMediaRosterEx::InstantiateDormantNode: couldn't load "
|
||||||
"configuration for addon-id %ld, flavor-id %ld\n", addonID,
|
"configuration for addon-id %" B_PRId32 ", flavor-id %" B_PRId32
|
||||||
flavorID);
|
"\n", addonID, flavorID);
|
||||||
// do not return, this is a minor problem, not a reason to fail
|
// do not return, this is a minor problem, not a reason to fail
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2441,13 +2467,15 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
if (creator != -1) {
|
if (creator != -1) {
|
||||||
// send a message to the server to assign team "creator" as creator
|
// send a message to the server to assign team "creator" as creator
|
||||||
// of node "node->ID()"
|
// of node "node->ID()"
|
||||||
printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team "
|
printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team %"
|
||||||
"%ld as creator of node %ld\n", creator, node->ID());
|
B_PRId32 " as creator of node %" B_PRId32 "\n", creator,
|
||||||
|
node->ID());
|
||||||
|
|
||||||
rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator);
|
rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRosterEx::InstantiateDormantNode failed to assign "
|
ERROR("BMediaRosterEx::InstantiateDormantNode failed to assign "
|
||||||
"team %ld as creator of node %ld\n", creator, node->ID());
|
"team %" B_PRId32 " as creator of node %" B_PRId32 "\n",
|
||||||
|
creator, node->ID());
|
||||||
// do not return, this is a minor problem, not a reason to fail
|
// do not return, this is a minor problem, not a reason to fail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2458,9 +2486,10 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
|
|||||||
|
|
||||||
*_node = node->Node();
|
*_node = node->Node();
|
||||||
|
|
||||||
TRACE("BMediaRosterEx::InstantiateDormantNode: addon-id %ld, flavor_id "
|
TRACE("BMediaRosterEx::InstantiateDormantNode: addon-id %" B_PRId32
|
||||||
"%ld instanciated as node %ld, port %ld in team %ld\n", addonID,
|
", flavor_id %" B_PRId32 " instanciated as node %" B_PRId32 ", port %"
|
||||||
flavorID, _node->node, _node->port, BPrivate::current_team());
|
B_PRId32 " in team %" B_PRId32 "\n", addonID, flavorID, _node->node,
|
||||||
|
_node->port, BPrivate::current_team());
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -2474,13 +2503,14 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
|
|||||||
if (_node == NULL)
|
if (_node == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
if (info.addon <= B_OK) {
|
if (info.addon <= B_OK) {
|
||||||
ERROR("BMediaRoster::InstantiateDormantNode error: addon-id %ld "
|
ERROR("BMediaRoster::InstantiateDormantNode error: addon-id %" B_PRId32
|
||||||
"invalid.\n", info.addon);
|
" invalid.\n", info.addon);
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("BMediaRoster::InstantiateDormantNode: addon-id %ld, flavor_id "
|
printf("BMediaRoster::InstantiateDormantNode: addon-id %" B_PRId32
|
||||||
"%ld, flags 0x%lX\n", info.addon, info.flavor_id, flags);
|
", flavor_id %" B_PRId32 ", flags 0x%" B_PRIx32 "\n", info.addon,
|
||||||
|
info.flavor_id, flags);
|
||||||
|
|
||||||
// Get flavor_info from the server
|
// Get flavor_info from the server
|
||||||
// TODO: this is a little overhead, as we get the full blown
|
// TODO: this is a little overhead, as we get the full blown
|
||||||
@@ -2492,8 +2522,8 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
|
|||||||
&flavorInfo);
|
&flavorInfo);
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::InstantiateDormantNode: failed to get "
|
ERROR("BMediaRoster::InstantiateDormantNode: failed to get "
|
||||||
"dormant_flavor_info for addon-id %ld, flavor-id %ld\n",
|
"dormant_flavor_info for addon-id %" B_PRId32 ", flavor-id %"
|
||||||
info.addon, info.flavor_id);
|
B_PRId32 "\n", info.addon, info.flavor_id);
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2501,9 +2531,10 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
|
|||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
printf("BMediaRoster::InstantiateDormantNode: name \"%s\", info \"%s\", "
|
printf("BMediaRoster::InstantiateDormantNode: name \"%s\", info \"%s\", "
|
||||||
"flavor_flags 0x%lX, internal_id %ld, possible_count %ld\n",
|
"flavor_flags 0x%" B_PRIx32 ", internal_id %" B_PRId32
|
||||||
flavorInfo.name, flavorInfo.info, flavorInfo.flavor_flags,
|
", possible_count %" B_PRId32 "\n", flavorInfo.name, flavorInfo.info,
|
||||||
flavorInfo.internal_id, flavorInfo.possible_count);
|
flavorInfo.flavor_flags, flavorInfo.internal_id,
|
||||||
|
flavorInfo.possible_count);
|
||||||
|
|
||||||
if ((flags & B_FLAVOR_IS_LOCAL) != 0) {
|
if ((flags & B_FLAVOR_IS_LOCAL) != 0) {
|
||||||
printf("BMediaRoster::InstantiateDormantNode: caller requested "
|
printf("BMediaRoster::InstantiateDormantNode: caller requested "
|
||||||
@@ -2702,8 +2733,8 @@ BMediaRoster::GetInitialLatencyFor(const media_node& producer,
|
|||||||
if (_flags != NULL)
|
if (_flags != NULL)
|
||||||
*_flags = reply.flags;
|
*_flags = reply.flags;
|
||||||
|
|
||||||
TRACE("BMediaRoster::GetInitialLatencyFor producer %ld has maximum "
|
TRACE("BMediaRoster::GetInitialLatencyFor producer %" B_PRId32 " has "
|
||||||
"initial latency %Ld\n", producer.node, *_latency);
|
"maximum initial latency %" B_PRId64 "\n", producer.node, *_latency);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2730,8 +2761,8 @@ BMediaRoster::GetStartLatencyFor(const media_node& timeSource,
|
|||||||
|
|
||||||
*_latency = reply.start_latency;
|
*_latency = reply.start_latency;
|
||||||
|
|
||||||
TRACE("BMediaRoster::GetStartLatencyFor timesource %ld has maximum "
|
TRACE("BMediaRoster::GetStartLatencyFor timesource %" B_PRId32 " has "
|
||||||
"initial latency %Ld\n", timeSource.node, *_latency);
|
"maximum initial latency %" B_PRId64 "\n", timeSource.node, *_latency);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2838,7 +2869,8 @@ BMediaRoster::SniffRef(const entry_ref& file, uint64 requireNodeKinds,
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
TRACE("BMediaRoster::SniffRef looking for a node to handle %s : %Ld\n",file.name, requireNodeKinds);
|
TRACE("BMediaRoster::SniffRef looking for a node to handle %s: 0x%" B_PRIx64
|
||||||
|
"\n", file.name, requireNodeKinds);
|
||||||
|
|
||||||
if (_node == NULL)
|
if (_node == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -2873,8 +2905,10 @@ BMediaRoster::SniffRef(const entry_ref& file, uint64 requireNodeKinds,
|
|||||||
if (highestCapability != -1) {
|
if (highestCapability != -1) {
|
||||||
*_node = nodes[highestCapability];
|
*_node = nodes[highestCapability];
|
||||||
|
|
||||||
TRACE("BMediaRoster::SniffRef: found a node %s addon-id %ld, flavor_id %ld\n",
|
TRACE("BMediaRoster::SniffRef: found a node %s addon-id %" B_PRId32
|
||||||
nodes[highestCapability].name, nodes[highestCapability].addon, nodes[highestCapability].flavor_id);
|
", flavor_id %" B_PRId32 "\n",
|
||||||
|
nodes[highestCapability].name, nodes[highestCapability].addon,
|
||||||
|
nodes[highestCapability].flavor_id);
|
||||||
|
|
||||||
if (mimeType != NULL) {
|
if (mimeType != NULL) {
|
||||||
//*mimeType = aMimeType; -- need a copy constructor
|
//*mimeType = aMimeType; -- need a copy constructor
|
||||||
@@ -3013,7 +3047,7 @@ BMediaRoster::NodeIDFor(port_id port)
|
|||||||
rv = QueryServer(SERVER_NODE_ID_FOR, &request, sizeof(request), &reply,
|
rv = QueryServer(SERVER_NODE_ID_FOR, &request, sizeof(request), &reply,
|
||||||
sizeof(reply));
|
sizeof(reply));
|
||||||
if (rv != B_OK) {
|
if (rv != B_OK) {
|
||||||
ERROR("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv);
|
ERROR("BMediaRoster::NodeIDFor: failed (error %#" B_PRIx32 ")\n", rv);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3101,8 +3135,8 @@ BMediaRoster::AudioBufferSizeFor(int32 channelCount, uint32 sampleFormat,
|
|||||||
bufferSize = (sampleFormat & 0xf) * channelCount
|
bufferSize = (sampleFormat & 0xf) * channelCount
|
||||||
* (ssize_t)((frameRate * bufferDuration) / 1000000.0);
|
* (ssize_t)((frameRate * bufferDuration) / 1000000.0);
|
||||||
|
|
||||||
printf("Suggested buffer duration %Ld, size %ld\n", bufferDuration,
|
printf("Suggested buffer duration %" B_PRId64 ", size %" B_PRIdSSIZE "\n",
|
||||||
bufferSize);
|
bufferDuration, bufferSize);
|
||||||
|
|
||||||
return bufferSize;
|
return bufferSize;
|
||||||
}
|
}
|
||||||
@@ -3148,10 +3182,12 @@ BMediaRoster::MessageReceived(BMessage* message)
|
|||||||
BMediaNode *node;
|
BMediaNode *node;
|
||||||
message->FindPointer("node", reinterpret_cast<void **>(&node));
|
message->FindPointer("node", reinterpret_cast<void **>(&node));
|
||||||
|
|
||||||
TRACE("BMediaRoster::MessageReceived NODE_FINAL_RELEASE saving node %ld configuration\n", node->ID());
|
TRACE("BMediaRoster::MessageReceived NODE_FINAL_RELEASE saving "
|
||||||
|
"node %" B_PRId32 " configuration\n", node->ID());
|
||||||
MediaRosterEx(BMediaRoster::Roster())->SaveNodeConfiguration(node);
|
MediaRosterEx(BMediaRoster::Roster())->SaveNodeConfiguration(node);
|
||||||
|
|
||||||
TRACE("BMediaRoster::MessageReceived NODE_FINAL_RELEASE releasing node %ld\n", node->ID());
|
TRACE("BMediaRoster::MessageReceived NODE_FINAL_RELEASE releasing "
|
||||||
|
"node %" B_PRId32 "\n", node->ID());
|
||||||
node->DeleteHook(node); // we don't call Release(), see above!
|
node->DeleteHook(node); // we don't call Release(), see above!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,8 +340,8 @@ BMediaTrack::ReadFrames(void* buffer, int64* _frameCount,
|
|||||||
//fflush(stdout);
|
//fflush(stdout);
|
||||||
//}
|
//}
|
||||||
} else {
|
} else {
|
||||||
ERROR("BMediaTrack::ReadFrames: decoder returned error 0x%08lx (%s)\n",
|
ERROR("BMediaTrack::ReadFrames: decoder returned error %#" B_PRIx32
|
||||||
result, strerror(result));
|
" (%s)\n", result, strerror(result));
|
||||||
*_frameCount = 0;
|
*_frameCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
|
|||||||
if (!fStreamInfos.Insert(info)) {
|
if (!fStreamInfos.Insert(info)) {
|
||||||
gPluginManager.DestroyEncoder(encoder);
|
gPluginManager.DestroyEncoder(encoder);
|
||||||
ERROR("MediaWriter::CreateEncoder can't create StreamInfo "
|
ERROR("MediaWriter::CreateEncoder can't create StreamInfo "
|
||||||
"for stream %ld\n", streamIndex);
|
"for stream %" B_PRId32 "\n", streamIndex);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
|
|||||||
if (chunkWriter == NULL) {
|
if (chunkWriter == NULL) {
|
||||||
gPluginManager.DestroyEncoder(encoder);
|
gPluginManager.DestroyEncoder(encoder);
|
||||||
ERROR("MediaWriter::CreateEncoder can't create ChunkWriter "
|
ERROR("MediaWriter::CreateEncoder can't create ChunkWriter "
|
||||||
"for stream %ld\n", streamIndex);
|
"for stream %" B_PRId32 "\n", streamIndex);
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2009, Haiku. All Rights Reserved.
|
* Copyright 2002-2012, Haiku. All Rights Reserved.
|
||||||
* This file may be used under the terms of the MIT License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Author: Zousar Shaker
|
* Author: Zousar Shaker
|
||||||
@@ -7,11 +7,13 @@
|
|||||||
* Marcus Overhagen
|
* Marcus Overhagen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*! Implements the following classes:
|
/*! Implements the following classes:
|
||||||
BParameterWeb, BParameterGroup, BParameter, BNullParameter,
|
BParameterWeb, BParameterGroup, BParameter, BNullParameter,
|
||||||
BContinuousParameter, BDiscreteParameter
|
BContinuousParameter, BDiscreteParameter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <ParameterWeb.h>
|
#include <ParameterWeb.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
@@ -281,6 +283,18 @@ swap32(Type value, bool doSwap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type> Type
|
||||||
|
swap64(Type value, bool doSwap)
|
||||||
|
{
|
||||||
|
STATIC_ASSERT(sizeof(Type) == 8);
|
||||||
|
|
||||||
|
if (doSwap)
|
||||||
|
return (Type)B_SWAP_INT64((int64)value);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type> Type
|
template<class Type> Type
|
||||||
read_from_buffer_swap32(const void **_buffer, bool doSwap)
|
read_from_buffer_swap32(const void **_buffer, bool doSwap)
|
||||||
{
|
{
|
||||||
@@ -288,6 +302,19 @@ read_from_buffer_swap32(const void **_buffer, bool doSwap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type> Type
|
||||||
|
read_pointer_from_buffer_swap(const void **_buffer, bool doSwap)
|
||||||
|
{
|
||||||
|
#if B_HAIKU_32_BIT
|
||||||
|
return swap32<Type>(read_from_buffer<Type>(_buffer), doSwap);
|
||||||
|
#elif B_HAIKU_64_BIT
|
||||||
|
return swap64<Type>(read_from_buffer<Type>(_buffer), doSwap);
|
||||||
|
#else
|
||||||
|
# error Interesting
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline ssize_t
|
static inline ssize_t
|
||||||
size_left(ssize_t size, const void *bufferStart, const void *buffer)
|
size_left(ssize_t size, const void *bufferStart, const void *buffer)
|
||||||
{
|
{
|
||||||
@@ -568,8 +595,8 @@ BParameterWeb::Unflatten(type_code code, const void* buffer, ssize_t size)
|
|||||||
// information - but it doesn't seem to have another purpose
|
// information - but it doesn't seem to have another purpose
|
||||||
int32 version = read_from_buffer_swap32<int32>(&buffer, isSwapped);
|
int32 version = read_from_buffer_swap32<int32>(&buffer, isSwapped);
|
||||||
if (version != kCurrentParameterWebVersion) {
|
if (version != kCurrentParameterWebVersion) {
|
||||||
ERROR("BParameterWeb::Unflatten(): wrong version %ld (%lx)?!\n",
|
ERROR("BParameterWeb::Unflatten(): wrong version %" B_PRId32 " (%"
|
||||||
version, version);
|
B_PRIx32 ")?!\n", version, version);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1052,8 +1079,8 @@ BParameterGroup::Unflatten(type_code code, const void* buffer, ssize_t size)
|
|||||||
if (size_left(size, bufferStart, buffer) < 12)
|
if (size_left(size, bufferStart, buffer) < 12)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
BParameter* oldPointer = read_from_buffer_swap32<BParameter*>(&buffer,
|
BParameter* oldPointer = read_pointer_from_buffer_swap<BParameter*>(
|
||||||
isSwapped);
|
&buffer, isSwapped);
|
||||||
BParameter::media_parameter_type mediaType
|
BParameter::media_parameter_type mediaType
|
||||||
= read_from_buffer_swap32<BParameter::media_parameter_type>(&buffer,
|
= read_from_buffer_swap32<BParameter::media_parameter_type>(&buffer,
|
||||||
isSwapped);
|
isSwapped);
|
||||||
@@ -1101,8 +1128,8 @@ BParameterGroup::Unflatten(type_code code, const void* buffer, ssize_t size)
|
|||||||
if (size_left(size, bufferStart, buffer) < 12)
|
if (size_left(size, bufferStart, buffer) < 12)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
BParameterGroup* oldPointer
|
BParameterGroup* oldPointer = read_pointer_from_buffer_swap<
|
||||||
= read_from_buffer_swap32<BParameterGroup*>(&buffer, isSwapped);
|
BParameterGroup*>(&buffer, isSwapped);
|
||||||
type_code type = read_from_buffer_swap32<type_code>(&buffer, isSwapped);
|
type_code type = read_from_buffer_swap32<type_code>(&buffer, isSwapped);
|
||||||
|
|
||||||
ssize_t groupSize
|
ssize_t groupSize
|
||||||
@@ -1161,7 +1188,8 @@ BParameterGroup::MakeControl(int32 type)
|
|||||||
return new BTextParameter(-1, B_MEDIA_NO_TYPE, NULL, NULL, NULL, 0);
|
return new BTextParameter(-1, B_MEDIA_NO_TYPE, NULL, NULL, NULL, 0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR("BParameterGroup::MakeControl unknown type %ld\n", type);
|
ERROR("BParameterGroup::MakeControl unknown type %" B_PRId32 "\n",
|
||||||
|
type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1656,8 +1684,8 @@ BParameter::Unflatten(type_code code, const void* buffer, ssize_t size)
|
|||||||
|
|
||||||
fInputs->MakeEmpty();
|
fInputs->MakeEmpty();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
fInputs->AddItem(read_from_buffer_swap32<BParameter * const>(&buffer,
|
fInputs->AddItem(read_pointer_from_buffer_swap<BParameter * const>(
|
||||||
fSwapDetected));
|
&buffer, fSwapDetected));
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the list of outputs
|
// read the list of outputs
|
||||||
@@ -1666,8 +1694,8 @@ BParameter::Unflatten(type_code code, const void* buffer, ssize_t size)
|
|||||||
|
|
||||||
fOutputs->MakeEmpty();
|
fOutputs->MakeEmpty();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
fOutputs->AddItem(read_from_buffer_swap32<BParameter * const>(&buffer,
|
fOutputs->AddItem(read_pointer_from_buffer_swap<BParameter * const>(
|
||||||
fSwapDetected));
|
&buffer, fSwapDetected));
|
||||||
}
|
}
|
||||||
|
|
||||||
fMediaType = read_from_buffer_swap32<media_type>(&buffer, fSwapDetected);
|
fMediaType = read_from_buffer_swap32<media_type>(&buffer, fSwapDetected);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2009-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Copyright 2002, Marcus Overhagen. All Rights Reserved.
|
* Copyright 2002, Marcus Overhagen. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +80,7 @@ SharedBufferList::Get()
|
|||||||
sArea = clone_area("shared buffer list clone", (void**)&sList,
|
sArea = clone_area("shared buffer list clone", (void**)&sList,
|
||||||
B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, areaReply.area);
|
B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, areaReply.area);
|
||||||
if (sArea < 0) {
|
if (sArea < 0) {
|
||||||
ERROR("SharedBufferList::Get() clone area %ld: %s\n",
|
ERROR("SharedBufferList::Get() clone area %" B_PRId32 ": %s\n",
|
||||||
areaReply.area, strerror(sArea));
|
areaReply.area, strerror(sArea));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -303,8 +303,8 @@ SharedBufferList::RecycleBuffer(BBuffer* buffer)
|
|||||||
if (fInfos[i].id == id) {
|
if (fInfos[i].id == id) {
|
||||||
reclaimedCount++;
|
reclaimedCount++;
|
||||||
if (fInfos[i].reclaimed) {
|
if (fInfos[i].reclaimed) {
|
||||||
ERROR("SharedBufferList::RecycleBuffer, BBuffer %p, id = %ld "
|
ERROR("SharedBufferList::RecycleBuffer, BBuffer %p, id = %"
|
||||||
"already reclaimed\n", buffer, id);
|
B_PRId32 " already reclaimed\n", buffer, id);
|
||||||
DEBUG_ONLY(debugger("buffer already reclaimed"));
|
DEBUG_ONLY(debugger("buffer already reclaimed"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -317,8 +317,8 @@ SharedBufferList::RecycleBuffer(BBuffer* buffer)
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (reclaimedCount == 0) {
|
if (reclaimedCount == 0) {
|
||||||
ERROR("shared_buffer_list::RecycleBuffer, BBuffer %p, id = %ld NOT "
|
ERROR("shared_buffer_list::RecycleBuffer, BBuffer %p, id = %" B_PRId32
|
||||||
"reclaimed\n", buffer, id);
|
" NOT reclaimed\n", buffer, id);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ SharedBufferList::_RequestBufferInOtherGroups(sem_id groupReclaimSem,
|
|||||||
|
|
||||||
if (fInfos[i].reclaimed == false) {
|
if (fInfos[i].reclaimed == false) {
|
||||||
ERROR("SharedBufferList:: RequestBufferInOtherGroups BBuffer "
|
ERROR("SharedBufferList:: RequestBufferInOtherGroups BBuffer "
|
||||||
"%p, id = %ld not reclaimed while requesting\n",
|
"%p, id = %" B_PRId32 " not reclaimed while requesting\n",
|
||||||
fInfos[i].buffer, id);
|
fInfos[i].buffer, id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ SoundConsumer::SetHooks(SoundProcessFunc recordFunc, SoundNotifyFunc notifyFunc,
|
|||||||
// Wait for acknowledge from the service thread.
|
// Wait for acknowledge from the service thread.
|
||||||
err = read_port_etc(cmd.reply, &code, 0, 0, B_TIMEOUT, 6000000LL);
|
err = read_port_etc(cmd.reply, &code, 0, 0, B_TIMEOUT, 6000000LL);
|
||||||
if (err > 0) err = 0;
|
if (err > 0) err = 0;
|
||||||
NODE(stderr, "SoundConsumer::SetHooks read reply: %#010lx\n", err);
|
NODE(stderr, "SoundConsumer::SetHooks read reply: %#" B_PRIx32
|
||||||
|
"\n", err);
|
||||||
}
|
}
|
||||||
// Clean up.
|
// Clean up.
|
||||||
delete_port(cmd.reply);
|
delete_port(cmd.reply);
|
||||||
@@ -591,8 +592,8 @@ SoundConsumer::ServiceThread()
|
|||||||
int32 code = 0;
|
int32 code = 0;
|
||||||
status_t err = read_port_etc(m_port, &code, msg, B_MEDIA_MESSAGE_SIZE,
|
status_t err = read_port_etc(m_port, &code, msg, B_MEDIA_MESSAGE_SIZE,
|
||||||
B_TIMEOUT, timeout);
|
B_TIMEOUT, timeout);
|
||||||
MESSAGE(stderr, "SoundConsumer::ServiceThread() port %ld message "
|
MESSAGE(stderr, "SoundConsumer::ServiceThread() port %" B_PRId32
|
||||||
"%#010lx\n", m_port, code);
|
" message %#" B_PRIx32 "\n", m_port, code);
|
||||||
// If we received a message, err will be the size of the message
|
// If we received a message, err will be the size of the message
|
||||||
// (including 0).
|
// (including 0).
|
||||||
if (err >= B_OK) {
|
if (err >= B_OK) {
|
||||||
@@ -625,7 +626,7 @@ SoundConsumer::ServiceThread()
|
|||||||
Notify(B_OP_TIMED_OUT, timeout);
|
Notify(B_OP_TIMED_OUT, timeout);
|
||||||
} else {
|
} else {
|
||||||
// Other errors are bad.
|
// Other errors are bad.
|
||||||
MESSAGE(stderr, "SoundConsumer: error %#010lx\n", err);
|
MESSAGE(stderr, "SoundConsumer: error %#" B_PRIx32 "\n", err);
|
||||||
bad++;
|
bad++;
|
||||||
// If we receive three bad reads with no good messages inbetween,
|
// If we receive three bad reads with no good messages inbetween,
|
||||||
// things are probably not going to improve (like the port
|
// things are probably not going to improve (like the port
|
||||||
@@ -663,7 +664,7 @@ SoundConsumer::ProcessingLatency()
|
|||||||
{
|
{
|
||||||
// We're saying it takes us 500 us to process each buffer. If all we do is
|
// We're saying it takes us 500 us to process each buffer. If all we do is
|
||||||
// copy the data, it probably takes much less than that, but it doesn't
|
// copy the data, it probably takes much less than that, but it doesn't
|
||||||
// hurt to be slightly conservative.
|
// hurt to be slightly conservative.
|
||||||
return 500LL;
|
return 500LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -464,8 +464,10 @@ SoundPlayNode::Disconnect(const media_source& what,
|
|||||||
delete fBufferGroup;
|
delete fBufferGroup;
|
||||||
fBufferGroup = NULL;
|
fBufferGroup = NULL;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\tDisconnect() called with wrong source/destination (%ld/%ld), ours is (%ld/%ld)\n",
|
fprintf(stderr, "\tDisconnect() called with wrong source/destination "
|
||||||
what.id, where.id, fOutput.source.id, fOutput.destination.id);
|
"(%" B_PRId32 "/%" B_PRId32 "), ours is (%" B_PRId32 "/%" B_PRId32
|
||||||
|
")\n", what.id, where.id, fOutput.source.id,
|
||||||
|
fOutput.destination.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,8 +478,8 @@ SoundPlayNode::LateNoticeReceived(const media_source& what, bigtime_t howMuch,
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
TRACE("SoundPlayNode::LateNoticeReceived, %Ld too late at %Ld\n", howMuch,
|
TRACE("SoundPlayNode::LateNoticeReceived, %" B_PRId64 " too late at %"
|
||||||
performanceTime);
|
B_PRId64 "\n", howMuch, performanceTime);
|
||||||
|
|
||||||
// is this our output?
|
// is this our output?
|
||||||
if (what != fOutput.source) {
|
if (what != fOutput.source) {
|
||||||
@@ -498,7 +500,8 @@ SoundPlayNode::LateNoticeReceived(const media_source& what, bigtime_t howMuch,
|
|||||||
fInternalLatency = 30000;
|
fInternalLatency = 30000;
|
||||||
|
|
||||||
SetEventLatency(fLatency + fInternalLatency);
|
SetEventLatency(fLatency + fInternalLatency);
|
||||||
TRACE("SoundPlayNode::LateNoticeReceived: increasing latency to %Ld\n", fLatency + fInternalLatency);
|
TRACE("SoundPlayNode::LateNoticeReceived: increasing latency to %"
|
||||||
|
B_PRId64 "\n", fLatency + fInternalLatency);
|
||||||
} else {
|
} else {
|
||||||
// The other run modes dictate various strategies for sacrificing data quality
|
// The other run modes dictate various strategies for sacrificing data quality
|
||||||
// in the interests of timely data delivery. The way *we* do this is to skip
|
// in the interests of timely data delivery. The way *we* do this is to skip
|
||||||
@@ -554,7 +557,8 @@ SoundPlayNode::LatencyChanged(const media_source& source,
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
TRACE("SoundPlayNode::LatencyChanged: new_latency %Ld\n", newLatency);
|
TRACE("SoundPlayNode::LatencyChanged: new_latency %" B_PRId64 "\n",
|
||||||
|
newLatency);
|
||||||
|
|
||||||
// something downstream changed latency, so we need to start producing
|
// something downstream changed latency, so we need to start producing
|
||||||
// buffers earlier (or later) than we were previously. Make sure that the
|
// buffers earlier (or later) than we were previously. Make sure that the
|
||||||
@@ -604,7 +608,7 @@ SoundPlayNode::HandleEvent(const media_timed_event* event, bigtime_t lateness,
|
|||||||
HandleParameter(event,lateness,realTimeEvent);
|
HandleParameter(event,lateness,realTimeEvent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr," unknown event type: %li\n", event->type);
|
fprintf(stderr," unknown event type: %" B_PRId32 "\n", event->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -635,7 +639,7 @@ SoundPlayNode::SendNewBuffer(const media_timed_event* event,
|
|||||||
|
|
||||||
if (lateness > (BufferDuration() / 3) ) {
|
if (lateness > (BufferDuration() / 3) ) {
|
||||||
printf("SoundPlayNode::SendNewBuffer, event scheduled much too late, "
|
printf("SoundPlayNode::SendNewBuffer, event scheduled much too late, "
|
||||||
"lateness is %Ld\n", lateness);
|
"lateness is %" B_PRId64 "\n", lateness);
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip buffer creation if output not enabled
|
// skip buffer creation if output not enabled
|
||||||
@@ -698,8 +702,8 @@ status_t
|
|||||||
SoundPlayNode::HandleDataStatus(const media_timed_event* event,
|
SoundPlayNode::HandleDataStatus(const media_timed_event* event,
|
||||||
bigtime_t lateness, bool realTimeEvent)
|
bigtime_t lateness, bool realTimeEvent)
|
||||||
{
|
{
|
||||||
TRACE("SoundPlayNode::HandleDataStatus status: %li, lateness: %Li\n",
|
TRACE("SoundPlayNode::HandleDataStatus status: %" B_PRId32 ", lateness: %"
|
||||||
event->data, lateness);
|
B_PRId64 "\n", event->data, lateness);
|
||||||
|
|
||||||
switch (event->data) {
|
switch (event->data) {
|
||||||
case B_DATA_NOT_AVAILABLE:
|
case B_DATA_NOT_AVAILABLE:
|
||||||
@@ -746,8 +750,8 @@ SoundPlayNode::HandleSeek(const media_timed_event* event, bigtime_t lateness,
|
|||||||
bool realTimeEvent)
|
bool realTimeEvent)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
TRACE("SoundPlayNode::HandleSeek(t=%lld, d=%li, bd=%lld)\n",
|
TRACE("SoundPlayNode::HandleSeek(t=%" B_PRId64 ", d=%" B_PRId32 ", bd=%"
|
||||||
event->event_time, event->data, event->bigdata);
|
B_PRId64 ")\n", event->event_time, event->data, event->bigdata);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -792,14 +796,15 @@ SoundPlayNode::AllocateBuffers()
|
|||||||
size_t size = fOutput.format.u.raw_audio.buffer_size;
|
size_t size = fOutput.format.u.raw_audio.buffer_size;
|
||||||
int32 count = int32(fLatency / BufferDuration() + 1 + 1);
|
int32 count = int32(fLatency / BufferDuration() + 1 + 1);
|
||||||
|
|
||||||
TRACE("SoundPlayNode::AllocateBuffers: latency = %Ld, buffer duration "
|
TRACE("SoundPlayNode::AllocateBuffers: latency = %" B_PRId64 ", buffer "
|
||||||
"= %Ld, count %ld\n", fLatency, BufferDuration(), count);
|
"duration = %" B_PRId64 ", count %" B_PRId32 "\n", fLatency,
|
||||||
|
BufferDuration(), count);
|
||||||
|
|
||||||
if (count < 3)
|
if (count < 3)
|
||||||
count = 3;
|
count = 3;
|
||||||
|
|
||||||
TRACE("SoundPlayNode::AllocateBuffers: creating group of %ld buffers, "
|
TRACE("SoundPlayNode::AllocateBuffers: creating group of %" B_PRId32
|
||||||
"size = %lu\n", count, size);
|
" buffers, size = %" B_PRIuSIZE "\n", count, size);
|
||||||
|
|
||||||
fBufferGroup = new BBufferGroup(size, count);
|
fBufferGroup = new BBufferGroup(size, count);
|
||||||
if (fBufferGroup->InitCheck() != B_OK) {
|
if (fBufferGroup->InitCheck() != B_OK) {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
/***********************************************************************
|
/*
|
||||||
* AUTHOR: Marcus Overhagen
|
* Copyright 2002-2012, Haiku. All Rights Reserved.
|
||||||
* FILE: TimeSource.cpp
|
* This file may be used under the terms of the MIT License.
|
||||||
* DESCR:
|
*
|
||||||
***********************************************************************/
|
* Author: Marcus Overhagen
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <TimeSource.h>
|
#include <TimeSource.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -42,7 +45,7 @@ struct TimeSourceTransmit // sizeof(TimeSourceTransmit) must be <= TS_AREA_SIZE
|
|||||||
|
|
||||||
class SlaveNodes
|
class SlaveNodes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SlaveNodes();
|
SlaveNodes();
|
||||||
~SlaveNodes();
|
~SlaveNodes();
|
||||||
public:
|
public:
|
||||||
@@ -115,13 +118,13 @@ bigtime_t
|
|||||||
BTimeSource::PerformanceTimeFor(bigtime_t real_time)
|
BTimeSource::PerformanceTimeFor(bigtime_t real_time)
|
||||||
{
|
{
|
||||||
PRINT(8, "CALLED BTimeSource::PerformanceTimeFor()\n");
|
PRINT(8, "CALLED BTimeSource::PerformanceTimeFor()\n");
|
||||||
bigtime_t last_perf_time;
|
bigtime_t last_perf_time;
|
||||||
bigtime_t last_real_time;
|
bigtime_t last_real_time;
|
||||||
float last_drift;
|
float last_drift;
|
||||||
|
|
||||||
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
|
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
|
||||||
debugger("BTimeSource::PerformanceTimeFor: GetTime failed");
|
debugger("BTimeSource::PerformanceTimeFor: GetTime failed");
|
||||||
|
|
||||||
return last_perf_time + (bigtime_t)((real_time - last_real_time) * last_drift);
|
return last_perf_time + (bigtime_t)((real_time - last_real_time) * last_drift);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,9 +139,9 @@ BTimeSource::RealTimeFor(bigtime_t performance_time,
|
|||||||
return performance_time - with_latency;
|
return performance_time - with_latency;
|
||||||
}
|
}
|
||||||
|
|
||||||
bigtime_t last_perf_time;
|
bigtime_t last_perf_time;
|
||||||
bigtime_t last_real_time;
|
bigtime_t last_real_time;
|
||||||
float last_drift;
|
float last_drift;
|
||||||
|
|
||||||
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
|
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
|
||||||
debugger("BTimeSource::RealTimeFor: GetTime failed");
|
debugger("BTimeSource::RealTimeFor: GetTime failed");
|
||||||
@@ -153,13 +156,14 @@ BTimeSource::IsRunning()
|
|||||||
PRINT(8, "CALLED BTimeSource::IsRunning()\n");
|
PRINT(8, "CALLED BTimeSource::IsRunning()\n");
|
||||||
|
|
||||||
bool isrunning;
|
bool isrunning;
|
||||||
|
|
||||||
if (fIsRealtime)
|
if (fIsRealtime)
|
||||||
isrunning = true; // The system time source is always running :)
|
isrunning = true; // The system time source is always running :)
|
||||||
else
|
else
|
||||||
isrunning = fBuf ? atomic_add(&fBuf->isrunning, 0) : fStarted;
|
isrunning = fBuf ? atomic_add(&fBuf->isrunning, 0) : fStarted;
|
||||||
|
|
||||||
TRACE_TIMESOURCE("BTimeSource::IsRunning() node %ld, port %ld, %s\n", fNodeID, fControlPort, isrunning ? "yes" : "no");
|
TRACE_TIMESOURCE("BTimeSource::IsRunning() node %" B_PRId32 ", port %"
|
||||||
|
B_PRId32 ", %s\n", fNodeID, fControlPort, isrunning ? "yes" : "no");
|
||||||
return isrunning;
|
return isrunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +201,9 @@ BTimeSource::GetTime(bigtime_t *performance_time,
|
|||||||
// }
|
// }
|
||||||
// printf("BTimeSource::GetTime timesource %ld, index %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), index, *performance_time, *real_time, *drift);
|
// printf("BTimeSource::GetTime timesource %ld, index %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), index, *performance_time, *real_time, *drift);
|
||||||
|
|
||||||
TRACE_TIMESOURCE("BTimeSource::GetTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), *performance_time, *real_time, *drift);
|
TRACE_TIMESOURCE("BTimeSource::GetTime timesource %" B_PRId32
|
||||||
|
", perf %16" B_PRId64 ", real %16" B_PRId64 ", drift %2.2f\n", ID(),
|
||||||
|
*performance_time, *real_time, *drift);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +229,7 @@ BTimeSource::GetStartLatency(bigtime_t *out_latency)
|
|||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
|
|
||||||
BTimeSource::BTimeSource() :
|
BTimeSource::BTimeSource() :
|
||||||
BMediaNode("This one is never called"),
|
BMediaNode("This one is never called"),
|
||||||
fStarted(false),
|
fStarted(false),
|
||||||
fArea(-1),
|
fArea(-1),
|
||||||
@@ -246,7 +252,8 @@ BTimeSource::HandleMessage(int32 message,
|
|||||||
const void *rawdata,
|
const void *rawdata,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
PRINT(4, "BTimeSource::HandleMessage %#lx, node %ld\n", message, fNodeID);
|
PRINT(4, "BTimeSource::HandleMessage %#" B_PRIx32 ", node %" B_PRId32 "\n",
|
||||||
|
message, fNodeID);
|
||||||
status_t rv;
|
status_t rv;
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case TIMESOURCE_OP:
|
case TIMESOURCE_OP:
|
||||||
@@ -275,7 +282,7 @@ BTimeSource::HandleMessage(int32 message,
|
|||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TIMESOURCE_ADD_SLAVE_NODE:
|
case TIMESOURCE_ADD_SLAVE_NODE:
|
||||||
{
|
{
|
||||||
const timesource_add_slave_node_command *data = static_cast<const timesource_add_slave_node_command *>(rawdata);
|
const timesource_add_slave_node_command *data = static_cast<const timesource_add_slave_node_command *>(rawdata);
|
||||||
@@ -289,7 +296,7 @@ BTimeSource::HandleMessage(int32 message,
|
|||||||
DirectRemoveMe(data->node);
|
DirectRemoveMe(data->node);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TIMESOURCE_GET_START_LATENCY:
|
case TIMESOURCE_GET_START_LATENCY:
|
||||||
{
|
{
|
||||||
const timesource_get_start_latency_request *request = static_cast<const timesource_get_start_latency_request *>(rawdata);
|
const timesource_get_start_latency_request *request = static_cast<const timesource_get_start_latency_request *>(rawdata);
|
||||||
@@ -308,9 +315,12 @@ BTimeSource::PublishTime(bigtime_t performance_time,
|
|||||||
bigtime_t real_time,
|
bigtime_t real_time,
|
||||||
float drift)
|
float drift)
|
||||||
{
|
{
|
||||||
TRACE_TIMESOURCE("BTimeSource::PublishTime timesource %ld, perf %16Ld, real %16Ld, drift %2.2f\n", ID(), performance_time, real_time, drift);
|
TRACE_TIMESOURCE("BTimeSource::PublishTime timesource %" B_PRId32
|
||||||
|
", perf %16" B_PRId64 ", real %16" B_PRId64 ", drift %2.2f\n", ID(),
|
||||||
|
performance_time, real_time, drift);
|
||||||
if (0 == fBuf) {
|
if (0 == fBuf) {
|
||||||
ERROR("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID());
|
ERROR("BTimeSource::PublishTime timesource %" B_PRId32
|
||||||
|
", fBuf = NULL\n", ID());
|
||||||
fStarted = true;
|
fStarted = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -335,9 +345,11 @@ BTimeSource::BroadcastTimeWarp(bigtime_t at_real_time,
|
|||||||
ASSERT(fSlaveNodes != NULL);
|
ASSERT(fSlaveNodes != NULL);
|
||||||
|
|
||||||
// calls BMediaNode::TimeWarp() of all slaved nodes
|
// calls BMediaNode::TimeWarp() of all slaved nodes
|
||||||
|
|
||||||
TRACE("BTimeSource::BroadcastTimeWarp: at_real_time %Ld, new_performance_time %Ld\n", at_real_time, new_performance_time);
|
TRACE("BTimeSource::BroadcastTimeWarp: at_real_time %" B_PRId64
|
||||||
|
", new_performance_time %" B_PRId64 "\n", at_real_time,
|
||||||
|
new_performance_time);
|
||||||
|
|
||||||
BAutolock lock(fSlaveNodes->locker);
|
BAutolock lock(fSlaveNodes->locker);
|
||||||
|
|
||||||
for (int i = 0, n = 0; i < SLAVE_NODES_COUNT && n != fSlaveNodes->count; i++) {
|
for (int i = 0, n = 0; i < SLAVE_NODES_COUNT && n != fSlaveNodes->count; i++) {
|
||||||
@@ -415,16 +427,18 @@ BTimeSource::BTimeSource(media_node_id id) :
|
|||||||
// We create a clone of the communication area
|
// We create a clone of the communication area
|
||||||
char name[32];
|
char name[32];
|
||||||
area_id area;
|
area_id area;
|
||||||
sprintf(name, "__timesource_buf_%ld", id);
|
sprintf(name, "__timesource_buf_%" B_PRId32, id);
|
||||||
area = find_area(name);
|
area = find_area(name);
|
||||||
if (area <= 0) {
|
if (area <= 0) {
|
||||||
ERROR("BTimeSource::BTimeSource couldn't find area, node %ld\n", id);
|
ERROR("BTimeSource::BTimeSource couldn't find area, node %" B_PRId32
|
||||||
|
"\n", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf(name, "__cloned_timesource_buf_%ld", id);
|
sprintf(name, "__cloned_timesource_buf_%" B_PRId32, id);
|
||||||
fArea = clone_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
fArea = clone_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, area);
|
||||||
if (fArea <= 0) {
|
if (fArea <= 0) {
|
||||||
ERROR("BTimeSource::BTimeSource couldn't clone area, node %ld\n", id);
|
ERROR("BTimeSource::BTimeSource couldn't clone area, node %" B_PRId32
|
||||||
|
"\n", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,12 +449,13 @@ BTimeSource::FinishCreate()
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
//printf("BTimeSource::FinishCreate(), id %ld\n", ID());
|
//printf("BTimeSource::FinishCreate(), id %ld\n", ID());
|
||||||
|
|
||||||
char name[32];
|
char name[32];
|
||||||
sprintf(name, "__timesource_buf_%ld", ID());
|
sprintf(name, "__timesource_buf_%" B_PRId32, ID());
|
||||||
fArea = create_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, TS_AREA_SIZE, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
fArea = create_area(name, reinterpret_cast<void **>(const_cast<BPrivate::media::TimeSourceTransmit **>(&fBuf)), B_ANY_ADDRESS, TS_AREA_SIZE, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (fArea <= 0) {
|
if (fArea <= 0) {
|
||||||
ERROR("BTimeSource::BTimeSource couldn't create area, node %ld\n", ID());
|
ERROR("BTimeSource::BTimeSource couldn't create area, node %" B_PRId32
|
||||||
|
"\n", ID());
|
||||||
fBuf = NULL;
|
fBuf = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -511,7 +526,7 @@ BTimeSource::DirectAddMe(const media_node &node)
|
|||||||
time_source_op_info msg;
|
time_source_op_info msg;
|
||||||
msg.op = B_TIMESOURCE_START;
|
msg.op = B_TIMESOURCE_START;
|
||||||
msg.real_time = RealTime();
|
msg.real_time = RealTime();
|
||||||
TRACE_TIMESOURCE("starting time source %ld\n", ID());
|
TRACE_TIMESOURCE("starting time source %" B_PRId32 "\n", ID());
|
||||||
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -544,7 +559,7 @@ BTimeSource::DirectRemoveMe(const media_node &node)
|
|||||||
time_source_op_info msg;
|
time_source_op_info msg;
|
||||||
msg.op = B_TIMESOURCE_STOP_IMMEDIATELY;
|
msg.op = B_TIMESOURCE_STOP_IMMEDIATELY;
|
||||||
msg.real_time = RealTime();
|
msg.real_time = RealTime();
|
||||||
TRACE_TIMESOURCE("stopping time source %ld\n", ID());
|
TRACE_TIMESOURCE("stopping time source %" B_PRId32 "\n", ID());
|
||||||
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
write_port(fControlPort, TIMESOURCE_OP, &msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -48,14 +48,17 @@ TimeSourceObject::TimeSourceObject(const media_node& node)
|
|||||||
if (BMediaRoster::Roster()->GetLiveNodeInfo(node, &liveNodeInfo)
|
if (BMediaRoster::Roster()->GetLiveNodeInfo(node, &liveNodeInfo)
|
||||||
== B_OK)
|
== B_OK)
|
||||||
strlcpy(fName, liveNodeInfo.name, B_MEDIA_NAME_LENGTH);
|
strlcpy(fName, liveNodeInfo.name, B_MEDIA_NAME_LENGTH);
|
||||||
else
|
else {
|
||||||
snprintf(fName, B_MEDIA_NAME_LENGTH, "timesource %ld", node.node);
|
snprintf(fName, B_MEDIA_NAME_LENGTH, "timesource %" B_PRId32,
|
||||||
|
node.node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddNodeKind(NODE_KIND_SHADOW_TIMESOURCE);
|
AddNodeKind(NODE_KIND_SHADOW_TIMESOURCE);
|
||||||
AddNodeKind(NODE_KIND_NO_REFCOUNTING);
|
AddNodeKind(NODE_KIND_NO_REFCOUNTING);
|
||||||
|
|
||||||
TRACE("TimeSourceObject::TimeSourceObject leave, node id %ld\n", fNodeID);
|
TRACE("TimeSourceObject::TimeSourceObject leave, node id %" B_PRId32 "\n",
|
||||||
|
fNodeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,18 +66,18 @@ _event_queue_imp::~_event_queue_imp()
|
|||||||
delete fLock;
|
delete fLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
_event_queue_imp::AddEvent(const media_timed_event &event)
|
_event_queue_imp::AddEvent(const media_timed_event &event)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLock);
|
BAutolock lock(fLock);
|
||||||
|
|
||||||
// printf(" adding %12Ld at %12Ld\n", event.event_time, system_time());
|
// printf(" adding %12Ld at %12Ld\n", event.event_time, system_time());
|
||||||
|
|
||||||
if (event.type <= 0) {
|
if (event.type <= 0) {
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(bigtime_t *)&event.queued_time = BTimeSource::RealTime();
|
*(bigtime_t *)&event.queued_time = BTimeSource::RealTime();
|
||||||
|
|
||||||
//create a new queue
|
//create a new queue
|
||||||
@@ -91,7 +91,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
|
|||||||
fEventCount++;
|
fEventCount++;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert at queue begin
|
//insert at queue begin
|
||||||
if (fFirstEntry->event.event_time >= event.event_time) {
|
if (fFirstEntry->event.event_time >= event.event_time) {
|
||||||
event_queue_entry *newentry = new event_queue_entry;
|
event_queue_entry *newentry = new event_queue_entry;
|
||||||
@@ -115,7 +115,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
|
|||||||
fEventCount++;
|
fEventCount++;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//insert into the queue
|
//insert into the queue
|
||||||
for (event_queue_entry *entry = fLastEntry; entry; entry = entry->prev) {
|
for (event_queue_entry *entry = fLastEntry; entry; entry = entry->prev) {
|
||||||
if (entry->event.event_time <= event.event_time) {
|
if (entry->event.event_time <= event.event_time) {
|
||||||
@@ -130,7 +130,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debugger("_event_queue_imp::AddEvent failed, should not be here\n");
|
debugger("_event_queue_imp::AddEvent failed, should not be here\n");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -157,10 +157,10 @@ status_t
|
|||||||
_event_queue_imp::RemoveFirstEvent(media_timed_event * outEvent)
|
_event_queue_imp::RemoveFirstEvent(media_timed_event * outEvent)
|
||||||
{
|
{
|
||||||
BAutolock lock(fLock);
|
BAutolock lock(fLock);
|
||||||
|
|
||||||
if (fFirstEntry == 0)
|
if (fFirstEntry == 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
if (outEvent != 0) {
|
if (outEvent != 0) {
|
||||||
// No cleanup here
|
// No cleanup here
|
||||||
*outEvent = fFirstEntry->event;
|
*outEvent = fFirstEntry->event;
|
||||||
@@ -173,7 +173,7 @@ _event_queue_imp::RemoveFirstEvent(media_timed_event * outEvent)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
_event_queue_imp::HasEvents() const
|
_event_queue_imp::HasEvents() const
|
||||||
{
|
{
|
||||||
@@ -191,31 +191,31 @@ _event_queue_imp::EventCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const media_timed_event *
|
const media_timed_event *
|
||||||
_event_queue_imp::FirstEvent() const
|
_event_queue_imp::FirstEvent() const
|
||||||
{
|
{
|
||||||
return fFirstEntry ? &fFirstEntry->event : NULL;
|
return fFirstEntry ? &fFirstEntry->event : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
_event_queue_imp::FirstEventTime() const
|
_event_queue_imp::FirstEventTime() const
|
||||||
{
|
{
|
||||||
return fFirstEntry ? fFirstEntry->event.event_time : B_INFINITE_TIMEOUT;
|
return fFirstEntry ? fFirstEntry->event.event_time : B_INFINITE_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const media_timed_event *
|
const media_timed_event *
|
||||||
_event_queue_imp::LastEvent() const
|
_event_queue_imp::LastEvent() const
|
||||||
{
|
{
|
||||||
return fLastEntry ? &fLastEntry->event : NULL;
|
return fLastEntry ? &fLastEntry->event : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bigtime_t
|
bigtime_t
|
||||||
_event_queue_imp::LastEventTime() const
|
_event_queue_imp::LastEventTime() const
|
||||||
{
|
{
|
||||||
return fLastEntry ? fLastEntry->event.event_time : B_INFINITE_TIMEOUT;
|
return fLastEntry ? fLastEntry->event.event_time : B_INFINITE_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
|
|||||||
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
||||||
action = (*hook)(&entry->event, context);
|
action = (*hook)(&entry->event, context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case BTimedEventQueue::B_DONE:
|
case BTimedEventQueue::B_DONE:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case BTimedEventQueue::B_REMOVE_EVENT:
|
case BTimedEventQueue::B_REMOVE_EVENT:
|
||||||
CleanupEvent(&entry->event);
|
CleanupEvent(&entry->event);
|
||||||
@@ -327,7 +327,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
|
|||||||
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
||||||
action = (*hook)(&entry->event, context);
|
action = (*hook)(&entry->event, context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case BTimedEventQueue::B_DONE:
|
case BTimedEventQueue::B_DONE:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case BTimedEventQueue::B_REMOVE_EVENT:
|
case BTimedEventQueue::B_REMOVE_EVENT:
|
||||||
CleanupEvent(&entry->event);
|
CleanupEvent(&entry->event);
|
||||||
@@ -356,7 +356,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
|
|||||||
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
||||||
action = (*hook)(&entry->event, context);
|
action = (*hook)(&entry->event, context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case BTimedEventQueue::B_DONE:
|
case BTimedEventQueue::B_DONE:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case BTimedEventQueue::B_REMOVE_EVENT:
|
case BTimedEventQueue::B_REMOVE_EVENT:
|
||||||
CleanupEvent(&entry->event);
|
CleanupEvent(&entry->event);
|
||||||
@@ -387,7 +387,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
|
|||||||
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
if (eventType == BTimedEventQueue::B_ANY_EVENT || eventType == entry->event.type) {
|
||||||
action = (*hook)(&entry->event, context);
|
action = (*hook)(&entry->event, context);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case BTimedEventQueue::B_DONE:
|
case BTimedEventQueue::B_DONE:
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case BTimedEventQueue::B_REMOVE_EVENT:
|
case BTimedEventQueue::B_REMOVE_EVENT:
|
||||||
CleanupEvent(&entry->event);
|
CleanupEvent(&entry->event);
|
||||||
@@ -411,7 +411,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
_event_queue_imp::FlushEvents(bigtime_t eventTime,
|
_event_queue_imp::FlushEvents(bigtime_t eventTime,
|
||||||
BTimedEventQueue::time_direction direction,
|
BTimedEventQueue::time_direction direction,
|
||||||
@@ -505,7 +505,7 @@ _event_queue_imp::SetCleanupHook(BTimedEventQueue::cleanup_hook hook, void *cont
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_event_queue_imp::RemoveEntry(event_queue_entry *entry)
|
_event_queue_imp::RemoveEntry(event_queue_entry *entry)
|
||||||
{
|
{
|
||||||
//remove the entry from double-linked list
|
//remove the entry from double-linked list
|
||||||
@@ -531,30 +531,30 @@ _event_queue_imp::RemoveEntry(event_queue_entry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_event_queue_imp::CleanupEvent(media_timed_event *event)
|
_event_queue_imp::CleanupEvent(media_timed_event *event)
|
||||||
{
|
{
|
||||||
//perform the cleanup action required
|
//perform the cleanup action required
|
||||||
//when deleting an event from the queue
|
//when deleting an event from the queue
|
||||||
|
|
||||||
//BeBook says:
|
//BeBook says:
|
||||||
// Each event has a cleanup flag associated with it that indicates
|
// Each event has a cleanup flag associated with it that indicates
|
||||||
// what sort of special action needs to be performed when the event is
|
// what sort of special action needs to be performed when the event is
|
||||||
// removed from the queue. If this value is B_NO_CLEANUP, nothing is done.
|
// removed from the queue. If this value is B_NO_CLEANUP, nothing is done.
|
||||||
// If it's B_RECYCLE, and the event is a B_HANDLE_BUFFER event, BTimedEventQueue
|
// If it's B_RECYCLE, and the event is a B_HANDLE_BUFFER event, BTimedEventQueue
|
||||||
// will automatically recycle the buffer associated with the event.
|
// will automatically recycle the buffer associated with the event.
|
||||||
// If the cleanup flag is B_DELETE or is B_USER_CLEANUP or greater,
|
// If the cleanup flag is B_DELETE or is B_USER_CLEANUP or greater,
|
||||||
// the cleanup hook function will be called.
|
// the cleanup hook function will be called.
|
||||||
//and:
|
//and:
|
||||||
// cleanup hook function specified by hook to be called for events
|
// cleanup hook function specified by hook to be called for events
|
||||||
// as they're removed from the queue. The hook will be called only
|
// as they're removed from the queue. The hook will be called only
|
||||||
// for events with cleanup_flag values of B_DELETE or B_USER_CLEANUP or greater.
|
// for events with cleanup_flag values of B_DELETE or B_USER_CLEANUP or greater.
|
||||||
//and:
|
//and:
|
||||||
// These values define how BTimedEventQueue should handle removing
|
// These values define how BTimedEventQueue should handle removing
|
||||||
// events from the queue. If the flag is B_USER_CLEANUP or greater,
|
// events from the queue. If the flag is B_USER_CLEANUP or greater,
|
||||||
// the cleanup hook function is called when the event is removed.
|
// the cleanup hook function is called when the event is removed.
|
||||||
//Problems:
|
//Problems:
|
||||||
// B_DELETE is a keyboard code! (seems to have existed in early
|
// B_DELETE is a keyboard code! (seems to have existed in early
|
||||||
// sample code as a cleanup flag)
|
// sample code as a cleanup flag)
|
||||||
//
|
//
|
||||||
// exiting cleanup flags are:
|
// exiting cleanup flags are:
|
||||||
@@ -562,8 +562,8 @@ _event_queue_imp::CleanupEvent(media_timed_event *event)
|
|||||||
// B_RECYCLE_BUFFER, // recycle buffers handled by BTimedEventQueue
|
// B_RECYCLE_BUFFER, // recycle buffers handled by BTimedEventQueue
|
||||||
// B_EXPIRE_TIMER, // call TimerExpired() on the event->data
|
// B_EXPIRE_TIMER, // call TimerExpired() on the event->data
|
||||||
// B_USER_CLEANUP = 0x4000 // others go to the cleanup func
|
// B_USER_CLEANUP = 0x4000 // others go to the cleanup func
|
||||||
//
|
//
|
||||||
|
|
||||||
if (event->cleanup == BTimedEventQueue::B_NO_CLEANUP) {
|
if (event->cleanup == BTimedEventQueue::B_NO_CLEANUP) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if (event->type == BTimedEventQueue::B_HANDLE_BUFFER && event->cleanup == BTimedEventQueue::B_RECYCLE_BUFFER) {
|
} else if (event->type == BTimedEventQueue::B_HANDLE_BUFFER && event->cleanup == BTimedEventQueue::B_RECYCLE_BUFFER) {
|
||||||
@@ -576,7 +576,8 @@ _event_queue_imp::CleanupEvent(media_timed_event *event)
|
|||||||
if (fCleanupHook)
|
if (fCleanupHook)
|
||||||
(*fCleanupHook)(event,fCleanupHookContext);
|
(*fCleanupHook)(event,fCleanupHookContext);
|
||||||
} else {
|
} else {
|
||||||
ERROR("BTimedEventQueue cleanup unhandled! type = %ld, cleanup = %ld\n", event->type, event->cleanup);
|
ERROR("BTimedEventQueue cleanup unhandled! type = %" B_PRId32
|
||||||
|
", cleanup = %" B_PRId32 "\n", event->type, event->cleanup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,7 +586,7 @@ _event_queue_imp::event_queue_entry *
|
|||||||
_event_queue_imp::GetEnd_BeforeTime(bigtime_t eventTime, bool inclusive)
|
_event_queue_imp::GetEnd_BeforeTime(bigtime_t eventTime, bool inclusive)
|
||||||
{
|
{
|
||||||
event_queue_entry *entry;
|
event_queue_entry *entry;
|
||||||
|
|
||||||
entry = fLastEntry;
|
entry = fLastEntry;
|
||||||
while (entry) {
|
while (entry) {
|
||||||
if ((entry->event.event_time > eventTime) || (!inclusive && entry->event.event_time == eventTime))
|
if ((entry->event.event_time > eventTime) || (!inclusive && entry->event.event_time == eventTime))
|
||||||
@@ -601,7 +602,7 @@ _event_queue_imp::event_queue_entry *
|
|||||||
_event_queue_imp::GetStart_AfterTime(bigtime_t eventTime, bool inclusive)
|
_event_queue_imp::GetStart_AfterTime(bigtime_t eventTime, bool inclusive)
|
||||||
{
|
{
|
||||||
event_queue_entry *entry;
|
event_queue_entry *entry;
|
||||||
|
|
||||||
entry = fFirstEntry;
|
entry = fFirstEntry;
|
||||||
while (entry) {
|
while (entry) {
|
||||||
if ((entry->event.event_time < eventTime) || (!inclusive && entry->event.event_time == eventTime))
|
if ((entry->event.event_time < eventTime) || (!inclusive && entry->event.event_time == eventTime))
|
||||||
|
|||||||
Reference in New Issue
Block a user