mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
rtmpsrc plugin : add timeout option
https://bugzilla.gnome.org/show_bug.cgi?id=764251
This commit is contained in:
parent
cc1feff99f
commit
9554e1c666
2 changed files with 19 additions and 3 deletions
|
@ -68,7 +68,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_LOCATION
|
||||
PROP_LOCATION,
|
||||
PROP_TIMEOUT
|
||||
#if 0
|
||||
PROP_SWF_URL,
|
||||
PROP_PAGE_URL
|
||||
|
@ -76,6 +77,7 @@ enum
|
|||
};
|
||||
|
||||
#define DEFAULT_LOCATION NULL
|
||||
#define DEFAULT_TIMEOUT 120
|
||||
|
||||
static void gst_rtmp_src_uri_handler_init (gpointer g_iface,
|
||||
gpointer iface_data);
|
||||
|
@ -125,6 +127,12 @@ gst_rtmp_src_class_init (GstRTMPSrcClass * klass)
|
|||
"Location of the RTMP url to read",
|
||||
DEFAULT_LOCATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_TIMEOUT,
|
||||
g_param_spec_int ("timeout", "RTMP Timeout",
|
||||
"Time without receiving any data from the server to wait before to timeout the session",
|
||||
0, G_MAXINT,
|
||||
DEFAULT_TIMEOUT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
|
||||
|
||||
gst_element_class_set_static_metadata (gstelement_class,
|
||||
|
@ -160,6 +168,7 @@ gst_rtmp_src_init (GstRTMPSrc * rtmpsrc)
|
|||
|
||||
rtmpsrc->cur_offset = 0;
|
||||
rtmpsrc->last_timestamp = 0;
|
||||
rtmpsrc->timeout = DEFAULT_TIMEOUT;
|
||||
|
||||
gst_base_src_set_format (GST_BASE_SRC (rtmpsrc), GST_FORMAT_TIME);
|
||||
}
|
||||
|
@ -271,6 +280,10 @@ gst_rtmp_src_set_property (GObject * object, guint prop_id,
|
|||
g_value_get_string (value), NULL);
|
||||
break;
|
||||
}
|
||||
case PROP_TIMEOUT:{
|
||||
src->timeout = g_value_get_int (value);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -289,6 +302,9 @@ gst_rtmp_src_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case PROP_LOCATION:
|
||||
g_value_set_string (value, src->uri);
|
||||
break;
|
||||
case PROP_TIMEOUT:
|
||||
g_value_set_int (value, src->timeout);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -574,13 +590,13 @@ gst_rtmp_src_start (GstBaseSrc * basesrc)
|
|||
src->discont = TRUE;
|
||||
|
||||
src->rtmp = RTMP_Alloc ();
|
||||
|
||||
if (!src->rtmp) {
|
||||
GST_ERROR_OBJECT (src, "Could not allocate librtmp's RTMP context");
|
||||
goto error;
|
||||
}
|
||||
|
||||
RTMP_Init (src->rtmp);
|
||||
src->rtmp->Link.timeout = src->timeout;
|
||||
if (!RTMP_SetupURL (src->rtmp, src->uri)) {
|
||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
||||
("Failed to setup URL '%s'", src->uri));
|
||||
|
|
|
@ -63,7 +63,7 @@ struct _GstRTMPSrc
|
|||
gchar *page_url;
|
||||
|
||||
RTMP *rtmp;
|
||||
|
||||
int timeout;
|
||||
gint64 cur_offset;
|
||||
GstClockTime last_timestamp;
|
||||
gboolean seekable;
|
||||
|
|
Loading…
Reference in a new issue