Commit fe955928 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: parse hls resolution

parent 86bfdbad
...@@ -120,6 +120,7 @@ void Parser::parseRepresentation(BaseAdaptationSet *adaptSet, const AttributesTa ...@@ -120,6 +120,7 @@ void Parser::parseRepresentation(BaseAdaptationSet *adaptSet, const AttributesTa
const Attribute *uriAttr = tag->getAttributeByName("URI"); const Attribute *uriAttr = tag->getAttributeByName("URI");
const Attribute *bwAttr = tag->getAttributeByName("BANDWIDTH"); const Attribute *bwAttr = tag->getAttributeByName("BANDWIDTH");
const Attribute *codecsAttr = tag->getAttributeByName("CODECS"); const Attribute *codecsAttr = tag->getAttributeByName("CODECS");
const Attribute *resAttr = tag->getAttributeByName("RESOLUTION");
Representation *rep = new (std::nothrow) Representation(adaptSet); Representation *rep = new (std::nothrow) Representation(adaptSet);
if(rep) if(rep)
...@@ -147,6 +148,16 @@ void Parser::parseRepresentation(BaseAdaptationSet *adaptSet, const AttributesTa ...@@ -147,6 +148,16 @@ void Parser::parseRepresentation(BaseAdaptationSet *adaptSet, const AttributesTa
if(codecsAttr && codecsAttr->quotedString().find(',') != std::string::npos) if(codecsAttr && codecsAttr->quotedString().find(',') != std::string::npos)
rep->setMimeType("video/mp2t"); rep->setMimeType("video/mp2t");
if(resAttr)
{
std::pair<int, int> res = resAttr->getResolution();
if(res.first * res.second)
{
rep->setWidth(res.first);
rep->setHeight(res.second);
}
}
parseSegments(rep, tagslist); parseSegments(rep, tagslist);
adaptSet->addRepresentation(rep); adaptSet->addRepresentation(rep);
......
...@@ -89,6 +89,25 @@ std::pair<std::size_t,std::size_t> Attribute::getByteRange() const ...@@ -89,6 +89,25 @@ std::pair<std::size_t,std::size_t> Attribute::getByteRange() const
return ret; return ret;
} }
std::pair<int, int> Attribute::getResolution() const
{
int w = 0, h = 0;
std::istringstream is(value);
if(!is.eof())
{
is >> w;
if(!is.eof())
{
char c = is.get();
if(c == 'x' && !is.eof())
is >> h;
}
}
return std::make_pair(w, h);
}
std::string Attribute::quotedString() const std::string Attribute::quotedString() const
{ {
if(value.length() < 2) if(value.length() < 2)
......
...@@ -47,6 +47,7 @@ namespace hls ...@@ -47,6 +47,7 @@ namespace hls
double floatingPoint() const; double floatingPoint() const;
std::vector<uint8_t> hexSequence() const; std::vector<uint8_t> hexSequence() const;
std::pair<std::size_t,std::size_t> getByteRange() const; std::pair<std::size_t,std::size_t> getByteRange() const;
std::pair<int, int> getResolution() const;
std::string name; std::string name;
std::string value; std::string value;
......
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