From 37634c2afb84e9a1471757e2e6c7b0f282b3f46e Mon Sep 17 00:00:00 2001 From: Tim-Philipp Müller Date: Wed, 25 Mar 2009 17:54:35 +0000 Subject: rtspsrc: better error message when the RTSP extension for Real streams is missing Try to post a decent error message when it looks like we're failing because the Real RTSP extension plugin is missing. Also add i18n bits for rtspsrc so our error messages get translated. --- gst/rtsp/gstrtsp.c | 8 ++++++++ gst/rtsp/gstrtspsrc.c | 39 ++++++++++++++++++++++++++++++++++++--- po/POTFILES.in | 1 + 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/gst/rtsp/gstrtsp.c b/gst/rtsp/gstrtsp.c index 045c03a6..37d7fbae 100644 --- a/gst/rtsp/gstrtsp.c +++ b/gst/rtsp/gstrtsp.c @@ -45,12 +45,20 @@ #include "config.h" #endif +#include "gst/gst-i18n-plugin.h" + #include "gstrtpdec.h" #include "gstrtspsrc.h" static gboolean plugin_init (GstPlugin * plugin) { +#ifdef ENABLE_NLS + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ + if (!gst_element_register (plugin, "rtspsrc", GST_RANK_NONE, GST_TYPE_RTSPSRC)) return FALSE; diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 6226457f..9c6f2696 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -94,6 +94,8 @@ #include #include +#include "gst/gst-i18n-plugin.h" + #include "gstrtspsrc.h" #ifdef G_OS_WIN32 @@ -3904,6 +3906,23 @@ failed: } } +static gboolean +gst_rtspsrc_stream_is_real_media (GstRTSPStream * stream) +{ + gboolean res = FALSE; + + if (stream->caps) { + GstStructure *s; + const gchar *enc = NULL; + + s = gst_caps_get_structure (stream->caps, 0); + if ((enc = gst_structure_get_string (s, "encoding-name"))) { + res = (strstr (enc, "-REAL") != NULL); + } + } + return res; +} + /* Perform the SETUP request for all the streams. * * We ask the server for a specific transport, which initially includes all the @@ -3926,6 +3945,7 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) GstRTSPStream *stream = NULL; GstRTSPLowerTrans protocols; GstRTSPStatusCode code; + gboolean unsupported_real = FALSE; gint rtpport, rtcpport; GstRTSPUrl *url; @@ -4035,7 +4055,11 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) retry++; goto retry; } - /* give up on this stream and move to the next stream */ + /* give up on this stream and move to the next stream, + * but not without doing some postprocessing so we can + * post a nicer/more useful error message later */ + if (!unsupported_real) + unsupported_real = gst_rtspsrc_stream_is_real_media (stream); continue; default: /* cleanup of leftover transport and move to the next stream */ @@ -4172,8 +4196,17 @@ no_transport: } nothing_to_activate: { - GST_ELEMENT_ERROR (src, STREAM, FORMAT, (NULL), - ("No supported stream was found.")); + /* none of the available error codes is really right .. */ + if (unsupported_real) { + GST_ELEMENT_ERROR (src, STREAM, CODEC_NOT_FOUND, + (_("No supported stream was found. You might need to install a " + "GStreamer RTSP extension plugin for Real media streams.")), + (NULL)); + } else { + GST_ELEMENT_ERROR (src, STREAM, CODEC_NOT_FOUND, + (_("No supported stream was found. You might be missing the right " + "GStreamer RTSP extension plugin.")), (NULL)); + } return FALSE; } cleanup_error: diff --git a/po/POTFILES.in b/po/POTFILES.in index 305cc419..7ee3258d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -8,6 +8,7 @@ gconf/gstreamer.schemas.in gst/avi/gstavidemux.c gst/avi/gstavimux.c gst/qtdemux/qtdemux.c +gst/rtsp/gstrtspsrc.c gst/wavparse/gstwavparse.c sys/oss/gstossmixer.c sys/oss/gstossmixertrack.c -- cgit