コード例 #1
0
ファイル: gstvdpsink.c プロジェクト: spunktsch/svtplayer
static gboolean
gst_vdp_sink_open_device (VdpSink * vdp_sink)
{
  gboolean res;
  GstVdpDevice *device;
  GError *err;

  g_mutex_lock (vdp_sink->device_lock);
  if (vdp_sink->device) {
    res = TRUE;
    goto done;
  }

  err = NULL;
  vdp_sink->device = device = gst_vdp_get_device (vdp_sink->display_name, &err);
  if (!device)
    goto device_error;

  vdp_sink->bpool = gst_vdp_output_buffer_pool_new (device);

  vdp_sink->caps = gst_vdp_sink_get_allowed_caps (device, vdp_sink->par);
  GST_DEBUG ("runtime calculated caps: %" GST_PTR_FORMAT, vdp_sink->caps);

  /* call XSynchronize with the current value of synchronous */
  GST_DEBUG_OBJECT (vdp_sink, "XSynchronize called with %s",
      vdp_sink->synchronous ? "TRUE" : "FALSE");
  XSynchronize (device->display, vdp_sink->synchronous);

  /* Setup our event listening thread */
  vdp_sink->running = TRUE;
  vdp_sink->event_thread = g_thread_create (
      (GThreadFunc) gst_vdp_sink_event_thread, vdp_sink, TRUE, NULL);

  res = TRUE;

done:
  g_mutex_unlock (vdp_sink->device_lock);
  return res;

device_error:
  gst_vdp_sink_post_error (vdp_sink, err);
  res = FALSE;
  goto done;
}
コード例 #2
0
static GstVdpDevice *
gst_vdp_sink_setup_device (VdpSink * vdp_sink)
{
  GstVdpDevice *device;

  device = gst_vdp_get_device (vdp_sink->display_name);
  if (!device)
    return NULL;

  vdp_sink->caps = gst_vdp_sink_get_allowed_caps (device, vdp_sink->par);
  GST_DEBUG ("runtime calculated caps: %" GST_PTR_FORMAT, vdp_sink->caps);

  /* call XSynchronize with the current value of synchronous */
  GST_DEBUG_OBJECT (vdp_sink, "XSynchronize called with %s",
      vdp_sink->synchronous ? "TRUE" : "FALSE");
  XSynchronize (device->display, vdp_sink->synchronous);

  /* Setup our event listening thread */
  vdp_sink->running = TRUE;
  vdp_sink->event_thread = g_thread_create (
      (GThreadFunc) gst_vdp_sink_event_thread, vdp_sink, TRUE, NULL);

  return device;
}