Updated FLV library to use DTSC::Meta instead of JSON::Value

This commit is contained in:
Thulinma 2013-11-28 15:57:30 +01:00
parent 9e44dde4a1
commit 5536bf89f9
2 changed files with 9 additions and 11 deletions

View file

@ -310,7 +310,7 @@ namespace Connector_RTMP {
///\param inputBuffer A buffer filled with chunk data.
void parseChunk(Socket::Buffer & inputBuffer){
//for DTSC conversion
static JSON::Value meta_out;
static DTSC::Meta meta_out;
static std::stringstream prebuffer; // Temporary buffer before sending real data
static bool sending = false;
static unsigned int counter = 0;
@ -424,7 +424,7 @@ namespace Connector_RTMP {
if (ss.connected()){
if (streamReset){
//reset push data to empty, in case stream properties change
meta_out.null();
meta_out.reset();
prebuffer.str("");
sending = false;
counter = 0;
@ -437,15 +437,15 @@ namespace Connector_RTMP {
counter++;
if (counter > 8){
sending = true;
ss.SendNow(meta_out.toNetPacked());
ss.SendNow(prebuffer.str().c_str(), prebuffer.str().size()); //write buffer
meta_out.send(ss);
ss.SendNow(prebuffer.str()); //write buffer
prebuffer.str(""); //clear buffer
ss.SendNow(pack_out.toNetPacked());
pack_out.sendTo(ss);
}else{
prebuffer << pack_out.toNetPacked();
}
}else{
ss.SendNow(pack_out.toNetPacked());
pack_out.sendTo(ss);
}
}
}else{

View file

@ -24,7 +24,7 @@ namespace Converters {
///\return The return code for the converter.
int FLV2DTSC(std::ostream & output){
FLV::Tag FLV_in; // Temporary storage for incoming FLV data.
JSON::Value meta_out; // Storage for outgoing header data.
DTSC::Meta meta_out; // Storage for outgoing header data.
JSON::Value pack_out; // Storage for outgoing data.
std::stringstream prebuffer; // Temporary buffer before sending real data
bool sending = false;
@ -40,8 +40,7 @@ namespace Converters {
counter++;
if (counter > 8){
sending = true;
meta_out["moreheader"] = 0LL;
output << meta_out.toNetPacked();
output << meta_out.toJSON().toNetPacked();
output << prebuffer.rdbuf();
prebuffer.str("");
std::cerr << "Buffer done, starting real-time output..." << std::endl;
@ -58,8 +57,7 @@ namespace Converters {
// if the FLV input is very short, do output it correctly...
if ( !sending){
std::cerr << "EOF - outputting buffer..." << std::endl;
meta_out["moreheader"] = 0LL;
output << meta_out.toNetPacked();
output << meta_out.toJSON().toNetPacked();
output << prebuffer.rdbuf();
}
std::cerr << "Done! If you output this data to a file, don't forget to run MistDTSCFix next." << std::endl;