int out = mlt_properties_get_int( properties, "period" );
int cycle = mlt_properties_get_int( properties, "cycle" );
int duration = mlt_properties_get_int( properties, "duration" );
- char *name = mlt_properties_get( properties, "_unique_id" );
- mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES(this), name );
+ mlt_position position = mlt_filter_get_position( filter, this );
out = out? out + 1 : 25;
if ( cycle )
static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
{
- // Get a unique name to store the frame position
- char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" );
-
- // Assign the current position to the name
- mlt_properties_set_position( MLT_FRAME_PROPERTIES( frame ), name, mlt_frame_get_position( frame ) );
-
// Push the filter on to the stack
mlt_frame_push_service( frame, this );
// We will get the 'b frame' from the producer
mlt_frame b_frame = NULL;
- // Get the unique id of the filter (used to reacquire the producer position)
- char *name = mlt_properties_get( properties, "_unique_id" );
-
// Get the original producer position
- mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name );
+ mlt_position position = mlt_filter_get_position( this, frame );
// Make sure the producer is in the correct position
mlt_producer_seek( producer, position );
// Get the properties of the frame
mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
- // Get a unique name to store the frame position
- char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" );
-
// Assign the frame out point to the filter (just in case we need it later)
mlt_properties_set_int( MLT_FILTER_PROPERTIES( this ), "_out", mlt_properties_get_int( properties, "out" ) );
- // Assign the current position to the name
- mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) );
-
// Push the filter on to the stack
mlt_frame_push_service( frame, this );
{
// Put the current image into the image cache, keyed on position
size_t image_size = (*width * *height) << 1;
- mlt_position pos = mlt_frame_get_position( frame );
+ mlt_position pos = mlt_filter_get_position( filter, frame );
uint8_t *image_copy = mlt_pool_alloc( image_size );
memcpy( image_copy, *image, image_size );
char key[20];
int freeze_before = mlt_properties_get_int( properties, "freeze_before" );
int freeze_after = mlt_properties_get_int( properties, "freeze_after" );
mlt_position pos = mlt_properties_get_position( properties, "frame" );
- mlt_position currentpos = mlt_properties_get_position( properties, "_seek_frame" );
+ mlt_position currentpos = mlt_filter_get_position( filter, this );
int do_freeze = 0;
if (freeze_before == 0 && freeze_after == 0) {
// Push the filter on to the stack
mlt_frame_push_service( frame, this );
- // Determine the time position of this frame
- mlt_properties_set_position( MLT_FILTER_PROPERTIES( this ), "_seek_frame", mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) );
-
// Push the frame filter
mlt_frame_push_get_image( frame, filter_get_image );
mlt_properties frame_properties = MLT_FRAME_PROPERTIES(frame);
// Get the frame position
- mlt_position position = mlt_frame_get_position( frame );
+ mlt_position position = mlt_filter_get_position( filter, frame );
// Get the new image
int error = mlt_frame_get_image( frame, image, format, width, height, 1 );
mlt_properties frame_properties = MLT_FRAME_PROPERTIES(frame);
// Get the frame position
- mlt_position position = mlt_frame_get_position( frame );
+ mlt_position position = mlt_filter_get_position( filter, frame );
mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
}
// For periodic detection (with offset of 'skip')
- if( frequency == 0 || (int)(mlt_frame_get_position(this)+skip) % frequency != 0)
+ if( frequency == 0 || (int)(mlt_filter_get_position(filter, this)+skip) % frequency != 0)
{
// Inject in stream
mlt_properties_set_data( MLT_FRAME_PROPERTIES(this), "bounds", bounds, sizeof( struct mlt_geometry_item_s ), NULL, NULL );
{
float smooth, radius, cx, cy, opac;
mlt_properties filter_props = MLT_FILTER_PROPERTIES( filter ) ;
- mlt_position pos = mlt_properties_get_position( filter_props, "_pos" );
+ mlt_position pos = mlt_filter_get_position( filter, this );
smooth = geometry_to_float ( mlt_properties_get( filter_props , "smooth" ) , pos ) * 100.0 ;
radius = geometry_to_float ( mlt_properties_get( filter_props , "radius" ) , pos ) * *width;
static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
{
-
mlt_frame_push_service( frame, this );
-
- // Determine the time position of this frame
- mlt_properties_set_position( MLT_FILTER_PROPERTIES( this ), "_pos", mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) );
-
mlt_frame_push_get_image( frame, filter_get_image );
return frame;
}
if ( producer != NULL && transition != NULL )
{
- char *name = mlt_properties_get( properties, "_unique_id" );
- mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( this ), name );
+ mlt_position position = mlt_filter_get_position( filter, this );
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this );
mlt_position in = mlt_filter_get_in( filter );
mlt_position out = mlt_filter_get_out( filter );
mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
mlt_producer_set_in_and_out( producer, in, out );
}
- mlt_producer_seek( producer, position - in );
+ mlt_producer_seek( producer, in + position );
mlt_frame_set_position( this, position );
mlt_properties_pass( MLT_PRODUCER_PROPERTIES( producer ), properties, "producer." );
mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), properties, "transition." );
mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &a_frame, 0 );
- mlt_frame_set_position( a_frame, position );
+ mlt_frame_set_position( a_frame, in + position );
// mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "distort", 1 );
// Special case - aspect_ratio = 0
static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
{
- // Get the properties of the frame
- mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
-
- // Get a unique name to store the frame position
- char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "_unique_id" );
-
- // Assign the current position to the name
- mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) );
-
// Push the frame filter
mlt_frame_push_service( frame, this );
mlt_frame_push_get_image( frame, filter_get_image );
if ( this != NULL )
{
this->process = filter_process;
- mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "background", "colour:black" );
+ mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "background", arg ? arg : "colour:black" );
}
return this;
}
double alpha_mix = 0.0;
// Calculate the position and length
- int position = mlt_frame_get_position( frame ) - mlt_filter_get_in( this );
+ int position = mlt_filter_get_position( this, frame );
int in = mlt_filter_get_in( this );
int out = mlt_filter_get_out( this );
int length;