X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmiracle%2Fmiracle_unit_commands.c;h=97fb2dd0934aeb3a6e5edc25a08357e682cfcb30;hb=f4d4669b66a9f23be85527f65dec19a566db561c;hp=53966d46a0c939ef897395f4ed7873e0999af0c9;hpb=1d3ab5568258841b1741b8c2fc88ce4e958e6fc6;p=melted diff --git a/src/miracle/miracle_unit_commands.c b/src/miracle/miracle_unit_commands.c index 53966d4..97fb2dd 100644 --- a/src/miracle/miracle_unit_commands.c +++ b/src/miracle/miracle_unit_commands.c @@ -181,6 +181,20 @@ int miracle_clean( command_argument cmd_arg ) return RESPONSE_SUCCESS; } +int miracle_wipe( command_argument cmd_arg ) +{ + miracle_unit unit = miracle_get_unit(cmd_arg->unit); + + if (unit == NULL) + return RESPONSE_INVALID_UNIT; + else + { + if ( miracle_unit_wipe( unit ) != valerie_ok ) + return RESPONSE_BAD_FILE; + } + return RESPONSE_SUCCESS; +} + int miracle_clear( command_argument cmd_arg ) { miracle_unit unit = miracle_get_unit(cmd_arg->unit); @@ -254,6 +268,37 @@ int miracle_append( command_argument cmd_arg ) return RESPONSE_SUCCESS; } +int miracle_push( command_argument cmd_arg, mlt_service service ) +{ + miracle_unit unit = miracle_get_unit(cmd_arg->unit); + if ( unit != NULL && service != NULL ) + if ( miracle_unit_append_service( unit, service ) == valerie_ok ) + return RESPONSE_SUCCESS; + return RESPONSE_BAD_FILE; +} + +int miracle_receive( command_argument cmd_arg, char *doc ) +{ + miracle_unit unit = miracle_get_unit(cmd_arg->unit); + if ( unit != NULL ) + { + // Get the consumer's profile + mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); + mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( consumer ) ); + mlt_producer producer = mlt_factory_producer( profile, "westley-xml", doc ); + if ( producer != NULL ) + { + if ( miracle_unit_append_service( unit, MLT_PRODUCER_SERVICE( producer ) ) == valerie_ok ) + { + mlt_producer_close( producer ); + return RESPONSE_SUCCESS; + } + mlt_producer_close( producer ); + } + } + return RESPONSE_BAD_FILE; +} + int miracle_play( command_argument cmd_arg ) { miracle_unit unit = miracle_get_unit(cmd_arg->unit);