Cleanup license declarations and remove dv1394d references.
[melted] / src / modules / westley / consumer_westley.c
index 8bf93c9..35d4223 100644 (file)
@@ -3,19 +3,19 @@
  * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
  * Author: Dan Dennedy <dan@dennedy.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "consumer_westley.h"
@@ -184,6 +184,7 @@ static void serialise_properties( serialise_context context, mlt_properties prop
                         strcmp( name, "in" ) != 0 &&
                         strcmp( name, "out" ) != 0 && 
                         strcmp( name, "id" ) != 0 && 
+                        strcmp( name, "title" ) != 0 && 
                         strcmp( name, "root" ) != 0 && 
                         strcmp( name, "width" ) != 0 &&
                         strcmp( name, "height" ) != 0 )
@@ -240,6 +241,8 @@ static inline void serialise_service_filters( serialise_context context, mlt_ser
                                int out = mlt_properties_get_position( properties, "out" );
                                p = xmlNewChild( node, NULL, "filter", NULL );
                                xmlNewProp( p, "id", id );
+                               if ( mlt_properties_get( properties, "title" ) )
+                                       xmlNewProp( p, "title", mlt_properties_get( properties, "title" ) );
                                if ( in != 0 || out != 0 )
                                {
                                        char temp[ 20 ];
@@ -272,6 +275,8 @@ static void serialise_producer( serialise_context context, mlt_service service,
 
                // Set the id
                xmlNewProp( child, "id", id );
+               if ( mlt_properties_get( properties, "title" ) )
+                       xmlNewProp( child, "title", mlt_properties_get( properties, "title" ) );
                xmlNewProp( child, "in", mlt_properties_get( properties, "in" ) );
                xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) );
                serialise_properties( context, properties, child );
@@ -377,6 +382,8 @@ static void serialise_playlist( serialise_context context, mlt_service service,
 
                // Set the id
                xmlNewProp( child, "id", id );
+               if ( mlt_properties_get( properties, "title" ) )
+                       xmlNewProp( child, "title", mlt_properties_get( properties, "title" ) );
 
                // Store application specific properties
                serialise_store_properties( context, properties, child, context->store );
@@ -397,7 +404,7 @@ static void serialise_playlist( serialise_context context, mlt_service service,
                                        char length[ 20 ];
                                        length[ 19 ] = '\0';
                                        xmlNode *entry = xmlNewChild( child, NULL, "blank", NULL );
-                                       snprintf( length, 19, "%d", info.frame_count );
+                                       snprintf( length, 19, "%d", (int)info.frame_count );
                                        xmlNewProp( entry, "length", length );
                                }
                                else
@@ -406,9 +413,9 @@ static void serialise_playlist( serialise_context context, mlt_service service,
                                        xmlNode *entry = xmlNewChild( child, NULL, "entry", NULL );
                                        id = westley_get_id( context, MLT_SERVICE( producer ), westley_existing );
                                        xmlNewProp( entry, "producer", id );
-                                       sprintf( temp, "%d", info.frame_in );
+                                       sprintf( temp, "%d", (int)info.frame_in );
                                        xmlNewProp( entry, "in", temp );
-                                       sprintf( temp, "%d", info.frame_out );
+                                       sprintf( temp, "%d", (int)info.frame_out );
                                        xmlNewProp( entry, "out", temp );
                                        if ( info.repeat > 1 )
                                        {
@@ -455,6 +462,10 @@ static void serialise_tractor( serialise_context context, mlt_service service, x
 
                // Set the id
                xmlNewProp( child, "id", id );
+               if ( mlt_properties_get( properties, "title" ) )
+                       xmlNewProp( child, "title", mlt_properties_get( properties, "title" ) );
+               if ( mlt_properties_get( properties, "global_feed" ) )
+                       xmlNewProp( child, "global_feed", mlt_properties_get( properties, "global_feed" ) );
                xmlNewProp( child, "in", mlt_properties_get( properties, "in" ) );
                xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) );
 
@@ -487,6 +498,8 @@ static void serialise_filter( serialise_context context, mlt_service service, xm
 
                // Set the id
                xmlNewProp( child, "id", id );
+               if ( mlt_properties_get( properties, "title" ) )
+                       xmlNewProp( child, "title", mlt_properties_get( properties, "title" ) );
                xmlNewProp( child, "in", mlt_properties_get( properties, "in" ) );
                xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) );
 
@@ -514,6 +527,8 @@ static void serialise_transition( serialise_context context, mlt_service service
        
                // Set the id
                xmlNewProp( child, "id", id );
+               if ( mlt_properties_get( properties, "title" ) )
+                       xmlNewProp( child, "title", mlt_properties_get( properties, "title" ) );
                xmlNewProp( child, "in", mlt_properties_get( properties, "in" ) );
                xmlNewProp( child, "out", mlt_properties_get( properties, "out" ) );
 
@@ -534,7 +549,7 @@ static void serialise_service( serialise_context context, mlt_service service, x
                if ( strcmp( mlt_type, "producer" ) == 0 )
                {
                        char *mlt_service = mlt_properties_get( properties, "mlt_service" );
-                       if ( mlt_properties_get( properties, "westley" ) == NULL && !strcmp( mlt_service, "tractor" ) )
+                       if ( mlt_properties_get( properties, "westley" ) == NULL && ( mlt_service != NULL && !strcmp( mlt_service, "tractor" ) ) )
                        {
                                context->pass = 0;
                                serialise_tractor( context, service, node );
@@ -632,6 +647,7 @@ xmlDocPtr westley_make_doc( mlt_consumer consumer, mlt_service service )
        // Assign a title property
        if ( mlt_properties_get( properties, "title" ) != NULL )
                xmlNewProp( root, "title", mlt_properties_get( properties, "title" ) );
+       mlt_properties_set_int( properties, "global_feed", 1 );
 
        // Construct the context maps
        context->id_map = mlt_properties_new();