Exemple #1
0
static void deserialize_vectors( videostab self, char *vectors, mlt_position length )
{
	mlt_geometry g = mlt_geometry_init();

	// Parse the property as a geometry
	if ( g && !mlt_geometry_parse( g, vectors, length, -1, -1 ) )
	{
		struct mlt_geometry_item_s item;
		int i;

		// Copy the geometry items to a vc array for interp()
		for ( i = 0; i < length; i++ )
		{
			mlt_geometry_fetch( g, &item, i );
			self->pos_h[i].x = item.x;
			self->pos_h[i].y = item.y;
		}
	}
	else
	{
		mlt_log_warning( MLT_FILTER_SERVICE(self->parent), "failed to parse vectors\n" );
	}

	// We are done with this mlt_geometry
	if ( g ) mlt_geometry_close( g );
}
Exemple #2
0
// Conditionally refresh in case of a change
int mlt_geometry_refresh( mlt_geometry self, char *data, int length, int nw, int nh )
{
	geometry g = self->local;
	int changed = ( length != -1 && length != g->length );
	changed = changed || ( nw != -1 && nw != g->nw );
	changed = changed || ( nh != -1 && nh != g->nh );
	changed = changed || ( data != NULL && ( g->data == NULL || strcmp( data, g->data ) ) );
	if ( changed )
		return mlt_geometry_parse( self, data, length, nw, nh );
	return -1;
}
Exemple #3
0
static mlt_geometry transition_parse_keys( mlt_transition transition, const char *name, const char *store, int normalised_width, int normalised_height )
{
	// Get the properties of the transition
	mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition );

	// Try to fetch it first
	mlt_geometry geometry = mlt_properties_get_data( properties, store, NULL );

	// Determine length and obtain cycle
	mlt_position length = mlt_transition_get_length( transition );
	double cycle = mlt_properties_get_double( properties, "cycle" );

	// Allow a geometry repeat cycle
	if ( cycle >= 1 )
		length = cycle;
	else if ( cycle > 0 )
		length *= cycle;

	if ( geometry == NULL )
	{
		// Get the new style geometry string
		char *property = mlt_properties_get( properties, name );

		// Create an empty geometries object
		geometry = mlt_geometry_init( );

		// Parse the geometry if we have one
		mlt_geometry_parse( geometry, property, length, normalised_width, normalised_height );

		// Store it
		mlt_properties_set_data( properties, store, geometry, 0, ( mlt_destructor )mlt_geometry_close, NULL );
	}
	else
	{
		// Check for updates and refresh if necessary
		mlt_geometry_refresh( geometry, mlt_properties_get( properties, name ), length, normalised_width, normalised_height );
	}

	return geometry;
}