X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmvcp%2Fmvcp_status.c;h=209290f9e1a0a635e10ab5510961480a9d19f41b;hb=f9b1c1ed4abd53e375c84736f24a5bb54c764fae;hp=963a3c9c1c4189c2454fa66ad0a3c81c71457689;hpb=27f0329aa8f434794f1f18e018fc3221e58b77a4;p=melted diff --git a/src/mvcp/mvcp_status.c b/src/mvcp/mvcp_status.c index 963a3c9..209290f 100644 --- a/src/mvcp/mvcp_status.c +++ b/src/mvcp/mvcp_status.c @@ -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 * * This library is free software; you can redistribute it and/or @@ -24,65 +24,65 @@ #include /* 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 ) ); }