示例#1
0
void SingleResourceLoader::parse_filters() throw (Exception)
{
    json_t* ja = json_object_get(defines_tmp.h, "effects");
    if (!ja || !json_is_array(ja) || !json_array_size(ja)  ) return;

    int aze = json_array_size(ja);
    for ( int i=0; i<aze; i++ ) {
        json_t* jae = json_array_get(ja, i);
        mlt_filter filter = get_filter(jae);

        mlt_producer_attach(producer_tmp, filter);
    }
}
示例#2
0
static void create_filter( mlt_profile profile, mlt_producer producer, char *effect, int *created )
{
	char *id = strdup( effect );
	char *arg = strchr( id, ':' );
	if ( arg != NULL )
		*arg ++ = '\0';

	// The swscale and avcolor_space filters require resolution as arg to test compatibility
	if ( strncmp( effect, "swscale", 7 ) == 0 || strncmp( effect, "avcolo", 6 ) == 0 )
		arg = (char*) mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( producer ), "_real_width" );

	mlt_filter filter = mlt_factory_filter( profile, id, arg );
	if ( filter != NULL )
	{
		mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_loader", 1 );
		mlt_producer_attach( producer, filter );
		mlt_filter_close( filter );
		*created = 1;
	}
	free( id );
}