Added a replacement for xxd, fixed a bug in flv.
This commit is contained in:
parent
2599769b9c
commit
453d3ac885
4 changed files with 55 additions and 10 deletions
14
Makefile
14
Makefile
|
@ -172,14 +172,12 @@ $(warning Java not installed - not compressing javascript codes before inclusion
|
|||
CLOSURE=cat
|
||||
endif
|
||||
|
||||
XXD := $(shell which xxd 2> /dev/null)
|
||||
ifndef XXD
|
||||
$(error xxd not installed - cannot continue. Please install xxd)
|
||||
endif
|
||||
sourcery: src/sourcery.cpp
|
||||
$(CXX) -o $@ $(CPPFLAGS) $^
|
||||
|
||||
src/connectors/embed.js.h: src/connectors/embed.js
|
||||
src/connectors/embed.js.h: src/connectors/embed.js sourcery
|
||||
$(CLOSURE) src/connectors/embed.js > embed.min.js
|
||||
xxd -i embed.min.js | sed s/_min_/_/g > src/connectors/embed.js.h
|
||||
./sourcery embed.min.js embed_js > src/connectors/embed.js.h
|
||||
rm embed.min.js
|
||||
|
||||
src/controller/server.html: $(lspDATA) $(lspSOURCES)
|
||||
|
@ -191,8 +189,8 @@ src/controller/server.html: $(lspDATA) $(lspSOURCES)
|
|||
echo "</style>" >> $@
|
||||
cat lsp/footer.html >> $@
|
||||
|
||||
src/controller/server.html.h: src/controller/server.html
|
||||
cd src/controller; xxd -i server.html server.html.h
|
||||
src/controller/server.html.h: src/controller/server.html sourcery
|
||||
cd src/controller; ../../sourcery server.html server_html > server.html.h
|
||||
|
||||
docs: src/* Doxyfile
|
||||
doxygen ./Doxyfile > /dev/null
|
||||
|
|
|
@ -600,7 +600,7 @@ function showTab(tabName,streamName) {
|
|||
)
|
||||
).append(
|
||||
$('<label>').text('The embed code is:').css('overflow','hidden').append(
|
||||
$('<textarea>').val('<div>\n <script src="'+embedbase+'embed_'+streamName+'.js"></script>\n</div>')
|
||||
$('<textarea>').val('<div>\n <script src="'+embedbase+'embed_'+streamName+'.js"></' + 'script>\n</div>')
|
||||
)
|
||||
).append(
|
||||
$('<button>').text('Back').addClass('escape-to-cancel').click(function(){
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace Converters {
|
|||
bool sending = false;
|
||||
unsigned int counter = 0;
|
||||
|
||||
while ( !feof(stdin)){
|
||||
while ( !feof(stdin) && !FLV::Parse_Error){
|
||||
if (FLV_in.FileLoader(stdin)){
|
||||
pack_out = FLV_in.toJSON(meta_out);
|
||||
if (pack_out.isNull()){
|
||||
|
@ -53,6 +53,10 @@ namespace Converters {
|
|||
output << pack_out.toNetPacked();
|
||||
}
|
||||
}
|
||||
if (FLV::Parse_Error){
|
||||
std::cerr << "Conversion failed: " << FLV::Error_Str << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if the FLV input is very short, do output it correctly...
|
||||
if ( !sending){
|
||||
|
|
43
src/sourcery.cpp
Normal file
43
src/sourcery.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
///\file sourcery.cpp
|
||||
///Utility program used for c-string dumping files.
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
if (argc < 3) {
|
||||
std::cerr << "Usage: " << argv[0] << " <inputFile> <variableName>" << std::endl;
|
||||
}
|
||||
std::cout << "const char *" << argv[2] << " = " << std::endl << " \"";
|
||||
int i = 0;
|
||||
int total = 0;
|
||||
std::ifstream inFile(argv[1]);
|
||||
while (inFile.good()){
|
||||
unsigned char thisChar = inFile.get();
|
||||
if (!inFile.good()){break;}
|
||||
switch (thisChar){
|
||||
//Filter special characters.
|
||||
case '\n': std::cout << "\\n"; i += 2; total--; break;
|
||||
case '\r': std::cout << "\\r"; i += 2; total--; break;
|
||||
case '\t': std::cout << "\\t"; i += 2; total--; break;
|
||||
case '\\': std::cout << "\\\\"; i += 2; total --; break;
|
||||
case '\"': std::cout << "\\\""; i += 2; total --; break;
|
||||
default:
|
||||
if (thisChar < 32 || thisChar > 126){
|
||||
//Convert to octal.
|
||||
std::cout << '\\' << std::oct << std::setw(3) << std::setfill('0') << (unsigned int)thisChar << std::dec;
|
||||
i += 4;
|
||||
}else{
|
||||
std::cout << thisChar;
|
||||
i ++;
|
||||
}
|
||||
}
|
||||
if (i >= 80){
|
||||
std::cout << "\" \\" << std::endl << " \"";
|
||||
total += i;
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
std::cout << "\";" << std::endl << "unsigned int " << argv[2] << "_len = " << i + total << ";";
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue