int melted_push( command_argument cmd_arg, mlt_service service )
{
melted_unit unit = melted_get_unit(cmd_arg->unit);
- if ( unit != NULL && service != NULL )
+ if ( !unit )
+ return RESPONSE_INVALID_UNIT;
+ if ( service != NULL )
if ( melted_unit_append_service( unit, service ) == mvcp_ok )
return RESPONSE_SUCCESS;
return RESPONSE_BAD_FILE;
int melted_receive( command_argument cmd_arg, char *doc )
{
melted_unit unit = melted_get_unit(cmd_arg->unit);
- if ( unit != NULL )
+ if ( unit == NULL )
+ return RESPONSE_INVALID_UNIT;
+ else
{
// 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 );
+ mlt_producer producer = mlt_factory_producer( profile, "xml-string", doc );
if ( producer != NULL )
{
if ( melted_unit_append_service( unit, MLT_PRODUCER_SERVICE( producer ) ) == mvcp_ok )
melted_unit unit = melted_get_unit(cmd_arg->unit);
if ( unit == NULL )
return RESPONSE_INVALID_UNIT;
- else
+ else if ( melted_unit_has_terminated( unit ) )
+ melted_unit_change_position( unit, 0, 0 );
+ else
melted_unit_play( unit, -2000 );
return RESPONSE_SUCCESS;
}
melted_unit unit = melted_get_unit(cmd_arg->unit);
if ( unit == NULL )
return RESPONSE_INVALID_UNIT;
- else
+ else if ( melted_unit_has_terminated( unit ) )
+ melted_unit_change_position( unit, 0, 0 );
+ else
melted_unit_play( unit, 2000 );
return RESPONSE_SUCCESS;
}
{
melted_unit unit = melted_get_unit(cmd_arg->unit);
char *name = (char*) cmd_arg->argument;
- char *value = melted_unit_get( unit, name );
if (unit == NULL)
+ {
return RESPONSE_INVALID_UNIT;
- else if ( value != NULL )
- mvcp_response_printf( cmd_arg->response, 1024, "%s\n", value );
+ }
+ else
+ {
+ char *value = melted_unit_get( unit, name );
+ if ( value != NULL )
+ mvcp_response_printf( cmd_arg->response, 1024, "%s\n", value );
+ }
return RESPONSE_SUCCESS;
}