melted only supports explicit profiles, not auto-profile
[melted] / src / mvcp / mvcp_status.c
index 963a3c9..209290f 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * valerie_status.c -- Unit Status Handling
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_status.c -- Unit Status Handling
+ * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This library is free software; you can redistribute it and/or
 #include <string.h>
 
 /* Application header files */
-#include "valerie_status.h"
-#include "valerie_tokeniser.h"
-#include "valerie_util.h"
+#include "mvcp_status.h"
+#include "mvcp_tokeniser.h"
+#include "mvcp_util.h"
 
 /** Parse a unit status string.
 */
 
-void valerie_status_parse( valerie_status status, char *text )
+void mvcp_status_parse( mvcp_status status, char *text )
 {
-       valerie_tokeniser tokeniser = valerie_tokeniser_init( );
-       if ( valerie_tokeniser_parse_new( tokeniser, text, " " ) == 17 )
+       mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+       if ( mvcp_tokeniser_parse_new( tokeniser, text, " " ) == 17 )
        {
-               status->unit = atoi( valerie_tokeniser_get_string( tokeniser, 0 ) );
-               strncpy( status->clip, valerie_util_strip( valerie_tokeniser_get_string( tokeniser, 2 ), '\"' ), sizeof( status->clip ) );
-               status->position = atol( valerie_tokeniser_get_string( tokeniser, 3 ) );
-               status->speed = atoi( valerie_tokeniser_get_string( tokeniser, 4 ) );
-               status->fps = atof( valerie_tokeniser_get_string( tokeniser, 5 ) );
-               status->in = atol( valerie_tokeniser_get_string( tokeniser, 6 ) );
-               status->out = atol( valerie_tokeniser_get_string( tokeniser, 7 ) );
-               status->length = atol( valerie_tokeniser_get_string( tokeniser, 8 ) );
-
-               strncpy( status->tail_clip, valerie_util_strip( valerie_tokeniser_get_string( tokeniser, 9 ), '\"' ), sizeof( status->tail_clip ) );
-               status->tail_position = atol( valerie_tokeniser_get_string( tokeniser, 10 ) );
-               status->tail_in = atol( valerie_tokeniser_get_string( tokeniser, 11 ) );
-               status->tail_out = atol( valerie_tokeniser_get_string( tokeniser, 12 ) );
-               status->tail_length = atol( valerie_tokeniser_get_string( tokeniser, 13 ) );
-               status->seek_flag = atoi( valerie_tokeniser_get_string( tokeniser, 14 ) );
-               status->generation = atoi( valerie_tokeniser_get_string( tokeniser, 15 ) );
-               status->clip_index = atoi( valerie_tokeniser_get_string( tokeniser, 16 ) );
-
-               if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "unknown" ) )
+               status->unit = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) );
+               strncpy( status->clip, mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 2 ), '\"' ), sizeof( status->clip ) );
+               status->position = atol( mvcp_tokeniser_get_string( tokeniser, 3 ) );
+               status->speed = atoi( mvcp_tokeniser_get_string( tokeniser, 4 ) );
+               status->fps = atof( mvcp_tokeniser_get_string( tokeniser, 5 ) );
+               status->in = atol( mvcp_tokeniser_get_string( tokeniser, 6 ) );
+               status->out = atol( mvcp_tokeniser_get_string( tokeniser, 7 ) );
+               status->length = atol( mvcp_tokeniser_get_string( tokeniser, 8 ) );
+
+               strncpy( status->tail_clip, mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 9 ), '\"' ), sizeof( status->tail_clip ) );
+               status->tail_position = atol( mvcp_tokeniser_get_string( tokeniser, 10 ) );
+               status->tail_in = atol( mvcp_tokeniser_get_string( tokeniser, 11 ) );
+               status->tail_out = atol( mvcp_tokeniser_get_string( tokeniser, 12 ) );
+               status->tail_length = atol( mvcp_tokeniser_get_string( tokeniser, 13 ) );
+               status->seek_flag = atoi( mvcp_tokeniser_get_string( tokeniser, 14 ) );
+               status->generation = atoi( mvcp_tokeniser_get_string( tokeniser, 15 ) );
+               status->clip_index = atoi( mvcp_tokeniser_get_string( tokeniser, 16 ) );
+
+               if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "unknown" ) )
                        status->status = unit_unknown;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "undefined" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "undefined" ) )
                        status->status = unit_undefined;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "offline" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "offline" ) )
                        status->status = unit_offline;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "not_loaded" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "not_loaded" ) )
                        status->status = unit_not_loaded;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "stopped" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "stopped" ) )
                        status->status = unit_stopped;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "paused" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "paused" ) )
                        status->status = unit_paused;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "playing" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "playing" ) )
                        status->status = unit_playing;
-               else if ( !strcmp( valerie_tokeniser_get_string( tokeniser, 1 ), "disconnected" ) )
+               else if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), "disconnected" ) )
                        status->status = unit_disconnected;
        }
        else
        {
-               memset( status, 0, sizeof( valerie_status_t ) );
+               memset( status, 0, sizeof( mvcp_status_t ) );
                fprintf( stderr, "Status thread changed?\n" );
        }
-       valerie_tokeniser_close( tokeniser );
+       mvcp_tokeniser_close( tokeniser );
 }
 
 /** Serialise a status into a string.
 */
 
-char *valerie_status_serialise( valerie_status status, char *text, int length )
+char *mvcp_status_serialise( mvcp_status status, char *text, int length )
 {
        const char *status_string = NULL;
 
@@ -146,15 +146,15 @@ char *valerie_status_serialise( valerie_status status, char *text, int length )
 /** Compare two status codes for changes.
 */
 
-int valerie_status_compare( valerie_status status1, valerie_status status2 )
+int mvcp_status_compare( mvcp_status status1, mvcp_status status2 )
 {
-       return memcmp( status1, status2, sizeof( valerie_status_t ) );
+       return memcmp( status1, status2, sizeof( mvcp_status_t ) );
 }
 
 /** Copy status code info from dest to src.
 */
 
-valerie_status valerie_status_copy( valerie_status dest, valerie_status src )
+mvcp_status mvcp_status_copy( mvcp_status dest, mvcp_status src )
 {
-       return memcpy( dest, src, sizeof( valerie_status_t ) );
+       return memcpy( dest, src, sizeof( mvcp_status_t ) );
 }