Fix build of melted.
[melted] / src / melted / melted_commands.c
index c95a4d0..c865a3d 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * global_commands.c
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * melted_commands.c - global commands
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Dan Dennedy <dan@dennedy.org>
  *
  * This program is free software; you can redistribute it and/or modify
 #include <dirent.h>
 #include <pthread.h>
 
-#include "miracle_unit.h"
-#include "miracle_commands.h"
-#include "miracle_log.h"
+#include "melted_unit.h"
+#include "melted_commands.h"
+#include "melted_log.h"
 
-static miracle_unit g_units[MAX_UNITS];
+static melted_unit g_units[MAX_UNITS];
 
 
-/** Return the miracle_unit given a numeric index.
+/** Return the melted_unit given a numeric index.
 */
 
-miracle_unit miracle_get_unit( int n )
+melted_unit melted_get_unit( int n )
 {
        if (n < MAX_UNITS)
                return g_units[n];
@@ -47,19 +47,19 @@ miracle_unit miracle_get_unit( int n )
                return NULL;
 }
 
-/** Destroy the miracle_unit given its numeric index.
+/** Destroy the melted_unit given its numeric index.
 */
 
-void miracle_delete_unit( int n )
+void melted_delete_unit( int n )
 {
        if (n < MAX_UNITS)
        {
-               miracle_unit unit = miracle_get_unit(n);
+               melted_unit unit = melted_get_unit(n);
                if (unit != NULL)
                {
-                       miracle_unit_close( unit );
+                       melted_unit_close( unit );
                        g_units[ n ] = NULL;
-                       miracle_log( LOG_NOTICE, "Deleted unit U%d.", n ); 
+                       melted_log( LOG_NOTICE, "Deleted unit U%d.", n ); 
                }
        }
 }
@@ -67,22 +67,22 @@ void miracle_delete_unit( int n )
 /** Destroy all allocated units on the server.
 */
 
-void miracle_delete_all_units( void )
+void melted_delete_all_units( void )
 {
        int i;
        for (i = 0; i < MAX_UNITS; i++)
        {
-               if ( miracle_get_unit(i) != NULL )
+               if ( melted_get_unit(i) != NULL )
                {
-                       miracle_unit_close( miracle_get_unit(i) );
-                       miracle_log( LOG_NOTICE, "Deleted unit U%d.", i ); 
+                       melted_unit_close( melted_get_unit(i) );
+                       melted_log( LOG_NOTICE, "Deleted unit U%d.", i ); 
                }
        }
 }
 
-/** Add a DV virtual vtr to the server.
+/** Add a virtual vtr to the server.
 */
-response_codes miracle_add_unit( command_argument cmd_arg )
+response_codes melted_add_unit( command_argument cmd_arg )
 {
        int i = 0;
        for ( i = 0; i < MAX_UNITS; i ++ )
@@ -92,15 +92,15 @@ response_codes miracle_add_unit( command_argument cmd_arg )
        if ( i < MAX_UNITS )
        {
                char *arg = cmd_arg->argument;
-               g_units[ i ] = miracle_unit_init( i, arg );
+               g_units[ i ] = melted_unit_init( i, arg );
                if ( g_units[ i ] != NULL )
                {
-                       miracle_unit_set_notifier( g_units[ i ], valerie_parser_get_notifier( cmd_arg->parser ), cmd_arg->root_dir );
-                       valerie_response_printf( cmd_arg->response, 10, "U%1d\n\n", i );
+                       melted_unit_set_notifier( g_units[ i ], mvcp_parser_get_notifier( cmd_arg->parser ), cmd_arg->root_dir );
+                       mvcp_response_printf( cmd_arg->response, 10, "U%1d\n\n", i );
                }
                return g_units[ i ] != NULL ? RESPONSE_SUCCESS_N : RESPONSE_ERROR;
        }
-       valerie_response_printf( cmd_arg->response, 1024, "no more units can be created\n\n" );
+       mvcp_response_printf( cmd_arg->response, 1024, "no more units can be created\n\n" );
 
        return RESPONSE_ERROR;
 }
@@ -108,7 +108,7 @@ response_codes miracle_add_unit( command_argument cmd_arg )
 
 /** List all AV/C nodes on the bus.
 */
-response_codes miracle_list_nodes( command_argument cmd_arg )
+response_codes melted_list_nodes( command_argument cmd_arg )
 {
        response_codes error = RESPONSE_SUCCESS_N;
        return error;
@@ -117,24 +117,24 @@ response_codes miracle_list_nodes( command_argument cmd_arg )
 
 /** List units already added to server.
 */
-response_codes miracle_list_units( command_argument cmd_arg )
+response_codes melted_list_units( command_argument cmd_arg )
 {
        response_codes error = RESPONSE_SUCCESS_N;
        int i = 0;
 
        for ( i = 0; i < MAX_UNITS; i ++ )
        {
-               miracle_unit unit = miracle_get_unit( i );
+               melted_unit unit = melted_get_unit( i );
                if ( unit != NULL )
                {
                        mlt_properties properties = unit->properties;
                        char *constructor = mlt_properties_get( properties, "constructor" );
                        int node = mlt_properties_get_int( properties, "node" );
                        int online = !mlt_properties_get_int( properties, "offline" );
-                       valerie_response_printf( cmd_arg->response, 1024, "U%d %02d %s %d\n", i, node, constructor, online );
+                       mvcp_response_printf( cmd_arg->response, 1024, "U%d %02d %s %d\n", i, node, constructor, online );
                }
        }
-       valerie_response_printf( cmd_arg->response, 1024, "\n" );
+       mvcp_response_printf( cmd_arg->response, 1024, "\n" );
 
        return error;
 }
@@ -146,7 +146,7 @@ static int filter_files( const struct dirent *de )
 
 /** List clips in a directory.
 */
-response_codes miracle_list_clips( command_argument cmd_arg )
+response_codes melted_list_clips( command_argument cmd_arg )
 {
        response_codes error = RESPONSE_BAD_FILE;
        const char *dir_name = (const char*) cmd_arg->argument;
@@ -166,19 +166,19 @@ response_codes miracle_list_clips( command_argument cmd_arg )
                {
                        snprintf( fullname, 1023, "%s%s/%s", cmd_arg->root_dir, dir_name, de[i]->d_name );
                        if ( stat( fullname, &info ) == 0 && S_ISDIR( info.st_mode ) )
-                               valerie_response_printf( cmd_arg->response, 1024, "\"%s/\"\n", de[i]->d_name );
+                               mvcp_response_printf( cmd_arg->response, 1024, "\"%s/\"\n", de[i]->d_name );
                }
                for (i = 0; i < n; i++ )
                {
                        snprintf( fullname, 1023, "%s%s/%s", cmd_arg->root_dir, dir_name, de[i]->d_name );
                        if ( lstat( fullname, &info ) == 0 && 
                                 ( S_ISREG( info.st_mode ) || S_ISLNK( info.st_mode ) || ( strstr( fullname, ".clip" ) && info.st_mode | S_IXUSR ) ) )
-                               valerie_response_printf( cmd_arg->response, 1024, "\"%s\" %llu\n", de[i]->d_name, (unsigned long long) info.st_size );
+                               mvcp_response_printf( cmd_arg->response, 1024, "\"%s\" %llu\n", de[i]->d_name, (unsigned long long) info.st_size );
                        free( de[ i ] );
                }
                free( de );
                closedir( dir );
-               valerie_response_write( cmd_arg->response, "\n", 1 );
+               mvcp_response_write( cmd_arg->response, "\n", 1 );
        }
 
        return error;
@@ -187,7 +187,7 @@ response_codes miracle_list_clips( command_argument cmd_arg )
 /** Set a server configuration property.
 */
 
-response_codes miracle_set_global_property( command_argument cmd_arg )
+response_codes melted_set_global_property( command_argument cmd_arg )
 {
        char *key = (char*) cmd_arg->argument;
        char *value = NULL;
@@ -197,7 +197,7 @@ response_codes miracle_set_global_property( command_argument cmd_arg )
                return RESPONSE_OUT_OF_RANGE;
        *value = 0;
        value++;
-       miracle_log( LOG_DEBUG, "SET %s = %s", key, value );
+       melted_log( LOG_DEBUG, "SET %s = %s", key, value );
 
        if ( strncasecmp( key, "root", 1024) == 0 )
        {
@@ -208,7 +208,7 @@ response_codes miracle_set_global_property( command_argument cmd_arg )
                for (i = 0; i < MAX_UNITS; i++)
                {
                        if (g_units[i] != NULL)
-                               miracle_unit_terminate( g_units[i] );
+                               melted_unit_terminate( g_units[i] );
                }
 
                /* set the property */
@@ -230,13 +230,13 @@ response_codes miracle_set_global_property( command_argument cmd_arg )
 /** Get a server configuration property.
 */
 
-response_codes miracle_get_global_property( command_argument cmd_arg )
+response_codes melted_get_global_property( command_argument cmd_arg )
 {
        char *key = (char*) cmd_arg->argument;
 
        if ( strncasecmp( key, "root", 1024) == 0 )
        {
-               valerie_response_write( cmd_arg->response, cmd_arg->root_dir, strlen(cmd_arg->root_dir) );
+               mvcp_response_write( cmd_arg->response, cmd_arg->root_dir, strlen(cmd_arg->root_dir) );
                return RESPONSE_SUCCESS_1;
        }
        else