]> git.sesse.net Git - mlt/commitdiff
add video_standard enum to mlt_frame, add mlt_consumer_properties, add properties...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 23 Dec 2003 02:41:15 +0000 (02:41 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 23 Dec 2003 02:41:15 +0000 (02:41 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@12 d19143bc-622f-0410-bfdd-b5b2a6649095

16 files changed:
mlt/src/framework/mlt_consumer.c
mlt/src/framework/mlt_consumer.h
mlt/src/framework/mlt_frame.h
mlt/src/modules/gtk2/producer_pango.c
mlt/src/modules/gtk2/producer_pango.h
mlt/src/modules/gtk2/producer_pixbuf.c
mlt/src/modules/gtk2/producer_pixbuf.h
mlt/src/tests/dan.c
src/framework/mlt_consumer.c
src/framework/mlt_consumer.h
src/framework/mlt_frame.h
src/modules/gtk2/producer_pango.c
src/modules/gtk2/producer_pango.h
src/modules/gtk2/producer_pixbuf.c
src/modules/gtk2/producer_pixbuf.h
src/tests/dan.c

index 635ad651c8e5636cdebc0e6008932f442c7b7c0a..f263a205c8afaa85eaa840e2cb026c1c0e5a725a 100644 (file)
@@ -42,6 +42,14 @@ mlt_service mlt_consumer_service( mlt_consumer this )
        return &this->parent;
 }
 
+/** Get the consumer properties.
+*/
+
+mlt_properties mlt_consumer_properties( mlt_consumer this )
+{
+       return mlt_service_properties( &this->parent );
+}
+
 /** Connect the consumer to the producer.
 */
 
index cbe907810723cbc488fda5d479f18ad75a9737e9..d6a963759136131f8ceee4312622a401ed84c7e7 100644 (file)
@@ -44,6 +44,7 @@ struct mlt_consumer_s
 
 extern int mlt_consumer_init( mlt_consumer this, void *child );
 extern mlt_service mlt_consumer_service( mlt_consumer this );
+extern mlt_properties mlt_consumer_properties( mlt_consumer this );
 extern int mlt_consumer_connect( mlt_consumer this, mlt_service producer );
 extern void mlt_consumer_close( mlt_consumer );
 
index fd86f2327972ae62909b69dbe0599ee336647efe..e9bd69a38c7bae2b7f8360dd5fe9b1f149bde832 100644 (file)
@@ -33,6 +33,13 @@ typedef enum
 }
 mlt_image_format;
 
+typedef enum
+{
+       mlt_video_standard_pal = 0,
+       mlt_video_standard_ntsc
+}
+mlt_video_standard;
+
 typedef enum
 {
        mlt_audio_none = 0,
index 85b7b396463d70bef934a09f13df827de93f499a..d113ce69cf9df99f98fc6070e3971a14eedf91b0 100644 (file)
@@ -49,9 +49,18 @@ mlt_producer producer_pango_init( const char *markup )
                producer->close = producer_close;
 
                this->markup = strdup( markup );
-               this->is_pal = 1;
                g_type_init();
 
+               // Get the properties interface
+               mlt_properties properties = mlt_producer_properties( &this->parent );
+
+               // Set the default properties
+               mlt_properties_set_int( properties, "video_standard", mlt_video_standard_pal );
+               mlt_properties_set_int( properties, "fgcolor", 0xffffffff );
+               mlt_properties_set_int( properties, "bgcolor", 0x00000000 );
+               mlt_properties_set_int( properties, "align", pango_align_left );
+               mlt_properties_set_int( properties, "pad", 0 );
+
                return producer;
        }
        free( this );
@@ -133,21 +142,38 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
        }
        else
        {
-               // the following four will be replaced by properties
-               rgba_color fg = { 0xff, 0xff, 0xff, 0xff };
-               rgba_color bg = { 0, 0, 0, 0x7f };
-               int pad = 8;
-               int align = 0; /* left */
+               // Obtain properties of producer
+               mlt_properties props = mlt_producer_properties( producer );
+
+               // Get properties
+               int fg = mlt_properties_get_int( props, "fgcolor" );
+               int bg = mlt_properties_get_int( props, "bgcolor" );
+               int align = mlt_properties_get_int( props, "align" );
+               int pad = mlt_properties_get_int( props, "pad" );
+               rgba_color fgcolor =
+               {
+                       ( fg & 0xff000000 ) >> 24,
+                       ( fg & 0x00ff0000 ) >> 16,
+                       ( fg & 0x0000ff00 ) >> 8,
+                       ( fg & 0x000000ff )
+               };
+               rgba_color bgcolor =
+               {
+                       ( bg & 0xff000000 ) >> 24,
+                       ( bg & 0x00ff0000 ) >> 16,
+                       ( bg & 0x0000ff00 ) >> 8,
+                       ( bg & 0x000000ff )
+               };
                
                // Render the title
-               pixbuf = pango_get_pixbuf( this->markup, fg, bg, pad, align );
+               pixbuf = pango_get_pixbuf( this->markup, fgcolor, bgcolor, pad, align );
        }
 
        // If we have a pixbuf
        if ( pixbuf )
        {
                // Scale to adjust for sample aspect ratio
-               if ( this->is_pal )
+               if ( mlt_properties_get_int( properties, "video_standard" ) == mlt_video_standard_pal )
                {
                        GdkPixbuf *temp = pixbuf;
                        GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf,
index f067e7cc4abd799e01af4763cdc5497510b050cd..1e2b1c85b2fd3703742ac85c90fe18ffcb6b7e9b 100644 (file)
@@ -33,9 +33,15 @@ struct producer_pango_s
        int height;
        uint8_t *image;
        uint8_t *alpha;
-       int is_pal;
 };
 
+typedef enum
+{
+       pango_align_left = 0,
+       pango_align_center,
+       pango_align_right
+} pango_align;
+
 extern mlt_producer producer_pango_init( const char *markup );
 
 #endif
index 1ba370f9bd2004823be5d587c45877819b72d21c..97a6fc3ecdf5ffd4533be32bbf49232f1d10df52 100644 (file)
 static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index );
 static void producer_close( mlt_producer parent );
 
+typedef enum
+{
+       SIGNAL_FORMAT_PAL,
+       SIGNAL_FORMAT_NTSC
+} mlt_signal_format;
+
 mlt_producer producer_pixbuf_init( const char *filename )
 {
        producer_pixbuf this = calloc( sizeof( struct producer_pixbuf_s ), 1 );
@@ -40,7 +46,13 @@ mlt_producer producer_pixbuf_init( const char *filename )
 
                this->filename = strdup( filename );
                this->counter = -1;
-               this->is_pal = 1;
+               
+               // Get the properties interface
+               mlt_properties properties = mlt_producer_properties( &this->parent );
+       
+               // Set the default properties
+               mlt_properties_set_int( properties, "video_standard", mlt_video_standard_pal );
+               
                g_type_init();
 
                return producer;
@@ -147,7 +159,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
        if ( pixbuf )
        {
                // Scale to adjust for sample aspect ratio
-               if ( this->is_pal )
+               if ( mlt_properties_get_int( properties, "video_stadnard" ) == mlt_video_standard_pal )
                {
                        GdkPixbuf *temp = pixbuf;
                        GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf,
index 04fb2f414048d1e9a14660a764eafee7a119ae2c..c7f76ef31f597284e80dc15d9a7bf8ac6fefd6b7 100644 (file)
@@ -34,7 +34,6 @@ struct producer_pixbuf_s
        int height;
        uint8_t *image;
        uint8_t *alpha;
-       int is_pal;
 };
 
 extern mlt_producer producer_pixbuf_init( const char *filename );
index 208ee49eb6c194fdf52a106dff902b5be158b954..d22f0a91867701b3c877d47ca4e736bec0da8b77 100644 (file)
@@ -17,15 +17,31 @@ int main( int argc, char **argv )
                file2 = argv[ 2 ];
 
        // Start the consumer...
-       mlt_consumer consumer = mlt_factory_consumer( "bluefish", NULL );
+       int vstd = mlt_video_standard_ntsc;
+       mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
+       mlt_properties_set_int( mlt_consumer_properties( consumer ), "video_standard", mlt_video_standard_ntsc );
 
        // Create the producer(s)
        mlt_producer dv1 = mlt_factory_producer( "mcmpeg", file1 );
 
+#if 0
+       // Connect the tractor to the consumer
+       mlt_consumer_connect( consumer, mlt_producer_service( dv1 ) );
+
+       // Do stuff until we're told otherwise...
+       fprintf( stderr, "Press return to continue\n" );
+       fgets( temp, 132, stdin );
+       mlt_consumer_close( consumer );
+       return 0;
+#endif
+
        //mlt_producer dv1 = producer_pixbuf_init( file1 );
        //mlt_producer dv2 = producer_libdv_init( file2 );
        //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
        mlt_producer dv2 = mlt_factory_producer( "pango", "<span font_desc=\"Sans Bold 36\">Mutton <span font_desc=\"Luxi Serif Bold Oblique 36\">Lettuce</span> Tomato</span>" );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "video_standard", mlt_video_standard_ntsc );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "bgcolor", 0x0000007f );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "pad", 8 );
 
        // Register producers(s) with a multitrack object
        mlt_multitrack multitrack = mlt_multitrack_init( );
index 635ad651c8e5636cdebc0e6008932f442c7b7c0a..f263a205c8afaa85eaa840e2cb026c1c0e5a725a 100644 (file)
@@ -42,6 +42,14 @@ mlt_service mlt_consumer_service( mlt_consumer this )
        return &this->parent;
 }
 
+/** Get the consumer properties.
+*/
+
+mlt_properties mlt_consumer_properties( mlt_consumer this )
+{
+       return mlt_service_properties( &this->parent );
+}
+
 /** Connect the consumer to the producer.
 */
 
index cbe907810723cbc488fda5d479f18ad75a9737e9..d6a963759136131f8ceee4312622a401ed84c7e7 100644 (file)
@@ -44,6 +44,7 @@ struct mlt_consumer_s
 
 extern int mlt_consumer_init( mlt_consumer this, void *child );
 extern mlt_service mlt_consumer_service( mlt_consumer this );
+extern mlt_properties mlt_consumer_properties( mlt_consumer this );
 extern int mlt_consumer_connect( mlt_consumer this, mlt_service producer );
 extern void mlt_consumer_close( mlt_consumer );
 
index fd86f2327972ae62909b69dbe0599ee336647efe..e9bd69a38c7bae2b7f8360dd5fe9b1f149bde832 100644 (file)
@@ -33,6 +33,13 @@ typedef enum
 }
 mlt_image_format;
 
+typedef enum
+{
+       mlt_video_standard_pal = 0,
+       mlt_video_standard_ntsc
+}
+mlt_video_standard;
+
 typedef enum
 {
        mlt_audio_none = 0,
index 85b7b396463d70bef934a09f13df827de93f499a..d113ce69cf9df99f98fc6070e3971a14eedf91b0 100644 (file)
@@ -49,9 +49,18 @@ mlt_producer producer_pango_init( const char *markup )
                producer->close = producer_close;
 
                this->markup = strdup( markup );
-               this->is_pal = 1;
                g_type_init();
 
+               // Get the properties interface
+               mlt_properties properties = mlt_producer_properties( &this->parent );
+
+               // Set the default properties
+               mlt_properties_set_int( properties, "video_standard", mlt_video_standard_pal );
+               mlt_properties_set_int( properties, "fgcolor", 0xffffffff );
+               mlt_properties_set_int( properties, "bgcolor", 0x00000000 );
+               mlt_properties_set_int( properties, "align", pango_align_left );
+               mlt_properties_set_int( properties, "pad", 0 );
+
                return producer;
        }
        free( this );
@@ -133,21 +142,38 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
        }
        else
        {
-               // the following four will be replaced by properties
-               rgba_color fg = { 0xff, 0xff, 0xff, 0xff };
-               rgba_color bg = { 0, 0, 0, 0x7f };
-               int pad = 8;
-               int align = 0; /* left */
+               // Obtain properties of producer
+               mlt_properties props = mlt_producer_properties( producer );
+
+               // Get properties
+               int fg = mlt_properties_get_int( props, "fgcolor" );
+               int bg = mlt_properties_get_int( props, "bgcolor" );
+               int align = mlt_properties_get_int( props, "align" );
+               int pad = mlt_properties_get_int( props, "pad" );
+               rgba_color fgcolor =
+               {
+                       ( fg & 0xff000000 ) >> 24,
+                       ( fg & 0x00ff0000 ) >> 16,
+                       ( fg & 0x0000ff00 ) >> 8,
+                       ( fg & 0x000000ff )
+               };
+               rgba_color bgcolor =
+               {
+                       ( bg & 0xff000000 ) >> 24,
+                       ( bg & 0x00ff0000 ) >> 16,
+                       ( bg & 0x0000ff00 ) >> 8,
+                       ( bg & 0x000000ff )
+               };
                
                // Render the title
-               pixbuf = pango_get_pixbuf( this->markup, fg, bg, pad, align );
+               pixbuf = pango_get_pixbuf( this->markup, fgcolor, bgcolor, pad, align );
        }
 
        // If we have a pixbuf
        if ( pixbuf )
        {
                // Scale to adjust for sample aspect ratio
-               if ( this->is_pal )
+               if ( mlt_properties_get_int( properties, "video_standard" ) == mlt_video_standard_pal )
                {
                        GdkPixbuf *temp = pixbuf;
                        GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf,
index f067e7cc4abd799e01af4763cdc5497510b050cd..1e2b1c85b2fd3703742ac85c90fe18ffcb6b7e9b 100644 (file)
@@ -33,9 +33,15 @@ struct producer_pango_s
        int height;
        uint8_t *image;
        uint8_t *alpha;
-       int is_pal;
 };
 
+typedef enum
+{
+       pango_align_left = 0,
+       pango_align_center,
+       pango_align_right
+} pango_align;
+
 extern mlt_producer producer_pango_init( const char *markup );
 
 #endif
index 1ba370f9bd2004823be5d587c45877819b72d21c..97a6fc3ecdf5ffd4533be32bbf49232f1d10df52 100644 (file)
 static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index );
 static void producer_close( mlt_producer parent );
 
+typedef enum
+{
+       SIGNAL_FORMAT_PAL,
+       SIGNAL_FORMAT_NTSC
+} mlt_signal_format;
+
 mlt_producer producer_pixbuf_init( const char *filename )
 {
        producer_pixbuf this = calloc( sizeof( struct producer_pixbuf_s ), 1 );
@@ -40,7 +46,13 @@ mlt_producer producer_pixbuf_init( const char *filename )
 
                this->filename = strdup( filename );
                this->counter = -1;
-               this->is_pal = 1;
+               
+               // Get the properties interface
+               mlt_properties properties = mlt_producer_properties( &this->parent );
+       
+               // Set the default properties
+               mlt_properties_set_int( properties, "video_standard", mlt_video_standard_pal );
+               
                g_type_init();
 
                return producer;
@@ -147,7 +159,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
        if ( pixbuf )
        {
                // Scale to adjust for sample aspect ratio
-               if ( this->is_pal )
+               if ( mlt_properties_get_int( properties, "video_stadnard" ) == mlt_video_standard_pal )
                {
                        GdkPixbuf *temp = pixbuf;
                        GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf,
index 04fb2f414048d1e9a14660a764eafee7a119ae2c..c7f76ef31f597284e80dc15d9a7bf8ac6fefd6b7 100644 (file)
@@ -34,7 +34,6 @@ struct producer_pixbuf_s
        int height;
        uint8_t *image;
        uint8_t *alpha;
-       int is_pal;
 };
 
 extern mlt_producer producer_pixbuf_init( const char *filename );
index 208ee49eb6c194fdf52a106dff902b5be158b954..d22f0a91867701b3c877d47ca4e736bec0da8b77 100644 (file)
@@ -17,15 +17,31 @@ int main( int argc, char **argv )
                file2 = argv[ 2 ];
 
        // Start the consumer...
-       mlt_consumer consumer = mlt_factory_consumer( "bluefish", NULL );
+       int vstd = mlt_video_standard_ntsc;
+       mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
+       mlt_properties_set_int( mlt_consumer_properties( consumer ), "video_standard", mlt_video_standard_ntsc );
 
        // Create the producer(s)
        mlt_producer dv1 = mlt_factory_producer( "mcmpeg", file1 );
 
+#if 0
+       // Connect the tractor to the consumer
+       mlt_consumer_connect( consumer, mlt_producer_service( dv1 ) );
+
+       // Do stuff until we're told otherwise...
+       fprintf( stderr, "Press return to continue\n" );
+       fgets( temp, 132, stdin );
+       mlt_consumer_close( consumer );
+       return 0;
+#endif
+
        //mlt_producer dv1 = producer_pixbuf_init( file1 );
        //mlt_producer dv2 = producer_libdv_init( file2 );
        //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
        mlt_producer dv2 = mlt_factory_producer( "pango", "<span font_desc=\"Sans Bold 36\">Mutton <span font_desc=\"Luxi Serif Bold Oblique 36\">Lettuce</span> Tomato</span>" );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "video_standard", mlt_video_standard_ntsc );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "bgcolor", 0x0000007f );
+       mlt_properties_set_int( mlt_producer_properties( dv2 ), "pad", 8 );
 
        // Register producers(s) with a multitrack object
        mlt_multitrack multitrack = mlt_multitrack_init( );