Commit e8bfbde1 authored by Christopher Mueller's avatar Christopher Mueller Committed by Hugo Beauzée-Luyssen

dash: added IS namespace and getprofile to domparser

Signed-off-by: default avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
parent 24abb523
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "DOMParser.h" #include "DOMParser.h"
using namespace dash::xml; using namespace dash::xml;
using namespace dash::mpd;
DOMParser::DOMParser (stream_t *stream) : DOMParser::DOMParser (stream_t *stream) :
root( NULL ), root( NULL ),
...@@ -132,21 +133,35 @@ void DOMParser::print (Node *node, int offset) ...@@ -132,21 +133,35 @@ void DOMParser::print (Node *node, int offset)
this->print(node->getSubNodes().at(i), offset); this->print(node->getSubNodes().at(i), offset);
} }
} }
void DOMParser::print () void DOMParser::print ()
{ {
this->print(this->root, 0); this->print(this->root, 0);
} }
bool DOMParser::isDash (stream_t *stream) bool DOMParser::isDash (stream_t *stream)
{ {
const char* psz_namespace = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011"; const char* psz_namespaceDIS = "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011";
const char* psz_namespaceIS = "urn:mpeg:DASH:schema:MPD:2011";
const uint8_t *peek; const uint8_t *peek;
int peek_size = stream_Peek(stream, &peek, 1024); int peek_size = stream_Peek(stream, &peek, 1024);
if (peek_size < (int)strlen(psz_namespace)) if (peek_size < (int)strlen(psz_namespaceDIS))
return false; return false;
std::string header((const char*)peek, peek_size); std::string header((const char*)peek, peek_size);
return header.find(psz_namespace) != std::string::npos; return (header.find(psz_namespaceDIS) != std::string::npos) || (header.find(psz_namespaceIS) != std::string::npos);
}
Profile DOMParser::getProfile ()
{
if(this->root == NULL)
return dash::mpd::UnknownProfile;
const std::string profile = this->root->getAttributeValue("profiles");
if(!profile.compare("urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm"))
return dash::mpd::BasicCM;
if(!profile.compare("urn:mpeg:dash:profile:isoff-main:2011"))
return dash::mpd::IsoffMain;
return dash::mpd::UnknownProfile;
} }
...@@ -55,6 +55,7 @@ namespace dash ...@@ -55,6 +55,7 @@ namespace dash
Node* getRootNode (); Node* getRootNode ();
void print (); void print ();
static bool isDash (stream_t *stream); static bool isDash (stream_t *stream);
mpd::Profile getProfile ();
private: private:
Node *root; Node *root;
......
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