예제 #1
0
/**
 * Gives the previous actor plugin based on the name of a plugin but skips
 * GL plugins.
 *
 * @see visual_actor_get_next_by_name_nogl
 *
 * @param name The name of the current plugin or NULL to get the last.
 *
 * @return The name of the previous plugin within the list that is not a GL plugin.
 */
const char *visual_actor_get_prev_by_name_nogl (const char *name)
{
	const char *prev = name;
	VisPluginData *plugin;
	VisPluginRef *ref;
	VisActorPlugin *actplugin;
	int gl;

	do {
		prev = visual_plugin_get_prev_by_name (visual_actor_get_list (), prev);

		if (prev == NULL)
			return NULL;
		
		ref = visual_plugin_find (__lv_plugins_actor, prev);
		plugin = visual_plugin_load (ref);
		actplugin = VISUAL_ACTOR_PLUGIN (plugin->info->plugin);

		if ((actplugin->vidoptions.depth & VISUAL_VIDEO_DEPTH_GL) > 0)
			gl = TRUE;
		else
			gl = FALSE;
	
		visual_plugin_unload (plugin);

	} while (gl == TRUE);

	return prev;
}
예제 #2
0
/**
 * Checks if the actor plugin is in the registry, based on it's name.
 *
 * @param name The name of the plugin that needs to be checked.
 *
 * @return TRUE if found, else FALSE.
 */
int visual_actor_valid_by_name (const char *name)
{
	if (visual_plugin_find (__lv_plugins_actor, name) == NULL)
		return FALSE;
	else
		return TRUE;
}
예제 #3
0
/**
 * Initializes a VisActor, this will set the allocated flag for the object to FALSE. Should not
 * be used to reset a VisActor, or on a VisActor created by visual_actor_new().
 *
 * @see visual_actor_new
 *
 * @param actor Pointer to the VisActor that is initialized.
 * @param actorname
 *	The name of the plugin to load, or NULL to simply initialize a new actor.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_ACTOR_NULL or -VISUAL_ERROR_PLUGIN_NO_LIST on failure.
 */
int visual_actor_init (VisActor *actor, const char *actorname)
{
	VisPluginRef *ref;
	VisPluginEnviron *enve;
	VisActorPluginEnviron *actenviron;

	visual_log_return_val_if_fail (actor != NULL, -VISUAL_ERROR_ACTOR_NULL);

	if (__lv_plugins_actor == NULL && actorname != NULL) {
		visual_log (VISUAL_LOG_CRITICAL, _("the plugin list is NULL"));

		return -VISUAL_ERROR_PLUGIN_NO_LIST;
	}

	/* Do the VisObject initialization */
	visual_object_clear (VISUAL_OBJECT (actor));
	visual_object_set_dtor (VISUAL_OBJECT (actor), actor_dtor);
	visual_object_set_allocated (VISUAL_OBJECT (actor), FALSE);

	/* Reset the VisActor data */
	actor->plugin = NULL;
	actor->video = NULL;
	actor->transform = NULL;
	actor->fitting = NULL;
	actor->ditherpal = NULL;

	visual_mem_set (&actor->songcompare, 0, sizeof (VisSongInfo));

	if (actorname == NULL)
		return VISUAL_OK;

	ref = visual_plugin_find (__lv_plugins_actor, actorname);

	actor->plugin = visual_plugin_load (ref);

	/* Adding the VisActorPluginEnviron */
	actenviron = visual_mem_new0 (VisActorPluginEnviron, 1);

	visual_object_initialize (VISUAL_OBJECT (actenviron), TRUE, NULL);

	enve = visual_plugin_environ_new (VISUAL_ACTOR_PLUGIN_ENVIRON, VISUAL_OBJECT (actenviron));
	visual_plugin_environ_add (actor->plugin, enve);

	return VISUAL_OK;
}
예제 #4
0
/* Internal functions */
int pipeline_from_preset (LVAVSPipelineContainer *container, LVAVSPresetContainer *presetcont)
{
    VisListEntry *le = NULL;
    LVAVSPresetElement *pelem;
    LVAVSPipelineElement *element;
    LVAVSPipelineContainer *cont;
    VisPluginRef *ref;
    LVAVSPipeline *pipeline = LVAVS_PIPELINE_ELEMENT(container)->pipeline; 

    while ((pelem = visual_list_next (presetcont->members, &le)) != NULL) {

        switch (pelem->type) {
            case LVAVS_PRESET_ELEMENT_TYPE_PLUGIN:
                ref = visual_plugin_find (visual_plugin_get_registry (), pelem->element_name);

                if (ref == NULL) {
                    visual_log (VISUAL_LOG_CRITICAL, "Requested plugin %s not in registry", pelem->element_name);

                    break;
                }

                if (ref->info == NULL) {
                    visual_log (VISUAL_LOG_CRITICAL, "Could not get VisPluginInfo for %s", pelem->element_name);

                    break;
                }

                /* FIXME fix libvisual type lookup and use the functions here */
                if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_ACTOR) == 0) {

                    element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR);
                    element->data.actor = visual_actor_new (pelem->element_name);
                    visual_object_set_private(VISUAL_OBJECT(element->data.actor->plugin), pipeline);

                } else if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_MORPH) == 0) {

                    element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_MORPH);
                    element->data.morph = visual_morph_new (pelem->element_name);
                    visual_object_set_private(VISUAL_OBJECT(element->data.morph->plugin), pipeline);

                } else if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_TRANSFORM) == 0) {

                    element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM);
                    element->data.transform = visual_transform_new (pelem->element_name);
                    visual_object_set_private(VISUAL_OBJECT(element->data.transform->plugin), pipeline);

                } else {
                    printf("uknown type '%s' '%s'\n", ref->info->type, ref->info->name);
                }

                if (pelem->pcont != NULL) {
                    element->params = visual_param_container_new ();
                    visual_param_container_copy (element->params, pelem->pcont);
                }

                element->pipeline = LVAVS_PIPELINE_ELEMENT (container)->pipeline;

                visual_list_add (container->members, element);

                break;

            case LVAVS_PRESET_ELEMENT_TYPE_CONTAINER:
                cont = lvavs_pipeline_container_new ();

        LVAVS_PIPELINE_ELEMENT(cont)->params = LVAVS_PIPELINE_ELEMENT(container)->params;
        LVAVS_PIPELINE_ELEMENT(cont)->pipeline = LVAVS_PIPELINE_ELEMENT(container)->pipeline;

                visual_list_add (container->members, cont);

                pipeline_from_preset (cont, LVAVS_PRESET_CONTAINER (pelem));
                break;

            case LVAVS_PRESET_ELEMENT_TYPE_RENDERSTATE:

                break;

            case LVAVS_PRESET_ELEMENT_TYPE_COMMENT:

                break;

            case LVAVS_PRESET_ELEMENT_TYPE_BPM:

                break;

            case LVAVS_PRESET_ELEMENT_TYPE_STACK:

                break;
            
            default:
                visual_log (VISUAL_LOG_CRITICAL, "Invalid LVAVSPresetElementType in LVAVSPresetElement");

                break;
        }
    }

    return VISUAL_OK;
}
예제 #5
0
파일: bglv.c 프로젝트: Jheengut/gmerlin
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;
  }