Minor fixes in the FLV2DTSC Converter

This commit is contained in:
Erik Zandvliet 2013-06-19 13:29:51 +02:00
parent 4f135c7265
commit d1dc4943de

View file

@ -41,23 +41,16 @@ namespace Converters {
if (counter > 8){ if (counter > 8){
sending = true; sending = true;
meta_out["moreheader"] = 0LL; meta_out["moreheader"] = 0LL;
std::string packed_header = meta_out.toNetPacked(); output << meta_out.toNetPacked();
unsigned int size = htonl(packed_header.size());
output << std::string(DTSC::Magic_Header, 4) << std::string((char*) &size, 4) << packed_header;
output << prebuffer.rdbuf();
prebuffer.str(""); prebuffer.str("");
std::cerr << "Buffer done, starting real-time output..." << std::endl; std::cerr << "Buffer done, starting real-time output..." << std::endl;
}else{ }else{
std::string packed_out = pack_out.toNetPacked(); prebuffer << pack_out.toNetPacked();
unsigned int size = htonl(packed_out.size());
prebuffer << std::string(DTSC::Magic_Packet, 4) << std::string((char*) &size, 4) << packed_out;
continue; //don't also write continue; //don't also write
} }
} }
//simply write //simply write
std::string packed_out = pack_out.toNetPacked(); output << pack_out.toNetPacked();
unsigned int size = htonl(packed_out.size());
output << std::string(DTSC::Magic_Packet, 4) << std::string((char*) &size, 4) << packed_out;
} }
} }
@ -65,9 +58,7 @@ namespace Converters {
if ( !sending){ if ( !sending){
std::cerr << "EOF - outputting buffer..." << std::endl; std::cerr << "EOF - outputting buffer..." << std::endl;
meta_out["moreheader"] = 0LL; meta_out["moreheader"] = 0LL;
std::string packed_header = meta_out.toNetPacked(); output << meta_out.toNetPacked();
unsigned int size = htonl(packed_header.size());
output << std::string(DTSC::Magic_Header, 4) << std::string((char*) &size, 4) << packed_header;
output << prebuffer.rdbuf(); output << prebuffer.rdbuf();
} }
std::cerr << "Done! If you output this data to a file, don't forget to run MistDTSCFix next." << std::endl; std::cerr << "Done! If you output this data to a file, don't forget to run MistDTSCFix next." << std::endl;