return error;
}
+/** Execute a command.
+*/
+
+valerie_error_code valerie_receive( valerie this, char *doc, 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_received( this->parser, command, doc );
+ 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;
+}
+
+/** 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.
*/
if ( error == valerie_ok )
{
int length = valerie_response_count( this->last_response );
- char *line = valerie_response_get_line( this->last_response, length - 2 );
+ char *line = valerie_response_get_line( this->last_response, length - 1 );
if ( line == NULL || sscanf( line, "U%d", unit ) != 1 )
error = valerie_unit_creation_failed;
}
/** 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, double in, double out )
+valerie_error_code valerie_unit_load_clipped( valerie this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "LOAD U%d \"%s\" %e %e", unit, file, in, out );
+ return valerie_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.
/** 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, double in, double out )
+valerie_error_code valerie_unit_load_back_clipped( valerie this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "LOAD U%d \"!%s\" %e %e", unit, file, in, out );
+ return valerie_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, double in, double out )
+valerie_error_code valerie_unit_append( valerie this, int unit, char *file, int32_t in, int32_t out )
{
- return valerie_execute( this, 10240, "APND U%d \"%s\" %e %e", unit, file, in, out );
+ 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_receive( valerie this, int unit, char *command, char *doc )
+{
+ return valerie_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 )
+{
+ return valerie_push( this, service, 10240, "PUSH U%d %s", unit, command );
}
/** Clean the unit - this function removes all but the currently playing clip.
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 );
+}
+
+/** Wipe the unit - this function removes all clips before the current one.
+*/
+
+valerie_error_code valerie_unit_wipe( valerie this, int unit )
+{
+ return valerie_execute( this, 1024, "WIPE U%d", unit );
+}
+
/** Move clips on the units playlist.
*/
/** 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, double in, double out )
+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 )
{
char temp[ 100 ];
valerie_interpret_clip_offset( temp, offset, clip );
- return valerie_execute( this, 1024, "INSERT U%d %s %s %e %e", 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.
/** Step by the number of frames on the specified unit.
*/
-valerie_error_code valerie_unit_step( valerie this, int unit, double step )
+valerie_error_code valerie_unit_step( valerie this, int unit, int32_t step )
{
- return valerie_execute( this, 1024, "STEP U%d %e", unit, step );
+ return valerie_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, double position )
+valerie_error_code valerie_unit_goto( valerie this, int unit, int32_t position )
{
- return valerie_execute( this, 1024, "GOTO U%d %e", unit, position );
+ return valerie_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, double position )
+valerie_error_code valerie_unit_clip_goto( valerie this, int unit, valerie_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 %e %s", unit, position, temp );
+ return valerie_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, double in )
+valerie_error_code valerie_unit_set_in( valerie this, int unit, int32_t in )
{
- return valerie_execute( this, 1024, "SIN U%d %e", unit, in );
+ return valerie_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, double in )
+valerie_error_code valerie_unit_clip_set_in( valerie this, int unit, valerie_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 %e %s", unit, in, temp );
+ return valerie_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, double out )
+valerie_error_code valerie_unit_set_out( valerie this, int unit, int32_t out )
{
- return valerie_execute( this, 1024, "SOUT U%d %e", unit, out );
+ return valerie_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, double in )
+valerie_error_code valerie_unit_clip_set_out( valerie this, int unit, valerie_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 %e %s", unit, in, temp );
+ return valerie_execute( this, 1024, "SOUT U%d %d %s", unit, in, temp );
}
/** Clear the in point of the loaded file on the specified unit.
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 = atof( valerie_tokeniser_get_string( tokeniser, 2 ) );
- entry->out = atof( valerie_tokeniser_get_string( tokeniser, 3 ) );
- entry->max = atof( valerie_tokeniser_get_string( tokeniser, 4 ) );
- entry->size = atof( valerie_tokeniser_get_string( tokeniser, 5 ) );
+ 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 ) );
}
valerie_tokeniser_close( tokeniser );