本文整理汇总了C++中BBuffer::SetHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ BBuffer::SetHeader方法的具体用法?C++ BBuffer::SetHeader怎么用?C++ BBuffer::SetHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBuffer
的用法示例。
在下文中一共展示了BBuffer::SetHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ID
status_t
BBufferConsumer::HandleMessage(int32 message, const void* data, size_t size)
{
PRINT(4, "BBufferConsumer::HandleMessage %#lx, node %ld\n", message, ID());
status_t rv;
switch (message) {
case CONSUMER_ACCEPT_FORMAT:
{
const consumer_accept_format_request* request
= static_cast<const consumer_accept_format_request*>(data);
consumer_accept_format_reply reply;
reply.format = request->format;
status_t status = AcceptFormat(request->dest, &reply.format);
request->SendReply(status, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_GET_NEXT_INPUT:
{
const consumer_get_next_input_request *request = static_cast<const consumer_get_next_input_request *>(data);
consumer_get_next_input_reply reply;
reply.cookie = request->cookie;
rv = GetNextInput(&reply.cookie, &reply.input);
request->SendReply(rv, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_DISPOSE_INPUT_COOKIE:
{
const consumer_dispose_input_cookie_request *request = static_cast<const consumer_dispose_input_cookie_request *>(data);
consumer_dispose_input_cookie_reply reply;
DisposeInputCookie(request->cookie);
request->SendReply(B_OK, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_BUFFER_RECEIVED:
{
const consumer_buffer_received_command* command
= static_cast<const consumer_buffer_received_command*>(data);
BBuffer* buffer = fBufferCache->GetBuffer(command->buffer);
if (buffer == NULL) {
ERROR("BBufferConsumer::CONSUMER_BUFFER_RECEIVED can't"
"find the buffer\n");
} else {
buffer->SetHeader(&command->header);
PRINT(4, "calling BBufferConsumer::BufferReceived buffer %ld "
"at perf %Ld and TimeSource()->Now() is %Ld\n",
buffer->Header()->buffer, buffer->Header()->start_time,
TimeSource()->Now());
BufferReceived(buffer);
}
return B_OK;
}
case CONSUMER_PRODUCER_DATA_STATUS:
{
const consumer_producer_data_status_command *command = static_cast<const consumer_producer_data_status_command *>(data);
ProducerDataStatus(command->for_whom, command->status, command->at_performance_time);
return B_OK;
}
case CONSUMER_GET_LATENCY_FOR:
{
const consumer_get_latency_for_request *request = static_cast<const consumer_get_latency_for_request *>(data);
consumer_get_latency_for_reply reply;
rv = GetLatencyFor(request->for_whom, &reply.latency, &reply.timesource);
request->SendReply(rv, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_CONNECTED:
{
const consumer_connected_request *request = static_cast<const consumer_connected_request *>(data);
consumer_connected_reply reply;
reply.input = request->input;
rv = Connected(request->input.source, request->input.destination, request->input.format, &reply.input);
request->SendReply(rv, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_DISCONNECTED:
{
const consumer_disconnected_request *request = static_cast<const consumer_disconnected_request *>(data);
consumer_disconnected_reply reply;
Disconnected(request->source, request->destination);
request->SendReply(B_OK, &reply, sizeof(reply));
return B_OK;
}
case CONSUMER_FORMAT_CHANGED:
{
const consumer_format_changed_request *request = static_cast<const consumer_format_changed_request *>(data);
consumer_format_changed_reply reply;
rv = FormatChanged(request->producer, request->consumer, request->change_tag, request->format);
request->SendReply(rv, &reply, sizeof(reply));
//.........这里部分代码省略.........