summaryrefslogtreecommitdiffstats
path: root/gst/rtsp
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-03-25 17:54:35 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-03-25 17:54:35 +0000
commit37634c2afb84e9a1471757e2e6c7b0f282b3f46e (patch)
tree8568f2c2869e98f0dd7aea4a31fad8b29e71e42e /gst/rtsp
parent2199592039d14e9168704a63bfb9f9457b92e5db (diff)
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.
Diffstat (limited to 'gst/rtsp')
-rw-r--r--gst/rtsp/gstrtsp.c8
-rw-r--r--gst/rtsp/gstrtspsrc.c39
2 files changed, 44 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 <gst/sdp/gstsdpmessage.h>
#include <gst/rtp/gstrtppayloads.h>
+#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: