예제 #1
0
static void
empathy_audio_sink_init (EmpathyGstAudioSink *obj)
{
  EmpathyGstAudioSinkPrivate *priv = EMPATHY_GST_AUDIO_SINK_GET_PRIVATE (obj);
  GstElement *resample;
  GstPad *ghost, *sink;

  priv->notifier = fs_element_added_notifier_new ();
  g_signal_connect (priv->notifier, "element-added",
    G_CALLBACK (empathy_audio_sink_element_added_cb), obj);

  resample = gst_element_factory_make ("audioresample", NULL);

  priv->volume = gst_element_factory_make ("volume", NULL);
  g_object_ref (priv->volume);

  priv->sink = gst_element_factory_make ("gconfaudiosink", NULL);

  fs_element_added_notifier_add (priv->notifier, GST_BIN (priv->sink));

  gst_bin_add_many (GST_BIN (obj), resample, priv->volume, priv->sink, NULL);
  gst_element_link_many (resample, priv->volume, priv->sink, NULL);

  sink = gst_element_get_static_pad (resample, "sink");

  ghost = gst_ghost_pad_new ("sink", sink);
  gst_element_add_pad (GST_ELEMENT (obj), ghost);

  gst_object_unref (G_OBJECT (sink));
}
예제 #2
0
static void
empathy_audio_src_init (EmpathyGstAudioSrc *obj)
{
  EmpathyGstAudioSrcPrivate *priv = EMPATHY_GST_AUDIO_SRC_GET_PRIVATE (obj);
  GstPad *ghost, *src;

  priv->peak_level = -G_MAXDOUBLE;
  priv->lock = g_mutex_new ();

  priv->notifier = fs_element_added_notifier_new ();
  g_signal_connect (priv->notifier, "element-added",
    G_CALLBACK (empathy_audio_src_element_added_cb), obj);

  priv->src = gst_element_factory_make ("gconfaudiosrc", NULL);
  gst_bin_add (GST_BIN (obj), priv->src);

  fs_element_added_notifier_add (priv->notifier, GST_BIN (priv->src));

  priv->volume = gst_element_factory_make ("volume", NULL);
  g_object_ref (priv->volume);

  gst_bin_add (GST_BIN (obj), priv->volume);
  gst_element_link (priv->src, priv->volume);

  priv->level = gst_element_factory_make ("level", NULL);
  gst_bin_add (GST_BIN (obj), priv->level);
  gst_element_link (priv->volume, priv->level);

  src = gst_element_get_static_pad (priv->level, "src");

  ghost = gst_ghost_pad_new ("src", src);
  gst_element_add_pad (GST_ELEMENT (obj), ghost);

  gst_object_unref (G_OBJECT (src));
}
예제 #3
0
static void
skype_audio_stream_init (SkypeAudioStream *self)
{
  self->priv = SKYPE_AUDIO_STREAM_GET_PRIVATE (self);

  self->priv->ptime = DEFAULT_PTIME;
  self->priv->volume = DEFAULT_VOLUME;

  self->priv->notifier = fs_element_added_notifier_new ();
  self->priv->properties = skype_dynamic_properties_new (self->priv->notifier,
      "bitrate", G_TYPE_UINT,
      NULL);
}
예제 #4
0
static void
empathy_call_handler_tf_channel_session_created_cb (TfChannel *tfchannel,
  FsConference *conference, FsParticipant *participant,
  EmpathyCallHandler *self)
{
  EmpathyCallHandlerPriv *priv = GET_PRIV (self);

  priv->fsnotifier = fs_element_added_notifier_new ();
  fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (conference));

  g_signal_connect (priv->fsnotifier, "element-added",
    G_CALLBACK (conference_element_added), NULL);

  g_signal_emit (G_OBJECT (self), signals[CONFERENCE_ADDED], 0,
    GST_ELEMENT (conference));
}
예제 #5
0
static void
empathy_video_widget_init (EmpathyVideoWidget *obj)
{
  EmpathyVideoWidgetPriv *priv = GET_PRIV (obj);
  GdkColor black;

  priv->notifier = fs_element_added_notifier_new ();
  g_signal_connect (priv->notifier, "element-added",
    G_CALLBACK (empathy_video_widget_element_added_cb),
    obj);

  if (gdk_color_parse ("Black", &black))
    gtk_widget_modify_bg (GTK_WIDGET (obj), GTK_STATE_NORMAL,
      &black);

  GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (obj), GTK_DOUBLE_BUFFERED);
}
static void
empathy_video_widget_init (EmpathyVideoWidget *obj)
{
  EmpathyVideoWidgetPriv *priv = GET_PRIV (obj);
  GdkRGBA black;

  priv->lock = g_mutex_new ();

  priv->notifier = fs_element_added_notifier_new ();
  g_signal_connect (priv->notifier, "element-added",
    G_CALLBACK (empathy_video_widget_element_added_cb),
    obj);

  if (gdk_rgba_parse (&black, "Black"))
    gtk_widget_override_background_color (GTK_WIDGET (obj), 0, &black);

  gtk_widget_set_double_buffered (GTK_WIDGET (obj), FALSE);
}
예제 #7
0
static void
mex_telepathy_channel_conference_added (TfChannel  *channel,
                                        GstElement *conference,
                                        gpointer    user_data)
{
  MexTelepathyChannel *self = MEX_TELEPATHY_CHANNEL (user_data);
  MexTelepathyChannelPrivate *priv = self->priv;

  GKeyFile *keyfile;

  MEX_INFO ("Conference added");

  /* Add notifier to set the various element properties as needed */
  keyfile = fs_utils_get_default_element_properties (conference);
  if (keyfile != NULL)
    {
      FsElementAddedNotifier *notifier;
      MEX_INFO ("Loaded default codecs for %s", GST_ELEMENT_NAME (conference));

      notifier = fs_element_added_notifier_new ();
      fs_element_added_notifier_set_properties_from_keyfile (notifier, keyfile);
      fs_element_added_notifier_add (notifier, GST_BIN (priv->pipeline));

      priv->notifiers = g_list_prepend (priv->notifiers, notifier);
    }

  gst_bin_add (GST_BIN (priv->pipeline), conference);
  gst_element_set_state (conference, GST_STATE_PLAYING);

  if (CLUTTER_IS_ACTOR (priv->video_call_page))
    {
      g_signal_emit (self,
                     mex_telepathy_channel_signals[SHOW_ACTOR],
                     0,
                     g_object_ref (priv->video_call_page));
      clutter_actor_show (priv->busy_box);
      clutter_actor_raise_top (priv->busy_box);
    }
  else
    priv->show_page = TRUE;
}
예제 #8
0
GstElement *
purple_media_manager_get_pipeline(PurpleMediaManager *manager)
{
#ifdef USE_VV
	g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL);

	if (manager->priv->pipeline == NULL) {
		FsElementAddedNotifier *notifier;
		gchar *filename;
		GError *err = NULL;
		GKeyFile *keyfile;
		GstBus *bus;
		manager->priv->pipeline = gst_pipeline_new(NULL);

		bus = gst_pipeline_get_bus(
				GST_PIPELINE(manager->priv->pipeline));
		gst_bus_add_signal_watch(GST_BUS(bus));
		g_signal_connect(G_OBJECT(bus), "message",
				G_CALLBACK(pipeline_bus_call), manager);
		gst_bus_set_sync_handler(bus,
				gst_bus_sync_signal_handler, NULL);
		gst_object_unref(bus);

		filename = g_build_filename(purple_user_dir(),
				"fs-element.conf", NULL);
		keyfile = g_key_file_new();
		if (!g_key_file_load_from_file(keyfile, filename,
				G_KEY_FILE_NONE, &err)) {
			if (err->code == 4)
				purple_debug_info("mediamanager",
						"Couldn't read "
						"fs-element.conf: %s\n",
						err->message);
			else
				purple_debug_error("mediamanager",
						"Error reading "
						"fs-element.conf: %s\n",
						err->message);
			g_error_free(err);
		}
		g_free(filename);

		/* Hack to make alsasrc stop messing up audio timestamps */
		if (!g_key_file_has_key(keyfile,
				"alsasrc", "slave-method", NULL)) {
			g_key_file_set_integer(keyfile,
					"alsasrc", "slave-method", 2);
		}

		notifier = fs_element_added_notifier_new();
		fs_element_added_notifier_add(notifier,
				GST_BIN(manager->priv->pipeline));
		fs_element_added_notifier_set_properties_from_keyfile(
				notifier, keyfile);

		gst_element_set_state(manager->priv->pipeline,
				GST_STATE_PLAYING);
	}

	return manager->priv->pipeline;
#else
	return NULL;
#endif
}
예제 #9
0
    VideoWidget::VideoWidget(GstBus *bus,  QWidget *parent, const QString &name, const QString &video_sink_name) 
        : Communication::VideoPlaybackWidgetInterface(parent), 
          bus_((GstBus *) gst_object_ref(bus)), 
          video_overlay_(0), 
          video_playback_element_(0),
          video_playback_bin_(0),
          name_(name),
          window_id_(0),
          on_element_added_g_signal_(0),
          on_sync_message_g_signal_(0)

    {
        qDebug() << "VideoWidget " << name << " INIT STARTED";
        setWindowTitle(name);

        // Element notifier init
        notifier_ = fs_element_added_notifier_new();
        on_element_added_g_signal_ = g_signal_connect(notifier_, "element-added", G_CALLBACK(&VideoWidget::OnElementAdded), this);

// UNIX -> autovideosink
       
#ifdef Q_WS_X11

        qt_x11_set_global_double_buffer(false);

        //video_playback_element_ = gst_element_factory_make(video_sink_name.toStdString().c_str(), 0);
        //gst_object_ref(video_playback_element_);
        //gst_object_sink(video_playback_element_);
        //fs_element_added_notifier_add(notifier_, GST_BIN(video_playback_element_));

#endif
        // WINDOWS -> autovideosink will chose one of there: glimagesink (best), directdrawsink (possible buffer errors), dshowvideosink (possible buffer errors)
        // X11 -> 
        video_playback_element_ = gst_element_factory_make(video_sink_name.toStdString().c_str(), 0);
        if (!video_playback_element_)
        {
            qDebug() << "VideoWidget " << name << " CANNOT CREATE video_playback_element_ (" << video_sink_name <<")";
            return;
        }

        // Video bin init
        const QString video_bin_name = "video_bin_for_" + name;
        video_playback_bin_ = gst_bin_new(video_bin_name.toStdString().c_str());
        if (!video_playback_bin_)
        {
            qDebug() << "VideoWidget " << name << " CANNOT CREATE video_bin_";
            return;
        }

        // Add playback element to video bin
        gst_bin_add(GST_BIN(video_playback_bin_), video_playback_element_);

        // Pad inits
        GstPad *static_sink_pad = gst_element_get_static_pad(video_playback_element_, "sink");
        GstPad *sink_ghost_pad = gst_ghost_pad_new("sink", static_sink_pad);

        // Add pad to video bin
        gst_element_add_pad(GST_ELEMENT(video_playback_bin_), sink_ghost_pad);
        gst_object_unref(G_OBJECT(static_sink_pad));
        gst_object_ref(video_playback_bin_);
        gst_object_sink(video_playback_bin_);

        fs_element_added_notifier_add(notifier_, GST_BIN(video_playback_bin_));

        gst_bus_enable_sync_message_emission(bus_);
        on_sync_message_g_signal_ = g_signal_connect(bus_, "sync-message", G_CALLBACK(&VideoWidget::OnSyncMessage), this);

        qDebug() << "VideoWidget " << name << " INIT COMPLETE";

        // QWidget properties
        QPalette palette;
        palette.setColor(QPalette::Background, Qt::black);
        palette.setColor(QPalette::Window, Qt::black);
        setPalette(palette);
        
        // Show nothing and lets put qwidgets as normal external windows
        //setAutoFillBackground(true);
        //setAttribute(Qt::WA_NoSystemBackground, true);
        //setAttribute(Qt::WA_PaintOnScreen, true);

        setWindowFlags(Qt::Dialog);
        resize(VIDEO_WIDTH, VIDEO_HEIGHT);
        setMinimumSize(VIDEO_WIDTH, VIDEO_HEIGHT);
    }