Exemple #1
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;
  }
int visual_transform_video_negotiate (VisTransform *transform)
{
    int depthflag;

    visual_return_val_if_fail (transform != NULL, -VISUAL_ERROR_TRANSFORM_NULL);
    visual_return_val_if_fail (transform->plugin != NULL, -VISUAL_ERROR_PLUGIN_NULL);

    depthflag = visual_transform_get_supported_depth (transform);

    if (!visual_video_depth_is_supported (depthflag, transform->video->depth))
        return -VISUAL_ERROR_TRANSFORM_NEGOTIATE;

    visual_event_queue_add (transform->plugin->eventqueue,
                            visual_event_new_resize (transform->video->width,
                                                     transform->video->height));

    visual_plugin_events_pump (transform->plugin);

    return -VISUAL_OK;
}