コード例 #1
0
ファイル: lvavs_pipeline.c プロジェクト: Denyufka/LibVisual
static int render_now(LVAVSPipelineContainer *container, VisVideo *video, VisAudio *audio, int s)
{
    LVAVSPipeline *pipeline = LVAVS_PIPELINE_ELEMENT(container)->pipeline;

    int i;
    int count = visual_list_count(container->members);
    for(i = 0; i < count; i++) {
        LVAVSPipelineElement *element = visual_list_get(container->members, i);
        VisVideo *tmpvid;

        if(s) {
            pipeline->framebuffer = visual_video_get_pixels(pipeline->dummy_vid);
            pipeline->fbout = visual_video_get_pixels(video);
        } else {
            pipeline->fbout = visual_video_get_pixels(pipeline->dummy_vid);
            pipeline->framebuffer = visual_video_get_pixels(video);
        }

        switch (element->type) {
            case LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR:

                visual_actor_set_video (element->data.actor, video);
                visual_actor_run (element->data.actor, audio);

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM:

                visual_transform_set_video (element->data.transform, video);
                visual_transform_run (element->data.transform, audio);

                break;

            case LVAVS_PIPELINE_ELEMENT_TYPE_CONTAINER:

                pipeline_container_run (LVAVS_PIPELINE_CONTAINER (element), video, audio);

                break;

            default:

                break;
        }

        if(pipeline->swap&1) {
            s^=1;
            pipeline->swap = 0;
        }

    }

    return s;
}
コード例 #2
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  guint i, count;
  VisList *list;

  GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
      "libvisual audio visualisations");

#ifdef LIBVISUAL_PLUGINSBASEDIR
  gst_plugin_add_dependency_simple (plugin, "HOME/.libvisual/actor",
      LIBVISUAL_PLUGINSBASEDIR "/actor", NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);
#endif

  visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_LOW);
  visual_log_set_info_handler (libvisual_log_handler, (void *) GST_LEVEL_INFO);
  visual_log_set_warning_handler (libvisual_log_handler,
      (void *) GST_LEVEL_WARNING);
  visual_log_set_critical_handler (libvisual_log_handler,
      (void *) GST_LEVEL_ERROR);
  visual_log_set_error_handler (libvisual_log_handler,
      (void *) GST_LEVEL_ERROR);

  if (!visual_is_initialized ())
    if (visual_init (NULL, NULL) != 0)
      return FALSE;

  list = visual_actor_get_list ();

#if !defined(VISUAL_API_VERSION)
  count = visual_list_count (list);
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
  count = visual_collection_size (VISUAL_COLLECTION (list));
#endif

  for (i = 0; i < count; i++) {
    VisPluginRef *ref = visual_list_get (list, i);
    VisPluginData *visplugin = NULL;
    gboolean skip = FALSE;
    GType type;
    gchar *name;
    GTypeInfo info = {
      sizeof (GstVisualClass),
      NULL,
      NULL,
      gst_visual_class_init,
      NULL,
      ref,
      sizeof (GstVisual),
      0,
      NULL
    };

    visplugin = visual_plugin_load (ref);

    if (ref->info->plugname == NULL)
      continue;

    /* Blacklist some plugins */
    if (strcmp (ref->info->plugname, "gstreamer") == 0 ||
        strcmp (ref->info->plugname, "gdkpixbuf") == 0) {
      skip = TRUE;
    } else {
      /* Ignore plugins that only support GL output for now */
      skip = gst_visual_actor_plugin_is_gl (visplugin->info->plugin,
          visplugin->info->plugname);
    }

    visual_plugin_unload (visplugin);

    if (!skip) {
      name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
      make_valid_name (name);
      type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
      g_free (name);

      name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
      make_valid_name (name);
      if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
        g_free (name);
        return FALSE;
      }
      g_free (name);
    }
  }

  return TRUE;
}