[vlc-commits] dash: Store the parent representation for every segments.
Hugo Beauzée-Luyssen
git at videolan.org
Thu Feb 2 14:40:23 CET 2012
vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Jan 25 18:08:59 2012 +0100| [ec59c3fbcd576701e598d74bf5d30cc18cb97676] | committer: Hugo Beauzée-Luyssen
dash: Store the parent representation for every segments.
Conflicts:
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.h
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec59c3fbcd576701e598d74bf5d30cc18cb97676
---
modules/stream_filter/dash/mpd/BasicCMParser.cpp | 2 +-
modules/stream_filter/dash/mpd/IsoffMainParser.cpp | 8 +++++---
modules/stream_filter/dash/mpd/IsoffMainParser.h | 1 +
modules/stream_filter/dash/mpd/Segment.cpp | 14 +++++++++-----
modules/stream_filter/dash/mpd/Segment.h | 5 ++++-
modules/stream_filter/dash/mpd/SegmentTemplate.cpp | 8 ++++----
6 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 9979ec3..fc0b0ea 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -404,7 +404,7 @@ Segment* BasicCMParser::parseSegment( Node* node )
seg = new SegmentTemplate( runtimeToken, this->currentRepresentation );
}
else
- seg = new Segment;
+ seg = new Segment( this->currentRepresentation );
if ( url.find( this->p_stream->psz_access ) != 0 ) //Relative url
url = this->url + url;
seg->setSourceUrl( url );
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index c2bedd8..c965e4c 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -34,7 +34,8 @@ using namespace dash::xml;
IsoffMainParser::IsoffMainParser (Node *root, stream_t *p_stream) :
root (root),
p_stream (p_stream),
- mpd (NULL)
+ mpd (NULL),
+ currentRepresentation( NULL )
{
}
IsoffMainParser::~IsoffMainParser ()
@@ -113,6 +114,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
for(size_t i = 0; i < representations.size(); i++)
{
Representation *rep = new Representation;
+ this->currentRepresentation = rep;
this->setSegmentBase(representations.at(i), rep);
this->setSegmentList(representations.at(i), rep);
rep->setBandwidth(atoi(representations.at(i)->getAttributeValue("bandwidth").c_str()));
@@ -148,7 +150,7 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
if(initSeg.size() > 0)
{
- Segment *seg = new Segment();
+ Segment *seg = new Segment( this->currentRepresentation );
seg->setSourceUrl(initSeg.at(0)->getAttributeValue("sourceURL"));
if(initSeg.at(0)->hasAttribute("range"))
@@ -170,7 +172,7 @@ void IsoffMainParser::setSegments (dash::xml::Node *segListNode, Segme
for(size_t i = 0; i < segments.size(); i++)
{
- Segment *seg = new Segment();
+ Segment *seg = new Segment( this->currentRepresentation );
seg->setSourceUrl(segments.at(i)->getAttributeValue("media"));
if(segments.at(0)->hasAttribute("mediaRange"))
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.h b/modules/stream_filter/dash/mpd/IsoffMainParser.h
index 069ddaa..404ccfb 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.h
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.h
@@ -62,6 +62,7 @@ namespace dash
dash::xml::Node *root;
stream_t *p_stream;
MPD *mpd;
+ Representation *currentRepresentation;
void setMPDAttributes ();
void setMPDBaseUrl ();
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 44d4d74..25a3493 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -30,11 +30,11 @@
using namespace dash::mpd;
using namespace dash::http;
-Segment::Segment () :
- startByte (-1),
- endByte (-1)
+Segment::Segment(const Representation *parent) :
+ startByte (-1),
+ endByte (-1),
+ parentRepresentation( parent )
{
-
}
std::string Segment::getSourceUrl () const
@@ -99,7 +99,6 @@ dash::http::Chunk* Segment::toChunk ()
chunk->addOptionalUrl(ss.str());
ss.clear();
}
-
}
else
{
@@ -108,3 +107,8 @@ dash::http::Chunk* Segment::toChunk ()
return chunk;
}
+
+const Representation *Segment::getParentRepresentation() const
+{
+ return this->parentRepresentation;
+}
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index 55ac6ef..c79c6fb 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -35,10 +35,11 @@ namespace dash
{
namespace mpd
{
+ class Representation;
class Segment
{
public:
- Segment();
+ Segment( const Representation *parent );
virtual ~Segment(){}
virtual std::string getSourceUrl() const;
virtual void setSourceUrl( const std::string &url );
@@ -55,12 +56,14 @@ namespace dash
virtual int getStartByte () const;
virtual int getEndByte () const;
virtual dash::http::Chunk* toChunk ();
+ const Representation* getParentRepresentation() const;
protected:
std::string sourceUrl;
std::vector<BaseUrl *> baseUrls;
int startByte;
int endByte;
+ const Representation* parentRepresentation;
};
}
}
diff --git a/modules/stream_filter/dash/mpd/SegmentTemplate.cpp b/modules/stream_filter/dash/mpd/SegmentTemplate.cpp
index 507b543..5651f4f 100644
--- a/modules/stream_filter/dash/mpd/SegmentTemplate.cpp
+++ b/modules/stream_filter/dash/mpd/SegmentTemplate.cpp
@@ -39,8 +39,8 @@ using namespace dash::mpd;
SegmentTemplate::SegmentTemplate( bool containRuntimeIdentifier,
Representation* representation ) :
+ Segment( representation ),
containRuntimeIdentifier( containRuntimeIdentifier ),
- representation( representation ),
beginTime( std::string::npos ),
beginIndex( std::string::npos ),
currentSegmentIndex( 0 )
@@ -60,10 +60,10 @@ std::string SegmentTemplate::getSourceUrl() const
{
//FIXME: This should use the current representation SegmentInfo
//which "inherits" the SegmentInfoDefault values.
- if ( this->representation->getParentGroup()->getSegmentInfoDefault() != NULL &&
- this->representation->getParentGroup()->getSegmentInfoDefault()->getSegmentTimeline() != NULL )
+ if ( this->parentRepresentation->getParentGroup()->getSegmentInfoDefault() != NULL &&
+ this->parentRepresentation->getParentGroup()->getSegmentInfoDefault()->getSegmentTimeline() != NULL )
{
- const SegmentTimeline::Element *el = this->representation->getParentGroup()->
+ const SegmentTimeline::Element *el = this->parentRepresentation->getParentGroup()->
getSegmentInfoDefault()->getSegmentTimeline()->getElement( this->currentSegmentIndex );
if ( el != NULL )
{
More information about the vlc-commits
mailing list