Implemented basic version of DTSC::RetimedPacket
This commit is contained in:
parent
9104d68a5d
commit
a984243d56
2 changed files with 20 additions and 3 deletions
19
lib/dtsc.h
19
lib/dtsc.h
|
@ -129,7 +129,7 @@ namespace DTSC {
|
||||||
void appendNal(const char * appendData, uint32_t appendLen);
|
void appendNal(const char * appendData, uint32_t appendLen);
|
||||||
void upgradeNal(const char * appendData, uint32_t appendLen);
|
void upgradeNal(const char * appendData, uint32_t appendLen);
|
||||||
void setKeyFrame(bool kf);
|
void setKeyFrame(bool kf);
|
||||||
long long unsigned int getTime() const;
|
virtual long long unsigned int getTime() const;
|
||||||
long int getTrackId() const;
|
long int getTrackId() const;
|
||||||
char * getData() const;
|
char * getData() const;
|
||||||
int getDataLen() const;
|
int getDataLen() const;
|
||||||
|
@ -150,6 +150,23 @@ namespace DTSC {
|
||||||
uint64_t prevNalSize;
|
uint64_t prevNalSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A child class of DTSC::Packet, which allows overriding the packet time efficiently.
|
||||||
|
class RetimedPacket : public Packet {
|
||||||
|
public:
|
||||||
|
RetimedPacket(uint64_t reTime){
|
||||||
|
timeOverride = reTime;
|
||||||
|
}
|
||||||
|
RetimedPacket(uint64_t reTime, const Packet & rhs) : Packet(rhs){
|
||||||
|
timeOverride = reTime;
|
||||||
|
}
|
||||||
|
RetimedPacket(uint64_t reTime, const char * data_, unsigned int len, bool noCopy = false) : Packet(data_, len, noCopy){
|
||||||
|
timeOverride = reTime;
|
||||||
|
}
|
||||||
|
virtual long long unsigned int getTime() const{return timeOverride;}
|
||||||
|
protected:
|
||||||
|
uint64_t timeOverride;
|
||||||
|
};
|
||||||
|
|
||||||
/// A simple structure used for ordering byte seek positions.
|
/// A simple structure used for ordering byte seek positions.
|
||||||
struct livePos {
|
struct livePos {
|
||||||
livePos() {
|
livePos() {
|
||||||
|
|
|
@ -303,9 +303,9 @@ namespace Mist {
|
||||||
//First memcpy only the payload to the destination
|
//First memcpy only the payload to the destination
|
||||||
//Leaves the 20 bytes inbetween empty to ensure the data is not accidentally read before it is complete
|
//Leaves the 20 bytes inbetween empty to ensure the data is not accidentally read before it is complete
|
||||||
memcpy(myPage.mapped + curOffset + 20, pack.getData() + 20, pack.getDataLen() - 20);
|
memcpy(myPage.mapped + curOffset + 20, pack.getData() + 20, pack.getDataLen() - 20);
|
||||||
//Copy the remaing values in reverse order:
|
//Copy the remaining values in reverse order:
|
||||||
//8 byte timestamp
|
//8 byte timestamp
|
||||||
memcpy(myPage.mapped + curOffset + 12, pack.getData() + 12, 8);
|
Bit::htobll(myPage.mapped + curOffset + 12, pack.getTime());
|
||||||
//The mapped track id
|
//The mapped track id
|
||||||
((int *)(myPage.mapped + curOffset + 8))[0] = htonl(mapTid);
|
((int *)(myPage.mapped + curOffset + 8))[0] = htonl(mapTid);
|
||||||
int size = Bit::btohl(pack.getData() + 4);
|
int size = Bit::btohl(pack.getData() + 4);
|
||||||
|
|
Loading…
Add table
Reference in a new issue