static void setup_transitions(struct state_machine *sm) { int i; for (i = 0; i < sm->nstates; ++i) setup_transition(sm, i); }
/** Get the image. */ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { int error = 0; mlt_filter filter = mlt_frame_pop_service( frame ); mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_producer producer = mlt_properties_get_data( properties, "_producer", NULL ); mlt_transition transition = mlt_properties_get_data( properties, "_transition", NULL ); mlt_frame text_frame = NULL; mlt_position position = 0; // Configure this filter mlt_service_lock( MLT_FILTER_SERVICE( filter ) ); setup_producer( filter, producer, frame ); setup_transition( filter, transition ); mlt_service_unlock( MLT_FILTER_SERVICE( filter ) ); // Make sure the producer is in the correct position position = mlt_filter_get_position( filter, frame ); mlt_producer_seek( producer, position ); // Get the b frame and process with transition if successful if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &text_frame, 0 ) == 0 ) { // Get the a and b frame properties mlt_properties a_props = MLT_FRAME_PROPERTIES( frame ); mlt_properties b_props = MLT_FRAME_PROPERTIES( text_frame ); // Set the frame and text_frame to be in the same position and have same consumer requirements mlt_frame_set_position( text_frame, position ); mlt_frame_set_position( frame, position ); mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_int( a_props, "consumer_deinterlace" ) ); // Apply all filters that are attached to this filter to the b frame mlt_service_apply_filters( MLT_FILTER_SERVICE( filter ), text_frame, 0 ); // Process the frame mlt_transition_process( transition, frame, text_frame ); // Get the image *format = mlt_image_yuv422; error = mlt_frame_get_image( frame, image, format, width, height, 1 ); // Close the b frame mlt_frame_close( text_frame ); } return error; }