X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fvalerie%2Fvalerie.c;h=8499f440b8e05a9bbfba46dee4631c8c2d8d56d0;hb=9b115c18489fdc84e2198fef65e4e444f579ff24;hp=b1c5f9402865cba9c87bace901ad49598436c585;hpb=521423f4869254f213455a239688159c283594b0;p=melted diff --git a/src/valerie/valerie.c b/src/valerie/valerie.c index b1c5f94..8499f44 100644 --- a/src/valerie/valerie.c +++ b/src/valerie/valerie.c @@ -145,6 +145,37 @@ valerie_error_code valerie_execute( valerie this, size_t size, char *format, ... return error; } +/** Execute a command. +*/ + +valerie_error_code valerie_push( valerie this, mlt_service service, size_t size, char *format, ... ) +{ + valerie_error_code error = valerie_server_unavailable; + char *command = malloc( size ); + if ( this != NULL && command != NULL ) + { + va_list list; + 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 ); + } + else + { + error = valerie_invalid_command; + } + va_end( list ); + } + else + { + error = valerie_malloc_failed; + } + free( command ); + return error; +} + /** Set a global property. */ @@ -252,6 +283,14 @@ valerie_error_code valerie_unit_append( valerie this, int unit, char *file, int3 return valerie_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_push( valerie this, int unit, char *command, mlt_service service ) +{ + return valerie_push( this, service, 10240, "PUSH U%d %s", unit, command ); +} + /** Clean the unit - this function removes all but the currently playing clip. */ @@ -260,6 +299,14 @@ valerie_error_code valerie_unit_clean( valerie this, int unit ) return valerie_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 ) +{ + return valerie_execute( this, 1024, "CLEAR U%d", unit ); +} + /** Move clips on the units playlist. */ @@ -297,7 +344,7 @@ valerie_error_code valerie_unit_clip_insert( valerie this, int unit, valerie_cli { 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 ); + return valerie_execute( this, 1024, "INSERT U%d \"%s\" %s %d %d", unit, file, temp, in, out ); } /** Play the unit at normal speed.