-SUBDIRS = src/framework \
- src/inigo \
- src/valerie \
- src/miracle \
- src/humperdink \
- src/albino \
- src/modules \
- profiles
+SUBDIRS = src/mvcp \
+ src/melted \
+ src/melted-client \
+ src/melted-console \
+ src/modules
all clean:
list='$(SUBDIRS)'; \
install -d "$(DESTDIR)$(prefix)/share/mlt"
install -c -m 755 mlt-config "$(DESTDIR)$(bindir)"
install -c -m 644 *.pc "$(DESTDIR)$(libdir)/pkgconfig"
- install -m 644 packages.dat "$(DESTDIR)$(prefix)/share/mlt/"
list='$(SUBDIRS)'; \
for subdir in $$list; do \
$(MAKE) DESTDIR=$(DESTDIR) -C $$subdir $@ || exit 1; \
done; \
if test -z "$(DESTDIR)"; then \
- /sbin/ldconfig 2> /dev/null || true; \
+ /sbin/ldconfig -n "$(DESTDIR)$(libdir)" 2> /dev/null || true; \
fi
uninstall:
- rm -f "$(DESTDIR)$(bindir)"/mlt-config
rm -f "$(DESTDIR)$(libdir)"/pkgconfig/mlt-*.pc
list='$(SUBDIRS)'; \
for subdir in $$list; do \
$(MAKE) DESTDIR=$(DESTDIR) -C $$subdir $@ || exit 1; \
done
- rm -rf "$(DESTDIR)$(prefix)/include/mlt"
- rm -rf "$(DESTDIR)$(prefix)/share/mlt"
dist:
- [ -d "mlt-$(version)" ] && rm -rf "mlt-$(version)" || echo
- svn export http://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt "mlt-$(version)"
- tar -cvzf "mlt-$(version).tar.gz" "mlt-$(version)"
+ git archive --format=tar --prefix=melted-$(version)/ HEAD | gzip >melted-$(version).tar.gz
/*
- * valerie.c -- High Level Client API for miracle
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp.c -- High Level Client API for Melted
+ * 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 <stdarg.h>
/* Application header files */
-#include "valerie.h"
-#include "valerie_tokeniser.h"
-#include "valerie_util.h"
+#include "mvcp.h"
+#include "mvcp_tokeniser.h"
+#include "mvcp_util.h"
-/** Initialise the valerie structure.
+/** Initialise the mvcp structure.
*/
-valerie valerie_init( valerie_parser parser )
+mvcp mvcp_init( mvcp_parser parser )
{
- valerie this = malloc( sizeof( valerie_t ) );
+ mvcp this = malloc( sizeof( mvcp_t ) );
if ( this != NULL )
{
- memset( this, 0, sizeof( valerie_t ) );
+ memset( this, 0, sizeof( mvcp_t ) );
this->parser = parser;
}
return this;
/** Set the response structure associated to the last command.
*/
-static void valerie_set_last_response( valerie this, valerie_response response )
+static void mvcp_set_last_response( mvcp this, mvcp_response response )
{
if ( this != NULL )
{
if ( this->last_response != NULL )
- valerie_response_close( this->last_response );
+ mvcp_response_close( this->last_response );
this->last_response = response;
}
}
/** Connect to the parser.
*/
-valerie_error_code valerie_connect( valerie this )
+mvcp_error_code mvcp_connect( mvcp this )
{
- valerie_error_code error = valerie_server_unavailable;
- valerie_response response = valerie_parser_connect( this->parser );
+ mvcp_error_code error = mvcp_server_unavailable;
+ mvcp_response response = mvcp_parser_connect( this->parser );
if ( response != NULL )
{
- valerie_set_last_response( this, response );
- if ( valerie_response_get_error_code( response ) == 100 )
- error = valerie_ok;
+ mvcp_set_last_response( this, response );
+ if ( mvcp_response_get_error_code( response ) == 100 )
+ error = mvcp_ok;
}
return error;
}
/** Interpret a non-context sensitive error code.
*/
-static valerie_error_code valerie_get_error_code( valerie this, valerie_response response )
+static mvcp_error_code mvcp_get_error_code( mvcp this, mvcp_response response )
{
- valerie_error_code error = valerie_server_unavailable;
- switch( valerie_response_get_error_code( response ) )
+ mvcp_error_code error = mvcp_server_unavailable;
+ switch( mvcp_response_get_error_code( response ) )
{
case -1:
- error = valerie_server_unavailable;
+ error = mvcp_server_unavailable;
break;
case -2:
- error = valerie_no_response;
+ error = mvcp_no_response;
break;
case 200:
case 201:
case 202:
- error = valerie_ok;
+ error = mvcp_ok;
break;
case 400:
- error = valerie_invalid_command;
+ error = mvcp_invalid_command;
break;
case 401:
- error = valerie_server_timeout;
+ error = mvcp_server_timeout;
break;
case 402:
- error = valerie_missing_argument;
+ error = mvcp_missing_argument;
break;
case 403:
- error = valerie_unit_unavailable;
+ error = mvcp_unit_unavailable;
break;
case 404:
- error = valerie_invalid_file;
+ error = mvcp_invalid_file;
break;
default:
case 500:
- error = valerie_unknown_error;
+ error = mvcp_unknown_error;
break;
}
return error;
/** Execute a command.
*/
-valerie_error_code valerie_execute( valerie this, size_t size, const char *format, ... )
+mvcp_error_code mvcp_execute( mvcp this, size_t size, const char *format, ... )
{
- valerie_error_code error = valerie_server_unavailable;
+ mvcp_error_code error = mvcp_server_unavailable;
char *command = malloc( size );
if ( this != NULL && command != NULL )
{
va_start( list, format );
if ( vsnprintf( command, size, format, list ) != 0 )
{
- valerie_response response = valerie_parser_execute( this->parser, command );
- valerie_set_last_response( this, response );
- error = valerie_get_error_code( this, response );
+ mvcp_response response = mvcp_parser_execute( this->parser, command );
+ mvcp_set_last_response( this, response );
+ error = mvcp_get_error_code( this, response );
}
else
{
- error = valerie_invalid_command;
+ error = mvcp_invalid_command;
}
va_end( list );
}
else
{
- error = valerie_malloc_failed;
+ error = mvcp_malloc_failed;
}
free( command );
return error;
/** Execute a command.
*/
-valerie_error_code valerie_receive( valerie this, char *doc, size_t size, const char *format, ... )
+mvcp_error_code mvcp_receive( mvcp this, char *doc, size_t size, const char *format, ... )
{
- valerie_error_code error = valerie_server_unavailable;
+ mvcp_error_code error = mvcp_server_unavailable;
char *command = malloc( size );
if ( this != NULL && command != NULL )
{
va_start( list, format );
if ( vsnprintf( command, size, format, list ) != 0 )
{
- valerie_response response = valerie_parser_received( this->parser, command, doc );
- valerie_set_last_response( this, response );
- error = valerie_get_error_code( this, response );
+ mvcp_response response = mvcp_parser_received( this->parser, command, doc );
+ mvcp_set_last_response( this, response );
+ error = mvcp_get_error_code( this, response );
}
else
{
- error = valerie_invalid_command;
+ error = mvcp_invalid_command;
}
va_end( list );
}
else
{
- error = valerie_malloc_failed;
+ error = mvcp_malloc_failed;
}
free( command );
return error;
/** Execute a command.
*/
-valerie_error_code valerie_push( valerie this, mlt_service service, size_t size, const char *format, ... )
+mvcp_error_code mvcp_push( mvcp this, mlt_service service, size_t size, const char *format, ... )
{
- valerie_error_code error = valerie_server_unavailable;
+ mvcp_error_code error = mvcp_server_unavailable;
char *command = malloc( size );
if ( this != NULL && command != NULL )
{
va_start( list, format );
if ( vsnprintf( command, size, format, list ) != 0 )
{
- valerie_response response = valerie_parser_push( this->parser, command, service );
- valerie_set_last_response( this, response );
- error = valerie_get_error_code( this, response );
+ mvcp_response response = mvcp_parser_push( this->parser, command, service );
+ mvcp_set_last_response( this, response );
+ error = mvcp_get_error_code( this, response );
}
else
{
- error = valerie_invalid_command;
+ error = mvcp_invalid_command;
}
va_end( list );
}
else
{
- error = valerie_malloc_failed;
+ error = mvcp_malloc_failed;
}
free( command );
return error;
/** Set a global property.
*/
-valerie_error_code valerie_set( valerie this, char *property, char *value )
+mvcp_error_code mvcp_set( mvcp this, char *property, char *value )
{
- return valerie_execute( this, 1024, "SET %s=%s", property, value );
+ return mvcp_execute( this, 1024, "SET %s=%s", property, value );
}
/** Get a global property.
*/
-valerie_error_code valerie_get( valerie this, char *property, char *value, int length )
+mvcp_error_code mvcp_get( mvcp this, char *property, char *value, int length )
{
- valerie_error_code error = valerie_execute( this, 1024, "GET %s", property );
- if ( error == valerie_ok )
+ mvcp_error_code error = mvcp_execute( this, 1024, "GET %s", property );
+ if ( error == mvcp_ok )
{
- valerie_response response = valerie_get_last_response( this );
- strncpy( value, valerie_response_get_line( response, 1 ), length );
+ mvcp_response response = mvcp_get_last_response( this );
+ strncpy( value, mvcp_response_get_line( response, 1 ), length );
}
return error;
}
/** Run a script.
*/
-valerie_error_code valerie_run( valerie this, char *file )
+mvcp_error_code mvcp_run( mvcp this, char *file )
{
- return valerie_execute( this, 10240, "RUN \"%s\"", file );
+ return mvcp_execute( this, 10240, "RUN \"%s\"", file );
}
/** Add a unit.
*/
-valerie_error_code valerie_unit_add( valerie this, char *guid, int *unit )
+mvcp_error_code mvcp_unit_add( mvcp this, char *guid, int *unit )
{
- valerie_error_code error = valerie_execute( this, 1024, "UADD %s", guid );
- if ( error == valerie_ok )
+ mvcp_error_code error = mvcp_execute( this, 1024, "UADD %s", guid );
+ if ( error == mvcp_ok )
{
- int length = valerie_response_count( this->last_response );
- char *line = valerie_response_get_line( this->last_response, length - 1 );
+ int length = mvcp_response_count( this->last_response );
+ char *line = mvcp_response_get_line( this->last_response, length - 1 );
if ( line == NULL || sscanf( line, "U%d", unit ) != 1 )
- error = valerie_unit_creation_failed;
+ error = mvcp_unit_creation_failed;
}
else
{
- if ( error == valerie_unknown_error )
- error = valerie_unit_creation_failed;
+ if ( error == mvcp_unknown_error )
+ error = mvcp_unit_creation_failed;
}
return error;
}
/** Load a file on the specified unit.
*/
-valerie_error_code valerie_unit_load( valerie this, int unit, char *file )
+mvcp_error_code mvcp_unit_load( mvcp this, int unit, char *file )
{
- return valerie_execute( this, 10240, "LOAD U%d \"%s\"", unit, file );
+ return mvcp_execute( this, 10240, "LOAD U%d \"%s\"", unit, file );
}
-static void valerie_interpret_clip_offset( char *output, valerie_clip_offset offset, int clip )
+static void mvcp_interpret_clip_offset( char *output, mvcp_clip_offset offset, int clip )
{
switch( offset )
{
- case valerie_absolute:
+ case mvcp_absolute:
sprintf( output, "%d", clip );
break;
- case valerie_relative:
+ case mvcp_relative:
if ( clip < 0 )
sprintf( output, "%d", clip );
else
/** Load a file on the specified unit with the specified in/out points.
*/
-valerie_error_code valerie_unit_load_clipped( valerie this, int unit, char *file, int32_t in, int32_t out )
+mvcp_error_code mvcp_unit_load_clipped( mvcp this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "LOAD U%d \"%s\" %d %d", unit, file, in, out );
+ return mvcp_execute( this, 10240, "LOAD U%d \"%s\" %d %d", unit, file, in, out );
}
/** Load a file on the specified unit at the end of the current pump.
*/
-valerie_error_code valerie_unit_load_back( valerie this, int unit, char *file )
+mvcp_error_code mvcp_unit_load_back( mvcp this, int unit, char *file )
{
- return valerie_execute( this, 10240, "LOAD U%d \"!%s\"", unit, file );
+ return mvcp_execute( this, 10240, "LOAD U%d \"!%s\"", unit, file );
}
/** Load a file on the specified unit at the end of the pump with the specified in/out points.
*/
-valerie_error_code valerie_unit_load_back_clipped( valerie this, int unit, char *file, int32_t in, int32_t out )
+mvcp_error_code mvcp_unit_load_back_clipped( mvcp this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "LOAD U%d \"!%s\" %d %d", unit, file, in, out );
+ return mvcp_execute( this, 10240, "LOAD U%d \"!%s\" %d %d", unit, file, in, out );
}
/** Append a file on the specified unit.
*/
-valerie_error_code valerie_unit_append( valerie this, int unit, char *file, int32_t in, int32_t out )
+mvcp_error_code mvcp_unit_append( mvcp this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "APND U%d \"%s\" %d %d", unit, file, in, out );
+ return mvcp_execute( this, 10240, "APND U%d \"%s\" %d %d", unit, file, in, out );
}
/** Push a service on to a unit.
*/
-valerie_error_code valerie_unit_receive( valerie this, int unit, char *command, char *doc )
+mvcp_error_code mvcp_unit_receive( mvcp this, int unit, char *command, char *doc )
{
- return valerie_receive( this, doc, 10240, "PUSH U%d %s", unit, command );
+ return mvcp_receive( this, doc, 10240, "PUSH U%d %s", unit, command );
}
/** Push a service on to a unit.
*/
-valerie_error_code valerie_unit_push( valerie this, int unit, char *command, mlt_service service )
+mvcp_error_code mvcp_unit_push( mvcp this, int unit, char *command, mlt_service service )
{
- return valerie_push( this, service, 10240, "PUSH U%d %s", unit, command );
+ return mvcp_push( this, service, 10240, "PUSH U%d %s", unit, command );
}
/** Clean the unit - this function removes all but the currently playing clip.
*/
-valerie_error_code valerie_unit_clean( valerie this, int unit )
+mvcp_error_code mvcp_unit_clean( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "CLEAN U%d", unit );
+ return mvcp_execute( this, 1024, "CLEAN U%d", unit );
}
/** Clear the unit - this function removes all clips.
*/
-valerie_error_code valerie_unit_clear( valerie this, int unit )
+mvcp_error_code mvcp_unit_clear( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "CLEAR U%d", unit );
+ return mvcp_execute( this, 1024, "CLEAR U%d", unit );
}
/** Wipe the unit - this function removes all clips before the current one.
*/
-valerie_error_code valerie_unit_wipe( valerie this, int unit )
+mvcp_error_code mvcp_unit_wipe( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "WIPE U%d", unit );
+ return mvcp_execute( this, 1024, "WIPE U%d", unit );
}
/** Move clips on the units playlist.
*/
-valerie_error_code valerie_unit_clip_move( valerie this, int unit, valerie_clip_offset src_offset, int src, valerie_clip_offset dest_offset, int dest )
+mvcp_error_code mvcp_unit_clip_move( mvcp this, int unit, mvcp_clip_offset src_offset, int src, mvcp_clip_offset dest_offset, int dest )
{
char temp1[ 100 ];
char temp2[ 100 ];
- valerie_interpret_clip_offset( temp1, src_offset, src );
- valerie_interpret_clip_offset( temp2, dest_offset, dest );
- return valerie_execute( this, 1024, "MOVE U%d %s %s", unit, temp1, temp2 );
+ mvcp_interpret_clip_offset( temp1, src_offset, src );
+ mvcp_interpret_clip_offset( temp2, dest_offset, dest );
+ return mvcp_execute( this, 1024, "MOVE U%d %s %s", unit, temp1, temp2 );
}
/** Remove clip at the specified position.
*/
-valerie_error_code valerie_unit_clip_remove( valerie this, int unit, valerie_clip_offset offset, int clip )
+mvcp_error_code mvcp_unit_clip_remove( mvcp this, int unit, mvcp_clip_offset offset, int clip )
{
char temp[ 100 ];
- valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "REMOVE U%d %s", unit, temp );
+ mvcp_interpret_clip_offset( temp, offset, clip );
+ return mvcp_execute( this, 1024, "REMOVE U%d %s", unit, temp );
}
/** Remove the currently playing clip.
*/
-valerie_error_code valerie_unit_remove_current_clip( valerie this, int unit )
+mvcp_error_code mvcp_unit_remove_current_clip( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "REMOVE U%d", unit );
+ return mvcp_execute( this, 1024, "REMOVE U%d", unit );
}
/** Insert clip at the specified position.
*/
-valerie_error_code valerie_unit_clip_insert( valerie this, int unit, valerie_clip_offset offset, int clip, char *file, int32_t in, int32_t out )
+mvcp_error_code mvcp_unit_clip_insert( mvcp this, int unit, mvcp_clip_offset offset, int clip, char *file, int32_t in, int32_t out )
{
char temp[ 100 ];
- valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "INSERT U%d \"%s\" %s %d %d", unit, file, temp, in, out );
+ mvcp_interpret_clip_offset( temp, offset, clip );
+ return mvcp_execute( this, 1024, "INSERT U%d \"%s\" %s %d %d", unit, file, temp, in, out );
}
/** Play the unit at normal speed.
*/
-valerie_error_code valerie_unit_play( valerie this, int unit )
+mvcp_error_code mvcp_unit_play( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "PLAY U%d 1000", unit );
+ return mvcp_execute( this, 1024, "PLAY U%d 1000", unit );
}
/** Play the unit at specified speed.
*/
-valerie_error_code valerie_unit_play_at_speed( valerie this, int unit, int speed )
+mvcp_error_code mvcp_unit_play_at_speed( mvcp this, int unit, int speed )
{
- return valerie_execute( this, 10240, "PLAY U%d %d", unit, speed );
+ return mvcp_execute( this, 10240, "PLAY U%d %d", unit, speed );
}
/** Stop playback on the specified unit.
*/
-valerie_error_code valerie_unit_stop( valerie this, int unit )
+mvcp_error_code mvcp_unit_stop( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "STOP U%d", unit );
+ return mvcp_execute( this, 1024, "STOP U%d", unit );
}
/** Pause playback on the specified unit.
*/
-valerie_error_code valerie_unit_pause( valerie this, int unit )
+mvcp_error_code mvcp_unit_pause( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "PAUSE U%d", unit );
+ return mvcp_execute( this, 1024, "PAUSE U%d", unit );
}
/** Rewind the specified unit.
*/
-valerie_error_code valerie_unit_rewind( valerie this, int unit )
+mvcp_error_code mvcp_unit_rewind( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "REW U%d", unit );
+ return mvcp_execute( this, 1024, "REW U%d", unit );
}
/** Fast forward the specified unit.
*/
-valerie_error_code valerie_unit_fast_forward( valerie this, int unit )
+mvcp_error_code mvcp_unit_fast_forward( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "FF U%d", unit );
+ return mvcp_execute( this, 1024, "FF U%d", unit );
}
/** Step by the number of frames on the specified unit.
*/
-valerie_error_code valerie_unit_step( valerie this, int unit, int32_t step )
+mvcp_error_code mvcp_unit_step( mvcp this, int unit, int32_t step )
{
- return valerie_execute( this, 1024, "STEP U%d %d", unit, step );
+ return mvcp_execute( this, 1024, "STEP U%d %d", unit, step );
}
/** Goto the specified frame on the specified unit.
*/
-valerie_error_code valerie_unit_goto( valerie this, int unit, int32_t position )
+mvcp_error_code mvcp_unit_goto( mvcp this, int unit, int32_t position )
{
- return valerie_execute( this, 1024, "GOTO U%d %d", unit, position );
+ return mvcp_execute( this, 1024, "GOTO U%d %d", unit, position );
}
/** Goto the specified frame in the clip on the specified unit.
*/
-valerie_error_code valerie_unit_clip_goto( valerie this, int unit, valerie_clip_offset offset, int clip, int32_t position )
+mvcp_error_code mvcp_unit_clip_goto( mvcp this, int unit, mvcp_clip_offset offset, int clip, int32_t position )
{
char temp[ 100 ];
- valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "GOTO U%d %d %s", unit, position, temp );
+ mvcp_interpret_clip_offset( temp, offset, clip );
+ return mvcp_execute( this, 1024, "GOTO U%d %d %s", unit, position, temp );
}
/** Set the in point of the loaded file on the specified unit.
*/
-valerie_error_code valerie_unit_set_in( valerie this, int unit, int32_t in )
+mvcp_error_code mvcp_unit_set_in( mvcp this, int unit, int32_t in )
{
- return valerie_execute( this, 1024, "SIN U%d %d", unit, in );
+ return mvcp_execute( this, 1024, "SIN U%d %d", unit, in );
}
/** Set the in point of the clip on the specified unit.
*/
-valerie_error_code valerie_unit_clip_set_in( valerie this, int unit, valerie_clip_offset offset, int clip, int32_t in )
+mvcp_error_code mvcp_unit_clip_set_in( mvcp this, int unit, mvcp_clip_offset offset, int clip, int32_t in )
{
char temp[ 100 ];
- valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "SIN U%d %d %s", unit, in, temp );
+ mvcp_interpret_clip_offset( temp, offset, clip );
+ return mvcp_execute( this, 1024, "SIN U%d %d %s", unit, in, temp );
}
/** Set the out point of the loaded file on the specified unit.
*/
-valerie_error_code valerie_unit_set_out( valerie this, int unit, int32_t out )
+mvcp_error_code mvcp_unit_set_out( mvcp this, int unit, int32_t out )
{
- return valerie_execute( this, 1024, "SOUT U%d %d", unit, out );
+ return mvcp_execute( this, 1024, "SOUT U%d %d", unit, out );
}
/** Set the out point of the clip on the specified unit.
*/
-valerie_error_code valerie_unit_clip_set_out( valerie this, int unit, valerie_clip_offset offset, int clip, int32_t in )
+mvcp_error_code mvcp_unit_clip_set_out( mvcp this, int unit, mvcp_clip_offset offset, int clip, int32_t in )
{
char temp[ 100 ];
- valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "SOUT U%d %d %s", unit, in, temp );
+ mvcp_interpret_clip_offset( temp, offset, clip );
+ return mvcp_execute( this, 1024, "SOUT U%d %d %s", unit, in, temp );
}
/** Clear the in point of the loaded file on the specified unit.
*/
-valerie_error_code valerie_unit_clear_in( valerie this, int unit )
+mvcp_error_code mvcp_unit_clear_in( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "SIN U%d -1", unit );
+ return mvcp_execute( this, 1024, "SIN U%d -1", unit );
}
/** Clear the out point of the loaded file on the specified unit.
*/
-valerie_error_code valerie_unit_clear_out( valerie this, int unit )
+mvcp_error_code mvcp_unit_clear_out( mvcp this, int unit )
{
- return valerie_execute( this, 1024, "SOUT U%d -1", unit );
+ return mvcp_execute( this, 1024, "SOUT U%d -1", unit );
}
/** Clear the in and out points on the loaded file on the specified unit.
*/
-valerie_error_code valerie_unit_clear_in_out( valerie this, int unit )
+mvcp_error_code mvcp_unit_clear_in_out( mvcp this, int unit )
{
- valerie_error_code error = valerie_unit_clear_out( this, unit );
- if ( error == valerie_ok )
- error = valerie_unit_clear_in( this, unit );
+ mvcp_error_code error = mvcp_unit_clear_out( this, unit );
+ if ( error == mvcp_ok )
+ error = mvcp_unit_clear_in( this, unit );
return error;
}
/** Set a unit configuration property.
*/
-valerie_error_code valerie_unit_set( valerie this, int unit, const char *name, const char *value )
+mvcp_error_code mvcp_unit_set( mvcp this, int unit, const char *name, const char *value )
{
- return valerie_execute( this, 1024, "USET U%d %s=%s", unit, name, value );
+ return mvcp_execute( this, 1024, "USET U%d %s=%s", unit, name, value );
}
/** Get a unit configuration property.
*/
-valerie_error_code valerie_unit_get( valerie this, int unit, char *name )
+mvcp_error_code mvcp_unit_get( mvcp this, int unit, char *name )
{
- return valerie_execute( this, 1024, "UGET U%d %s", unit, name );
+ return mvcp_execute( this, 1024, "UGET U%d %s", unit, name );
}
/** Get a units status.
*/
-valerie_error_code valerie_unit_status( valerie this, int unit, valerie_status status )
+mvcp_error_code mvcp_unit_status( mvcp this, int unit, mvcp_status status )
{
- valerie_error_code error = valerie_execute( this, 1024, "USTA U%d", unit );
- int error_code = valerie_response_get_error_code( this->last_response );
+ mvcp_error_code error = mvcp_execute( this, 1024, "USTA U%d", unit );
+ int error_code = mvcp_response_get_error_code( this->last_response );
- memset( status, 0, sizeof( valerie_status_t ) );
+ memset( status, 0, sizeof( mvcp_status_t ) );
status->unit = unit;
- if ( error_code == 202 && valerie_response_count( this->last_response ) == 2 )
- valerie_status_parse( status, valerie_response_get_line( this->last_response, 1 ) );
+ if ( error_code == 202 && mvcp_response_count( this->last_response ) == 2 )
+ mvcp_status_parse( status, mvcp_response_get_line( this->last_response, 1 ) );
else if ( error_code == 403 )
status->status = unit_undefined;
/** Transfer the current settings of unit src to unit dest.
*/
-valerie_error_code valerie_unit_transfer( valerie this, int src, int dest )
+mvcp_error_code mvcp_unit_transfer( mvcp this, int src, int dest )
{
- return valerie_execute( this, 1024, "XFER U%d U%d", src, dest );
+ return mvcp_execute( this, 1024, "XFER U%d U%d", src, dest );
}
/** Obtain the parsers notifier.
*/
-valerie_notifier valerie_get_notifier( valerie this )
+mvcp_notifier mvcp_get_notifier( mvcp this )
{
if ( this != NULL )
- return valerie_parser_get_notifier( this->parser );
+ return mvcp_parser_get_notifier( this->parser );
else
return NULL;
}
/** List the contents of the specified directory.
*/
-valerie_dir valerie_dir_init( valerie this, const char *directory )
+mvcp_dir mvcp_dir_init( mvcp this, const char *directory )
{
- valerie_dir dir = malloc( sizeof( valerie_dir_t ) );
+ mvcp_dir dir = malloc( sizeof( mvcp_dir_t ) );
if ( dir != NULL )
{
- memset( dir, 0, sizeof( valerie_dir_t ) );
+ memset( dir, 0, sizeof( mvcp_dir_t ) );
dir->directory = strdup( directory );
- dir->response = valerie_parser_executef( this->parser, "CLS \"%s\"", directory );
+ dir->response = mvcp_parser_executef( this->parser, "CLS \"%s\"", directory );
}
return dir;
}
/** Return the error code associated to the dir.
*/
-valerie_error_code valerie_dir_get_error_code( valerie_dir dir )
+mvcp_error_code mvcp_dir_get_error_code( mvcp_dir dir )
{
if ( dir != NULL )
- return valerie_get_error_code( NULL, dir->response );
+ return mvcp_get_error_code( NULL, dir->response );
else
- return valerie_malloc_failed;
+ return mvcp_malloc_failed;
}
/** Get a particular file entry in the directory.
*/
-valerie_error_code valerie_dir_get( valerie_dir dir, int index, valerie_dir_entry entry )
+mvcp_error_code mvcp_dir_get( mvcp_dir dir, int index, mvcp_dir_entry entry )
{
- valerie_error_code error = valerie_ok;
- memset( entry, 0, sizeof( valerie_dir_entry_t ) );
- if ( index < valerie_dir_count( dir ) )
+ mvcp_error_code error = mvcp_ok;
+ memset( entry, 0, sizeof( mvcp_dir_entry_t ) );
+ if ( index < mvcp_dir_count( dir ) )
{
- char *line = valerie_response_get_line( dir->response, index + 1 );
- valerie_tokeniser tokeniser = valerie_tokeniser_init( );
- valerie_tokeniser_parse_new( tokeniser, line, " " );
+ char *line = mvcp_response_get_line( dir->response, index + 1 );
+ mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+ mvcp_tokeniser_parse_new( tokeniser, line, " " );
- if ( valerie_tokeniser_count( tokeniser ) > 0 )
+ if ( mvcp_tokeniser_count( tokeniser ) > 0 )
{
- valerie_util_strip( valerie_tokeniser_get_string( tokeniser, 0 ), '\"' );
+ mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 0 ), '\"' );
strcpy( entry->full, dir->directory );
if ( entry->full[ strlen( entry->full ) - 1 ] != '/' )
strcat( entry->full, "/" );
- strcpy( entry->name, valerie_tokeniser_get_string( tokeniser, 0 ) );
+ strcpy( entry->name, mvcp_tokeniser_get_string( tokeniser, 0 ) );
strcat( entry->full, entry->name );
- switch ( valerie_tokeniser_count( tokeniser ) )
+ switch ( mvcp_tokeniser_count( tokeniser ) )
{
case 1:
entry->dir = 1;
break;
case 2:
- entry->size = strtoull( valerie_tokeniser_get_string( tokeniser, 1 ), NULL, 10 );
+ entry->size = strtoull( mvcp_tokeniser_get_string( tokeniser, 1 ), NULL, 10 );
break;
default:
- error = valerie_invalid_file;
+ error = mvcp_invalid_file;
break;
}
}
- valerie_tokeniser_close( tokeniser );
+ mvcp_tokeniser_close( tokeniser );
}
return error;
}
/** Get the number of entries in the directory
*/
-int valerie_dir_count( valerie_dir dir )
+int mvcp_dir_count( mvcp_dir dir )
{
- if ( dir != NULL && valerie_response_count( dir->response ) >= 2 )
- return valerie_response_count( dir->response ) - 2;
+ if ( dir != NULL && mvcp_response_count( dir->response ) >= 2 )
+ return mvcp_response_count( dir->response ) - 2;
else
return -1;
}
/** Close the directory structure.
*/
-void valerie_dir_close( valerie_dir dir )
+void mvcp_dir_close( mvcp_dir dir )
{
if ( dir != NULL )
{
free( dir->directory );
- valerie_response_close( dir->response );
+ mvcp_response_close( dir->response );
free( dir );
}
}
/** List the playlist of the specified unit.
*/
-valerie_list valerie_list_init( valerie this, int unit )
+mvcp_list mvcp_list_init( mvcp this, int unit )
{
- valerie_list list = calloc( 1, sizeof( valerie_list_t ) );
+ mvcp_list list = calloc( 1, sizeof( mvcp_list_t ) );
if ( list != NULL )
{
- list->response = valerie_parser_executef( this->parser, "LIST U%d", unit );
- if ( valerie_response_count( list->response ) >= 2 )
- list->generation = atoi( valerie_response_get_line( list->response, 1 ) );
+ list->response = mvcp_parser_executef( this->parser, "LIST U%d", unit );
+ if ( mvcp_response_count( list->response ) >= 2 )
+ list->generation = atoi( mvcp_response_get_line( list->response, 1 ) );
}
return list;
}
/** Return the error code associated to the list.
*/
-valerie_error_code valerie_list_get_error_code( valerie_list list )
+mvcp_error_code mvcp_list_get_error_code( mvcp_list list )
{
if ( list != NULL )
- return valerie_get_error_code( NULL, list->response );
+ return mvcp_get_error_code( NULL, list->response );
else
- return valerie_malloc_failed;
+ return mvcp_malloc_failed;
}
/** Get a particular file entry in the list.
*/
-valerie_error_code valerie_list_get( valerie_list list, int index, valerie_list_entry entry )
+mvcp_error_code mvcp_list_get( mvcp_list list, int index, mvcp_list_entry entry )
{
- valerie_error_code error = valerie_ok;
- memset( entry, 0, sizeof( valerie_list_entry_t ) );
- if ( index < valerie_list_count( list ) )
+ mvcp_error_code error = mvcp_ok;
+ memset( entry, 0, sizeof( mvcp_list_entry_t ) );
+ if ( index < mvcp_list_count( list ) )
{
- char *line = valerie_response_get_line( list->response, index + 2 );
- valerie_tokeniser tokeniser = valerie_tokeniser_init( );
- valerie_tokeniser_parse_new( tokeniser, line, " " );
+ char *line = mvcp_response_get_line( list->response, index + 2 );
+ mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+ mvcp_tokeniser_parse_new( tokeniser, line, " " );
- if ( valerie_tokeniser_count( tokeniser ) > 0 )
+ if ( mvcp_tokeniser_count( tokeniser ) > 0 )
{
- entry->clip = atoi( valerie_tokeniser_get_string( tokeniser, 0 ) );
- valerie_util_strip( valerie_tokeniser_get_string( tokeniser, 1 ), '\"' );
- strcpy( entry->full, valerie_tokeniser_get_string( tokeniser, 1 ) );
- entry->in = atol( valerie_tokeniser_get_string( tokeniser, 2 ) );
- entry->out = atol( valerie_tokeniser_get_string( tokeniser, 3 ) );
- entry->max = atol( valerie_tokeniser_get_string( tokeniser, 4 ) );
- entry->size = atol( valerie_tokeniser_get_string( tokeniser, 5 ) );
- entry->fps = atof( valerie_tokeniser_get_string( tokeniser, 6 ) );
+ entry->clip = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) );
+ mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 1 ), '\"' );
+ strcpy( entry->full, mvcp_tokeniser_get_string( tokeniser, 1 ) );
+ entry->in = atol( mvcp_tokeniser_get_string( tokeniser, 2 ) );
+ entry->out = atol( mvcp_tokeniser_get_string( tokeniser, 3 ) );
+ entry->max = atol( mvcp_tokeniser_get_string( tokeniser, 4 ) );
+ entry->size = atol( mvcp_tokeniser_get_string( tokeniser, 5 ) );
+ entry->fps = atof( mvcp_tokeniser_get_string( tokeniser, 6 ) );
}
- valerie_tokeniser_close( tokeniser );
+ mvcp_tokeniser_close( tokeniser );
}
return error;
}
/** Get the number of entries in the list
*/
-int valerie_list_count( valerie_list list )
+int mvcp_list_count( mvcp_list list )
{
- if ( list != NULL && valerie_response_count( list->response ) >= 3 )
- return valerie_response_count( list->response ) - 3;
+ if ( list != NULL && mvcp_response_count( list->response ) >= 3 )
+ return mvcp_response_count( list->response ) - 3;
else
return -1;
}
/** Close the list structure.
*/
-void valerie_list_close( valerie_list list )
+void mvcp_list_close( mvcp_list list )
{
if ( list != NULL )
{
- valerie_response_close( list->response );
+ mvcp_response_close( list->response );
free( list );
}
}
/** List the currently connected nodes.
*/
-valerie_nodes valerie_nodes_init( valerie this )
+mvcp_nodes mvcp_nodes_init( mvcp this )
{
- valerie_nodes nodes = malloc( sizeof( valerie_nodes_t ) );
+ mvcp_nodes nodes = malloc( sizeof( mvcp_nodes_t ) );
if ( nodes != NULL )
{
- memset( nodes, 0, sizeof( valerie_nodes_t ) );
- nodes->response = valerie_parser_executef( this->parser, "NLS" );
+ memset( nodes, 0, sizeof( mvcp_nodes_t ) );
+ nodes->response = mvcp_parser_executef( this->parser, "NLS" );
}
return nodes;
}
/** Return the error code associated to the nodes list.
*/
-valerie_error_code valerie_nodes_get_error_code( valerie_nodes nodes )
+mvcp_error_code mvcp_nodes_get_error_code( mvcp_nodes nodes )
{
if ( nodes != NULL )
- return valerie_get_error_code( NULL, nodes->response );
+ return mvcp_get_error_code( NULL, nodes->response );
else
- return valerie_malloc_failed;
+ return mvcp_malloc_failed;
}
/** Get a particular node entry.
*/
-valerie_error_code valerie_nodes_get( valerie_nodes nodes, int index, valerie_node_entry entry )
+mvcp_error_code mvcp_nodes_get( mvcp_nodes nodes, int index, mvcp_node_entry entry )
{
- valerie_error_code error = valerie_ok;
- memset( entry, 0, sizeof( valerie_node_entry_t ) );
- if ( index < valerie_nodes_count( nodes ) )
+ mvcp_error_code error = mvcp_ok;
+ memset( entry, 0, sizeof( mvcp_node_entry_t ) );
+ if ( index < mvcp_nodes_count( nodes ) )
{
- char *line = valerie_response_get_line( nodes->response, index + 1 );
- valerie_tokeniser tokeniser = valerie_tokeniser_init( );
- valerie_tokeniser_parse_new( tokeniser, line, " " );
+ char *line = mvcp_response_get_line( nodes->response, index + 1 );
+ mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+ mvcp_tokeniser_parse_new( tokeniser, line, " " );
- if ( valerie_tokeniser_count( tokeniser ) == 3 )
+ if ( mvcp_tokeniser_count( tokeniser ) == 3 )
{
- entry->node = atoi( valerie_tokeniser_get_string( tokeniser, 0 ) );
- strncpy( entry->guid, valerie_tokeniser_get_string( tokeniser, 1 ), sizeof( entry->guid ) );
- valerie_util_strip( valerie_tokeniser_get_string( tokeniser, 2 ), '\"' );
- strncpy( entry->name, valerie_tokeniser_get_string( tokeniser, 2 ), sizeof( entry->name ) );
+ entry->node = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) );
+ strncpy( entry->guid, mvcp_tokeniser_get_string( tokeniser, 1 ), sizeof( entry->guid ) );
+ mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 2 ), '\"' );
+ strncpy( entry->name, mvcp_tokeniser_get_string( tokeniser, 2 ), sizeof( entry->name ) );
}
- valerie_tokeniser_close( tokeniser );
+ mvcp_tokeniser_close( tokeniser );
}
return error;
}
/** Get the number of nodes
*/
-int valerie_nodes_count( valerie_nodes nodes )
+int mvcp_nodes_count( mvcp_nodes nodes )
{
- if ( nodes != NULL && valerie_response_count( nodes->response ) >= 2 )
- return valerie_response_count( nodes->response ) - 2;
+ if ( nodes != NULL && mvcp_response_count( nodes->response ) >= 2 )
+ return mvcp_response_count( nodes->response ) - 2;
else
return -1;
}
/** Close the nodes structure.
*/
-void valerie_nodes_close( valerie_nodes nodes )
+void mvcp_nodes_close( mvcp_nodes nodes )
{
if ( nodes != NULL )
{
- valerie_response_close( nodes->response );
+ mvcp_response_close( nodes->response );
free( nodes );
}
}
/** List the currently defined units.
*/
-valerie_units valerie_units_init( valerie this )
+mvcp_units mvcp_units_init( mvcp this )
{
- valerie_units units = malloc( sizeof( valerie_units_t ) );
+ mvcp_units units = malloc( sizeof( mvcp_units_t ) );
if ( units != NULL )
{
- memset( units, 0, sizeof( valerie_units_t ) );
- units->response = valerie_parser_executef( this->parser, "ULS" );
+ memset( units, 0, sizeof( mvcp_units_t ) );
+ units->response = mvcp_parser_executef( this->parser, "ULS" );
}
return units;
}
/** Return the error code associated to the nodes list.
*/
-valerie_error_code valerie_units_get_error_code( valerie_units units )
+mvcp_error_code mvcp_units_get_error_code( mvcp_units units )
{
if ( units != NULL )
- return valerie_get_error_code( NULL, units->response );
+ return mvcp_get_error_code( NULL, units->response );
else
- return valerie_malloc_failed;
+ return mvcp_malloc_failed;
}
/** Get a particular unit entry.
*/
-valerie_error_code valerie_units_get( valerie_units units, int index, valerie_unit_entry entry )
+mvcp_error_code mvcp_units_get( mvcp_units units, int index, mvcp_unit_entry entry )
{
- valerie_error_code error = valerie_ok;
- memset( entry, 0, sizeof( valerie_unit_entry_t ) );
- if ( index < valerie_units_count( units ) )
+ mvcp_error_code error = mvcp_ok;
+ memset( entry, 0, sizeof( mvcp_unit_entry_t ) );
+ if ( index < mvcp_units_count( units ) )
{
- char *line = valerie_response_get_line( units->response, index + 1 );
- valerie_tokeniser tokeniser = valerie_tokeniser_init( );
- valerie_tokeniser_parse_new( tokeniser, line, " " );
+ char *line = mvcp_response_get_line( units->response, index + 1 );
+ mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+ mvcp_tokeniser_parse_new( tokeniser, line, " " );
- if ( valerie_tokeniser_count( tokeniser ) == 4 )
+ if ( mvcp_tokeniser_count( tokeniser ) == 4 )
{
- entry->unit = atoi( valerie_tokeniser_get_string( tokeniser, 0 ) + 1 );
- entry->node = atoi( valerie_tokeniser_get_string( tokeniser, 1 ) );
- strncpy( entry->guid, valerie_tokeniser_get_string( tokeniser, 2 ), sizeof( entry->guid ) );
- entry->online = atoi( valerie_tokeniser_get_string( tokeniser, 3 ) );
+ entry->unit = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) + 1 );
+ entry->node = atoi( mvcp_tokeniser_get_string( tokeniser, 1 ) );
+ strncpy( entry->guid, mvcp_tokeniser_get_string( tokeniser, 2 ), sizeof( entry->guid ) );
+ entry->online = atoi( mvcp_tokeniser_get_string( tokeniser, 3 ) );
}
- valerie_tokeniser_close( tokeniser );
+ mvcp_tokeniser_close( tokeniser );
}
return error;
}
/** Get the number of units
*/
-int valerie_units_count( valerie_units units )
+int mvcp_units_count( mvcp_units units )
{
- if ( units != NULL && valerie_response_count( units->response ) >= 2 )
- return valerie_response_count( units->response ) - 2;
+ if ( units != NULL && mvcp_response_count( units->response ) >= 2 )
+ return mvcp_response_count( units->response ) - 2;
else
return -1;
}
/** Close the units structure.
*/
-void valerie_units_close( valerie_units units )
+void mvcp_units_close( mvcp_units units )
{
if ( units != NULL )
{
- valerie_response_close( units->response );
+ mvcp_response_close( units->response );
free( units );
}
}
/** Get the response of the last command executed.
*/
-valerie_response valerie_get_last_response( valerie this )
+mvcp_response mvcp_get_last_response( mvcp this )
{
return this->last_response;
}
/** Obtain a printable message associated to the error code provided.
*/
-const char *valerie_error_description( valerie_error_code error )
+const char *mvcp_error_description( mvcp_error_code error )
{
const char *msg = "Unrecognised error";
switch( error )
{
- case valerie_ok:
+ case mvcp_ok:
msg = "OK";
break;
- case valerie_malloc_failed:
+ case mvcp_malloc_failed:
msg = "Memory allocation error";
break;
- case valerie_unknown_error:
+ case mvcp_unknown_error:
msg = "Unknown error";
break;
- case valerie_no_response:
+ case mvcp_no_response:
msg = "No response obtained";
break;
- case valerie_invalid_command:
+ case mvcp_invalid_command:
msg = "Invalid command";
break;
- case valerie_server_timeout:
+ case mvcp_server_timeout:
msg = "Communications with server timed out";
break;
- case valerie_missing_argument:
+ case mvcp_missing_argument:
msg = "Missing argument";
break;
- case valerie_server_unavailable:
+ case mvcp_server_unavailable:
msg = "Unable to communicate with server";
break;
- case valerie_unit_creation_failed:
+ case mvcp_unit_creation_failed:
msg = "Unit creation failed";
break;
- case valerie_unit_unavailable:
+ case mvcp_unit_unavailable:
msg = "Unit unavailable";
break;
- case valerie_invalid_file:
+ case mvcp_invalid_file:
msg = "Invalid file";
break;
- case valerie_invalid_position:
+ case mvcp_invalid_position:
msg = "Invalid position";
break;
}
return msg;
}
-/** Close the valerie structure.
+/** Close the mvcp structure.
*/
-void valerie_close( valerie this )
+void mvcp_close( mvcp this )
{
if ( this != NULL )
{
- valerie_set_last_response( this, NULL );
+ mvcp_set_last_response( this, NULL );
free( this );
}
}
/*
- * valerie.h -- High Level Client API for miracle
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp.h -- High Level Client API for Melted
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_H_
-#define _VALERIE_H_
+#ifndef _MVCP_H_
+#define _MVCP_H_
/* System header files */
#include <limits.h>
#include <framework/mlt.h>
/* Application header files */
-#include "valerie_parser.h"
-#include "valerie_status.h"
-#include "valerie_notifier.h"
+#include "mvcp_parser.h"
+#include "mvcp_status.h"
+#include "mvcp_notifier.h"
#ifdef __cplusplus
extern "C"
typedef enum
{
- valerie_ok = 0,
- valerie_malloc_failed,
- valerie_unknown_error,
- valerie_no_response,
- valerie_invalid_command,
- valerie_server_timeout,
- valerie_missing_argument,
- valerie_server_unavailable,
- valerie_unit_creation_failed,
- valerie_unit_unavailable,
- valerie_invalid_file,
- valerie_invalid_position
+ mvcp_ok = 0,
+ mvcp_malloc_failed,
+ mvcp_unknown_error,
+ mvcp_no_response,
+ mvcp_invalid_command,
+ mvcp_server_timeout,
+ mvcp_missing_argument,
+ mvcp_server_unavailable,
+ mvcp_unit_creation_failed,
+ mvcp_unit_unavailable,
+ mvcp_invalid_file,
+ mvcp_invalid_position
}
-valerie_error_code;
+mvcp_error_code;
/** Clip index specification.
*/
typedef enum
{
- valerie_absolute = 0,
- valerie_relative
+ mvcp_absolute = 0,
+ mvcp_relative
}
-valerie_clip_offset;
+mvcp_clip_offset;
/** Client structure.
*/
typedef struct
{
- valerie_parser parser;
- valerie_response last_response;
+ mvcp_parser parser;
+ mvcp_response last_response;
}
-*valerie, valerie_t;
+*mvcp, mvcp_t;
/** Client API.
*/
-extern valerie valerie_init( valerie_parser );
+extern mvcp mvcp_init( mvcp_parser );
-/* Connect to the valerie parser instance */
-extern valerie_error_code valerie_connect( valerie );
+/* Connect to the mvcp parser instance */
+extern mvcp_error_code mvcp_connect( mvcp );
/* Global functions */
-extern valerie_error_code valerie_set( valerie, char *, char * );
-extern valerie_error_code valerie_get( valerie, char *, char *, int );
-extern valerie_error_code valerie_run( valerie, char * );
+extern mvcp_error_code mvcp_set( mvcp, char *, char * );
+extern mvcp_error_code mvcp_get( mvcp, char *, char *, int );
+extern mvcp_error_code mvcp_run( mvcp, char * );
/* Unit functions */
-extern valerie_error_code valerie_unit_add( valerie, char *, int * );
-extern valerie_error_code valerie_unit_load( valerie, int, char * );
-extern valerie_error_code valerie_unit_load_clipped( valerie, int, char *, int32_t, int32_t );
-extern valerie_error_code valerie_unit_load_back( valerie, int, char * );
-extern valerie_error_code valerie_unit_load_back_clipped( valerie, int, char *, int32_t, int32_t );
-extern valerie_error_code valerie_unit_append( valerie, int, char *, int32_t, int32_t );
-extern valerie_error_code valerie_unit_receive( valerie, int, char *, char * );
-extern valerie_error_code valerie_unit_push( valerie, int, char *, mlt_service );
-extern valerie_error_code valerie_unit_clean( valerie, int );
-extern valerie_error_code valerie_unit_wipe( valerie, int );
-extern valerie_error_code valerie_unit_clear( valerie, int );
-extern valerie_error_code valerie_unit_clip_move( valerie, int, valerie_clip_offset, int, valerie_clip_offset, int );
-extern valerie_error_code valerie_unit_clip_remove( valerie, int, valerie_clip_offset, int );
-extern valerie_error_code valerie_unit_remove_current_clip( valerie, int );
-extern valerie_error_code valerie_unit_clip_insert( valerie, int, valerie_clip_offset, int, char *, int32_t, int32_t );
-extern valerie_error_code valerie_unit_play( valerie, int );
-extern valerie_error_code valerie_unit_play_at_speed( valerie, int, int );
-extern valerie_error_code valerie_unit_stop( valerie, int );
-extern valerie_error_code valerie_unit_pause( valerie, int );
-extern valerie_error_code valerie_unit_rewind( valerie, int );
-extern valerie_error_code valerie_unit_fast_forward( valerie, int );
-extern valerie_error_code valerie_unit_step( valerie, int, int32_t );
-extern valerie_error_code valerie_unit_goto( valerie, int, int32_t );
-extern valerie_error_code valerie_unit_clip_goto( valerie, int, valerie_clip_offset, int, int32_t );
-extern valerie_error_code valerie_unit_clip_set_in( valerie, int, valerie_clip_offset, int, int32_t );
-extern valerie_error_code valerie_unit_clip_set_out( valerie, int, valerie_clip_offset, int, int32_t );
-extern valerie_error_code valerie_unit_set_in( valerie, int, int32_t );
-extern valerie_error_code valerie_unit_set_out( valerie, int, int32_t );
-extern valerie_error_code valerie_unit_clear_in( valerie, int );
-extern valerie_error_code valerie_unit_clear_out( valerie, int );
-extern valerie_error_code valerie_unit_clear_in_out( valerie, int );
-extern valerie_error_code valerie_unit_set( valerie, int, const char *, const char * );
-extern valerie_error_code valerie_unit_get( valerie, int, char * );
-extern valerie_error_code valerie_unit_status( valerie, int, valerie_status );
-extern valerie_error_code valerie_unit_transfer( valerie, int, int );
+extern mvcp_error_code mvcp_unit_add( mvcp, char *, int * );
+extern mvcp_error_code mvcp_unit_load( mvcp, int, char * );
+extern mvcp_error_code mvcp_unit_load_clipped( mvcp, int, char *, int32_t, int32_t );
+extern mvcp_error_code mvcp_unit_load_back( mvcp, int, char * );
+extern mvcp_error_code mvcp_unit_load_back_clipped( mvcp, int, char *, int32_t, int32_t );
+extern mvcp_error_code mvcp_unit_append( mvcp, int, char *, int32_t, int32_t );
+extern mvcp_error_code mvcp_unit_receive( mvcp, int, char *, char * );
+extern mvcp_error_code mvcp_unit_push( mvcp, int, char *, mlt_service );
+extern mvcp_error_code mvcp_unit_clean( mvcp, int );
+extern mvcp_error_code mvcp_unit_wipe( mvcp, int );
+extern mvcp_error_code mvcp_unit_clear( mvcp, int );
+extern mvcp_error_code mvcp_unit_clip_move( mvcp, int, mvcp_clip_offset, int, mvcp_clip_offset, int );
+extern mvcp_error_code mvcp_unit_clip_remove( mvcp, int, mvcp_clip_offset, int );
+extern mvcp_error_code mvcp_unit_remove_current_clip( mvcp, int );
+extern mvcp_error_code mvcp_unit_clip_insert( mvcp, int, mvcp_clip_offset, int, char *, int32_t, int32_t );
+extern mvcp_error_code mvcp_unit_play( mvcp, int );
+extern mvcp_error_code mvcp_unit_play_at_speed( mvcp, int, int );
+extern mvcp_error_code mvcp_unit_stop( mvcp, int );
+extern mvcp_error_code mvcp_unit_pause( mvcp, int );
+extern mvcp_error_code mvcp_unit_rewind( mvcp, int );
+extern mvcp_error_code mvcp_unit_fast_forward( mvcp, int );
+extern mvcp_error_code mvcp_unit_step( mvcp, int, int32_t );
+extern mvcp_error_code mvcp_unit_goto( mvcp, int, int32_t );
+extern mvcp_error_code mvcp_unit_clip_goto( mvcp, int, mvcp_clip_offset, int, int32_t );
+extern mvcp_error_code mvcp_unit_clip_set_in( mvcp, int, mvcp_clip_offset, int, int32_t );
+extern mvcp_error_code mvcp_unit_clip_set_out( mvcp, int, mvcp_clip_offset, int, int32_t );
+extern mvcp_error_code mvcp_unit_set_in( mvcp, int, int32_t );
+extern mvcp_error_code mvcp_unit_set_out( mvcp, int, int32_t );
+extern mvcp_error_code mvcp_unit_clear_in( mvcp, int );
+extern mvcp_error_code mvcp_unit_clear_out( mvcp, int );
+extern mvcp_error_code mvcp_unit_clear_in_out( mvcp, int );
+extern mvcp_error_code mvcp_unit_set( mvcp, int, const char *, const char * );
+extern mvcp_error_code mvcp_unit_get( mvcp, int, char * );
+extern mvcp_error_code mvcp_unit_status( mvcp, int, mvcp_status );
+extern mvcp_error_code mvcp_unit_transfer( mvcp, int, int );
/* Notifier functionality. */
-extern valerie_notifier valerie_get_notifier( valerie );
+extern mvcp_notifier mvcp_get_notifier( mvcp );
/** Structure for the directory.
*/
typedef struct
{
char *directory;
- valerie_response response;
+ mvcp_response response;
}
-*valerie_dir, valerie_dir_t;
+*mvcp_dir, mvcp_dir_t;
/** Directory entry structure.
*/
char full[ PATH_MAX + NAME_MAX ];
unsigned long long size;
}
-*valerie_dir_entry, valerie_dir_entry_t;
+*mvcp_dir_entry, mvcp_dir_entry_t;
/* Directory reading. */
-extern valerie_dir valerie_dir_init( valerie, const char * );
-extern valerie_error_code valerie_dir_get_error_code( valerie_dir );
-extern valerie_error_code valerie_dir_get( valerie_dir, int, valerie_dir_entry );
-extern int valerie_dir_count( valerie_dir );
-extern void valerie_dir_close( valerie_dir );
+extern mvcp_dir mvcp_dir_init( mvcp, const char * );
+extern mvcp_error_code mvcp_dir_get_error_code( mvcp_dir );
+extern mvcp_error_code mvcp_dir_get( mvcp_dir, int, mvcp_dir_entry );
+extern int mvcp_dir_count( mvcp_dir );
+extern void mvcp_dir_close( mvcp_dir );
/** Structure for the list.
*/
typedef struct
{
int generation;
- valerie_response response;
+ mvcp_response response;
}
-*valerie_list, valerie_list_t;
+*mvcp_list, mvcp_list_t;
/** List entry structure.
*/
int32_t size;
int32_t fps;
}
-*valerie_list_entry, valerie_list_entry_t;
+*mvcp_list_entry, mvcp_list_entry_t;
/* List reading. */
-extern valerie_list valerie_list_init( valerie, int );
-extern valerie_error_code valerie_list_get_error_code( valerie_list );
-extern valerie_error_code valerie_list_get( valerie_list, int, valerie_list_entry );
-extern int valerie_list_count( valerie_list );
-extern void valerie_list_close( valerie_list );
+extern mvcp_list mvcp_list_init( mvcp, int );
+extern mvcp_error_code mvcp_list_get_error_code( mvcp_list );
+extern mvcp_error_code mvcp_list_get( mvcp_list, int, mvcp_list_entry );
+extern int mvcp_list_count( mvcp_list );
+extern void mvcp_list_close( mvcp_list );
/** Structure for nodes.
*/
typedef struct
{
- valerie_response response;
+ mvcp_response response;
}
-*valerie_nodes, valerie_nodes_t;
+*mvcp_nodes, mvcp_nodes_t;
/** Node entry structure.
*/
char guid[ 17 ];
char name[ 1024 ];
}
-*valerie_node_entry, valerie_node_entry_t;
+*mvcp_node_entry, mvcp_node_entry_t;
/* Node reading. */
-extern valerie_nodes valerie_nodes_init( valerie );
-extern valerie_error_code valerie_nodes_get_error_code( valerie_nodes );
-extern valerie_error_code valerie_nodes_get( valerie_nodes, int, valerie_node_entry );
-extern int valerie_nodes_count( valerie_nodes );
-extern void valerie_nodes_close( valerie_nodes );
+extern mvcp_nodes mvcp_nodes_init( mvcp );
+extern mvcp_error_code mvcp_nodes_get_error_code( mvcp_nodes );
+extern mvcp_error_code mvcp_nodes_get( mvcp_nodes, int, mvcp_node_entry );
+extern int mvcp_nodes_count( mvcp_nodes );
+extern void mvcp_nodes_close( mvcp_nodes );
/** Structure for units.
*/
typedef struct
{
- valerie_response response;
+ mvcp_response response;
}
-*valerie_units, valerie_units_t;
+*mvcp_units, mvcp_units_t;
/** Unit entry structure.
*/
char guid[ 512 ];
int online;
}
-*valerie_unit_entry, valerie_unit_entry_t;
+*mvcp_unit_entry, mvcp_unit_entry_t;
/* Unit reading. */
-extern valerie_units valerie_units_init( valerie );
-extern valerie_error_code valerie_units_get_error_code( valerie_units );
-extern valerie_error_code valerie_units_get( valerie_units, int, valerie_unit_entry );
-extern int valerie_units_count( valerie_units );
-extern void valerie_units_close( valerie_units );
+extern mvcp_units mvcp_units_init( mvcp );
+extern mvcp_error_code mvcp_units_get_error_code( mvcp_units );
+extern mvcp_error_code mvcp_units_get( mvcp_units, int, mvcp_unit_entry );
+extern int mvcp_units_count( mvcp_units );
+extern void mvcp_units_close( mvcp_units );
/* Miscellaenous functions */
-extern valerie_response valerie_get_last_response( valerie );
-extern const char *valerie_error_description( valerie_error_code );
+extern mvcp_response mvcp_get_last_response( mvcp );
+extern const char *mvcp_error_description( mvcp_error_code );
/* Courtesy functions. */
-extern valerie_error_code valerie_execute( valerie, size_t, const char *, ... );
-extern valerie_error_code valerie_push( valerie, mlt_service, size_t, const char *, ... );
+extern mvcp_error_code mvcp_execute( mvcp, size_t, const char *, ... );
+extern mvcp_error_code mvcp_push( mvcp, mlt_service, size_t, const char *, ... );
/* Close function. */
-extern void valerie_close( valerie );
+extern void mvcp_close( mvcp );
#ifdef __cplusplus
}
/*
- * valerie_notifier.c -- Unit Status Notifier Handling
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_notifier.c -- Unit Status Notifier 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 <sys/time.h>
/* Application header files */
-#include "valerie_notifier.h"
+#include "mvcp_notifier.h"
/** Notifier initialisation.
*/
-valerie_notifier valerie_notifier_init( )
+mvcp_notifier mvcp_notifier_init( )
{
- valerie_notifier this = calloc( 1, sizeof( valerie_notifier_t ) );
+ mvcp_notifier this = calloc( 1, sizeof( mvcp_notifier_t ) );
if ( this != NULL )
{
int index = 0;
/** Get a stored status for the specified unit.
*/
-void valerie_notifier_get( valerie_notifier this, valerie_status status, int unit )
+void mvcp_notifier_get( mvcp_notifier this, mvcp_status status, int unit )
{
pthread_mutex_lock( &this->mutex );
if ( unit >= 0 && unit < MAX_UNITS )
- valerie_status_copy( status, &this->store[ unit ] );
+ mvcp_status_copy( status, &this->store[ unit ] );
else
- memset( status, 0, sizeof( valerie_status_t ) );
+ memset( status, 0, sizeof( mvcp_status_t ) );
status->unit = unit;
status->dummy = time( NULL );
pthread_mutex_unlock( &this->mutex );
/** Wait on a new status.
*/
-int valerie_notifier_wait( valerie_notifier this, valerie_status status )
+int mvcp_notifier_wait( mvcp_notifier this, mvcp_status status )
{
struct timeval now;
struct timespec timeout;
int error = 0;
- memset( status, 0, sizeof( valerie_status_t ) );
+ memset( status, 0, sizeof( mvcp_status_t ) );
gettimeofday( &now, NULL );
timeout.tv_sec = now.tv_sec + 1;
timeout.tv_nsec = now.tv_usec * 1000;
pthread_mutex_lock( &this->mutex );
pthread_cond_timedwait( &this->cond, &this->mutex, &timeout );
- valerie_status_copy( status, &this->last );
+ mvcp_status_copy( status, &this->last );
pthread_mutex_unlock( &this->mutex );
return error;
/** Put a new status.
*/
-void valerie_notifier_put( valerie_notifier this, valerie_status status )
+void mvcp_notifier_put( mvcp_notifier this, mvcp_status status )
{
pthread_mutex_lock( &this->mutex );
- valerie_status_copy( &this->store[ status->unit ], status );
- valerie_status_copy( &this->last, status );
+ mvcp_status_copy( &this->store[ status->unit ], status );
+ mvcp_status_copy( &this->last, status );
pthread_mutex_unlock( &this->mutex );
pthread_cond_broadcast( &this->cond );
}
/** Communicate a disconnected status for all units to all waiting.
*/
-void valerie_notifier_disconnected( valerie_notifier notifier )
+void mvcp_notifier_disconnected( mvcp_notifier notifier )
{
int unit = 0;
- valerie_status_t status;
+ mvcp_status_t status;
for ( unit = 0; unit < MAX_UNITS; unit ++ )
{
- valerie_notifier_get( notifier, &status, unit );
+ mvcp_notifier_get( notifier, &status, unit );
status.status = unit_disconnected;
- valerie_notifier_put( notifier, &status );
+ mvcp_notifier_put( notifier, &status );
}
}
/** Close the notifier - note that all access must be stopped before we call this.
*/
-void valerie_notifier_close( valerie_notifier this )
+void mvcp_notifier_close( mvcp_notifier this )
{
if ( this != NULL )
{
/*
- * valerie_notifier.h -- Unit Status Notifier Handling
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_notifier.h -- Unit Status Notifier 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_NOTIFIER_H_
-#define _VALERIE_NOTIFIER_H_
+#ifndef _MVCP_NOTIFIER_H_
+#define _MVCP_NOTIFIER_H_
/* System header files */
#include <pthread.h>
/* Application header files */
-#include "valerie_status.h"
+#include "mvcp_status.h"
#ifdef __cplusplus
extern "C"
{
pthread_mutex_t mutex;
pthread_cond_t cond;
- valerie_status_t last;
- valerie_status_t store[ MAX_UNITS ];
+ mvcp_status_t last;
+ mvcp_status_t store[ MAX_UNITS ];
}
-*valerie_notifier, valerie_notifier_t;
-
-extern valerie_notifier valerie_notifier_init( );
-extern void valerie_notifier_get( valerie_notifier, valerie_status, int );
-extern int valerie_notifier_wait( valerie_notifier, valerie_status );
-extern void valerie_notifier_put( valerie_notifier, valerie_status );
-extern void valerie_notifier_disconnected( valerie_notifier );
-extern void valerie_notifier_close( valerie_notifier );
+*mvcp_notifier, mvcp_notifier_t;
+
+extern mvcp_notifier mvcp_notifier_init( );
+extern void mvcp_notifier_get( mvcp_notifier, mvcp_status, int );
+extern int mvcp_notifier_wait( mvcp_notifier, mvcp_status );
+extern void mvcp_notifier_put( mvcp_notifier, mvcp_status );
+extern void mvcp_notifier_disconnected( mvcp_notifier );
+extern void mvcp_notifier_close( mvcp_notifier );
#ifdef __cplusplus
}
/*
- * valerie_parser.c -- Valerie Parser for Miracle
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_parser.c -- MVCP Parser for Melted
+ * 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_parser.h"
-#include "valerie_util.h"
+#include "mvcp_parser.h"
+#include "mvcp_util.h"
/** Connect to the parser.
*/
-valerie_response valerie_parser_connect( valerie_parser parser )
+mvcp_response mvcp_parser_connect( mvcp_parser parser )
{
return parser->connect( parser->real );
}
/** Execute a command via the parser.
*/
-valerie_response valerie_parser_execute( valerie_parser parser, char *command )
+mvcp_response mvcp_parser_execute( mvcp_parser parser, char *command )
{
return parser->execute( parser->real, command );
}
/** Push a service via the parser.
*/
-valerie_response valerie_parser_received( valerie_parser parser, char *command, char *doc )
+mvcp_response mvcp_parser_received( mvcp_parser parser, char *command, char *doc )
{
return parser->received != NULL ? parser->received( parser->real, command, doc ) : NULL;
}
/** Push a service via the parser.
*/
-valerie_response valerie_parser_push( valerie_parser parser, char *command, mlt_service service )
+mvcp_response mvcp_parser_push( mvcp_parser parser, char *command, mlt_service service )
{
return parser->push( parser->real, command, service );
}
/** Execute a formatted command via the parser.
*/
-valerie_response valerie_parser_executef( valerie_parser parser, const char *format, ... )
+mvcp_response mvcp_parser_executef( mvcp_parser parser, const char *format, ... )
{
char *command = malloc( 10240 );
- valerie_response response = NULL;
+ mvcp_response response = NULL;
if ( command != NULL )
{
va_list list;
va_start( list, format );
if ( vsnprintf( command, 10240, format, list ) != 0 )
- response = valerie_parser_execute( parser, command );
+ response = mvcp_parser_execute( parser, command );
va_end( list );
free( command );
}
return response;
}
-/** Execute the contents of a file. Note the special case valerie_response returned.
+/** Execute the contents of a file. Note the special case mvcp_response returned.
*/
-valerie_response valerie_parser_run( valerie_parser parser, char *filename )
+mvcp_response mvcp_parser_run( mvcp_parser parser, char *filename )
{
- valerie_response response = valerie_response_init( );
+ mvcp_response response = mvcp_response_init( );
if ( response != NULL )
{
FILE *file = fopen( filename, "r" );
if ( file != NULL )
{
char command[ 1024 ];
- valerie_response_set_error( response, 201, "OK" );
- while ( valerie_response_get_error_code( response ) == 201 && fgets( command, 1024, file ) )
+ mvcp_response_set_error( response, 201, "OK" );
+ while ( mvcp_response_get_error_code( response ) == 201 && fgets( command, 1024, file ) )
{
- valerie_util_trim( valerie_util_chomp( command ) );
+ mvcp_util_trim( mvcp_util_chomp( command ) );
if ( strcmp( command, "" ) && command[ 0 ] != '#' )
{
- valerie_response temp = NULL;
- valerie_response_printf( response, 1024, "%s\n", command );
- temp = valerie_parser_execute( parser, command );
+ mvcp_response temp = NULL;
+ mvcp_response_printf( response, 1024, "%s\n", command );
+ temp = mvcp_parser_execute( parser, command );
if ( temp != NULL )
{
int index = 0;
- for ( index = 0; index < valerie_response_count( temp ); index ++ )
- valerie_response_printf( response, 10240, "%s\n", valerie_response_get_line( temp, index ) );
- valerie_response_close( temp );
+ for ( index = 0; index < mvcp_response_count( temp ); index ++ )
+ mvcp_response_printf( response, 10240, "%s\n", mvcp_response_get_line( temp, index ) );
+ mvcp_response_close( temp );
}
else
{
- valerie_response_set_error( response, 500, "Batch execution failed" );
+ mvcp_response_set_error( response, 500, "Batch execution failed" );
}
}
}
}
else
{
- valerie_response_set_error( response, 404, "File not found." );
+ mvcp_response_set_error( response, 404, "File not found." );
}
}
return response;
/** Get the notifier associated to the parser.
*/
-valerie_notifier valerie_parser_get_notifier( valerie_parser parser )
+mvcp_notifier mvcp_parser_get_notifier( mvcp_parser parser )
{
if ( parser->notifier == NULL )
- parser->notifier = valerie_notifier_init( );
+ parser->notifier = mvcp_notifier_init( );
return parser->notifier;
}
/** Close the parser.
*/
-void valerie_parser_close( valerie_parser parser )
+void mvcp_parser_close( mvcp_parser parser )
{
if ( parser != NULL )
{
parser->close( parser->real );
- valerie_notifier_close( parser->notifier );
+ mvcp_notifier_close( parser->notifier );
free( parser );
}
}
/*
- * valerie_parser.h -- Valerie Parser for Miracle Server
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_parser.h -- MVCP Parser for Melted
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_PARSER_H_
-#define _VALERIE_PARSER_H_
+#ifndef _MVCP_PARSER_H_
+#define _MVCP_PARSER_H_
/* MLT Header files */
#include <framework/mlt.h>
/* Application header files */
-#include "valerie_response.h"
-#include "valerie_notifier.h"
+#include "mvcp_response.h"
+#include "mvcp_notifier.h"
#ifdef __cplusplus
extern "C"
/** Callbacks to define the parser.
*/
-typedef valerie_response (*parser_connect)( void * );
-typedef valerie_response (*parser_execute)( void *, char * );
-typedef valerie_response (*parser_received)( void *, char *, char * );
-typedef valerie_response (*parser_push)( void *, char *, mlt_service );
+typedef mvcp_response (*parser_connect)( void * );
+typedef mvcp_response (*parser_execute)( void *, char * );
+typedef mvcp_response (*parser_received)( void *, char *, char * );
+typedef mvcp_response (*parser_push)( void *, char *, mlt_service );
typedef void (*parser_close)( void * );
-/** Structure for the valerie parser.
+/** Structure for the mvcp parser.
*/
typedef struct
parser_received received;
parser_close close;
void *real;
- valerie_notifier notifier;
+ mvcp_notifier notifier;
}
-*valerie_parser, valerie_parser_t;
+*mvcp_parser, mvcp_parser_t;
/** API for the parser - note that no constructor is defined here.
*/
-extern valerie_response valerie_parser_connect( valerie_parser );
-extern valerie_response valerie_parser_push( valerie_parser, char *, mlt_service );
-extern valerie_response valerie_parser_received( valerie_parser, char *, char * );
-extern valerie_response valerie_parser_execute( valerie_parser, char * );
-extern valerie_response valerie_parser_executef( valerie_parser, const char *, ... );
-extern valerie_response valerie_parser_run( valerie_parser, char * );
-extern valerie_notifier valerie_parser_get_notifier( valerie_parser );
-extern void valerie_parser_close( valerie_parser );
+extern mvcp_response mvcp_parser_connect( mvcp_parser );
+extern mvcp_response mvcp_parser_push( mvcp_parser, char *, mlt_service );
+extern mvcp_response mvcp_parser_received( mvcp_parser, char *, char * );
+extern mvcp_response mvcp_parser_execute( mvcp_parser, char * );
+extern mvcp_response mvcp_parser_executef( mvcp_parser, const char *, ... );
+extern mvcp_response mvcp_parser_run( mvcp_parser, char * );
+extern mvcp_notifier mvcp_parser_get_notifier( mvcp_parser );
+extern void mvcp_parser_close( mvcp_parser );
#ifdef __cplusplus
}
/*
- * valerie_remote.c -- Remote Parser
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_remote.c -- Remote Parser
+ * 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
/* Application header files */
#include <framework/mlt.h>
-#include "valerie_remote.h"
-#include "valerie_socket.h"
-#include "valerie_tokeniser.h"
-#include "valerie_util.h"
+#include "mvcp_remote.h"
+#include "mvcp_socket.h"
+#include "mvcp_tokeniser.h"
+#include "mvcp_util.h"
-/** Private valerie_remote structure.
+/** Private mvcp_remote structure.
*/
typedef struct
int terminated;
char *server;
int port;
- valerie_socket socket;
- valerie_socket status;
+ mvcp_socket socket;
+ mvcp_socket status;
pthread_t thread;
- valerie_parser parser;
+ mvcp_parser parser;
pthread_mutex_t mutex;
int connected;
}
-*valerie_remote, valerie_remote_t;
+*mvcp_remote, mvcp_remote_t;
/** Forward declarations.
*/
-static valerie_response valerie_remote_connect( valerie_remote );
-static valerie_response valerie_remote_execute( valerie_remote, char * );
-static valerie_response valerie_remote_receive( valerie_remote, char *, char * );
-static valerie_response valerie_remote_push( valerie_remote, char *, mlt_service );
-static void valerie_remote_close( valerie_remote );
-static int valerie_remote_read_response( valerie_socket, valerie_response );
+static mvcp_response mvcp_remote_connect( mvcp_remote );
+static mvcp_response mvcp_remote_execute( mvcp_remote, char * );
+static mvcp_response mvcp_remote_receive( mvcp_remote, char *, char * );
+static mvcp_response mvcp_remote_push( mvcp_remote, char *, mlt_service );
+static void mvcp_remote_close( mvcp_remote );
+static int mvcp_remote_read_response( mvcp_socket, mvcp_response );
-/** DV Parser constructor.
+/** MVCP Parser constructor.
*/
-valerie_parser valerie_parser_init_remote( char *server, int port )
+mvcp_parser mvcp_parser_init_remote( char *server, int port )
{
- valerie_parser parser = calloc( 1, sizeof( valerie_parser_t ) );
- valerie_remote remote = calloc( 1, sizeof( valerie_remote_t ) );
+ mvcp_parser parser = calloc( 1, sizeof( mvcp_parser_t ) );
+ mvcp_remote remote = calloc( 1, sizeof( mvcp_remote_t ) );
if ( parser != NULL )
{
- parser->connect = (parser_connect)valerie_remote_connect;
- parser->execute = (parser_execute)valerie_remote_execute;
- parser->push = (parser_push)valerie_remote_push;
- parser->received = (parser_received)valerie_remote_receive;
- parser->close = (parser_close)valerie_remote_close;
+ parser->connect = (parser_connect)mvcp_remote_connect;
+ parser->execute = (parser_execute)mvcp_remote_execute;
+ parser->push = (parser_push)mvcp_remote_push;
+ parser->received = (parser_received)mvcp_remote_receive;
+ parser->close = (parser_close)mvcp_remote_close;
parser->real = remote;
if ( remote != NULL )
/** Thread for receiving and distributing the status information.
*/
-static void *valerie_remote_status_thread( void *arg )
+static void *mvcp_remote_status_thread( void *arg )
{
- valerie_remote remote = arg;
+ mvcp_remote remote = arg;
char temp[ 10240 ];
int length = 0;
int offset = 0;
- valerie_tokeniser tokeniser = valerie_tokeniser_init( );
- valerie_notifier notifier = valerie_parser_get_notifier( remote->parser );
- valerie_status_t status;
+ mvcp_tokeniser tokeniser = mvcp_tokeniser_init( );
+ mvcp_notifier notifier = mvcp_parser_get_notifier( remote->parser );
+ mvcp_status_t status;
int index = 0;
- valerie_socket_write_data( remote->status, "STATUS\r\n", 8 );
+ mvcp_socket_write_data( remote->status, "STATUS\r\n", 8 );
while ( !remote->terminated &&
- ( length = valerie_socket_read_data( remote->status, temp + offset, sizeof( temp ) ) ) >= 0 )
+ ( length = mvcp_socket_read_data( remote->status, temp + offset, sizeof( temp ) ) ) >= 0 )
{
if ( strchr( temp, '\n' ) == NULL )
{
continue;
}
offset = 0;
- valerie_tokeniser_parse_new( tokeniser, temp, "\n" );
- for ( index = 0; index < valerie_tokeniser_count( tokeniser ); index ++ )
+ mvcp_tokeniser_parse_new( tokeniser, temp, "\n" );
+ for ( index = 0; index < mvcp_tokeniser_count( tokeniser ); index ++ )
{
- char *line = valerie_tokeniser_get_string( tokeniser, index );
+ char *line = mvcp_tokeniser_get_string( tokeniser, index );
if ( line[ strlen( line ) - 1 ] == '\r' )
{
- valerie_util_chomp( line );
- valerie_status_parse( &status, line );
- valerie_notifier_put( notifier, &status );
+ mvcp_util_chomp( line );
+ mvcp_status_parse( &status, line );
+ mvcp_notifier_put( notifier, &status );
}
else
{
}
}
- valerie_notifier_disconnected( notifier );
- valerie_tokeniser_close( tokeniser );
+ mvcp_notifier_disconnected( notifier );
+ mvcp_tokeniser_close( tokeniser );
remote->terminated = 1;
return NULL;
/** Forward reference.
*/
-static void valerie_remote_disconnect( valerie_remote remote );
+static void mvcp_remote_disconnect( mvcp_remote remote );
/** Connect to the server.
*/
-static valerie_response valerie_remote_connect( valerie_remote remote )
+static mvcp_response mvcp_remote_connect( mvcp_remote remote )
{
- valerie_response response = NULL;
+ mvcp_response response = NULL;
- valerie_remote_disconnect( remote );
+ mvcp_remote_disconnect( remote );
if ( !remote->connected )
{
signal( SIGPIPE, SIG_IGN );
- remote->socket = valerie_socket_init( remote->server, remote->port );
- remote->status = valerie_socket_init( remote->server, remote->port );
+ remote->socket = mvcp_socket_init( remote->server, remote->port );
+ remote->status = mvcp_socket_init( remote->server, remote->port );
- if ( valerie_socket_connect( remote->socket ) == 0 )
+ if ( mvcp_socket_connect( remote->socket ) == 0 )
{
- response = valerie_response_init( );
- valerie_remote_read_response( remote->socket, response );
+ response = mvcp_response_init( );
+ mvcp_remote_read_response( remote->socket, response );
}
- if ( response != NULL && valerie_socket_connect( remote->status ) == 0 )
+ if ( response != NULL && mvcp_socket_connect( remote->status ) == 0 )
{
- valerie_response status_response = valerie_response_init( );
- valerie_remote_read_response( remote->status, status_response );
- if ( valerie_response_get_error_code( status_response ) == 100 )
- pthread_create( &remote->thread, NULL, valerie_remote_status_thread, remote );
- valerie_response_close( status_response );
+ mvcp_response status_response = mvcp_response_init( );
+ mvcp_remote_read_response( remote->status, status_response );
+ if ( mvcp_response_get_error_code( status_response ) == 100 )
+ pthread_create( &remote->thread, NULL, mvcp_remote_status_thread, remote );
+ mvcp_response_close( status_response );
remote->connected = 1;
}
}
/** Execute the command.
*/
-static valerie_response valerie_remote_execute( valerie_remote remote, char *command )
+static mvcp_response mvcp_remote_execute( mvcp_remote remote, char *command )
{
- valerie_response response = NULL;
+ mvcp_response response = NULL;
pthread_mutex_lock( &remote->mutex );
- if ( valerie_socket_write_data( remote->socket, command, strlen( command ) ) == strlen( command ) )
+ if ( mvcp_socket_write_data( remote->socket, command, strlen( command ) ) == strlen( command ) )
{
- response = valerie_response_init( );
- valerie_socket_write_data( remote->socket, "\r\n", 2 );
- valerie_remote_read_response( remote->socket, response );
+ response = mvcp_response_init( );
+ mvcp_socket_write_data( remote->socket, "\r\n", 2 );
+ mvcp_remote_read_response( remote->socket, response );
}
pthread_mutex_unlock( &remote->mutex );
return response;
/** Push a westley document to the server.
*/
-static valerie_response valerie_remote_receive( valerie_remote remote, char *command, char *buffer )
+static mvcp_response mvcp_remote_receive( mvcp_remote remote, char *command, char *buffer )
{
- valerie_response response = NULL;
+ mvcp_response response = NULL;
pthread_mutex_lock( &remote->mutex );
- if ( valerie_socket_write_data( remote->socket, command, strlen( command ) ) == strlen( command ) )
+ if ( mvcp_socket_write_data( remote->socket, command, strlen( command ) ) == strlen( command ) )
{
char temp[ 20 ];
int length = strlen( buffer );
- response = valerie_response_init( );
- valerie_socket_write_data( remote->socket, "\r\n", 2 );
+ response = mvcp_response_init( );
+ mvcp_socket_write_data( remote->socket, "\r\n", 2 );
sprintf( temp, "%d", length );
- valerie_socket_write_data( remote->socket, temp, strlen( temp ) );
- valerie_socket_write_data( remote->socket, "\r\n", 2 );
- valerie_socket_write_data( remote->socket, buffer, length );
- valerie_socket_write_data( remote->socket, "\r\n", 2 );
- valerie_remote_read_response( remote->socket, response );
+ mvcp_socket_write_data( remote->socket, temp, strlen( temp ) );
+ mvcp_socket_write_data( remote->socket, "\r\n", 2 );
+ mvcp_socket_write_data( remote->socket, buffer, length );
+ mvcp_socket_write_data( remote->socket, "\r\n", 2 );
+ mvcp_remote_read_response( remote->socket, response );
}
pthread_mutex_unlock( &remote->mutex );
return response;
/** Push a producer to the server.
*/
-static valerie_response valerie_remote_push( valerie_remote remote, char *command, mlt_service service )
+static mvcp_response mvcp_remote_push( mvcp_remote remote, char *command, mlt_service service )
{
- valerie_response response = NULL;
+ mvcp_response response = NULL;
if ( service != NULL )
{
mlt_consumer consumer = mlt_factory_consumer( NULL, "westley", "buffer" );
mlt_consumer_connect( consumer, service );
mlt_consumer_start( consumer );
buffer = mlt_properties_get( properties, "buffer" );
- response = valerie_remote_receive( remote, command, buffer );
+ response = mvcp_remote_receive( remote, command, buffer );
mlt_consumer_close( consumer );
}
return response;
/** Disconnect.
*/
-static void valerie_remote_disconnect( valerie_remote remote )
+static void mvcp_remote_disconnect( mvcp_remote remote )
{
if ( remote != NULL && remote->terminated )
{
if ( remote->connected )
pthread_join( remote->thread, NULL );
- valerie_socket_close( remote->status );
- valerie_socket_close( remote->socket );
+ mvcp_socket_close( remote->status );
+ mvcp_socket_close( remote->socket );
remote->connected = 0;
remote->terminated = 0;
}
/** Close the parser.
*/
-static void valerie_remote_close( valerie_remote remote )
+static void mvcp_remote_close( mvcp_remote remote )
{
if ( remote != NULL )
{
remote->terminated = 1;
- valerie_remote_disconnect( remote );
+ mvcp_remote_disconnect( remote );
pthread_mutex_destroy( &remote->mutex );
free( remote->server );
free( remote );
/** Read response.
*/
-static int valerie_remote_read_response( valerie_socket socket, valerie_response response )
+static int mvcp_remote_read_response( mvcp_socket socket, mvcp_response response )
{
char temp[ 10240 ];
int length;
int terminated = 0;
- while ( !terminated && ( length = valerie_socket_read_data( socket, temp, 10240 ) ) >= 0 )
+ while ( !terminated && ( length = mvcp_socket_read_data( socket, temp, 10240 ) ) >= 0 )
{
int position = 0;
temp[ length ] = '\0';
- valerie_response_write( response, temp, length );
- position = valerie_response_count( response ) - 1;
+ mvcp_response_write( response, temp, length );
+ position = mvcp_response_count( response ) - 1;
if ( position < 0 || temp[ strlen( temp ) - 1 ] != '\n' )
continue;
- switch( valerie_response_get_error_code( response ) )
+ switch( mvcp_response_get_error_code( response ) )
{
case 201:
case 500:
- terminated = !strcmp( valerie_response_get_line( response, position ), "" );
+ terminated = !strcmp( mvcp_response_get_line( response, position ), "" );
break;
case 202:
- terminated = valerie_response_count( response ) >= 2;
+ terminated = mvcp_response_count( response ) >= 2;
break;
default:
terminated = 1;
/*
- * valerie_remote.h -- Remote Parser
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_remote.h -- Remote Parser
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_REMOTE_H_
-#define _VALERIE_REMOTE_H_
+#ifndef _MVCP_REMOTE_H_
+#define _MVCP_REMOTE_H_
/* Application header files */
-#include "valerie_parser.h"
+#include "mvcp_parser.h"
#ifdef __cplusplus
extern "C"
/** Remote parser API.
*/
-extern valerie_parser valerie_parser_init_remote( char *, int );
+extern mvcp_parser mvcp_parser_init_remote( char *, int );
#ifdef __cplusplus
}
/*
- * valerie_response.c -- Response
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_response.c -- Response
+ * 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_response.h"
+#include "mvcp_response.h"
-/** Construct a new dv response.
+/** Construct a new MVCP response.
*/
-valerie_response valerie_response_init( )
+mvcp_response mvcp_response_init( )
{
- valerie_response response = malloc( sizeof( valerie_response_t ) );
+ mvcp_response response = malloc( sizeof( mvcp_response_t ) );
if ( response != NULL )
- memset( response, 0, sizeof( valerie_response_t ) );
+ memset( response, 0, sizeof( mvcp_response_t ) );
return response;
}
-/** Clone a dv response
+/** Clone a MVCP response
*/
-valerie_response valerie_response_clone( valerie_response response )
+mvcp_response mvcp_response_clone( mvcp_response response )
{
- valerie_response clone = valerie_response_init( );
+ mvcp_response clone = mvcp_response_init( );
if ( clone != NULL && response != NULL )
{
int index = 0;
- for ( index = 0; index < valerie_response_count( response ); index ++ )
+ for ( index = 0; index < mvcp_response_count( response ); index ++ )
{
- char *line = valerie_response_get_line( response, index );
- valerie_response_printf( clone, strlen( line ) + 2, "%s\n", line );
+ char *line = mvcp_response_get_line( response, index );
+ mvcp_response_printf( clone, strlen( line ) + 2, "%s\n", line );
}
}
return clone;
/** Get the error code associated to the response.
*/
-int valerie_response_get_error_code( valerie_response response )
+int mvcp_response_get_error_code( mvcp_response response )
{
int error_code = -1;
if ( response != NULL )
/** Get the error description associated to the response.
*/
-const char *valerie_response_get_error_string( valerie_response response )
+const char *mvcp_response_get_error_string( mvcp_response response )
{
const char *error_string = "No message specified";
if ( response->count > 0 )
the user of the returned data to use a LF or CR/LF as appropriate.
*/
-char *valerie_response_get_line( valerie_response response, int index )
+char *mvcp_response_get_line( mvcp_response response, int index )
{
if ( index < response->count )
return response->array[ index ];
/** Return the number of lines of text in the response.
*/
-int valerie_response_count( valerie_response response )
+int mvcp_response_count( mvcp_response response )
{
if ( response != NULL )
return response->count;
/** Set the error and description associated to the response.
*/
-void valerie_response_set_error( valerie_response response, int error_code, const char *error_string )
+void mvcp_response_set_error( mvcp_response response, int error_code, const char *error_string )
{
if ( response->count == 0 )
{
- valerie_response_printf( response, 10240, "%d %s\n", error_code, error_string );
+ mvcp_response_printf( response, 10240, "%d %s\n", error_code, error_string );
}
else
{
/** Write formatted text to the response.
*/
-int valerie_response_printf( valerie_response response, size_t size, const char *format, ... )
+int mvcp_response_printf( mvcp_response response, size_t size, const char *format, ... )
{
int length = 0;
char *text = malloc( size );
va_start( list, format );
length = vsnprintf( text, size, format, list );
if ( length != 0 )
- valerie_response_write( response, text, length );
+ mvcp_response_write( response, text, length );
va_end( list );
free( text );
}
/** Write text to the reponse.
*/
-int valerie_response_write( valerie_response response, const char *text, int size )
+int mvcp_response_write( mvcp_response response, const char *text, int size )
{
int ret = 0;
const char *ptr = text;
/** Close the response.
*/
-void valerie_response_close( valerie_response response )
+void mvcp_response_close( mvcp_response response )
{
if ( response != NULL )
{
/*
- * valerie_response.h -- Response
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_response.h -- Response
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_RESPONSE_H_
-#define _VALERIE_RESPONSE_H_
+#ifndef _MVCP_RESPONSE_H_
+#define _MVCP_RESPONSE_H_
#include <stdio.h>
int count;
int append;
}
-*valerie_response, valerie_response_t;
+*mvcp_response, mvcp_response_t;
/** API for accessing the response structure.
*/
-extern valerie_response valerie_response_init( );
-extern valerie_response valerie_response_clone( valerie_response );
-extern int valerie_response_get_error_code( valerie_response );
-extern const char *valerie_response_get_error_string( valerie_response );
-extern char *valerie_response_get_line( valerie_response, int );
-extern int valerie_response_count( valerie_response );
-extern void valerie_response_set_error( valerie_response, int, const char * );
-extern int valerie_response_printf( valerie_response, size_t, const char *, ... );
-extern int valerie_response_write( valerie_response, const char *, int );
-extern void valerie_response_close( valerie_response );
+extern mvcp_response mvcp_response_init( );
+extern mvcp_response mvcp_response_clone( mvcp_response );
+extern int mvcp_response_get_error_code( mvcp_response );
+extern const char *mvcp_response_get_error_string( mvcp_response );
+extern char *mvcp_response_get_line( mvcp_response, int );
+extern int mvcp_response_count( mvcp_response );
+extern void mvcp_response_set_error( mvcp_response, int, const char * );
+extern int mvcp_response_printf( mvcp_response, size_t, const char *, ... );
+extern int mvcp_response_write( mvcp_response, const char *, int );
+extern void mvcp_response_close( mvcp_response );
#ifdef __cplusplus
}
/*
- * valerie_socket.c -- Client Socket
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_socket.c -- Client Socket
+ * 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 <sys/time.h>
/* Application header files */
-#include "valerie_socket.h"
+#include "mvcp_socket.h"
/** Initialise the socket.
*/
-valerie_socket valerie_socket_init( char *server, int port )
+mvcp_socket mvcp_socket_init( char *server, int port )
{
- valerie_socket socket = malloc( sizeof( valerie_socket_t ) );
+ mvcp_socket socket = malloc( sizeof( mvcp_socket_t ) );
if ( socket != NULL )
{
- memset( socket, 0, sizeof( valerie_socket_t ) );
+ memset( socket, 0, sizeof( mvcp_socket_t ) );
socket->fd = -1;
socket->server = strdup( server );
socket->port = port;
/** Connect to the server.
*/
-int valerie_socket_connect( valerie_socket connection )
+int mvcp_socket_connect( mvcp_socket connection )
{
int ret = 0;
struct hostent *host;
/** Convenience constructor for a connected file descriptor.
*/
-valerie_socket valerie_socket_init_fd( int fd )
+mvcp_socket mvcp_socket_init_fd( int fd )
{
- valerie_socket socket = malloc( sizeof( valerie_socket_t ) );
+ mvcp_socket socket = malloc( sizeof( mvcp_socket_t ) );
if ( socket != NULL )
{
- memset( socket, 0, sizeof( valerie_socket_t ) );
+ memset( socket, 0, sizeof( mvcp_socket_t ) );
socket->fd = fd;
socket->no_close = 1;
}
/** Read an arbitrarily formatted block of data from the server.
*/
-int valerie_socket_read_data( valerie_socket socket, char *data, int length )
+int mvcp_socket_read_data( mvcp_socket socket, char *data, int length )
{
struct timeval tv = { 1, 0 };
fd_set rfds;
/** Write an arbitrarily formatted block of data to the server.
*/
-int valerie_socket_write_data( valerie_socket socket, const char *data, int length )
+int mvcp_socket_write_data( mvcp_socket socket, const char *data, int length )
{
int used = 0;
/** Close the socket.
*/
-void valerie_socket_close( valerie_socket socket )
+void mvcp_socket_close( mvcp_socket socket )
{
if ( socket->fd > 0 && !socket->no_close )
close( socket->fd );
/*
- * valerie_socket.h -- Client Socket
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_socket.h -- Client Socket
+ * 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
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifndef _VALERIE_SOCKET_H_
-#define _VALERIE_SOCKET_H_
+#ifndef _MVCP_SOCKET_H_
+#define _MVCP_SOCKET_H_
#ifdef __cplusplus
extern "C"
int fd;
int no_close;
}
-*valerie_socket, valerie_socket_t;
+*mvcp_socket, mvcp_socket_t;
/** Remote parser API.
*/
-extern valerie_socket valerie_socket_init( char *, int );
-extern int valerie_socket_connect( valerie_socket );
-extern valerie_socket valerie_socket_init_fd( int );
-extern int valerie_socket_read_data( valerie_socket, char *, int );
-extern int valerie_socket_write_data( valerie_socket, const char *, int );
-extern void valerie_socket_close( valerie_socket );
+extern mvcp_socket mvcp_socket_init( char *, int );
+extern int mvcp_socket_connect( mvcp_socket );
+extern mvcp_socket mvcp_socket_init_fd( int );
+extern int mvcp_socket_read_data( mvcp_socket, char *, int );
+extern int mvcp_socket_write_data( mvcp_socket, const char *, int );
+extern void mvcp_socket_close( mvcp_socket );
#ifdef __cplusplus
}
/*
- * 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;
/** 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 ) );
}
/*
- * valerie_status.h -- Unit Status Handling
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_status.h -- 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_STATUS_H_
-#define _VALERIE_STATUS_H_
+#ifndef _MVCP_STATUS_H_
+#define _MVCP_STATUS_H_
#include <stdint.h>
int clip_index;
int dummy;
}
-*valerie_status, valerie_status_t;
+*mvcp_status, mvcp_status_t;
-/** DV1394 Status API
+/** MVCP Status API
*/
-extern void valerie_status_parse( valerie_status, char * );
-extern char *valerie_status_serialise( valerie_status, char *, int );
-extern int valerie_status_compare( valerie_status, valerie_status );
-extern valerie_status valerie_status_copy( valerie_status, valerie_status );
+extern void mvcp_status_parse( mvcp_status, char * );
+extern char *mvcp_status_serialise( mvcp_status, char *, int );
+extern int mvcp_status_compare( mvcp_status, mvcp_status );
+extern mvcp_status mvcp_status_copy( mvcp_status, mvcp_status );
#ifdef __cplusplus
}
/*
- * valerie_tokeniser.c -- String tokeniser
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_tokeniser.c -- String tokeniser
+ * 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_tokeniser.h"
+#include "mvcp_tokeniser.h"
/** Initialise a tokeniser.
*/
-valerie_tokeniser valerie_tokeniser_init( )
+mvcp_tokeniser mvcp_tokeniser_init( )
{
- valerie_tokeniser tokeniser = malloc( sizeof( valerie_tokeniser_t ) );
+ mvcp_tokeniser tokeniser = malloc( sizeof( mvcp_tokeniser_t ) );
if ( tokeniser != NULL )
- memset( tokeniser, 0, sizeof( valerie_tokeniser_t ) );
+ memset( tokeniser, 0, sizeof( mvcp_tokeniser_t ) );
return tokeniser;
}
/** Clear the tokeniser.
*/
-static void valerie_tokeniser_clear( valerie_tokeniser tokeniser )
+static void mvcp_tokeniser_clear( mvcp_tokeniser tokeniser )
{
int index = 0;
for ( index = 0; index < tokeniser->count; index ++ )
/** Append a string to the tokeniser.
*/
-static int valerie_tokeniser_append( valerie_tokeniser tokeniser, char *token )
+static int mvcp_tokeniser_append( mvcp_tokeniser tokeniser, char *token )
{
int error = 0;
/** Parse a string by splitting on the delimiter provided.
*/
-int valerie_tokeniser_parse_new( valerie_tokeniser tokeniser, char *string, const char *delimiter )
+int mvcp_tokeniser_parse_new( mvcp_tokeniser tokeniser, char *string, const char *delimiter )
{
int count = 0;
int length = strlen( string );
int index = 0;
char *token = strdup( string );
- valerie_tokeniser_clear( tokeniser );
+ mvcp_tokeniser_clear( tokeniser );
tokeniser->input = strdup( string );
strcpy( token, "" );
if ( end == NULL )
{
strcat( token, start );
- valerie_tokeniser_append( tokeniser, token );
+ mvcp_tokeniser_append( tokeniser, token );
index = length;
count ++;
}
index += end - start;
if ( token[ 0 ] != '\"' || ( token[ 0 ] == '\"' && token[ strlen( token ) - 1 ] == '\"' ) )
{
- valerie_tokeniser_append( tokeniser, token );
+ mvcp_tokeniser_append( tokeniser, token );
strcpy( token, "" );
count ++;
}
if ( !strcmp( token, "" ) )
{
count = 0 - ( count - 1 );
- valerie_tokeniser_append( tokeniser, token );
+ mvcp_tokeniser_append( tokeniser, token );
}
free( token );
/** Get the original input.
*/
-char *valerie_tokeniser_get_input( valerie_tokeniser tokeniser )
+char *mvcp_tokeniser_get_input( mvcp_tokeniser tokeniser )
{
return tokeniser->input;
}
/** Get the number of tokens.
*/
-int valerie_tokeniser_count( valerie_tokeniser tokeniser )
+int mvcp_tokeniser_count( mvcp_tokeniser tokeniser )
{
return tokeniser->count;
}
/** Get a token as a string.
*/
-char *valerie_tokeniser_get_string( valerie_tokeniser tokeniser, int index )
+char *mvcp_tokeniser_get_string( mvcp_tokeniser tokeniser, int index )
{
if ( index < tokeniser->count )
return tokeniser->tokens[ index ];
/** Close the tokeniser.
*/
-void valerie_tokeniser_close( valerie_tokeniser tokeniser )
+void mvcp_tokeniser_close( mvcp_tokeniser tokeniser )
{
- valerie_tokeniser_clear( tokeniser );
+ mvcp_tokeniser_clear( tokeniser );
free( tokeniser->tokens );
free( tokeniser );
}
/*
- * valerie_tokeniser.h -- String tokeniser
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_tokeniser.h -- String tokeniser
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_TOKENISER_H_
-#define _VALERIE_TOKENISER_H_
+#ifndef _MVCP_TOKENISER_H_
+#define _MVCP_TOKENISER_H_
#ifdef __cplusplus
extern "C"
int count;
int size;
}
-*valerie_tokeniser, valerie_tokeniser_t;
+*mvcp_tokeniser, mvcp_tokeniser_t;
/** Remote parser API.
*/
-extern valerie_tokeniser valerie_tokeniser_init( );
-extern int valerie_tokeniser_parse_new( valerie_tokeniser, char *, const char * );
-extern char *valerie_tokeniser_get_input( valerie_tokeniser );
-extern int valerie_tokeniser_count( valerie_tokeniser );
-extern char *valerie_tokeniser_get_string( valerie_tokeniser, int );
-extern void valerie_tokeniser_close( valerie_tokeniser );
+extern mvcp_tokeniser mvcp_tokeniser_init( );
+extern int mvcp_tokeniser_parse_new( mvcp_tokeniser, char *, const char * );
+extern char *mvcp_tokeniser_get_input( mvcp_tokeniser );
+extern int mvcp_tokeniser_count( mvcp_tokeniser );
+extern char *mvcp_tokeniser_get_string( mvcp_tokeniser, int );
+extern void mvcp_tokeniser_close( mvcp_tokeniser );
#ifdef __cplusplus
}
/*
- * valerie_util.c -- General Purpose Client Utilities
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_util.c -- General Purpose Client Utilities
+ * 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 <ctype.h>
/* Application header files */
-#include "valerie_util.h"
+#include "mvcp_util.h"
/** Remove LF or CR/LF terminations from the input string.
*/
-char *valerie_util_chomp( char *input )
+char *mvcp_util_chomp( char *input )
{
if ( input != NULL )
{
/** Remove leading and trailing spaces from the input string.
*/
-char *valerie_util_trim( char *input )
+char *mvcp_util_trim( char *input )
{
if ( input != NULL )
{
/** Strip the specified string of leading and trailing 'value' (ie: ").
*/
-char *valerie_util_strip( char *input, char value )
+char *mvcp_util_strip( char *input, char value )
{
if ( input != NULL )
{
/*
- * valerie_util.h -- General Purpose Client Utilities
- * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
+ * mvcp_util.h -- General Purpose Client Utilities
+ * 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _VALERIE_UTIL_H_
-#define _VALERIE_UTIL_H_
+#ifndef _MVCP_UTIL_H_
+#define _MVCP_UTIL_H_
#ifdef __cplusplus
extern "C"
{
#endif
-extern char *valerie_util_chomp( char * );
-extern char *valerie_util_trim( char * );
-extern char *valerie_util_strip( char *, char );
+extern char *mvcp_util_chomp( char * );
+extern char *mvcp_util_trim( char * );
+extern char *mvcp_util_strip( char *, char );
#ifdef __cplusplus
}