Ejemplo n.º 1
0
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);
  }
}
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
    }
}
Ejemplo n.º 3
0
void QGstreamerGLTextureRenderer::setWinId(WId id)
{
#ifdef GL_TEXTURE_SINK_DEBUG
    qDebug() << Q_FUNC_INFO << id;
#endif

    if (m_winId == id)
        return;

    bool oldReady = isReady();

    m_winId = id;

    if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
        //don't set winId in NULL state,
        //texture sink opens xvideo port on set_xwindow_id,
        //this fails if video resource is not granted by resource policy yet.
        //state is changed to READY/PAUSED/PLAYING only after resource is granted.
        GstState pendingState = GST_STATE_NULL;
        GstState newState = GST_STATE_NULL;
        GstStateChangeReturn res = gst_element_get_state(m_videoSink,
                                                         &newState,
                                                         &pendingState,
                                                         0);//don't block and return immediately

        if (res != GST_STATE_CHANGE_FAILURE &&
                newState != GST_STATE_NULL &&
                pendingState != GST_STATE_NULL)
            gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_winId);
    }

    if (oldReady != isReady())
        emit readyChanged(!oldReady);
}
Ejemplo n.º 4
0
static gboolean
cycle_window (GstXOverlay * ov)
{
  XGCValues values;
  Window old_win = win;
  GC old_gc = gc;

  win = XCreateSimpleWindow (disp, root, 0, 0, width, height, 0, 0, 0);

  XSetWindowBackgroundPixmap (disp, win, None);

  gc = XCreateGC (disp, win, 0, &values);

  XMapRaised (disp, win);

  XSync (disp, FALSE);

  gst_x_overlay_set_xwindow_id (ov, win);

  if (old_win) {
    XDestroyWindow (disp, old_win);
    XFreeGC (disp, old_gc);
    XSync (disp, FALSE);
  }

  return TRUE;
}
Ejemplo n.º 5
0
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;
}
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;
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
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;
}
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;
}
Ejemplo n.º 10
0
void X11Renderer::setOverlay()
{
    if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
        WId windowId = m_renderWidget->winId();
        // Even if we have created a winId at this point, other X applications
        // need to be aware of it.
        QApplication::syncX();
        gst_x_overlay_set_xwindow_id ( GST_X_OVERLAY(m_videoSink) ,  windowId );
    }
    windowExposed();
    m_overlaySet = true;
}
gboolean VideoReceiver::busCall(GstBus     *,
								GstMessage *message,
								gpointer    data)
{


  VideoReceiver *vr = static_cast<VideoReceiver *>(data);
  GError *error = NULL;
  gchar *debug = NULL;

  switch (GST_MESSAGE_TYPE(message)) {
  case GST_MESSAGE_ERROR:
	gst_message_parse_error(message, &error, &debug);
	qWarning("Error: %s", error->message);
	g_error_free(error);
	g_free(debug);
    
	break;
  case GST_MESSAGE_EOS:
	// end-of-stream
	// g_main_loop_quit(loop);
	qWarning("%s: Warning: EOS", __FUNCTION__);
	break;
  case GST_MESSAGE_WARNING:
	gst_message_parse_warning(message, &error, &debug);
	if (error != NULL) {
	  qWarning("Warning: %s", error->message);
	  g_error_free(error);
	}
	if (debug != NULL) {
	  qDebug("Debug: %s", debug);
	  g_free(debug);
	}
	break;
  case GST_MESSAGE_ELEMENT:
	
	if (gst_structure_has_name(message->structure, "prepare-xwindow-id") && vr->xid != 0) {
	  qDebug("%s - prepare-xwindow-id", __FUNCTION__);
	  gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), vr->xid);
	}
    
	break;
  default:
	// Unhandled message 
	//qWarning("Unhandled message type: %d", GST_MESSAGE_TYPE(message));
	break;
  }
  
  return true;
}
Ejemplo n.º 12
0
static void
bus_call(GstBus * bus, GstMessage *msg, gpointer data)
{
  windows_t *windows = (windows_t *)data;
  if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ELEMENT &&
      gst_structure_has_name(msg->structure, "prepare-xwindow-id")){
    g_print("Got prepare-xwindow-id msg. option screens: %d\n", option_screens);
    for (int i = 0; i < option_screens; i++){
      gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(windows->sinks[i]),
          windows->xwindows[i]);
      g_print("connected sink %d to window %lu\n", i, windows->xwindows[i]);
      hide_mouse(windows->gtk_windows[i]);
    }
  }
}
Ejemplo n.º 13
0
static GstBusSyncReply
window_id_cb (GstBus *bus, GstMessage *msg, gpointer data) {

	if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT)
		return GST_BUS_PASS;

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

	g_object_set(G_OBJECT(msg->src), "force-aspect-ratio", TRUE, NULL);

	gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC(msg)),
								video_window_xid);
	gst_message_unref (msg);
	return GST_BUS_DROP;
}
Ejemplo n.º 14
0
bool QGstreamerVideoWindow::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)) {

        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);

        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;
}
Ejemplo n.º 15
0
 void VideoWidget::SetOverlay()
 {
     if (isVisible() && video_overlay_ && GST_IS_X_OVERLAY(video_overlay_))
     {
         // Get window id from this widget and set it for video sink
         // so it renders to our widget id and does not open separate window (that is the default behaviour)
         qDebug() << name_ << " >> SetOverlay() called from showEvent()";
         window_id_ = winId();
         if (window_id_)
         {
             qDebug() << name_ << " >> Giving x overlay widgets window id " << window_id_;
             #ifdef Q_WS_X11
                 QApplication::syncX();
             #endif
             gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(video_overlay_), (gulong)window_id_);
             WindowExposed();
         }
     }
 }
Ejemplo n.º 16
0
static gboolean
empathy_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
{
  EmpathyVideoWidget *self = EMPATHY_VIDEO_WIDGET (widget);
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);

  if (event != NULL && event->count > 0)
    return TRUE;

  if (priv->overlay == NULL)
    return TRUE;

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

  gst_x_overlay_expose (GST_X_OVERLAY (priv->overlay));

  return TRUE;
}
Ejemplo n.º 17
0
void QGstreamerGLTextureRenderer::precessNewStream()
{
    if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
        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);
    }
}
Ejemplo n.º 18
0
void GStreamerGWorld::setWindowOverlay(GstMessage* message)
{
    GstObject* sink = GST_MESSAGE_SRC(message);

    if (!GST_IS_X_OVERLAY(sink))
        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);
#if GST_CHECK_VERSION(0, 10, 31) || GST_VERSION_NANO
        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
    }
}
Ejemplo n.º 19
0
GstBusSyncReply Pipeline::create_window (GstBus* bus, GstMessage* message, const Pipeline* p)
{
    // 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;

    qDebug ("setting xwindow id");

    //Passing 0 as the xwindow_id will tell the overlay to stop using that window and create an internal one.
    //In the directdrawsink's gst_x_overlay_set_xwindow_id implementation, xwindow_id (parameter 2) is casted to HWND before it used.
    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), (ulong)p->winId());

    gst_message_unref (message);

    return GST_BUS_DROP;
}
Ejemplo n.º 20
0
void QGstreamerVideoWindow::setWinId(WId id)
{
    if (m_windowId == id)
        return;

    WId oldId = m_windowId;

    m_windowId = id;

    if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
    }

    if (!oldId)
        emit readyChanged(true);

    if (!id)
        emit readyChanged(false);
}
P_INVOKE void
bp_video_window_expose (BansheePlayer *player, GdkWindow *window, gboolean direct)
{
    g_return_if_fail (IS_BANSHEE_PLAYER (player));
    
    if (direct && player->xoverlay != NULL && GST_IS_X_OVERLAY (player->xoverlay)) {
        gst_x_overlay_expose (player->xoverlay);
        return;
    }

    if (player->xoverlay == NULL && !bp_video_find_xoverlay (player)) {
        return;
    }
    
    gst_object_ref (player->xoverlay);

    gst_x_overlay_set_xwindow_id (player->xoverlay, player->video_window_xid);
    gst_x_overlay_expose (player->xoverlay);

    gst_object_unref (player->xoverlay);
}
Ejemplo n.º 22
0
static void
bus_sync_func_cb(GstBus *bus, GstMessage *message, gpointer user_data)
{
    struct xid_callback_data *xid_cb_data;
    GstXOverlay *sink = GST_X_OVERLAY(user_data);
    xid_cb_data = (struct xid_callback_data *)
        g_object_get_qdata(G_OBJECT(sink), xoverlay_xid_data_quark);

    if (xid_cb_data == NULL) {
        return;
    }

    if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT) {
        if (message->structure
            && GST_MESSAGE_SRC(message) == GST_OBJECT(sink)
            && strcmp(gst_structure_get_name(message->structure),
                      "prepare-xwindow-id") == 0) {
            gst_x_overlay_set_xwindow_id(sink, xid_cb_data->xid);
        }
    }
}
Ejemplo n.º 23
0
static void
empathy_video_widget_sync_message_cb (GstBus *bus, GstMessage *message,
  EmpathyVideoWidget *self)
{
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);
  const GstStructure *s;

  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
    return;

  if (GST_MESSAGE_SRC (message) != (GstObject *) priv->overlay)
    return;

  s = gst_message_get_structure (message);

  if (gst_structure_has_name (s, "prepare-xwindow-id"))
    {
      gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay),
        GDK_WINDOW_XID (GTK_WIDGET (self)->window));
    }
}
static void
bp_video_bus_element_sync_message (GstBus *bus, GstMessage *message, BansheePlayer *player)
{
    gboolean found_xoverlay;
    
    g_return_if_fail (IS_BANSHEE_PLAYER (player));

    #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WIN32)

    if (message->structure == NULL || !gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
        return;
    }

    found_xoverlay = bp_video_find_xoverlay (player);

    if (found_xoverlay) {
        gst_x_overlay_set_xwindow_id (player->xoverlay, player->video_window_xid);
    }

    #endif
}
Ejemplo n.º 25
0
static GstBusSyncReply
acam_webcam_bus_sync_handler (GstBus *bus, GstMessage *message, acam_webcam_device_s *acam_webcam_device)
{
	GstXOverlay *overlay;

	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;

	overlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));

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

	gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (gtk_widget_get_window (acam_webcam_device->video_screen)));

	gst_message_unref (message);

	return GST_BUS_DROP;
}
Ejemplo n.º 26
0
static gboolean
empathy_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
{
  EmpathyVideoWidget *self = EMPATHY_VIDEO_WIDGET (widget);
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);

  if (event != NULL && event->count > 0)
    return TRUE;

  if (priv->overlay == NULL)
    {
      gdk_window_clear_area (gtk_widget_get_window (widget), 0, 0,
        widget->allocation.width, widget->allocation.height);
      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;
}
Ejemplo n.º 27
0
static GstBusSyncReply
set_playbin_window (GstBus             *bus,
		    GstMessage         *message,
		    GthMediaViewerPage *self)
{
	GstXOverlay *image_sink;

	/* 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;

	image_sink = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
	gst_x_overlay_set_xwindow_id (image_sink, GDK_WINDOW_XID (gtk_widget_get_window (self->priv->area)));
	g_object_set (image_sink, "force-aspect-ratio", TRUE, NULL);
	self->priv->xwin_assigned = TRUE;

	gst_message_unref (message);

	return GST_BUS_DROP;
}
Ejemplo n.º 28
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    gst_init (NULL,NULL);

    GstElement *GSTpipeline = gst_pipeline_new ("pipeline");
    g_assert(GSTpipeline);
    GstElement *GSTsource = gst_element_factory_make("v4l2src", "source");
    g_assert(GSTsource);
    GstElement *GSTdest = gst_element_factory_make("xvimagesink", "view");
    g_assert(GSTdest);

    gst_bin_add_many(GST_BIN(GSTpipeline), GSTsource, GSTdest, NULL);
    gst_element_link_many(GSTsource, GSTdest, NULL);

    unsigned long win_id = ui->wgtVideo->winId();
    QApplication::syncX();
    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GSTdest), win_id);

    gst_element_set_state(GST_ELEMENT(GSTpipeline), GST_STATE_PLAYING);
}
Ejemplo n.º 29
0
static void
window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow)
{
	GstElement *sink;

	if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT ||
			!gst_structure_has_name(msg->structure,
			"prepare-xwindow-id"))
		return;

	sink = GST_ELEMENT(GST_MESSAGE_SRC(msg));
	while (sink != ow->sink) {
		if (sink == NULL)
			return;
		sink = GST_ELEMENT_PARENT(sink);
	}

	g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC
			| G_SIGNAL_MATCH_DATA, 0, 0, NULL,
			window_id_cb, ow);

	gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(
			GST_MESSAGE_SRC(msg)), ow->window_id);
}
Ejemplo n.º 30
0
void Eyrie::record() {
	QVariant ret;
	if(recbin != NULL) {
		qDebug() << "Ending recording";
		gst_element_set_state(recbin, GST_STATE_NULL);
		recbin = NULL;
		QMetaObject::invokeMethod(parent(), "reset", Q_RETURN_ARG(QVariant, ret));
		return;
	}
	qDebug() << "Starting recording";
	QMetaObject::invokeMethod(parent(), "setStatus", Q_RETURN_ARG(QVariant, ret), Q_ARG(QVariant, ""));
	recbin = gst_pipeline_new("pipeline");
	GError *err = NULL;
	recbin = gst_parse_launch("autoaudiosrc ! level ! tee name=t   t. ! queue ! audioconvert ! audioresample ! appsink name=asink caps=audio/x-raw-float,channels=1,rate=11025,width=32,endianness=1234  t. ! queue ! audioconvert ! monoscope ! videobalance saturation=0 ! videoflip method=6 ! ffmpegcolorspace ! xvimagesink name=overlay", &err);
	sink = gst_bin_get_by_name(GST_BIN(recbin), "asink");
	GstAppSinkCallbacks appsink_cbs = { NULL, NULL, on_buffer, NULL };
	gst_app_sink_set_callbacks(GST_APP_SINK(sink), &appsink_cbs, this, NULL);
	overlay = gst_bin_get_by_name(GST_BIN(recbin), "overlay");
	gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(overlay), view->effectiveWinId());
	gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(overlay), 655, 140, 100, 200);
	gst_element_set_state(recbin, GST_STATE_PLAYING);
	attempts = 0;
	timer->start(10000);
}