]> git.sesse.net Git - mlt/commitdiff
New geometry specification
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Mon, 20 Dec 2004 10:46:35 +0000 (10:46 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Mon, 20 Dec 2004 10:46:35 +0000 (10:46 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@564 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_playlist.c
src/modules/core/transition_composite.c
src/modules/data_fx.properties

index 17aa6a1f450db22fb716a14f3f50e73862e2a254..68c0dc7f6380797675cf68e52a01e43572488c6f 100644 (file)
@@ -1329,7 +1329,7 @@ int mlt_playlist_clip_start( mlt_playlist this, int clip )
        mlt_playlist_clip_info info;
        if ( mlt_playlist_get_clip_info( this, &info, clip ) == 0 )
                return info.start;
-       return 0;
+       return clip < 0 ? 0 : mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) ) + 1;
 }
 
 int mlt_playlist_clip_length( mlt_playlist this, int clip )
index fafe387f568380f43344bce9205f4101d32519d6..92add8fd4237caf1e3860d498cd644552a4afe62 100644 (file)
@@ -213,27 +213,48 @@ static struct geometry_s *transition_parse_keys( mlt_transition this,  int norma
        // Pointer
        struct geometry_s *ptr = start;
 
-       // Parse the start property
-       geometry_parse( start, NULL, mlt_properties_get( properties, "start" ), normalised_width, normalised_height );
-
-       // Parse the keys in between
-       for ( i = 0; i < mlt_properties_count( properties ); i ++ )
+       // Check if we're using the new style geometry
+       if ( mlt_properties_get( properties, "geometry" ) )
        {
-               // Get the name of the property
-               char *name = mlt_properties_get_name( properties, i );
+               // Sundry vars
+               int i;
+               int frame = 0;
+
+               // Obtain the geometry data - this is presented in the form:
+               // x,y:WxH[!][:mix][;f=x,y:WxH[!][:mix]]*
+               char *data = mlt_properties_get( properties, "geometry" );
+
+               // Split the data on the ; to seperate the values
+               mlt_tokeniser tokens = mlt_tokeniser_init( );
+               mlt_tokeniser_parse_new( tokens, data, ";" );
 
-               // Check that it's valid
-               if ( !strncmp( name, "key[", 4 ) )
+               // Parse the first entry
+               geometry_parse( start, NULL, mlt_tokeniser_get_string( tokens, 0 ), normalised_width, normalised_height );
+
+               // Iterate through the remainder
+               for ( i = 1; i < mlt_tokeniser_count( tokens ); i ++ )
                {
-                       // Get the value of the property
-                       char *value = mlt_properties_get_value( properties, i );
+                       // Get the current value
+                       char *value = mlt_tokeniser_get_string( tokens, i );
+
+                       // Used to determine the position
+                       float position = 0;
 
-                       // Determine the frame number
-                       int frame = atoi( name + 4 );
+                       // Determine the position of the / delimiter
+                       char *p = strchr( value, '=' );
+
+                       // Ensure that it has a frame and extract that value
+                       if ( p )
+                       {
+                               frame = atoi( value );
+                               value = p + 1;
+                       }
+                       else
+                       {
+                               fprintf( stderr, "Malformed geometry - no frame in %s (%d)\n", value, i );
+                       }
 
                        // Determine the position
-                       float position = 0;
-                       
                        if ( frame >= 0 && frame < ( out - in ) )
                                position = ( float )frame / ( float )( out - in + 1 );
                        else if ( frame < 0 && - frame < ( out - in ) )
@@ -255,20 +276,80 @@ static struct geometry_s *transition_parse_keys( mlt_transition this,  int norma
                                // Allow the next to be appended after this one
                                ptr = temp;
                        }
-                       else
+               }
+
+               // Close the tokens
+               mlt_tokeniser_close( tokens );
+
+               // Parse the end
+               geometry_parse( end, ptr, NULL, normalised_width, normalised_height );
+               if ( out > 0 )
+                       end->position = ( float )( out - in ) / ( float )( out - in + 1 );
+               else
+                       end->position = 1;
+       }
+       else
+       {
+               // DEPRECATED: Multiple keys for geometry information is inefficient and too rigid for 
+               // practical use
+
+               // Parse the start property
+               geometry_parse( start, NULL, mlt_properties_get( properties, "start" ), normalised_width, normalised_height );
+
+               // Parse the keys in between
+               for ( i = 0; i < mlt_properties_count( properties ); i ++ )
+               {
+                       // Get the name of the property
+                       char *name = mlt_properties_get_name( properties, i );
+       
+                       // Check that it's valid
+                       if ( !strncmp( name, "key[", 4 ) )
                        {
-                               fprintf( stderr, "Key out of order - skipping %s\n", name );
+                               // Get the value of the property
+                               char *value = mlt_properties_get_value( properties, i );
+       
+                               // Determine the frame number
+                               int frame = atoi( name + 4 );
+       
+                               // Determine the position
+                               float position = 0;
+                               
+                               if ( frame >= 0 && frame < ( out - in ) )
+                                       position = ( float )frame / ( float )( out - in + 1 );
+                               else if ( frame < 0 && - frame < ( out - in ) )
+                                       position = ( float )( out - in + frame ) / ( float )( out - in + 1 );
+       
+                               // For now, we'll exclude all keys received out of order
+                               if ( position > ptr->position )
+                               {
+                                       // Create a new geometry
+                                       struct geometry_s *temp = calloc( 1, sizeof( struct geometry_s ) );
+       
+                                       // Parse and add to the list
+                                       geometry_parse( temp, ptr, value, normalised_width, normalised_height );
+       
+                                       // Assign the position and frame
+                                       temp->frame = frame;
+                                       temp->position = position;
+       
+                                       // Allow the next to be appended after this one
+                                       ptr = temp;
+                               }
+                               else
+                               {
+                                       fprintf( stderr, "Key out of order - skipping %s\n", name );
+                               }
                        }
                }
+
+               // Parse the end
+               geometry_parse( end, ptr, mlt_properties_get( properties, "end" ), normalised_width, normalised_height );
+               if ( out > 0 )
+                       end->position = ( float )( out - in ) / ( float )( out - in + 1 );
+               else
+                       end->position = 1;
        }
        
-       // Parse the end
-       geometry_parse( end, ptr, mlt_properties_get( properties, "end" ), normalised_width, normalised_height );
-       if ( out > 0 )
-               end->position = ( float )( out - in ) / ( float )( out - in + 1 );
-       else
-               end->position = 1;
-
        return start;
 }
 
index 369cd4860c7653fc62c31a5e2ca3853721bee3ea..01ce3290b8857487792a7d46cb6ae3f5e7ded028 100644 (file)
@@ -24,16 +24,15 @@ titles.type.markup=text
 titles.period=2
 titles.properties.length[0]=filter[0].composite.out
 titles.properties.length[1]=filter[1].composite.out
-titles.composite.start=5%,70%:90%x20%
+titles.composite.geometry=5%,70%:90%x20%
 titles.filter[0]=watermark
 titles.filter[0].resource=colour:0x000000
-titles.filter[0].composite.start=0%,0%:100%x100%:0
-titles.filter[0].composite.key[5]=0%,0%:100%x100%:40
+titles.filter[0].composite.geometry=0%,0%:100%x100%:0;5=0%,0%:100%x100%:40
+titles.filter[0].composite.titles=1
 titles.filter[1]=watermark
 titles.filter[1].resource=pango:
 titles.filter[1].producer.markup=Shotcut
-titles.filter[1].composite.start=1%,1%:99%x99%:0
-titles.filter[1].composite.key[8]=1%,1%:99%x99%:100
+titles.filter[1].composite.geometry=0%,0%:100%x100%:0;8=0%,0%:100%x100%:100
 titles.filter[1].composite.titles=1
 
 #
@@ -47,16 +46,15 @@ top-titles.type.markup=text
 top-titles.period=2
 top-titles.properties.length[0]=filter[0].composite.out
 top-titles.properties.length[1]=filter[1].composite.out
-top-titles.composite.start=5%,5%:90%x20%
+top-titles.composite.geometry=5%,5%:90%x20%
 top-titles.filter[0]=watermark
 top-titles.filter[0].resource=colour:0x000000
-top-titles.filter[0].composite.start=0%,0%:100%x100%:0
-top-titles.filter[0].composite.key[5]=0%,0%:100%x100%:40
+top-titles.filter[0].composite.geometry=0%,0%:100%x100%:0;5=0%,0%:100%x100%:40
+top-titles.filter[0].composite.titles=1
 top-titles.filter[1]=watermark
 top-titles.filter[1].resource=pango:
 top-titles.filter[1].producer.markup=Shotcut
-top-titles.filter[1].composite.start=1%,1%:99%x99%:0
-top-titles.filter[1].composite.key[8]=1%,1%:99%x99%:100
+top-titles.filter[1].composite.geometry=0%,0%:100%x100%:0;8=0%,0%:100%x100%:100
 top-titles.filter[1].composite.halign=centre
 top-titles.filter[1].composite.titles=1
 
@@ -69,15 +67,16 @@ tickertape.description=Tickertape
 tickertape.properties.markup=filter[1].producer.markup
 tickertape.type.markup=text
 tickertape.properties.length[0]=filter[1].composite.out
-tickertape.composite.start=0%,93%:100%x7%
+tickertape.composite.geometry=0%,93%:100%x7%
 tickertape.filter[0]=watermark
 tickertape.filter[0].resource=colour:0x000000
-tickertape.filter[0].composite.start=0%,0%:100%x100%:100
+tickertape.filter[0].composite.geometry=0%,0%:100%x100%:100
+tickertape.filter[0].composite.titles=1
 tickertape.filter[1]=watermark
 tickertape.filter[1].resource=pango:
 tickertape.filter[1].producer.markup=Shotcut
-tickertape.filter[1].composite.start=101%,1%:300%x99%:100
-tickertape.filter[1].composite.end=-300%,1%:300%x99%:100
+tickertape.filter[1].composite.geometry=100%,0%:300%x100%:100;-1=-300%,0%:300%x100%:100
+tickertape.filter[1].producer.font=San 32
 tickertape.filter[1].composite.titles=1
 
 #
@@ -91,19 +90,16 @@ location.type.markup=text
 location.period=2
 location.properties.length[0]=filter[0].composite.out
 location.properties.length[1]=filter[1].composite.out
-location.composite.start=0,80:230x30
+location.composite.geometry=0,80:230x30
 location.filter[0]=watermark
 location.filter[0].resource=colour:0x6c010100
-location.filter[0].composite.start=-100%,0%:100%x100%:100
-location.filter[0].composite.key[25]=0%,0%:100%x100%:100
+location.filter[0].composite.geometry=-100%,0%:100%x100%:100;25=0%,0%:100%x100%:100
 location.filter[0].composite.titles=1
 location.filter[1]=watermark
 location.filter[1].resource=pango:
 location.filter[1].producer.markup=
 location.filter[1].producer.font=San 24
-location.filter[1].composite.start=0%,0%:100%x100%:0
-location.filter[1].composite.key[24]=0%,0%:100%x100%:0
-location.filter[1].composite.key[49]=0%,0%:100%x100%:100
+location.filter[1].composite.geometry=0%,0%:100%x100%:0;24=0%,0%:100%x100%:0;49=0%,0%:100%x100%:100
 location.filter[1].composite.titles=1
 location.filter[1].composite.halign=right
 location.filter[1].composite.valign=center
@@ -115,41 +111,35 @@ courtesy.type.markup=text
 courtesy.period=2
 courtesy.properties.length[0]=filter[0].composite.out
 courtesy.properties.length[1]=filter[1].composite.out
-courtesy.composite.start=0,115:230x30
+courtesy.composite.geometry=0,115:230x30
 courtesy.filter[0]=watermark
 courtesy.filter[0].resource=colour:0x6c010100
-courtesy.filter[0].composite.start=-100%,0%:100%x100%:0
-courtesy.filter[0].composite.key[12]=-100%,0%:100%x100%:0
-courtesy.filter[0].composite.key[37]=0%,0%:100%x100%:100
+courtesy.filter[0].composite.geometry=-100%,0%:100%x100%:0;12=-100%,0%:100%x100%:0;37=0%,0%:100%x100%:100
 courtesy.filter[0].composite.titles=1
 courtesy.filter[1]=watermark
 courtesy.filter[1].resource=pango:
 courtesy.filter[1].producer.markup=ETV Exclusive
 courtesy.filter[1].producer.font=San 24
-courtesy.filter[1].composite.start=0%,0%:100%x100%:0
-courtesy.filter[1].composite.key[37]=0%,0%:100%x100%:0
-courtesy.filter[1].composite.key[61]=0%,0%:100%x100%:100
+courtesy.filter[1].composite.geometry=0%,0%:100%x100%:0;37=0%,0%:100%x100%:0;61=0%,0%:100%x100%:100
 courtesy.filter[1].composite.titles=1
 courtesy.filter[1].composite.halign=right
 courtesy.filter[1].composite.valign=right
 
 exclusive=region
-exclusive.description=Titles
+exclusive.description=Exclusive
 exclusive.period=2
 exclusive.properties.length[0]=filter[0].composite.out
 exclusive.properties.length[1]=filter[1].composite.out
-exclusive.composite.start=0,115:230x30
+exclusive.composite.geometry=0,115:230x30
 exclusive.filter[0]=watermark
 exclusive.filter[0].resource=colour:0x6c010100
-exclusive.filter[0].composite.start=0%,0%:100%x100%:10
-exclusive.filter[0].composite.key[25]=0%,0%:100%x100%:100
+exclusive.filter[0].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 exclusive.filter[0].composite.titles=1
 exclusive.filter[1]=watermark
 exclusive.filter[1].resource=pango:
 exclusive.filter[1].producer.markup=ETV Exclusive
 exclusive.filter[1].producer.font=San 24
-exclusive.filter[1].composite.start=0%,0%:100%x100%:10
-exclusive.filter[1].composite.key[25]=0%,0%:100%x100%:100
+exclusive.filter[1].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 exclusive.filter[1].composite.titles=1
 exclusive.filter[1].composite.halign=right
 exclusive.filter[1].composite.valign=right
@@ -159,18 +149,16 @@ file_shot.description=Titles
 file_shot.period=2
 file_shot.properties.length[0]=filter[0].composite.out
 file_shot.properties.length[1]=filter[1].composite.out
-file_shot.composite.start=590,160:80x25
+file_shot.composite.geometry=590,160:80x25
 file_shot.filter[0]=watermark
 file_shot.filter[0].resource=colour:0x6c010100
-file_shot.filter[0].composite.start=0%,0%:100%x100%:10
-file_shot.filter[0].composite.key[25]=0%,0%:100%x100%:100
+file_shot.filter[0].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 file_shot.filter[0].composite.titles=1
 file_shot.filter[1]=watermark
 file_shot.filter[1].resource=pango:
 file_shot.filter[1].producer.markup=File Shot
 file_shot.filter[1].producer.font=San 20
-file_shot.filter[1].composite.start=1%,1%:99%x99%:15
-file_shot.filter[1].composite.key[25]=1%,1%:99%x99%:100
+file_shot.filter[1].composite.geometry=1%,1%:99%x99%:15;25=1%,1%:99%x99%:100
 file_shot.filter[1].composite.titles=0
 file_shot.filter[1].composite.halign=centre
 file_shot.filter[1].composite.valign=centre
@@ -180,86 +168,34 @@ special.description=Titles
 special.period=2
 special.properties.length[0]=filter[0].composite.out
 special.properties.length[1]=filter[1].composite.out
-special.composite.start=465,375:255x35
+special.composite.geometry=465,375:255x35
 special.filter[0]=watermark
 special.filter[0].resource=colour:0x6c010100
-special.filter[0].composite.start=100%,0%:100%x100%:0
-special.filter[1].composite.key[49]=100%,0%:100%x100%:0
-special.filter[0].composite.key[74]=0%,0%:100%x100%:100
+special.filter[0].composite.geometry=100%,0%:100%x100%:0;49=100%,0%:100%x100%:0;74=0%,0%:100%x100%:100
 special.filter[0].composite.titles=1
 special.filter[1]=watermark
 special.filter[1].resource=pango:
 special.filter[1].producer.markup=Special
 special.filter[1].producer.font=San 24
-special.filter[1].composite.start=100%,0%:100%x100%:0
-special.filter[1].composite.key[49]=100%,0%:100%x100%:0
-special.filter[1].composite.key[74]=0%,0%:100%x100%:100
+special.filter[1].composite.geometry=100%,0%:100%x100%:0;49=100%,0%:100%x100%:0;74=0%,0%:100%x100%:100
 special.filter[1].composite.titles=1
 special.filter[1].composite.halign=centre
 special.filter[1].composite.valign=centre
 
-name=region
-name.description=Titles
-name.properties.markup=filter[1].producer.markup
-name.type.markup=text
-name.period=2
-name.properties.length[0]=filter[0].composite.out
-name.properties.length[1]=filter[1].composite.out
-name.composite.start=0,410:720x45
-name.filter[0]=watermark
-name.filter[0].resource=colour:0xbbbbbb00
-name.filter[0].composite.start=0%,0%:100%x100%:10
-name.filter[0].composite.key[25]=0%,0%:100%x100%:100
-name.filter[0].composite.titles=1
-name.filter[1]=watermark
-name.filter[1].resource=pango:
-name.filter[1].producer.markup=
-name.filter[1].producer.font=San 32
-name.filter[1].producer.fgcolour=0x6c0101ff
-name.filter[1].composite.start=0%,0%:100%x100%:10
-name.filter[1].composite.key[25]=0%,0%:100%x100%:100
-name.filter[1].composite.titles=1
-name.filter[1].composite.halign=centre
-name.filter[1].composite.valign=centre
-
-designation=region
-designation.description=Titles
-designation.properties.markup=filter[1].producer.markup
-designation.type.markup=text
-designation.period=2
-designation.properties.length[0]=filter[0].composite.out
-designation.properties.length[1]=filter[1].composite.out
-designation.composite.start=0,455:720x45
-designation.filter[0]=watermark
-designation.filter[0].resource=colour:0xbbbbbb00
-designation.filter[0].composite.start=0%,0%:100%x100%:10
-designation.filter[0].composite.key[25]=0%,0%:100%x100%:100
-designation.filter[0].composite.titles=1
-designation.filter[1]=watermark
-designation.filter[1].resource=pango:
-designation.filter[1].producer.markup=
-designation.filter[1].producer.font=San 32
-designation.filter[1].producer.fgcolour=0x6c0101ff
-designation.filter[1].composite.start=0%,0%:100%x100%:10
-designation.filter[1].composite.key[25]=0%,0%:100%x100%:100
-designation.filter[1].composite.titles=1
-designation.filter[1].composite.halign=centre
-designation.filter[1].composite.valign=centre
-
 ticker=region
 ticker.description=Tickertape
 ticker.properties.markup=filter[1].producer.markup
 ticker.type.markup=text
 ticker.properties.length[0]=filter[1].composite.out
-ticker.composite.start=0,500:722x75
+ticker.composite.geometry=0,500:722x75
 ticker.filter[0]=watermark
 ticker.filter[0].resource=colour:0x6c010100
-ticker.filter[0].composite.start=0%,0%:100%x100%:100
+ticker.filter[0].composite.geometry=0%,0%:100%x100%:100
 ticker.filter[0].composite.titles=1
 ticker.filter[1]=watermark
 ticker.filter[1].resource=pango:
 ticker.filter[1].producer.markup=Ticker - provided for reference
-ticker.filter[1].composite.start=0%,0%:100%x100%:100
+ticker.filter[1].composite.geometry=0%,0%:100%x100%:100
 ticker.filter[1].composite.titles=0
 ticker.filter[1].producer.font=San 24
 ticker.filter[1].composite.halign=centre
@@ -270,22 +206,22 @@ super=region
 super.description=Transcription
 super.properties.0=filter[1].producer.markup
 super.properties.1=filter[2].producer.markup
+super.properties.align=filter[1].composite.valign
 super.properties.length[0]=filter[0].composite.out
 super.properties.length[1]=filter[1].composite.out
 super.properties.length[2]=filter[2].composite.out
-super.composite.start=0,410:720x90
+super.period=2
+super.composite.geometry=0,410:720x90
 super.filter[0]=watermark
 super.filter[0].resource=colour:0xbbbbbb00
-super.filter[0].composite.start=0%,0%:100%x100%:10
-super.filter[0].composite.key[25]=0%,0%:100%x100%:100
+super.filter[0].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 super.filter[0].composite.titles=1
 super.filter[1]=watermark
 super.filter[1].resource=pango:
 super.filter[1].producer.markup=
 super.filter[1].producer.font=San 32
 super.filter[1].producer.fgcolour=0x6c0101ff
-super.filter[1].composite.start=0,0:100%x100%:10
-super.filter[1].composite.key[25]=0,0:100%x100%:100
+super.filter[1].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 super.filter[1].composite.titles=1
 super.filter[1].composite.halign=centre
 super.filter[1].composite.valign=top
@@ -294,9 +230,15 @@ super.filter[2].resource=pango:
 super.filter[2].producer.markup=
 super.filter[2].producer.font=San 32
 super.filter[2].producer.fgcolour=0x6c0101ff
-super.filter[2].composite.start=0,0:100%x100%:10
-super.filter[2].composite.key[25]=0,0:100%x100%:100
+super.filter[2].composite.geometry=0%,0%:100%x100%:10;25=0%,0%:100%x100%:100
 super.filter[2].composite.titles=1
 super.filter[2].composite.halign=centre
 super.filter[2].composite.valign=bottom
 
+obscure=region
+obscure.description=Obscure
+obscure.properties.geometry=obscure.geometry
+obscure.composite.geometry=
+obscure.filter[0]=obscure
+obscure.filter[0].start=0,0:100%x100%
+