TARGET = libmlt.so
OBJS = mlt_frame.o \
+ mlt_deque.o \
mlt_property.o \
mlt_properties.o \
mlt_service.o \
#include "mlt_factory.h"
#include "mlt_frame.h"
+#include "mlt_deque.h"
#include "mlt_multitrack.h"
#include "mlt_producer.h"
#include "mlt_transition.h"
--- /dev/null
+/*
+ * mlt_deque.c -- double ended queue
+ * 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.
+ */
+
+// Local header files
+#include "mlt_deque.h"
+
+// System header files
+#include <stdlib.h>
+#include <string.h>
+
+/** Private structure.
+*/
+
+struct mlt_deque_s
+{
+ void **list;
+ int size;
+ int count;
+};
+
+/** Create a deque.
+*/
+
+mlt_deque mlt_deque_init( )
+{
+ return calloc( 1, sizeof( struct mlt_deque_s ) );
+}
+
+/** Return the number of items in the deque.
+*/
+
+int mlt_deque_count( mlt_deque this )
+{
+ return this->count;
+}
+
+/** Allocate space on the deque.
+*/
+
+static int mlt_deque_allocate( mlt_deque this )
+{
+ if ( this->count == this->size )
+ {
+ this->list = realloc( this->list, sizeof( void * ) * ( this->size + 10 ) );
+ this->size += 10;
+ }
+ return this->list == NULL;
+}
+
+/** Push an item to the end.
+*/
+
+int mlt_deque_push_back( mlt_deque this, void *item )
+{
+ int error = mlt_deque_allocate( this );
+
+ if ( error == 0 )
+ this->list[ this->count ++ ] = item;
+
+ return error;
+}
+
+/** Pop an item.
+*/
+
+void *mlt_deque_pop_back( mlt_deque this )
+{
+ return this->count > 0 ? this->list[ -- this->count ] : NULL;
+}
+
+/** Queue an item at the start.
+*/
+
+int mlt_deque_push_front( mlt_deque this, void *item )
+{
+ int error = mlt_deque_allocate( this );
+
+ if ( error == 0 )
+ {
+ memmove( &this->list[ 1 ], this->list, ( this->count ++ ) * sizeof( void * ) );
+ this->list[ 0 ] = item;
+ }
+
+ return error;
+}
+
+/** Remove an item from the start.
+*/
+
+void *mlt_deque_pop_front( mlt_deque this )
+{
+ void *item = NULL;
+
+ if ( this->count > 0 )
+ {
+ item = this->list[ 0 ];
+ memmove( this->list, &this->list[ 1 ], ( -- this->count ) * sizeof( void * ) );
+ }
+
+ return item;
+}
+
+/** Inquire on item at back of deque but don't remove.
+*/
+
+void *mlt_deque_peek_back( mlt_deque this )
+{
+ return this->count > 0 ? this->list[ this->count - 1 ] : NULL;
+}
+
+/** Inquire on item at front of deque but don't remove.
+*/
+
+void *mlt_deque_peek_front( mlt_deque this )
+{
+ return this->count > 0 ? this->list[ 0 ] : NULL;
+}
+
+/** Close the queue.
+*/
+
+void mlt_deque_close( mlt_deque this )
+{
+ free( this->list );
+ free( this );
+}
+
+
--- /dev/null
+/*
+ * mlt_deque.h -- double ended queue
+ * 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 _MLT_DEQUE_H_
+#define _MLT_DEQUE_H_
+
+#include "mlt_types.h"
+
+extern mlt_deque mlt_deque_init( );
+extern int mlt_deque_count( mlt_deque this );
+extern int mlt_deque_push_back( mlt_deque this, void *item );
+extern void *mlt_deque_pop_back( mlt_deque this );
+extern int mlt_deque_push_front( mlt_deque this, void *item );
+extern void *mlt_deque_pop_front( mlt_deque this );
+extern void *mlt_deque_peek_back( mlt_deque this );
+extern void *mlt_deque_peek_front( mlt_deque this );
+extern void mlt_deque_close( mlt_deque this );
+
+#endif
mlt_repository_close( consumers );
mlt_properties_close( object_list );
free( mlt_prefix );
- free( object_list );
mlt_prefix = NULL;
}
}
void mlt_field_close( mlt_field this )
{
- mlt_tractor_close( this->tractor );
- mlt_multitrack_close( this->multitrack );
+ //mlt_tractor_close( this->tractor );
+ //mlt_multitrack_close( this->multitrack );
free( this );
}
uint8_t *in_ptr;
// Generate the affine transform scaling values
- float scale_width = ( float )iwidth / ( float )owidth;
- float scale_height = ( float )iheight / ( float )oheight;
+ int scale_width = ( iwidth << 16 ) / owidth;
+ int scale_height = ( iheight << 16 ) / oheight;
// Loop for the entirety of our output height.
for ( y = - out_y_range; y < out_y_range ; y ++ )
{
// Calculate the derived y value
- dy = scale_height * y;
+ dy = ( scale_height * y ) >> 16;
// Start at the beginning of the line
out_ptr = out_line;
for ( x = - out_x_range; x < out_x_range; x += 1 )
{
// Calculated the derived x
- dx = scale_width * x;
-
- // Check if x and y are in the valid input range.
- if ( abs( dx ) < in_x_range && abs( dy ) < in_y_range )
- {
- // We're in the input range for this row.
- in_ptr = in_line + dx * 2;
- *out_ptr ++ = *in_ptr ++;
- in_ptr = in_line + ( ( dx >> 1 ) << 2 ) + ( ( x & 1 ) << 1 ) + 1;
- *out_ptr ++ = *in_ptr ++;
- }
- else
- {
- // We're not in the input range for this row.
- *out_ptr ++ = 16;
- *out_ptr ++ = 128;
- }
+ dx = ( scale_width * x ) >> 16;
+
+ // We're in the input range for this row.
+ in_ptr = in_line + ( dx << 1 );
+ *out_ptr ++ = *in_ptr ++;
+ in_ptr = in_line + ( ( dx >> 1 ) << 2 ) + ( ( x & 1 ) << 1 ) + 1;
+ *out_ptr ++ = *in_ptr;
}
// Move to next output line
#ifndef _MLT_MANAGER_H_
#define _MLT_MANAGER_H_
-mlt_producer mlt_manager_init( char **config );
+extern mlt_manager mlt_manager_init( );
+extern mlt_producer mlt_manager_producer( mlt_manager this );
+extern mlt_producer mlt_manager_properties( mlt_manager this );
+extern int mlt_manager_track_count( mlt_manager this );
+extern int mlt_manager_clip_count( mlt_manager this, int track );
+extern int mlt_manager_append_clip( mlt_manager this, int track, mlt_producer clip );
+extern int mlt_manager_append_clip_io( mlt_manager this, int track, mlt_producer clip, mlt_position in, mlt_position out );
+extern int mlt_manager_append_blank( mlt_manager this, int track, int length );
+extern int mlt_manager_insert_clip( mlt_manager this, int track, mlt_producer clip, mlt_position position );
+extern int mlt_manager_insert_clip_io( mlt_manager this, int track, mlt_position position, mlt_producer clip, mlt_position in, mlt_position out );
+extern int mlt_manager_insert_blank( mlt_manager this, int track, mlt_position position, int length );
+extern int mlt_manager_remove_clip( mlt_manager this, int track, int index );
+extern mlt_producer mlt_manager_get_clip( mlt_manager this, int track, int index, char *type, mlt_position *in, mlt_position *out );
+extern int mlt_manager_service_count( mlt_manager this );
+extern int mlt_manager_append_filter( mlt_manager this, mlt_filter that );
+extern int mlt_manager_append_transition( mlt_manager this, int index, mlt_transition that );
+extern int mlt_manager_insert_filter( mlt_manager this, int index, mlt_filter that );
+extern int mlt_manager_insert_transition( mlt_manager this, int index, mlt_transition that );
+extern int mlt_manager_remove_service( mlt_manager this, int index );
+extern mlt_service mlt_manager_get_service( mlt_manager this, int index, char *type );
+extern int mlt_manager_set_resource( mlt_manager this, char *resource );
+extern int mlt_manager_set_type( mlt_manager this, char *type );
#endif
static mlt_properties construct_object( char *prefix, char *id )
{
- mlt_properties output = calloc( sizeof( struct mlt_properties_s ), 1 );
+ mlt_properties output = mlt_properties_new( );
mlt_properties_init( output, NULL );
mlt_properties_set( output, "prefix", prefix );
mlt_properties_set( output, "id", id );
static mlt_properties construct_service( mlt_properties object, char *id )
{
- mlt_properties output = calloc( sizeof( struct mlt_properties_s ), 1 );
+ mlt_properties output = mlt_properties_new( );
mlt_properties_init( output, NULL );
mlt_properties_set_data( output, "object", object, 0, NULL, NULL );
mlt_properties_set( output, "id", id );
return symbol_ptr != NULL ? symbol_ptr( service, input ) : NULL;
}
-void destroy_properties( void *arg )
-{
- mlt_properties_close( arg );
- free( arg );
-}
-
mlt_repository mlt_repository_init( mlt_properties object_list, char *prefix, char *data, char *symbol )
{
char full_file[ 512 ];
object_properties = construct_object( prefix, object );
// Add it to the object list
- mlt_properties_set_data( object_list, object, object_properties, 0, destroy_properties, NULL );
+ mlt_properties_set_data( object_list, object, object_properties, 0, ( mlt_destructor )mlt_properties_close, NULL );
}
// Now construct a property for the service
mlt_properties service_properties = construct_service( object_properties, service );
// Add it to the repository
- mlt_properties_set_data( &this->parent, service, service_properties, 0, destroy_properties, NULL );
+ mlt_properties_set_data( &this->parent, service, service_properties, 0, ( mlt_destructor )mlt_properties_close, NULL );
}
}
typedef struct mlt_tractor_s *mlt_tractor;
typedef struct mlt_field_s *mlt_field;
typedef struct mlt_consumer_s *mlt_consumer;
+typedef struct mlt_deque_s *mlt_deque;
typedef void ( *mlt_destructor )( void * );
typedef char *( *mlt_serialiser )( void *, int length );