SRCS := $(OBJS:.o=.c)
-CFLAGS += -pthread -DPREFIX="\"$(prefix)\""
+CFLAGS += -rdynamic -DPREFIX="\"$(prefix)\""
LDFLAGS += -lm $(LIBDL) -lpthread
frame = mlt_consumer_get_frame( this );
// Get the image of the first frame
- mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 );
+ if ( !video_off )
+ mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 );
+
+ if ( !audio_off )
+ {
+ samples = mlt_sample_calculator( fps, frequency, counter++ );
+ mlt_frame_get_audio( frame, &pcm, &afmt, &frequency, &channels, &samples );
+ frame->get_audio = NULL;
+ }
+
mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 );
// Get the starting time (can ignore the times above)
uint8_t *image;
mlt_image_format img_fmt = mlt_image_yuv422;
- // Fo receiving audio samples back from the fifo
- int16_t buffer[ 48000 * 2 ];
+ // For receiving audio samples back from the fifo
+ int16_t *buffer = av_malloc( 48000 * 2 );
int count = 0;
// Allocate the context
if ( audio_st )
audio_input_frame_size = open_audio( oc, audio_st, audio_outbuf_size );
+ fprintf( stderr, "%d\n", audio_input_frame_size );
+
// Open the output file, if needed
if ( !( fmt->flags & AVFMT_NOFILE ) )
{
av_free( input->data[0] );
av_free( input );
av_free( video_outbuf );
+ av_free( buffer );
// Free the stream
av_free(oc);
mlt_frame_set_position( *frame, mlt_producer_position( this ) );
// Set the position of this producer
- mlt_properties_set_position( mlt_frame_properties( *frame ), "avformat_position", mlt_producer_get_in( this ) + mlt_producer_position( this ) );
+ mlt_properties_set_position( mlt_frame_properties( *frame ), "avformat_position", mlt_producer_position( this ) );
// Set up the video
producer_set_up_video( this, *frame );
transition_composite.o \
transition_luma.o \
transition_mix.o \
- transition_region.o
+ transition_region.o \
+ consumer_null.o
ASM_OBJS = composite_line_yuv_mmx.o
region libmltcore.so
EOF
+cat << EOF >> ../consumers.dat
+null libmltcore.so
+EOF
+
fi
--- /dev/null
+/*
+ * consumer_null.c -- a null consumer
+ * 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 "consumer_null.h"
+
+// mlt Header files
+#include <framework/mlt_frame.h>
+
+// System header files
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+// Forward references.
+static int consumer_start( mlt_consumer this );
+static int consumer_stop( mlt_consumer this );
+static int consumer_is_stopped( mlt_consumer this );
+static void *consumer_thread( void *arg );
+static void consumer_close( mlt_consumer this );
+
+/** Initialise the dv consumer.
+*/
+
+mlt_consumer consumer_null_init( char *arg )
+{
+ // Allocate the consumer
+ mlt_consumer this = mlt_consumer_new( );
+
+ // If memory allocated and initialises without error
+ if ( this != NULL )
+ {
+ // Assign close callback
+ this->close = consumer_close;
+
+ // Set up start/stop/terminated callbacks
+ this->start = consumer_start;
+ this->stop = consumer_stop;
+ this->is_stopped = consumer_is_stopped;
+ }
+
+ // Return this
+ return this;
+}
+
+/** Start the consumer.
+*/
+
+static int consumer_start( mlt_consumer this )
+{
+ // Get the properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
+ // Check that we're not already running
+ if ( !mlt_properties_get_int( properties, "running" ) )
+ {
+ // Allocate a thread
+ pthread_t *thread = calloc( 1, sizeof( pthread_t ) );
+ pthread_attr_t thread_attributes;
+
+ // Assign the thread to properties
+ mlt_properties_set_data( properties, "thread", thread, sizeof( pthread_t ), free, NULL );
+
+ // Set the running state
+ mlt_properties_set_int( properties, "running", 1 );
+
+ // Inherit the scheduling priority
+ pthread_attr_init( &thread_attributes );
+ pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
+
+ // Create the thread
+ pthread_create( thread, &thread_attributes, consumer_thread, this );
+ }
+ return 0;
+}
+
+/** Stop the consumer.
+*/
+
+static int consumer_stop( mlt_consumer this )
+{
+ // Get the properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
+ // Check that we're running
+ if ( mlt_properties_get_int( properties, "running" ) )
+ {
+ // Get the thread
+ pthread_t *thread = mlt_properties_get_data( properties, "thread", NULL );
+
+ // Stop the thread
+ mlt_properties_set_int( properties, "running", 0 );
+
+ // Wait for termination
+ pthread_join( *thread, NULL );
+ }
+
+ return 0;
+}
+
+/** Determine if the consumer is stopped.
+*/
+
+static int consumer_is_stopped( mlt_consumer this )
+{
+ // Get the properties
+ mlt_properties properties = mlt_consumer_properties( this );
+ return !mlt_properties_get_int( properties, "running" );
+}
+
+/** The main thread - the argument is simply the consumer.
+*/
+
+static void *consumer_thread( void *arg )
+{
+ // Map the argument to the object
+ mlt_consumer this = arg;
+
+ // Get the properties
+ mlt_properties properties = mlt_consumer_properties( this );
+
+ // Frame and size
+ mlt_frame frame = NULL;
+
+ // Loop while running
+ while( mlt_properties_get_int( properties, "running" ) )
+ {
+ // Get the frame
+ frame = mlt_consumer_rt_frame( this );
+
+ // Check that we have a frame to work with
+ if ( frame != NULL )
+ {
+ // Close the frame
+ mlt_frame_close( frame );
+ }
+ }
+
+ return NULL;
+}
+
+/** Close the consumer.
+*/
+
+static void consumer_close( mlt_consumer this )
+{
+ // Stop the consumer
+ mlt_consumer_stop( this );
+
+ // Close the parent
+ mlt_consumer_close( this );
+
+ // Free the memory
+ free( this );
+}
--- /dev/null
+/*
+ * consumer_null.h -- null consumer
+ * 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 _CONSUMER_NULL_H_
+#define _CONSUMER_NULL_H
+
+#include <framework/mlt_consumer.h>
+
+extern mlt_consumer consumer_null_init( char *arg );
+
+#endif
#include "transition_luma.h"
#include "transition_mix.h"
#include "transition_region.h"
+#include "consumer_null.h"
void *mlt_create_producer( char *id, void *arg )
{
void *mlt_create_consumer( char *id, void *arg )
{
+ if ( !strcmp( id, "null" ) )
+ return consumer_null_init( arg );
return NULL;
}
// Foward declarations
static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index );
+static void producer_close( mlt_producer this );
/** Initialise.
*/
// Initialise the producer
if ( this != NULL )
{
+ // Synthetic - aspect ratio of 1
+ mlt_properties_set_double( mlt_producer_properties( this ), "aspect_ratio", 1 );
+
// Callback registration
this->get_frame = producer_get_frame;
+ this->close = producer_close;
}
return this;
{
int16_t *p = *buffer + size / 2;
while ( p != *buffer )
- *( -- p ) = fast_rand( ) & 0xff;
+ *( -- p ) = fast_rand( ) & 0x0f00;
}
// Set the buffer for destruction
return 0;
}
+static void producer_close( mlt_producer this )
+{
+ this->close = NULL;
+ mlt_producer_close( this );
+ free( this );
+}
// Forward references
static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index );
+static void producer_close( mlt_producer this );
/** Constructor for the frame holding producer. Basically, all this producer does is
provide a producer wrapper for the requested producer, allows the specifcation of
// Override the get_frame method
this->get_frame = producer_get_frame;
+ this->close = producer_close;
}
else
{
return 0;
}
+
+static void producer_close( mlt_producer this )
+{
+ this->close = NULL;
+ mlt_producer_close( this );
+ free( this );
+}
+
}
// internal cleanup
- if ( init_audio == 0 )
- SDL_AudioQuit( );
if ( this->sdl_overlay != NULL )
SDL_FreeYUVOverlay( this->sdl_overlay );
SDL_Quit( );
mlt_frame_set_position( *frame, mlt_producer_position( this ) );
// Set the position of this producer
- mlt_properties_set_position( mlt_frame_properties( *frame ), "vorbis_position", mlt_producer_get_in( this ) + mlt_producer_position( this ) );
+ mlt_properties_set_position( mlt_frame_properties( *frame ), "vorbis_position", mlt_producer_position( this ) );
// Set up the audio
producer_set_up_audio( this, *frame );