summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu.duponchelle@collabora.com>2014-09-16 17:42:27 (GMT)
committerMathieu Duponchelle <mathieu.duponchelle@collabora.com>2014-09-16 17:44:34 (GMT)
commit790f6871c469ce20092a7420fff6c821473ce195 (patch)
treea97342b561f3835e3b36e9f87550dc5d3b84fbf1
parentad489f27ff8528c42768a48e92846ebe9bee0844 (diff)
downloadgst-plugins-dlnasrc-dlna.tar.gz
gst-plugins-dlnasrc-dlna.tar.xz
dlnasrc: expose a "resend-stream-start" property.dlna
As there is no way to know if the DMS will send a whole new file, it is up to the application to specify that.
-rw-r--r--src/gstdlnasrc.c44
-rw-r--r--src/gstdlnasrc.h1
2 files changed, 32 insertions, 13 deletions
diff --git a/src/gstdlnasrc.c b/src/gstdlnasrc.c
index e83fb06..1251714 100644
--- a/src/gstdlnasrc.c
+++ b/src/gstdlnasrc.c
@@ -49,6 +49,7 @@ enum
PROP_DTCP_BLOCKSIZE,
PROP_PAUSE_MODE,
PROP_PREFER_TIMERANGE,
+ PROP_RESEND_STREAM_START,
};
#define GST_DLNA_SRC_PAUSE_MODE_TYPE (gst_dlna_src_pause_mode_get_type())
@@ -444,6 +445,10 @@ gst_dlna_src_class_init (GstDlnaSrcClass * klass)
"Whether time seeks with a rate different from 1.0 should be executed"
" using the playspeed or time range trick mode", FALSE, G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_klass, PROP_RESEND_STREAM_START,
+ g_param_spec_boolean ("resend-stream-start", "Resend stream start",
+ "Whether playspeed seeks should trigger a stream-start", FALSE, G_PARAM_READWRITE));
+
gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_dlna_src_finalize);
gstelement_klass->change_state = gst_dlna_src_change_state;
}
@@ -574,6 +579,9 @@ gst_dlna_src_set_property (GObject * object, guint prop_id,
case PROP_PREFER_TIMERANGE:
dlna_src->prefer_timerange = g_value_get_boolean (value);
break;
+ case PROP_RESEND_STREAM_START:
+ dlna_src->resend_stream_start = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -642,6 +650,10 @@ gst_dlna_src_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boolean (value, dlna_src->prefer_timerange);
break;
+ case PROP_RESEND_STREAM_START:
+ g_value_set_boolean (value, dlna_src->resend_stream_start);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -783,7 +795,7 @@ gst_dlna_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
{
- GST_INFO_OBJECT (dlna_src, "Got src event: %s",
+ GST_ERROR_OBJECT (dlna_src, "Got src event: %s",
GST_EVENT_TYPE_NAME (event));
ret = dlna_src_handle_event_seek (dlna_src, pad, event, &new_event);
/* If we can handle it, substitute (potentially) modified seek event */
@@ -1248,21 +1260,21 @@ dlna_src_handle_event_seek (GstDlnaSrc * dlna_src, GstPad * pad,
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start, &stop_type, &stop);
- GST_INFO_OBJECT (dlna_src,
+ GST_ERROR_OBJECT (dlna_src,
"Got Seek event %d: rate: %3.1f, format: %s, flags: %d, start type: %d, start: %"
G_GUINT64_FORMAT ", stop type: %d, stop: %"
G_GUINT64_FORMAT, gst_event_get_seqnum (event), rate,
gst_format_get_name (format), flags, start_type, start, stop_type, stop);
if ((dlna_src->uri == NULL) || (dlna_src->server_info == NULL)) {
- GST_INFO_OBJECT (dlna_src,
+ GST_ERROR_OBJECT (dlna_src,
"No URI and/or HEAD response info, event handled");
return FALSE;
}
/* If we already handled that seek, return straight away succesfully */
if (gst_event_get_seqnum(event) == dlna_src->seek_seqnum) {
- GST_DEBUG_OBJECT (dlna_src, "Already handled seek with the same seqnum");
+ GST_ERROR_OBJECT (dlna_src, "Already handled seek with the same seqnum");
return FALSE;
}
@@ -1277,7 +1289,7 @@ dlna_src_handle_event_seek (GstDlnaSrc * dlna_src, GstPad * pad,
* corresponds to which position in time
*/
if (rate != 1.0) {
- GST_WARNING_OBJECT (dlna_src, "FIXME: Implement byte-based scan-mode");
+ GST_ERROR_OBJECT (dlna_src, "FIXME: Implement byte-based scan-mode");
return FALSE;
}
@@ -1302,14 +1314,17 @@ dlna_src_handle_event_seek (GstDlnaSrc * dlna_src, GstPad * pad,
goto process_seek;
}
} else if (format == GST_FORMAT_TIME) {
+ GST_ERROR ("format is TIME");
/* Server supports playspeed and the requested rate */
if (!dlna_src->prefer_timerange && rate != 1.0 && dlna_src_is_rate_supported (dlna_src, rate)) {
trick_mode = GST_DLNA_MODE_PLAYSPEED;
- dlna_src->restart_stream = TRUE;
+ if (dlna_src->resend_stream_start)
+ dlna_src->restart_stream = TRUE;
goto process_seek;
}
if (dlna_src->time_seek_supported) {
+ GST_ERROR ("time seek supported");
if (seek_time_range_supported (dlna_src, start, stop)) {
trick_mode = GST_DLNA_MODE_TIMERANGE;
goto process_seek;
@@ -1318,18 +1333,18 @@ dlna_src_handle_event_seek (GstDlnaSrc * dlna_src, GstPad * pad,
/* FIXME, For now we just refuse seeks outside of server time range, need to
* check DLNA specs to see what the client is meant to do. It might need to clamp
* the requested range */
- GST_WARNING_OBJECT (dlna_src, "Requested time seek outside of server range");
+ GST_ERROR_OBJECT (dlna_src, "Requested time seek outside of server range");
return FALSE;
}
} else {
- GST_WARNING_OBJECT (dlna_src, "Seek event in unhandled format");
+ GST_ERROR_OBJECT (dlna_src, "Seek event in unhandled format");
return FALSE;
}
/* FIXME: If we end up here, it means that the server can't handle the
* requested format, we need to convert it
*/
- GST_WARNING_OBJECT (dlna_src, "FIXME : Implement BYTE<=>TIME conversion");
+ GST_ERROR_OBJECT (dlna_src, "FIXME : Implement BYTE<=>TIME conversion");
return FALSE;
process_seek:
@@ -1578,13 +1593,16 @@ dlna_src_is_rate_supported (GstDlnaSrc * dlna_src, gfloat rate)
*/
/* Look through list of server supported playspeeds and verify rate is supported */
+ GST_ERROR ("playspeed count is %d", dlna_src->server_info->content_features->playspeeds_cnt);
for (i = 0; i < dlna_src->server_info->content_features->playspeeds_cnt; i++) {
+ GST_ERROR ("one rate is %f", dlna_src->server_info->content_features->playspeeds[i]);
if (dlna_src->server_info->content_features->playspeeds[i] == rate) {
is_supported = TRUE;
break;
}
}
+ GST_ERROR ("rate is supported : %d", is_supported);
return is_supported;
}
@@ -1964,7 +1982,7 @@ restart_stream (GstDlnaSrc *dlna_src)
id = gst_pad_create_stream_id (dlna_src->src_pad, GST_ELEMENT_CAST (dlna_src),
NULL);
- GST_DEBUG_OBJECT (dlna_src, "restart stream; new ID: %s", id);
+ GST_ERROR_OBJECT (dlna_src, "restart stream; new ID: %s", id);
gst_pad_push_event (dlna_src->src_pad, gst_event_new_stream_start (id));
g_free (id);
@@ -1983,7 +2001,7 @@ dlna_src_outgoing_probe_event_downstream (GstPad *pad, GstPadProbeInfo *info,
{
const GstSegment *segment;
- GST_DEBUG_OBJECT (dlna_src, "Saw outgoing segment %" GST_PTR_FORMAT,
+ GST_ERROR_OBJECT (dlna_src, "Saw outgoing segment %" GST_PTR_FORMAT,
event);
if (dlna_src->restart_stream) {
@@ -2418,7 +2436,7 @@ dlna_src_uri_gather_info (GstDlnaSrc * dlna_src, GError ** error)
dlna_src_head_response_struct_to_str (dlna_src, dlna_src->server_info,
struct_str);
- GST_INFO_OBJECT (dlna_src, "Parsed HEAD Response into struct: %s",
+ GST_ERROR_OBJECT (dlna_src, "Parsed HEAD Response into struct: %s",
struct_str->str);
g_string_free (struct_str, TRUE);
@@ -3538,7 +3556,7 @@ dlna_src_head_response_parse_playspeeds (GstDlnaSrc * dlna_src,
gchar **tokens;
gchar **ptr;
- GST_LOG_OBJECT (dlna_src, "Found PS Field: %s", field_str);
+ GST_ERROR_OBJECT (dlna_src, "Found PS Field: %s", field_str);
if ((ret_code = sscanf (field_str, "%255[^=]=%255s", tmp1, tmp2)) != 2) {
GST_WARNING_OBJECT (dlna_src,
diff --git a/src/gstdlnasrc.h b/src/gstdlnasrc.h
index 083cbc9..45356a6 100644
--- a/src/gstdlnasrc.h
+++ b/src/gstdlnasrc.h
@@ -132,6 +132,7 @@ struct _GstDlnaSrc
gboolean paused;
gboolean prefer_timerange;
+ gboolean resend_stream_start;
/* Workaround for LPCM as we need one TIME segment to keep audiobasesink
* happy. */
gboolean lpcm_hack;