X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fvalerie%2Fconsumer_valerie.c;h=984c743aef89c9a9fa7354f8c0a590d5e7262ebe;hb=f4bb8619271de912e431dbaf5a4a7eb197b9ed04;hp=71a274c8e946b833cd9be155d4c1ed1fdeda1359;hpb=4580365ba2f57f530aa4bdeb57788822fab09e2f;p=melted diff --git a/src/modules/valerie/consumer_valerie.c b/src/modules/valerie/consumer_valerie.c index 71a274c..984c743 100644 --- a/src/modules/valerie/consumer_valerie.c +++ b/src/modules/valerie/consumer_valerie.c @@ -46,19 +46,19 @@ mlt_consumer consumer_valerie_init( char *arg ) { char *temp = NULL; int port = atoi( strchr( arg, ':' ) + 1 ); - mlt_properties_set( mlt_consumer_properties( this ), "server", arg ); - temp = mlt_properties_get( mlt_consumer_properties( this ), "server" ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "server", arg ); + temp = mlt_properties_get( MLT_CONSUMER_PROPERTIES( this ), "server" ); *( strchr( temp, ':' ) ) = '\0'; - mlt_properties_set_int( mlt_consumer_properties( this ), "port", port ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "port", port ); } else { - mlt_properties_set( mlt_consumer_properties( this ), "server", arg == NULL ? "localhost" : arg ); - mlt_properties_set_int( mlt_consumer_properties( this ), "port", 5250 ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "server", arg == NULL ? "localhost" : arg ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "port", 5250 ); } - mlt_properties_set_int( mlt_consumer_properties( this ), "unit", 0 ); - mlt_properties_set( mlt_consumer_properties( this ), "command", "append" ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( this ), "unit", 0 ); + mlt_properties_set( MLT_CONSUMER_PROPERTIES( this ), "command", "append" ); // Allow thread to be started/stopped this->start = consumer_start; @@ -78,17 +78,18 @@ mlt_consumer consumer_valerie_init( char *arg ) static int consumer_start( mlt_consumer this ) { // Get the producer service - mlt_service service = mlt_service_producer( mlt_consumer_service( this ) ); + mlt_service service = mlt_service_producer( MLT_CONSUMER_SERVICE( this ) ); // Get the properties object - mlt_properties properties = mlt_consumer_properties( this ); + mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); // Get all the properties now char *server = mlt_properties_get( properties, "server" ); int port = mlt_properties_get_int( properties, "port" ); - char *command = mlt_properties_get( properties, "command" ); + char *cmd = mlt_properties_get( properties, "command" ); int unit = mlt_properties_get_int( properties, "unit" ); char *title = mlt_properties_get( properties, "title" ); + char command[ 2048 ]; // If this is a reuse, then a valerie object will exist valerie connection = mlt_properties_get_data( properties, "connection", NULL ); @@ -96,6 +97,24 @@ static int consumer_start( mlt_consumer this ) // Special case - we can get a doc too... char *doc = mlt_properties_get( properties, "westley" ); + // Set the title if provided + if ( service != NULL ) + { + if ( title != NULL ) + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", title ); + else if ( mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "title" ) == NULL ) + mlt_properties_set( MLT_SERVICE_PROPERTIES( service ), "title", "Anonymous Submission" ); + title = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "title" ); + } + + strcpy( command, cmd == NULL ? "" : cmd ); + if ( strstr( command, "title=" ) == NULL && title != NULL ) + { + strcat( command, " title=\"" ); + strcat( command, title ); + strcat( command, "\"" ); + } + if ( service != NULL || doc != NULL ) { // Initiate the connection if required @@ -111,6 +130,7 @@ static int consumer_start( mlt_consumer this ) else { fprintf( stderr, "Unable to connect to the server at %s:%d\n", server, port ); + mlt_properties_set_int( properties, "_error", 1 ); valerie_close( connection ); valerie_parser_close( parser ); connection = NULL; @@ -124,12 +144,6 @@ static int consumer_start( mlt_consumer this ) { int error; - // Set the title if provided - if ( title != NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", title ); - else if ( mlt_properties_get( mlt_service_properties( service ), "title" ) == NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", "Anonymous Submission" ); - // Push the service error = valerie_unit_push( connection, unit, command, service );