vlc | branch: master | Jean-Paul Saman <jean-paul.sa...@m2x.nl> | Wed May 11 12:45:36 2011 +0200| [cd00c9c5935bed7bfdf0c30104f8b1e945cf6fc2] | committer: Jean-Paul Saman
stream_filter/httplive.c: #EXTINF: accepts integer (version < 3) or floating points based on protocol version. Update logic in parse_SegmentationInformation() to accept float values for duration as mentioned in later version of the draft specification. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd00c9c5935bed7bfdf0c30104f8b1e945cf6fc2 --- modules/stream_filter/httplive.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 5ce7e78..5f07c0d 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -29,6 +29,7 @@ #endif #include <limits.h> +#include <errno.h> #include <vlc_common.h> #include <vlc_plugin.h> @@ -515,7 +516,30 @@ static int parse_SegmentInformation(hls_stream_t *hls, char *p_read, int *durati if (token == NULL) return VLC_EGENERIC; - *duration = atoi(token); + int value; + if (hls->version < 3) + { + value = strtol(token, NULL, 10); + if (errno == ERANGE) + { + *duration = -1; + return VLC_EGENERIC; + } + *duration = value; + } + else + { + double d = strtod(token, (char **) NULL); + if (errno == ERANGE) + { + *duration = -1; + return VLC_EGENERIC; + } + if ((d) - ((int)d) >= 0.5) + value = ((int)d) + 1; + else + value = ((int)d); + } /* Ignore the rest of the line */ _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org http://mailman.videolan.org/listinfo/vlc-commits