Fixed new style lastData() function
This commit is contained in:
parent
3e559fdffd
commit
5be3774e3c
2 changed files with 2 additions and 10 deletions
11
lib/dtsc.cpp
11
lib/dtsc.cpp
|
@ -12,7 +12,6 @@ char DTSC::Magic_Packet2[] = "DTP2";
|
||||||
/// Initializes a DTSC::Stream with only one packet buffer.
|
/// Initializes a DTSC::Stream with only one packet buffer.
|
||||||
DTSC::Stream::Stream(){
|
DTSC::Stream::Stream(){
|
||||||
datapointertype = DTSC::INVALID;
|
datapointertype = DTSC::INVALID;
|
||||||
datapointer = 0;
|
|
||||||
buffercount = 1;
|
buffercount = 1;
|
||||||
buffertime = 0;
|
buffertime = 0;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +20,6 @@ DTSC::Stream::Stream(){
|
||||||
/// The actual buffer count may not at all times be the requested amount.
|
/// The actual buffer count may not at all times be the requested amount.
|
||||||
DTSC::Stream::Stream(unsigned int rbuffers, unsigned int bufferTime){
|
DTSC::Stream::Stream(unsigned int rbuffers, unsigned int bufferTime){
|
||||||
datapointertype = DTSC::INVALID;
|
datapointertype = DTSC::INVALID;
|
||||||
datapointer = 0;
|
|
||||||
if (rbuffers < 1){
|
if (rbuffers < 1){
|
||||||
rbuffers = 1;
|
rbuffers = 1;
|
||||||
}
|
}
|
||||||
|
@ -182,11 +180,6 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
buffers[newPos].toNetPacked();//make sure package is packed and ready
|
buffers[newPos].toNetPacked();//make sure package is packed and ready
|
||||||
datapointertype = INVALID;
|
datapointertype = INVALID;
|
||||||
///\todo Save keyframes when they arrive.
|
///\todo Save keyframes when they arrive.
|
||||||
if (newPack.isMember("data")){
|
|
||||||
datapointer = &(buffers[newPos]["data"].strVal);
|
|
||||||
}else{
|
|
||||||
datapointer = 0;
|
|
||||||
}
|
|
||||||
std::string tmp = "";
|
std::string tmp = "";
|
||||||
if (newPack.isMember("trackid")){
|
if (newPack.isMember("trackid")){
|
||||||
tmp = getTrackById(newPack["trackid"].asInt())["type"].asString();
|
tmp = getTrackById(newPack["trackid"].asInt())["type"].asString();
|
||||||
|
@ -229,7 +222,7 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
if (keySize){
|
if (keySize){
|
||||||
metadata["tracks"][trackMapping[newPos.trackID]]["keys"][keySize - 1]["parts"].append((long long int)newPack["data"].asString().size());
|
metadata["tracks"][trackMapping[newPos.trackID]]["keys"][keySize - 1]["parts"].append((long long int)newPack["data"].asString().size());
|
||||||
}
|
}
|
||||||
metadata["live"] = true;
|
metadata["live"] = 1ll;
|
||||||
}
|
}
|
||||||
unsigned int timeBuffered = 0;
|
unsigned int timeBuffered = 0;
|
||||||
if (keySize > 1){
|
if (keySize > 1){
|
||||||
|
@ -254,7 +247,7 @@ void DTSC::Stream::addPacket(JSON::Value & newPack){
|
||||||
/// Returns a direct pointer to the data attribute of the last received packet, if available.
|
/// Returns a direct pointer to the data attribute of the last received packet, if available.
|
||||||
/// Returns NULL if no valid pointer or packet is available.
|
/// Returns NULL if no valid pointer or packet is available.
|
||||||
std::string & DTSC::Stream::lastData(){
|
std::string & DTSC::Stream::lastData(){
|
||||||
return *datapointer;
|
return buffers.rbegin()->second["data"].strVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the packet in this buffer number.
|
/// Returns the packet in this buffer number.
|
||||||
|
|
|
@ -210,7 +210,6 @@ namespace DTSC {
|
||||||
std::map<livePos,JSON::Value> buffers;
|
std::map<livePos,JSON::Value> buffers;
|
||||||
std::map<int,std::set<livePos> > keyframes;
|
std::map<int,std::set<livePos> > keyframes;
|
||||||
void addPacket(JSON::Value & newPack);
|
void addPacket(JSON::Value & newPack);
|
||||||
std::string * datapointer;
|
|
||||||
datatype datapointertype;
|
datatype datapointertype;
|
||||||
unsigned int buffercount;
|
unsigned int buffercount;
|
||||||
unsigned int buffertime;
|
unsigned int buffertime;
|
||||||
|
|
Loading…
Add table
Reference in a new issue