avformat whoops, pooling claridication and removal of dv leak
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 21 Feb 2004 08:18:50 +0000 (08:18 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 21 Feb 2004 08:18:50 +0000 (08:18 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@159 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_pool.c
src/modules/avformat/producer_avformat.c
src/modules/dv/producer_libdv.c

index 16d1e1d..5f891e9 100644 (file)
@@ -220,15 +220,15 @@ void *mlt_pool_alloc( int size )
        mlt_pool pool = NULL;
 
        // Determines the index of the pool to use
-       int index = 0;
+       int index = 8;
 
        // Minimum size pooled is 256 bytes
-       size = size >> 8;
+       size = size + 4;
        while ( ( 1 << index ) < size )
                index ++;
 
        // Now get the pool at the index
-       pool = mlt_properties_get_data_at( pools, index + 1, NULL );
+       pool = mlt_properties_get_data_at( pools, index - 8, NULL );
 
        // Now get the real item
        return pool_fetch( pool );
index a02f7cb..b1631f6 100644 (file)
@@ -384,8 +384,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                int got_picture = 0;
                AVFrame frame;
 
-               //memset( &pkt, 0, sizeof( pkt ) );
-               //memset( &frame, 0, sizeof( frame ) );
+               memset( &pkt, 0, sizeof( pkt ) );
+               memset( &frame, 0, sizeof( frame ) );
 
                while( ret >= 0 && !got_picture )
                {
@@ -718,7 +718,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form
                int got_audio = 0;
                int16_t *temp = mlt_pool_alloc( sizeof( int16_t ) * AVCODEC_MAX_AUDIO_FRAME_SIZE );
 
-               //memset( &pkt, 0, sizeof( pkt ) );
+               memset( &pkt, 0, sizeof( pkt ) );
 
                while( ret >= 0 && !got_audio )
                {
@@ -794,20 +794,19 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form
                        av_free_packet( &pkt );
                }
 
+               *buffer = mlt_pool_alloc( *samples * *channels * sizeof( int16_t ) );
+               mlt_properties_set_data( frame_properties, "audio", *buffer, 0, ( mlt_destructor )mlt_pool_release, NULL );
+
                // Now handle the audio if we have enough
                if ( audio_used >= *samples )
                {
-                       *buffer = mlt_pool_alloc( *samples * *channels * sizeof( int16_t ) );
                        memcpy( *buffer, audio_buffer, *samples * *channels * sizeof( int16_t ) );
                        audio_used -= *samples;
                        memmove( audio_buffer, &audio_buffer[ *samples * *channels ], audio_used * *channels * sizeof( int16_t ) );
-                       mlt_properties_set_data( frame_properties, "audio", *buffer, 0, ( mlt_destructor )mlt_pool_release, NULL );
                }
                else
                {
-                       frame->get_audio = NULL;
-                       mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
-                       audio_used = 0;
+                       memset( *buffer, 0, *samples * *channels * sizeof( int16_t ) );
                }
                
                // Store the number of audio samples still available
index b346b72..b277313 100644 (file)
@@ -334,7 +334,7 @@ static void producer_close( mlt_producer parent )
        producer_libdv this = parent->child;
 
        // Free the dv deconder
-       //dv_decoder_free( this->dv_decoder );
+       dv_decoder_free( this->dv_decoder );
 
        // Close the file
        if ( this->fd > 0 )