Commit de45860f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Allow SegmentTimeline to be queried for a "S" element.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 8158205e)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent eaf97ac6
......@@ -26,6 +26,8 @@
#include <vlc_common.h>
#include <vlc_arrays.h>
#include <iostream>
using namespace dash::mpd;
SegmentTimeline::SegmentTimeline() :
......@@ -53,6 +55,28 @@ void dash::mpd::SegmentTimeline::addElement(dash::mpd::SegmentTimeline::Element
this->elements.push_back( e );
}
const SegmentTimeline::Element* SegmentTimeline::getElement( mtime_t dts ) const
{
if ( this->elements.size() == 0 )
return NULL;
int64_t targetT = dts * this->timescale / 1000000;
targetT -= this->elements.front()->t;
std::list<Element*>::const_iterator it = this->elements.begin();
std::list<Element*>::const_iterator end = this->elements.end();
const Element* res = NULL;
while ( it != end )
{
if ( (*it)->t > targetT )
return res;
res = *it;
++it;
}
std::cerr << "No more element to be used." << std::endl;
return NULL;
}
dash::mpd::SegmentTimeline::Element::Element() :
r( 0 )
{
......
......@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <list>
#include <stdint.h>
#include <vlc_common.h>
namespace dash
{
......@@ -47,6 +48,7 @@ namespace dash
int getTimescale() const;
void setTimescale( int timescale );
void addElement( Element* e );
const Element* getElement( mtime_t dts ) const;
private:
int timescale;
......
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