static void geometry_calculate( mlt_transition transition, const char *store, struct mlt_geometry_item_s *output, double position ) { mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition ); mlt_geometry geometry = mlt_properties_get_data( properties, store, NULL ); int mirror_off = mlt_properties_get_int( properties, "mirror_off" ); int repeat_off = mlt_properties_get_int( properties, "repeat_off" ); int length = mlt_geometry_get_length( geometry ); // Allow wrapping if ( !repeat_off && position >= length && length != 0 ) { int section = position / length; position -= section * length; if ( !mirror_off && section % 2 == 1 ) position = length - position; } // Fetch the key for the position mlt_geometry_fetch( geometry, output, position ); }
char *mlt_geometry_serialise_cut( mlt_geometry self, int in, int out ) { geometry g = self->local; struct mlt_geometry_item_s item; char *ret = malloc( 1000 ); int used = 0; int size = 1000; if ( in == -1 ) in = 0; if ( out == -1 ) out = mlt_geometry_get_length( self ); if ( ret != NULL ) { char temp[ 100 ]; strcpy( ret, "" ); item.frame = in; while( 1 ) { strcpy( temp, "" ); // If it's the first frame, then it's not necessarily a key if ( item.frame == in ) { if ( mlt_geometry_fetch( self, &item, item.frame ) ) break; // If the first key is larger than the current position // then do nothing here if ( g->item->data.frame > item.frame ) { item.frame ++; continue; } // To ensure correct seeding, ensure all values are fixed item.f[0] = 1; item.f[1] = 1; item.f[2] = 1; item.f[3] = 1; item.f[4] = 1; } // Typically, we move from key to key else if ( item.frame < out ) { if ( mlt_geometry_next_key( self, &item, item.frame ) ) break; // Special case - crop at the out point if ( item.frame > out ) mlt_geometry_fetch( self, &item, out ); } // We've handled the last key else { break; } if ( item.frame - in != 0 ) sprintf( temp, "%d=", item.frame - in ); if ( item.f[0] ) sprintf( temp + strlen( temp ), "%g", item.x ); if ( item.f[1] ) { strcat( temp, "/" ); sprintf( temp + strlen( temp ), "%g", item.y ); } if ( item.f[2] ) { strcat( temp, ":" ); sprintf( temp + strlen( temp ), "%g", item.w ); } if ( item.f[3] ) { strcat( temp, "x" ); sprintf( temp + strlen( temp ), "%g", item.h ); } if ( item.f[4] ) { strcat( temp, ":" ); sprintf( temp + strlen( temp ), "%g", item.mix ); } if ( used + strlen( temp ) + 2 > size ) // +2 for ';' and NULL { size += 1000; ret = realloc( ret, size ); } if ( ret != NULL && used != 0 ) { used ++; strcat( ret, ";" ); } if ( ret != NULL ) { used += strlen( temp ); strcat( ret, temp ); } item.frame ++; } } return ret; }
else if ( align[ 0 ] == 'r' || align[ 0 ] == 'b' ) ret = 2; return ret; } /** Calculate real geometry. */ static void geometry_calculate( mlt_transition this, struct geometry_s *output, double position ) { mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); mlt_geometry geometry = mlt_properties_get_data( properties, "geometries", NULL ); int mirror_off = mlt_properties_get_int( properties, "mirror_off" ); int repeat_off = mlt_properties_get_int( properties, "repeat_off" ); int length = mlt_geometry_get_length( geometry ); // Allow wrapping if ( !repeat_off && position >= length && length != 0 ) { int section = position / length; position -= section * length; if ( !mirror_off && section % 2 == 1 ) position = length - position; } // Fetch the key for the position mlt_geometry_fetch( geometry, &output->item, position ); } static mlt_geometry transition_parse_keys( mlt_transition this, int normalised_width, int normalised_height )