From 5536bf89f987b847ed4d9440b6cc7dcbb9e1f782 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 28 Nov 2013 15:57:30 +0100 Subject: [PATCH] Updated FLV library to use DTSC::Meta instead of JSON::Value --- src/connectors/conn_rtmp.cpp | 12 ++++++------ src/converters/flv2dtsc.cpp | 8 +++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/connectors/conn_rtmp.cpp b/src/connectors/conn_rtmp.cpp index d0fdf978..a6f62954 100644 --- a/src/connectors/conn_rtmp.cpp +++ b/src/connectors/conn_rtmp.cpp @@ -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{ diff --git a/src/converters/flv2dtsc.cpp b/src/converters/flv2dtsc.cpp index 1d4c1a23..fd23035d 100644 --- a/src/converters/flv2dtsc.cpp +++ b/src/converters/flv2dtsc.cpp @@ -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;