当前位置: 首页>>代码示例>>C++>>正文


C++ GST_X_OVERLAY函数代码示例

本文整理汇总了C++中GST_X_OVERLAY函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_X_OVERLAY函数的具体用法?C++ GST_X_OVERLAY怎么用?C++ GST_X_OVERLAY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GST_X_OVERLAY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_bus_element_cb

static void
on_bus_element_cb (GstBus *bus, GstMessage *message,
    GbpPlayer *player)
{
  const GstStructure *structure;
  const gchar *structure_name;
  GstElement *sink;
  structure = gst_message_get_structure (message);
  if (structure == NULL)
    return;

  structure_name = gst_structure_get_name (structure);

#ifdef XP_MACOSX
  if (!strcmp (structure_name, "have-ns-view") ||
      !strcmp (structure_name, "have-ca-layer")) {
    if (player->priv->xid != 0) {
      gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_ELEMENT (message->src)),
          (gulong) player->priv->xid);
    }
    return;
  }
#endif

  if (!strcmp (structure_name, "prepare-xwindow-id")) {
    sink = GST_ELEMENT (message->src);
    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), player->priv->xid);
  }
}
开发者ID:alessandrod,项目名称:gst-browser-plugin,代码行数:29,代码来源:gbp-player.c

示例2: preview_draw_cb

G_MODULE_EXPORT gboolean
preview_draw_cb(
    GtkWidget *widget,
    cairo_t *cr,
    signal_user_data_t *ud)
{
#if defined(_ENABLE_GST)
#if GST_CHECK_VERSION(1, 0, 0)
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstVideoOverlay *vover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                vover = GST_VIDEO_OVERLAY(gst_bin_get_by_interface(
                                    GST_BIN(vsink), GST_TYPE_VIDEO_OVERLAY));
            else
                vover = GST_VIDEO_OVERLAY(vsink);
            gst_video_overlay_expose(vover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#else
    if (ud->preview->live_enabled && ud->preview->state == PREVIEW_STATE_LIVE)
    {
        if (GST_STATE(ud->preview->play) >= GST_STATE_PAUSED)
        {
            GstElement *vsink;
            GstXOverlay *xover;

            g_object_get(ud->preview->play, "video-sink", &vsink, NULL);
            if (GST_IS_BIN(vsink))
                xover = GST_X_OVERLAY(gst_bin_get_by_interface(
                                        GST_BIN(vsink), GST_TYPE_X_OVERLAY));
            else
                xover = GST_X_OVERLAY(vsink);
            gst_x_overlay_expose(xover);
            // For some reason, the exposed region doesn't always get
            // cleaned up here. But a delayed gst_x_overlay_expose()
            // takes care of it.
            g_idle_add((GSourceFunc)delayed_expose_cb, ud);
        }
        return FALSE;
    }
#endif
#endif

    if (ud->preview->pix != NULL)
    {
        _draw_pixbuf(cr, ud->preview->pix);
    }
    return FALSE;
}
开发者ID:TotalCaesar659,项目名称:HandBrake,代码行数:60,代码来源:preview.c

示例3: empathy_video_widget_draw

static gboolean
empathy_video_widget_draw (GtkWidget *widget,
    cairo_t *cr)
{
  EmpathyVideoWidget *self = EMPATHY_VIDEO_WIDGET (widget);
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);
  GtkAllocation allocation;

  if (priv->overlay == NULL)
    {
      gtk_widget_get_allocation (widget, &allocation);

      gtk_render_frame (gtk_widget_get_style_context (widget), cr,
          0, 0,
          gtk_widget_get_allocated_width (widget),
          gtk_widget_get_allocated_height (widget));
      return TRUE;
    }

  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay),
    GDK_WINDOW_XID (gtk_widget_get_window (widget)));

  gst_x_overlay_expose (GST_X_OVERLAY (priv->overlay));

  return TRUE;
}
开发者ID:sharat-dev,项目名称:empathy_sharat,代码行数:26,代码来源:empathy-video-widget.c

示例4: GST_MESSAGE_SRC

void GStreamerGWorld::setWindowOverlay(GstMessage* message)
{
    GstObject* sink = GST_MESSAGE_SRC(message);

#ifndef GST_API_VERSION_1
    if (!GST_IS_X_OVERLAY(sink))
#else
    if (!GST_IS_VIDEO_OVERLAY(sink))
#endif
        return;

    if (g_object_class_find_property(G_OBJECT_GET_CLASS(sink), "force-aspect-ratio"))
        g_object_set(sink, "force-aspect-ratio", TRUE, NULL);

    if (m_videoWindow) {
        m_videoWindow->prepareForOverlay(message);

#ifndef GST_API_VERSION_1
// gst_x_overlay_set_window_handle was introduced in -plugins-base
// 0.10.31, just like the macro for checking the version.
#ifdef GST_CHECK_PLUGINS_BASE_VERSION
        gst_x_overlay_set_window_handle(GST_X_OVERLAY(sink), m_videoWindow->videoWindowId());
#else
        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), m_videoWindow->videoWindowId());
#endif
#else
        gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), m_videoWindow->videoWindowId());
#endif
    }
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:30,代码来源:GStreamerGWorld.cpp

示例5: create_window

static GstBusSyncReply
create_window(GstBus *bus, GstMessage *msg, gpointer data)
{
    preview_t *preview = (preview_t*)data;

    switch (GST_MESSAGE_TYPE(msg))
    {
    case GST_MESSAGE_ELEMENT:
    {
#if GST_CHECK_VERSION(1, 0, 0)
        if (!gst_is_video_overlay_prepare_window_handle_message(msg))
            return GST_BUS_PASS;
        gst_video_overlay_set_window_handle(
            GST_VIDEO_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#else
        if (!gst_structure_has_name(msg->structure, "prepare-xwindow-id"))
            return GST_BUS_PASS;
#if !defined(_WIN32)
        gst_x_overlay_set_xwindow_id(
            GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#else
        gst_directdraw_sink_set_window_id(
            GST_X_OVERLAY(GST_MESSAGE_SRC(msg)), preview->xid);
#endif
#endif
        gst_message_unref(msg);
        return GST_BUS_DROP;
    } break;

    default:
    {
    } break;
    }
    return GST_BUS_PASS;
}
开发者ID:TotalCaesar659,项目名称:HandBrake,代码行数:35,代码来源:preview.c

示例6: gst_bin_get_by_interface

void
BasePlatformInterface::PrepareVideoWindow(GstMessage *aMessage)
{
  GstElement *element = NULL;
  GstXOverlay *xoverlay = NULL;

  if (GST_IS_BIN (mVideoSink)) {
    /* Get the actual implementing object from the bin */
    element = gst_bin_get_by_interface(GST_BIN (mVideoSink),
            GST_TYPE_X_OVERLAY);
  }
  else {
    element = mVideoSink;
  }

  if (GST_IS_X_OVERLAY (element)) {
    xoverlay = GST_X_OVERLAY (element);
    LOG(("xoverlay interface found, setting video window"));
  }
  else {
    LOG(("No xoverlay interface found, cannot set video window"));
    return;
  }

  SetXOverlayWindowID(xoverlay);

  ResizeToWindow();
}
开发者ID:Brijen,项目名称:nightingale-hacking,代码行数:28,代码来源:sbGStreamerPlatformBase.cpp

示例7: set_gst_sdl_video_overlay

Window
set_gst_sdl_video_overlay (GstElement *pipeline,
                           int x,
                           int y,
                           int width,
                           int height)
{
  GstElement *videosink;
  SDL_SysWMinfo sdl_info;
  Window play_win;

  sdl_info = get_sdl_wm_info ();
  if (!sdl_info.version.major)
    return 0;

  g_object_get (pipeline, "video-sink", &videosink, NULL);

  if (videosink && GST_IS_X_OVERLAY (videosink)) {
    sdl_info.info.x11.lock_func ();

    play_win = create_x11_subwindow (sdl_info.info.x11.display,
                                     sdl_info.info.x11.window,
                                     x, y, width, height);
    sdl_info.info.x11.unlock_func ();

    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), play_win);
  } else
    play_win = 0;

  g_object_unref (videosink);

  return play_win;
}
开发者ID:barbieri,项目名称:barbieri-playground,代码行数:33,代码来源:sdl-gstreamer.c

示例8: sync_bus_callback

static GstBusSyncReply
sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
{
  const GstStructure *st;
  const GValue *image;
  GstBuffer *buf = NULL;
  guint8 *data_buf = NULL;
  gchar *caps_string;
  guint size = 0;
  gchar *preview_filename = NULL;
  FILE *f = NULL;
  size_t written;

  switch (GST_MESSAGE_TYPE (message)) {
    case GST_MESSAGE_ELEMENT:{
      st = gst_message_get_structure (message);
      if (st) {
        if (gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
          if (!no_xwindow && window) {
            gst_x_overlay_set_window_handle (GST_X_OVERLAY (GST_MESSAGE_SRC
                    (message)), window);
            gst_message_unref (message);
            message = NULL;
            return GST_BUS_DROP;
          }
        } else if (gst_structure_has_name (st, "preview-image")) {
          GST_DEBUG ("preview-image");
          /* extract preview-image from msg */
          image = gst_structure_get_value (st, "buffer");
          if (image) {
            buf = gst_value_get_buffer (image);
            data_buf = GST_BUFFER_DATA (buf);
            size = GST_BUFFER_SIZE (buf);
            preview_filename = g_strdup_printf ("test_vga.rgb");
            caps_string = gst_caps_to_string (GST_BUFFER_CAPS (buf));
            g_print ("writing buffer to %s, elapsed: %.2fs, buffer caps: %s\n",
                preview_filename, g_timer_elapsed (timer, NULL), caps_string);
            g_free (caps_string);
            f = g_fopen (preview_filename, "w");
            if (f) {
              written = fwrite (data_buf, size, 1, f);
              if (!written) {
                g_print ("error writing file\n");
              }
              fclose (f);
            } else {
              g_print ("error opening file for raw image writing\n");
            }
            g_free (preview_filename);
          }
        }
      }
      break;
    }
    default:
      /* unhandled message */
      break;
  }
  return GST_BUS_PASS;
}
开发者ID:mrchapp,项目名称:gst-plugins-bad,代码行数:60,代码来源:gst-camerabin2-test.c

示例9: create_window

static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, gpointer data)
{
  GstGLClutterActor **actor = (GstGLClutterActor **) data;
  static gint count = 0;
  static GMutex *mutex = NULL;
  // ignore anything but 'prepare-xwindow-id' element messages
  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
    return GST_BUS_PASS;

  if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
    return GST_BUS_PASS;

  if (!mutex)
    mutex = g_mutex_new ();

  g_mutex_lock (mutex);

  if (count < N_ACTORS) {
    g_message ("adding actor %d", count);
    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)),
        actor[count]->win);
    clutter_threads_add_idle ((GSourceFunc) create_actor, actor[count]);
    count++;
  }

  g_mutex_unlock (mutex);

  gst_message_unref (message);
  return GST_BUS_DROP;
}
开发者ID:zsx,项目名称:ossbuild,代码行数:31,代码来源:clutteractortee.c

示例10: gst_structure_has_name

bool QGstreamerGLTextureRenderer::processSyncMessage(const QGstreamerMessage &message)
{
    GstMessage* gm = message.rawMessage();

    if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
            gst_structure_has_name(gm->structure, "prepare-xwindow-id") &&
            m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
#ifdef GL_TEXTURE_SINK_DEBUG
    qDebug() << Q_FUNC_INFO;
#endif
        GstXOverlay *overlay = GST_X_OVERLAY(m_videoSink);

        gst_x_overlay_set_xwindow_id(overlay, m_winId);

        if (!m_displayRect.isEmpty()) {
            gst_x_overlay_set_render_rectangle(overlay,
                                               m_displayRect.x(),
                                               m_displayRect.y(),
                                               m_displayRect.width(),
                                               m_displayRect.height());
        }

        GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
        m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);

        return true;
    }

    return false;
}
开发者ID:Elleo,项目名称:qtmultimedia,代码行数:30,代码来源:qgstreamergltexturerenderer.cpp

示例11: switch

void Pipeline::setResolution(Resolution value)
{
    int width, height;

    switch (value) {
    case Low:
        // QVGA
        width = LOW_RES_WIDTH;
        height = LOW_RES_HEIGHT;
        break;
    case Medium:
        // VGA
        width = MID_RES_WIDTH;
        height = MID_RES_HEIGHT;
        break;
    case High:
        // WVGA
        width = HIGH_RES_WIDTH;
        height = HIGH_RES_HEIGHT;
        break;
    default:
        qCritical() << "Unsupported resolution value " << value;
        return;
    }

    g_signal_emit_by_name(camerabin, "set-video-resolution-fps",
                          width, height, VIDEO_FRN, VIDEO_FRD, NULL);

    // set new rendering position to the viewfinder
    gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(viewfinder),
                                       32,
                                       30,
                                       560,
                                       420);
}
开发者ID:foolab,项目名称:aura,代码行数:35,代码来源:pipeline.cpp

示例12: gst_v4l2_xoverlay_prepare_xwindow_id

/**
 * gst_v4l2_xoverlay_prepare_xwindow_id:
 * @v4l2object: the v4l2object
 * @required: %TRUE if display is required (ie. TRUE for v4l2sink, but
 *   FALSE for any other element with optional overlay capabilities)
 *
 * Helper function to create a windo if none is set from the application.
 */
void
gst_v4l2_xoverlay_prepare_xwindow_id (GstV4l2Object * v4l2object,
    gboolean required)
{
  if (!GST_V4L2_IS_OVERLAY (v4l2object))
    return;

  gst_x_overlay_prepare_xwindow_id (GST_X_OVERLAY (v4l2object->element));

  if (required && !v4l2object->xwindow_id) {
    GstV4l2Xv *v4l2xv;
    Window win;
    int width, height;
    long event_mask;

    if (!v4l2object->xv && GST_V4L2_IS_OPEN (v4l2object))
      gst_v4l2_xoverlay_open (v4l2object);

    v4l2xv = v4l2object->xv;

    /* if xoverlay is not supported, just bail */
    if (!v4l2xv)
      return;

    /* xoverlay is supported, but we don't have a window.. so create one */
    GST_DEBUG_OBJECT (v4l2object->element, "creating window");

    g_mutex_lock (v4l2xv->mutex);

    width = XDisplayWidth (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy));
    height = XDisplayHeight (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy));
    GST_DEBUG_OBJECT (v4l2object->element, "dpy=%p", v4l2xv->dpy);

    win = XCreateSimpleWindow (v4l2xv->dpy,
        DefaultRootWindow (v4l2xv->dpy),
        0, 0, width, height, 0, 0,
        XBlackPixel (v4l2xv->dpy, DefaultScreen (v4l2xv->dpy)));

    GST_DEBUG_OBJECT (v4l2object->element, "win=%lu", win);

    event_mask = ExposureMask | StructureNotifyMask;
    if (GST_IS_NAVIGATION (v4l2object->element)) {
      event_mask |= PointerMotionMask |
          KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask;
    }
    XSelectInput (v4l2xv->dpy, win, event_mask);
    v4l2xv->event_id = g_timeout_add (45, event_refresh, v4l2object);

    XMapRaised (v4l2xv->dpy, win);

    XSync (v4l2xv->dpy, FALSE);

    g_mutex_unlock (v4l2xv->mutex);

    GST_DEBUG_OBJECT (v4l2object->element, "got window");

    gst_v4l2_xoverlay_set_window_handle (v4l2object, win);
  }
}
开发者ID:matsu,项目名称:gst-plugins-good,代码行数:67,代码来源:gstv4l2xoverlay.c

示例13: gst_x_overlay_set_render_rectangle

void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
{
    m_displayRect = rect;

    if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
#if GST_VERSION_MICRO >= 29
        if (m_displayRect.isEmpty())
            gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), -1, -1, -1, -1);
        else
            gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink),
                                               m_displayRect.x(),
                                               m_displayRect.y(),
                                               m_displayRect.width(),
                                               m_displayRect.height());
        repaint();
#endif
    }
}
开发者ID:xjohncz,项目名称:qt5,代码行数:18,代码来源:qgstreamervideowindow.cpp

示例14: tsmf_window_create

int tsmf_window_create(TSMFGstreamerDecoder* decoder)
{
	struct X11Handle* hdl;

	if (decoder->media_type != TSMF_MAJOR_TYPE_VIDEO)
	{
		decoder->ready = TRUE;
		return -3;
	}
	else
	{
#if GST_VERSION_MAJOR > 0
		GstVideoOverlay *overlay = GST_VIDEO_OVERLAY(decoder->outsink);
#else
		GstXOverlay *overlay = GST_X_OVERLAY(decoder->outsink);
#endif

		if (!decoder)
			return -1;

		if (!decoder->platform)
			return -1;

		hdl = (struct X11Handle*) decoder->platform;

		if (!hdl->subwin)
		{
			int event, error;
			hdl->subwin = XCreateSimpleWindow(hdl->disp, *(int *)hdl->xfwin, 0, 0, 1, 1, 0, 0, 0);

			if (!hdl->subwin)
			{
				WLog_ERR(TAG, "Could not create subwindow!");
			}

			XMapWindow(hdl->disp, hdl->subwin);
			XSync(hdl->disp, FALSE);
#if GST_VERSION_MAJOR > 0
			gst_video_overlay_set_window_handle(overlay, hdl->subwin);
#else
			gst_x_overlay_set_window_handle(overlay, hdl->subwin);
#endif
			decoder->ready = TRUE;
#if defined(WITH_XEXT)
			hdl->has_shape = XShapeQueryExtension(hdl->disp, &event, &error);
#endif
		}

#if GST_VERSION_MAJOR > 0
		gst_video_overlay_handle_events(overlay, TRUE);
#else
		gst_x_overlay_handle_events(overlay, TRUE);
#endif
		return 0;
	}
}
开发者ID:Distrotech,项目名称:FreeRDP,代码行数:56,代码来源:tsmf_X11.c

示例15: gst_vdp_sink_set_property

static void
gst_vdp_sink_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  VdpSink *vdp_sink;

  g_return_if_fail (GST_IS_VDP_SINK (object));

  vdp_sink = GST_VDP_SINK (object);

  switch (prop_id) {
    case PROP_DISPLAY:
      vdp_sink->display_name = g_strdup (g_value_get_string (value));
      break;
    case PROP_SYNCHRONOUS:
      vdp_sink->synchronous = g_value_get_boolean (value);
      if (vdp_sink->device) {
        GST_DEBUG_OBJECT (vdp_sink, "XSynchronize called with %s",
            vdp_sink->synchronous ? "TRUE" : "FALSE");
        g_mutex_lock (vdp_sink->x_lock);
        XSynchronize (vdp_sink->device->display, vdp_sink->synchronous);
        g_mutex_unlock (vdp_sink->x_lock);
      }
      break;
    case PROP_PIXEL_ASPECT_RATIO:
    {
      GValue *tmp;

      tmp = g_new0 (GValue, 1);
      g_value_init (tmp, GST_TYPE_FRACTION);

      if (!g_value_transform (value, tmp)) {
        GST_WARNING_OBJECT (vdp_sink,
            "Could not transform string to aspect ratio");
        g_free (tmp);
      } else {
        GST_DEBUG_OBJECT (vdp_sink, "set PAR to %d/%d",
            gst_value_get_fraction_numerator (tmp),
            gst_value_get_fraction_denominator (tmp));
        g_free (vdp_sink->par);
        vdp_sink->par = tmp;
      }
    }
      break;
    case PROP_HANDLE_EVENTS:
      gst_vdp_sink_set_event_handling (GST_X_OVERLAY (vdp_sink),
          g_value_get_boolean (value));
      break;
    case PROP_HANDLE_EXPOSE:
      vdp_sink->handle_expose = g_value_get_boolean (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:56,代码来源:gstvdpsink.c


注:本文中的GST_X_OVERLAY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。