Added utcoffset field to metadata to display VoD program time if supported by output

This commit is contained in:
Marco van Dijk 2021-10-28 16:28:37 +02:00 committed by Thulinma
parent 19d7c9fe07
commit 684df4b23d
4 changed files with 23 additions and 2 deletions

View file

@ -1151,6 +1151,7 @@ namespace DTSC{
stream.addField("maxkeepaway", RAX_16UINT); stream.addField("maxkeepaway", RAX_16UINT);
stream.addField("bufferwindow", RAX_64UINT); stream.addField("bufferwindow", RAX_64UINT);
stream.addField("bootmsoffset", RAX_64INT); stream.addField("bootmsoffset", RAX_64INT);
stream.addField("utcoffset", RAX_64INT);
stream.addField("minfragduration", RAX_64UINT); stream.addField("minfragduration", RAX_64UINT);
stream.setRCount(1); stream.setRCount(1);
stream.setReady(); stream.setReady();
@ -1183,6 +1184,7 @@ namespace DTSC{
streamMaxKeepAwayField = stream.getFieldData("maxkeepaway"); streamMaxKeepAwayField = stream.getFieldData("maxkeepaway");
streamBufferWindowField = stream.getFieldData("bufferwindow"); streamBufferWindowField = stream.getFieldData("bufferwindow");
streamBootMsOffsetField = stream.getFieldData("bootmsoffset"); streamBootMsOffsetField = stream.getFieldData("bootmsoffset");
streamUTCOffsetField = stream.getFieldData("utcoffset");
streamMinimumFragmentDurationField = stream.getFieldData("minfragduration"); streamMinimumFragmentDurationField = stream.getFieldData("minfragduration");
trackValidField = trackList.getFieldData("valid"); trackValidField = trackList.getFieldData("valid");
@ -2088,6 +2090,12 @@ namespace DTSC{
stream.setInt(streamBootMsOffsetField, bootMsOffset); stream.setInt(streamBootMsOffsetField, bootMsOffset);
} }
int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);} int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);}
void Meta::setUTCOffset(int64_t UTCOffset){
stream.setInt(streamUTCOffsetField, UTCOffset);
}
int64_t Meta::getUTCOffset() const{return stream.getInt(streamUTCOffsetField);}
/*LTS-START*/ /*LTS-START*/
void Meta::setMinimumFragmentDuration(uint64_t fragmentDuration){ void Meta::setMinimumFragmentDuration(uint64_t fragmentDuration){
stream.setInt(streamMinimumFragmentDurationField, fragmentDuration); stream.setInt(streamMinimumFragmentDurationField, fragmentDuration);

View file

@ -419,6 +419,9 @@ namespace DTSC{
void setBootMsOffset(int64_t bootMsOffset); void setBootMsOffset(int64_t bootMsOffset);
int64_t getBootMsOffset() const; int64_t getBootMsOffset() const;
void setUTCOffset(int64_t UTCOffset);
int64_t getUTCOffset() const;
std::set<size_t> getValidTracks(bool skipEmpty = false) const; std::set<size_t> getValidTracks(bool skipEmpty = false) const;
std::set<size_t> getMySourceTracks(size_t pid) const; std::set<size_t> getMySourceTracks(size_t pid) const;
@ -497,6 +500,7 @@ namespace DTSC{
Util::RelAccXFieldData streamMaxKeepAwayField; Util::RelAccXFieldData streamMaxKeepAwayField;
Util::RelAccXFieldData streamBufferWindowField; Util::RelAccXFieldData streamBufferWindowField;
Util::RelAccXFieldData streamBootMsOffsetField; Util::RelAccXFieldData streamBootMsOffsetField;
Util::RelAccXFieldData streamUTCOffsetField;
Util::RelAccXFieldData streamMinimumFragmentDurationField; Util::RelAccXFieldData streamMinimumFragmentDurationField;
Util::RelAccXFieldData trackValidField; Util::RelAccXFieldData trackValidField;

View file

@ -746,6 +746,7 @@ namespace Mist{
} }
tsStream.clear(); tsStream.clear();
// set bootMsOffset in order to display the program time correctly in the player // set bootMsOffset in order to display the program time correctly in the player
meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS()));
meta.setBootMsOffset(streamOffset); meta.setBootMsOffset(streamOffset);
return true; return true;
} }
@ -837,8 +838,8 @@ namespace Mist{
} }
// set bootMsOffset in order to display the program time correctly in the player // set bootMsOffset in order to display the program time correctly in the player
meta.setUTCOffset(streamOffset + (Util::unixMS() - Util::bootMS()));
meta.setBootMsOffset(streamOffset); meta.setBootMsOffset(streamOffset);
if (streamIsLive || isLiveDVR){return true;} if (streamIsLive || isLiveDVR){return true;}
// Set local vars used for parsing existing headers // Set local vars used for parsing existing headers

View file

@ -505,7 +505,15 @@ namespace Mist{
} }
json_resp["type"] = (M.getLive() ? "live" : "vod"); json_resp["type"] = (M.getLive() ? "live" : "vod");
if (M.getLive()){ if (M.getLive()){
json_resp["unixoffset"] = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS()); if (M.getUTCOffset()){
json_resp["unixoffset"] = M.getUTCOffset();
}else{
json_resp["unixoffset"] = M.getBootMsOffset() + (Util::unixMS() - Util::bootMS());
}
}else{
if (M.getUTCOffset()){
json_resp["unixoffset"] = M.getUTCOffset();
}
} }
// show ALL the meta datas! // show ALL the meta datas!