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("bufferwindow", RAX_64UINT);
stream.addField("bootmsoffset", RAX_64INT);
stream.addField("utcoffset", RAX_64INT);
stream.addField("minfragduration", RAX_64UINT);
stream.setRCount(1);
stream.setReady();
@ -1183,6 +1184,7 @@ namespace DTSC{
streamMaxKeepAwayField = stream.getFieldData("maxkeepaway");
streamBufferWindowField = stream.getFieldData("bufferwindow");
streamBootMsOffsetField = stream.getFieldData("bootmsoffset");
streamUTCOffsetField = stream.getFieldData("utcoffset");
streamMinimumFragmentDurationField = stream.getFieldData("minfragduration");
trackValidField = trackList.getFieldData("valid");
@ -2088,6 +2090,12 @@ namespace DTSC{
stream.setInt(streamBootMsOffsetField, bootMsOffset);
}
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*/
void Meta::setMinimumFragmentDuration(uint64_t fragmentDuration){
stream.setInt(streamMinimumFragmentDurationField, fragmentDuration);

View file

@ -419,6 +419,9 @@ namespace DTSC{
void setBootMsOffset(int64_t bootMsOffset);
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> getMySourceTracks(size_t pid) const;
@ -497,6 +500,7 @@ namespace DTSC{
Util::RelAccXFieldData streamMaxKeepAwayField;
Util::RelAccXFieldData streamBufferWindowField;
Util::RelAccXFieldData streamBootMsOffsetField;
Util::RelAccXFieldData streamUTCOffsetField;
Util::RelAccXFieldData streamMinimumFragmentDurationField;
Util::RelAccXFieldData trackValidField;

View file

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

View file

@ -505,8 +505,16 @@ namespace Mist{
}
json_resp["type"] = (M.getLive() ? "live" : "vod");
if (M.getLive()){
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!
M.toJSON(json_resp["meta"], true);