pidgin/gtksound.c

changeset 19849
e8a23f4721f0
parent 19591
a943e8e69c5f
child 19859
71d37b57eff2
equal deleted inserted replaced
19848:e642e0e42afe 19849:e8a23f4721f0
444 444
445 g_free(esc_filename); 445 g_free(esc_filename);
446 g_free(command); 446 g_free(command);
447 return; 447 return;
448 } 448 }
449 #endif /* _WIN32 */
450
449 #ifdef USE_GSTREAMER 451 #ifdef USE_GSTREAMER
450 if (gst_init_failed) /* Perhaps do gdk_beep instead? */ 452 if (gst_init_failed) /* Perhaps do gdk_beep instead? */
451 return; 453 return;
452 volume = (float)(CLAMP(purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"),0,100)) / 50; 454 volume = (float)(CLAMP(purple_prefs_get_int(PIDGIN_PREFS_ROOT "/sound/volume"),0,100)) / 50;
453 if (!strcmp(method, "automatic")) { 455 if (!strcmp(method, "automatic")) {
458 sink = gst_element_factory_make("autoaudiosink", "sink"); 460 sink = gst_element_factory_make("autoaudiosink", "sink");
459 if (!sink) { 461 if (!sink) {
460 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n"); 462 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
461 return; 463 return;
462 } 464 }
463 } else if (!strcmp(method, "esd")) { 465 }
466 #ifndef _WIN32
467 else if (!strcmp(method, "esd")) {
464 sink = gst_element_factory_make("esdsink", "sink"); 468 sink = gst_element_factory_make("esdsink", "sink");
465 if (!sink) { 469 if (!sink) {
466 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n"); 470 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
467 return; 471 return;
468 } 472 }
470 sink = gst_element_factory_make("alsasink", "sink"); 474 sink = gst_element_factory_make("alsasink", "sink");
471 if (!sink) { 475 if (!sink) {
472 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n"); 476 purple_debug_error("sound", "Unable to create GStreamer audiosink.\n");
473 return; 477 return;
474 } 478 }
475 } else { 479 }
480 #endif
481 else {
476 purple_debug_error("sound", "Unknown sound method '%s'\n", method); 482 purple_debug_error("sound", "Unknown sound method '%s'\n", method);
477 return; 483 return;
478 } 484 }
479 485
480 play = gst_element_factory_make("playbin", "play"); 486 play = gst_element_factory_make("playbin", "play");
496 502
497 gst_object_unref(bus); 503 gst_object_unref(bus);
498 g_free(uri); 504 g_free(uri);
499 505
500 #else /* USE_GSTREAMER */ 506 #else /* USE_GSTREAMER */
507
508 #ifndef _WIN32
501 gdk_beep(); 509 gdk_beep();
502 return;
503 #endif /* USE_GSTREAMER */
504 #else /* _WIN32 */ 510 #else /* _WIN32 */
505 purple_debug_info("sound", "Playing %s\n", filename); 511 purple_debug_info("sound", "Playing %s\n", filename);
506 512
507 if (G_WIN32_HAVE_WIDECHAR_API ()) { 513 if (G_WIN32_HAVE_WIDECHAR_API ()) {
508 wchar_t *wc_filename = g_utf8_to_utf16(filename, 514 wchar_t *wc_filename = g_utf8_to_utf16(filename,
516 if (!PlaySoundA(l_filename, NULL, SND_ASYNC | SND_FILENAME)) 522 if (!PlaySoundA(l_filename, NULL, SND_ASYNC | SND_FILENAME))
517 purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n"); 523 purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
518 g_free(l_filename); 524 g_free(l_filename);
519 } 525 }
520 #endif /* _WIN32 */ 526 #endif /* _WIN32 */
527
528 #endif /* USE_GSTREAMER */
521 } 529 }
522 530
523 static void 531 static void
524 pidgin_sound_play_event(PurpleSoundEventID event) 532 pidgin_sound_play_event(PurpleSoundEventID event)
525 { 533 {

mercurial