Ticket #9083: 0001-Implement-BMediaRoster-RollNode.patch

File 0001-Implement-BMediaRoster-RollNode.patch, 2.9 KB (added by Barrett, 9 years ago)

This patch implement BMediaRoster::RollNode.

  • headers/private/media/ServerInterface.h

    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 {  
    8888    NODE_SET_RUN_MODE,
    8989    NODE_TIME_WARP,
    9090    NODE_PREROLL,
     91    NODE_ROLL,
    9192    NODE_SET_TIMESOURCE,
    9293    NODE_GET_TIMESOURCE,
    9394    NODE_REQUEST_COMPLETED,
    struct node_seek_command : command_data {  
    899900    bigtime_t               performance_time;
    900901};
    901902
     903struct 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
    902909struct node_set_run_mode_command : command_data {
    903910    BMediaNode::run_mode    mode;
    904911};
  • src/kits/media/MediaNode.cpp

    diff --git a/src/kits/media/MediaNode.cpp b/src/kits/media/MediaNode.cpp
    index 5f7c005..77319ae 100644
    a b BMediaNode::HandleMessage(int32 message,  
    632632            return B_OK;
    633633        }
    634634
     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
    635652        case NODE_SET_TIMESOURCE:
    636653        {
    637654            const node_set_timesource_command *command = static_cast<const node_set_timesource_command *>(data);
  • src/kits/media/MediaRoster.cpp

    diff --git a/src/kits/media/MediaRoster.cpp b/src/kits/media/MediaRoster.cpp
    index b7d2853..8201be0 100644
    a b status_t  
    14001400BMediaRoster::RollNode(const media_node& node, bigtime_t startPerformance,
    14011401    bigtime_t stopPerformance, bigtime_t atMediaTime)
    14021402{
    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));
    14051418}
    14061419
    14071420