mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
mpdparser: make durations unsigned where appropriate
The standard does not seem to make any particular explicit not implicit reference to the signedness of durations, and the code does not rely on such, nor on the negativity of the -1 value that's used as a placeholder when a duration property is not present in the XML. https://bugzilla.gnome.org/show_bug.cgi?id=750847
This commit is contained in:
parent
d6e805a283
commit
e48e68416c
3 changed files with 111 additions and 139 deletions
|
@ -72,7 +72,8 @@ static gboolean gst_mpdparser_get_xml_prop_cond_uint (xmlNode * a_node,
|
||||||
static gboolean gst_mpdparser_get_xml_prop_dateTime (xmlNode * a_node,
|
static gboolean gst_mpdparser_get_xml_prop_dateTime (xmlNode * a_node,
|
||||||
const gchar * property_name, GstDateTime ** property_value);
|
const gchar * property_name, GstDateTime ** property_value);
|
||||||
static gboolean gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
|
static gboolean gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
|
||||||
const gchar * property_name, gint64 default_value, gint64 * property_value);
|
const gchar * property_name, guint64 default_value,
|
||||||
|
guint64 * property_value);
|
||||||
static gboolean gst_mpdparser_get_xml_node_content (xmlNode * a_node,
|
static gboolean gst_mpdparser_get_xml_node_content (xmlNode * a_node,
|
||||||
gchar ** content);
|
gchar ** content);
|
||||||
static gchar *gst_mpdparser_get_xml_node_namespace (xmlNode * a_node,
|
static gchar *gst_mpdparser_get_xml_node_namespace (xmlNode * a_node,
|
||||||
|
@ -127,7 +128,7 @@ static void gst_mpdparser_parse_utctiming_node (GList ** list,
|
||||||
xmlNode * a_node);
|
xmlNode * a_node);
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
static gint convert_to_millisecs (gint decimals, gint pos);
|
static guint convert_to_millisecs (guint decimals, gint pos);
|
||||||
static int strncmp_ext (const char *s1, const char *s2);
|
static int strncmp_ext (const char *s1, const char *s2);
|
||||||
static GstStreamPeriod *gst_mpdparser_get_stream_period (GstMpdClient * client);
|
static GstStreamPeriod *gst_mpdparser_get_stream_period (GstMpdClient * client);
|
||||||
static GstSNode *gst_mpdparser_clone_s_node (GstSNode * pointer);
|
static GstSNode *gst_mpdparser_clone_s_node (GstSNode * pointer);
|
||||||
|
@ -146,11 +147,12 @@ static const gchar *gst_mpdparser_get_initializationURL (GstActiveStream *
|
||||||
static gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template,
|
static gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template,
|
||||||
const gchar * id, guint number, guint bandwidth, guint64 time);
|
const gchar * id, guint number, guint bandwidth, guint64 time);
|
||||||
static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream,
|
static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream,
|
||||||
GstSegmentURLNode * url_node, guint number, gint repeat, gint64 scale_start,
|
GstSegmentURLNode * url_node, guint number, gint repeat,
|
||||||
gint64 scale_duration, GstClockTime start, GstClockTime duration);
|
guint64 scale_start, guint64 scale_duration, GstClockTime start,
|
||||||
|
GstClockTime duration);
|
||||||
static const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType);
|
static const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType);
|
||||||
static GstClockTime gst_mpd_client_get_segment_duration (GstMpdClient * client,
|
static GstClockTime gst_mpd_client_get_segment_duration (GstMpdClient * client,
|
||||||
GstActiveStream * stream, gint64 * scale_duration);
|
GstActiveStream * stream, guint64 * scale_duration);
|
||||||
static GstDateTime *gst_mpd_client_get_availability_start_time (GstMpdClient *
|
static GstDateTime *gst_mpd_client_get_availability_start_time (GstMpdClient *
|
||||||
client);
|
client);
|
||||||
|
|
||||||
|
@ -919,10 +921,11 @@ error:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* this function computes decimals * 10 ^ (3 - pos) */
|
/* this function computes decimals * 10 ^ (3 - pos) */
|
||||||
static gint
|
static guint
|
||||||
convert_to_millisecs (gint decimals, gint pos)
|
convert_to_millisecs (guint decimals, gint pos)
|
||||||
{
|
{
|
||||||
gint num = 1, den = 1, i = 3 - pos;
|
guint num = 1, den = 1;
|
||||||
|
gint i = 3 - pos;
|
||||||
|
|
||||||
while (i < 0) {
|
while (i < 0) {
|
||||||
den *= 10;
|
den *= 10;
|
||||||
|
@ -937,16 +940,15 @@ convert_to_millisecs (gint decimals, gint pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
|
||||||
const gchar * property_name, gint64 default_value, gint64 * property_value,
|
const gchar * property_name, guint64 default_value,
|
||||||
gboolean allow_negative)
|
guint64 * property_value)
|
||||||
{
|
{
|
||||||
xmlChar *prop_string;
|
xmlChar *prop_string;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
gint ret, read, len, pos, posT;
|
gint ret, len, pos, posT;
|
||||||
gint years = 0, months = 0, days = 0, hours = 0, minutes = 0, seconds =
|
guint years = 0, months = 0, days = 0, hours = 0, minutes = 0, seconds =
|
||||||
0, decimals = 0;
|
0, decimals = 0, read;
|
||||||
gint sign = 1;
|
|
||||||
gboolean have_ms = FALSE;
|
gboolean have_ms = FALSE;
|
||||||
gboolean exists = FALSE;
|
gboolean exists = FALSE;
|
||||||
|
|
||||||
|
@ -956,26 +958,9 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
len = xmlStrlen (prop_string);
|
len = xmlStrlen (prop_string);
|
||||||
str = (gchar *) prop_string;
|
str = (gchar *) prop_string;
|
||||||
GST_TRACE ("duration: %s, len %d", str, len);
|
GST_TRACE ("duration: %s, len %d", str, len);
|
||||||
/* read "-" for sign, if present */
|
if (strchr (str, '-') != NULL) {
|
||||||
pos = strcspn (str, "-");
|
GST_WARNING ("'-' sign found while parsing unsigned duration");
|
||||||
if (pos < len) { /* found "-" */
|
goto error;
|
||||||
if (pos != 0) {
|
|
||||||
GST_WARNING ("sign \"-\" non at the beginning of the string");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
GST_TRACE ("found - sign at the beginning");
|
|
||||||
if (!allow_negative) {
|
|
||||||
GST_WARNING ("sign \"-\" not allowed for property '%s'", property_name);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
sign = -1;
|
|
||||||
str++;
|
|
||||||
len--;
|
|
||||||
/* look for another "-" sign */
|
|
||||||
if (strcspn (str, "-") != len) {
|
|
||||||
GST_WARNING ("found a second \"-\" sign");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* read "P" for period */
|
/* read "P" for period */
|
||||||
pos = strcspn (str, "P");
|
pos = strcspn (str, "P");
|
||||||
|
@ -994,7 +979,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
do {
|
do {
|
||||||
GST_TRACE ("parsing substring %s", str);
|
GST_TRACE ("parsing substring %s", str);
|
||||||
pos = strcspn (str, "YMD");
|
pos = strcspn (str, "YMD");
|
||||||
ret = sscanf (str, "%d", &read);
|
ret = sscanf (str, "%u", &read);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
GST_WARNING ("can not read integer value from string %s!", str);
|
GST_WARNING ("can not read integer value from string %s!", str);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1014,12 +999,12 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GST_TRACE ("read number %d type %c", read, str[pos]);
|
GST_TRACE ("read number %u type %c", read, str[pos]);
|
||||||
str += (pos + 1);
|
str += (pos + 1);
|
||||||
posT -= (pos + 1);
|
posT -= (pos + 1);
|
||||||
} while (posT > 0);
|
} while (posT > 0);
|
||||||
|
|
||||||
GST_TRACE ("Y:M:D=%d:%d:%d", years, months, days);
|
GST_TRACE ("Y:M:D=%u:%u:%u", years, months, days);
|
||||||
}
|
}
|
||||||
/* read "T" for time (if present) */
|
/* read "T" for time (if present) */
|
||||||
/* here T is at pos == 0 */
|
/* here T is at pos == 0 */
|
||||||
|
@ -1032,7 +1017,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
do {
|
do {
|
||||||
GST_TRACE ("parsing substring %s", str);
|
GST_TRACE ("parsing substring %s", str);
|
||||||
pos = strcspn (str, "HMS,.");
|
pos = strcspn (str, "HMS,.");
|
||||||
ret = sscanf (str, "%d", &read);
|
ret = sscanf (str, "%u", &read);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
GST_WARNING ("can not read integer value from string %s!", str);
|
GST_WARNING ("can not read integer value from string %s!", str);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1048,7 +1033,7 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
if (have_ms) {
|
if (have_ms) {
|
||||||
/* we have read the decimal part of the seconds */
|
/* we have read the decimal part of the seconds */
|
||||||
decimals = convert_to_millisecs (read, pos);
|
decimals = convert_to_millisecs (read, pos);
|
||||||
GST_TRACE ("decimal number %d (%d digits) -> %d ms", read, pos,
|
GST_TRACE ("decimal number %u (%d digits) -> %d ms", read, pos,
|
||||||
decimals);
|
decimals);
|
||||||
} else {
|
} else {
|
||||||
/* no decimals */
|
/* no decimals */
|
||||||
|
@ -1066,20 +1051,20 @@ gst_mpdparser_get_xml_prop_duration_inner (xmlNode * a_node,
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GST_TRACE ("read number %d type %c", read, str[pos]);
|
GST_TRACE ("read number %u type %c", read, str[pos]);
|
||||||
str += pos + 1;
|
str += pos + 1;
|
||||||
len -= (pos + 1);
|
len -= (pos + 1);
|
||||||
} while (len > 0);
|
} while (len > 0);
|
||||||
|
|
||||||
GST_TRACE ("H:M:S.MS=%d:%d:%d.%03d", hours, minutes, seconds, decimals);
|
GST_TRACE ("H:M:S.MS=%u:%u:%u.%03u", hours, minutes, seconds, decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlFree (prop_string);
|
xmlFree (prop_string);
|
||||||
exists = TRUE;
|
exists = TRUE;
|
||||||
*property_value =
|
*property_value =
|
||||||
sign * ((((((gint64) years * 365 + months * 30 + days) * 24 +
|
(((((guint64) years * 365 + months * 30 + days) * 24 +
|
||||||
hours) * 60 + minutes) * 60 + seconds) * 1000 + decimals);
|
hours) * 60 + minutes) * 60 + seconds) * 1000 + decimals;
|
||||||
GST_LOG (" - %s: %" G_GINT64_FORMAT, property_name, *property_value);
|
GST_LOG (" - %s: %" G_GUINT64_FORMAT, property_name, *property_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exists;
|
return exists;
|
||||||
|
@ -1089,22 +1074,6 @@ error:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
|
|
||||||
const gchar * property_name, gint64 default_value, gint64 * property_value)
|
|
||||||
{
|
|
||||||
return gst_mpdparser_get_xml_prop_duration_inner (a_node, property_name,
|
|
||||||
default_value, property_value, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_mpdparser_get_xml_prop_duration_unsigned (xmlNode * a_node,
|
|
||||||
const gchar * property_name, gint64 default_value, gint64 * property_value)
|
|
||||||
{
|
|
||||||
return gst_mpdparser_get_xml_prop_duration_inner (a_node, property_name,
|
|
||||||
default_value, property_value, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpdparser_get_xml_node_content (xmlNode * a_node, gchar ** content)
|
gst_mpdparser_get_xml_node_content (xmlNode * a_node, gchar ** content)
|
||||||
{
|
{
|
||||||
|
@ -1972,11 +1941,12 @@ gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_mpdparser_get_xml_prop_string (a_node, "id", &new_period->id);
|
gst_mpdparser_get_xml_prop_string (a_node, "id", &new_period->id);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "start", -1, &new_period->start);
|
gst_mpdparser_get_xml_prop_duration (a_node, "start", GST_MPD_DURATION_NONE,
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "duration", -1,
|
&new_period->start);
|
||||||
&new_period->duration);
|
gst_mpdparser_get_xml_prop_duration (a_node, "duration",
|
||||||
gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching",
|
GST_MPD_DURATION_NONE, &new_period->duration);
|
||||||
FALSE, &new_period->bitstreamSwitching);
|
gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching", FALSE,
|
||||||
|
&new_period->bitstreamSwitching);
|
||||||
|
|
||||||
/* explore children nodes */
|
/* explore children nodes */
|
||||||
for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
|
for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
|
||||||
|
@ -2061,10 +2031,10 @@ gst_mpdparser_parse_metrics_range_node (GList ** list, xmlNode * a_node)
|
||||||
*list = g_list_append (*list, new_metrics_range);
|
*list = g_list_append (*list, new_metrics_range);
|
||||||
|
|
||||||
GST_LOG ("attributes of Metrics Range node:");
|
GST_LOG ("attributes of Metrics Range node:");
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "starttime", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "starttime",
|
||||||
&new_metrics_range->starttime);
|
GST_MPD_DURATION_NONE, &new_metrics_range->starttime);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "duration", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "duration",
|
||||||
&new_metrics_range->duration);
|
GST_MPD_DURATION_NONE, &new_metrics_range->duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2162,20 +2132,20 @@ gst_mpdparser_parse_root_node (GstMPDNode ** pointer, xmlNode * a_node)
|
||||||
&new_mpd->availabilityStartTime);
|
&new_mpd->availabilityStartTime);
|
||||||
gst_mpdparser_get_xml_prop_dateTime (a_node, "availabilityEndTime",
|
gst_mpdparser_get_xml_prop_dateTime (a_node, "availabilityEndTime",
|
||||||
&new_mpd->availabilityEndTime);
|
&new_mpd->availabilityEndTime);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "mediaPresentationDuration", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "mediaPresentationDuration",
|
||||||
&new_mpd->mediaPresentationDuration);
|
GST_MPD_DURATION_NONE, &new_mpd->mediaPresentationDuration);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "minimumUpdatePeriod", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "minimumUpdatePeriod",
|
||||||
&new_mpd->minimumUpdatePeriod);
|
GST_MPD_DURATION_NONE, &new_mpd->minimumUpdatePeriod);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "minBufferTime", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "minBufferTime",
|
||||||
&new_mpd->minBufferTime);
|
GST_MPD_DURATION_NONE, &new_mpd->minBufferTime);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "timeShiftBufferDepth", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "timeShiftBufferDepth",
|
||||||
&new_mpd->timeShiftBufferDepth);
|
GST_MPD_DURATION_NONE, &new_mpd->timeShiftBufferDepth);
|
||||||
gst_mpdparser_get_xml_prop_duration_unsigned (a_node,
|
gst_mpdparser_get_xml_prop_duration (a_node, "suggestedPresentationDelay",
|
||||||
"suggestedPresentationDelay", -1, &new_mpd->suggestedPresentationDelay);
|
GST_MPD_DURATION_NONE, &new_mpd->suggestedPresentationDelay);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "maxSegmentDuration", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "maxSegmentDuration",
|
||||||
&new_mpd->maxSegmentDuration);
|
GST_MPD_DURATION_NONE, &new_mpd->maxSegmentDuration);
|
||||||
gst_mpdparser_get_xml_prop_duration (a_node, "maxSubsegmentDuration", -1,
|
gst_mpdparser_get_xml_prop_duration (a_node, "maxSubsegmentDuration",
|
||||||
&new_mpd->maxSubsegmentDuration);
|
GST_MPD_DURATION_NONE, &new_mpd->maxSubsegmentDuration);
|
||||||
|
|
||||||
/* explore children Period nodes */
|
/* explore children Period nodes */
|
||||||
for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
|
for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
|
||||||
|
@ -3348,7 +3318,7 @@ gst_mpdparser_parse_baseURL (GstMpdClient * client, GstActiveStream * stream,
|
||||||
|
|
||||||
static GstClockTime
|
static GstClockTime
|
||||||
gst_mpd_client_get_segment_duration (GstMpdClient * client,
|
gst_mpd_client_get_segment_duration (GstMpdClient * client,
|
||||||
GstActiveStream * stream, gint64 * scale_dur)
|
GstActiveStream * stream, guint64 * scale_dur)
|
||||||
{
|
{
|
||||||
GstStreamPeriod *stream_period;
|
GstStreamPeriod *stream_period;
|
||||||
GstMultSegmentBaseType *base = NULL;
|
GstMultSegmentBaseType *base = NULL;
|
||||||
|
@ -3760,7 +3730,7 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream,
|
||||||
} else {
|
} else {
|
||||||
GstClockTime duration;
|
GstClockTime duration;
|
||||||
GstStreamPeriod *stream_period;
|
GstStreamPeriod *stream_period;
|
||||||
gint64 scale_dur;
|
guint64 scale_dur;
|
||||||
|
|
||||||
g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
|
g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType->
|
||||||
SegmentTimeline == NULL, FALSE);
|
SegmentTimeline == NULL, FALSE);
|
||||||
|
@ -3789,7 +3759,7 @@ gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpd_client_add_media_segment (GstActiveStream * stream,
|
gst_mpd_client_add_media_segment (GstActiveStream * stream,
|
||||||
GstSegmentURLNode * url_node, guint number, gint repeat,
|
GstSegmentURLNode * url_node, guint number, gint repeat,
|
||||||
gint64 scale_start, gint64 scale_duration,
|
guint64 scale_start, guint64 scale_duration,
|
||||||
GstClockTime start, GstClockTime duration)
|
GstClockTime start, GstClockTime duration)
|
||||||
{
|
{
|
||||||
GstMediaSegment *media_segment;
|
GstMediaSegment *media_segment;
|
||||||
|
@ -3932,7 +3902,7 @@ gst_mpd_client_setup_representation (GstMpdClient * client,
|
||||||
SegmentURL = g_list_next (SegmentURL);
|
SegmentURL = g_list_next (SegmentURL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gint64 scale_dur;
|
guint64 scale_dur;
|
||||||
|
|
||||||
duration =
|
duration =
|
||||||
gst_mpd_client_get_segment_duration (client, stream, &scale_dur);
|
gst_mpd_client_get_segment_duration (client, stream, &scale_dur);
|
||||||
|
|
|
@ -67,6 +67,8 @@ typedef struct _GstMultSegmentBaseType GstMultSegmentBaseType;
|
||||||
#define GST_MPD_CLIENT_LOCK(c) g_mutex_lock (&c->lock);
|
#define GST_MPD_CLIENT_LOCK(c) g_mutex_lock (&c->lock);
|
||||||
#define GST_MPD_CLIENT_UNLOCK(c) g_mutex_unlock (&c->lock);
|
#define GST_MPD_CLIENT_UNLOCK(c) g_mutex_unlock (&c->lock);
|
||||||
|
|
||||||
|
#define GST_MPD_DURATION_NONE ((guint64)-1)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GST_STREAM_UNKNOWN,
|
GST_STREAM_UNKNOWN,
|
||||||
|
@ -346,8 +348,8 @@ struct _GstSubsetNode
|
||||||
struct _GstPeriodNode
|
struct _GstPeriodNode
|
||||||
{
|
{
|
||||||
gchar *id;
|
gchar *id;
|
||||||
gint64 start; /* [ms] */
|
guint64 start; /* [ms] */
|
||||||
gint64 duration; /* [ms] */
|
guint64 duration; /* [ms] */
|
||||||
gboolean bitstreamSwitching;
|
gboolean bitstreamSwitching;
|
||||||
/* SegmentBase node */
|
/* SegmentBase node */
|
||||||
GstSegmentBaseType *SegmentBase;
|
GstSegmentBaseType *SegmentBase;
|
||||||
|
@ -378,8 +380,8 @@ struct _GstProgramInformationNode
|
||||||
|
|
||||||
struct _GstMetricsRangeNode
|
struct _GstMetricsRangeNode
|
||||||
{
|
{
|
||||||
gint64 starttime; /* [ms] */
|
guint64 starttime; /* [ms] */
|
||||||
gint64 duration; /* [ms] */
|
guint64 duration; /* [ms] */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMetricsNode
|
struct _GstMetricsNode
|
||||||
|
@ -408,13 +410,13 @@ struct _GstMPDNode
|
||||||
GstMPDFileType type;
|
GstMPDFileType type;
|
||||||
GstDateTime *availabilityStartTime;
|
GstDateTime *availabilityStartTime;
|
||||||
GstDateTime *availabilityEndTime;
|
GstDateTime *availabilityEndTime;
|
||||||
gint64 mediaPresentationDuration; /* [ms] */
|
guint64 mediaPresentationDuration; /* [ms] */
|
||||||
gint64 minimumUpdatePeriod; /* [ms] */
|
guint64 minimumUpdatePeriod; /* [ms] */
|
||||||
gint64 minBufferTime; /* [ms] */
|
guint64 minBufferTime; /* [ms] */
|
||||||
gint64 timeShiftBufferDepth; /* [ms] */
|
guint64 timeShiftBufferDepth; /* [ms] */
|
||||||
gint64 suggestedPresentationDelay; /* [ms] */
|
guint64 suggestedPresentationDelay; /* [ms] */
|
||||||
gint64 maxSegmentDuration; /* [ms] */
|
guint64 maxSegmentDuration; /* [ms] */
|
||||||
gint64 maxSubsegmentDuration; /* [ms] */
|
guint64 maxSubsegmentDuration; /* [ms] */
|
||||||
/* list of BaseURL nodes */
|
/* list of BaseURL nodes */
|
||||||
GList *BaseURLs;
|
GList *BaseURLs;
|
||||||
/* list of Location nodes */
|
/* list of Location nodes */
|
||||||
|
@ -452,8 +454,8 @@ struct _GstMediaSegment
|
||||||
GstSegmentURLNode *SegmentURL; /* this is NULL when using a SegmentTemplate */
|
GstSegmentURLNode *SegmentURL; /* this is NULL when using a SegmentTemplate */
|
||||||
guint number; /* segment number */
|
guint number; /* segment number */
|
||||||
gint repeat; /* number of extra repetitions (0 = played only once) */
|
gint repeat; /* number of extra repetitions (0 = played only once) */
|
||||||
gint64 scale_start; /* start time in timescale units */
|
guint64 scale_start; /* start time in timescale units */
|
||||||
gint64 scale_duration; /* duration in timescale units */
|
guint64 scale_duration; /* duration in timescale units */
|
||||||
GstClockTime start; /* segment start time */
|
GstClockTime start; /* segment start time */
|
||||||
GstClockTime duration; /* segment duration */
|
GstClockTime duration; /* segment duration */
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,26 +128,26 @@ GST_START_TEST (dash_mpdparser_mpd)
|
||||||
assert_equals_int (gst_date_time_get_minute (availabilityEndTime), 10);
|
assert_equals_int (gst_date_time_get_minute (availabilityEndTime), 10);
|
||||||
assert_equals_int (gst_date_time_get_second (availabilityEndTime), 50);
|
assert_equals_int (gst_date_time_get_second (availabilityEndTime), 50);
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->mediaPresentationDuration,
|
assert_equals_uint64 (mpdclient->mpd_node->mediaPresentationDuration,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->minimumUpdatePeriod,
|
assert_equals_uint64 (mpdclient->mpd_node->minimumUpdatePeriod,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->minBufferTime,
|
assert_equals_uint64 (mpdclient->mpd_node->minBufferTime,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->timeShiftBufferDepth,
|
assert_equals_uint64 (mpdclient->mpd_node->timeShiftBufferDepth,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->suggestedPresentationDelay,
|
assert_equals_uint64 (mpdclient->mpd_node->suggestedPresentationDelay,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->maxSegmentDuration,
|
assert_equals_uint64 (mpdclient->mpd_node->maxSegmentDuration,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
assert_equals_int64 (mpdclient->mpd_node->maxSubsegmentDuration,
|
assert_equals_uint64 (mpdclient->mpd_node->maxSubsegmentDuration,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
}
|
}
|
||||||
|
@ -301,10 +301,10 @@ GST_START_TEST (dash_mpdparser_metrics_range)
|
||||||
metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data;
|
metricsNode = (GstMetricsNode *) mpdclient->mpd_node->Metrics->data;
|
||||||
assert_equals_pointer (metricsNode->metrics, NULL);
|
assert_equals_pointer (metricsNode->metrics, NULL);
|
||||||
metricsRangeNode = (GstMetricsRangeNode *) metricsNode->MetricsRanges->data;
|
metricsRangeNode = (GstMetricsRangeNode *) metricsNode->MetricsRanges->data;
|
||||||
assert_equals_int64 (metricsRangeNode->starttime,
|
assert_equals_uint64 (metricsRangeNode->starttime,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 500));
|
||||||
assert_equals_int64 (metricsRangeNode->duration,
|
assert_equals_uint64 (metricsRangeNode->duration,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 123));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 123));
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
}
|
}
|
||||||
|
@ -362,10 +362,10 @@ GST_START_TEST (dash_mpdparser_period)
|
||||||
|
|
||||||
periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
|
periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
|
||||||
assert_equals_string (periodNode->id, "TestId");
|
assert_equals_string (periodNode->id, "TestId");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 123));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 123));
|
||||||
assert_equals_int64 (periodNode->duration,
|
assert_equals_uint64 (periodNode->duration,
|
||||||
(gint64) duration_to_ms (0, 1, 2, 12, 10, 20, 765));
|
duration_to_ms (0, 1, 2, 12, 10, 20, 765));
|
||||||
assert_equals_int (periodNode->bitstreamSwitching, 1);
|
assert_equals_int (periodNode->bitstreamSwitching, 1);
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
|
@ -2728,50 +2728,50 @@ GST_START_TEST (dash_mpdparser_various_duration_formats)
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 0);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 0);
|
||||||
assert_equals_string (periodNode->id, "Period0");
|
assert_equals_string (periodNode->id, "Period0");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 0));
|
duration_to_ms (0, 0, 0, 0, 0, 1, 0));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 1);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 1);
|
||||||
assert_equals_string (periodNode->id, "Period1");
|
assert_equals_string (periodNode->id, "Period1");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 500));
|
duration_to_ms (0, 0, 0, 0, 0, 1, 500));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 2);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 2);
|
||||||
assert_equals_string (periodNode->id, "Period2");
|
assert_equals_string (periodNode->id, "Period2");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 0, 0, 0, 1, 700));
|
duration_to_ms (0, 0, 0, 0, 0, 1, 700));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 3);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 3);
|
||||||
assert_equals_string (periodNode->id, "Period3");
|
assert_equals_string (periodNode->id, "Period3");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 0, 0, 1, 0, 0));
|
duration_to_ms (0, 0, 0, 0, 1, 0, 0));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 4);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 4);
|
||||||
assert_equals_string (periodNode->id, "Period4");
|
assert_equals_string (periodNode->id, "Period4");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 0, 1, 0, 0, 0));
|
duration_to_ms (0, 0, 0, 1, 0, 0, 0));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 5);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 5);
|
||||||
assert_equals_string (periodNode->id, "Period5");
|
assert_equals_string (periodNode->id, "Period5");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 0, 1, 0, 0, 0, 0));
|
duration_to_ms (0, 0, 1, 0, 0, 0, 0));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 6);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 6);
|
||||||
assert_equals_string (periodNode->id, "Period6");
|
assert_equals_string (periodNode->id, "Period6");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (0, 1, 0, 0, 0, 0, 0));
|
duration_to_ms (0, 1, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
periodNode =
|
periodNode =
|
||||||
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 7);
|
(GstPeriodNode *) g_list_nth_data (mpdclient->mpd_node->Periods, 7);
|
||||||
assert_equals_string (periodNode->id, "Period7");
|
assert_equals_string (periodNode->id, "Period7");
|
||||||
assert_equals_int64 (periodNode->start,
|
assert_equals_uint64 (periodNode->start,
|
||||||
(gint64) duration_to_ms (1, 0, 0, 0, 0, 0, 0));
|
duration_to_ms (1, 0, 0, 0, 0, 0, 0));
|
||||||
|
|
||||||
gst_mpd_client_free (mpdclient);
|
gst_mpd_client_free (mpdclient);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue