From 1969e7f7ff0e46d577a177dc8a2f6b250a9dc411 Mon Sep 17 00:00:00 2001
From: Dario Casalinuovo <b.vitruvio@gmail.com>
Date: Wed, 7 Jan 2015 16:35:07 +0100
Subject: [PATCH] Implement BMediaRoster::RollNode().
---
headers/private/media/ServerInterface.h | 7 +++++++
src/kits/media/MediaNode.cpp | 17 +++++++++++++++++
src/kits/media/MediaRoster.cpp | 17 +++++++++++++++--
3 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/headers/private/media/ServerInterface.h b/headers/private/media/ServerInterface.h
index 8042ebf..13249eb 100644
a
|
b
|
enum {
|
88 | 88 | NODE_SET_RUN_MODE, |
89 | 89 | NODE_TIME_WARP, |
90 | 90 | NODE_PREROLL, |
| 91 | NODE_ROLL, |
91 | 92 | NODE_SET_TIMESOURCE, |
92 | 93 | NODE_GET_TIMESOURCE, |
93 | 94 | NODE_REQUEST_COMPLETED, |
… |
… |
struct node_seek_command : command_data {
|
899 | 900 | bigtime_t performance_time; |
900 | 901 | }; |
901 | 902 | |
| 903 | struct node_roll_command : command_data { |
| 904 | bigtime_t start_performance_time; |
| 905 | bigtime_t stop_performance_time; |
| 906 | bigtime_t seek_media_time; |
| 907 | }; |
| 908 | |
902 | 909 | struct node_set_run_mode_command : command_data { |
903 | 910 | BMediaNode::run_mode mode; |
904 | 911 | }; |
diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp
index 5f7c005..77319ae 100644
a
|
b
|
BMediaNode::HandleMessage(int32 message,
|
632 | 632 | return B_OK; |
633 | 633 | } |
634 | 634 | |
| 635 | case NODE_ROLL: |
| 636 | { |
| 637 | const node_roll_command *command |
| 638 | = static_cast<const node_roll_command *>(data); |
| 639 | |
| 640 | TRACE("BMediaNode::HandleMessage NODE_ROLL, node %ld\n", |
| 641 | fNodeID); |
| 642 | |
| 643 | if (command->seek_media_time != B_INFINITE_TIMEOUT) |
| 644 | Seek(command->seek_media_time, |
| 645 | command->start_performance_time); |
| 646 | |
| 647 | Start(command->start_performance_time); |
| 648 | Stop(command->stop_performance_time, false); |
| 649 | return B_OK; |
| 650 | } |
| 651 | |
635 | 652 | case NODE_SET_TIMESOURCE: |
636 | 653 | { |
637 | 654 | const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data); |
diff --git a/src/kits/media/MediaRoster.cpp b/src/kits/media/MediaRoster.cpp
index b7d2853..8201be0 100644
a
|
b
|
status_t
|
1400 | 1400 | BMediaRoster::RollNode(const media_node& node, bigtime_t startPerformance, |
1401 | 1401 | bigtime_t stopPerformance, bigtime_t atMediaTime) |
1402 | 1402 | { |
1403 | | UNIMPLEMENTED(); |
1404 | | return B_ERROR; |
| 1403 | CALLED(); |
| 1404 | if (IS_INVALID_NODE(node)) |
| 1405 | return B_MEDIA_BAD_NODE; |
| 1406 | |
| 1407 | TRACE("BMediaRoster::RollNode, node %" B_PRId32 ", at start perf %" |
| 1408 | B_PRId64 ", at stop perf %" B_PRId64 ", at media time %" |
| 1409 | B_PRId64 "\n", node.node, startPerformance, |
| 1410 | stopPerformance, atMediaTime); |
| 1411 | |
| 1412 | node_roll_command command; |
| 1413 | command.start_performance_time = startPerformance; |
| 1414 | command.stop_performance_time = stopPerformance; |
| 1415 | command.seek_media_time = atMediaTime; |
| 1416 | |
| 1417 | return write_port(node.port, NODE_ROLL, &command, sizeof(command)); |
1405 | 1418 | } |
1406 | 1419 | |
1407 | 1420 | |