diff options
author | jake <jake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-05-14 06:26:16 +0000 |
---|---|---|
committer | jake <jake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-05-14 06:26:16 +0000 |
commit | c1e4dcc06f5953102df3d3f8e25651b4531f431f (patch) | |
tree | ac0099c7c388a95bf526c03cd3dae2325a628811 /gtk/rtp_player.c | |
parent | aa7735f02e870c6f5e166ac165e86b749e0aaa29 (diff) |
Extend error reporting from PortAudio library.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28358 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'gtk/rtp_player.c')
-rw-r--r-- | gtk/rtp_player.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/gtk/rtp_player.c b/gtk/rtp_player.c index 5ac80804aa..78a34f8784 100644 --- a/gtk/rtp_player.c +++ b/gtk/rtp_player.c @@ -1606,6 +1606,75 @@ play_channels(void) #endif /* PORTAUDIO_API_1 */ if( err != paNoError ) { +#if PORTAUDIO_API_1 + const char *deviceName = "No Device"; + + PaDeviceID device = Pa_GetDefaultOutputDeviceID(); + + if (device != paNoDevice) + { + const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo( device ); + if (deviceInfo) + deviceName = deviceInfo->name; + else + deviceName = "(No device info)"; + } + + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Got this info from PortAudio Library:\n" + " Default deviceName: %s (%d)", deviceName, device); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); +#else + PaHostApiIndex hostApi = Pa_GetDefaultHostApi(); + if (hostApi < 0) + { + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Can not even get the default host API from PortAudio Library.\n Error: %s", + Pa_GetErrorText( hostApi )); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + else + { + const PaHostApiInfo *hostApiInfo = Pa_GetHostApiInfo( hostApi ); + + if ( !hostApiInfo ) + { + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Can not even get the host API info from PortAudio Library."); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + else + { + const char *hostApiName = hostApiInfo->name; + const char *deviceName = "No Device"; + + PaDeviceIndex device = hostApiInfo->defaultOutputDevice; + + if (device != paNoDevice) + { + const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo( device ); + if (deviceInfo) + deviceName = deviceInfo->name; + else + deviceName = "(No device info)"; + } + + dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, + "Got this info from PortAudio Library:\n" + " Default hostApiName: %s\n" + " Default deviceName: %s (%d)", hostApiName, deviceName, device); + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + } + } +#endif dialog = gtk_message_dialog_new ((GtkWindow *) rtp_player_dlg_w, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, "Can not Open Stream in PortAudio Library.\n Error: %s", Pa_GetErrorText( err )); |