Known Bugs
The luma map must be the same size as the B frame.
+ The PGM parser does not handle comments.
mix
Known Bugs
The luma map must be the same size as the B frame.
+ The PGM parser does not handle comments.
mix
producer->get_frame = producer_get_frame;
mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL );
mlt_properties_set( properties, "log_id", "multitrack" );
- mlt_properties_set( properties, "resource", "<mulitrack>" );
+ mlt_properties_set( properties, "resource", "<multitrack>" );
}
else
{
return result;
}
+/** Get the number of tracks.
+*/
+
+int mlt_multitrack_count( mlt_multitrack this )
+{
+ return this->count;
+}
+
+/** Get an individual track as a producer.
+*/
+
+mlt_producer mlt_multitrack_track( mlt_multitrack this, int track )
+{
+ mlt_producer producer = NULL;
+
+ if ( this->list != NULL && track < this->count )
+ producer = this->list[ track ];
+
+ return producer;
+}
+
+
/** Determine the clip point.
Special case here: a 'producer' has no concept of multiple clips - only the
extern int mlt_multitrack_connect( mlt_multitrack this, mlt_producer producer, int track );
extern mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int index );
extern void mlt_multitrack_close( mlt_multitrack this );
+extern int mlt_multitrack_count( mlt_multitrack this );
+extern mlt_producer mlt_multitrack_track( mlt_multitrack this, int track );
#endif
// Open the shared object
object = dlopen( full_file, RTLD_NOW | RTLD_GLOBAL );
+ if ( object == NULL )
+ fprintf( stderr, "Failed to load plugin: %s\n", dlerror() );
// Set it on the properties
mlt_properties_set_data( object_properties, "dlopen", object, 0, ( void (*)( void * ) )dlclose, NULL );
base->out = that;
}
+
+/** Get the first connected producer service.
+*/
+
+mlt_service mlt_service_get_producer( mlt_service this )
+{
+ mlt_service producer = NULL;
+
+ // Get the service base
+ mlt_service_base *base = this->private;
+
+ if ( base->in != NULL )
+ producer = base->in[ 0 ];
+
+ return producer;
+}
+
+
/** Get the service state.
*/
extern int mlt_service_has_output( mlt_service this );
extern int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index );
extern int mlt_service_is_active( mlt_service this );
+extern mlt_service mlt_service_get_producer( mlt_service this );
#endif
{
producer->get_frame = producer_get_frame;
mlt_properties_set( mlt_producer_properties( producer ), "resource", "<tractor>" );
+ mlt_properties_set( mlt_producer_properties( producer ), "mlt_type", "producer" );
+ mlt_properties_set( mlt_producer_properties( producer ), "mlt_service", "tractor" );
}
else
{
typedef void ( *mlt_destructor )( void * );
typedef char *( *mlt_serialiser )( void *, int length );
+#define MLT_SERVICE(x) ( ( mlt_service )( x ) )
+#define MLT_PRODUCER(x) ( ( mlt_producer )( x ) )
+#define MLT_MULTITRACK(x) ( ( mlt_multitrack )( x ) )
+#define MLT_PLAYLIST(x) ( ( mlt_playlist )( x ) )
+#define MLT_FILTER(x) ( ( mlt_filter )( x ) )
+#define MLT_TRANSITION(x) ( ( mlt_transition )( x ) )
#endif
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo westley
all clean depend install:
list='$(SUBDIRS)'; \
--- /dev/null
+
+TARGET = ../libmltwestley.so
+
+OBJS = factory.o \
+ consumer_westley.o \
+ producer_westley.o
+
+CFLAGS = -I../../ -Wall -g -D_FILE_OFFSET_BITS=64 -pthread `xml2-config --cflags`
+
+LDFLAGS = `xml2-config --libs`
+
+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
--- /dev/null
+#!/bin/bash
+
+if [ "$help" != "1" ]
+then
+
+cat << EOF >> ../producers.dat
+westley libmltwestley.so
+EOF
+
+cat << EOF >> ../consumers.dat
+westley libmltwestley.so
+EOF
+
+fi
+
--- /dev/null
+/*
+ * consumer_westley.c -- a libxml2 serialiser of mlt service networks
+ * 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 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 "consumer_westley.h"
+#include <framework/mlt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <libxml/tree.h>
+
+/** Forward references to static functions.
+*/
+
+static int consumer_start( mlt_consumer parent );
+
+/** This is what will be called by the factory - anything can be passed in
+ via the argument, but keep it simple.
+*/
+
+mlt_consumer consumer_westley_init( char *arg )
+{
+ // Create the consumer object
+ mlt_consumer this = calloc( sizeof( struct mlt_consumer_s ), 1 );
+
+ // If no malloc'd and consumer init ok
+ if ( this != NULL && mlt_consumer_init( this, NULL ) == 0 )
+ {
+ // We have stuff to clean up, so override the close method
+ //parent->close = consumer_close;
+
+ // Allow thread to be started/stopped
+ this->start = consumer_start;
+
+ // Return the consumer produced
+ return this;
+ }
+
+ // malloc or consumer init failed
+ free( this );
+
+ // Indicate failure
+ return NULL;
+}
+
+void serialise_service( mlt_service service )
+{
+ // Iterate over consumer/producer connections
+ while ( service != NULL )
+ {
+ char *mlt_type = mlt_properties_get( mlt_service_properties(service ), "mlt_type" );
+
+ // Tell about the producer
+ if ( strcmp( mlt_type, "producer" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s' resource '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ),
+ mlt_properties_get( mlt_service_properties( service ), "resource" ) );
+ }
+
+ // Tell about the framework container producers
+ else if ( strcmp( mlt_type, "mlt_producer" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' resource '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "resource" ) );
+
+ // Recurse on multitrack's tracks
+ if ( strcmp( mlt_properties_get( mlt_service_properties( service ), "resource" ), "<multitrack>" ) == 0 )
+ {
+ int i;
+
+ fprintf( stderr, "contains...\n" );
+ for ( i = 0; i < mlt_multitrack_count( MLT_MULTITRACK( service ) ); i++ )
+ serialise_service( MLT_SERVICE( mlt_multitrack_track( MLT_MULTITRACK( service ), i ) ) );
+ fprintf( stderr, "...done.\n" );
+ }
+
+ // Recurse on playlist's clips
+ else if ( strcmp( mlt_properties_get( mlt_service_properties( service ), "resource" ), "<playlist>" ) == 0 )
+ {
+ int i;
+ mlt_playlist_clip_info info;
+
+ fprintf( stderr, "contains...\n" );
+ for ( i = 0; i < mlt_playlist_count( MLT_PLAYLIST( service ) ); i++ )
+ {
+ if ( ! mlt_playlist_get_clip_info( MLT_PLAYLIST( service ), &info, i ) )
+ serialise_service( MLT_SERVICE( info.producer ) );
+ }
+ fprintf( stderr, "...done.\n" );
+ }
+ }
+
+ // Tell about a filter
+ else if ( strcmp( mlt_type, "filter" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) );
+
+ fprintf( stderr, "is applied to\n" );
+
+ // Recurse on connected producer
+ serialise_service( MLT_SERVICE( MLT_FILTER( service )->producer ) );
+ }
+
+ // Tell about a transition
+ else if ( strcmp( mlt_type, "transition" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) );
+
+ fprintf( stderr, "is applied to\n" );
+
+ // Recurse on connected producer
+ serialise_service( MLT_SERVICE( MLT_TRANSITION( service )->producer ) );
+ }
+
+ // Get the next connected service
+ service = mlt_service_get_producer( service );
+ if ( service != NULL )
+ fprintf( stderr, "is connected to\n" );
+ }
+}
+
+static int consumer_start( mlt_consumer this )
+{
+ // get a handle on properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
+ mlt_service inigo = NULL;
+
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n",
+ mlt_properties_get( properties, "mlt_type" ),
+ mlt_properties_get( properties, "mlt_service" ) );
+
+ // Get the producer service
+ mlt_service service = mlt_service_get_producer( mlt_consumer_service( this ) );
+ if ( service != NULL )
+ {
+ fprintf( stderr, "is connected to\n" );
+
+ // Remember inigo
+ if ( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) != NULL &&
+ strcmp( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ), "inigo" ) == 0 )
+ inigo = service;
+
+ serialise_service( service );
+ }
+
+ mlt_consumer_stop( this );
+
+ // Tell inigo, enough already!
+ if ( inigo != NULL )
+ mlt_properties_set_int( mlt_service_properties( inigo ), "done", 1 );
+
+ return 0;
+}
+
--- /dev/null
+/*
+ * consumer_westley.h -- a libxml2 serialiser of mlt service networks
+ * 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 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 _CONSUMER_WESTLEY_H_
+#define _CONSUMER_WESTLEY_H_
+
+#include <framework/mlt_consumer.h>
+
+extern mlt_consumer consumer_westley_init( char * );
+
+#endif
--- /dev/null
+/*
+ * 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 "consumer_westley.h"
+#include "producer_westley.h"
+
+void *mlt_create_producer( char *id, void *arg )
+{
+ if ( !strcmp( id, "westley" ) )
+ return producer_westley_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 )
+{
+ if ( !strcmp( id, "westley" ) )
+ return consumer_westley_init( arg );
+ return NULL;
+}
+
--- /dev/null
+/*
+ * producer_libdv.c -- a libxml2 parser of mlt service networks
+ * 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 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_westley.h"
+#include <framework/mlt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <libxml/parser.h>
+
+static mlt_producer parse_westley( char *file )
+{
+ return NULL;
+}
+
+mlt_producer producer_westley_init( char *filename )
+{
+ int i;
+ int track = 0;
+ mlt_producer producer = NULL;
+ mlt_playlist playlist = mlt_playlist_init( );
+ mlt_properties group = mlt_properties_new( );
+ mlt_properties properties = group;
+ mlt_field field = mlt_field_init( );
+ mlt_properties field_properties = mlt_field_properties( field );
+ mlt_multitrack multitrack = mlt_field_multitrack( field );
+
+ // We need to track the number of registered filters
+ mlt_properties_set_int( field_properties, "registered", 0 );
+
+ // Parse
+ producer = parse_westley( filename );
+
+ // TODO
+
+ // Connect producer to playlist
+ if ( producer != NULL )
+ mlt_playlist_append( playlist, producer );
+
+ // We must have a producer at this point
+ if ( mlt_playlist_count( playlist ) > 0 )
+ {
+ // Connect multitrack to producer
+ mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track );
+ }
+
+ mlt_tractor tractor = mlt_field_tractor( field );
+ mlt_producer prod = mlt_tractor_producer( tractor );
+ mlt_properties props = mlt_tractor_properties( tractor );
+ mlt_properties_set( mlt_producer_properties( prod ), "resource", filename );
+ mlt_properties_set_data( props, "multitrack", multitrack, 0, NULL, NULL );
+ mlt_properties_set_data( props, "field", field, 0, NULL, NULL );
+ mlt_properties_set_data( props, "group", group, 0, NULL, NULL );
+ mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 );
+ mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) );
+ mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) );
+
+ return mlt_tractor_producer( tractor );
+}
+
--- /dev/null
+/*
+ * producer_westley.h -- a libxml2 parser of mlt service networks
+ * 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 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_WESTLEY_H_
+#define _PRODUCER_WESTLEY_H_
+
+#include <framework/mlt_producer.h>
+
+extern mlt_producer producer_westley_init( char *filename );
+
+#endif
// Start the consumer...
int vstd = mlt_video_standard_ntsc;
//mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
- mlt_consumer consumer = mlt_factory_consumer( "sdl", "PAL" );
+ mlt_consumer consumer = mlt_factory_consumer( "westley", "PAL" );
// Create the producer(s)
mlt_producer dv1 = mlt_factory_producer( "libdv", file1 );
producer->get_frame = producer_get_frame;
mlt_properties_set_data( properties, "multitrack", this, 0, NULL, NULL );
mlt_properties_set( properties, "log_id", "multitrack" );
- mlt_properties_set( properties, "resource", "<mulitrack>" );
+ mlt_properties_set( properties, "resource", "<multitrack>" );
}
else
{
return result;
}
+/** Get the number of tracks.
+*/
+
+int mlt_multitrack_count( mlt_multitrack this )
+{
+ return this->count;
+}
+
+/** Get an individual track as a producer.
+*/
+
+mlt_producer mlt_multitrack_track( mlt_multitrack this, int track )
+{
+ mlt_producer producer = NULL;
+
+ if ( this->list != NULL && track < this->count )
+ producer = this->list[ track ];
+
+ return producer;
+}
+
+
/** Determine the clip point.
Special case here: a 'producer' has no concept of multiple clips - only the
extern int mlt_multitrack_connect( mlt_multitrack this, mlt_producer producer, int track );
extern mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int index );
extern void mlt_multitrack_close( mlt_multitrack this );
+extern int mlt_multitrack_count( mlt_multitrack this );
+extern mlt_producer mlt_multitrack_track( mlt_multitrack this, int track );
#endif
// Open the shared object
object = dlopen( full_file, RTLD_NOW | RTLD_GLOBAL );
+ if ( object == NULL )
+ fprintf( stderr, "Failed to load plugin: %s\n", dlerror() );
// Set it on the properties
mlt_properties_set_data( object_properties, "dlopen", object, 0, ( void (*)( void * ) )dlclose, NULL );
base->out = that;
}
+
+/** Get the first connected producer service.
+*/
+
+mlt_service mlt_service_get_producer( mlt_service this )
+{
+ mlt_service producer = NULL;
+
+ // Get the service base
+ mlt_service_base *base = this->private;
+
+ if ( base->in != NULL )
+ producer = base->in[ 0 ];
+
+ return producer;
+}
+
+
/** Get the service state.
*/
extern int mlt_service_has_output( mlt_service this );
extern int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index );
extern int mlt_service_is_active( mlt_service this );
+extern mlt_service mlt_service_get_producer( mlt_service this );
#endif
{
producer->get_frame = producer_get_frame;
mlt_properties_set( mlt_producer_properties( producer ), "resource", "<tractor>" );
+ mlt_properties_set( mlt_producer_properties( producer ), "mlt_type", "producer" );
+ mlt_properties_set( mlt_producer_properties( producer ), "mlt_service", "tractor" );
}
else
{
typedef void ( *mlt_destructor )( void * );
typedef char *( *mlt_serialiser )( void *, int length );
+#define MLT_SERVICE(x) ( ( mlt_service )( x ) )
+#define MLT_PRODUCER(x) ( ( mlt_producer )( x ) )
+#define MLT_MULTITRACK(x) ( ( mlt_multitrack )( x ) )
+#define MLT_PLAYLIST(x) ( ( mlt_playlist )( x ) )
+#define MLT_FILTER(x) ( ( mlt_filter )( x ) )
+#define MLT_TRANSITION(x) ( ( mlt_transition )( x ) )
#endif
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo westley
all clean depend install:
list='$(SUBDIRS)'; \
--- /dev/null
+
+TARGET = ../libmltwestley.so
+
+OBJS = factory.o \
+ consumer_westley.o \
+ producer_westley.o
+
+CFLAGS = -I../../ -Wall -g -D_FILE_OFFSET_BITS=64 -pthread `xml2-config --cflags`
+
+LDFLAGS = `xml2-config --libs`
+
+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
--- /dev/null
+#!/bin/bash
+
+if [ "$help" != "1" ]
+then
+
+cat << EOF >> ../producers.dat
+westley libmltwestley.so
+EOF
+
+cat << EOF >> ../consumers.dat
+westley libmltwestley.so
+EOF
+
+fi
+
--- /dev/null
+/*
+ * consumer_westley.c -- a libxml2 serialiser of mlt service networks
+ * 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 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 "consumer_westley.h"
+#include <framework/mlt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <libxml/tree.h>
+
+/** Forward references to static functions.
+*/
+
+static int consumer_start( mlt_consumer parent );
+
+/** This is what will be called by the factory - anything can be passed in
+ via the argument, but keep it simple.
+*/
+
+mlt_consumer consumer_westley_init( char *arg )
+{
+ // Create the consumer object
+ mlt_consumer this = calloc( sizeof( struct mlt_consumer_s ), 1 );
+
+ // If no malloc'd and consumer init ok
+ if ( this != NULL && mlt_consumer_init( this, NULL ) == 0 )
+ {
+ // We have stuff to clean up, so override the close method
+ //parent->close = consumer_close;
+
+ // Allow thread to be started/stopped
+ this->start = consumer_start;
+
+ // Return the consumer produced
+ return this;
+ }
+
+ // malloc or consumer init failed
+ free( this );
+
+ // Indicate failure
+ return NULL;
+}
+
+void serialise_service( mlt_service service )
+{
+ // Iterate over consumer/producer connections
+ while ( service != NULL )
+ {
+ char *mlt_type = mlt_properties_get( mlt_service_properties(service ), "mlt_type" );
+
+ // Tell about the producer
+ if ( strcmp( mlt_type, "producer" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s' resource '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ),
+ mlt_properties_get( mlt_service_properties( service ), "resource" ) );
+ }
+
+ // Tell about the framework container producers
+ else if ( strcmp( mlt_type, "mlt_producer" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' resource '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "resource" ) );
+
+ // Recurse on multitrack's tracks
+ if ( strcmp( mlt_properties_get( mlt_service_properties( service ), "resource" ), "<multitrack>" ) == 0 )
+ {
+ int i;
+
+ fprintf( stderr, "contains...\n" );
+ for ( i = 0; i < mlt_multitrack_count( MLT_MULTITRACK( service ) ); i++ )
+ serialise_service( MLT_SERVICE( mlt_multitrack_track( MLT_MULTITRACK( service ), i ) ) );
+ fprintf( stderr, "...done.\n" );
+ }
+
+ // Recurse on playlist's clips
+ else if ( strcmp( mlt_properties_get( mlt_service_properties( service ), "resource" ), "<playlist>" ) == 0 )
+ {
+ int i;
+ mlt_playlist_clip_info info;
+
+ fprintf( stderr, "contains...\n" );
+ for ( i = 0; i < mlt_playlist_count( MLT_PLAYLIST( service ) ); i++ )
+ {
+ if ( ! mlt_playlist_get_clip_info( MLT_PLAYLIST( service ), &info, i ) )
+ serialise_service( MLT_SERVICE( info.producer ) );
+ }
+ fprintf( stderr, "...done.\n" );
+ }
+ }
+
+ // Tell about a filter
+ else if ( strcmp( mlt_type, "filter" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) );
+
+ fprintf( stderr, "is applied to\n" );
+
+ // Recurse on connected producer
+ serialise_service( MLT_SERVICE( MLT_FILTER( service )->producer ) );
+ }
+
+ // Tell about a transition
+ else if ( strcmp( mlt_type, "transition" ) == 0 )
+ {
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n", mlt_type,
+ mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) );
+
+ fprintf( stderr, "is applied to\n" );
+
+ // Recurse on connected producer
+ serialise_service( MLT_SERVICE( MLT_TRANSITION( service )->producer ) );
+ }
+
+ // Get the next connected service
+ service = mlt_service_get_producer( service );
+ if ( service != NULL )
+ fprintf( stderr, "is connected to\n" );
+ }
+}
+
+static int consumer_start( mlt_consumer this )
+{
+ // get a handle on properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
+ mlt_service inigo = NULL;
+
+ fprintf( stderr, "mlt_type '%s' mlt_service '%s'\n",
+ mlt_properties_get( properties, "mlt_type" ),
+ mlt_properties_get( properties, "mlt_service" ) );
+
+ // Get the producer service
+ mlt_service service = mlt_service_get_producer( mlt_consumer_service( this ) );
+ if ( service != NULL )
+ {
+ fprintf( stderr, "is connected to\n" );
+
+ // Remember inigo
+ if ( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ) != NULL &&
+ strcmp( mlt_properties_get( mlt_service_properties( service ), "mlt_service" ), "inigo" ) == 0 )
+ inigo = service;
+
+ serialise_service( service );
+ }
+
+ mlt_consumer_stop( this );
+
+ // Tell inigo, enough already!
+ if ( inigo != NULL )
+ mlt_properties_set_int( mlt_service_properties( inigo ), "done", 1 );
+
+ return 0;
+}
+
--- /dev/null
+/*
+ * consumer_westley.h -- a libxml2 serialiser of mlt service networks
+ * 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 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 _CONSUMER_WESTLEY_H_
+#define _CONSUMER_WESTLEY_H_
+
+#include <framework/mlt_consumer.h>
+
+extern mlt_consumer consumer_westley_init( char * );
+
+#endif
--- /dev/null
+/*
+ * 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 "consumer_westley.h"
+#include "producer_westley.h"
+
+void *mlt_create_producer( char *id, void *arg )
+{
+ if ( !strcmp( id, "westley" ) )
+ return producer_westley_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 )
+{
+ if ( !strcmp( id, "westley" ) )
+ return consumer_westley_init( arg );
+ return NULL;
+}
+
--- /dev/null
+/*
+ * producer_libdv.c -- a libxml2 parser of mlt service networks
+ * 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 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_westley.h"
+#include <framework/mlt.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <libxml/parser.h>
+
+static mlt_producer parse_westley( char *file )
+{
+ return NULL;
+}
+
+mlt_producer producer_westley_init( char *filename )
+{
+ int i;
+ int track = 0;
+ mlt_producer producer = NULL;
+ mlt_playlist playlist = mlt_playlist_init( );
+ mlt_properties group = mlt_properties_new( );
+ mlt_properties properties = group;
+ mlt_field field = mlt_field_init( );
+ mlt_properties field_properties = mlt_field_properties( field );
+ mlt_multitrack multitrack = mlt_field_multitrack( field );
+
+ // We need to track the number of registered filters
+ mlt_properties_set_int( field_properties, "registered", 0 );
+
+ // Parse
+ producer = parse_westley( filename );
+
+ // TODO
+
+ // Connect producer to playlist
+ if ( producer != NULL )
+ mlt_playlist_append( playlist, producer );
+
+ // We must have a producer at this point
+ if ( mlt_playlist_count( playlist ) > 0 )
+ {
+ // Connect multitrack to producer
+ mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track );
+ }
+
+ mlt_tractor tractor = mlt_field_tractor( field );
+ mlt_producer prod = mlt_tractor_producer( tractor );
+ mlt_properties props = mlt_tractor_properties( tractor );
+ mlt_properties_set( mlt_producer_properties( prod ), "resource", filename );
+ mlt_properties_set_data( props, "multitrack", multitrack, 0, NULL, NULL );
+ mlt_properties_set_data( props, "field", field, 0, NULL, NULL );
+ mlt_properties_set_data( props, "group", group, 0, NULL, NULL );
+ mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 );
+ mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) );
+ mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) );
+
+ return mlt_tractor_producer( tractor );
+}
+
--- /dev/null
+/*
+ * producer_westley.h -- a libxml2 parser of mlt service networks
+ * 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 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_WESTLEY_H_
+#define _PRODUCER_WESTLEY_H_
+
+#include <framework/mlt_producer.h>
+
+extern mlt_producer producer_westley_init( char *filename );
+
+#endif
// Start the consumer...
int vstd = mlt_video_standard_ntsc;
//mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
- mlt_consumer consumer = mlt_factory_consumer( "sdl", "PAL" );
+ mlt_consumer consumer = mlt_factory_consumer( "westley", "PAL" );
// Create the producer(s)
mlt_producer dv1 = mlt_factory_producer( "libdv", file1 );