comparison libpurple/media.c @ 25692:19e077a4cb62

Move the main voice and video pipeline into media.c and display more debug info.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 27 Jun 2008 16:56:25 +0000
parents ddbea813862e
children 72e738dac5f7
comparison
equal deleted inserted replaced
25691:b4696e229c6d 25692:19e077a4cb62
488 purple_media_get_sink(PurpleMedia *media, const gchar *sess_id) 488 purple_media_get_sink(PurpleMedia *media, const gchar *sess_id)
489 { 489 {
490 return purple_media_get_session(media, sess_id)->src; 490 return purple_media_get_session(media, sess_id)->src;
491 } 491 }
492 492
493 static gboolean
494 media_bus_call(GstBus *bus, GstMessage *msg, gpointer media)
495 {
496 switch(GST_MESSAGE_TYPE(msg)) {
497 case GST_MESSAGE_EOS:
498 purple_debug_info("media", "End of Stream\n");
499 break;
500 case GST_MESSAGE_ERROR: {
501 gchar *debug = NULL;
502 GError *err = NULL;
503
504 gst_message_parse_error(msg, &err, &debug);
505
506 purple_debug_error("media", "gst pipeline error: %s\n", err->message);
507 g_error_free(err);
508
509 if (debug) {
510 purple_debug_error("media", "Debug details: %s\n", debug);
511 g_free (debug);
512 }
513 break;
514 }
515 case GST_MESSAGE_ELEMENT: {
516 if (gst_structure_has_name(msg->structure, "farsight-error")) {
517 gint error_no;
518 gst_structure_get_int(msg->structure, "error-no", &error_no);
519 purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
520 gst_structure_get_string(msg->structure, "error-msg"));
521 } else {
522 gchar *name, *str;
523 name = gst_object_get_name(GST_MESSAGE_SRC (msg));
524 purple_debug_info("media", "element name: %s\n", name);
525 g_free(name);
526
527 str = gst_structure_to_string(msg->structure);
528 purple_debug_info("media", "structure: %s\n", str);
529 g_free(str);
530 }
531 break;
532 }
533 default:
534 purple_debug_info("media", "gst message type: %s\n",
535 GST_MESSAGE_TYPE_NAME(msg));
536 return TRUE;
537 }
538
539 return TRUE;
540 }
541
493 GstElement * 542 GstElement *
494 purple_media_get_pipeline(PurpleMedia *media) 543 purple_media_get_pipeline(PurpleMedia *media)
495 { 544 {
496 if (!media->priv->pipeline) { 545 if (!media->priv->pipeline) {
546 GstBus *bus;
497 media->priv->pipeline = gst_pipeline_new(media->priv->name); 547 media->priv->pipeline = gst_pipeline_new(media->priv->name);
548 bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
549 gst_bus_add_signal_watch(GST_BUS(bus));
550 gst_bus_add_watch(bus, media_bus_call, media);
551 gst_object_unref(bus);
552
498 gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(media->priv->conference)); 553 gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(media->priv->conference));
499 } 554 }
500 555
501 return media->priv->pipeline; 556 return media->priv->pipeline;
502 } 557 }