Implement BMediaRoster::RollNode().

Fixes #9083.

Signed-off-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Dario Casalinuovo 2015-01-07 16:35:07 +01:00 committed by Adrien Destugues
parent 67d5656fab
commit 14896b937a
3 changed files with 39 additions and 2 deletions

View File

@ -88,6 +88,7 @@ enum {
NODE_SET_RUN_MODE,
NODE_TIME_WARP,
NODE_PREROLL,
NODE_ROLL,
NODE_SET_TIMESOURCE,
NODE_GET_TIMESOURCE,
NODE_REQUEST_COMPLETED,
@ -899,6 +900,12 @@ struct node_seek_command : command_data {
bigtime_t performance_time;
};
struct node_roll_command : command_data {
bigtime_t start_performance_time;
bigtime_t stop_performance_time;
bigtime_t seek_media_time;
};
struct node_set_run_mode_command : command_data {
BMediaNode::run_mode mode;
};

View File

@ -632,6 +632,23 @@ BMediaNode::HandleMessage(int32 message,
return B_OK;
}
case NODE_ROLL:
{
const node_roll_command *command
= static_cast<const node_roll_command *>(data);
TRACE("BMediaNode::HandleMessage NODE_ROLL, node %ld\n",
fNodeID);
if (command->seek_media_time != B_INFINITE_TIMEOUT)
Seek(command->seek_media_time,
command->start_performance_time);
Start(command->start_performance_time);
Stop(command->stop_performance_time, false);
return B_OK;
}
case NODE_SET_TIMESOURCE:
{
const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data);

View File

@ -1400,8 +1400,21 @@ status_t
BMediaRoster::RollNode(const media_node& node, bigtime_t startPerformance,
bigtime_t stopPerformance, bigtime_t atMediaTime)
{
UNIMPLEMENTED();
return B_ERROR;
CALLED();
if (IS_INVALID_NODE(node))
return B_MEDIA_BAD_NODE;
TRACE("BMediaRoster::RollNode, node %" B_PRId32 ", at start perf %"
B_PRId64 ", at stop perf %" B_PRId64 ", at media time %"
B_PRId64 "\n", node.node, startPerformance,
stopPerformance, atMediaTime);
node_roll_command command;
command.start_performance_time = startPerformance;
command.stop_performance_time = stopPerformance;
command.seek_media_time = atMediaTime;
return write_port(node.port, NODE_ROLL, &command, sizeof(command));
}