Added/improved start/endTime functions in Output class

This commit is contained in:
Thulinma 2016-09-02 14:31:54 +02:00
parent 1aeecc53bd
commit 63ea74d792
2 changed files with 23 additions and 5 deletions

View file

@ -466,10 +466,26 @@ namespace Mist {
return buffer.begin()->time; return buffer.begin()->time;
} }
///Return the end time of the VoD asset, or 0 if unknown. ///Return the start time of the selected tracks.
uint64_t Output::startTime(){
uint64_t start = 0xFFFFFFFFFFFFFFFFull;
if (selectedTracks.size()){
for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it)){
if (start < myMeta.tracks[*it].firstms){
start = myMeta.tracks[*it].firstms;
}
}
}
}
return start;
}
///Return the end time of the selected tracks, or 0 if unknown or live.
uint64_t Output::endTime(){ uint64_t Output::endTime(){
if (myMeta.live){return 0;} if (myMeta.live){return 0;}
uint64_t end = 0; uint64_t end = 0;
if (selectedTracks.size()){
for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){ for (std::set<long unsigned int>::iterator it = selectedTracks.begin(); it != selectedTracks.end(); it++){
if (myMeta.tracks.count(*it)){ if (myMeta.tracks.count(*it)){
if (end < myMeta.tracks[*it].lastms){ if (end < myMeta.tracks[*it].lastms){
@ -477,6 +493,7 @@ namespace Mist {
} }
} }
} }
}
return end; return end;
} }

View file

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