livido_init_f init_instance( livido_port_t *my_instance ) { int w = 0, h = 0; lvd_extract_dimensions( my_instance, "out_channels", &w, &h ); int video_area = w * h * 3; displaywall_t *entry = (displaywall_t*) livido_malloc(sizeof(displaywall_t)); livido_memset( entry, 0, sizeof(displaywall_t)); entry->vecx = (int *)livido_malloc(sizeof(int) * video_area); entry->vecy = (int *)livido_malloc(sizeof(int) * video_area); if(entry->vecx == NULL || entry->vecy == NULL) { free(entry); return NULL; } entry->scale = 3; entry->dx = 0; entry->dy = 0; entry->speed = 10; entry->cx = w / 2; entry->cy = h / 2; displaywall_initVec(entry, w, h); livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1, &entry); return LIVIDO_NO_ERROR; }
LIVIDO_PLUGIN #include "utils.h" #include "livido-utils.c" #include "lvd_common.h" #include "lvdgmicglue.h" livido_init_f init_instance( livido_port_t *my_instance ) { Clvdgmic *gmic = lvdgmic_new(1); livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1,&gmic ); return LIVIDO_NO_ERROR; }
livido_init_f init_instance( livido_port_t *my_instance ) { starfield_t *starfield = (starfield_t*) livido_malloc( sizeof(starfield_t)); starfield->stars = (STAR**) livido_malloc(sizeof(STAR*) * MAX_STARS ); int i; for( i = 0; i < MAX_STARS ; i ++ ) { starfield->stars[i] = (STAR*) livido_malloc( sizeof(STAR) ); init_star( starfield->stars[i], i + 1 , 2 ); } livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1, &starfield); return LIVIDO_NO_ERROR; }
livido_init_f init_instance( livido_port_t *my_instance ) { int width = 0, height = 0; lvd_extract_dimensions( my_instance, "out_channels", &width, &height ); scale0tilt_instance_t* inst = (scale0tilt_instance_t*)livido_malloc(sizeof(scale0tilt_instance_t)); livido_memset( inst, 0, sizeof(scale0tilt_instance_t) ); inst->w = width; inst->h = height; inst->sx = 1.0; inst->sy = 1.0; inst->format_src.frame_width = inst->w; inst->format_src.frame_height = inst->h; inst->format_src.image_width = inst->w; inst->format_src.image_height = inst->h; inst->format_src.pixel_width = 1; inst->format_src.pixel_height = 1; inst->format_src.pixelformat = GAVL_YUVJ_444_P; inst->video_scaler = gavl_video_scaler_create(); inst->frame_src = gavl_video_frame_create( NULL ); inst->frame_dst = gavl_video_frame_create( NULL ); inst->frame_src->strides[0] = width; inst->frame_src->strides[1] = width; inst->frame_src->strides[2] = width; inst->frame_dst->strides[0] = width; inst->frame_dst->strides[1] = width; inst->frame_dst->strides[2] = width; update_scaler(inst); inst->temp = gavl_video_frame_create( &(inst->format_src) ); inst->temp_alpha = gavl_video_frame_create( &(inst->format_src) ); livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1, &inst); return LIVIDO_NO_ERROR; }
livido_init_f init_instance( livido_port_t *my_instance ) { int w = 0, h = 0; lvd_extract_dimensions( my_instance, "out_channels", &w, &h ); lvd_crop_t *c = (lvd_crop_t*) livido_malloc( sizeof(lvd_crop_t)); livido_memset(c,0,sizeof(lvd_crop_t)); c->buf[0] = (uint8_t*) livido_malloc( sizeof(uint8_t) * RUP8(w * h * 4)); c->buf[1] = c->buf[0] + RUP8(w*h); c->buf[2] = c->buf[1] + RUP8(w*h); c->flags = SWS_FAST_BILINEAR; c->w = -1; c->h = -1; livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR,1, &c); return LIVIDO_NO_ERROR; }
livido_deinit_f deinit_instance( livido_port_t *my_instance ) { lvd_crop_t *crop = NULL; livido_property_get( my_instance, "PLUGIN_private", 0, &crop ); if( crop ) { if( crop->buf[0] ) { free(crop->buf[0]); } if( crop->sws ) { sws_freeContext( crop->sws ); } free(crop); crop = NULL; } livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR, 0, NULL ); return LIVIDO_NO_ERROR; }
livido_deinit_f deinit_instance( livido_port_t *my_instance ) { scale0tilt_instance_t *inst = NULL; livido_property_get( my_instance, "PLUGIN_private", 0, &inst ); gavl_video_scaler_destroy(inst->video_scaler); gavl_video_frame_null( inst->frame_src ); gavl_video_frame_destroy( inst->frame_src ); gavl_video_frame_null( inst->frame_dst ); gavl_video_frame_destroy( inst->frame_dst ); gavl_video_frame_null( inst->temp ); gavl_video_frame_destroy( inst->temp ); gavl_video_frame_null( inst->temp_alpha ); gavl_video_frame_destroy( inst->temp_alpha ); free(inst); livido_property_set( my_instance, "PLUGIN_private", LIVIDO_ATOM_TYPE_VOIDPTR, 0, NULL ); return LIVIDO_NO_ERROR; }