mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-13 11:34:10 +00:00
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.
This commit is contained in:
parent
2199592039
commit
37634c2afb
3 changed files with 45 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue