Commit 9d7819b9 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: hls: fix integer reading

parent 565dd315
......@@ -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() << "-";
......
......@@ -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();
}
......
......@@ -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)
......
......@@ -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());
......
......@@ -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
{
......
......@@ -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;
......
......@@ -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());
}
......
......@@ -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();
......
......@@ -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;
......
......@@ -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());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment