]> git.sesse.net Git - mlt/commitdiff
add consumer properties mlt_image_format and mlt_audio_format
authorDan Dennedy <dan@dennedy.org>
Sun, 11 Dec 2011 00:46:11 +0000 (16:46 -0800)
committerDan Dennedy <dan@dennedy.org>
Sun, 11 Dec 2011 00:46:11 +0000 (16:46 -0800)
src/framework/mlt_consumer.c
src/framework/mlt_consumer.h

index 88d6b29a971b63dae2f63722f1a0fab7f5ac3269..a45ce47288d086ccbbb1930fafa97d8d9a476a62 100644 (file)
@@ -100,6 +100,8 @@ int mlt_consumer_init( mlt_consumer self, void *child, mlt_profile profile )
 
                // Hmm - default all consumers to yuv422 :-/
                self->format = mlt_image_yuv422;
+               mlt_properties_set( properties, "mlt_image_format", mlt_image_format_name( self->format ) );
+               mlt_properties_set( properties, "mlt_audio_format", mlt_audio_format_name( mlt_audio_s16 ) );
 
                mlt_events_register( properties, "consumer-frame-show", ( mlt_transmitter )mlt_consumer_frame_show );
                mlt_events_register( properties, "consumer-frame-render", ( mlt_transmitter )mlt_consumer_frame_render );
@@ -453,6 +455,22 @@ int mlt_consumer_start( mlt_consumer self )
        if ( abs( self->real_time ) > 1 && mlt_properties_get_int( properties, "buffer" ) <= abs( self->real_time ) )
                mlt_properties_set_int( properties, "_buffer", abs( self->real_time ) + 1 );
 
+       // Get the image format to use for rendering threads
+       const char* format = mlt_properties_get( properties, "mlt_image_format" );
+       if ( format )
+       {
+               if ( !strcmp( format, "rgb24" ) )
+                       self->format = mlt_image_rgb24;
+               else if ( !strcmp( format, "rgb24a" ) )
+                       self->format = mlt_image_rgb24a;
+               else if ( !strcmp( format, "yuv420p" ) )
+                       self->format = mlt_image_yuv420p;
+               else if ( !strcmp( format, "none" ) )
+                       self->format = mlt_image_none;
+               else
+                       self->format = mlt_image_yuv422;
+       }
+
        // Start the service
        if ( self->start != NULL )
                return self->start( self );
@@ -619,6 +637,20 @@ static void *consumer_read_ahead_thread( void *arg )
 
        // Get the audio settings
        mlt_audio_format afmt = mlt_audio_s16;
+       const char *format = mlt_properties_get( properties, "mlt_audio_format" );
+       if ( format )
+       {
+               if ( !strcmp( format, "none" ) )
+                       afmt = mlt_audio_none;
+               else if ( !strcmp( format, "s32" ) )
+                       afmt = mlt_audio_s32;
+               else if ( !strcmp( format, "s32le" ) )
+                       afmt = mlt_audio_s32le;
+               else if ( !strcmp( format, "float" ) )
+                       afmt = mlt_audio_float;
+               else if ( !strcmp( format, "f32le" ) )
+                       afmt = mlt_audio_f32le;
+       }
        int counter = 0;
        double fps = mlt_properties_get_double( properties, "fps" );
        int channels = mlt_properties_get_int( properties, "channels" );
index be938e996e71082b35cc2574d985c3d6eee62094..741eb0d654db34bc944c3cdf7841bde898fc7376 100644 (file)
@@ -68,6 +68,8 @@
  * \properties \em display_aspect_den the denominator of the video frame aspect ratio, overrides \p mlt_profile_s
  * \properties \em priority the OS scheduling priority for the render threads when real_time is not 0.
  * \properties \em top_field_first when not progressive, whether interlace field order is top-field-first, defaults to 0
+ * \properties \em mlt_image_format the image format to request in rendering threads, defaults to yuv422
+ * \properties \em mlt_audio_format the audio format to request in rendering threads, defaults to S16
  */
 
 struct mlt_consumer_s