]> git.sesse.net Git - casparcg/commitdiff
2.0.2: INFO TEMPLATE works on both compressed and uncompressed templates.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 28 Nov 2011 10:50:44 +0000 (10:50 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 28 Nov 2011 10:50:44 +0000 (10:50 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1698 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

dlls/zlib1.dll [new file with mode: 0644]
modules/flash/flash.vcxproj
modules/flash/util/swf.cpp [new file with mode: 0644]
modules/flash/util/swf.h [new file with mode: 0644]
shell/shell.vcxproj

diff --git a/dlls/zlib1.dll b/dlls/zlib1.dll
new file mode 100644 (file)
index 0000000..869b00d
Binary files /dev/null and b/dlls/zlib1.dll differ
index 8cee6d31fd1592a542009504b73af8d813f605a1..1b8bdb8f86d4b427436b7937dcb63a543aa8084c 100644 (file)
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
-    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
+    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;$(IncludePath)</IncludePath>\r
+    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;$(IncludePath)</IncludePath>\r
+    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;$(IncludePath)</IncludePath>\r
+    <IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg 0.8\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;$(IncludePath)</IncludePath>\r
     <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg 0.8\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
     <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg 0.8\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
     <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg 0.8\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
diff --git a/modules/flash/util/swf.cpp b/modules/flash/util/swf.cpp
new file mode 100644 (file)
index 0000000..d278a55
--- /dev/null
@@ -0,0 +1,74 @@
+#include "../StdAfx.h"\r
+\r
+#include <common/exception/exceptions.h>\r
+\r
+#include <fstream>\r
+#include <streambuf>\r
+\r
+#include <zlib.h>\r
+\r
+namespace caspar { namespace flash {\r
+       \r
+std::vector<char> decompress_one_file(const std::vector<char>& in_data, uLong buf_size = 5000000)\r
+{\r
+       if(buf_size > 300*1000000)\r
+               BOOST_THROW_EXCEPTION(file_read_error());\r
+\r
+       std::vector<char> out_data(buf_size, 0);\r
+\r
+       auto ret = uncompress((Bytef*)out_data.data(), &buf_size, (Bytef*)in_data.data(), in_data.size());\r
+\r
+       if(ret == Z_BUF_ERROR)\r
+               return decompress_one_file(in_data, buf_size*2);\r
+\r
+       if(ret != Z_OK)\r
+               BOOST_THROW_EXCEPTION(file_read_error());\r
+\r
+       out_data.resize(buf_size);\r
+\r
+       return out_data;\r
+}\r
+\r
+std::wstring read_swf_meta_info(const std::wstring& filename)\r
+{\r
+       auto file = std::fstream(filename, std::ios::in | std::ios::binary);\r
+\r
+       if(!file)\r
+               BOOST_THROW_EXCEPTION(file_read_error());\r
+       \r
+       char head[4] = {};\r
+       file.read(head, 3);\r
+       \r
+       std::vector<char> data;\r
+       \r
+       file.seekg(0, std::ios::end);   \r
+       data.reserve(static_cast<size_t>(file.tellg()));\r
+       file.seekg(0, std::ios::beg);\r
+\r
+       if(strcmp(head, "CWS") == 0)\r
+       {\r
+               file.seekg(8, std::ios::beg);\r
+               std::copy((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>(), std::back_inserter(data));\r
+               data = decompress_one_file(data);\r
+       }\r
+       else\r
+       {\r
+               file.seekg(0, std::ios::end);   \r
+               data.reserve(static_cast<size_t>(file.tellg()));\r
+               file.seekg(0, std::ios::beg);\r
+\r
+               std::copy((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>(), std::back_inserter(data));\r
+       }\r
+       \r
+       std::string beg_str = "<template version";\r
+       std::string end_str = "</template>";\r
+       auto beg_it = std::find_end(data.begin(), data.end(), beg_str.begin(), beg_str.end());\r
+       auto end_it = std::find_end(beg_it, data.end(), end_str.begin(), end_str.end());\r
+       \r
+       if(beg_it == data.end() || end_it == data.end())\r
+               BOOST_THROW_EXCEPTION(file_read_error());\r
+       \r
+       return widen(std::string(beg_it, end_it+end_str.size()));\r
+}\r
+\r
+}}
\ No newline at end of file
diff --git a/modules/flash/util/swf.h b/modules/flash/util/swf.h
new file mode 100644 (file)
index 0000000..fb09527
--- /dev/null
@@ -0,0 +1,9 @@
+#pragma once\r
+\r
+#include <string>\r
+\r
+namespace caspar { namespace flash {\r
+\r
+std::wstring read_swf_meta_info(const std::wstring& filename);\r
+\r
+}}
\ No newline at end of file
index 74cdacbd8d871ef01032ebe058edd285e4bfc842..78b9e74cde565bd431f9acaf1adca6f287d5f565 100644 (file)
     <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg 0.8\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
     <IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg 0.8\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
     <IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\dependencies\BluefishSDK_V5_8_0_31\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg 0.8\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
-    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>\r
+    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;$(LibraryPath)</LibraryPath>\r
+    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;$(LibraryPath)</LibraryPath>\r
+    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;$(LibraryPath)</LibraryPath>\r
+    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_8_0_31\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg 0.8\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;$(LibraryPath)</LibraryPath>\r
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
       <ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
     </ClCompile>\r
     <Link>\r
-      <AdditionalDependencies>sfml-system-d.lib;sfml-audio-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib</AdditionalDependencies>\r
+      <AdditionalDependencies>sfml-system-d.lib;sfml-audio-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
       <Version>\r
       </Version>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
@@ -232,7 +232,7 @@ copy "$(ProjectDir)casparcg.config" "$(OutDir)"</Command>
       </Command>\r
     </PreLinkEvent>\r
     <Link>\r
-      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib</AdditionalDependencies>\r
+      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
       <Version>\r
       </Version>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
@@ -288,7 +288,7 @@ copy "$(ProjectDir)casparcg.config" "$(OutDir)"</Command>
       </Command>\r
     </PreLinkEvent>\r
     <Link>\r
-      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib</AdditionalDependencies>\r
+      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
       <Version>\r
       </Version>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
@@ -343,7 +343,7 @@ copy "$(ProjectDir)casparcg.config" "$(OutDir)"</Command>
       </Command>\r
     </PreLinkEvent>\r
     <Link>\r
-      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib</AdditionalDependencies>\r
+      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
       <Version>\r
       </Version>\r
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r