{"INSERT", miracle_insert, 1, ATYPE_STRING, "Insert a clip at the given clip index."},
{"REMOVE", miracle_remove, 1, ATYPE_NONE, "Remove a clip at the given clip index."},
{"CLEAN", miracle_clean, 1, ATYPE_NONE, "Clean a unit by removing all but the currently playing clip."},
+ {"CLEAR", miracle_clear, 1, ATYPE_NONE, "Clear a unit by removing all clips."},
{"MOVE", miracle_move, 1, ATYPE_INT, "Move a clip to another clip index."},
{"APND", miracle_append, 1, ATYPE_STRING, "Append a clip specified in absolute filename argument."},
{"PLAY", miracle_play, 1, ATYPE_NONE, "Play a loaded clip at speed -2000 to 2000 where 1000 = normal forward speed."},
return valerie_ok;
}
+valerie_error_code miracle_unit_clear( miracle_unit unit )
+{
+ clear_unit( unit );
+ miracle_log( LOG_DEBUG, "Cleared playlist" );
+ miracle_unit_status_communicate( unit );
+ return valerie_ok;
+}
+
valerie_error_code miracle_unit_move( miracle_unit unit, int src, int dest )
{
mlt_properties properties = unit->properties;
extern valerie_error_code miracle_unit_append( miracle_unit unit, char *clip, int32_t in, int32_t out );
extern valerie_error_code miracle_unit_remove( miracle_unit unit, int index );
extern valerie_error_code miracle_unit_clean( miracle_unit unit );
+extern valerie_error_code miracle_unit_clear( miracle_unit unit );
extern valerie_error_code miracle_unit_move( miracle_unit unit, int src, int dest );
extern int miracle_unit_transfer( miracle_unit dest_unit, miracle_unit src_unit );
extern void miracle_unit_play( miracle_unit_t *unit, int speed );
char *filename = (char*) cmd_arg->argument;
char fullname[1024];
- if ( filename[0] == '/' )
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
filename++;
snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
return RESPONSE_SUCCESS;
}
+int miracle_clear( command_argument cmd_arg )
+{
+ miracle_unit unit = miracle_get_unit(cmd_arg->unit);
+
+ if (unit == NULL)
+ return RESPONSE_INVALID_UNIT;
+ else
+ {
+ if ( miracle_unit_clear( unit ) != valerie_ok )
+ return RESPONSE_BAD_FILE;
+ }
+ return RESPONSE_SUCCESS;
+}
+
int miracle_move( command_argument cmd_arg )
{
miracle_unit unit = miracle_get_unit(cmd_arg->unit);
char *filename = (char*) cmd_arg->argument;
char fullname[1024];
- if ( filename[0] == '/' )
+ if ( strlen( cmd_arg->root_dir ) && filename[0] == '/' )
filename++;
snprintf( fullname, 1023, "%s%s", cmd_arg->root_dir, filename );
extern response_codes miracle_insert( command_argument );
extern response_codes miracle_remove( command_argument );
extern response_codes miracle_clean( command_argument );
+extern response_codes miracle_clear( command_argument );
extern response_codes miracle_move( command_argument );
extern response_codes miracle_append( command_argument );
extern response_codes miracle_play( command_argument );
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.
*/
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_clean( 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 );