diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2011-07-07 06:11:28 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-11-08 04:07:19 +0800 |
commit | dd3a57dfb3466de4207ed5233db504ad20ef54e6 (patch) | |
tree | 93a1c1485f71728a030f7607356f2d48898690be /src | |
parent | af1731d30620e7bd4aaa098af02adc3c71cb30f9 (diff) | |
download | gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar.gz gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar.bz2 gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar.lz gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar.xz gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.tar.zst gsoc2013-empathy-dd3a57dfb3466de4207ed5233db504ad20ef54e6.zip |
Add framerate and resolution change signal
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-handler.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c index 99054b9de..ef07c503a 100644 --- a/src/empathy-call-handler.c +++ b/src/empathy-call-handler.c @@ -52,6 +52,8 @@ enum { CLOSED, CANDIDATES_CHANGED, STATE_CHANGED, + FRAMERATE_CHANGED, + RESOLUTION_CHANGED, LAST_SIGNAL }; @@ -511,6 +513,19 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); + + signals[FRAMERATE_CHANGED] = + g_signal_new ("framerate-changed", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, 1, G_TYPE_UINT); + + signals[RESOLUTION_CHANGED] = + g_signal_new ("resolution-changed", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, NULL, NULL, + g_cclosure_marshal_generic, + G_TYPE_NONE, + 2, G_TYPE_UINT, G_TYPE_UINT); } EmpathyCallHandler * @@ -761,6 +776,31 @@ on_tf_content_src_pad_added_cb (TfContent *content, } static void +on_tf_content_framerate_changed (TfContent *content, + GParamSpec *spec, + EmpathyCallHandler *handler) +{ + guint framerate; + + g_object_get (content, "framerate", &framerate, NULL); + + if (framerate != 0) + g_signal_emit (G_OBJECT (handler), signals[FRAMERATE_CHANGED], 0, + framerate); +} + +static void +on_tf_content_resolution_changed (TfContent *content, + guint width, + guint height, + EmpathyCallHandler *handler) +{ + if (width > 0 && height > 0) + g_signal_emit (G_OBJECT (handler), signals[RESOLUTION_CHANGED], 0, + width, height); +} + +static void on_tf_channel_content_added_cb (TfChannel *tfchannel, TfContent *content, EmpathyCallHandler *handler) @@ -812,6 +852,33 @@ on_tf_channel_content_added_cb (TfChannel *tfchannel, tp_clear_object (&fs_stream); */ + if (mtype == FS_MEDIA_TYPE_VIDEO) + { + guint framerate, width, height; + + g_signal_connect (content, "notify::framerate", + G_CALLBACK (on_tf_content_framerate_changed), + handler); + + g_signal_connect (content, "resolution-changed", + G_CALLBACK (on_tf_content_resolution_changed), + handler); + + g_object_get (content, + "framerate", &framerate, + "width", &width, + "height", &height, + NULL); + + if (framerate > 0) + g_signal_emit (G_OBJECT (handler), signals[FRAMERATE_CHANGED], 0, + framerate); + + if (width > 0 && height > 0) + g_signal_emit (G_OBJECT (handler), signals[RESOLUTION_CHANGED], 0, + width, height); + } + gst_object_unref (spad); } |