]> git.sesse.net Git - mlt/commitdiff
Tell loader how to use WebVfx.
authorDan Dennedy <dan@dennedy.org>
Thu, 14 Mar 2013 03:15:53 +0000 (20:15 -0700)
committerDan Dennedy <dan@dennedy.org>
Thu, 14 Mar 2013 03:16:16 +0000 (20:16 -0700)
With my latest (merged) patches to WebVfx, one can load plain old HTML
and QML files. They do not need webvfx script to initialize rendering -
with some caveats about the meaning of document-loaded. However, without
this loader change, plain resources need  to prefaced with "plain:". The
loader producer can now do that and instead "webvfx:" is needed to tell
webvfx to wait for script in the content to call
WebVfx.renderReady(true) (unless you use "webvfx:plain:...").

Also, WebVfx can also now load HTML over HTTP. This is especially handy
if your content is updating itself with data from a web service.
Otherwise, you will run into cross-site-scripting errors.

src/modules/core/loader.dict
src/modules/core/producer_loader.c

index 8a854d01fcd28da028c2ac0cf97108ca763f15c0..2956cc3ffe59c1dedc377ed8120f904efa700d49 100644 (file)
@@ -1,4 +1,7 @@
-http://*=avformat
+http://*=avformat,webvfx:plain:
+https://*=webvfx:plain:
+plain:http://*=webvfx:plain:
+plain:https://*=webvfx:plain:
 <?xml*=xml-string
 *.mlt=xml
 *.westley=xml
@@ -13,10 +16,13 @@ http://*=avformat
 *.exr=qimage
 *.gif=pixbuf,qimage
 *.graphics=xml
+*.htm=webvfx:plain:
+*.html=webvfx:plain:
 *.jfx=xml
 *.jef=xml
 *.jpg=pixbuf,qimage
 *.jpeg=pixbuf,qimage
+*.kdenlivetitle=kdenlivetitle
 *.kino=xml
 *.mp3=avformat
 *.mov=mcdv,avformat,libdv
@@ -28,6 +34,7 @@ http://*=avformat
 *.pgm=pgm,pixbuf,qimage
 *.png=pixbuf,qimage
 *.psd=qimage
+*.qml=webvfx:plain:
 *.story=xml
 *.svg=pixbuf,qimage
 *.swf=avformat,swfdec
@@ -40,5 +47,4 @@ http://*=avformat
 *.wmv=avformat
 *.xcf=qimage
 *.xml=xml
-*.kdenlivetitle=kdenlivetitle
 *=avformat
index 9571fb803b9cd94b8046b3d187d01c30115d6cba..ccf2e4469fb337fd870ba1b4b1dd09eafc6d5511 100644 (file)
@@ -40,7 +40,23 @@ static mlt_producer create_from( mlt_profile profile, char *file, char *services
                char *p = strchr( service, ',' );
                if ( p != NULL )
                        *p ++ = '\0';
-               producer = mlt_factory_producer( profile, service, file );
+
+               // If  the service name has a colon as field delimiter, then treat the
+               // second field as a prefix for the file/url.
+               char *prefix = strchr( service, ':' );
+               if ( prefix )
+               {
+                       *prefix ++ = '\0';
+                       char* prefix_file = calloc( 1, strlen( file ) + strlen( prefix ) + 1 );
+                       strcpy( prefix_file, prefix );
+                       strcat( prefix_file, file );
+                       producer = mlt_factory_producer( profile, service, prefix_file );
+                       free( prefix_file );
+               }
+               else
+               {
+                       producer = mlt_factory_producer( profile, service, file );
+               }
                service = p;
        }
        while ( producer == NULL && service != NULL );