Add method endTime() to outputs to get end of stream time in ms

This commit is contained in:
Thulinma 2016-08-02 21:58:03 +02:00
parent 09fbe27651
commit 2c44be003c
2 changed files with 15 additions and 0 deletions

View file

@ -466,6 +466,20 @@ namespace Mist {
return buffer.begin()->time;
}
///Return the end time of the VoD asset, or 0 if unknown.
uint64_t Output::endTime(){
if (myMeta.live){return 0;}
uint64_t end = 0;
for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it)){
if (end < myMeta.tracks[*it].lastms){
end = myMeta.tracks[*it].lastms;
}
}
}
return end;
}
/// Prepares all tracks from selectedTracks for seeking to the specified ms position.
void Output::seek(unsigned long long pos){
sought = true;

View file

@ -47,6 +47,7 @@ namespace Mist {
bool seek(unsigned int tid, unsigned long long pos, bool getNextKey = false);
void stop();
uint64_t currentTime();
uint64_t endTime();
void setBlocking(bool blocking);
long unsigned int getMainSelectedTrack();
void updateMeta();