Commit 2a18a3bf authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptative: add getFirstDTS

parent 25930fef
......@@ -150,6 +150,19 @@ mtime_t PlaylistManager::getPCR() const
return pcr;
}
mtime_t PlaylistManager::getFirstDTS() const
{
mtime_t dts = VLC_TS_INVALID;
for(int type=0; type<StreamTypeCount; type++)
{
if(!streams[type])
continue;
if(dts == VLC_TS_INVALID || dts > streams[type]->getFirstDTS())
dts = streams[type]->getFirstDTS();
}
return dts;
}
int PlaylistManager::getGroup() const
{
for(int type=0; type<StreamTypeCount; type++)
......
......@@ -55,6 +55,7 @@ namespace adaptative
Stream::status demux(mtime_t);
mtime_t getDuration() const;
mtime_t getPCR() const;
mtime_t getFirstDTS() const;
int getGroup() const;
int esCount() const;
bool setPosition(mtime_t);
......
......@@ -107,6 +107,11 @@ mtime_t Stream::getPCR() const
return output->getPCR();
}
mtime_t Stream::getFirstDTS() const
{
return output->getFirstDTS();
}
int Stream::getGroup() const
{
return output->getGroup();
......@@ -314,6 +319,30 @@ BaseStreamOutput::~BaseStreamOutput()
vlc_mutex_destroy(&lock);
}
mtime_t BaseStreamOutput::getFirstDTS() const
{
mtime_t ret = VLC_TS_INVALID;
vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
std::list<Demuxed *>::const_iterator it;
for(it=queues.begin(); it!=queues.end();++it)
{
const Demuxed *pair = *it;
const block_t *p_block = pair->p_queue;
while( p_block && p_block->i_dts == VLC_TS_INVALID )
{
p_block = p_block->p_next;
}
if(p_block)
{
ret = p_block->i_dts;
break;
}
}
vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
return ret;
}
int BaseStreamOutput::esCount() const
{
return queues.size();
......
......@@ -65,6 +65,7 @@ namespace adaptative
SegmentTracker *, AbstractStreamOutputFactory &);
bool isEOF() const;
mtime_t getPCR() const;
mtime_t getFirstDTS() const;
int getGroup() const;
int esCount() const;
bool seekAble() const;
......@@ -95,6 +96,7 @@ namespace adaptative
virtual void pushBlock(block_t *) = 0;
virtual mtime_t getPCR() const;
virtual mtime_t getFirstDTS() const = 0;
virtual int getGroup() const;
virtual int esCount() const = 0;
virtual bool seekAble() const = 0;
......@@ -127,6 +129,7 @@ namespace adaptative
BaseStreamOutput(demux_t *, const std::string &);
virtual ~BaseStreamOutput();
virtual void pushBlock(block_t *); /* reimpl */
virtual mtime_t getFirstDTS() const; /* reimpl */
virtual int esCount() const; /* reimpl */
virtual bool seekAble() const; /* reimpl */
virtual void setPosition(mtime_t); /* reimpl */
......
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