diff --git a/.gitignore b/.gitignore index 54844bb9..a342da04 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ libtool *.flv *.json server.html* +*.js.h diff --git a/Makefile.am b/Makefile.am index ad7432b7..6eaf62a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ SUBDIRS=src -EXTRA_DIST=server.html server.html.h VERSION lsp/*.js lsp/*.html lsp/*.css +EXTRA_DIST=server.html server.html.h VERSION lsp/*.js lsp/*.html lsp/*.css src/embed.js* docs: doxygen ./Doxyfile > /dev/null .PHONY: docs diff --git a/src/Makefile.am b/src/Makefile.am index c46e8e50..18bdd0b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,17 +1,3 @@ -AM_CPPFLAGS = $(MIST_CFLAGS) -LDADD = $(MIST_LIBS) -SUBDIRS=converters analysers -bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic -MistBuffer_SOURCES=buffer.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp tinythread.cpp tinythread.h ../VERSION -MistBuffer_LDADD=$(MIST_LIBS) -lpthread -MistController_SOURCES=controller.cpp ../VERSION ../server.html.h -MistConnRAW_SOURCES=conn_raw.cpp ../VERSION -MistConnRTMP_SOURCES=conn_rtmp.cpp ../VERSION -MistConnHTTP_SOURCES=conn_http.cpp tinythread.cpp tinythread.h ../VERSION -MistConnHTTP_LDADD=$(MIST_LIBS) -lpthread -MistConnHTTPProgressive_SOURCES=conn_http_progressive.cpp ../VERSION -MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION - ../lsp/uncompressed.js: ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js cat ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js > ../lsp/uncompressed.js ../lsp/compressed.js: ../lsp/uncompressed.js @@ -26,3 +12,23 @@ MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION cat ../lsp/footer.html >> ../server.html ../server.html.h: ../server.html xxd -i ../server.html ../server.html.h +./embed.js.h: ./embed.js + mv embed.js tmp.js + java -jar ../lsp/jscompiler.jar < tmp.js > embed.js + xxd -i embed.js embed.js.h + mv tmp.js embed.js + +AM_CPPFLAGS = $(MIST_CFLAGS) +LDADD = $(MIST_LIBS) +SUBDIRS=converters analysers +bin_PROGRAMS=MistBuffer MistController MistConnRAW MistConnRTMP MistConnHTTP MistConnHTTPProgressive MistConnHTTPDynamic +MistBuffer_SOURCES=buffer.cpp buffer_user.h buffer_user.cpp buffer_stream.h buffer_stream.cpp tinythread.cpp tinythread.h ../VERSION +MistBuffer_LDADD=$(MIST_LIBS) -lpthread +MistController_SOURCES=controller.cpp ../VERSION ../server.html.h +MistConnRAW_SOURCES=conn_raw.cpp ../VERSION +MistConnRTMP_SOURCES=conn_rtmp.cpp ../VERSION +MistConnHTTP_SOURCES=conn_http.cpp tinythread.cpp tinythread.h ../VERSION ./embed.js.h +MistConnHTTP_LDADD=$(MIST_LIBS) -lpthread +MistConnHTTPProgressive_SOURCES=conn_http_progressive.cpp ../VERSION +MistConnHTTPDynamic_SOURCES=conn_http_dynamic.cpp ../VERSION + diff --git a/src/conn_http.cpp b/src/conn_http.cpp index 8ce0814a..45bfef59 100644 --- a/src/conn_http.cpp +++ b/src/conn_http.cpp @@ -18,6 +18,7 @@ #include #include #include "tinythread.h" +#include "embed.js.h" /// Holds everything unique to HTTP Connector. namespace Connector_HTTP{ @@ -164,7 +165,9 @@ namespace Connector_HTTP{ } response += "mistvideo['" + streamname + "'] = "+json_resp.toString()+";\n"; if (url.substr(0, 6) != "/info_" && !json_resp.isMember("error")){ - response += "\n\nif(!mistvideo.hasSupport||!mistvideo.buildPlayer){mistvideo.flashVersion=function(){var version=0;try{version=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description.replace(/([^0-9\\.])/g,'').split('.')[0];}catch(e){}try{version=new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable(\"$version\").replace(/([^0-9\\,])/g,'').split(',')[0];}catch(e){}return version;};mistvideo.supports={flashversion:parseInt(mistvideo.flashVersion(),10)};mistvideo.hasSupport=function(type){switch(type){case'f4v':return mistvideo.supports.flashversion>=11;break;case'rtmp':return mistvideo.supports.flashversion>=10;break;case'flv':return mistvideo.supports.flashversion>=7;break;default:return false;}};mistvideo.buildPlayer=function(src,container,width,height){switch(src.type){case'f4v':case'rtmp':case'flv':container.innerHTML='';break;}};}var video=mistvideo['"+streamname+"'],container=document.createElement('div'),scripts=document.getElementsByTagName('script'),me=scripts[scripts.length-1];me.parentNode.insertBefore(container,me);container.setAttribute('class','mistvideo');me.parentNode.removeChild(me);if(video.error){container.innerHTML=['Error: ',video.error,''].join('');}else if(video.source.length<1){container.innerHTML='Error: no streams found';}else{var i,videofoundPlayer=false,len=video.source.length;for(i=0;iSend(H.BuildResponse("200", "OK"));