Skip to content

Commit

Permalink
demux: adaptative: add support for slave demuxers
Browse files Browse the repository at this point in the history
  • Loading branch information
fcartegnie committed Oct 7, 2015
1 parent 60aa97c commit 31c781a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
37 changes: 37 additions & 0 deletions modules/demux/adaptative/plumbing/Demuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,40 @@ int Demuxer::demux(mtime_t)
b_eof = true;
return i_ret;
}

SlaveDemuxer::SlaveDemuxer(demux_t *p_realdemux, const std::string &name, es_out_t *out, AbstractSourceStream *source)
: Demuxer(p_realdemux, name, out, source)
{
length = VLC_TS_INVALID;
b_reinitsonseek = false;
b_startsfromzero = false;
}

SlaveDemuxer::~SlaveDemuxer()
{

}

bool SlaveDemuxer::create()
{
if(Demuxer::create())
{
length = VLC_TS_INVALID;
if(demux_Control(p_demux, DEMUX_GET_LENGTH, &length) != VLC_SUCCESS)
b_eof = true;
return true;
}
return false;
}

int SlaveDemuxer::demux(mtime_t nz_deadline)
{
if( demux_Control(p_demux, DEMUX_SET_NEXT_DEMUX_TIME, VLC_TS_0 + nz_deadline) != VLC_SUCCESS )
{
b_eof = true;
return VLC_DEMUXER_EOF;
}
int ret = Demuxer::demux(nz_deadline);
es_out_Control(p_es_out, ES_OUT_SET_GROUP_PCR, 0, VLC_TS_0 + nz_deadline);
return ret;
}
14 changes: 13 additions & 1 deletion modules/demux/adaptative/plumbing/Demuxer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace adaptative
virtual bool create(); /* impl */
virtual bool restart(CommandsQueue &); /* impl */

private:
protected:
AbstractSourceStream *sourcestream;
demux_t *p_realdemux;
demux_t *p_demux;
Expand All @@ -68,6 +68,18 @@ namespace adaptative
bool b_eof;
};

class SlaveDemuxer : public Demuxer
{
public:
SlaveDemuxer(demux_t *, const std::string &, es_out_t *, AbstractSourceStream *);
virtual ~SlaveDemuxer();
virtual bool create(); /* reimpl */
virtual int demux(mtime_t); /* reimpl */

private:
mtime_t length;
};

}

#endif // DEMUXER_HPP

0 comments on commit 31c781a

Please sign in to comment.