mlt_filter filter_avresample_init( char *arg ) { // Create a filter mlt_filter filter = mlt_filter_new( ); // Initialise if successful if ( filter != NULL ) { // Calculate size of the buffer int size = MAX_AUDIO_FRAME_SIZE * sizeof( int16_t ); // Allocate the buffer int16_t *buffer = mlt_pool_alloc( size ); // Assign the process method filter->process = filter_process; // Deal with argument if ( arg != NULL ) mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "frequency", arg ); // Default to 2 channel output mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "channels", 2 ); // Store the buffer mlt_properties_set_data( MLT_FILTER_PROPERTIES( filter ), "buffer", buffer, size, mlt_pool_release, NULL ); } return filter; }
mlt_filter filter_audiochannels_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new(); if ( filter ) filter->process = filter_process; return filter; }
mlt_filter filter_greyscale_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) filter->process = filter_process; return filter; }
mlt_filter filter_vidstab_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new(); vs_data* data = (vs_data*)calloc( 1, sizeof(vs_data) ); if ( filter && data ) { data->analyze_data = NULL; data->apply_data = NULL; filter->close = filter_close; filter->child = data; filter->process = process_filter; mlt_properties properties = MLT_FILTER_PROPERTIES(filter); //properties for analyze mlt_properties_set( properties, "filename", "vidstab.trf" ); mlt_properties_set( properties, "shakiness", "4" ); mlt_properties_set( properties, "accuracy", "4" ); mlt_properties_set( properties, "stepsize", "6" ); mlt_properties_set( properties, "algo", "1" ); mlt_properties_set( properties, "mincontrast", "0.3" ); mlt_properties_set( properties, "show", "0" ); mlt_properties_set( properties, "tripod", "0" ); // properties for apply mlt_properties_set( properties, "smoothing", "15" ); mlt_properties_set( properties, "maxshift", "-1" ); mlt_properties_set( properties, "maxangle", "-1" ); mlt_properties_set( properties, "crop", "0" ); mlt_properties_set( properties, "invert", "0" ); mlt_properties_set( properties, "relative", "1" ); mlt_properties_set( properties, "zoom", "0" ); mlt_properties_set( properties, "optzoom", "1" ); mlt_properties_set( properties, "zoomspeed", "0.25" ); mlt_properties_set( properties, "reload", "0" ); mlt_properties_set( properties, "vid.stab.version", LIBVIDSTAB_VERSION ); init_vslog(); } else { if( filter ) { mlt_filter_close( filter ); } if( data ) { free( data ); } filter = NULL; } return filter; }
mlt_filter filter_gamma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "gamma", arg == NULL ? "1" : arg ); } return filter; }
mlt_filter filter_mask_apply_init(mlt_profile profile, mlt_service_type type, const char *id, char *arg) { mlt_filter filter = mlt_filter_new( ); if (filter) { mlt_properties_set(MLT_FILTER_PROPERTIES(filter), "transition", arg? arg : "frei0r.composition"); mlt_properties_set(MLT_FILTER_PROPERTIES(filter), "mlt_image_format", "rgb24a"); filter->process = process; } return filter; }
mlt_filter filter_qtblend_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "background", arg ? arg : "colour:0" ); } return filter; }
mlt_filter filter_audiospectrum_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new(); private_data* pdata = (private_data*)calloc( 1, sizeof(private_data) ); if ( filter && pdata && createQApplicationIfNeeded( MLT_FILTER_SERVICE(filter) ) ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_set_int( properties, "_filter_private", 1 ); mlt_properties_set_int( properties, "frequency_low", 20 ); mlt_properties_set_int( properties, "frequency_high", 20000 ); mlt_properties_set( properties, "type", "line" ); mlt_properties_set( properties, "bgcolor", "0x00000000" ); mlt_properties_set( properties, "color.1", "0xffffffff" ); mlt_properties_set( properties, "rect", "0% 0% 100% 100%" ); mlt_properties_set( properties, "thickness", "0" ); mlt_properties_set( properties, "fill", "0" ); mlt_properties_set( properties, "mirror", "0" ); mlt_properties_set( properties, "reverse", "0" ); mlt_properties_set( properties, "tension", "0.4" ); mlt_properties_set( properties, "angle", "0" ); mlt_properties_set( properties, "gorient", "v" ); mlt_properties_set_int( properties, "bands", 31 ); mlt_properties_set_double( properties, "threshold", -60.0 ); mlt_properties_set_int( properties, "window_size", 8192 ); // Create a unique ID for storing data on the frame pdata->fft_prop_name = (char*)calloc( 1, 20 ); snprintf( pdata->fft_prop_name, 20, "fft.%p", filter ); pdata->fft_prop_name[20 - 1] = '\0'; pdata->fft = 0; filter->close = filter_close; filter->process = filter_process; filter->child = pdata; } else { mlt_log_error( MLT_FILTER_SERVICE(filter), "Filter audio spectrum failed\n" ); if( filter ) { mlt_filter_close( filter ); } if( pdata ) { free( pdata ); } filter = NULL; } return filter; }
mlt_filter filter_dust_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "maxdiameter", "2" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "maxcount", "10" ); } return filter; }
mlt_filter filter_obscure_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); filter->process = filter_process; mlt_properties_set( properties, "start", arg != NULL ? arg : "0%/0%:100%x100%" ); mlt_properties_set( properties, "end", "" ); } return filter; }
mlt_filter filter_grain_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "noise", "40" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "contrast", "160" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "brightness", "70" ); } return filter; }
mlt_filter filter_charcoal_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "x_scatter", 1 ); mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "y_scatter", 1 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "scale", 1.5 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "mix", 0.0 ); } return filter; }
mlt_filter filter_mono_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; if ( arg != NULL ) mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "channels", atoi( arg ) ); else mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "channels", -1 ); } return filter; }
mlt_filter filter_wave_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "start", arg == NULL ? "10" : arg); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "speed", "5"); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "deformX", "1"); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "deformY", "1"); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "wave", NULL); } return filter; }
mlt_filter filter_loudness_meter_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); private_data* pdata = (private_data*)calloc( 1, sizeof(private_data) ); if( filter && pdata ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_set_int( properties, "calc_program", 1 ); mlt_properties_set_int( properties, "calc_shortterm", 1 ); mlt_properties_set_int( properties, "calc_momentary", 1 ); mlt_properties_set_int( properties, "calc_range", 1 ); mlt_properties_set_int( properties, "calc_peak", 1 ); mlt_properties_set_int( properties, "calc_true_peak", 1 ); mlt_properties_set( properties, "program", "-100.0" ); mlt_properties_set( properties, "shortterm", "-100.0" ); mlt_properties_set( properties, "momentary", "-100.0" ); mlt_properties_set( properties, "range", "-1.0" ); mlt_properties_set( properties, "peak", "-100.0" ); mlt_properties_set( properties, "max_peak", "-100.0" ); mlt_properties_set( properties, "true_peak", "-100.0" ); mlt_properties_set( properties, "max_true_peak", "-100.0" ); mlt_properties_set( properties, "reset", "1" ); mlt_properties_set( properties, "reset_count", "0" ); mlt_properties_set( properties, "frames_processed", "0" ); pdata->r128 = 0; pdata->reset = 1; pdata->prev_pos = -1; filter->close = filter_close; filter->process = filter_process; filter->child = pdata; mlt_events_listen( properties, filter, "property-changed", (mlt_listener)property_changed ); } else { if( filter ) { mlt_filter_close( filter ); filter = NULL; } free( pdata ); } return filter; }
mlt_filter filter_channelcopy_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; if ( arg != NULL ) mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "to", atoi( arg ) ); else mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "to", 1 ); if ( strcmp(id, "channelswap") == 0 ) mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "swap", 1 ); } return filter; }
mlt_filter filter_watermark_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); filter->process = filter_process; mlt_properties_set( properties, "factory", mlt_environment( "MLT_PRODUCER" ) ); if ( arg != NULL ) mlt_properties_set( properties, "resource", arg ); // Ensure that attached filters are handled privately mlt_properties_set_int( properties, "_filter_private", 1 ); } return filter; }
mlt_filter filter_deconvolution_sharpen_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = NULL; GlslManager* glsl = GlslManager::get_instance(); if ( glsl && ( filter = mlt_filter_new() ) ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_set_int( properties, "matrix_size", 5 ); mlt_properties_set_double( properties, "circle_radius", 2.0 ); mlt_properties_set_double( properties, "gaussian_radius", 0.0 ); mlt_properties_set_double( properties, "correlation", 0.95 ); mlt_properties_set_double( properties, "noise", 0.01 ); filter->process = process; } return filter; }
mlt_filter filter_videostab_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { videostab self = calloc( 1, sizeof(*self) ); if ( self ) { mlt_filter parent = mlt_filter_new(); parent->child = self; parent->close = filter_close; parent->process = filter_process; self->parent = parent; mlt_properties_set( MLT_FILTER_PROPERTIES(parent), "shutterangle", "0" ); // 0 - 180 , default 0 self->lanc_kernels=prepare_lanc_kernels(); return parent; } return NULL; }
mlt_filter filter_vignette_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "smooth", 0.8 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "radius", 0.5 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "x", 0.5 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "y", 0.5 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "opacity", 0.0 ); mlt_properties_set_double( MLT_FILTER_PROPERTIES( filter ), "mode", 0 ); } return filter; }
mlt_filter filter_spot_remover_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new(); if ( filter ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_set( properties, "rect", "0% 0% 10% 10%" ); filter->process = filter_process; } else { mlt_log_error( NULL, "Filter spot_remover initialization failed\n" ); } return filter; }
mlt_filter filter_oldfilm_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) { filter->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "delta", "14" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "every", "20" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "brightnessdelta_up" , "20" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "brightnessdelta_down" , "30" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "brightnessdelta_every" , "70" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "unevendevelop_up" , "60" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "unevendevelop_down" , "20" ); mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "unevendevelop_duration" , "70" ); } return filter; }
mlt_filter filter_lift_gamma_gain_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new(); private_data* self = (private_data*)calloc( 1, sizeof(private_data) ); int i = 0; if ( filter && self ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); // Initialize self data for( i = 0; i < 256; i++ ) { self->rlut[i] = i; self->glut[i] = i; self->blut[i] = i; } self->rlift = self->glift = self->blift = 0.0; self->rgamma = self->ggamma = self->bgamma = 1.0; self->rgain = self->ggain = self->bgain = 1.0; // Initialize filter properties mlt_properties_set_double( properties, "lift_r", self->rlift ); mlt_properties_set_double( properties, "lift_g", self->glift ); mlt_properties_set_double( properties, "lift_b", self->blift ); mlt_properties_set_double( properties, "gamma_r", self->rgamma ); mlt_properties_set_double( properties, "gamma_g", self->ggamma ); mlt_properties_set_double( properties, "gamma_b", self->bgamma ); mlt_properties_set_double( properties, "gain_r", self->rgain ); mlt_properties_set_double( properties, "gain_g", self->ggain ); mlt_properties_set_double( properties, "gain_b", self->bgain ); filter->close = filter_close; filter->process = filter_process; filter->child = self; } else { mlt_log_error( MLT_FILTER_SERVICE(filter), "Filter lift_gamma_gain init failed\n" ); mlt_filter_close( filter ); filter = NULL; free( self ); } return filter; }
mlt_filter filter_dynamic_loudness_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = mlt_filter_new( ); private_data* pdata = (private_data*)calloc( 1, sizeof(private_data) ); if( filter && pdata ) { mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); mlt_properties_set( properties, "target_loudness", "-23.0" ); mlt_properties_set( properties, "window", "3.0" ); mlt_properties_set( properties, "max_gain", "15.0" ); mlt_properties_set( properties, "min_gain", "-15.0" ); mlt_properties_set( properties, "max_rate", "3.0" ); mlt_properties_set( properties, "in_loudness", "-100.0" ); mlt_properties_set( properties, "out_gain", "0.0" ); mlt_properties_set( properties, "reset_count", "0" ); pdata->target_gain = 0.0; pdata->start_gain = 0.0; pdata->end_gain = 0.0; pdata->r128 = 0; pdata->reset = 1; pdata->time_elapsed_ms = 0; pdata->prev_o_pos = 0; filter->close = filter_close; filter->process = filter_process; filter->child = pdata; mlt_events_listen( properties, filter, "property-changed", (mlt_listener)property_changed ); } else { if( filter ) { mlt_filter_close( filter ); filter = NULL; } free( pdata ); } return filter; }
GlslManager::GlslManager() : Mlt::Filter( mlt_filter_new() ) , pbo(0) , initEvent(0) , closeEvent(0) { mlt_filter filter = get_filter(); if ( filter ) { // Set the mlt_filter child in case we choose to override virtual functions. filter->child = this; mlt_properties_set_data(mlt_global_properties(), "glslManager", this, 0, (mlt_destructor) deleteManager, NULL); mlt_events_register( get_properties(), "init glsl", NULL ); mlt_events_register( get_properties(), "close glsl", NULL ); initEvent = listen("init glsl", this, (mlt_listener) GlslManager::onInit); closeEvent = listen("close glsl", this, (mlt_listener) GlslManager::onClose); } }
mlt_filter filter_avcolour_space_init( void *arg ) { // Test to see if swscale accepts the arg as resolution if ( arg ) { int *width = (int*) arg; if ( *width > 0 ) { struct SwsContext *context = sws_getContext( *width, *width, AV_PIX_FMT_RGB32, 64, 64, AV_PIX_FMT_RGB32, SWS_BILINEAR, NULL, NULL, NULL); if ( context ) sws_freeContext( context ); else return NULL; } } mlt_filter filter = mlt_filter_new( ); if ( filter != NULL ) filter->process = filter_process; return filter; }
mlt_filter filter_data_show_init( mlt_profile profile, mlt_service_type type, const char *id, void *arg ) { // Create the filter mlt_filter filter = mlt_filter_new( ); // Initialise it if ( filter != NULL ) { // Get the properties mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); // Assign the argument (default to titles) mlt_properties_set( properties, "resource", arg == NULL ? NULL : arg ); // Specify the processing method filter->process = filter_process; } return filter; }
mlt_filter filter_mirror_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { // Construct a new filter mlt_filter filter = mlt_filter_new( ); // If we have a filter, initialise it if ( filter != NULL ) { // Get the properties mlt_properties properties = MLT_FILTER_PROPERTIES( filter ); // Set the default mirror type mlt_properties_set_or_default( properties, "mirror", arg, "horizontal" ); // Assign the process method filter->process = filter_process; } // Return the filter return filter; }
mlt_filter filter_movit_convert_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter filter = NULL; GlslManager* glsl = GlslManager::get_instance(); if ( glsl && ( filter = mlt_filter_new() ) ) { #ifdef WIN32 // XXX avcolor_space is crashing on Windows in this context! mlt_filter cpu_csc = NULL; #else mlt_filter cpu_csc = create_filter( profile, "avcolor_space" ); #endif if ( !cpu_csc ) cpu_csc = create_filter( profile, "imageconvert" ); if ( cpu_csc ) mlt_properties_set_data( MLT_FILTER_PROPERTIES( filter ), "cpu_csc", cpu_csc, 0, (mlt_destructor) mlt_filter_close, NULL ); filter->process = process; } return filter; }
mlt_filter filter_detect_init(mlt_profile profile, mlt_service_type type, const char *id, char *arg) { mlt_filter filter = NULL; if ((filter = mlt_filter_new())) { filter->process = process_filter; mlt_properties properties = MLT_FILTER_PROPERTIES(filter); //properties for stabilize mlt_properties_set(properties, "shakiness", "4"); mlt_properties_set(properties, "accuracy", "4"); mlt_properties_set(properties, "stepsize", "6"); mlt_properties_set(properties, "algo", "1"); mlt_properties_set(properties, "mincontrast", "0.3"); mlt_properties_set(properties, "show", "0"); mlt_properties_set(properties, "tripod", "0"); // properties for transform mlt_properties_set(properties, "smoothing", "15"); mlt_properties_set(properties, "maxshift", "-1"); mlt_properties_set(properties, "maxangle", "-1"); mlt_properties_set(properties, "crop", "0"); mlt_properties_set(properties, "invert", "0"); mlt_properties_set(properties, "relative", "1"); mlt_properties_set(properties, "zoom", "0"); mlt_properties_set(properties, "optzoom", "1"); mlt_properties_set(properties, "zoomspeed", "0.25"); mlt_properties_set(properties, "vid.stab.version", LIBVIDSTAB_VERSION); return filter; } return NULL; }