]> git.sesse.net Git - mlt/commitdiff
realtime scheduling updates; suppress libdv errors; add frame property deinterlace_me...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Apr 2005 05:03:28 +0000 (05:03 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 5 Apr 2005 05:03:28 +0000 (05:03 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@688 d19143bc-622f-0410-bfdd-b5b2a6649095

15 files changed:
src/albino/albino.c
src/framework/mlt_consumer.c
src/inigo/inigo.c
src/miracle/miracle.c
src/miracle/miracle_server.c
src/modules/avformat/consumer_avformat.c
src/modules/core/consumer_null.c
src/modules/dv/consumer_libdv.c
src/modules/dv/producer_libdv.c
src/modules/fezzik/producer_hold.c
src/modules/gtk2/producer_pixbuf.c
src/modules/sdl/consumer_sdl.c
src/modules/sdl/consumer_sdl_preview.c
src/modules/sdl/consumer_sdl_still.c
src/modules/xine/filter_deinterlace.c

index 0bee31486b708894fcced838f7715159f2250f66..506f795c38fe17f185c115c8fdb205cacaefa05c 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sched.h>
 
 /* Application header files */
 #include <miracle/miracle_local.h>
@@ -58,6 +59,13 @@ int main( int argc, char **argv  )
        }
        else
        {
+               struct sched_param scp;
+       
+               // Use realtime scheduling if possible
+               memset( &scp, '\0', sizeof( scp ) );
+               scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1;
+               sched_setscheduler( 0, SCHED_RR, &scp );
+
                printf( "Miracle Standalone Instance\n" );
                parser = miracle_parser_init_local( );
                response = valerie_parser_connect( parser );
index 44f94525d6f917a75412989b33382287d367d167..3a839d2143e745d4cab8eff7e6d1b56882a88b6c 100644 (file)
@@ -494,8 +494,6 @@ static void *consumer_read_ahead_thread( void *arg )
 
 static void consumer_read_ahead_start( mlt_consumer this )
 {
-       pthread_attr_t thread_attributes;
-       
        // We're running now
        this->ahead = 1;
 
@@ -508,12 +506,8 @@ static void consumer_read_ahead_start( mlt_consumer this )
        // Create the condition
        pthread_cond_init( &this->cond, NULL );
 
-       // Inherit the scheduling priority
-       pthread_attr_init( &thread_attributes );
-       pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-       
        // Create the read ahead 
-       pthread_create( &this->ahead_thread, &thread_attributes, consumer_read_ahead_thread, this );
+       pthread_create( &this->ahead_thread, NULL, consumer_read_ahead_thread, this );
 }
 
 static void consumer_read_ahead_stop( mlt_consumer this )
index d37a44758ac4c22637bbc94b19a7fe36bc3532f5..77575d5e56ac10f881658c7d85e3b68cae1e8b84 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sched.h>
 
 #include <framework/mlt.h>
 
@@ -191,6 +192,12 @@ int main( int argc, char **argv )
        mlt_producer inigo = NULL;
        FILE *store = NULL;
        char *name = NULL;
+       struct sched_param scp;
+
+       // Use realtime scheduling if possible
+       memset( &scp, '\0', sizeof( scp ) );
+       scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1;
+       sched_setscheduler( 0, SCHED_FIFO, &scp );
 
        // Construct the factory
        mlt_factory_init( NULL );
index 913f78552ccabd9f5abffb60bdb70b505858ecd0..d735662b56f5a609716f9dc4f02edb2c7db02a5a 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <time.h>
+#include <sched.h>
 
 #include <framework/mlt.h>
 
@@ -66,6 +67,12 @@ int main( int argc, char **argv )
        int index = 0;
        int background = 1;
        struct timespec tm = { 5, 0 };
+       struct sched_param scp;
+
+       // Use realtime scheduling if possible
+       memset( &scp, '\0', sizeof( scp ) );
+       scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1;
+       sched_setscheduler( 0, SCHED_RR, &scp );
 
        mlt_factory_init( NULL );
 
index 151ce3189ba94044fb44df45836fab2da7e81151..d0a96b93a6de1f63b42122895f9095d6f1e53710 100644 (file)
@@ -158,9 +158,6 @@ static void *miracle_server_run( void *arg )
           their resources get freed automatically. (CY: ... hmmph...) */
        pthread_attr_init( &thread_attributes );
        pthread_attr_setdetachstate( &thread_attributes, PTHREAD_CREATE_DETACHED );
-       pthread_attr_init( &thread_attributes );
-       pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-       /* pthread_attr_setschedpolicy( &thread_attributes, SCHED_RR ); */
 
        while ( !server->shutdown )
        {
@@ -267,25 +264,13 @@ int miracle_server_execute( miracle_server server )
 
                if ( response != NULL )
                {
-                       pthread_attr_t attr;
                        int result;
-                       pthread_attr_init( &attr );
-                       pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
-                       pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
-                       pthread_attr_setschedpolicy( &attr, SCHED_FIFO );
-                       pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
                        valerie_response_close( response );
-                       result = pthread_create( &server->thread, &attr, miracle_server_run, server );
+                       result = pthread_create( &server->thread, NULL, miracle_server_run, server );
                        if ( result )
                        {
-                               miracle_log( LOG_WARNING, "Failed to schedule realtime (%s)", strerror(errno) );
-                               pthread_attr_setschedpolicy( &attr, SCHED_OTHER );
-                               result = pthread_create( &server->thread, &attr, miracle_server_run, server );
-                               if ( result )
-                               {
-                                       miracle_log( LOG_CRIT, "Failed to launch TCP listener thread" );
-                                       error = -1;
-                               }
+                               miracle_log( LOG_CRIT, "Failed to launch TCP listener thread" );
+                               error = -1;
                        }
                }
        }
index e5a4dddfef98ed2d9a4521d05bbdfaa28caa6435..021c501889e8980a4b41b6bdec611e41a71383d5 100644 (file)
@@ -235,7 +235,6 @@ static int consumer_start( mlt_consumer this )
        {
                // Allocate a thread
                pthread_t *thread = calloc( 1, sizeof( pthread_t ) );
-               pthread_attr_t thread_attributes;
 
                // Get the width and height
                int width = mlt_properties_get_int( properties, "width" );
@@ -269,12 +268,8 @@ static int consumer_start( mlt_consumer this )
                // 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 );
+               pthread_create( thread, NULL, consumer_thread, this );
        }
        return 0;
 }
index 88a7947e9d417eaf15c44fd83f8effe439b6f886..d2abe19db8a1bcdf44e6aa79a0a86e51ee1ac448 100644 (file)
@@ -74,7 +74,6 @@ static int consumer_start( mlt_consumer this )
        {
                // 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 );
@@ -82,12 +81,8 @@ static int consumer_start( mlt_consumer this )
                // 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 );
+               pthread_create( thread, NULL, consumer_thread, this );
        }
        return 0;
 }
index 448c22536aa702d81c778a7dc2dfb90632d40530..c8f58bd2081e5e391e6651485fddba5ab6d34fa3 100644 (file)
@@ -99,7 +99,6 @@ static int consumer_start( mlt_consumer this )
        {
                // 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 );
@@ -107,12 +106,8 @@ static int consumer_start( mlt_consumer this )
                // 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 );
+               pthread_create( thread, NULL, consumer_thread, this );
        }
        return 0;
 }
index 9516c10339454559f025dd00e19ae9093ead0896..0ab10e08e665bbc8c6b65fc85c6701673d6f2d09 100644 (file)
@@ -79,6 +79,7 @@ dv_decoder_t *dv_decoder_alloc( )
                        this->quality = DV_QUALITY_COLOR | DV_QUALITY_AC_2;
                        this->audio->arg_audio_emphasis = 2;
                        dv_set_audio_correction( this, DV_AUDIO_CORRECT_AVERAGE );
+                       dv_set_error_log( this, NULL );
 
                        // Register it with the properties to ensure clean up
                        sprintf( label, "%p", this );
index 77afe3faf12bfeb0d3fced4ebe8969770dc016e7..2a376f7e53dcd57a50068b38a1d5e930137d7dfd 100644 (file)
@@ -59,6 +59,7 @@ mlt_producer producer_hold_init( char *arg )
                mlt_properties_set_position( properties, "out", 25 );
                mlt_properties_set_position( properties, "length", 15000 );
                mlt_properties_set( properties, "resource", arg );
+               mlt_properties_set( properties, "method", "onefield" );
 
                // Override the get_frame method
                this->get_frame = producer_get_frame;
@@ -182,6 +183,9 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index
 
                // Ensure that the consumer sees what the real frame has
                mlt_properties_pass( MLT_FRAME_PROPERTIES( *frame ), MLT_FRAME_PROPERTIES( real_frame ), "" );
+
+               mlt_properties_set( MLT_FRAME_PROPERTIES( real_frame ), "deinterlace_method",
+                       mlt_properties_get( properties, "method" ) );
        }
 
        // Move to the next position
index a37d6e95670a54cb40f9862e2658b967cd51d1bd..7f8b46c9c6c1ba1d4feb9cdb7b5a1dbaed3edd53 100644 (file)
@@ -315,7 +315,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                else if ( strchr( filename, '%' ) != NULL )
                {
                        // handle picture sequences
-                       int i = 0;
+                       int i = mlt_properties_get_int( properties, "begin" );
                        int gap = 0;
                        char full[1024];
 
index 50e08d85611741f911b59ade2bf14d9ad3698c39..35c39c88175ed4ea27d3bae4d92c41139ebeaadb 100644 (file)
@@ -175,8 +175,6 @@ int consumer_start( mlt_consumer parent )
 
        if ( !this->running )
        {
-               pthread_attr_t thread_attributes;
-               
                consumer_stop( parent );
 
                this->running = 1;
@@ -189,11 +187,7 @@ int consumer_start( mlt_consumer parent )
                        mlt_properties_set_int( this->properties, "height", this->height );
                }
 
-               // Inherit the scheduling priority
-               pthread_attr_init( &thread_attributes );
-               pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-
-               pthread_create( &this->thread, &thread_attributes, consumer_thread, this );
+               pthread_create( &this->thread, NULL, consumer_thread, this );
        }
 
        return 0;
index 1d8494374aaa124013de413b7f6812b8684386ce..d2dd85956f275827e54000f6e826bce4fccead9e 100644 (file)
@@ -135,19 +135,13 @@ static int consumer_start( mlt_consumer parent )
 
        if ( !this->running )
        {
-               pthread_attr_t thread_attributes;
-               
                consumer_stop( parent );
 
                this->running = 1;
                this->joined = 0;
                this->last_speed = 1;
 
-               // Inherit the scheduling priority
-               pthread_attr_init( &thread_attributes );
-               pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-
-               pthread_create( &this->thread, &thread_attributes, consumer_thread, this );
+               pthread_create( &this->thread, NULL, consumer_thread, this );
        }
 
        return 0;
index bc4489aded1db4fb054d59f3e113c3618b44595b..f2146f5eaa82083ad635291dbaf5ddf54f61c955 100644 (file)
@@ -158,8 +158,6 @@ static int consumer_start( mlt_consumer parent )
 
        if ( !this->running )
        {
-               pthread_attr_t thread_attributes;
-
                // Attach a colour space converter
                if ( !this->filtered )
                {
@@ -185,11 +183,7 @@ static int consumer_start( mlt_consumer parent )
 
                //this->width = this->height * this->display_aspect;
 
-               // Inherit the scheduling priority
-               pthread_attr_init( &thread_attributes );
-               pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
-
-               pthread_create( &this->thread, &thread_attributes, consumer_thread, this );
+               pthread_create( &this->thread, NULL, consumer_thread, this );
        }
 
        return 0;
index fa48a4da2b74f6a26fbb6c61e706566f0e4541c9..9d122a974eeabbd4bd2f07da947ea754035f3212 100644 (file)
@@ -95,7 +95,12 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
                char *method_str = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "method" );
                int method = DEINTERLACE_LINEARBLEND;
                
-               if ( strcmp( method_str, "bob" ) == 0 )
+               if ( method_str == NULL )
+                       method_str = mlt_properties_get( MLT_FRAME_PROPERTIES( this ), "deinterlace_method" );
+               
+               if ( method_str == NULL )
+                       mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "method", "linearblend" );
+               else if ( strcmp( method_str, "bob" ) == 0 )
                        method = DEINTERLACE_BOB;
                else if ( strcmp( method_str, "weave" ) == 0 )
                        method = DEINTERLACE_BOB;
@@ -142,7 +147,7 @@ mlt_filter filter_deinterlace_init( void *arg )
        if ( this != NULL )
        {
                this->process = deinterlace_process;
-               mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "method", arg == NULL ? "linearblend" : arg );
+               mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "method", arg );
        }
        return this;
 }