Fix build of mvcp-client.
authorDan Dennedy <dan@dennedy.org>
Fri, 15 May 2009 06:59:00 +0000 (23:59 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 15 May 2009 06:59:00 +0000 (23:59 -0700)
Signed-off-by: Dan Dennedy <dan@dennedy.org>

src/mvcp-client/client.c
src/mvcp-client/client.h
src/mvcp-client/io.c
src/mvcp-client/io.h
src/mvcp-client/remote.c

index afd2bbd..1bbac31 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * client.c -- Valerie client demo
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * client.c -- MVCP client
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -35,12 +35,12 @@ typedef enum
        absolute,
        relative
 }
-dv_demo_whence;
+client_whence;
 
 /** Function prototype for menu handling. 
 */
 
-typedef valerie_error_code (*demo_function)( dv_demo );
+typedef mvcp_error_code (*demo_function)( client );
 
 /** The menu structure. 
 */
@@ -55,34 +55,34 @@ typedef struct
        }
        array[ 50 ];
 }
-*dv_demo_menu, dv_demo_menu_t;
+*client_menu, client_menu_t;
 
 /** Forward reference to menu runner.
 */
 
-extern valerie_error_code dv_demo_run_menu( dv_demo, dv_demo_menu );
+extern mvcp_error_code client_run_menu( client, client_menu );
 
 /** Foward references. 
 */
 
-extern valerie_error_code dv_demo_list_nodes( dv_demo );
-extern valerie_error_code dv_demo_add_unit( dv_demo );
-extern valerie_error_code dv_demo_select_unit( dv_demo );
-extern valerie_error_code dv_demo_execute( dv_demo );
-extern valerie_error_code dv_demo_load( dv_demo );
-extern valerie_error_code dv_demo_transport( dv_demo );
-static void *dv_demo_status_thread( void * );
+extern mvcp_error_code client_list_nodes( client );
+extern mvcp_error_code client_add_unit( client );
+extern mvcp_error_code client_select_unit( client );
+extern mvcp_error_code client_execute( client );
+extern mvcp_error_code client_load( client );
+extern mvcp_error_code client_transport( client );
+static void *client_status_thread( void * );
 
 /** Connected menu definition. 
 */
 
-dv_demo_menu_t connected_menu =
+client_menu_t connected_menu =
 {
        "Connected Menu",
        {
-               { "Add Unit", dv_demo_add_unit },
-               { "Select Unit", dv_demo_select_unit },
-               { "Command Shell", dv_demo_execute },
+               { "Add Unit", client_add_unit },
+               { "Select Unit", client_select_unit },
+               { "Command Shell", client_execute },
                { NULL, NULL }
        }
 };
@@ -90,13 +90,13 @@ dv_demo_menu_t connected_menu =
 /** Initialise the demo structure.
 */
 
-dv_demo dv_demo_init( valerie_parser parser )
+client client_init( mvcp_parser parser )
 {
-       dv_demo this = malloc( sizeof( dv_demo_t ) );
+       client this = malloc( sizeof( client_t ) );
        if ( this != NULL )
        {
                int index = 0;
-               memset( this, 0, sizeof( dv_demo_t ) );
+               memset( this, 0, sizeof( client_t ) );
                strcpy( this->last_directory, "/" );
                for ( index = 0; index < 4; index ++ )
                {
@@ -111,7 +111,7 @@ dv_demo dv_demo_init( valerie_parser parser )
 /** Display a status record.
 */
 
-void dv_demo_show_status( dv_demo demo, valerie_status status )
+void client_show_status( client demo, mvcp_status status )
 {
        if ( status->unit == demo->selected_unit && demo->showing )
        {
@@ -158,9 +158,9 @@ void dv_demo_show_status( dv_demo demo, valerie_status status )
 /** Determine action to carry out as dictated by the client unit queue.
 */
 
-void dv_demo_queue_action( dv_demo demo, valerie_status status )
+void client_queue_action( client demo, mvcp_status status )
 {
-       dv_demo_queue queue = &demo->queues[ status->unit ];
+       client_queue queue = &demo->queues[ status->unit ];
 
        /* SPECIAL CASE STATUS NOTIFICATIONS TO IGNORE */
 
@@ -178,18 +178,18 @@ void dv_demo_queue_action( dv_demo demo, valerie_status status )
                        queue->position = ( queue->position + 1 ) % 50;
                        if ( queue->position == queue->tail )
                                queue->position = queue->head;
-                       valerie_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
+                       mvcp_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
                        if ( status->status == unit_not_loaded )
-                               valerie_unit_play( demo->dv, queue->unit );
+                               mvcp_unit_play( demo->dv, queue->unit );
                        queue->ignore = 1;
                }
                else if ( ( status->position <= status->in && status->speed < 0 ) || status->status == unit_not_loaded )
                {
                        if ( queue->position == -1 )
                                queue->position = queue->head;
-                       valerie_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
+                       mvcp_unit_load( demo->dv_status, status->unit, queue->list[ queue->position ] );
                        if ( status->status == unit_not_loaded )
-                               valerie_unit_play( demo->dv, queue->unit );
+                               mvcp_unit_play( demo->dv, queue->unit );
                        queue->position = ( queue->position - 1 ) % 50;
                        queue->ignore = 1;
                }
@@ -199,18 +199,18 @@ void dv_demo_queue_action( dv_demo demo, valerie_status status )
 /** Status thread.
 */
 
-static void *dv_demo_status_thread( void *arg )
+static void *client_status_thread( void *arg )
 {
-       dv_demo demo = arg;
-       valerie_status_t status;
-       valerie_notifier notifier = valerie_get_notifier( demo->dv_status );
+       client demo = arg;
+       mvcp_status_t status;
+       mvcp_notifier notifier = mvcp_get_notifier( demo->dv_status );
 
        while ( !demo->terminated )
        {
-               if ( valerie_notifier_wait( notifier, &status ) != -1 )
+               if ( mvcp_notifier_wait( notifier, &status ) != -1 )
                {
-                       dv_demo_queue_action( demo, &status );
-                       dv_demo_show_status( demo, &status );
+                       client_queue_action( demo, &status );
+                       client_show_status( demo, &status );
                        if ( status.status == unit_disconnected )
                                demo->disconnected = 1;
                }
@@ -222,12 +222,12 @@ static void *dv_demo_status_thread( void *arg )
 /** Turn on/off status display.
 */
 
-void dv_demo_change_status( dv_demo demo, int flag )
+void client_change_status( client demo, int flag )
 {
        if ( demo->disconnected && flag )
        {
-               valerie_error_code error = valerie_connect( demo->dv );
-               if ( error == valerie_ok )
+               mvcp_error_code error = mvcp_connect( demo->dv );
+               if ( error == mvcp_ok )
                        demo->disconnected = 0;
                else
                        beep();
@@ -235,11 +235,11 @@ void dv_demo_change_status( dv_demo demo, int flag )
 
        if ( flag )
        {
-               valerie_status_t status;
-               valerie_notifier notifier = valerie_get_notifier( demo->dv );
-               valerie_notifier_get( notifier, &status, demo->selected_unit );
+               mvcp_status_t status;
+               mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
+               mvcp_notifier_get( notifier, &status, demo->selected_unit );
                demo->showing = 1;
-               dv_demo_show_status( demo, &status );
+               client_show_status( demo, &status );
        }
        else
        {
@@ -252,29 +252,29 @@ void dv_demo_change_status( dv_demo demo, int flag )
 /** Add a unit.
 */
 
-valerie_error_code dv_demo_add_unit( dv_demo demo )
+mvcp_error_code client_add_unit( client demo )
 {
-       valerie_error_code error = valerie_ok;
-       valerie_nodes nodes = valerie_nodes_init( demo->dv );
-       valerie_units units = valerie_units_init( demo->dv );
+       mvcp_error_code error = mvcp_ok;
+       mvcp_nodes nodes = mvcp_nodes_init( demo->dv );
+       mvcp_units units = mvcp_units_init( demo->dv );
 
-       if ( valerie_nodes_count( nodes ) != -1 && valerie_units_count( units ) != -1 )
+       if ( mvcp_nodes_count( nodes ) != -1 && mvcp_units_count( units ) != -1 )
        {
                char pressed;
-               valerie_node_entry_t node;
-               valerie_unit_entry_t unit;
+               mvcp_node_entry_t node;
+               mvcp_unit_entry_t unit;
                int node_index = 0;
                int unit_index = 0;
 
                printf( "Select a Node\n\n" );
 
-               for ( node_index = 0; node_index < valerie_nodes_count( nodes ); node_index ++ )
+               for ( node_index = 0; node_index < mvcp_nodes_count( nodes ); node_index ++ )
                {
-                       valerie_nodes_get( nodes, node_index, &node );
+                       mvcp_nodes_get( nodes, node_index, &node );
                        printf( "%d: %s - %s ", node_index + 1, node.guid, node.name );
-                       for ( unit_index = 0; unit_index < valerie_units_count( units ); unit_index ++ )
+                       for ( unit_index = 0; unit_index < mvcp_units_count( units ); unit_index ++ )
                        {
-                               valerie_units_get( units, unit_index, &unit );
+                               mvcp_units_get( units, unit_index, &unit );
                                if ( !strcmp( unit.guid, node.guid ) )
                                        printf( "[U%d] ", unit.unit );
                        }
@@ -288,12 +288,12 @@ valerie_error_code dv_demo_add_unit( dv_demo demo )
                while ( ( pressed = get_keypress( ) ) != '0' )
                {
                        node_index = pressed - '1';
-                       if ( node_index >= 0 && node_index < valerie_nodes_count( nodes ) )
+                       if ( node_index >= 0 && node_index < mvcp_nodes_count( nodes ) )
                        {
                                int unit;
                                printf( "%c\n\n", pressed );
-                               valerie_nodes_get( nodes, node_index, &node );
-                               if ( valerie_unit_add( demo->dv, node.guid, &unit ) == valerie_ok )
+                               mvcp_nodes_get( nodes, node_index, &node );
+                               if ( mvcp_unit_add( demo->dv, node.guid, &unit ) == mvcp_ok )
                                {
                                        printf( "Unit added as U%d\n", unit );
                                        demo->selected_unit = unit;
@@ -301,10 +301,10 @@ valerie_error_code dv_demo_add_unit( dv_demo demo )
                                else
                                {
                                        int index = 0;
-                                       valerie_response response = valerie_get_last_response( demo->dv );
+                                       mvcp_response response = mvcp_get_last_response( demo->dv );
                                        printf( "Failed to add unit:\n\n" );
-                                       for( index = 1; index < valerie_response_count( response ) - 1; index ++ )
-                                               printf( "%s\n", valerie_response_get_line( response, index ) );
+                                       for( index = 1; index < mvcp_response_count( response ) - 1; index ++ )
+                                               printf( "%s\n", mvcp_response_get_line( response, index ) );
                                }
                                printf( "\n" );
                                wait_for_any_key( NULL );
@@ -322,8 +322,8 @@ valerie_error_code dv_demo_add_unit( dv_demo demo )
                wait_for_any_key( NULL );
        }
 
-       valerie_nodes_close( nodes );
-       valerie_units_close( units );
+       mvcp_nodes_close( nodes );
+       mvcp_units_close( units );
 
        return error;
 }
@@ -331,18 +331,18 @@ valerie_error_code dv_demo_add_unit( dv_demo demo )
 /** Select a unit.
 */
 
-valerie_error_code dv_demo_select_unit( dv_demo demo )
+mvcp_error_code client_select_unit( client demo )
 {
        int terminated = 0;
        int refresh = 1;
 
        while ( !terminated )
        {
-               valerie_units units = valerie_units_init( demo->dv );
+               mvcp_units units = mvcp_units_init( demo->dv );
 
-               if ( valerie_units_count( units ) > 0 )
+               if ( mvcp_units_count( units ) > 0 )
                {
-                       valerie_unit_entry_t unit;
+                       mvcp_unit_entry_t unit;
                        int index = 0;
                        char key = '\0';
 
@@ -350,9 +350,9 @@ valerie_error_code dv_demo_select_unit( dv_demo demo )
                        {
                                printf( "Select a Unit\n\n" );
 
-                               for ( index = 0; index < valerie_units_count( units ); index ++ )
+                               for ( index = 0; index < mvcp_units_count( units ); index ++ )
                                {
-                                       valerie_units_get( units, index, &unit );
+                                       mvcp_units_get( units, index, &unit );
                                        printf( "%d: U%d - %s [%s]\n", index + 1, 
                                                                                                   unit.unit, 
                                                                                                   unit.guid, 
@@ -371,11 +371,11 @@ valerie_error_code dv_demo_select_unit( dv_demo demo )
 
                        if ( key != '0' )
                        {
-                               if ( key >= '1' && key < '1' + valerie_units_count( units ) )
+                               if ( key >= '1' && key < '1' + mvcp_units_count( units ) )
                                {
                                        demo->selected_unit = key - '1';
                                        printf( "%c\n\n", key );
-                                       dv_demo_load( demo );
+                                       client_load( demo );
                                        refresh = 1;
                                }
                                else
@@ -389,10 +389,10 @@ valerie_error_code dv_demo_select_unit( dv_demo demo )
                                terminated = 1;
                        }
                }
-               else if ( valerie_units_count( units ) == 0 )
+               else if ( mvcp_units_count( units ) == 0 )
                {
                        printf( "No units added - add a unit first\n\n" );
-                       dv_demo_add_unit( demo );
+                       client_add_unit( demo );
                }
                else
                {
@@ -400,22 +400,22 @@ valerie_error_code dv_demo_select_unit( dv_demo demo )
                        terminated = 1;
                }
 
-               valerie_units_close( units );
+               mvcp_units_close( units );
        }
 
-       return valerie_ok;
+       return mvcp_ok;
 }
 
 /** Execute an arbitrary command.
 */
 
-valerie_error_code dv_demo_execute( dv_demo demo )
+mvcp_error_code client_execute( client demo )
 {
-       valerie_error_code error = valerie_ok;
+       mvcp_error_code error = mvcp_ok;
        char command[ 10240 ];
        int terminated = 0;
 
-       printf( "Miracle Shell\n" );
+       printf( "Melted Shell\n" );
        printf( "Enter an empty command to exit.\n\n" );
 
        while ( !terminated )
@@ -428,13 +428,13 @@ valerie_error_code dv_demo_execute( dv_demo demo )
                        if ( strcmp( command, "" ) )
                        {
                                int index = 0;
-                               valerie_response response = NULL;
-                               error = valerie_execute( demo->dv, 10240, command );
+                               mvcp_response response = NULL;
+                               error = mvcp_execute( demo->dv, 10240, command );
                                printf( "\n" );
-                               response = valerie_get_last_response( demo->dv );
-                               for ( index = 0; index < valerie_response_count( response ); index ++ )
+                               response = mvcp_get_last_response( demo->dv );
+                               for ( index = 0; index < mvcp_response_count( response ); index ++ )
                                {
-                                       char *line = valerie_response_get_line( response, index );
+                                       char *line = mvcp_response_get_line( response, index );
                                        printf( "%4d: %s\n", index, line );
                                }
                                printf( "\n" );
@@ -451,26 +451,26 @@ valerie_error_code dv_demo_execute( dv_demo demo )
 /** Add a file to the queue.
 */
 
-valerie_error_code dv_demo_queue_add( dv_demo demo, dv_demo_queue queue, char *file )
+mvcp_error_code client_queue_add( client demo, client_queue queue, char *file )
 {
-       valerie_status_t status;
-       valerie_notifier notifier = valerie_get_notifier( demo->dv );
+       mvcp_status_t status;
+       mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
 
        if ( ( queue->tail + 1 ) % 50 == queue->head )
                queue->head = ( queue->head + 1 ) % 50;
        strcpy( queue->list[ queue->tail ], file );
        queue->tail = ( queue->tail + 1 ) % 50;
 
-       valerie_notifier_get( notifier, &status, queue->unit );
-       valerie_notifier_put( notifier, &status );
+       mvcp_notifier_get( notifier, &status, queue->unit );
+       mvcp_notifier_put( notifier, &status );
 
-       return valerie_ok;
+       return mvcp_ok;
 }
 
 /** Basic queue maintenance and status reports.
 */
 
-valerie_error_code dv_demo_queue_maintenance( dv_demo demo, dv_demo_queue queue )
+mvcp_error_code client_queue_maintenance( client demo, client_queue queue )
 {
        printf( "Queue Maintenance for Unit %d\n\n", queue->unit );
 
@@ -527,7 +527,7 @@ valerie_error_code dv_demo_queue_maintenance( dv_demo demo, dv_demo_queue queue
                                last_position = queue->position;
                        }
 
-                       dv_demo_change_status( demo, 1 );
+                       client_change_status( demo, 1 );
                        
                        switch( term_read( ) )
                        {
@@ -547,22 +547,22 @@ valerie_error_code dv_demo_queue_maintenance( dv_demo demo, dv_demo_queue queue
                                        break;
                        }
 
-                       dv_demo_change_status( demo, 0 );
+                       client_change_status( demo, 0 );
                }
 
                term_exit( );
        }
 
-       return valerie_ok;
+       return mvcp_ok;
 }
 
 /** Load a file to the selected unit. Horrible function - sorry :-/. Not a good
        demo....
 */
 
-valerie_error_code dv_demo_load( dv_demo demo )
+mvcp_error_code client_load( client demo )
 {
-       valerie_error_code error = valerie_ok;
+       mvcp_error_code error = mvcp_ok;
        int terminated = 0;
        int refresh = 1;
        int start = 0;
@@ -573,18 +573,18 @@ valerie_error_code dv_demo_load( dv_demo demo )
 
        while ( !terminated )
        {
-               valerie_dir dir = valerie_dir_init( demo->dv, demo->current_directory );
+               mvcp_dir dir = mvcp_dir_init( demo->dv, demo->current_directory );
 
-               if ( valerie_dir_count( dir ) == -1 )
+               if ( mvcp_dir_count( dir ) == -1 )
                {
                        printf( "Invalid directory - retrying %s\n", demo->last_directory );
-                       valerie_dir_close( dir );
-                       dir = valerie_dir_init( demo->dv, demo->last_directory );
-                       if ( valerie_dir_count( dir ) == -1 )
+                       mvcp_dir_close( dir );
+                       dir = mvcp_dir_init( demo->dv, demo->last_directory );
+                       if ( mvcp_dir_count( dir ) == -1 )
                        {
                                printf( "Invalid directory - going back to /\n" );
-                               valerie_dir_close( dir );
-                               dir = valerie_dir_init( demo->dv, "/" );
+                               mvcp_dir_close( dir );
+                               dir = mvcp_dir_init( demo->dv, "/" );
                                strcpy( demo->current_directory, "/" );
                        }
                        else
@@ -593,7 +593,7 @@ valerie_error_code dv_demo_load( dv_demo demo )
                        }
                }
 
-               terminated = valerie_dir_count( dir ) == -1;
+               terminated = mvcp_dir_count( dir ) == -1;
 
                if ( !terminated )
                {
@@ -602,13 +602,13 @@ valerie_error_code dv_demo_load( dv_demo demo )
                        int max = 9;
                        int end = 0;
 
-                       end = valerie_dir_count( dir );
+                       end = mvcp_dir_count( dir );
 
                        strcpy( demo->last_directory, demo->current_directory );
 
                        while ( !selected && !terminated )
                        {
-                               valerie_dir_entry_t entry;
+                               mvcp_dir_entry_t entry;
                                int pressed;
 
                                if ( refresh )
@@ -621,7 +621,7 @@ valerie_error_code dv_demo_load( dv_demo demo )
                                                printf( "-: Parent directory\n" );
                                        for ( index = start; index < end && ( index - start ) < max; index ++ )
                                        {
-                                               valerie_dir_get( dir, index, &entry );
+                                               mvcp_dir_get( dir, index, &entry );
                                                printf( "%d: %s\n", index - start + 1, entry.name );
                                        }
                                        while ( ( index ++ % 9 ) != 0 )
@@ -638,7 +638,7 @@ valerie_error_code dv_demo_load( dv_demo demo )
                                        refresh = 0;
                                }
 
-                               dv_demo_change_status( demo, 1 );
+                               client_change_status( demo, 1 );
 
                                pressed = term_read( );
                                switch( pressed )
@@ -674,23 +674,23 @@ valerie_error_code dv_demo_load( dv_demo demo )
                                                }
                                                break;
                                        case 't':
-                                               dv_demo_change_status( demo, 0 );
+                                               client_change_status( demo, 0 );
                                                term_exit( );
-                                               dv_demo_transport( demo );
+                                               client_transport( demo );
                                                term_init( );
                                                selected = 1;
                                                break;
                                        case 'x':
-                                               dv_demo_change_status( demo, 0 );
+                                               client_change_status( demo, 0 );
                                                term_exit( );
-                                               dv_demo_execute( demo );
+                                               client_execute( demo );
                                                term_init( );
                                                selected = 1;
                                                break;
                                        case 'q':
-                                               dv_demo_change_status( demo, 0 );
+                                               client_change_status( demo, 0 );
                                                term_exit( );
-                                               dv_demo_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
+                                               client_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
                                                term_init( );
                                                selected = 1;
                                                break;
@@ -699,7 +699,7 @@ valerie_error_code dv_demo_load( dv_demo demo )
                                                {
                                                        if ( ( start + pressed - '1' ) < end )
                                                        {
-                                                               valerie_dir_get( dir, start + pressed - '1', &entry );
+                                                               mvcp_dir_get( dir, start + pressed - '1', &entry );
                                                                selected = 1;
                                                                strcat( demo->current_directory, entry.name );
                                                        }
@@ -707,22 +707,22 @@ valerie_error_code dv_demo_load( dv_demo demo )
                                                break;
                                }
 
-                               dv_demo_change_status( demo, 0 );
+                               client_change_status( demo, 0 );
                        }
 
-                       valerie_dir_close( dir );
+                       mvcp_dir_close( dir );
                }
 
                if ( !terminated && demo->current_directory[ strlen( demo->current_directory ) - 1 ] != '/' )
                {
                        if ( demo->queues[ demo->selected_unit ].mode == 0 )
                        {
-                               error = valerie_unit_load( demo->dv, demo->selected_unit, demo->current_directory );
-                               valerie_unit_play( demo->dv, demo->selected_unit );
+                               error = mvcp_unit_load( demo->dv, demo->selected_unit, demo->current_directory );
+                               mvcp_unit_play( demo->dv, demo->selected_unit );
                        }
                        else
                        {
-                               dv_demo_queue_add( demo, &demo->queues[ demo->selected_unit ], demo->current_directory );
+                               client_queue_add( demo, &demo->queues[ demo->selected_unit ], demo->current_directory );
                                printf( "File %s added to queue.\n", demo->current_directory );
                        }
                        strcpy( demo->current_directory, demo->last_directory );
@@ -743,59 +743,59 @@ valerie_error_code dv_demo_load( dv_demo demo )
 /** Set the in point of the clip on the select unit.
 */
 
-valerie_error_code dv_demo_set_in( dv_demo demo )
+mvcp_error_code client_set_in( client demo )
 {
        int position = 0;
-       valerie_status_t status;
-       valerie_notifier notifier = valerie_parser_get_notifier( demo->parser );
-       valerie_notifier_get( notifier, &status, demo->selected_unit );
+       mvcp_status_t status;
+       mvcp_notifier notifier = mvcp_parser_get_notifier( demo->parser );
+       mvcp_notifier_get( notifier, &status, demo->selected_unit );
        position = status.position;
-       return valerie_unit_set_in( demo->dv, demo->selected_unit, position );
+       return mvcp_unit_set_in( demo->dv, demo->selected_unit, position );
 }
 
 /** Set the out point of the clip on the selected unit.
 */
 
-valerie_error_code dv_demo_set_out( dv_demo demo )
+mvcp_error_code client_set_out( client demo )
 {
        int position = 0;
-       valerie_status_t status;
-       valerie_notifier notifier = valerie_parser_get_notifier( demo->parser );
-       valerie_notifier_get( notifier, &status, demo->selected_unit );
+       mvcp_status_t status;
+       mvcp_notifier notifier = mvcp_parser_get_notifier( demo->parser );
+       mvcp_notifier_get( notifier, &status, demo->selected_unit );
        position = status.position;
-       return valerie_unit_set_out( demo->dv, demo->selected_unit, position );
+       return mvcp_unit_set_out( demo->dv, demo->selected_unit, position );
 }
 
 /** Clear the in and out points on the selected unit.
 */
 
-valerie_error_code dv_demo_clear_in_out( dv_demo demo )
+mvcp_error_code client_clear_in_out( client demo )
 {
-       return valerie_unit_clear_in_out( demo->dv, demo->selected_unit );
+       return mvcp_unit_clear_in_out( demo->dv, demo->selected_unit );
 }
 
 /** Goto a user specified frame on the selected unit.
 */
 
-valerie_error_code dv_demo_goto( dv_demo demo )
+mvcp_error_code client_goto( client demo )
 {
        int frame = 0;
        printf( "Frame: " );
        if ( get_int( &frame, 0 ) )
-               return valerie_unit_goto( demo->dv, demo->selected_unit, frame );
-       return valerie_ok;
+               return mvcp_unit_goto( demo->dv, demo->selected_unit, frame );
+       return mvcp_ok;
 }
 
 /** Manipulate playback on the selected unit.
 */
 
-valerie_error_code dv_demo_transport( dv_demo demo )
+mvcp_error_code client_transport( client demo )
 {
-       valerie_error_code error = valerie_ok;
+       mvcp_error_code error = mvcp_ok;
        int refresh = 1;
        int terminated = 0;
-       valerie_status_t status;
-       valerie_notifier notifier = valerie_get_notifier( demo->dv );
+       mvcp_status_t status;
+       mvcp_notifier notifier = mvcp_get_notifier( demo->dv );
 
        while ( !terminated )
        {
@@ -818,7 +818,7 @@ valerie_error_code dv_demo_transport( dv_demo demo )
                        refresh = 0;
                }
 
-               dv_demo_change_status( demo, 1 );
+               client_change_status( demo, 1 );
 
                switch( term_read( ) )
                {
@@ -828,97 +828,97 @@ valerie_error_code dv_demo_transport( dv_demo demo )
                        case -1:
                                break;
                        case ' ':
-                               error = valerie_unit_pause( demo->dv, demo->selected_unit );
+                               error = mvcp_unit_pause( demo->dv, demo->selected_unit );
                                break;
                        case '1':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -5000 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -5000 );
                                break;
                        case '2':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -2500 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -2500 );
                                break;
                        case '3':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -1000 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -1000 );
                                break;
                        case '4':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, -500 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, -500 );
                                break;
                        case '5':
-                               error = valerie_unit_play( demo->dv, demo->selected_unit );
+                               error = mvcp_unit_play( demo->dv, demo->selected_unit );
                                break;
                        case '6':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 500 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 500 );
                                break;
                        case '7':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 1250 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 1250 );
                                break;
                        case '8':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 2500 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 2500 );
                                break;
                        case '9':
-                               error = valerie_unit_play_at_speed( demo->dv, demo->selected_unit, 5000 );
+                               error = mvcp_unit_play_at_speed( demo->dv, demo->selected_unit, 5000 );
                                break;
                        case 's':
-                               error = valerie_unit_goto( demo->dv, demo->selected_unit, 0 );
+                               error = mvcp_unit_goto( demo->dv, demo->selected_unit, 0 );
                                break;
                        case 'h':
-                               error = valerie_unit_step( demo->dv, demo->selected_unit, -1 );
+                               error = mvcp_unit_step( demo->dv, demo->selected_unit, -1 );
                                break;
                        case 'j':
-                               valerie_notifier_get( notifier, &status, demo->selected_unit );
-                               error = valerie_unit_goto( demo->dv, demo->selected_unit, status.tail_out );
+                               mvcp_notifier_get( notifier, &status, demo->selected_unit );
+                               error = mvcp_unit_goto( demo->dv, demo->selected_unit, status.tail_out );
                                break;
                        case 'k':
-                               valerie_notifier_get( notifier, &status, demo->selected_unit );
-                               error = valerie_unit_goto( demo->dv, demo->selected_unit, status.in );
+                               mvcp_notifier_get( notifier, &status, demo->selected_unit );
+                               error = mvcp_unit_goto( demo->dv, demo->selected_unit, status.in );
                                break;
                        case 'l':
-                               error = valerie_unit_step( demo->dv, demo->selected_unit, 1 );
+                               error = mvcp_unit_step( demo->dv, demo->selected_unit, 1 );
                                break;
                        case 'p':
-                               error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "pause" );
+                               error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "pause" );
                                break;
                        case 'r':
-                               error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "loop" );
+                               error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "loop" );
                                break;
                        case 't':
-                               error = valerie_unit_set( demo->dv, demo->selected_unit, "eof", "stop" );
+                               error = mvcp_unit_set( demo->dv, demo->selected_unit, "eof", "stop" );
                                break;
                        case 'i':
-                               error = dv_demo_set_in( demo );
+                               error = client_set_in( demo );
                                break;
                        case 'o':
-                               error = dv_demo_set_out( demo );
+                               error = client_set_out( demo );
                                break;
                        case 'g':
-                               dv_demo_change_status( demo, 0 );
+                               client_change_status( demo, 0 );
                                term_exit( );
-                               error = dv_demo_goto( demo );
+                               error = client_goto( demo );
                                refresh = 1;
                                break;
                        case 'c':
-                               error = dv_demo_clear_in_out( demo );
+                               error = client_clear_in_out( demo );
                                break;
                        case 'u':
-                               error = valerie_unit_set( demo->dv, demo->selected_unit, "points", "use" );
+                               error = mvcp_unit_set( demo->dv, demo->selected_unit, "points", "use" );
                                break;
                        case 'd':
-                               error = valerie_unit_set( demo->dv, demo->selected_unit, "points", "ignore" );
+                               error = mvcp_unit_set( demo->dv, demo->selected_unit, "points", "ignore" );
                                break;
                        case 'x':
-                               dv_demo_change_status( demo, 0 );
+                               client_change_status( demo, 0 );
                                term_exit( );
-                               dv_demo_execute( demo );
+                               client_execute( demo );
                                refresh = 1;
                                break;
                        case 'q':
-                               dv_demo_change_status( demo, 0 );
+                               client_change_status( demo, 0 );
                                term_exit( );
-                               dv_demo_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
+                               client_queue_maintenance( demo, &demo->queues[ demo->selected_unit ] );
                                refresh = 1;
                                break;
                }
 
-               dv_demo_change_status( demo, 0 );
+               client_change_status( demo, 0 );
        }
 
        term_exit( );
@@ -929,7 +929,7 @@ valerie_error_code dv_demo_transport( dv_demo demo )
 /** Recursive menu execution.
 */
 
-valerie_error_code dv_demo_run_menu( dv_demo demo, dv_demo_menu menu )
+mvcp_error_code client_run_menu( client demo, client_menu menu )
 {
        const char *items = "123456789abcdefghijklmnopqrstuvwxyz";
        int refresh_menu = 1;
@@ -957,8 +957,8 @@ valerie_error_code dv_demo_run_menu( dv_demo demo, dv_demo_menu menu )
 
                if ( demo->disconnected && key != '0' )
                {
-                       valerie_error_code error = valerie_connect( demo->dv );
-                       if ( error == valerie_ok )
+                       mvcp_error_code error = mvcp_connect( demo->dv );
+                       if ( error == mvcp_ok )
                                demo->disconnected = 0;
                        else
                                beep();
@@ -986,20 +986,20 @@ valerie_error_code dv_demo_run_menu( dv_demo demo, dv_demo_menu menu )
                }
        }
 
-       return valerie_ok;
+       return mvcp_ok;
 }
 
 /** Entry point for main menu.
 */
 
-void dv_demo_run( dv_demo this )
+void client_run( client this )
 {
-       this->dv = valerie_init( this->parser );
-       this->dv_status = valerie_init( this->parser );
-       if ( valerie_connect( this->dv ) == valerie_ok )
+       this->dv = mvcp_init( this->parser );
+       this->dv_status = mvcp_init( this->parser );
+       if ( mvcp_connect( this->dv ) == mvcp_ok )
        {
-               pthread_create( &this->thread, NULL, dv_demo_status_thread, this );
-               dv_demo_run_menu( this, &connected_menu );
+               pthread_create( &this->thread, NULL, client_status_thread, this );
+               client_run_menu( this, &connected_menu );
                this->terminated = 1;
                pthread_join( this->thread, NULL );
                this->terminated = 0;
@@ -1010,8 +1010,8 @@ void dv_demo_run( dv_demo this )
                wait_for_any_key( "" );
        }
 
-       valerie_close( this->dv_status );
-       valerie_close( this->dv );
+       mvcp_close( this->dv_status );
+       mvcp_close( this->dv );
 
        printf( "Demo Exit.\n" );
 }
@@ -1019,7 +1019,7 @@ void dv_demo_run( dv_demo this )
 /** Close the demo structure.
 */
 
-void dv_demo_close( dv_demo demo )
+void client_close( client demo )
 {
        free( demo );
 }
index 59d97f9..f4ae5f8 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * client.h -- Valerie client demo
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * client.h -- MVCP client
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef _DEMO_CLIENT_H_
-#define _DEMO_CLIENT_H_
+#ifndef _MVCP_CLIENT_H_
+#define _MVCP_CLIENT_H_
 
 #include <stdio.h>
 #include <pthread.h>
-#include <valerie/valerie.h>
+#include <mvcp/mvcp.h>
 
 /** Queue for unit playback
 */
@@ -38,7 +38,7 @@ typedef struct
        char list[ 50 ][ PATH_MAX + NAME_MAX ];
        int ignore;
 }
-*dv_demo_queue, dv_demo_queue_t;
+*client_queue, client_queue_t;
 
 /** Structure for storing app state. 
 */
@@ -46,21 +46,21 @@ typedef struct
 typedef struct
 {
        int disconnected;
-       valerie_parser parser;
-       valerie dv;
-       valerie dv_status;
+       mvcp_parser parser;
+       mvcp dv;
+       mvcp dv_status;
        int selected_unit;
        char current_directory[ 512 ];
        char last_directory[ 512 ];
        int showing;
        int terminated;
        pthread_t thread;
-       dv_demo_queue_t queues[ MAX_UNITS ];
+       client_queue_t queues[ MAX_UNITS ];
 }
-*dv_demo, dv_demo_t;
+*client, client_t;
 
-extern dv_demo dv_demo_init( valerie_parser );
-extern void dv_demo_run( dv_demo );
-extern void dv_demo_close( dv_demo );
+extern client client_init( mvcp_parser );
+extern void client_run( client );
+extern void client_close( client );
 
 #endif
index 42718df..b6a58c9 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * io.c -- Valerie client demo input/output
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * io.c -- MVCP client input/output
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
index f4ac23a..321ff2f 100644 (file)
@@ -18,8 +18,8 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef _DEMO_IO_H_
-#define _DEMO_IO_H_
+#ifndef _MVCP_CLIENT_IO_H_
+#define _MVCP_CLIENT_IO_H_
 
 extern char *chomp( char * );
 extern char *trim( char * );
index 8171179..3da69e6 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * remote.c -- Remote Valerie client demo
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * remote.c -- Remote MVCP client
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <stdint.h>
 
-#include <valerie/valerie_remote.h>
+#include <mvcp/mvcp_remote.h>
 
 /* Application header files */
 #include "client.h"
 /** Connect to a remote server.
 */
 
-static valerie_parser create_parser( )
+static mvcp_parser create_parser( )
 {
        char server[ 132 ];
        int port;
-       valerie_parser parser = NULL;
+       mvcp_parser parser = NULL;
 
        printf( "Connecting to a Server\n\n" );
 
@@ -46,7 +46,7 @@ static valerie_parser create_parser( )
                printf( "Port        [5250]: " );
 
                if ( get_int( &port, 5250 ) != NULL )
-                       parser = valerie_parser_init_remote( server, port );
+                       parser = mvcp_parser_init_remote( server, port );
        }
 
        printf( "\n" );
@@ -59,14 +59,14 @@ static valerie_parser create_parser( )
 
 int main( int argc, char **argv )
 {
-       valerie_parser parser = create_parser( );
+       mvcp_parser parser = create_parser( );
 
        if ( parser != NULL )
        {
-               dv_demo demo = dv_demo_init( parser );
-               dv_demo_run( demo );
-               dv_demo_close( demo );
-               valerie_parser_close( parser );
+               client demo = client_init( parser );
+               client_run( demo );
+               client_close( demo );
+               mvcp_parser_close( parser );
        }
 
        return 0;