Esempio n. 1
0
static int act_gdkpixbuf_load_file (PixbufPrivate *priv, const char *filename)
{
	visual_log (VISUAL_LOG_INFO, "Loading image from '%s'", filename);

	if (priv->source) {
		g_object_unref (priv->source);
		priv->source = NULL;
	}

	if (priv->target) {
		visual_video_unref (priv->target);
		priv->target = NULL;
	}

	visual_mem_free (priv->filename);
	priv->filename = visual_strdup (filename);

	priv->source = gdk_pixbuf_new_from_file (filename, NULL);
	if (!priv->source) {
		visual_log (VISUAL_LOG_ERROR, "Failed to load image from file '%s'", filename);
		return FALSE;
	}

	act_gdkpixbuf_update_image (priv);

	return TRUE;
}
Esempio n. 2
0
  bool Actor::video_negotiate (VisVideoDepth run_depth, bool noevent, bool forced)
  {
      auto output_width  = m_impl->video->get_width ();
      auto output_height = m_impl->video->get_height ();
      auto output_depth  = m_impl->video->get_depth ();

      // Ask actor for preferred rendering dimensions

      int run_width  = output_width;
      int run_height = output_height;

      m_impl->get_actor_plugin ()->requisition (m_impl->plugin, &run_width, &run_height);

      // Check to make sure requested run depth is supported. If not, pick the highest.

      auto supported_depths = get_supported_depths ();
      m_impl->run_depth = forced ? run_depth : visual_video_depth_get_highest_nogl (supported_depths);

      if (!visual_video_depth_is_supported (supported_depths, m_impl->run_depth)) {
          m_impl->run_depth = visual_video_depth_get_highest_nogl (supported_depths);
      }

      // Configure proxy videos to convert rendering

      m_impl->to_scale.reset ();
      m_impl->to_convert.reset ();

      visual_log (VISUAL_LOG_DEBUG, "Setting up any necessary video conversions..");

      if (output_depth != VISUAL_VIDEO_DEPTH_GL) {
          // Configure any necessary depth conversion
          if (m_impl->run_depth != output_depth) {
              visual_log (VISUAL_LOG_DEBUG, "Setting up depth conversion: %s -> %s",
                          visual_video_depth_name (m_impl->run_depth),
                          visual_video_depth_name (output_depth));

              m_impl->to_convert = Video::create (output_width, output_height, m_impl->run_depth);
          }

          // Configure any necessary scaling
          if (run_width != output_width || run_height != output_height) {
              visual_log (VISUAL_LOG_DEBUG, "Setting up scaling: (%dx%d) -> (%dx%d)",
                          run_width, run_height, output_width, output_height);

              m_impl->to_scale = Video::create (run_width, run_height, output_depth);
          }
      } else {
          visual_log (VISUAL_LOG_DEBUG, "Conversions skipped in OpenGL rendering mode");
      }

      // FIXME: This should be moved into the if block above. It's out
      // here because plugins depend on this to receive information
      // about initial dimensions
      if (!noevent) {
          visual_event_queue_add (visual_plugin_get_event_queue (m_impl->plugin),
                                  visual_event_new_resize (run_width, run_height));
      }

      return true;
  }
Esempio n. 3
0
static int negotiate_video_with_unsupported_depth (VisActor *actor, int rundepth, int noevent, int forced)
{
	VisActorPlugin *actplugin = get_actor_plugin (actor);
	int depthflag = visual_actor_get_supported_depth (actor);
	
	/* Depth transform enviroment, it automaticly
	 * fits size because it can use the pitch from
	 * the dest video context */
	actor->transform = visual_video_new ();

	visual_log (VISUAL_LOG_INFO, _("run depth %d forced %d\n"), rundepth, forced);

	if (forced == TRUE)
		visual_video_set_depth (actor->transform, rundepth);
	else
		visual_video_set_depth (actor->transform,
				visual_video_depth_get_highest_nogl (depthflag));

	visual_log (VISUAL_LOG_INFO, _("transpitch1 %d depth %d bpp %d"), actor->transform->pitch, actor->transform->depth,
			actor->transform->bpp);
	/* If there is only GL (which gets returned by highest nogl if
	 * nothing else is there, stop here */
	if (actor->transform->depth == VISUAL_VIDEO_DEPTH_GL)
		return -VISUAL_ERROR_ACTOR_GL_NEGOTIATE;

	visual_video_set_dimension (actor->transform, actor->video->width, actor->video->height);
	visual_log (VISUAL_LOG_INFO, _("transpitch2 %d %d"), actor->transform->width, actor->transform->pitch);

	actplugin->requisition (visual_actor_get_plugin (actor), &actor->transform->width, &actor->transform->height);
	visual_log (VISUAL_LOG_INFO, _("transpitch3 %d"), actor->transform->pitch);

	if (noevent == FALSE) {
		visual_event_queue_add_resize (&actor->plugin->eventqueue, actor->transform,
				actor->transform->width, actor->transform->height);
		visual_plugin_events_pump (actor->plugin);
	} else {
		/* Normally a visual_video_set_dimension get's called within the
		 * event handler, but we won't come there right now so we've
		 * got to set the pitch ourself */
		visual_video_set_dimension (actor->transform,
				actor->transform->width, actor->transform->height);
	}

	visual_log (VISUAL_LOG_INFO, _("rundepth: %d transpitch %d\n"), rundepth, actor->transform->pitch);
	visual_video_allocate_buffer (actor->transform);

	if (actor->video->depth == VISUAL_VIDEO_DEPTH_8BIT)
		actor->ditherpal = visual_palette_new (256);

	return VISUAL_OK;
}
Esempio n. 4
0
int inp_alsa_upload (VisPluginData *plugin, VisAudio *audio)
{
	int16_t data[PCM_BUF_SIZE];
	alsaPrivate *priv = NULL;
	int rcnt;

	visual_return_val_if_fail(audio != NULL, -1);
	visual_return_val_if_fail(plugin != NULL, -1);
	priv = visual_object_get_private (VISUAL_OBJECT (plugin));
	visual_return_val_if_fail(priv != NULL, -1);

#if 0
	{	/* DEBUG STUFF, REMOVE IN RELEASE FIXME FIXME XXX TODO WHATEVER */
		VisBuffer buffer;

		visual_buffer_init (&buffer, data, 512, NULL);

		for (i = 0; i < 16; i++) {
			visual_audio_samplepool_input (audio->samplepool, &buffer, VISUAL_AUDIO_SAMPLE_RATE_44100,
					VISUAL_AUDIO_SAMPLE_FORMAT_S16, VISUAL_AUDIO_SAMPLE_CHANNEL_STEREO);
		}
		return 0;
	}
#endif
	do {
		rcnt = snd_pcm_readi(priv->chandle, data, PCM_BUF_SIZE / 2);

		if (rcnt > 0) {
			VisBuffer buffer;

			visual_buffer_init (&buffer, data, rcnt, NULL);

			visual_audio_samplepool_input (audio->samplepool, &buffer, VISUAL_AUDIO_SAMPLE_RATE_44100,
					VISUAL_AUDIO_SAMPLE_FORMAT_S16, VISUAL_AUDIO_SAMPLE_CHANNEL_STEREO);
		}

		if (rcnt < 0) {
			if (rcnt == -EPIPE) {
				visual_log(VISUAL_LOG_WARNING, _("ALSA: Buffer Overrun"));

				if (snd_pcm_prepare(priv->chandle) < 0) {
					visual_log(VISUAL_LOG_ERROR,
							_("Failed to prepare interface"));
					return(-1);
				}
			}
		}
	} while (rcnt > 0);

	return 0;
}
Esempio n. 5
0
static int act_jakdaw_events (VisPluginData *plugin, VisEventQueue *events)
{
	JakdawPrivate *priv = visual_object_get_private (VISUAL_OBJECT (plugin));
	VisEvent ev;
	VisParamEntry *param;

	while (visual_event_queue_poll (events, &ev)) {
		switch (ev.type) {
			case VISUAL_EVENT_RESIZE:
				act_jakdaw_resize (plugin, ev.event.resize.width, ev.event.resize.height);
				break;

			case VISUAL_EVENT_PARAM:
				param = ev.event.param.param;

				visual_log (VISUAL_LOG_DEBUG, "Param changed: %s", param->name);

				if (visual_param_entry_is (param, "zoom mode")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the zoom mode param: %d",
							param->numeric.integer);

					priv->zoom_mode = visual_param_entry_get_integer (param);

					_jakdaw_feedback_reset (priv, priv->xres, priv->yres);
				}
				else if (visual_param_entry_is (param, "plotter trigger")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the plotter trigger param: %d",
							param->numeric.integer);

					priv->plotter_colortype = visual_param_entry_get_integer (param);

				}
				else if (visual_param_entry_is (param, "plotter type")) {
					visual_log (VISUAL_LOG_DEBUG, "New value for the plotter type param: %d",
							param->numeric.integer);

					priv->plotter_scopetype = visual_param_entry_get_integer (param);

					_jakdaw_feedback_reset (priv, priv->xres, priv->yres);
				}

				break;

			default: /* to avoid warnings */
				break;
		}
	}

	return 0;
}
Esempio n. 6
0
/**
 * Initializes a VisTransform, this will set the allocated flag for the object to FALSE. Should not
 * be used to reset a VisTransform, or on a VisTransform created by visual_transform_new().
 *
 * @see visual_transform_new
 *
 * @param transform Pointer to the VisTransform that is initialized.
 * @param transformname
 *	The name of the plugin to load, or NULL to simply initialize a new transform.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_TRANSFORM_NULL or -VISUAL_ERROR_PLUGIN_NO_LIST on failure.
 */
int visual_transform_init (VisTransform *transform, const char *transformname)
{
	VisPluginRef *ref;

	visual_log_return_val_if_fail (transform != NULL, -VISUAL_ERROR_TRANSFORM_NULL);

	if (__lv_plugins_transform == NULL && transformname != 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 (transform));
	visual_object_set_dtor (VISUAL_OBJECT (transform), transform_dtor);
	visual_object_set_allocated (VISUAL_OBJECT (transform), FALSE);

	/* Reset the VisTransform data */
	transform->plugin = NULL;
	transform->video = NULL;
	transform->pal = NULL;

	if (transformname == NULL)
		return VISUAL_OK;

	ref = visual_plugin_find (__lv_plugins_transform, transformname);

	transform->plugin = visual_plugin_load (ref);

	return VISUAL_OK;
}
int visual_transform_init (VisTransform *transform, const char *transformname)
{
    visual_return_val_if_fail (transform != NULL, -VISUAL_ERROR_TRANSFORM_NULL);

    if (transformname && !LV::transform_plugin_get_list ().empty ()) {
        visual_log (VISUAL_LOG_ERROR, _("the plugin list is NULL"));
        return -VISUAL_ERROR_PLUGIN_NO_LIST;
    }

    /* Do the VisObject initialization */
    visual_object_clear (VISUAL_OBJECT (transform));
    visual_object_set_dtor (VISUAL_OBJECT (transform), transform_dtor);
    visual_object_set_allocated (VISUAL_OBJECT (transform), FALSE);

    /* Reset the VisTransform data */
    transform->plugin = NULL;
    transform->video = NULL;
    transform->pal = NULL;

    if (transformname == NULL)
        return VISUAL_OK;

    if (!LV::PluginRegistry::instance()->has_plugin (VISUAL_PLUGIN_TYPE_TRANSFORM, transformname)) {
        return -VISUAL_ERROR_PLUGIN_NOT_FOUND;
    }

    transform->plugin = visual_plugin_load (VISUAL_PLUGIN_TYPE_TRANSFORM, transformname);

    return VISUAL_OK;
}
  PluginRegistry::PluginRegistry ()
      : m_impl (new Impl)
  {
      visual_log (VISUAL_LOG_DEBUG, "Initializing plugin registry");

      // Add the standard plugin paths
      add_path (VISUAL_PLUGIN_PATH "/actor");
      add_path (VISUAL_PLUGIN_PATH "/input");
      add_path (VISUAL_PLUGIN_PATH "/morph");
      add_path (VISUAL_PLUGIN_PATH "/transform");

#if !defined(VISUAL_OS_WIN32) || defined(VISUAL_WITH_CYGWIN)
      // Add homedirectory plugin paths
      char const* home_env = std::getenv ("HOME");

      if (home_env) {
          std::string home_dir (home_env);

          add_path (home_dir + "/.libvisual/actor");
          add_path (home_dir + "/.libvisual/input");
          add_path (home_dir + "/.libvisual/morph");
          add_path (home_dir + "/.libvisual/transform");
      }
#endif
  }
Esempio n. 9
0
int visual_video_set_buffer (VisVideo *video, void *buffer)
{
	visual_return_val_if_fail (video != NULL, -VISUAL_ERROR_VIDEO_NULL);

	if (visual_buffer_get_allocated (video->buffer)) {
		visual_log (VISUAL_LOG_ERROR, _("Trying to set a screen buffer on "
				"a VisVideo structure which points to an allocated screen buffer"));

		return -VISUAL_ERROR_VIDEO_HAS_ALLOCATED;
	}

	visual_buffer_set_data (video->buffer, buffer);
	visual_buffer_set_destroyer (video->buffer, NULL);

	if (video->pixel_rows != NULL) {
		visual_mem_free (video->pixel_rows);

		video->pixel_rows = NULL;
	}

	if (visual_buffer_get_data (video->buffer) != NULL) {
		video->pixel_rows = visual_mem_new0 (void *, video->height);

		precompute_row_table (video);
	}
Esempio n. 10
0
int visual_video_allocate_buffer (VisVideo *video)
{
	visual_return_val_if_fail (video != NULL, -VISUAL_ERROR_VIDEO_NULL);
	visual_return_val_if_fail (video->buffer != NULL, -VISUAL_ERROR_VIDEO_BUFFER_NULL);

	if (visual_video_get_pixels (video) != NULL) {
		if (visual_buffer_get_allocated (video->buffer)) {
			visual_video_free_buffer (video);
		} else {
			visual_log (VISUAL_LOG_ERROR, _("Trying to allocate an screen buffer on "
					"a VisVideo structure which points to an external screen buffer"));

			return -VISUAL_ERROR_VIDEO_HAS_PIXELS;
		}
	}

	if (visual_video_get_size (video) == 0) {
		visual_buffer_set_data (video->buffer, NULL);

		return VISUAL_OK;
	}

	visual_buffer_set_destroyer (video->buffer, visual_buffer_destroyer_free);
	visual_buffer_set_size (video->buffer, visual_video_get_size (video));
	visual_buffer_allocate_data (video->buffer);

	video->pixel_rows = visual_mem_new0 (void *, video->height);
	precompute_row_table (video);

	return VISUAL_OK;
}
Esempio n. 11
0
/**
 * Gives a pointer to the palette within the VisActor. This can be needed to set a palette on the target
 * display when it's in index mode.
 *
 * @see VisPalette
 *
 * @param actor Pointer to a VisActor of which the palette is needed.
 *
 * @return Pointer to the palette structure on succes or NULL on failure. Also it's possible that NULL
 * is returned when the plugin is running in a full color mode or openGL. The returned palette is
 * read only.
 */
VisPalette *visual_actor_get_palette (VisActor *actor)
{
	VisActorPlugin *actplugin;

	visual_log_return_val_if_fail (actor != NULL, NULL);

	actplugin = get_actor_plugin (actor);

	if (actplugin == NULL) {
		visual_log (VISUAL_LOG_CRITICAL,
			_("The given actor does not reference any actor plugin"));
		return NULL;
	}

	if (actor->transform != NULL &&
		actor->video->depth == VISUAL_VIDEO_DEPTH_8BIT) {

		return actor->ditherpal;

	} else {
		return actplugin->palette (visual_actor_get_plugin (actor));
	}

	return NULL;
}
Esempio n. 12
0
/**
 * cleanup plugin (release resources)
 *
 * @param plugin plugin to be cleaned up.
 *
 * @return 0 on success.
 */
static int inp_mplayer_cleanup( VisPluginData *plugin )
{
	int unclean = 0;
	mplayer_priv_t *priv = NULL;

	visual_return_val_if_fail( plugin != NULL, -1 );
	priv = visual_object_get_private (VISUAL_OBJECT (plugin));
	visual_return_val_if_fail( priv != NULL, -1 );

	if ( priv->loaded == 1 )
	{
		void *mmap_area  = (void*)priv->mmap_area;
		int   mmap_count = priv->mmap_area->bs + sizeof( mplayer_data_t );

		if ( priv->fd > 0 )
		{
			if ( close( priv->fd ) != 0 )
			{
				visual_log( VISUAL_LOG_CRITICAL,
						_("Could not close file descriptor %d: %s"),
						priv->fd, strerror( errno ) );
				unclean |= 1;
			}
			priv->fd = -1;
		}
		else
		{
			visual_log( VISUAL_LOG_CRITICAL, _("Wrong file descriptor %d"),
					priv->fd );
			unclean |= 2;
		}

		if ( munmap( mmap_area, mmap_count ) != 0 )
		{
			visual_log( VISUAL_LOG_CRITICAL,
					_("Could not munmap() area %p+%d. %s"),
					mmap_area, mmap_count,
					strerror( errno ) );
			unclean |= 4;
		}
	}

	visual_mem_free( priv->sharedfile );
	visual_mem_free( priv );

	return - unclean;
}
Esempio n. 13
0
int visual_morph_run (VisMorph *morph, VisAudio *audio, VisVideo *src1, VisVideo *src2)
{
    VisMorphPlugin *morphplugin;

    visual_return_val_if_fail (morph != NULL, -VISUAL_ERROR_MORPH_NULL);
    visual_return_val_if_fail (audio != NULL, -VISUAL_ERROR_AUDIO_NULL);
    visual_return_val_if_fail (src1 != NULL, -VISUAL_ERROR_VIDEO_NULL);
    visual_return_val_if_fail (src2 != NULL, -VISUAL_ERROR_VIDEO_NULL);

    morphplugin = get_morph_plugin (morph);

    if (morphplugin == NULL) {
        visual_log (VISUAL_LOG_ERROR,
            _("The given morph does not reference any plugin"));

        return -VISUAL_ERROR_MORPH_PLUGIN_NULL;
    }

    /* If we're morphing using the timer, start the timer. */
    if (!visual_timer_is_active (morph->timer))
        visual_timer_start (morph->timer);

    if (morphplugin->palette != NULL)
        morphplugin->palette (morph->plugin, morph->rate, audio, morph->morphpal, src1, src2);
    else {
        if (src1->pal != NULL && src2->pal != NULL)
            visual_palette_blend (morph->morphpal, src1->pal, src2->pal, morph->rate);
    }

    morphplugin->apply (morph->plugin, morph->rate, audio, morph->dest, src1, src2);

    visual_video_set_palette (morph->dest, visual_morph_get_palette (morph));

    /* On automatic morphing increase the rate. */
    if (morph->mode == VISUAL_MORPH_MODE_STEPS) {
        morph->rate += (1.000 / morph->steps);
        morph->stepsdone++;

        if (morph->rate > 1.0)
            morph->rate = 1;

    } else if (morph->mode == VISUAL_MORPH_MODE_TIME) {
        /**
         * @todo: We might want to have a bigger type here, but long longs aren't atomic
         * on most architectures, so that won't do for now, maybe when we can lock (for threading)
         * we can look into that
         */
        double usec_elapsed = visual_timer_elapsed_usecs (morph->timer);
        double usec_morph = visual_time_to_usecs (morph->morphtime);

        morph->rate = usec_elapsed / usec_morph;

        if (morph->rate > 1.0)
            morph->rate = 1;
    }


    return VISUAL_OK;
}
Esempio n. 14
0
/**
 * Get the float parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the float parameter is requested.
 *
 * @return The float parameter from the VisParamEntry.
 */
float visual_param_entry_get_float (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, 0);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_FLOAT)
		visual_log (VISUAL_LOG_WARNING, _("Requesting float from a non float param"));

	return param->numeric.floating;
}
Esempio n. 15
0
/**
 * Get the double parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the double parameter is requested.
 *
 * @return The double parameter from the VisParamEntry.
 */
double visual_param_entry_get_double (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, 0);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_DOUBLE)
		visual_log (VISUAL_LOG_WARNING, _("Requesting double from a non double param"));

	return param->numeric.doubleflt;
}
Esempio n. 16
0
  void System::init (int& argc, char**& argv)
  {
      if (m_instance) {
          visual_log (VISUAL_LOG_WARNING, "Attempt to initialize LV a second time");
          return;
      }

      m_instance = new System (argc, argv);
  }
Esempio n. 17
0
/**
 * Get the integer parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the integer parameter is requested.
 *
 * @return The integer parameter from the VisParamEntry.
 */
int visual_param_entry_get_integer (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, 0);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_INTEGER)
		visual_log (VISUAL_LOG_WARNING, _("Requesting integer from a non integer param"));

	return param->numeric.integer;
}
  PluginRef* load_plugin_ref (std::string const& plugin_path)
  {
      // NOTE: This does not check if a plugin has already been loaded

      try {
          ModulePtr module = Module::load (plugin_path);

          int* plugin_version = static_cast<int*> (module->get_symbol (VISUAL_PLUGIN_VERSION_TAG));

          if (!plugin_version || *plugin_version != VISUAL_PLUGIN_API_VERSION) {
              visual_log (VISUAL_LOG_ERROR, _("Plugin %s is not compatible with version %s of libvisual"),
                          plugin_path.c_str (), visual_get_version ());
              return NULL;
          }

          VisPluginGetInfoFunc get_plugin_info =
              reinterpret_cast<VisPluginGetInfoFunc> (module->get_symbol ("get_plugin_info"));

          if (!get_plugin_info) {
              visual_log (VISUAL_LOG_ERROR, _("Cannot get function that returns plugin info"));
              return NULL;
          }

          VisPluginInfo const* plugin_info = get_plugin_info ();

          if (!plugin_info) {
              visual_log (VISUAL_LOG_ERROR, _("Cannot get plugin info"));
              return NULL;
          }

          PluginRef* ref = new PluginRef;

          ref->info   = plugin_info;
          ref->file   = plugin_path;
          ref->module = module;

          return ref;
      }
      catch (LV::Error& error) {
          visual_log (VISUAL_LOG_ERROR, "Cannot load plugin (%s): %s", plugin_path.c_str (), error.what());
          return NULL;
      }
  }
Esempio n. 19
0
 ModulePtr Module::load (std::string const& path)
 {
     try {
         return {new Module {path}, false};
     }
     catch (std::exception& error) {
         visual_log (VISUAL_LOG_ERROR, "%s", error.what ());
         return nullptr;
     }
 }
Esempio n. 20
0
 ActorPtr Actor::load (std::string const& name)
 {
     try {
         return {new Actor (name), false};
     }
     catch (std::exception& error) {
         visual_log (VISUAL_LOG_ERROR, "%s", error.what ());
         return nullptr;
     }
 }
Esempio n. 21
0
/**
 * Copies the value of the src param into the param. Also sets the param to the type of which the
 * source param is.
 *
 * @param param Pointer to the VisParamEntry to which a parameter is set.
 * @param src Pointer to the VisParamEntry from which the value is retrieved.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL, -VISUAL_ERROR_PARAM_INVALID_TYPE on failure.
 */
int visual_param_entry_set_from_param (VisParamEntry *param, VisParamEntry *src)
{
	visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL);
	visual_log_return_val_if_fail (src != NULL, -VISUAL_ERROR_PARAM_NULL);

	switch (src->type) {
		case VISUAL_PARAM_ENTRY_TYPE_NULL:

			break;

		case VISUAL_PARAM_ENTRY_TYPE_STRING:
			visual_param_entry_set_string (param, visual_param_entry_get_string (src));
			break;

		case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
			visual_param_entry_set_integer (param, visual_param_entry_get_integer (src));
			
			break;

		case VISUAL_PARAM_ENTRY_TYPE_FLOAT:
			visual_param_entry_set_float (param, visual_param_entry_get_float (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_DOUBLE:
			visual_param_entry_set_double (param, visual_param_entry_get_double (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_COLOR:
			visual_param_entry_set_color_by_color (param, visual_param_entry_get_color (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_PALETTE:
			visual_param_entry_set_palette (param, visual_param_entry_get_palette (src));

			break;

		case VISUAL_PARAM_ENTRY_TYPE_OBJECT:
			visual_param_entry_set_object (param, visual_param_entry_get_object (src));

			break;
		
		default:
			visual_log (VISUAL_LOG_CRITICAL, _("param type is not valid"));

			return -VISUAL_ERROR_PARAM_INVALID_TYPE;

			break;
	}
	
	return VISUAL_OK;
}
Esempio n. 22
0
MorphPtr Morph::load (std::string const& name)
{
    try {
        return {new Morph {name}, false};
    }
    catch (std::exception& error)
    {
        visual_log (VISUAL_LOG_ERROR, "%s", error.what ());
        return nullptr;
    }
}
Esempio n. 23
0
static int log_and_exit (int error)
{
	visual_log (VISUAL_LOG_CRITICAL, "Aborting due to error: %s",
		visual_error_to_string (error));

#if !defined(VISUAL_OS_WIN32)
	raise (SIGTRAP);
#endif

	exit (EXIT_FAILURE);
}
Esempio n. 24
0
/**
 * Get the string parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the string parameter is requested.
 *
 * @return The string parameter from the VisParamEntry or NULL.
 */
char *visual_param_entry_get_string (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, NULL);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_STRING) {
		visual_log (VISUAL_LOG_WARNING, _("Requesting string from a non string param"));

		return NULL;
	}

	return param->string;
}
Esempio n. 25
0
/**
 * Get the object parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the object parameter is requested.
 *
 * @return Pointer to the VisObject parameter from the VisParamEntry.
 */
VisObject *visual_param_entry_get_object (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, NULL);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_OBJECT) {
		visual_log (VISUAL_LOG_WARNING, _("Requested object from a non object param\n"));

		return NULL;
	}

	return param->objdata;
}
Esempio n. 26
0
/**
 * Get the palette parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the palette parameter is requested.
 *
 * @return Pointer to the VisPalette parameter from the VisParamEntry. The returned VisPalette
 *	should be exclusively used as read only.
 */
VisPalette *visual_param_entry_get_palette (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, NULL);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_PALETTE) {
		visual_log (VISUAL_LOG_WARNING, _("Requested palette from a non palette param\n"));

		return NULL;
	}

	return &param->pal;
}
Esempio n. 27
0
/**
 * Get the color parameter from a VisParamEntry.
 *
 * @param param Pointer to the VisParamEntry from which the color parameter is requested.
 *
 * @return Pointer to the VisColor parameter from the VisParamEntry. It's adviced to
 *	use the VisColor that is returned as read only seen changing it directly won't emit events and
 *	can cause synchronous problems between the plugin and the parameter system. Instead use the
 *	visual_param_entry_set_color* methods to change the parameter value.
 */
VisColor *visual_param_entry_get_color (VisParamEntry *param)
{
	visual_log_return_val_if_fail (param != NULL, NULL);

	if (param->type != VISUAL_PARAM_ENTRY_TYPE_COLOR) {
		visual_log (VISUAL_LOG_WARNING, _("Requesting color from a non color param"));

		return NULL;
	}

	return &param->color;
}
Esempio n. 28
0
/**
 * Quits libvisual, destroys all the plugin registries.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_LIBVISUAL_NOT_INITIALIZED on failure.
 */
int visual_quit ()
{
	int ret;

	if (__lv_initialized == FALSE) {
                visual_log (VISUAL_LOG_WARNING, _("Never initialized"));

		return -VISUAL_ERROR_LIBVISUAL_NOT_INITIALIZED;
	}

	if (visual_fourier_is_initialized () == TRUE)
		visual_fourier_deinitialize ();

	ret = visual_object_unref (VISUAL_OBJECT (__lv_plugins));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Plugins references list: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_plugins_actor));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Actor plugins list: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_plugins_input));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Input plugins list: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_plugins_morph));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Morph plugins list: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_plugins_transform));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Transform plugins list: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_paramcontainer));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Global param container: destroy failed: %s"), visual_error_to_string (ret));

	ret = visual_object_unref (VISUAL_OBJECT (__lv_userinterface));
	if (ret < 0)
		visual_log (VISUAL_LOG_WARNING, _("Error during UI destroy: %s"), visual_error_to_string (ret));

        if (__lv_progname != NULL) {
                visual_mem_free (__lv_progname);

		__lv_progname = NULL;
	}

	__lv_initialized = FALSE;
	return VISUAL_OK;
}
Esempio n. 29
0
int pipeline_container_realize (LVAVSPipelineContainer *container)
{
    VisListEntry *le = NULL;
    LVAVSPipelineElement *element;

    while ((element = visual_list_next (container->members, &le)) != NULL) {

        switch (element->type) {
            case LVAVS_PIPELINE_ELEMENT_TYPE_NULL:

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR:

                visual_actor_realize (element->data.actor);
                visual_param_container_copy_match (visual_plugin_get_params (
                            visual_actor_get_plugin (element->data.actor)), element->params);

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM:

                visual_transform_realize (element->data.transform);
                visual_param_container_copy_match (visual_plugin_get_params (
                            visual_transform_get_plugin (element->data.transform)), element->params);

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_MORPH:

                visual_morph_realize (element->data.morph);

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_RENDERSTATE:

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_CONTAINER:

                pipeline_container_realize (LVAVS_PIPELINE_CONTAINER (element));

                break;

            default:
                visual_log (VISUAL_LOG_CRITICAL, "Invalid LVAVSPipelineElementType");

                break;
        }
    }
    return 0;
}
Esempio n. 30
0
  Module::Module (std::string const& path)
      : m_impl (new Impl)
      , m_ref_count (1)
  {
      visual_log (VISUAL_LOG_DEBUG, "Loading DLL: %s", path.c_str ());

      m_impl->handle = LoadLibrary (path.c_str ());
      m_impl->path = path;

      if (!m_impl->handle) {
          std::ostringstream msg;
          msg << "Failed to load shared object (" << path << "): Win32 error code #" << GetLastError ();
          throw std::runtime_error {msg.str ()};
      }
  }