[vlc-commits] demux: hls: fix integer reading
Francois Cartegnie
git at videolan.org
Wed Feb 10 20:35:09 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Feb 10 20:10:15 2016 +0100| [9d7819b98105ef8695d65be565ef1c116b2ad991] | committer: Francois Cartegnie
demux: hls: fix integer reading
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d7819b98105ef8695d65be565ef1c116b2ad991
---
modules/demux/adaptative/http/HTTPConnection.cpp | 3 +++
modules/demux/adaptative/playlist/ID.cpp | 1 +
modules/demux/adaptative/playlist/Segment.cpp | 1 +
modules/demux/adaptative/playlist/SegmentTimeline.cpp | 1 +
modules/demux/adaptative/tools/Conversions.cpp | 1 +
modules/demux/adaptative/tools/Conversions.hpp | 1 +
modules/demux/dash/mpd/Representation.cpp | 5 +++++
modules/demux/hls/playlist/HLSSegment.cpp | 1 +
modules/demux/hls/playlist/Tags.cpp | 3 +++
modules/demux/smooth/playlist/Representation.cpp | 2 ++
10 files changed, 19 insertions(+)
diff --git a/modules/demux/adaptative/http/HTTPConnection.cpp b/modules/demux/adaptative/http/HTTPConnection.cpp
index e2a7cee..dd148ea 100644
--- a/modules/demux/adaptative/http/HTTPConnection.cpp
+++ b/modules/demux/adaptative/http/HTTPConnection.cpp
@@ -179,6 +179,7 @@ int HTTPConnection::parseReply()
return VLC_ENOOBJ;
std::istringstream ss(line.substr(9));
+ ss.imbue(std::locale("C"));
int replycode;
ss >> replycode;
if (replycode != 200 && replycode != 206)
@@ -239,6 +240,7 @@ void HTTPConnection::onHeader(const std::string &key,
if(key == "Content-Length")
{
std::istringstream ss(value);
+ ss.imbue(std::locale("C"));
size_t length;
ss >> length;
contentLength = length;
@@ -264,6 +266,7 @@ std::string HTTPConnection::buildRequestHeader(const std::string &path) const
std::string HTTPConnection::extraRequestHeaders() const
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
if(bytesRange.isValid())
{
ss << "Range: bytes=" << bytesRange.getStartByte() << "-";
diff --git a/modules/demux/adaptative/playlist/ID.cpp b/modules/demux/adaptative/playlist/ID.cpp
index 00137f5..a475a40 100644
--- a/modules/demux/adaptative/playlist/ID.cpp
+++ b/modules/demux/adaptative/playlist/ID.cpp
@@ -30,6 +30,7 @@ ID::ID(const std::string &id_)
ID::ID(uint64_t id_)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << "default_id#" << id_;
id = ss.str();
}
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index f23d37f..d196d2b 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -123,6 +123,7 @@ size_t ISegment::getOffset() const
void ISegment::debug(vlc_object_t *obj, int indent) const
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << std::string(indent, ' ') << debugName << " #" << getSequenceNumber();
ss << " url=" << getUrlSegment().toString();
if(startByte!=endByte)
diff --git a/modules/demux/adaptative/playlist/SegmentTimeline.cpp b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
index 489b9fa..f249a56 100644
--- a/modules/demux/adaptative/playlist/SegmentTimeline.cpp
+++ b/modules/demux/adaptative/playlist/SegmentTimeline.cpp
@@ -274,6 +274,7 @@ bool SegmentTimeline::Element::contains(stime_t time) const
void SegmentTimeline::Element::debug(vlc_object_t *obj, int indent) const
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << std::string(indent + 1, ' ') << "Element #" << number
<< " d=" << d << " r=" << r << " @t=" << t;
msg_Dbg(obj, "%s", ss.str().c_str());
diff --git a/modules/demux/adaptative/tools/Conversions.cpp b/modules/demux/adaptative/tools/Conversions.cpp
index 8f2c16b..126626d 100644
--- a/modules/demux/adaptative/tools/Conversions.cpp
+++ b/modules/demux/adaptative/tools/Conversions.cpp
@@ -96,6 +96,7 @@ UTCTime::UTCTime(const std::string &str)
enum { UTCTIME_YEAR = 0, UTCTIME_MON, UTCTIME_DAY, UTCTIME_HOUR, UTCTIME_MIN, UTCTIME_SEC, UTCTIME_MSEC, UTCTIME_TZ };
int values[8] = {0};
std::istringstream in(str);
+ in.imbue(std::locale("C"));
try
{
diff --git a/modules/demux/adaptative/tools/Conversions.hpp b/modules/demux/adaptative/tools/Conversions.hpp
index 9068445..bbc9d3f 100644
--- a/modules/demux/adaptative/tools/Conversions.hpp
+++ b/modules/demux/adaptative/tools/Conversions.hpp
@@ -57,6 +57,7 @@ template<typename T> class Integer
try
{
std::istringstream in(str);
+ in.imbue(std::locale("C"));
in >> value;
} catch (int) {
value = 0;
diff --git a/modules/demux/dash/mpd/Representation.cpp b/modules/demux/dash/mpd/Representation.cpp
index 1f88d9c..ff5f5e5 100644
--- a/modules/demux/dash/mpd/Representation.cpp
+++ b/modules/demux/dash/mpd/Representation.cpp
@@ -102,6 +102,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(pos != std::string::npos)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << getScaledTimeBySegmentNumber(number, templ);
ret.replace(pos, std::string("$Time$").length(), ss.str());
}
@@ -110,6 +111,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(pos != std::string::npos)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << getLiveTemplateNumberOffset(number, templ);
ret.replace(pos, std::string("$Number$").length(), ss.str());
}
@@ -124,6 +126,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(fmtend != std::string::npos)
{
std::istringstream iss(ret.substr(fmtstart, fmtend - fmtstart + 1));
+ iss.imbue(std::locale("C"));
try
{
size_t width;
@@ -131,6 +134,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if (iss.peek() != '$' && iss.peek() != 'd')
throw VLC_EGENERIC;
std::stringstream oss;
+ oss.imbue(std::locale("C"));
oss.width(width); /* set format string length */
oss.fill('0');
oss << getLiveTemplateNumberOffset(number, templ);
@@ -145,6 +149,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(pos != std::string::npos)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << getBandwidth();
ret.replace(pos, std::string("$Bandwidth$").length(), ss.str());
}
diff --git a/modules/demux/hls/playlist/HLSSegment.cpp b/modules/demux/hls/playlist/HLSSegment.cpp
index c7130a9..a9d4b5d 100644
--- a/modules/demux/hls/playlist/HLSSegment.cpp
+++ b/modules/demux/hls/playlist/HLSSegment.cpp
@@ -136,6 +136,7 @@ void HLSSegment::setEncryption(SegmentEncryption &enc)
void HLSSegment::debug(vlc_object_t *obj, int indent) const
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << std::string(indent, ' ') << debugName <<
" #" << (getSequenceNumber() - Segment::SEQUENCE_FIRST) <<
" url=" << getUrlSegment().toString();
diff --git a/modules/demux/hls/playlist/Tags.cpp b/modules/demux/hls/playlist/Tags.cpp
index 9c25fc4..9e890f5 100644
--- a/modules/demux/hls/playlist/Tags.cpp
+++ b/modules/demux/hls/playlist/Tags.cpp
@@ -37,6 +37,7 @@ Attribute::Attribute(const std::string &name_, const std::string &value_)
uint64_t Attribute::decimal() const
{
std::istringstream is(value);
+ is.imbue(std::locale("C"));
uint64_t ret;
is >> ret;
return ret;
@@ -72,6 +73,7 @@ std::pair<std::size_t,std::size_t> Attribute::getByteRange() const
std::size_t length = 0;
std::size_t offset = 0;
std::istringstream is(value);
+ is.imbue(std::locale("C"));
if(!is.eof())
{
@@ -92,6 +94,7 @@ std::pair<int, int> Attribute::getResolution() const
int w = 0, h = 0;
std::istringstream is(value);
+ is.imbue(std::locale("C"));
if(!is.eof())
{
is >> w;
diff --git a/modules/demux/smooth/playlist/Representation.cpp b/modules/demux/smooth/playlist/Representation.cpp
index 1e79431..3d87a2d 100644
--- a/modules/demux/smooth/playlist/Representation.cpp
+++ b/modules/demux/smooth/playlist/Representation.cpp
@@ -56,6 +56,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(pos != std::string::npos)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << templ->segmentTimeline.Get()->getScaledPlaybackTimeByElementNumber(number);
ret.replace(pos, std::string("{start_time}").length(), ss.str());
}
@@ -67,6 +68,7 @@ std::string Representation::contextualize(size_t number, const std::string &comp
if(pos != std::string::npos)
{
std::stringstream ss;
+ ss.imbue(std::locale("C"));
ss << getBandwidth();
ret.replace(pos, std::string("{bitrate}").length(), ss.str());
}
More information about the vlc-commits
mailing list