]> git.sesse.net Git - mlt/commitdiff
ffmpeg cleanup
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 16 Apr 2004 17:29:52 +0000 (17:29 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 16 Apr 2004 17:29:52 +0000 (17:29 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@281 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/ffmpeg/Makefile
src/modules/ffmpeg/configure
src/modules/ffmpeg/consumer_ffmpeg.c [deleted file]
src/modules/ffmpeg/consumer_ffmpeg.h [deleted file]
src/modules/ffmpeg/factory.c
src/modules/ffmpeg/filter_ffmpeg_dub.c [deleted file]
src/modules/ffmpeg/filter_ffmpeg_dub.h [deleted file]

index 551653e176b859045b864887f91c673b979959b0..0f20334a343e17e5215168e71f5803ff86bab2fe 100644 (file)
@@ -3,9 +3,7 @@ include ../../../config.mak
 TARGET = ../libmltffmpeg.so
 
 OBJS = factory.o \
-          producer_ffmpeg.o \
-          filter_ffmpeg_dub.o \
-          consumer_ffmpeg.o
+          producer_ffmpeg.o
 
 CFLAGS += -I../..
 
index 539ac5bd96909aaf339a9794746511f93b8072ba..e4e7f8d6cf6c2fa256984f8ea3321ae4d46b2494 100755 (executable)
@@ -7,13 +7,5 @@ cat << EOF >> ../producers.dat
 ffmpeg                 libmltffmpeg.so
 EOF
 
-cat << EOF >> ../filters.dat
-ffmpeg_dub             libmltffmpeg.so
-EOF
-
-cat << EOF >> ../consumers.dat
-ffmpeg                 libmltffmpeg.so
-EOF
-
 fi
 
diff --git a/src/modules/ffmpeg/consumer_ffmpeg.c b/src/modules/ffmpeg/consumer_ffmpeg.c
deleted file mode 100644 (file)
index da11800..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * consumer_ffmpeg.c -- an ffmpeg 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.
- */
-
-#include "consumer_ffmpeg.h"
-#include <framework/mlt_frame.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-
-/** This classes definition.
-*/
-
-typedef struct consumer_ffmpeg_s *consumer_ffmpeg;
-
-struct consumer_ffmpeg_s
-{
-       struct mlt_consumer_s parent;
-       mlt_properties properties;
-       int format;
-       int video;
-       pthread_t thread;
-       int running;
-       uint8_t audio_buffer[ 4096 * 3 ];
-       int audio_avail;
-       pthread_mutex_t audio_mutex;
-       pthread_cond_t audio_cond;
-       int window_width;
-       int window_height;
-       float aspect_ratio;
-       int width;
-       int height;
-       int playing;
-       mlt_frame *queue;
-       int size;
-       int count;
-       uint8_t *buffer;
-};
-
-/** Forward references to static functions.
-*/
-
-static void consumer_close( mlt_consumer parent );
-static void *consumer_thread( void * );
-
-/** This is what will be called by the factory - anything can be passed in
-       via the argument, but keep it simple.
-*/
-
-mlt_consumer consumer_ffmpeg_init( char *arg )
-{
-       // Create the consumer object
-       consumer_ffmpeg this = calloc( sizeof( struct consumer_ffmpeg_s ), 1 );
-
-       // If no malloc'd and consumer init ok
-       if ( this != NULL && mlt_consumer_init( &this->parent, this ) == 0 )
-       {
-               // Get the parent consumer object
-               mlt_consumer parent = &this->parent;
-
-               // We have stuff to clean up, so override the close method
-               parent->close = consumer_close;
-
-               // get a handle on properties
-               mlt_service service = mlt_consumer_service( parent );
-               this->properties = mlt_service_properties( service );
-
-               // This is the initialisation of the consumer
-               this->running = 1;
-               pthread_mutex_init( &this->audio_mutex, NULL );
-               pthread_cond_init( &this->audio_cond, NULL);
-               
-               // process actual param
-               if ( arg == NULL || !strcmp( arg, "-" ) )
-               {
-                       mlt_properties_set( this->properties, "video_file", "-" );
-                       mlt_properties_set( this->properties, "video_format", "dv" );
-               }
-               else
-               {
-                       mlt_properties_set( this->properties, "video_file", arg );
-                       mlt_properties_set( this->properties, "video_format", "" );
-               }
-
-               // Create the the thread
-               pthread_create( &this->thread, NULL, consumer_thread, this );
-
-               // Return the consumer produced
-               return parent;
-       }
-
-       // malloc or consumer init failed
-       free( this );
-
-       // Indicate failure
-       return NULL;
-}
-
-static void sdl_fill_audio( void *udata, uint8_t *stream, int len )
-{
-       consumer_ffmpeg this = udata;
-
-       pthread_mutex_lock( &this->audio_mutex );
-
-       // Block until audio received
-       while ( this->running && len > this->audio_avail )
-               pthread_cond_wait( &this->audio_cond, &this->audio_mutex );
-
-       if ( this->audio_avail >= len )
-       {
-               // Remove len from the audio available
-               this->audio_avail -= len;
-
-               // Remove the samples
-               memmove( this->audio_buffer, this->audio_buffer + len, this->audio_avail );
-       }
-       else
-       {
-               // Just to be safe, wipe the stream first
-               memset( stream, 0, len );
-
-               // Copy what we have into the stream
-               memcpy( stream, this->audio_buffer, this->audio_avail );
-
-               // No audio left
-               this->audio_avail = 0;
-       }
-
-       pthread_cond_broadcast( &this->audio_cond );
-       pthread_mutex_unlock( &this->audio_mutex );
-}
-
-static int consumer_play_audio( consumer_ffmpeg this, mlt_frame frame, int init_audio )
-{
-       // Get the properties of this consumer
-       mlt_properties properties = this->properties;
-       mlt_audio_format afmt = mlt_audio_pcm;
-       int channels;
-       int samples;
-       int frequency;
-       int16_t *pcm;
-       int bytes;
-
-       mlt_frame_get_audio( frame, &pcm, &afmt, &frequency, &channels, &samples );
-
-       if ( mlt_properties_get_int( properties, "audio_off" ) )
-               return init_audio;
-
-       if ( init_audio == 0 )
-       {
-               bytes = ( samples * channels * 2 );
-               pthread_mutex_lock( &this->audio_mutex );
-               while ( bytes > ( sizeof( this->audio_buffer) - this->audio_avail ) )
-                       pthread_cond_wait( &this->audio_cond, &this->audio_mutex );
-               mlt_properties properties = mlt_frame_properties( frame );
-               if ( mlt_properties_get_double( properties, "_speed" ) == 1 )
-                       memcpy( &this->audio_buffer[ this->audio_avail ], pcm, bytes );
-               else
-                       memset( &this->audio_buffer[ this->audio_avail ], 0, bytes );
-               this->audio_avail += bytes;
-               pthread_cond_broadcast( &this->audio_cond );
-               pthread_mutex_unlock( &this->audio_mutex );
-       }
-       else
-       {
-               this->playing = 1;
-       }
-
-       return init_audio;
-}
-
-static int consumer_play_video( consumer_ffmpeg this, mlt_frame frame )
-{
-       // Get the properties of this consumer
-       mlt_properties properties = this->properties;
-
-       if ( mlt_properties_get_int( properties, "video_off" ) )
-       {
-               mlt_frame_close( frame );
-               return 0;
-       }
-
-       if ( this->count == this->size )
-       {
-               this->size += 25;
-               this->queue = realloc( this->queue, sizeof( mlt_frame ) * this->size );
-       }
-       this->queue[ this->count ++ ] = frame;
-
-       // We're working on the oldest frame now
-       frame = this->queue[ 0 ];
-
-       // Shunt the frames in the queue down
-       int i = 0;
-       for ( i = 1; i < this->count; i ++ )
-               this->queue[ i - 1 ] = this->queue[ i ];
-       this->count --;
-
-       return 0;
-}
-
-/** Threaded wrapper for pipe.
-*/
-
-static void *consumer_thread( void *arg )
-{
-       // Identify the arg
-       consumer_ffmpeg this = arg;
-
-       // Get the consumer
-       mlt_consumer consumer = &this->parent;
-
-       // Get the service assoicated to the consumer
-       mlt_service service = mlt_consumer_service( consumer );
-
-       // Define a frame pointer
-       mlt_frame frame;
-
-       // internal intialization
-       int init_audio = 1;
-
-       // Loop until told not to
-       while( this->running )
-       {
-               // Get a frame from the service (should never return anything other than 0)
-               if ( mlt_service_get_frame( service, &frame, 0 ) == 0 )
-               {
-                       init_audio = consumer_play_audio( this, frame, init_audio );
-                       consumer_play_video( this, frame );
-               }
-       }
-
-       return NULL;
-}
-
-/** Callback to allow override of the close method.
-*/
-
-static void consumer_close( mlt_consumer parent )
-{
-       // Get the actual object
-       consumer_ffmpeg this = parent->child;
-
-       // Kill the thread and clean up
-       this->running = 0;
-
-       pthread_mutex_lock( &this->audio_mutex );
-       pthread_cond_broadcast( &this->audio_cond );
-       pthread_mutex_unlock( &this->audio_mutex );
-
-       pthread_join( this->thread, NULL );
-       pthread_mutex_destroy( &this->audio_mutex );
-       pthread_cond_destroy( &this->audio_cond );
-               
-       // Now clean up the rest (the close = NULL is a bit nasty but needed for now)
-       parent->close = NULL;
-       mlt_consumer_close( parent );
-
-       // Finally clean up this
-       free( this );
-}
-
diff --git a/src/modules/ffmpeg/consumer_ffmpeg.h b/src/modules/ffmpeg/consumer_ffmpeg.h
deleted file mode 100644 (file)
index dc2fc79..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * consumer_ffmpeg.h -- simple ffmpeg test case
- * 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_FFMPEG_H_
-#define _CONSUMER_FFMPEG_H_
-
-#include <framework/mlt_consumer.h>
-
-extern mlt_consumer consumer_ffmpeg_init( char *file );
-
-#endif
index 7bf697ac796bb7462329ab48c7426fb847b5c084..5498e551340ab2e19707f97194e1a80ea99fc302 100644 (file)
@@ -21,8 +21,6 @@
 #include <string.h>
 
 #include "producer_ffmpeg.h"
-#include "filter_ffmpeg_dub.h"
-#include "consumer_ffmpeg.h"
 
 void *mlt_create_producer( char *id, void *arg )
 {
@@ -33,8 +31,6 @@ void *mlt_create_producer( char *id, void *arg )
 
 void *mlt_create_filter( char *id, void *arg )
 {
-       if ( !strcmp( id, "ffmpeg_dub" ) )
-               return filter_ffmpeg_dub_init( arg );
        return NULL;
 }
 
@@ -45,8 +41,6 @@ void *mlt_create_transition( char *id, void *arg )
 
 void *mlt_create_consumer( char *id, void *arg )
 {
-       if ( !strcmp( id, "ffmpeg" ) )
-               return consumer_ffmpeg_init( arg );
        return NULL;
 }
 
diff --git a/src/modules/ffmpeg/filter_ffmpeg_dub.c b/src/modules/ffmpeg/filter_ffmpeg_dub.c
deleted file mode 100644 (file)
index c46dcd8..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * filter_ffmpeg_dub.c -- simple ffmpeg dub test case
- * 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 "filter_ffmpeg_dub.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <framework/mlt.h>
-
-/** Do it.
-*/
-
-static int filter_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
-{
-       // Obtain the frame properties
-       mlt_properties frame_properties = mlt_frame_properties( frame );
-       
-       // Get the producer used.
-       mlt_producer producer = mlt_properties_get_data( frame_properties, "producer", NULL );
-
-       // Get the producer properties
-       mlt_properties producer_properties = mlt_producer_properties( producer );
-
-       // Get the original get_audio
-       frame->get_audio = mlt_properties_get_data( frame_properties, "get_audio", NULL );
-
-       // Call the original get_audio
-       mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
-
-       // Now if our producer is still producing, override the audio
-       if ( !mlt_properties_get_int( producer_properties, "end_of_clip" ) )
-       {
-               // Get the position
-               mlt_position position = mlt_properties_get_position( producer_properties, "dub_position" );
-
-               // We need a frame from the producer
-               mlt_frame producer_frame;
-
-               // Set the FPS
-               mlt_properties_set_double( producer_properties, "fps", mlt_properties_get_double( frame_properties, "fps" ) );
-
-               // Seek to the position
-               mlt_producer_seek( producer, position );
-
-               // Get the next frame
-               producer->get_frame( producer, &producer_frame, 0 );
-
-               if ( !mlt_properties_get_int( producer_properties, "end_of_clip" ) )
-               {
-                       // Now get the audio from this frame
-                       producer_frame->get_audio( producer_frame, buffer, format, frequency, channels, samples );
-
-                       // This producer frame will be destroyed automatically when frame is destroyed
-                       mlt_properties_set_data( frame_properties, "ffmpeg_dub_frame", producer_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
-
-                       // Incrment the position
-                       mlt_properties_set_position( producer_properties, "dub_position", position + 1 );
-               }
-       }
-
-       return 0;
-}
-
-/** Filter processing.
-*/
-
-static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
-{
-       // Obtain the filter properties
-       mlt_properties filter_properties = mlt_filter_properties( this );
-
-       // Get the producer used.
-       mlt_producer producer = mlt_properties_get_data( filter_properties, "producer", NULL );
-       
-       // Obtain the frame properties
-       mlt_properties frame_properties = mlt_frame_properties( frame );
-       
-       // Get the producer properties
-       mlt_properties producer_properties = mlt_producer_properties( producer );
-
-       // Only do this if we have not reached end of clip and ffmpeg_dub has not already been done
-       if ( !mlt_properties_get_int( producer_properties, "end_of_clip" ) &&
-                mlt_properties_get_data( frame_properties, "get_audio", NULL ) == NULL )
-       {
-               // Backup the original get_audio (it's still needed)
-               mlt_properties_set_data( frame_properties, "get_audio", frame->get_audio, 0, NULL, NULL );
-
-               // Pass the producer on the frame
-               mlt_properties_set_data( frame_properties, "producer", producer, 0, NULL, NULL );
-
-               // Override the get_audio method
-               frame->get_audio = filter_get_audio;
-       }
-
-       return frame;
-}
-
-/** Constructor for the filter.
-*/
-
-mlt_filter filter_ffmpeg_dub_init( char *file )
-{
-       // Create the filter object
-       mlt_filter this = mlt_filter_new( );
-
-       // Initialise it
-       if ( this != NULL )
-       {
-               // Obtain the properties
-               mlt_properties properties = mlt_filter_properties( this );
-
-               // Create an ffmpeg producer
-               // TODO: THIS SHOULD NOT BE HERE....
-               mlt_producer producer = mlt_factory_producer( "ffmpeg", file );
-
-               // Overide the filter process method
-               this->process = filter_process;
-
-               // Pass the producer 
-               mlt_properties_set_data( properties, "producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
-
-               // Initialise the audio frame position
-               mlt_properties_set_position( properties, "dub_position", 0 );
-       }
-
-       return this;
-}
-
diff --git a/src/modules/ffmpeg/filter_ffmpeg_dub.h b/src/modules/ffmpeg/filter_ffmpeg_dub.h
deleted file mode 100644 (file)
index 688d01b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * filter_ffmpeg_dub.h -- simple ffmpeg dub test case
- * 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 _FILTER_FFMPEG_DUB_H_
-#define _FILTER_FFMPEG_DUB_H_
-
-#include <framework/mlt_filter.h>
-
-extern mlt_filter filter_ffmpeg_dub_init( char *file );
-
-#endif