]> git.sesse.net Git - mlt/commitdiff
adding the rock thrower...
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 6 Feb 2004 11:38:16 +0000 (11:38 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 6 Feb 2004 11:38:16 +0000 (11:38 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@116 d19143bc-622f-0410-bfdd-b5b2a6649095

12 files changed:
src/framework/mlt_factory.c
src/framework/mlt_tractor.c
src/miracle/miracle_unit.c
src/modules/Makefile
src/modules/fezzik/Makefile [new file with mode: 0644]
src/modules/fezzik/configure [new file with mode: 0755]
src/modules/fezzik/factory.c [new file with mode: 0644]
src/modules/fezzik/producer_fezzik.c [new file with mode: 0644]
src/modules/fezzik/producer_fezzik.h [new file with mode: 0644]
src/modules/inigo/producer_inigo.c
src/modules/westley/consumer_westley.c
src/modules/westley/producer_westley.c

index 419a7d324b2d7d6e3758cf7b2e826e52178a6f1b..85da14847e0f866bc350c1fc15ec45c2262c7c3d 100644 (file)
@@ -82,7 +82,8 @@ mlt_producer mlt_factory_producer( char *service, void *input )
        {
                mlt_properties properties = mlt_producer_properties( obj );
                mlt_properties_set( properties, "mlt_type", "producer" );
-               mlt_properties_set( properties, "mlt_service", service );
+               if ( mlt_properties_get_int( properties, "_mlt_service_hidden" ) == 0 )
+                       mlt_properties_set( properties, "mlt_service", service );
        }
        return obj;
 }
index 5e0caca72ebf9dcbe575ac6a288199b85a79ad9d..236344859fe8353c23f064b504dae5f14b1b0096 100644 (file)
@@ -135,55 +135,65 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                // Try to obtain the multitrack associated to the tractor
                mlt_multitrack multitrack = mlt_properties_get_data( properties, "multitrack", NULL );
 
+               // Or a specific producer
+               mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
+
                // If we don't have one, we're in trouble... 
                if ( multitrack != NULL )
                {
                        mlt_producer target = mlt_multitrack_producer( multitrack );
                        mlt_producer_seek( target, mlt_producer_frame( parent ) );
                        mlt_producer_set_speed( target, mlt_producer_get_speed( parent ) );
-               }
-               else
-               {
-                       fprintf( stderr, "tractor without a multitrack!!\n" );
-               }
-
-               // Loop through each of the tracks we're harvesting
-               for ( i = 0; !done; i ++ )
-               {
-                       // Get a frame from the producer
-                       mlt_service_get_frame( this->producer, &temp, i );
 
-                       // Check for last track
-                       done = mlt_properties_get_int( mlt_frame_properties( temp ), "last_track" );
-
-                       // Handle the frame
-                       if ( done && looking )
-                       {
-                               // Use this as output if we don't have one already
-                               *frame = temp;
-                       }
-                       else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking &&
-                                           mlt_producer_frame( parent ) == mlt_frame_get_position( temp ) )
+                       // Loop through each of the tracks we're harvesting
+                       for ( i = 0; !done; i ++ )
                        {
-                               *frame = temp;
-                               looking = 0;
+                               // Get a frame from the producer
+                               mlt_service_get_frame( this->producer, &temp, i );
+
+                               // Check for last track
+                               done = mlt_properties_get_int( mlt_frame_properties( temp ), "last_track" );
+
+                               // Handle the frame
+                               if ( done && looking )
+                               {
+                                       // Use this as output if we don't have one already
+                                       *frame = temp;
+                               }
+                               else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking &&
+                                               mlt_producer_frame( parent ) == mlt_frame_get_position( temp ) )
+                               {
+                                       *frame = temp;
+                                       looking = 0;
+                               }
+                               else
+                               {
+                                       // We store all other frames for now
+                                       store[ count ++ ] = temp;
+                               }
                        }
-                       else
+       
+                       // Now place all the unused frames on to the properties (will be destroyed automatically)
+                       while ( count -- )
                        {
-                               // We store all other frames for now
-                               store[ count ++ ] = temp;
+                               mlt_properties frame_properties = mlt_frame_properties( *frame );
+                               char label[ 30 ];
+                               sprintf( label, "tractor_%d", count );
+                               while ( mlt_properties_get_data( frame_properties, label, NULL ) != NULL )
+                                       strcat( label, "+" );
+                               mlt_properties_set_data( frame_properties, label, store[ count ], 0, ( mlt_destructor )mlt_frame_close, NULL );
                        }
                }
-
-               // Now place all the unused frames on to the properties (will be destroyed automatically)
-               while ( count -- )
+               else if ( producer != NULL )
                {
-                       mlt_properties frame_properties = mlt_frame_properties( *frame );
-                       char label[ 30 ];
-                       sprintf( label, "tractor_%d", count );
-                       while ( mlt_properties_get_data( frame_properties, label, NULL ) != NULL )
-                               strcat( label, "+" );
-                       mlt_properties_set_data( frame_properties, label, store[ count ], 0, ( mlt_destructor )mlt_frame_close, NULL );
+                       mlt_producer_seek( producer, mlt_producer_frame( parent ) );
+                       mlt_producer_set_speed( producer, mlt_producer_get_speed( parent ) );
+                       mlt_service_get_frame( this->producer, frame, track );
+               }
+               else
+               {
+                       fprintf( stderr, "tractor without a multitrack!!\n" );
+                       mlt_service_get_frame( this->producer, frame, track );
                }
 
                // Prepare the next frame
@@ -213,7 +223,7 @@ void mlt_tractor_close( mlt_tractor this )
 /** Close the producer.
 */
 
-void producer_close( mlt_producer this )
+static void producer_close( mlt_producer this )
 {
        mlt_tractor_close( this->child );
 }
index 0469ae51a0debe9b6eb901a1631d5f6fa45e0290..255dad47ca0f5ef4bbe78a11285dba821995310c 100644 (file)
@@ -129,51 +129,7 @@ void miracle_unit_set_notifier( miracle_unit this, valerie_notifier notifier, ch
 
 static mlt_producer create_producer( char *file )
 {
-       mlt_producer result = NULL;
-
-       // 1st Line preferences
-       if ( strstr( file, ".inigo" ) )
-               result = mlt_factory_producer( "inigo_file", file );
-       else if ( strstr( file, ".westley" ) )
-               result = mlt_factory_producer( "westley", file );
-       else if ( strstr( file, ".mpg" ) )
-               result = mlt_factory_producer( "mcmpeg", file );
-       else if ( strstr( file, ".mpeg" ) )
-               result = mlt_factory_producer( "mcmpeg", file );
-       else if ( strstr( file, ".dv" ) )
-               result = mlt_factory_producer( "mcdv", file );
-       else if ( strstr( file, ".dif" ) )
-               result = mlt_factory_producer( "mcdv", file );
-       else if ( strstr( file, ".jpg" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".JPG" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".jpeg" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".png" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".tga" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".txt" ) )
-               result = mlt_factory_producer( "pango", file );
-       else if ( strstr( file, ".ogg" ) )
-               result = mlt_factory_producer( "vorbis", file );
-
-       // 2nd Line fallbacks
-       if ( result == NULL && strstr( file, ".dv" ) )
-               result = mlt_factory_producer( "libdv", file );
-       else if ( result == NULL && strstr( file, ".dif" ) )
-               result = mlt_factory_producer( "libdv", file );
-
-       // 3rd line fallbacks 
-       if ( result == NULL )
-               result = mlt_factory_producer( "avformat", file );
-
-       // 4th line fallbacks 
-       if ( result == NULL )
-               result = mlt_factory_producer( "ffmpeg", file );
-
-       return result;
+       return mlt_factory_producer( "fezzik", file );
 }
 
 /** Create or locate a producer for the file specified.
index 68b8a38c5d55b7e01b89cda0525dd748685ae9d1..f959a3c11878b8d2403482f8f8fee826c7c495a3 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo avformat vorbis speex westley
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo avformat vorbis speex westley fezzik
 
 all clean depend install:
        list='$(SUBDIRS)'; \
diff --git a/src/modules/fezzik/Makefile b/src/modules/fezzik/Makefile
new file mode 100644 (file)
index 0000000..7b5a2a7
--- /dev/null
@@ -0,0 +1,27 @@
+
+TARGET = ../libmltfezzik.so
+
+OBJS = factory.o \
+          producer_fezzik.o 
+
+CFLAGS = -I../../ -Wall -g -D_FILE_OFFSET_BITS=64 -pthread
+
+SRCS := $(OBJS:.o=.c)
+
+all:   $(TARGET)
+
+$(TARGET): $(OBJS)
+               $(CC) -shared -o $@ $(OBJS) $(LDFLAGS)
+
+depend:        $(SRCS)
+               $(CC) -MM $(CFLAGS) $^ 1>.depend
+
+dist-clean:    clean
+               rm -f .depend
+
+clean: 
+               rm -f $(OBJS) $(TARGET) 
+
+ifneq ($(wildcard .depend),)
+include .depend
+endif
diff --git a/src/modules/fezzik/configure b/src/modules/fezzik/configure
new file mode 100755 (executable)
index 0000000..0576042
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if [ "$help" != "1" ]
+then
+
+cat << EOF >> ../producers.dat
+fezzik                 libmltfezzik.so
+EOF
+
+fi
+
diff --git a/src/modules/fezzik/factory.c b/src/modules/fezzik/factory.c
new file mode 100644 (file)
index 0000000..f37316f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * factory.c -- the factory method interfaces
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * 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 program 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.
+ *
+ * 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.
+ */
+
+#include <string.h>
+
+#include "producer_fezzik.h"
+
+void *mlt_create_producer( char *id, void *arg )
+{
+       if ( !strcmp( id, "fezzik" ) )
+               return producer_fezzik_init( arg );
+       return NULL;
+}
+
+void *mlt_create_filter( char *id, void *arg )
+{
+       return NULL;
+}
+
+void *mlt_create_transition( char *id, void *arg )
+{
+       return NULL;
+}
+
+void *mlt_create_consumer( char *id, void *arg )
+{
+       return NULL;
+}
+
diff --git a/src/modules/fezzik/producer_fezzik.c b/src/modules/fezzik/producer_fezzik.c
new file mode 100644 (file)
index 0000000..c85ecf0
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * producer_fezzik.c -- a normalising filter
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * 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 program 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.
+ *
+ * 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.
+ */
+
+#include "producer_fezzik.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <framework/mlt.h>
+
+static void track_service( mlt_tractor tractor, void *service, mlt_destructor destructor )
+{
+       mlt_properties properties = mlt_tractor_properties( tractor );
+       int registered = mlt_properties_get_int( properties, "_registered" );
+       char *key = mlt_properties_get( properties, "_registered" );
+       char *real = malloc( strlen( key ) + 2 );
+       sprintf( real, "_%s", key );
+       mlt_properties_set_data( properties, real, service, 0, destructor, NULL );
+       mlt_properties_set_int( properties, "_registered", ++ registered );
+       free( real );
+}
+
+static mlt_producer create_producer( char *file )
+{
+       mlt_producer result = NULL;
+
+       // 1st Line preferences
+       if ( strstr( file, ".inigo" ) )
+               result = mlt_factory_producer( "inigo_file", file );
+       else if ( strstr( file, ".mpg" ) )
+               result = mlt_factory_producer( "mcmpeg", file );
+       else if ( strstr( file, ".mpeg" ) )
+               result = mlt_factory_producer( "mcmpeg", file );
+       else if ( strstr( file, ".dv" ) )
+               result = mlt_factory_producer( "mcdv", file );
+       else if ( strstr( file, ".dif" ) )
+               result = mlt_factory_producer( "mcdv", file );
+       else if ( strstr( file, ".jpg" ) )
+               result = mlt_factory_producer( "pixbuf", file );
+       else if ( strstr( file, ".JPG" ) )
+               result = mlt_factory_producer( "pixbuf", file );
+       else if ( strstr( file, ".jpeg" ) )
+               result = mlt_factory_producer( "pixbuf", file );
+       else if ( strstr( file, ".png" ) )
+               result = mlt_factory_producer( "pixbuf", file );
+       else if ( strstr( file, ".txt" ) )
+               result = mlt_factory_producer( "pango", file );
+       else if ( strstr( file, ".westley" ) )
+               result = mlt_factory_producer( "westley", file );
+       else if ( strstr( file, ".ogg" ) )
+               result = mlt_factory_producer( "vorbis", file );
+
+       // 2nd Line fallbacks
+       if ( result == NULL )
+       {
+               if ( strstr( file, ".dv" ) )
+                       result = mlt_factory_producer( "libdv", file );
+               else if ( strstr( file, ".dif" ) )
+                       result = mlt_factory_producer( "libdv", file );
+       }
+
+       // 3rd line fallbacks 
+       if ( result == NULL )
+               result = mlt_factory_producer( "avformat", file );
+
+       // 4th line fallbacks 
+       if ( result == NULL )
+               result = mlt_factory_producer( "ffmpeg", file );
+
+       return result;
+}
+
+static mlt_service create_filter( mlt_tractor tractor, mlt_service last, char *effect )
+{
+       char *id = strdup( effect );
+       char *arg = strchr( id, ':' );
+       if ( arg != NULL )
+               *arg ++ = '\0';
+       mlt_filter filter = mlt_factory_filter( id, arg );
+       if ( filter != NULL )
+       {
+               mlt_filter_connect( filter, last, 0 );
+               track_service( tractor, filter, ( mlt_destructor )mlt_filter_close );
+               last = mlt_filter_service( filter );
+       }
+       free( id );
+       return last;
+}
+
+mlt_producer producer_fezzik_init( char *arg )
+{
+       // Create the producer that the tractor will contain
+       mlt_producer producer = create_producer( arg );
+
+       // Build the tractor if we have a producer and it isn't already westley'd :-)
+       if ( producer != NULL && mlt_properties_get( mlt_producer_properties( producer ), "westley" ) == NULL )
+       {
+               // Construct the tractor
+               mlt_tractor tractor = mlt_tractor_init( );
+
+               // Sanity check
+               if ( tractor != NULL )
+               {
+                       // Extract the tractor properties
+                       mlt_properties properties = mlt_tractor_properties( tractor );
+
+                       // Our producer will be the last service
+                       mlt_service last = mlt_producer_service( producer );
+
+                       // Set the registered count
+                       mlt_properties_set_int( properties, "_registered", 0 );
+
+                       // Register our producer for seeking in the tractor
+                       mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
+
+                       // Now attach normalising filters
+                       last = create_filter( tractor, last, "rescale" );
+                       last = create_filter( tractor, last, "resample" );
+
+                       // Connect the tractor to the last
+                       mlt_tractor_connect( tractor, last );
+
+                       // Finally, inherit properties from producer
+                       mlt_properties_inherit( properties, mlt_producer_properties( producer ) );
+
+                       // Now make sure we don't lose our inherited identity
+                       mlt_properties_set_int( properties, "_mlt_service_hidden", 1 );
+
+                       // This is a temporary hack to ensure that westley doesn't dig too deep
+                       // and fezzik doesn't overdo it with throwing rocks...
+                       mlt_properties_set( properties, "westley", "was here" );
+
+                       // Now, we return the producer of the tractor
+                       producer = mlt_tractor_producer( tractor );
+               }
+       }
+
+       // Return the tractor's producer
+       return producer;
+}
+
diff --git a/src/modules/fezzik/producer_fezzik.h b/src/modules/fezzik/producer_fezzik.h
new file mode 100644 (file)
index 0000000..0438b78
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * producer_fezzik.h -- a normalising producer
+ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * 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 program 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.
+ *
+ * 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.
+ */
+
+#ifndef _PRODUCER_FEZZIK_H_
+#define _PRODUCER_FEZZIK_H_
+
+#include <framework/mlt_producer.h>
+
+extern mlt_producer producer_fezzik_init( char *args );
+
+#endif
index 893c01e1fc5aaaed2c1fb602b4cbadd2791b369e..b03d3d75278d864449485f664635c5656e22d10f 100644 (file)
@@ -69,47 +69,7 @@ static void track_service( mlt_field field, void *service, mlt_destructor destru
 
 static mlt_producer create_producer( mlt_field field, char *file )
 {
-       mlt_producer result = NULL;
-
-       // 1st Line preferences
-       if ( strstr( file, ".inigo" ) )
-               result = mlt_factory_producer( "inigo_file", file );
-       else if ( strstr( file, ".mpg" ) )
-               result = mlt_factory_producer( "mcmpeg", file );
-       else if ( strstr( file, ".mpeg" ) )
-               result = mlt_factory_producer( "mcmpeg", file );
-       else if ( strstr( file, ".dv" ) )
-               result = mlt_factory_producer( "mcdv", file );
-       else if ( strstr( file, ".dif" ) )
-               result = mlt_factory_producer( "mcdv", file );
-       else if ( strstr( file, ".jpg" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".JPG" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".jpeg" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".png" ) )
-               result = mlt_factory_producer( "pixbuf", file );
-       else if ( strstr( file, ".txt" ) )
-               result = mlt_factory_producer( "pango", file );
-       else if ( strstr( file, ".westley" ) )
-               result = mlt_factory_producer( "westley", file );
-       else if ( strstr( file, ".ogg" ) )
-               result = mlt_factory_producer( "vorbis", file );
-
-       // 2nd Line fallbacks
-       if ( result == NULL && strstr( file, ".dv" ) )
-               result = mlt_factory_producer( "libdv", file );
-       else if ( result == NULL && strstr( file, ".dif" ) )
-               result = mlt_factory_producer( "libdv", file );
-
-       // 3rd line fallbacks 
-       if ( result == NULL )
-               result = mlt_factory_producer( "avformat", file );
-
-       // 4th line fallbacks 
-       if ( result == NULL )
-               result = mlt_factory_producer( "ffmpeg", file );
+       mlt_producer result = mlt_factory_producer( "fezzik", file );
 
        if ( result != NULL )
                track_service( field, result, ( mlt_destructor )mlt_producer_close );
index be075e8ab248e5ec3d8a20498974f7098ff0951a..c309065399f45d5e62e389c10c2b374f51f0b565 100644 (file)
@@ -32,6 +32,7 @@
 */
 
 static int consumer_start( mlt_consumer parent );
+static int consumer_is_stopped( mlt_consumer this );
 
 /** This is what will be called by the factory - anything can be passed in
        via the argument, but keep it simple.
@@ -50,6 +51,7 @@ mlt_consumer consumer_westley_init( char *arg )
 
                // Allow thread to be started/stopped
                this->start = consumer_start;
+               this->is_stopped = consumer_is_stopped;
 
                mlt_properties_set( mlt_consumer_properties( this ), "resource", arg );
 
@@ -378,10 +380,11 @@ static int consumer_start( mlt_consumer this )
        xmlFreeDoc( doc );
        mlt_consumer_stop( this );
 
-       // Tell inigo, enough already!
-       if ( inigo != NULL )
-               mlt_properties_set_int( mlt_service_properties( inigo ), "done", 1 );
-       
        return 0;
 }
 
+static int consumer_is_stopped( mlt_consumer this )
+{
+       return 1;
+}
+
index 265475a064f32b4d8ef671263327f3e8a9d3c23c..b753f93b96604caf3477a4786069266d038d5647 100644 (file)
@@ -139,17 +139,13 @@ static void on_start_producer( deserialise_context context, const xmlChar *name,
                mlt_properties_set( properties, (char*) atts[0], (char*) atts[1] );
        }
 
-       if ( mlt_properties_get( properties, "mlt_service" ) != NULL )
+       service = MLT_SERVICE( mlt_factory_producer( "fezzik", mlt_properties_get( properties, "resource" ) ) );
+
+       if ( service == NULL && mlt_properties_get( properties, "mlt_service" ) != NULL )
        {
                service = MLT_SERVICE( mlt_factory_producer( mlt_properties_get( properties, "mlt_service" ),
                        mlt_properties_get( properties, "resource" ) ) );
        }
-       else
-       {
-               // Unspecified producer, use inigo
-               char *args[2] = { mlt_properties_get( properties, "resource" ), 0 };
-               service = MLT_SERVICE( mlt_factory_producer( "inigo", args ) );
-       }
 
        track_service( context->destructors, service, (mlt_destructor) mlt_producer_close );