64 bit fixes for libmedia.so, ActivityMonitor, and Sudoku.

* Alex, I feel your pain :-)
This commit is contained in:
Axel Dörfler
2012-11-30 13:16:38 +01:00
parent 8f6542aa68
commit 332cc6bc3b
25 changed files with 586 additions and 479 deletions
+10 -7
View File
@@ -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.
*/
#ifndef _MEDIA_NODE_H
@@ -92,7 +92,7 @@ struct media_request_info {
what_code what;
int32 change_tag;
status_t status;
int32 cookie;
void* cookie;
void* user_data;
media_source source;
media_destination destination;
@@ -115,11 +115,13 @@ struct media_node_attribute {
};
namespace BPrivate { namespace media {
class TimeSourceObject;
class SystemTimeSourceObject;
class BMediaRosterEx;
} } // BPrivate::media
namespace BPrivate {
namespace media {
class TimeSourceObject;
class SystemTimeSourceObject;
class BMediaRosterEx;
}
} // BPrivate::media
/*! BMediaNode is the indirect base class for all Media Kit participants.
@@ -338,4 +340,5 @@ private:
// not to be confused with _mChangeCount
};
#endif // _MEDIA_NODE_H
+1 -1
View File
@@ -48,7 +48,7 @@ public:
interval /= 1000;
// Find closest index
int32 bestDiff = LONG_MAX;
int32 bestDiff = INT32_MAX;
uint32 bestIndex = 0;
for (uint32 i = 0; i < kNumUpdateIntervals; i++) {
int32 diff = abs(kUpdateIntervals[i] - interval);
+6
View File
@@ -221,6 +221,12 @@ PartitionListRow::PartitionListRow(BPartition* partition)
if (partition->ContainsFileSystem()) {
SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
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) {
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
+1 -1
View File
@@ -216,7 +216,7 @@ SudokuField::Dump()
for (uint32 x = 0; x < fSize; x++) {
if (x != 0 && x % fBlockSize == 0)
putchar(' ');
printf("%lu", ValueAt(x, y));
printf("%" B_PRIu32, ValueAt(x, y));
}
putchar('\n');
}
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2011, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2007-2012, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
@@ -161,7 +161,7 @@ SudokuGenerator::Generate(SudokuField* target, uint32 fieldsLeft,
if (removeCount <= 0 || *quit)
break;
}
printf(" remove count = %ld\n", removeCount);
printf(" remove count = %" B_PRId32 "\n", removeCount);
}
// set the remaining values to be initial values
+15 -15
View File
@@ -110,10 +110,10 @@ void
SudokuView::InitObject(const BMessage* archive)
{
fField = NULL;
fShowHintX = ~0UL;
fValueHintValue = ~0UL;
fLastHintValue = ~0UL;
fLastField = ~0UL;
fShowHintX = UINT32_MAX;
fValueHintValue = UINT32_MAX;
fLastHintValue = UINT32_MAX;
fLastField = UINT32_MAX;
fKeyboardX = 0;
fKeyboardY = 0;
fShowKeyboardFocus = false;
@@ -220,7 +220,7 @@ SudokuView::SetTo(entry_ref& ref)
_PushUndo();
status = fField->SetTo(_BaseCharacter(), buffer);
fValueHintValue = ~0UL;
fValueHintValue = UINT32_MAX;
Invalidate();
fclose(file);
return status;
@@ -243,7 +243,7 @@ SudokuView::SetTo(const char* data)
_PushUndo();
status = fField->SetTo(_BaseCharacter(), buffer);
fValueHintValue = ~0UL;
fValueHintValue = UINT32_MAX;
Invalidate();
return status;
}
@@ -260,7 +260,7 @@ SudokuView::SetTo(SudokuField* field)
fField = field;
fBlockSize = fField->BlockSize();
fValueHintValue = ~0UL;
fValueHintValue = UINT32_MAX;
FrameResized(0, 0);
Invalidate();
return B_OK;
@@ -757,12 +757,12 @@ SudokuView::_SetValueHintValue(uint32 value)
if (value == fValueHintValue)
return;
if (fValueHintValue != ~0UL)
if (fValueHintValue != UINT32_MAX)
_InvalidateValue(fValueHintValue, true);
fValueHintValue = value;
if (fValueHintValue != ~0UL)
if (fValueHintValue != UINT32_MAX)
_InvalidateValue(fValueHintValue, true);
}
@@ -770,13 +770,13 @@ SudokuView::_SetValueHintValue(uint32 value)
void
SudokuView::_RemoveHint()
{
if (fShowHintX == ~0UL)
if (fShowHintX == UINT32_MAX)
return;
uint32 x = fShowHintX;
uint32 y = fShowHintY;
fShowHintX = ~0;
fShowHintY = ~0;
fShowHintX = UINT32_MAX;
fShowHintY = UINT32_MAX;
_InvalidateField(x, y);
}
@@ -912,7 +912,7 @@ SudokuView::MouseDown(BPoint where)
fField->SetHintMaskAt(x, y, hintMask);
if (value + 1 != fValueHintValue) {
_SetValueHintValue(~0UL);
_SetValueHintValue(UINT32_MAX);
_InvalidateHintField(x, y, hintX, hintY);
} else
_InvalidateField(x, y);
@@ -1107,7 +1107,7 @@ SudokuView::MessageReceived(BMessage* message)
solver.SetTo(fField);
bigtime_t start = system_time();
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);
if (solver.CountSolutions() > 0) {
_PushUndo();
@@ -1129,7 +1129,7 @@ SudokuView::MessageReceived(BMessage* message)
solver.SetTo(fField);
bigtime_t start = system_time();
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);
if (solver.CountSolutions() > 0) {
_PushUndo();
+2 -1
View File
@@ -96,7 +96,8 @@ private:
void _InvalidateField(uint32 x, uint32 y);
void _InvalidateValue(uint32 value,
bool invalidateHint = false,
uint32 x = ~0UL, uint32 y = ~0UL);
uint32 x = UINT32_MAX,
uint32 y = UINT32_MAX);
void _InvalidateKeyboardFocus(uint32 x, uint32 y);
void _InsertKey(char rawKey, int32 modifiers);
void _SetValueHintValue(uint32 value);
+2 -1
View File
@@ -54,7 +54,8 @@ BBufferGroup::BBufferGroup(size_t size, int32 count, uint32 placement,
// don't allow all placement parameter values
if (placement != B_ANY_ADDRESS && placement != B_ANY_KERNEL_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;
}
+7 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2010-2012, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2002-2003, Marcus Overhagen, <Marcus@Overhagen.de>.
* Distributed under the terms of the MIT License.
*/
@@ -82,7 +82,7 @@ BBufferProducer::GetLatency(bigtime_t* _latency)
{
CALLED();
// 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
int32 cookie;
@@ -95,7 +95,7 @@ BBufferProducer::GetLatency(bigtime_t* _latency)
while (GetNextOutput(&cookie, &output) == B_OK) {
if (output.destination == media_destination::null)
continue;
if (output.node.node == fNodeID) {
// avoid port writes (deadlock) if loopback connection
if (fConsumerThis == NULL)
@@ -113,7 +113,8 @@ BBufferProducer::GetLatency(bigtime_t* _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;
}
@@ -276,7 +277,7 @@ BBufferProducer::HandleMessage(int32 message, const void* data, size_t size)
= media_request_info::B_SET_OUTPUT_BUFFERS_FOR;
replycommand.info.change_tag = command->change_tag;
replycommand.info.status = status;
replycommand.info.cookie = (int32)group;
replycommand.info.cookie = group;
replycommand.info.user_data = command->user_data;
replycommand.info.source = command->source;
replycommand.info.destination = command->destination;
@@ -544,7 +545,7 @@ BBufferProducer::FindSeekTag(const media_destination& destination,
request.destination = destination;
request.target_time = targetTime;
request.flags = flags;
status_t status = QueryPort(destination.port, CONSUMER_SEEK_TAG_REQUESTED,
&request, sizeof(request), &reply, sizeof(reply));
if (status != B_OK)
+3 -2
View File
@@ -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.
*/
@@ -367,7 +367,8 @@ BControllable::StartControlPanel(BMessenger* _messenger)
ERROR("BControllable::StartControlPanel Error launching application\n");
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)
*_messenger = BMessenger(NULL, team);
+12 -10
View File
@@ -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,
B_RELATIVE_TIMEOUT, TIMEOUT);
if (status != B_OK) {
ERROR("SendToPort: write_port failed, msgcode 0x%lx, port %ld: %s\n",
msgCode, sendPort, strerror(status));
ERROR("SendToPort: write_port failed, msgcode 0x%" B_PRIx32 ", port %"
B_PRId32 ": %s\n", msgCode, sendPort, strerror(status));
if (status == B_BAD_PORT_ID && sendPort == sMediaServerPort) {
find_media_server_port();
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,
B_RELATIVE_TIMEOUT, TIMEOUT);
if (status != B_OK) {
ERROR("SendToPort: retrying write_port failed, msgCode 0x%lx, "
"port %ld: %s\n", msgCode, sendPort, strerror(status));
ERROR("SendToPort: retrying write_port failed, msgCode 0x%" B_PRIx32
", port %" B_PRId32 ": %s\n", msgCode, sendPort,
strerror(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,
B_RELATIVE_TIMEOUT, TIMEOUT);
if (status != B_OK) {
ERROR("QueryPort: write_port failed, msgcode 0x%lx, port %ld: %s\n",
msgCode, requestPort, strerror(status));
ERROR("QueryPort: write_port failed, msgcode 0x%" B_PRIx32 ", port %"
B_PRId32 ": %s\n", msgCode, requestPort, strerror(status));
if (status == B_BAD_PORT_ID && requestPort == sMediaServerPort) {
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,
B_RELATIVE_TIMEOUT, TIMEOUT);
if (status != B_OK) {
ERROR("QueryPort: retrying write_port failed, msgcode 0x%lx, port "
"%ld: %s\n", msgCode, requestPort, strerror(status));
ERROR("QueryPort: retrying write_port failed, msgcode 0x%" B_PRIx32
", port %" B_PRId32 ": %s\n", msgCode, requestPort,
strerror(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,
B_RELATIVE_TIMEOUT, TIMEOUT);
if (status < B_OK) {
ERROR("QueryPort: read_port failed, msgcode 0x%lx, port %ld: %s\n",
msgCode, request->reply_port, strerror(status));
ERROR("QueryPort: read_port failed, msgcode 0x%" B_PRIx32 ", port %"
B_PRId32 ": %s\n", msgCode, request->reply_port, strerror(status));
}
return status < B_OK ? status : reply->result;
+13 -12
View File
@@ -85,8 +85,8 @@ DormantNodeManager::~DormantNodeManager()
for (; iterator != fAddOnMap.end(); iterator++) {
loaded_add_on_info& info = iterator->second;
ERROR("Forcing unload of add-on id %ld with usecount %ld\n",
info.add_on->AddonID(), info.use_count);
ERROR("Forcing unload of add-on id %" B_PRId32 " with usecount %"
B_PRId32 "\n", info.add_on->AddonID(), info.use_count);
_UnloadAddOn(info.add_on, info.image);
}
}
@@ -95,7 +95,7 @@ DormantNodeManager::~DormantNodeManager()
BMediaAddOn*
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
BMediaAddOn* addOn = _LookupAddOn(id);
@@ -107,8 +107,8 @@ DormantNodeManager::GetAddOn(media_addon_id id)
// ok, it's not loaded, try to get the path
BPath path;
if (FindAddOnPath(&path, id) != B_OK) {
ERROR("DormantNodeManager::GetAddon: can't find path for add-on "
"%ld\n", id);
ERROR("DormantNodeManager::GetAddon: can't find path for add-on %"
B_PRId32 "\n", id);
return NULL;
}
@@ -116,8 +116,8 @@ DormantNodeManager::GetAddOn(media_addon_id id)
BMediaAddOn* newAddOn;
image_id image;
if (_LoadAddOn(path.Path(), id, &newAddOn, &image) != B_OK) {
ERROR("DormantNodeManager::GetAddon: can't load add-on %ld from path "
"%s\n",id, path.Path());
ERROR("DormantNodeManager::GetAddon: can't load add-on %" B_PRId32
" from path %s\n",id, path.Path());
return NULL;
}
@@ -154,13 +154,14 @@ DormantNodeManager::GetAddOn(media_addon_id id)
void
DormantNodeManager::PutAddOn(media_addon_id id)
{
TRACE("DormantNodeManager::PutAddon, id %ld\n", id);
TRACE("DormantNodeManager::PutAddon, id %" B_PRId32 "\n", id);
BAutolock locker(fLock);
AddOnMap::iterator found = fAddOnMap.find(id);
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;
}
@@ -194,7 +195,7 @@ DormantNodeManager::PutAddOnDelayed(media_addon_id id)
media_addon_id
DormantNodeManager::RegisterAddOn(const char* path)
{
TRACE("DormantNodeManager::RegisterAddon, path %s\n",path);
TRACE("DormantNodeManager::RegisterAddon, path %s\n", path);
entry_ref ref;
status_t status = get_ref_for_path(path, &ref);
@@ -222,7 +223,7 @@ DormantNodeManager::RegisterAddOn(const char* path)
return 0;
}
TRACE("DormantNodeManager::RegisterAddon finished with id %ld\n",
TRACE("DormantNodeManager::RegisterAddon finished with id %" B_PRId32 "\n",
reply.add_on_id);
return reply.add_on_id;
@@ -233,7 +234,7 @@ DormantNodeManager::RegisterAddOn(const char* path)
void
DormantNodeManager::UnregisterAddOn(media_addon_id id)
{
TRACE("DormantNodeManager::UnregisterAddon id %ld\n",id);
TRACE("DormantNodeManager::UnregisterAddon id %" B_PRId32 "\n", id);
ASSERT(id > 0);
port_id port = find_port(MEDIA_SERVER_PORT_NAME);
+61 -62
View File
@@ -114,7 +114,7 @@ media_source::~media_source()
media_source media_source::null(-1, -1);
// #pragma mark -
// #pragma mark -
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;
@@ -352,7 +352,7 @@ multistream_format_matches(const media_multistream_format& a,
switch ((a.format != 0) ? a.format : b.format) {
default:
return true; // TODO: really?
case media_multistream_format::B_VID:
if (a.u.vid.frame_rate != 0 && b.u.vid.frame_rate != 0
&& 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 true;
case media_multistream_format::B_AVI:
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) {
@@ -444,10 +444,10 @@ encoded_audio_format_matches(const media_encoded_audio_format& a,
return false;
if (!multi_audio_info_matches(a.multi_info, b.multi_info))
return false;
if (a.encoding == 0 && b.encoding == 0)
return true; // can't compare
switch((a.encoding != 0) ? a.encoding : b.encoding) {
case media_encoded_audio_format::B_ANY:
default:
@@ -488,7 +488,7 @@ encoded_video_format_matches(const media_encoded_video_format& a,
if (a.encoding == 0 && b.encoding == 0)
return true; // can't compare
switch((a.encoding != 0) ? a.encoding : b.encoding) {
case media_encoded_video_format::B_ANY:
default:
@@ -592,7 +592,7 @@ multistream_format_specialize(media_multistream_format* format,
format->flags = other->flags;
if (format->format == 0)
format->format = other->format;
switch (format->format) {
case media_multistream_format::B_VID:
if (format->u.vid.frame_rate == 0)
@@ -636,7 +636,8 @@ multistream_format_specialize(media_multistream_format* format,
default:
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?
return true;
}
if (type != 0 && other->type != 0 && type != other->type)
return false;
switch ((type != 0) ? type : other->type) {
case B_MEDIA_RAW_AUDIO:
return multi_audio_format_matches(u.raw_audio, other->u.raw_audio);
case B_MEDIA_RAW_VIDEO:
return raw_video_format_matches(u.raw_video, other->u.raw_video);
case B_MEDIA_MULTISTREAM:
return multistream_format_matches(u.multistream,
other->u.multistream);
case B_MEDIA_ENCODED_AUDIO:
return encoded_audio_format_matches(u.encoded_audio,
other->u.encoded_audio);
@@ -710,7 +711,7 @@ media_format::Matches(const media_format* other) const
case B_MEDIA_ENCODED_VIDEO:
return encoded_video_format_matches(u.encoded_video,
other->u.encoded_video);
default:
return true; // TODO: really?
}
@@ -727,16 +728,16 @@ media_format::SpecializeTo(const media_format* otherFormat)
"wildcard format\n");
return;
}
if (type == 0)
type = otherFormat->type;
switch (type) {
case B_MEDIA_RAW_AUDIO:
multi_audio_format_specialize(&u.raw_audio,
&otherFormat->u.raw_audio);
return;
case B_MEDIA_RAW_VIDEO:
raw_video_format_specialize(&u.raw_video,
&otherFormat->u.raw_video);
@@ -746,7 +747,7 @@ media_format::SpecializeTo(const media_format* otherFormat)
multistream_format_specialize(&u.multistream,
&otherFormat->u.multistream);
return;
case B_MEDIA_ENCODED_AUDIO:
encoded_audio_format_specialize(&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,
&otherFormat->u.encoded_video);
return;
default:
ERROR("media_format::SpecializeTo can't specialize format "
"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)
return B_BAD_VALUE;
void* new_addr;
area_id new_area;
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_size = size;
meta_data_area = new_area;
memcpy(meta_data, data, size);
if (meta_data_area > 0)
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
if (clone.meta_data) {
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);
if (meta_data_area < 0) {
// whoops, we just lost our meta data
@@ -1011,7 +1012,7 @@ operator==(const media_multistream_format& a,
switch (a.format) {
case media_multistream_format::B_VID:
return a.u.vid == b.u.vid;
case media_multistream_format::B_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) {
return false;
}
switch (a.type) {
case B_MEDIA_RAW_AUDIO:
return a.u.raw_audio == b.u.raw_audio;
case B_MEDIA_RAW_VIDEO:
return a.u.raw_video == b.u.raw_video;
case B_MEDIA_MULTISTREAM:
return a.u.multistream == b.u.multistream;
case B_MEDIA_ENCODED_AUDIO:
return a.u.encoded_audio == b.u.encoded_audio;
case B_MEDIA_ENCODED_VIDEO:
return a.u.encoded_video == b.u.encoded_video;
default:
return true; // TODO: really?
}
}
// #pragma mark -
// #pragma mark -
/*! 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 ? */
const char* videoOrientation = "0"; /* I'd use "NC", R5 uses 0. */
if (buf == NULL)
return false;
switch (f.type) {
case B_MEDIA_RAW_AUDIO:
snprintf(buf, size,
"raw_audio;%g;%ld;0x%lx;%ld;0x%lx;0x%08lx;%d;0x%04x",
f.u.raw_audio.frame_rate,
f.u.raw_audio.channel_count,
f.u.raw_audio.format,
f.u.raw_audio.byte_order,
"raw_audio;%g;%" B_PRIu32 ";0x%" B_PRIx32 ";%" B_PRIu32 ";0x%"
B_PRIxSIZE ";0x%#" B_PRIx32 ";%d;0x%04x",
f.u.raw_audio.frame_rate,
f.u.raw_audio.channel_count,
f.u.raw_audio.format,
f.u.raw_audio.byte_order,
f.u.raw_audio.buffer_size,
f.u.raw_audio.channel_mask,
f.u.raw_audio.valid_bits,
@@ -1093,9 +1095,8 @@ string_for_format(const media_format& f, char* buf, size_t size)
videoOrientation = "TopLR";
else if (f.u.raw_video.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
videoOrientation = "BotLR";
// snprintf(buf, size, "raw_video;%g;%ld;%ld;%ld;%s;%d;%d;%d;%d;%d;%d;"
// "%d;%d",
snprintf(buf, size, "raw_video;%g;0x%x;%ld;%ld;%ld;%ld;%s;%d;%d",
snprintf(buf, size, "raw_video;%g;0x%x;%" B_PRIu32 ";%" B_PRIu32 ";%"
B_PRIu32 ";%" B_PRIu32 ";%s;%d;%d",
f.u.raw_video.field_rate,
f.u.raw_video.display.format,
f.u.raw_video.interlace,
@@ -1108,21 +1109,20 @@ string_for_format(const media_format& f, char* buf, size_t size)
return true;
case B_MEDIA_ENCODED_AUDIO:
snprintf(encoding, 10, "%d", f.u.encoded_audio.encoding);
snprintf(buf, size,
"caudio;%s;%g;%ld;(%g;%ld;0x%lx;%ld;0x%lx;0x%08lx;%d;0x%04x)",
encoding, // f.u.encoded_audio.encoding,
f.u.encoded_audio.bit_rate,
f.u.encoded_audio.frame_size,
// (
f.u.encoded_audio.output.frame_rate,
f.u.encoded_audio.output.channel_count,
f.u.encoded_audio.output.format,
f.u.encoded_audio.output.byte_order,
snprintf(buf, size,
"caudio;%s;%g;%ld;(%g;%" B_PRIu32 ";0x%" B_PRIx32 ";%" B_PRIu32
";0x%" B_PRIxSIZE ";0x%08" B_PRIx32 ";%d;0x%04x)",
encoding,
f.u.encoded_audio.bit_rate,
f.u.encoded_audio.frame_size,
f.u.encoded_audio.output.frame_rate,
f.u.encoded_audio.output.channel_count,
f.u.encoded_audio.output.format,
f.u.encoded_audio.output.byte_order,
f.u.encoded_audio.output.buffer_size,
f.u.encoded_audio.multi_info.channel_mask,
f.u.encoded_audio.multi_info.valid_bits,
f.u.encoded_audio.multi_info.matrix_mask);
// )
return true;
case B_MEDIA_ENCODED_VIDEO:
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";
else if (f.u.encoded_video.output.orientation == B_VIDEO_BOTTOM_LEFT_RIGHT)
videoOrientation = "BotLR";
snprintf(buf, size,
"cvideo;%s;%g;%g;%ld;(%g;0x%x;%ld;%ld;%ld;%ld;%s;%d;%d)",
encoding,
f.u.encoded_video.avg_bit_rate,
f.u.encoded_video.max_bit_rate,
snprintf(buf, size,
"cvideo;%s;%g;%g;%" B_PRIuSIZE ";(%g;0x%x;%" B_PRIu32 ";%" B_PRIu32
";%" B_PRIu32 ";%" B_PRIu32 ";%s;%d;%d)",
encoding,
f.u.encoded_video.avg_bit_rate,
f.u.encoded_video.max_bit_rate,
f.u.encoded_video.frame_size,
// (
f.u.encoded_video.output.field_rate,
f.u.encoded_video.output.display.format,
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.first_active,
videoOrientation,
f.u.encoded_video.output.pixel_width_aspect,
f.u.encoded_video.output.pixel_height_aspect);
// )
return true;
default:
snprintf(buf, size, "%d-", f.type);
@@ -1232,7 +1231,7 @@ shutdown_media_server(bigtime_t timeout,
BMessage msg(B_QUIT_REQUESTED);
BMessage reply;
status_t err;
if ((err = msg.AddBool("be:_user_request", true)) != B_OK)
return err;
@@ -1266,7 +1265,7 @@ shutdown_media_server(bigtime_t timeout,
progress(40, "Waiting for media_server to quit.", cookie);
snooze(200000);
}
if (be_roster->IsRunning(B_MEDIA_ADDON_SERVER_SIGNATURE)) {
progress(50, "Waiting for media_addon_server to quit.", cookie);
snooze(200000);
@@ -1310,7 +1309,7 @@ launch_media_server(uint32 flags)
err = B_MEDIA_SYSTEM_FAILURE;
for (int i = 0; i < 15; i++) {
snooze(2000000);
BMessage msg(1); // this is a hack
BMessage reply;
BMessenger messenger(B_MEDIA_ADDON_SERVER_SIGNATURE);
+45 -42
View File
@@ -87,7 +87,7 @@ BMediaEventLooper::Start(bigtime_t performance_time)
// This hook function is called when a node is started
// by a call to the BMediaRoster. The specified
// 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));
}
@@ -97,15 +97,15 @@ BMediaEventLooper::Stop(bigtime_t performance_time,
bool immediate)
{
CALLED();
// This hook function is called when a node is stopped
// by a call to the BMediaRoster. The specified performanceTime,
// the time at which the node should stop, may be in the future.
// If immediate is true, your node should ignore the performanceTime
// This hook function is called when a node is stopped
// by a call to the BMediaRoster. The specified performanceTime,
// the time at which the node should stop, may be in the future.
// If immediate is true, your node should ignore the performanceTime
// value and synchronously stop performance. When Stop() returns,
// 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.
if (immediate) {
// always be sure to add to the front of the queue so we can make sure it is
// handled before any buffers are sent!
@@ -120,11 +120,11 @@ BMediaEventLooper::Seek(bigtime_t media_time,
bigtime_t performance_time)
{
CALLED();
// This hook function is called when a node is asked to seek to
// the specified mediaTime by a call to the BMediaRoster.
// The specified performanceTime, the time at which the node
// should begin the seek operation, may be in the future.
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_SEEK, NULL,
// This hook function is called when a node is asked to seek to
// the specified mediaTime by a call to the BMediaRoster.
// The specified performanceTime, the time at which the node
// should begin the seek operation, may be in the future.
fEventQueue.AddEvent(media_timed_event(performance_time, BTimedEventQueue::B_SEEK, 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)
{
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
// there will be a sudden jump in the performance time progression
// as seen by the node. The to_performance_time argument indicates
// there will be a sudden jump in the performance time progression
// as seen by the node. The to_performance_time argument indicates
// 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
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));
// 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()
// XXX should we do this here?
BMediaNode::TimeWarp(at_real_time, to_performance_time);
@@ -168,15 +168,16 @@ BMediaEventLooper::SetRunMode(run_mode mode)
CALLED();
// 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
int32 priority;
// bump or reduce priority when switching from/to offline run mode
int32 priority;
priority = (mode == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
if (priority != fCurrentPriority) {
fCurrentPriority = priority;
if (fControlThread > 0) {
set_thread_priority(fControlThread, fCurrentPriority);
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)
{
CALLED();
// 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
// the queue, to let you handle any special tidying-up that the event might require.
// 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
// 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)
return;
// BMediaEventLooper compensates your performance time by adding the event latency
// (see SetEventLatency()) and the scheduling latency (or, for real-time events,
// only the scheduling latency).
// (see SetEventLatency()) and the scheduling latency (or, for real-time events,
// only the scheduling latency).
latency = fEventLatency + fSchedulingLatency;
waituntil = B_INFINITE_TIMEOUT;
@@ -349,17 +350,18 @@ BMediaEventLooper::SetPriority(int32 priority)
// clamp to a valid value
if (priority < 5)
priority = 5;
if (priority > 120)
priority = 120;
fSetPriority = priority;
fCurrentPriority = (RunMode() == B_OFFLINE) ? min_c(B_NORMAL_PRIORITY, fSetPriority) : fSetPriority;
if (fControlThread > 0) {
set_thread_priority(fControlThread, fCurrentPriority);
fSchedulingLatency = estimate_max_scheduling_latency(fControlThread);
printf("BMediaEventLooper: SchedulingLatency is %Ld\n", fSchedulingLatency);
printf("BMediaEventLooper: SchedulingLatency is %" B_PRId64 "\n",
fSchedulingLatency);
}
return B_OK;
@@ -375,7 +377,7 @@ BMediaEventLooper::SetRunState(run_state state)
// also needed for correct terminating of the ControlLoop()
if (fRunState == B_QUITTING && state != B_TERMINATED)
return;
fRunState = state;
}
@@ -413,10 +415,10 @@ void
BMediaEventLooper::Run()
{
CALLED();
if (fControlThread != -1)
return; // thread already running
// until now, the run state is B_UNREGISTERED, but we need to start in B_STOPPED state.
SetRunState(B_STOPPED);
@@ -427,7 +429,8 @@ BMediaEventLooper::Run()
// get latency information
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)
return;
SetRunState(B_QUITTING);
close_port(ControlPort());
if (fControlThread != -1) {
@@ -463,23 +466,23 @@ BMediaEventLooper::DispatchEvent(const media_timed_event *event,
case BTimedEventQueue::B_START:
SetRunState(B_STARTED);
break;
case BTimedEventQueue::B_STOP:
case BTimedEventQueue::B_STOP:
SetRunState(B_STOPPED);
break;
case BTimedEventQueue::B_SEEK:
/* nothing */
break;
case BTimedEventQueue::B_WARP:
/* nothing */
break;
default:
break;
}
_DispatchCleanUp(event);
}
@@ -513,8 +516,8 @@ BMediaEventLooper::_DispatchCleanUp(const media_timed_event *event)
{
PRINT(6, "CALLED BMediaEventLooper::_DispatchCleanUp()\n");
// this function to clean up after custom events you've created
if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP)
// this function to clean up after custom events you've created
if (event->cleanup >= BTimedEventQueue::B_USER_CLEANUP)
CleanUpEvent(event);
}
+12 -12
View File
@@ -1,7 +1,7 @@
/*
* Copyright 2004-2007, Marcus Overhagen. 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.
*/
@@ -103,8 +103,8 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
fStreamInfo[i].cookie = 0;
fStreamInfo[i].hasCookie = false;
fStreamInfo[i].status = B_ERROR;
ERROR("MediaExtractor::MediaExtractor: AllocateCookie for stream "
"%ld failed\n", i);
ERROR("MediaExtractor::MediaExtractor: AllocateCookie for stream %"
B_PRId32 " failed\n", i);
} else
fStreamInfo[i].hasCookie = true;
}
@@ -122,7 +122,7 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
!= B_OK) {
fStreamInfo[i].status = B_ERROR;
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;
if (status != B_OK) {
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;
}
@@ -346,8 +346,8 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
sizeof(formatString));
ERROR("MediaExtractor::CreateDecoder gPluginManager.CreateDecoder "
"failed for stream %ld, format: %s: %s\n", stream, formatString,
strerror(status));
"failed for stream %" B_PRId32 ", format: %s: %s\n", stream,
formatString, strerror(status));
#endif
return status;
}
@@ -357,7 +357,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
if (chunkProvider == NULL) {
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder can't create chunk provider "
"for stream %ld\n", stream);
"for stream %" B_PRId32 "\n", stream);
return B_NO_MEMORY;
}
@@ -367,16 +367,16 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize);
if (status != B_OK) {
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %ld: %s\n",
stream, strerror(status));
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %" B_PRId32
": %s\n", stream, strerror(status));
return status;
}
status = gPluginManager.GetDecoderInfo(decoder, codecInfo);
if (status != B_OK) {
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream "
"%ld: %s\n", stream, strerror(status));
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream %"
B_PRId32 ": %s\n", stream, strerror(status));
return status;
}
+215 -179
View File
@@ -1,6 +1,6 @@
/*
* 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.
*/
@@ -132,8 +132,8 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode* node)
// NOTE: This node could have been created by an application,
// it does not mean there is an error.
// TODO: this check incorrectly triggers on BeOS R5 BT848 node
TRACE("BMediaRosterEx::SaveNodeConfiguration node %ld not instantiated "
"from BMediaAddOn!\n", node->ID());
TRACE("BMediaRosterEx::SaveNodeConfiguration node %" B_PRId32 " not "
"instantiated from BMediaAddOn!\n", node->ID());
return B_ERROR;
}
@@ -141,7 +141,8 @@ BMediaRosterEx::SaveNodeConfiguration(BMediaNode* node)
// TODO: fix this
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;
}
@@ -153,7 +154,8 @@ BMediaRosterEx::LoadNodeConfiguration(media_addon_id addonID, int32 flavorID,
// TODO: fix this
_msg->MakeEmpty(); // to be fully R5 compliant
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;
}
@@ -199,7 +201,8 @@ BMediaRosterEx::ReleaseNodeAll(const media_node& node)
if (node.kind & NODE_KIND_NO_REFCOUNTING) {
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());
return B_OK;
}
@@ -211,14 +214,16 @@ BMediaRosterEx::ReleaseNodeAll(const media_node& node)
request.node = node;
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());
rv = QueryServer(SERVER_RELEASE_NODE_ALL, &request, sizeof(request), &reply,
sizeof(reply));
if (rv != B_OK) {
ERROR("BMediaRoster::ReleaseNodeAll FAILED, node %ld, port %ld, team "
"%ld!\n", node.node, node.port, BPrivate::current_team());
ERROR("BMediaRoster::ReleaseNodeAll FAILED, node %" B_PRId32 ", port %"
B_PRId32 ", team %" B_PRId32 "!\n", node.node, node.port,
BPrivate::current_team());
}
return rv;
}
@@ -294,11 +299,11 @@ BMediaRosterEx::GetAllOutputs(const media_node& node, List<media_output>* list)
status_t rv;
status_t result;
PRINT(4, "BMediaRosterEx::GetAllOutputs() node %ld, port %ld\n", node.node,
node.port);
PRINT(4, "BMediaRosterEx::GetAllOutputs() node %" B_PRId32 ", port %"
B_PRId32 "\n", node.node, node.port);
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);
return B_MEDIA_BAD_NODE;
}
@@ -320,7 +325,7 @@ BMediaRosterEx::GetAllOutputs(const media_node& node, List<media_output>* list)
result = B_ERROR;
}
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
PRINT_OUTPUT("output ", reply.output);
#endif
}
@@ -340,7 +345,8 @@ BMediaRosterEx::GetAllOutputs(BBufferProducer* node, List<media_output>* list)
int32 cookie;
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;
cookie = 0;
@@ -354,7 +360,7 @@ BMediaRosterEx::GetAllOutputs(BBufferProducer* node, List<media_output>* list)
result = B_ERROR;
}
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
PRINT_OUTPUT("output ", output);
#endif
}
@@ -370,11 +376,11 @@ BMediaRosterEx::GetAllInputs(const media_node& node, List<media_input>* list)
status_t rv;
status_t result;
PRINT(4, "BMediaRosterEx::GetAllInputs() node %ld, port %ld\n", node.node,
node.port);
PRINT(4, "BMediaRosterEx::GetAllInputs() node %" B_PRId32 ", port %"
B_PRId32 "\n", node.node, node.port);
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);
return B_MEDIA_BAD_NODE;
}
@@ -396,7 +402,7 @@ BMediaRosterEx::GetAllInputs(const media_node& node, List<media_input>* list)
result = B_ERROR;
}
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
PRINT_OUTPUT("input ", reply.input);
#endif
}
@@ -416,7 +422,8 @@ BMediaRosterEx::GetAllInputs(BBufferConsumer* node, List<media_input>* list)
int32 cookie;
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;
cookie = 0;
@@ -430,7 +437,7 @@ BMediaRosterEx::GetAllInputs(BBufferConsumer* node, List<media_input>* list)
result = B_ERROR;
}
#if DEBUG >= 3
PRINT(3," next cookie %ld, ", cookie);
PRINT(3," next cookie %" B_PRId32 ", ", cookie);
PRINT_INPUT("input ", input);
#endif
}
@@ -450,7 +457,7 @@ BMediaRosterEx::PublishOutputs(const media_node& node, List<media_output>* list)
status_t rv;
count = list->CountItems();
TRACE("PublishOutputs: publishing %ld\n", count);
TRACE("PublishOutputs: publishing %" B_PRId32 "\n", count);
request.node = node;
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,
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (request.area < B_OK) {
ERROR("PublishOutputs: failed to create area, %#lx\n",
ERROR("PublishOutputs: failed to create area, %#" B_PRIx32 "\n",
request.area);
return (status_t)request.area;
}
@@ -470,7 +477,7 @@ BMediaRosterEx::PublishOutputs(const media_node& node, List<media_output>* list)
request.area = -1;
outputs = request.outputs;
}
TRACE("PublishOutputs: area %ld\n", request.area);
TRACE("PublishOutputs: area %" B_PRId32 "\n", request.area);
int 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;
count = list->CountItems();
TRACE("PublishInputs: publishing %ld\n", count);
TRACE("PublishInputs: publishing %" B_PRId32 "\n", count);
request.node = node;
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,
B_ANY_ADDRESS, size, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
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;
}
inputs = static_cast<media_input *>(start_addr);
@@ -518,7 +526,7 @@ BMediaRosterEx::PublishInputs(const media_node& node, List<media_input>* list)
request.area = -1;
inputs = request.inputs;
}
TRACE("PublishInputs: area %ld\n", request.area);
TRACE("PublishInputs: area %" B_PRId32 "\n", request.area);
int 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) {
printf("BMediaRoster::ReleaseNode, trying to release reference "
"counting disabled timesource, node %ld, port %ld, team %ld\n",
node.node, node.port, BPrivate::current_team());
"counting disabled timesource, node %" B_PRId32 ", port %" B_PRId32
", team %" B_PRId32 "\n", node.node, node.port,
BPrivate::current_team());
return B_OK;
}
@@ -778,14 +787,16 @@ BMediaRoster::ReleaseNode(const media_node& node)
request.node = node;
request.team = BPrivate::current_team();
TRACE("BMediaRoster::ReleaseNode, node %ld, port %ld, team %ld\n",
node.node, node.port, BPrivate::current_team());
TRACE("BMediaRoster::ReleaseNode, node %" B_PRId32 ", port %" B_PRId32
", team %" B_PRId32 "\n", node.node, node.port,
BPrivate::current_team());
rv = QueryServer(SERVER_RELEASE_NODE, &request, sizeof(request), &reply,
sizeof(reply));
if (rv != B_OK) {
ERROR("BMediaRoster::ReleaseNode FAILED, node %ld, port %ld, team "
"%ld!\n", node.node, node.port, BPrivate::current_team());
ERROR("BMediaRoster::ReleaseNode FAILED, node %" B_PRId32 ", port %"
B_PRId32 ", team %" B_PRId32 "!\n", node.node, node.port,
BPrivate::current_team());
}
return rv;
}
@@ -808,13 +819,14 @@ BMediaRoster::MakeTimeSourceFor(const media_node& forNode)
}
if (IS_INVALID_NODE(forNode)) {
ERROR("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %ld, "
"port %ld, kinds 0x%lx\n", forNode.node, forNode.port,
forNode.kind);
ERROR("BMediaRoster::MakeTimeSourceFor: for_node invalid, node %"
B_PRId32 ", port %" B_PRId32 ", kinds 0x%" B_PRIx32 "\n",
forNode.node, forNode.port, forNode.kind);
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_reply reply;
@@ -831,7 +843,8 @@ BMediaRoster::MakeTimeSourceFor(const media_node& forNode)
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;
}
@@ -870,26 +883,26 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
media_node destnode;
rv = GetNodeFor(NodeIDFor(from.port), &sourcenode);
if (rv != B_OK) {
ERROR("BMediaRoster::Connect: Can't find source node for port %ld\n",
from.port);
ERROR("BMediaRoster::Connect: Can't find source node for port %"
B_PRId32 "\n", from.port);
return B_MEDIA_BAD_SOURCE;
}
ReleaseNode(sourcenode);
rv = GetNodeFor(NodeIDFor(to.port), &destnode);
if (rv != B_OK) {
ERROR("BMediaRoster::Connect: Can't find destination node for port "
"%ld\n", to.port);
"%" B_PRId32 "\n", to.port);
return B_MEDIA_BAD_DESTINATION;
}
ReleaseNode(destnode);
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);
return B_MEDIA_BAD_SOURCE;
}
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);
return B_MEDIA_BAD_DESTINATION;
}
@@ -907,7 +920,7 @@ BMediaRoster::Connect(const media_source& from, const media_destination& to,
sizeof(request1), &reply1, sizeof(reply1));
if (rv != B_OK) {
ERROR("BMediaRoster::Connect: aborted after "
"BBufferProducer::FormatProposal, status = %#lx\n",rv);
"BBufferProducer::FormatProposal, status = %#" B_PRIx32 "\n",rv);
return rv;
}
// 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));
if (rv != B_OK) {
ERROR("BMediaRoster::Connect: aborted after "
"BBufferConsumer::AcceptFormat, status = %#lx\n",rv);
"BBufferConsumer::AcceptFormat, status = %#" B_PRIx32 "\n",rv);
return rv;
}
// 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));
if (rv != B_OK) {
ERROR("BMediaRoster::Connect: aborted after "
"BBufferProducer::PrepareToConnect, status = %#lx\n",rv);
"BBufferProducer::PrepareToConnect, status = %#" B_PRIx32 "\n", rv);
return rv;
}
// 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));
if (con_status != B_OK) {
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!
}
// 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) {
ERROR("BMediaRoster::Connect: aborted after BBufferProducer::Connect()"
", status = %#lx\n",rv);
", status = %#" B_PRIx32 "\n", rv);
return rv;
}
// 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;
if (GetNodeFor(source_nodeid, &sourcenode) == B_OK) {
if (!(sourcenode.kind & B_BUFFER_PRODUCER)) {
ERROR("BMediaRoster::Disconnect: source_nodeid %ld is not a "
"B_BUFFER_PRODUCER\n", source_nodeid);
ERROR("BMediaRoster::Disconnect: source_nodeid %" B_PRId32
" is not a B_BUFFER_PRODUCER\n", source_nodeid);
}
if (MediaRosterEx(this)->GetAllOutputs(sourcenode , &outlist) == B_OK)
MediaRosterEx(this)->PublishOutputs(sourcenode , &outlist);
ReleaseNode(sourcenode);
} 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 (!(destnode.kind & B_BUFFER_CONSUMER)) {
ERROR("BMediaRoster::Disconnect: destination_nodeid %ld is not a "
"B_BUFFER_CONSUMER\n", destination_nodeid);
ERROR("BMediaRoster::Disconnect: destination_nodeid %" B_PRId32
" is not a B_BUFFER_CONSUMER\n", destination_nodeid);
}
if (MediaRosterEx(this)->GetAllInputs(destnode , &inlist) == B_OK)
MediaRosterEx(this)->PublishInputs(destnode, &inlist);
ReleaseNode(destnode);
} else {
ERROR("BMediaRoster::Disconnect: GetNodeFor destination_nodeid %ld "
"failed\n", destination_nodeid);
ERROR("BMediaRoster::Disconnect: GetNodeFor destination_nodeid %"
B_PRId32 " failed\n", destination_nodeid);
}
// send a notification
@@ -1124,45 +1139,47 @@ status_t
BMediaRoster::Disconnect(const media_output& output, const media_input& input)
{
if (IS_INVALID_NODEID(output.node.node)) {
printf("BMediaRoster::Disconnect: output.node.node %ld invalid\n",
output.node.node);
printf("BMediaRoster::Disconnect: output.node.node %" B_PRId32
" invalid\n", output.node.node);
return B_MEDIA_BAD_SOURCE;
}
if (IS_INVALID_NODEID(input.node.node)) {
printf("BMediaRoster::Disconnect: input.node.node %ld invalid\n",
input.node.node);
printf("BMediaRoster::Disconnect: input.node.node %" B_PRId32
" invalid\n", input.node.node);
return B_MEDIA_BAD_DESTINATION;
}
if (!(output.node.kind & B_BUFFER_PRODUCER)) {
printf("BMediaRoster::Disconnect: output.node.kind 0x%lx is no "
"B_BUFFER_PRODUCER\n", output.node.kind);
printf("BMediaRoster::Disconnect: output.node.kind 0x%" B_PRIx32
" is no B_BUFFER_PRODUCER\n", output.node.kind);
return B_MEDIA_BAD_SOURCE;
}
if (!(input.node.kind & B_BUFFER_CONSUMER)) {
printf("BMediaRoster::Disconnect: input.node.kind 0x%lx is no "
"B_BUFFER_PRODUCER\n", input.node.kind);
printf("BMediaRoster::Disconnect: input.node.kind 0x%" B_PRIx32
" is no B_BUFFER_PRODUCER\n", input.node.kind);
return B_MEDIA_BAD_DESTINATION;
}
if (input.source.port != output.source.port) {
printf("BMediaRoster::Disconnect: input.source.port %ld doesn't match "
"output.source.port %ld\n", input.source.port, output.source.port);
printf("BMediaRoster::Disconnect: input.source.port %" B_PRId32
" doesn't match output.source.port %" B_PRId32 "\n",
input.source.port, output.source.port);
return B_MEDIA_BAD_SOURCE;
}
if (input.source.id != output.source.id) {
printf("BMediaRoster::Disconnect: input.source.id %ld doesn't match "
"output.source.id %ld\n", input.source.id, output.source.id);
printf("BMediaRoster::Disconnect: input.source.id %" B_PRId32
" doesn't match output.source.id %" B_PRId32 "\n", input.source.id,
output.source.id);
return B_MEDIA_BAD_SOURCE;
}
if (input.destination.port != output.destination.port) {
printf("BMediaRoster::Disconnect: input.destination.port %ld doesn't "
"match output.destination.port %ld\n", input.destination.port,
output.destination.port);
printf("BMediaRoster::Disconnect: input.destination.port %" B_PRId32
" doesn't match output.destination.port %" B_PRId32 "\n",
input.destination.port, output.destination.port);
return B_MEDIA_BAD_DESTINATION;
}
if (input.destination.id != output.destination.id) {
printf("BMediaRoster::Disconnect: input.destination.id %ld doesn't "
"match output.destination.id %ld\n", input.destination.id,
output.destination.id);
printf("BMediaRoster::Disconnect: input.destination.id %" B_PRId32
" doesn't match output.destination.id %" B_PRId32 "\n",
input.destination.id, output.destination.id);
return B_MEDIA_BAD_DESTINATION;
}
@@ -1178,8 +1195,8 @@ BMediaRoster::StartNode(const media_node& node, bigtime_t atPerformanceTime)
if (node.node <= 0)
return B_MEDIA_BAD_NODE;
TRACE("BMediaRoster::StartNode, node %ld, at perf %Ld\n", node.node,
atPerformanceTime);
TRACE("BMediaRoster::StartNode, node %" B_PRId32 ", at perf %" B_PRId64
"\n", node.node, atPerformanceTime);
node_start_command command;
command.performance_time = atPerformanceTime;
@@ -1196,8 +1213,8 @@ BMediaRoster::StopNode(const media_node& node, bigtime_t atPerformanceTime,
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
TRACE("BMediaRoster::StopNode, node %ld, at perf %Ld %s\n", node.node,
atPerformanceTime, immediate ? "NOW" : "");
TRACE("BMediaRoster::StopNode, node %" B_PRId32 ", at perf %" B_PRId64
" %s\n", node.node, atPerformanceTime, immediate ? "NOW" : "");
node_stop_command command;
command.performance_time = atPerformanceTime;
@@ -1215,8 +1232,8 @@ BMediaRoster::SeekNode(const media_node& node, bigtime_t toMediaTime,
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
TRACE("BMediaRoster::SeekNode, node %ld, at perf %Ld, to perf %Ld\n",
node.node, atPerformanceTime, toMediaTime);
TRACE("BMediaRoster::SeekNode, node %" B_PRId32 ", at perf %" B_PRId64
", to perf %" B_PRId64 "\n", node.node, atPerformanceTime, toMediaTime);
node_seek_command command;
command.media_time = toMediaTime;
@@ -1232,26 +1249,27 @@ BMediaRoster::StartTimeSource(const media_node& node, bigtime_t atRealTime)
CALLED();
if (IS_SYSTEM_TIMESOURCE(node)) {
// 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;
}
// if (IS_SHADOW_TIMESOURCE(node)) {
// // 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;
// }
if (IS_INVALID_NODE(node)) {
ERROR("BMediaRoster::StartTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE;
}
if ((node.kind & B_TIME_SOURCE) == 0) {
ERROR("BMediaRoster::StartTimeSource node %ld is no timesource\n",
ERROR("BMediaRoster::StartTimeSource node %" B_PRId32 " invalid\n",
node.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,
atRealTime);
TRACE("BMediaRoster::StartTimeSource, node %" B_PRId32 ", at real %"
B_PRId64 "\n", node.node, atRealTime);
BTimeSource::time_source_op_info msg;
msg.op = BTimeSource::B_TIMESOURCE_START;
@@ -1277,17 +1295,18 @@ BMediaRoster::StopTimeSource(const media_node& node, bigtime_t atRealTime,
// return B_OK;
// }
if (IS_INVALID_NODE(node)) {
ERROR("BMediaRoster::StopTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE;
}
if ((node.kind & B_TIME_SOURCE) == 0) {
ERROR("BMediaRoster::StopTimeSource node %ld is no timesource\n",
ERROR("BMediaRoster::StopTimeSource node %" B_PRId32 " invalid\n",
node.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",
node.node, atRealTime, immediate ? "NOW" : "");
TRACE("BMediaRoster::StopTimeSource, node %" B_PRId32 ", at real %" B_PRId64
" %s\n", node.node, atRealTime, immediate ? "NOW" : "");
BTimeSource::time_source_op_info msg;
msg.op = immediate ? BTimeSource::B_TIMESOURCE_STOP_IMMEDIATELY
@@ -1316,17 +1335,18 @@ BMediaRoster::SeekTimeSource(const media_node& node,
// return B_OK;
// }
if (IS_INVALID_NODE(node)) {
ERROR("BMediaRoster::SeekTimeSource node %ld invalid\n", node.node);
return B_MEDIA_BAD_NODE;
}
if ((node.kind & B_TIME_SOURCE) == 0) {
ERROR("BMediaRoster::SeekTimeSource node %ld is no timesource\n",
ERROR("BMediaRoster::SeekTimeSource node %" B_PRId32 " invalid\n",
node.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",
node.node, atRealTime, toPerformanceTime);
TRACE("BMediaRoster::SeekTimeSource, node %" B_PRId32 ", at real %" B_PRId64
", to perf %" B_PRId64 "\n", node.node, atRealTime, toPerformanceTime);
BTimeSource::time_source_op_info msg;
msg.op = BTimeSource::B_TIMESOURCE_SEEK;
@@ -1349,7 +1369,8 @@ BMediaRoster::SyncToNode(const media_node& node, bigtime_t atTime,
status_t
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))
return B_MEDIA_BAD_NODE;
@@ -1385,8 +1406,8 @@ status_t
BMediaRoster::SetProducerRunModeDelay(const media_node& node,
bigtime_t delay, BMediaNode::run_mode mode)
{
TRACE("BMediaRoster::SetProducerRunModeDelay, node %ld, delay %Ld, "
"mode %d\n", node.node, delay, mode);
TRACE("BMediaRoster::SetProducerRunModeDelay, node %" B_PRId32 ", delay %"
B_PRId64 ", mode %d\n", node.node, delay, mode);
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
if ((node.kind & B_BUFFER_PRODUCER) == 0)
@@ -1522,13 +1543,13 @@ BMediaRoster::GetFreeInputsFor(const media_node& node,
{
CALLED();
if (IS_INVALID_NODE(node)) {
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld invalid\n",
node.node, node.port);
ERROR("BMediaRoster::GetFreeInputsFor: node %" B_PRId32 ", port %"
B_PRId32 " invalid\n", node.node, node.port);
return B_MEDIA_BAD_NODE;
}
if ((node.kind & B_BUFFER_CONSUMER) == 0) {
ERROR("BMediaRoster::GetFreeInputsFor: node %ld, port %ld is not a "
"consumer\n", node.node, node.port);
ERROR("BMediaRoster::GetFreeInputsFor: node %" B_PRId32 ", port %"
B_PRId32 " is not a consumer\n", node.node, node.port);
return B_MEDIA_BAD_NODE;
}
if (out_free_inputs == NULL || out_total_count == NULL)
@@ -1544,8 +1565,9 @@ BMediaRoster::GetFreeInputsFor(const media_node& node,
if (B_OK != rv)
return rv;
PRINT(4, "BMediaRoster::GetFreeInputsFor node %ld, max %ld, filter-type "
"%ld\n", node.node, buf_num_inputs, filter_type);
PRINT(4, "BMediaRoster::GetFreeInputsFor node %" B_PRId32 ", max %" B_PRId32
", filter-type %" B_PRId32 "\n", node.node, buf_num_inputs,
filter_type);
int32 i;
for (i = 0, list.Rewind(); list.GetNext(&input);) {
@@ -1596,8 +1618,8 @@ BMediaRoster::GetConnectedInputsFor(const media_node& node,
if (B_OK != rv)
return rv;
PRINT(4, "BMediaRoster::GetConnectedInputsFor node %ld, max %ld\n",
node.node, buf_num_inputs);
PRINT(4, "BMediaRoster::GetConnectedInputsFor node %" B_PRId32 ", max %"
B_PRId32 "\n", node.node, buf_num_inputs);
int32 i;
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)
return rv;
PRINT(4, "BMediaRoster::GetAllInputsFor node %ld, max %ld\n", node.node,
buf_num_inputs);
PRINT(4, "BMediaRoster::GetAllInputsFor node %" B_PRId32 ", max %" B_PRId32
"\n", node.node, buf_num_inputs);
int32 i;
for (i = 0, list.Rewind(); list.GetNext(&input); i++) {
@@ -1680,8 +1702,9 @@ BMediaRoster::GetFreeOutputsFor(const media_node& node,
if (B_OK != rv)
return rv;
PRINT(4, "BMediaRoster::GetFreeOutputsFor node %ld, max %ld, filter-type "
"%ld\n", node.node, buf_num_outputs, filter_type);
PRINT(4, "BMediaRoster::GetFreeOutputsFor node %" B_PRId32 ", max %"
B_PRId32 ", filter-type %" B_PRId32 "\n", node.node, buf_num_outputs,
filter_type);
int32 i;
for (i = 0, list.Rewind(); list.GetNext(&output);) {
@@ -1732,8 +1755,8 @@ BMediaRoster::GetConnectedOutputsFor(const media_node& node,
if (B_OK != rv)
return rv;
PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %ld, max %ld\n",
node.node, buf_num_outputs);
PRINT(4, "BMediaRoster::GetConnectedOutputsFor node %" B_PRId32 ", max %"
B_PRId32 "\n", node.node, buf_num_outputs);
int32 i;
for (i = 0, list.Rewind(); list.GetNext(&output);) {
@@ -1777,8 +1800,8 @@ BMediaRoster::GetAllOutputsFor(const media_node& node,
if (B_OK != rv)
return rv;
PRINT(4, "BMediaRoster::GetAllOutputsFor node %ld, max %ld\n", node.node,
buf_num_outputs);
PRINT(4, "BMediaRoster::GetAllOutputsFor node %" B_PRId32 ", max %" B_PRId32
"\n", node.node, buf_num_outputs);
int32 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();
TRACE("BMediaRoster::RegisterNode: sending SERVER_REGISTER_NODE: port "
"%ld, kinds 0x%Lx, team %ld, name '%s'\n", request.port, request.kinds,
request.team, request.name);
"%" B_PRId32 ", kinds 0x%" B_PRIx64 ", team %" B_PRId32 ", name '%s'\n",
request.port, request.kinds, request.team, request.name);
status_t status = QueryServer(SERVER_REGISTER_NODE, &request,
sizeof(request), &reply, sizeof(reply));
@@ -2059,8 +2082,9 @@ BMediaRoster::UnregisterNode(BMediaNode* node)
status_t status = QueryServer(SERVER_UNREGISTER_NODE, &request,
sizeof(request), &reply, sizeof(reply));
if (status != B_OK) {
ERROR("BMediaRoster::UnregisterNode: failed to unregister node id %ld, "
"name '%s': %s\n", node->ID(), node->Name(), strerror(status));
ERROR("BMediaRoster::UnregisterNode: failed to unregister node id %"
B_PRId32 ", name '%s': %s\n", node->ID(), node->Name(),
strerror(status));
return status;
}
@@ -2135,16 +2159,16 @@ BMediaRoster::SetTimeSourceFor(media_node_id node, media_node_id time_source)
media_node clone;
status_t rv, result;
TRACE("BMediaRoster::SetTimeSourceFor: node %ld will be assigned time "
"source %ld\n", node, time_source);
TRACE("BMediaRoster::SetTimeSourceFor: node %ld time source %ld enter\n",
node, time_source);
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " will be assigned "
"time source %" B_PRId32 "\n", node, time_source);
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " time source %"
B_PRId32 " enter\n", node, time_source);
// we need to get a clone of the node to have a port id
rv = GetNodeFor(node, &clone);
if (rv != B_OK) {
ERROR("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id "
"%ld\n", node);
ERROR("BMediaRoster::SetTimeSourceFor, GetNodeFor failed, node id %"
B_PRId32 "\n", node);
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));
if (rv != B_OK) {
ERROR("BMediaRoster::SetTimeSourceFor, sending NODE_SET_TIMESOURCE "
"failed, node id %ld\n", node);
"failed, node id %" B_PRId32 "\n", node);
result = B_ERROR;
}
// we release the clone
rv = ReleaseNode(clone);
if (rv != B_OK) {
ERROR("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id "
"%ld\n", node);
ERROR("BMediaRoster::SetTimeSourceFor, ReleaseNode failed, node id %"
B_PRId32 "\n", node);
result = B_ERROR;
}
TRACE("BMediaRoster::SetTimeSourceFor: node %ld time source %ld leave\n",
node, time_source);
TRACE("BMediaRoster::SetTimeSourceFor: node %" B_PRId32 " time source %"
B_PRId32 " leave\n", node, time_source);
return result;
}
@@ -2202,7 +2226,7 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (area < B_OK) {
ERROR("BMediaRoster::GetParameterWebFor couldn't create area of "
"size %ld\n", size);
"size %" B_PRId32 "\n", size);
return B_ERROR;
}
request.max_size = size;
@@ -2218,8 +2242,8 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
if (reply.size == 0) {
// no parameter web available
// TODO: should we return an error?
ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter "
"web\n", node.node);
ERROR("BMediaRoster::GetParameterWebFor node %" B_PRId32
" has no parameter web\n", node.node);
*_web = new (std::nothrow) BParameterWeb();
delete_area(area);
return *_web != NULL ? B_OK : B_NO_MEMORY;
@@ -2230,10 +2254,11 @@ BMediaRoster::GetParameterWebFor(const media_node& node, BParameterWeb** _web)
if (*_web == NULL)
rv = B_NO_MEMORY;
else {
printf("BMediaRoster::GetParameterWebFor Unflattening %ld "
"bytes, 0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx\n",
reply.size, ((uint32*)data)[0], ((uint32*)data)[1],
((uint32*)data)[2], ((uint32*)data)[3]);
printf("BMediaRoster::GetParameterWebFor Unflattening %"
B_PRId32 " bytes, %#" B_PRIx32 ", %#" B_PRIx32 ", %#"
B_PRIx32 ", %#" B_PRIx32 "\n", reply.size,
((uint32*)data)[0], ((uint32*)data)[1], ((uint32*)data)[2],
((uint32*)data)[3]);
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
// loop and try a larger size
}
ERROR("BMediaRoster::GetParameterWebFor node %ld has no parameter web "
"larger than %ld\n", node.node, size);
ERROR("BMediaRoster::GetParameterWebFor node %" B_PRId32 " has no "
"parameter web larger than %" B_PRId32 "\n", node.node, size);
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
// requested the instantiation.
TRACE("BMediaRosterEx::InstantiateDormantNode: addonID %ld, flavorID "
"%ld\n", addonID, flavorID);
TRACE("BMediaRosterEx::InstantiateDormantNode: addonID %" B_PRId32
", flavorID %" B_PRId32 "\n", addonID, flavorID);
// Get flavor_info from the server
dormant_flavor_info info;
@@ -2368,8 +2393,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
rv = GetDormantFlavorInfo(addonID, flavorID, &info);
if (rv != B_OK) {
ERROR("BMediaRosterEx::InstantiateDormantNode error: failed to get "
"dormant_flavor_info for addon-id %ld, flavor-id %ld\n", addonID,
flavorID);
"dormant_flavor_info for addon-id %" B_PRId32 ", flavor-id %"
B_PRId32 "\n", addonID, flavorID);
return B_ERROR;
}
@@ -2388,7 +2413,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
rv = IncrementAddonFlavorInstancesCount(addonID, flavorID);
if (rv != B_OK) {
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
gDormantNodeManager->PutAddOn(addonID);
return B_ERROR;
@@ -2398,8 +2424,8 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
rv = LoadNodeConfiguration(addonID, flavorID, &config);
if (rv != B_OK) {
ERROR("BMediaRosterEx::InstantiateDormantNode: couldn't load "
"configuration for addon-id %ld, flavor-id %ld\n", addonID,
flavorID);
"configuration for addon-id %" B_PRId32 ", flavor-id %" B_PRId32
"\n", addonID, flavorID);
// 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) {
// send a message to the server to assign team "creator" as creator
// of node "node->ID()"
printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team "
"%ld as creator of node %ld\n", creator, node->ID());
printf("!!! BMediaRosterEx::InstantiateDormantNode assigning team %"
B_PRId32 " as creator of node %" B_PRId32 "\n", creator,
node->ID());
rv = MediaRosterEx(this)->SetNodeCreator(node->ID(), creator);
if (rv != B_OK) {
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
}
}
@@ -2458,9 +2486,10 @@ BMediaRosterEx::InstantiateDormantNode(media_addon_id addonID, int32 flavorID,
*_node = node->Node();
TRACE("BMediaRosterEx::InstantiateDormantNode: addon-id %ld, flavor_id "
"%ld instanciated as node %ld, port %ld in team %ld\n", addonID,
flavorID, _node->node, _node->port, BPrivate::current_team());
TRACE("BMediaRosterEx::InstantiateDormantNode: addon-id %" B_PRId32
", flavor_id %" B_PRId32 " instanciated as node %" B_PRId32 ", port %"
B_PRId32 " in team %" B_PRId32 "\n", addonID, flavorID, _node->node,
_node->port, BPrivate::current_team());
return B_OK;
}
@@ -2474,13 +2503,14 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
if (_node == NULL)
return B_BAD_VALUE;
if (info.addon <= B_OK) {
ERROR("BMediaRoster::InstantiateDormantNode error: addon-id %ld "
"invalid.\n", info.addon);
ERROR("BMediaRoster::InstantiateDormantNode error: addon-id %" B_PRId32
" invalid.\n", info.addon);
return B_BAD_VALUE;
}
printf("BMediaRoster::InstantiateDormantNode: addon-id %ld, flavor_id "
"%ld, flags 0x%lX\n", info.addon, info.flavor_id, flags);
printf("BMediaRoster::InstantiateDormantNode: addon-id %" B_PRId32
", flavor_id %" B_PRId32 ", flags 0x%" B_PRIx32 "\n", info.addon,
info.flavor_id, flags);
// Get flavor_info from the server
// TODO: this is a little overhead, as we get the full blown
@@ -2492,8 +2522,8 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
&flavorInfo);
if (rv != B_OK) {
ERROR("BMediaRoster::InstantiateDormantNode: failed to get "
"dormant_flavor_info for addon-id %ld, flavor-id %ld\n",
info.addon, info.flavor_id);
"dormant_flavor_info for addon-id %" B_PRId32 ", flavor-id %"
B_PRId32 "\n", info.addon, info.flavor_id);
return B_NAME_NOT_FOUND;
}
@@ -2501,9 +2531,10 @@ BMediaRoster::InstantiateDormantNode(const dormant_node_info& info,
#if DEBUG
printf("BMediaRoster::InstantiateDormantNode: name \"%s\", info \"%s\", "
"flavor_flags 0x%lX, internal_id %ld, possible_count %ld\n",
flavorInfo.name, flavorInfo.info, flavorInfo.flavor_flags,
flavorInfo.internal_id, flavorInfo.possible_count);
"flavor_flags 0x%" B_PRIx32 ", internal_id %" B_PRId32
", possible_count %" B_PRId32 "\n", flavorInfo.name, flavorInfo.info,
flavorInfo.flavor_flags, flavorInfo.internal_id,
flavorInfo.possible_count);
if ((flags & B_FLAVOR_IS_LOCAL) != 0) {
printf("BMediaRoster::InstantiateDormantNode: caller requested "
@@ -2702,8 +2733,8 @@ BMediaRoster::GetInitialLatencyFor(const media_node& producer,
if (_flags != NULL)
*_flags = reply.flags;
TRACE("BMediaRoster::GetInitialLatencyFor producer %ld has maximum "
"initial latency %Ld\n", producer.node, *_latency);
TRACE("BMediaRoster::GetInitialLatencyFor producer %" B_PRId32 " has "
"maximum initial latency %" B_PRId64 "\n", producer.node, *_latency);
return B_OK;
}
@@ -2730,8 +2761,8 @@ BMediaRoster::GetStartLatencyFor(const media_node& timeSource,
*_latency = reply.start_latency;
TRACE("BMediaRoster::GetStartLatencyFor timesource %ld has maximum "
"initial latency %Ld\n", timeSource.node, *_latency);
TRACE("BMediaRoster::GetStartLatencyFor timesource %" B_PRId32 " has "
"maximum initial latency %" B_PRId64 "\n", timeSource.node, *_latency);
return B_OK;
}
@@ -2838,7 +2869,8 @@ BMediaRoster::SniffRef(const entry_ref& file, uint64 requireNodeKinds,
{
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)
return B_BAD_VALUE;
@@ -2873,8 +2905,10 @@ BMediaRoster::SniffRef(const entry_ref& file, uint64 requireNodeKinds,
if (highestCapability != -1) {
*_node = nodes[highestCapability];
TRACE("BMediaRoster::SniffRef: found a node %s addon-id %ld, flavor_id %ld\n",
nodes[highestCapability].name, nodes[highestCapability].addon, nodes[highestCapability].flavor_id);
TRACE("BMediaRoster::SniffRef: found a node %s addon-id %" B_PRId32
", flavor_id %" B_PRId32 "\n",
nodes[highestCapability].name, nodes[highestCapability].addon,
nodes[highestCapability].flavor_id);
if (mimeType != NULL) {
//*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,
sizeof(reply));
if (rv != B_OK) {
ERROR("BMediaRoster::NodeIDFor: failed (error %#lx)\n", rv);
ERROR("BMediaRoster::NodeIDFor: failed (error %#" B_PRIx32 ")\n", rv);
return -1;
}
@@ -3101,8 +3135,8 @@ BMediaRoster::AudioBufferSizeFor(int32 channelCount, uint32 sampleFormat,
bufferSize = (sampleFormat & 0xf) * channelCount
* (ssize_t)((frameRate * bufferDuration) / 1000000.0);
printf("Suggested buffer duration %Ld, size %ld\n", bufferDuration,
bufferSize);
printf("Suggested buffer duration %" B_PRId64 ", size %" B_PRIdSSIZE "\n",
bufferDuration, bufferSize);
return bufferSize;
}
@@ -3148,10 +3182,12 @@ BMediaRoster::MessageReceived(BMessage* message)
BMediaNode *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);
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!
return;
}
+2 -2
View File
@@ -340,8 +340,8 @@ BMediaTrack::ReadFrames(void* buffer, int64* _frameCount,
//fflush(stdout);
//}
} else {
ERROR("BMediaTrack::ReadFrames: decoder returned error 0x%08lx (%s)\n",
result, strerror(result));
ERROR("BMediaTrack::ReadFrames: decoder returned error %#" B_PRIx32
" (%s)\n", result, strerror(result));
*_frameCount = 0;
}
+2 -2
View File
@@ -125,7 +125,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
if (!fStreamInfos.Insert(info)) {
gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create StreamInfo "
"for stream %ld\n", streamIndex);
"for stream %" B_PRId32 "\n", streamIndex);
return B_NO_MEMORY;
}
@@ -134,7 +134,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
if (chunkWriter == NULL) {
gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create ChunkWriter "
"for stream %ld\n", streamIndex);
"for stream %" B_PRId32 "\n", streamIndex);
return B_NO_MEMORY;
}
+40 -12
View File
@@ -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.
*
* Author: Zousar Shaker
@@ -7,11 +7,13 @@
* Marcus Overhagen
*/
/*! Implements the following classes:
BParameterWeb, BParameterGroup, BParameter, BNullParameter,
BContinuousParameter, BDiscreteParameter
*/
#include <ParameterWeb.h>
#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
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
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
int32 version = read_from_buffer_swap32<int32>(&buffer, isSwapped);
if (version != kCurrentParameterWebVersion) {
ERROR("BParameterWeb::Unflatten(): wrong version %ld (%lx)?!\n",
version, version);
ERROR("BParameterWeb::Unflatten(): wrong version %" B_PRId32 " (%"
B_PRIx32 ")?!\n", version, version);
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)
return B_BAD_VALUE;
BParameter* oldPointer = read_from_buffer_swap32<BParameter*>(&buffer,
isSwapped);
BParameter* oldPointer = read_pointer_from_buffer_swap<BParameter*>(
&buffer, isSwapped);
BParameter::media_parameter_type mediaType
= read_from_buffer_swap32<BParameter::media_parameter_type>(&buffer,
isSwapped);
@@ -1101,8 +1128,8 @@ BParameterGroup::Unflatten(type_code code, const void* buffer, ssize_t size)
if (size_left(size, bufferStart, buffer) < 12)
return B_BAD_VALUE;
BParameterGroup* oldPointer
= read_from_buffer_swap32<BParameterGroup*>(&buffer, isSwapped);
BParameterGroup* oldPointer = read_pointer_from_buffer_swap<
BParameterGroup*>(&buffer, isSwapped);
type_code type = read_from_buffer_swap32<type_code>(&buffer, isSwapped);
ssize_t groupSize
@@ -1161,7 +1188,8 @@ BParameterGroup::MakeControl(int32 type)
return new BTextParameter(-1, B_MEDIA_NO_TYPE, NULL, NULL, NULL, 0);
default:
ERROR("BParameterGroup::MakeControl unknown type %ld\n", type);
ERROR("BParameterGroup::MakeControl unknown type %" B_PRId32 "\n",
type);
return NULL;
}
}
@@ -1656,8 +1684,8 @@ BParameter::Unflatten(type_code code, const void* buffer, ssize_t size)
fInputs->MakeEmpty();
for (int32 i = 0; i < count; i++) {
fInputs->AddItem(read_from_buffer_swap32<BParameter * const>(&buffer,
fSwapDetected));
fInputs->AddItem(read_pointer_from_buffer_swap<BParameter * const>(
&buffer, fSwapDetected));
}
// read the list of outputs
@@ -1666,8 +1694,8 @@ BParameter::Unflatten(type_code code, const void* buffer, ssize_t size)
fOutputs->MakeEmpty();
for (int32 i = 0; i < count; i++) {
fOutputs->AddItem(read_from_buffer_swap32<BParameter * const>(&buffer,
fSwapDetected));
fOutputs->AddItem(read_pointer_from_buffer_swap<BParameter * const>(
&buffer, fSwapDetected));
}
fMediaType = read_from_buffer_swap32<media_type>(&buffer, fSwapDetected);
+7 -7
View File
@@ -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.
* Distributed under the terms of the MIT License.
*/
@@ -80,7 +80,7 @@ SharedBufferList::Get()
sArea = clone_area("shared buffer list clone", (void**)&sList,
B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, areaReply.area);
if (sArea < 0) {
ERROR("SharedBufferList::Get() clone area %ld: %s\n",
ERROR("SharedBufferList::Get() clone area %" B_PRId32 ": %s\n",
areaReply.area, strerror(sArea));
return NULL;
}
@@ -303,8 +303,8 @@ SharedBufferList::RecycleBuffer(BBuffer* buffer)
if (fInfos[i].id == id) {
reclaimedCount++;
if (fInfos[i].reclaimed) {
ERROR("SharedBufferList::RecycleBuffer, BBuffer %p, id = %ld "
"already reclaimed\n", buffer, id);
ERROR("SharedBufferList::RecycleBuffer, BBuffer %p, id = %"
B_PRId32 " already reclaimed\n", buffer, id);
DEBUG_ONLY(debugger("buffer already reclaimed"));
continue;
}
@@ -317,8 +317,8 @@ SharedBufferList::RecycleBuffer(BBuffer* buffer)
return B_ERROR;
if (reclaimedCount == 0) {
ERROR("shared_buffer_list::RecycleBuffer, BBuffer %p, id = %ld NOT "
"reclaimed\n", buffer, id);
ERROR("shared_buffer_list::RecycleBuffer, BBuffer %p, id = %" B_PRId32
" NOT reclaimed\n", buffer, id);
return B_ERROR;
}
@@ -397,7 +397,7 @@ SharedBufferList::_RequestBufferInOtherGroups(sem_id groupReclaimSem,
if (fInfos[i].reclaimed == false) {
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);
continue;
}
+6 -5
View File
@@ -156,7 +156,8 @@ SoundConsumer::SetHooks(SoundProcessFunc recordFunc, SoundNotifyFunc notifyFunc,
// Wait for acknowledge from the service thread.
err = read_port_etc(cmd.reply, &code, 0, 0, B_TIMEOUT, 6000000LL);
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.
delete_port(cmd.reply);
@@ -591,8 +592,8 @@ SoundConsumer::ServiceThread()
int32 code = 0;
status_t err = read_port_etc(m_port, &code, msg, B_MEDIA_MESSAGE_SIZE,
B_TIMEOUT, timeout);
MESSAGE(stderr, "SoundConsumer::ServiceThread() port %ld message "
"%#010lx\n", m_port, code);
MESSAGE(stderr, "SoundConsumer::ServiceThread() port %" B_PRId32
" message %#" B_PRIx32 "\n", m_port, code);
// If we received a message, err will be the size of the message
// (including 0).
if (err >= B_OK) {
@@ -625,7 +626,7 @@ SoundConsumer::ServiceThread()
Notify(B_OP_TIMED_OUT, timeout);
} else {
// Other errors are bad.
MESSAGE(stderr, "SoundConsumer: error %#010lx\n", err);
MESSAGE(stderr, "SoundConsumer: error %#" B_PRIx32 "\n", err);
bad++;
// If we receive three bad reads with no good messages inbetween,
// 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
// 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;
}
+21 -16
View File
@@ -464,8 +464,10 @@ SoundPlayNode::Disconnect(const media_source& what,
delete fBufferGroup;
fBufferGroup = NULL;
} else {
fprintf(stderr, "\tDisconnect() called with wrong source/destination (%ld/%ld), ours is (%ld/%ld)\n",
what.id, where.id, fOutput.source.id, fOutput.destination.id);
fprintf(stderr, "\tDisconnect() called with wrong source/destination "
"(%" 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();
TRACE("SoundPlayNode::LateNoticeReceived, %Ld too late at %Ld\n", howMuch,
performanceTime);
TRACE("SoundPlayNode::LateNoticeReceived, %" B_PRId64 " too late at %"
B_PRId64 "\n", howMuch, performanceTime);
// is this our output?
if (what != fOutput.source) {
@@ -498,7 +500,8 @@ SoundPlayNode::LateNoticeReceived(const media_source& what, bigtime_t howMuch,
fInternalLatency = 30000;
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 {
// 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
@@ -554,7 +557,8 @@ SoundPlayNode::LatencyChanged(const media_source& source,
{
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
// 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);
break;
default:
fprintf(stderr," unknown event type: %li\n", event->type);
fprintf(stderr," unknown event type: %" B_PRId32 "\n", event->type);
break;
}
}
@@ -635,7 +639,7 @@ SoundPlayNode::SendNewBuffer(const media_timed_event* event,
if (lateness > (BufferDuration() / 3) ) {
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
@@ -698,8 +702,8 @@ status_t
SoundPlayNode::HandleDataStatus(const media_timed_event* event,
bigtime_t lateness, bool realTimeEvent)
{
TRACE("SoundPlayNode::HandleDataStatus status: %li, lateness: %Li\n",
event->data, lateness);
TRACE("SoundPlayNode::HandleDataStatus status: %" B_PRId32 ", lateness: %"
B_PRId64 "\n", event->data, lateness);
switch (event->data) {
case B_DATA_NOT_AVAILABLE:
@@ -746,8 +750,8 @@ SoundPlayNode::HandleSeek(const media_timed_event* event, bigtime_t lateness,
bool realTimeEvent)
{
CALLED();
TRACE("SoundPlayNode::HandleSeek(t=%lld, d=%li, bd=%lld)\n",
event->event_time, event->data, event->bigdata);
TRACE("SoundPlayNode::HandleSeek(t=%" B_PRId64 ", d=%" B_PRId32 ", bd=%"
B_PRId64 ")\n", event->event_time, event->data, event->bigdata);
return B_OK;
}
@@ -792,14 +796,15 @@ SoundPlayNode::AllocateBuffers()
size_t size = fOutput.format.u.raw_audio.buffer_size;
int32 count = int32(fLatency / BufferDuration() + 1 + 1);
TRACE("SoundPlayNode::AllocateBuffers: latency = %Ld, buffer duration "
"= %Ld, count %ld\n", fLatency, BufferDuration(), count);
TRACE("SoundPlayNode::AllocateBuffers: latency = %" B_PRId64 ", buffer "
"duration = %" B_PRId64 ", count %" B_PRId32 "\n", fLatency,
BufferDuration(), count);
if (count < 3)
count = 3;
TRACE("SoundPlayNode::AllocateBuffers: creating group of %ld buffers, "
"size = %lu\n", count, size);
TRACE("SoundPlayNode::AllocateBuffers: creating group of %" B_PRId32
" buffers, size = %" B_PRIuSIZE "\n", count, size);
fBufferGroup = new BBufferGroup(size, count);
if (fBufferGroup->InitCheck() != B_OK) {
+50 -35
View File
@@ -1,8 +1,11 @@
/***********************************************************************
* AUTHOR: Marcus Overhagen
* FILE: TimeSource.cpp
* DESCR:
***********************************************************************/
/*
* Copyright 2002-2012, Haiku. All Rights Reserved.
* This file may be used under the terms of the MIT License.
*
* Author: Marcus Overhagen
*/
#include <TimeSource.h>
#include <Autolock.h>
#include <string.h>
@@ -42,7 +45,7 @@ struct TimeSourceTransmit // sizeof(TimeSourceTransmit) must be <= TS_AREA_SIZE
class SlaveNodes
{
public:
public:
SlaveNodes();
~SlaveNodes();
public:
@@ -115,13 +118,13 @@ bigtime_t
BTimeSource::PerformanceTimeFor(bigtime_t real_time)
{
PRINT(8, "CALLED BTimeSource::PerformanceTimeFor()\n");
bigtime_t last_perf_time;
bigtime_t last_real_time;
float last_drift;
bigtime_t last_perf_time;
bigtime_t last_real_time;
float last_drift;
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
debugger("BTimeSource::PerformanceTimeFor: GetTime failed");
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;
}
bigtime_t last_perf_time;
bigtime_t last_real_time;
float last_drift;
bigtime_t last_perf_time;
bigtime_t last_real_time;
float last_drift;
if (GetTime(&last_perf_time, &last_real_time, &last_drift) != B_OK)
debugger("BTimeSource::RealTimeFor: GetTime failed");
@@ -153,13 +156,14 @@ BTimeSource::IsRunning()
PRINT(8, "CALLED BTimeSource::IsRunning()\n");
bool isrunning;
if (fIsRealtime)
isrunning = true; // The system time source is always running :)
else
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;
}
@@ -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);
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;
}
@@ -223,7 +229,7 @@ BTimeSource::GetStartLatency(bigtime_t *out_latency)
*************************************************************/
BTimeSource::BTimeSource() :
BTimeSource::BTimeSource() :
BMediaNode("This one is never called"),
fStarted(false),
fArea(-1),
@@ -246,7 +252,8 @@ BTimeSource::HandleMessage(int32 message,
const void *rawdata,
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;
switch (message) {
case TIMESOURCE_OP:
@@ -275,7 +282,7 @@ BTimeSource::HandleMessage(int32 message,
}
return B_OK;
}
case TIMESOURCE_ADD_SLAVE_NODE:
{
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);
return B_OK;
}
case TIMESOURCE_GET_START_LATENCY:
{
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,
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) {
ERROR("BTimeSource::PublishTime timesource %ld, fBuf = NULL\n", ID());
ERROR("BTimeSource::PublishTime timesource %" B_PRId32
", fBuf = NULL\n", ID());
fStarted = true;
return;
}
@@ -335,9 +345,11 @@ BTimeSource::BroadcastTimeWarp(bigtime_t at_real_time,
ASSERT(fSlaveNodes != NULL);
// 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);
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
char name[32];
area_id area;
sprintf(name, "__timesource_buf_%ld", id);
sprintf(name, "__timesource_buf_%" B_PRId32, id);
area = find_area(name);
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;
}
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);
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;
}
}
@@ -435,12 +449,13 @@ BTimeSource::FinishCreate()
{
CALLED();
//printf("BTimeSource::FinishCreate(), id %ld\n", ID());
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);
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;
return;
}
@@ -511,7 +526,7 @@ BTimeSource::DirectAddMe(const media_node &node)
time_source_op_info msg;
msg.op = B_TIMESOURCE_START;
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));
}
return;
@@ -544,7 +559,7 @@ BTimeSource::DirectRemoveMe(const media_node &node)
time_source_op_info msg;
msg.op = B_TIMESOURCE_STOP_IMMEDIATELY;
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));
}
return;
+6 -3
View File
@@ -48,14 +48,17 @@ TimeSourceObject::TimeSourceObject(const media_node& node)
if (BMediaRoster::Roster()->GetLiveNodeInfo(node, &liveNodeInfo)
== B_OK)
strlcpy(fName, liveNodeInfo.name, B_MEDIA_NAME_LENGTH);
else
snprintf(fName, B_MEDIA_NAME_LENGTH, "timesource %ld", node.node);
else {
snprintf(fName, B_MEDIA_NAME_LENGTH, "timesource %" B_PRId32,
node.node);
}
}
AddNodeKind(NODE_KIND_SHADOW_TIMESOURCE);
AddNodeKind(NODE_KIND_NO_REFCOUNTING);
TRACE("TimeSourceObject::TimeSourceObject leave, node id %ld\n", fNodeID);
TRACE("TimeSourceObject::TimeSourceObject leave, node id %" B_PRId32 "\n",
fNodeID);
}
+45 -44
View File
@@ -66,18 +66,18 @@ _event_queue_imp::~_event_queue_imp()
delete fLock;
}
status_t
_event_queue_imp::AddEvent(const media_timed_event &event)
{
BAutolock lock(fLock);
// printf(" adding %12Ld at %12Ld\n", event.event_time, system_time());
if (event.type <= 0) {
return B_BAD_VALUE;
}
*(bigtime_t *)&event.queued_time = BTimeSource::RealTime();
//create a new queue
@@ -91,7 +91,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
fEventCount++;
return B_OK;
}
//insert at queue begin
if (fFirstEntry->event.event_time >= event.event_time) {
event_queue_entry *newentry = new event_queue_entry;
@@ -115,7 +115,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
fEventCount++;
return B_OK;
}
//insert into the queue
for (event_queue_entry *entry = fLastEntry; entry; entry = entry->prev) {
if (entry->event.event_time <= event.event_time) {
@@ -130,7 +130,7 @@ _event_queue_imp::AddEvent(const media_timed_event &event)
return B_OK;
}
}
debugger("_event_queue_imp::AddEvent failed, should not be here\n");
return B_OK;
}
@@ -157,10 +157,10 @@ status_t
_event_queue_imp::RemoveFirstEvent(media_timed_event * outEvent)
{
BAutolock lock(fLock);
if (fFirstEntry == 0)
return B_ERROR;
if (outEvent != 0) {
// No cleanup here
*outEvent = fFirstEntry->event;
@@ -173,7 +173,7 @@ _event_queue_imp::RemoveFirstEvent(media_timed_event * outEvent)
return B_OK;
}
bool
_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
{
return fFirstEntry ? &fFirstEntry->event : NULL;
{
return fFirstEntry ? &fFirstEntry->event : NULL;
}
bigtime_t
_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
{
return fLastEntry ? &fLastEntry->event : NULL;
{
return fLastEntry ? &fLastEntry->event : NULL;
}
bigtime_t
bigtime_t
_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) {
action = (*hook)(&entry->event, context);
switch (action) {
case BTimedEventQueue::B_DONE:
case BTimedEventQueue::B_DONE:
return B_OK;
case BTimedEventQueue::B_REMOVE_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) {
action = (*hook)(&entry->event, context);
switch (action) {
case BTimedEventQueue::B_DONE:
case BTimedEventQueue::B_DONE:
return B_OK;
case BTimedEventQueue::B_REMOVE_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) {
action = (*hook)(&entry->event, context);
switch (action) {
case BTimedEventQueue::B_DONE:
case BTimedEventQueue::B_DONE:
return B_OK;
case BTimedEventQueue::B_REMOVE_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) {
action = (*hook)(&entry->event, context);
switch (action) {
case BTimedEventQueue::B_DONE:
case BTimedEventQueue::B_DONE:
return B_OK;
case BTimedEventQueue::B_REMOVE_EVENT:
CleanupEvent(&entry->event);
@@ -411,7 +411,7 @@ _event_queue_imp::DoForEach(BTimedEventQueue::for_each_hook hook,
return B_ERROR;
}
status_t
_event_queue_imp::FlushEvents(bigtime_t eventTime,
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)
{
//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)
{
//perform the cleanup action required
//when deleting an event from the queue
//BeBook says:
// Each event has a cleanup flag associated with it that indicates
// 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.
// Each event has a cleanup flag associated with it that indicates
// 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.
// If it's B_RECYCLE, and the event is a B_HANDLE_BUFFER event, BTimedEventQueue
// will automatically recycle the buffer associated with the event.
// If the cleanup flag is B_DELETE or is B_USER_CLEANUP or greater,
// the cleanup hook function will be called.
// will automatically recycle the buffer associated with the event.
// If the cleanup flag is B_DELETE or is B_USER_CLEANUP or greater,
// the cleanup hook function will be called.
//and:
// cleanup hook function specified by hook to be called for events
// 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.
// 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.
//and:
// These values define how BTimedEventQueue should handle removing
// events from the queue. If the flag is B_USER_CLEANUP or greater,
// the cleanup hook function is called when the event is removed.
// These values define how BTimedEventQueue should handle removing
// events from the queue. If the flag is B_USER_CLEANUP or greater,
// the cleanup hook function is called when the event is removed.
//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)
//
// 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_EXPIRE_TIMER, // call TimerExpired() on the event->data
// B_USER_CLEANUP = 0x4000 // others go to the cleanup func
//
//
if (event->cleanup == BTimedEventQueue::B_NO_CLEANUP) {
// do nothing
} 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)
(*fCleanupHook)(event,fCleanupHookContext);
} 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_entry *entry;
entry = fLastEntry;
while (entry) {
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_entry *entry;
entry = fFirstEntry;
while (entry) {
if ((entry->event.event_time < eventTime) || (!inclusive && entry->event.event_time == eventTime))