int main (int argc, char **argv) { float rate = 0.0; VisMorph *morph; VisAudio audio; VisVideo *dest, *src1, *src2; int i; visual_init (&argc, &argv); if (argc < 2) morph = visual_morph_new ("alphablend"); else morph = visual_morph_new (argv[1]); visual_morph_realize (morph); dest = visual_video_new (); visual_video_set_depth (dest, DEPTH); visual_video_set_dimension (dest, 640, 400); visual_video_allocate_buffer (dest); src1 = visual_video_new (); src2 = visual_video_new (); visual_video_copy_attrs (src1, dest); visual_video_copy_attrs (src2, dest); visual_video_allocate_buffer (src1); visual_video_allocate_buffer (src2); visual_morph_set_video (morph, dest); for (i = 0; i < TIMES; i++) { visual_morph_set_rate (morph, rate); visual_morph_run (morph, &audio, src1, src2); rate += 0.1; if (rate > 1.0) rate = 0.0; } printf ("Morph throughput bench %d times depthBPP %d morph: %s\n", TIMES, dest->bpp, (visual_plugin_get_info (visual_morph_get_plugin (morph)))->plugname); return EXIT_SUCCESS; }
VisMorphPlugin* Morph::Impl::get_morph_plugin () const { return static_cast<VisMorphPlugin*> (visual_plugin_get_info (plugin)->plugin); }
VisActorPlugin* Actor::Impl::get_actor_plugin () const { return static_cast<VisActorPlugin*> (visual_plugin_get_info (plugin)->plugin); }
bg_plugin_info_t * bg_lv_get_info(const char * filename) { int i; VisVideoAttributeOptions *vidoptions; bg_x11_window_t * win; bg_plugin_info_t * ret; VisPluginRef * ref; VisList * list; VisActor * actor; VisPluginInfo * info; char * tmp_string; const char * actor_name = NULL; check_init(); list = visual_plugin_get_registry(); /* Find out if there is a plugin matching the filename */ while((actor_name = visual_actor_get_next_by_name(actor_name))) { ref = visual_plugin_find(list, actor_name); if(ref && !strcmp(ref->file, filename)) break; } if(!actor_name) return NULL; actor = visual_actor_new(actor_name); if(!actor) return NULL; ret = calloc(1, sizeof(*ret)); info = visual_plugin_get_info(visual_actor_get_plugin(actor)); ret->name = bg_sprintf("vis_lv_%s", actor_name); ret->long_name = gavl_strdup(info->name); ret->type = BG_PLUGIN_VISUALIZATION; ret->api = BG_PLUGIN_API_LV; ret->description = bg_sprintf(TR("libvisual plugin")); ret->module_filename = gavl_strdup(filename); /* Optional info */ if(info->author && *info->author) { tmp_string = bg_sprintf(TR("\nAuthor: %s"), info->author); ret->description = gavl_strcat(ret->description, tmp_string); free(tmp_string); } if(info->version && *info->version) { tmp_string = bg_sprintf(TR("\nVersion: %s"), info->version); ret->description = gavl_strcat(ret->description, tmp_string); free(tmp_string); } if(info->about && *info->about) { tmp_string = bg_sprintf(TR("\nAbout: %s"), info->about); ret->description = gavl_strcat(ret->description, tmp_string); free(tmp_string); } if(info->help && *info->help) { tmp_string = bg_sprintf(TR("\nHelp: %s"), info->help); ret->description = gavl_strcat(ret->description, tmp_string); free(tmp_string); } if(info->license && *info->license) { tmp_string = bg_sprintf(TR("\nLicense: %s"), info->license); ret->description = gavl_strcat(ret->description, tmp_string); free(tmp_string); } /* Check out if it's an OpenGL plugin */ if(visual_actor_get_supported_depth(actor) & VISUAL_VIDEO_DEPTH_GL) { ret->flags |= BG_PLUGIN_VISUALIZE_GL; win = bg_x11_window_create(NULL); /* Create an OpenGL context. For this, we need the OpenGL attributes */ vidoptions = visual_actor_get_video_attribute_options(actor); for(i = 0; i < VISUAL_GL_ATTRIBUTE_LAST; i++) { if((vidoptions->gl_attributes[i].mutated) && (bg_attributes[i] >= 0)) { bg_x11_window_set_gl_attribute(win, bg_attributes[i], vidoptions->gl_attributes[i].value); } } /* Set bogus dimensions, will be corrected by the size_callback */ bg_x11_window_set_size(win, 640, 480); bg_x11_window_realize(win); if(!bg_x11_window_start_gl(win)) { ret->flags |= BG_PLUGIN_UNSUPPORTED; } else bg_x11_window_set_gl(win); } else { ret->flags |= BG_PLUGIN_VISUALIZE_FRAME; win = NULL; } ret->priority = 1; /* Must realize the actor to get the parameters */ if(!(ret->flags & BG_PLUGIN_UNSUPPORTED)) { visual_actor_realize(actor); ret->parameters = create_parameters(actor, NULL, NULL); visual_object_unref(VISUAL_OBJECT(actor)); } if(win) { bg_x11_window_unset_gl(win); bg_x11_window_stop_gl(win); bg_x11_window_destroy(win); } return ret; }