winlin

try to build srs-librtmp on vs2010, failed.

@@ -73,6 +73,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -73,6 +73,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73 #endif 73 #endif
74 74
75 // for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213 75 // for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213
  76 +#if defined(_WIN32)
  77 + #include <windows.h>
  78 +#endif
  79 +
  80 +// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213
76 #ifndef _WIN32 81 #ifndef _WIN32
77 #include <inttypes.h> 82 #include <inttypes.h>
78 #endif 83 #endif
@@ -24,11 +24,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -24,11 +24,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef SRS_WIN_PORTING_H 24 #ifndef SRS_WIN_PORTING_H
25 #define SRS_WIN_PORTING_H 25 #define SRS_WIN_PORTING_H
26 26
27 -// for srs-librtmp, @see https://github.com/winlinvip/simple-rtmp-server/issues/213  
28 -#if defined(_WIN32)  
29 - #include <windows.h>  
30 -#endif  
31 -  
32 /** 27 /**
33 * for linux like, 28 * for linux like,
34 * for example, not on windows or it's cygwin. 29 * for example, not on windows or it's cygwin.
@@ -30,6 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,6 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 30
31 #include <sys/types.h> 31 #include <sys/types.h>
32 32
  33 +#ifdef _WIN32
  34 + typedef long int int64_t;
  35 + typedef unsigned int u_int32_t;
  36 + typedef int int32_t;
  37 +#endif
33 38
34 /** 39 /**
35 * srs-librtmp is a librtmp like library, 40 * srs-librtmp is a librtmp like library,
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013-2014 winlin
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +/**
  24 +gcc srs_play.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_play
  25 +*/
  26 +
  27 +#include <stdio.h>
  28 +#include <stdlib.h>
  29 +
  30 +#include "srs_librtmp.hpp"
  31 +
  32 +int main(int argc, char** argv)
  33 +{
  34 + printf("suck rtmp stream like rtmpdump\n");
  35 + printf("srs(simple-rtmp-server) client librtmp library.\n");
  36 + printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision());
  37 +
  38 + if (argc <= 1) {
  39 + printf("Usage: %s <rtmp_url>\n"
  40 + " rtmp_url RTMP stream url to play\n"
  41 + "For example:\n"
  42 + " %s rtmp://127.0.0.1:1935/live/livestream\n",
  43 + argv[0], argv[0]);
  44 + exit(-1);
  45 + }
  46 +
  47 + srs_human_trace("rtmp url: %s", argv[1]);
  48 + srs_rtmp_t rtmp = srs_rtmp_create(argv[1]);
  49 +
  50 + if (srs_rtmp_handshake(rtmp) != 0) {
  51 + srs_human_trace("simple handshake failed.");
  52 + goto rtmp_destroy;
  53 + }
  54 + srs_human_trace("simple handshake success");
  55 +
  56 + if (srs_rtmp_connect_app(rtmp) != 0) {
  57 + srs_human_trace("connect vhost/app failed.");
  58 + goto rtmp_destroy;
  59 + }
  60 + srs_human_trace("connect vhost/app success");
  61 +
  62 + if (srs_rtmp_play_stream(rtmp) != 0) {
  63 + srs_human_trace("play stream failed.");
  64 + goto rtmp_destroy;
  65 + }
  66 + srs_human_trace("play stream success");
  67 +
  68 + for (;;) {
  69 + int size;
  70 + char type;
  71 + char* data;
  72 + u_int32_t timestamp;
  73 +
  74 + if (srs_rtmp_read_packet(rtmp, &type, &timestamp, &data, &size) != 0) {
  75 + goto rtmp_destroy;
  76 + }
  77 +
  78 + if (srs_human_print_rtmp_packet(type, timestamp, data, size) != 0) {
  79 + goto rtmp_destroy;
  80 + }
  81 +
  82 + free(data);
  83 + }
  84 +
  85 +rtmp_destroy:
  86 + srs_rtmp_destroy(rtmp);
  87 +
  88 + return 0;
  89 +}
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
3 - <ItemGroup Label="ProjectConfigurations">  
4 - <ProjectConfiguration Include="Debug|Win32">  
5 - <Configuration>Debug</Configuration>  
6 - <Platform>Win32</Platform>  
7 - </ProjectConfiguration>  
8 - <ProjectConfiguration Include="Release|Win32">  
9 - <Configuration>Release</Configuration>  
10 - <Platform>Win32</Platform>  
11 - </ProjectConfiguration>  
12 - </ItemGroup>  
13 - <PropertyGroup Label="Globals">  
14 - <ProjectGuid>{5149B9A9-5085-4A10-AD6F-23FBE6854390}</ProjectGuid>  
15 - <Keyword>Win32Proj</Keyword>  
16 - <RootNamespace>srs_play</RootNamespace>  
17 - </PropertyGroup>  
18 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />  
19 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">  
20 - <ConfigurationType>Application</ConfigurationType>  
21 - <UseDebugLibraries>true</UseDebugLibraries>  
22 - <CharacterSet>Unicode</CharacterSet>  
23 - </PropertyGroup>  
24 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">  
25 - <ConfigurationType>Application</ConfigurationType>  
26 - <UseDebugLibraries>false</UseDebugLibraries>  
27 - <WholeProgramOptimization>true</WholeProgramOptimization>  
28 - <CharacterSet>Unicode</CharacterSet>  
29 - </PropertyGroup>  
30 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />  
31 - <ImportGroup Label="ExtensionSettings">  
32 - </ImportGroup>  
33 - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">  
34 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />  
35 - </ImportGroup>  
36 - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">  
37 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />  
38 - </ImportGroup>  
39 - <PropertyGroup Label="UserMacros" />  
40 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">  
41 - <LinkIncremental>true</LinkIncremental>  
42 - </PropertyGroup>  
43 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">  
44 - <LinkIncremental>false</LinkIncremental>  
45 - </PropertyGroup>  
46 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">  
47 - <ClCompile>  
48 - <PrecompiledHeader>  
49 - </PrecompiledHeader>  
50 - <WarningLevel>Level3</WarningLevel>  
51 - <Optimization>Disabled</Optimization>  
52 - <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>  
53 - <AdditionalIncludeDirectories>..\src\core;..\src\libs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>  
54 - </ClCompile>  
55 - <Link>  
56 - <SubSystem>Console</SubSystem>  
57 - <GenerateDebugInformation>true</GenerateDebugInformation>  
58 - <AdditionalDependencies>srs-librtmp.lib;%(AdditionalDependencies)</AdditionalDependencies>  
59 - <AdditionalLibraryDirectories>./debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>  
60 - </Link>  
61 - </ItemDefinitionGroup>  
62 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">  
63 - <ClCompile>  
64 - <WarningLevel>Level3</WarningLevel>  
65 - <PrecompiledHeader>  
66 - </PrecompiledHeader>  
67 - <Optimization>MaxSpeed</Optimization>  
68 - <FunctionLevelLinking>true</FunctionLevelLinking>  
69 - <IntrinsicFunctions>true</IntrinsicFunctions>  
70 - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>  
71 - </ClCompile>  
72 - <Link>  
73 - <SubSystem>Console</SubSystem>  
74 - <GenerateDebugInformation>true</GenerateDebugInformation>  
75 - <EnableCOMDATFolding>true</EnableCOMDATFolding>  
76 - <OptimizeReferences>true</OptimizeReferences>  
77 - </Link>  
78 - </ItemDefinitionGroup>  
79 - <ItemGroup>  
80 - <ClCompile Include="srs_play.c" />  
81 - </ItemGroup>  
82 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />  
83 - <ImportGroup Label="ExtensionTargets">  
84 - </ImportGroup>  
85 -</Project> 1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <ItemGroup Label="ProjectConfigurations">
  4 + <ProjectConfiguration Include="Debug|Win32">
  5 + <Configuration>Debug</Configuration>
  6 + <Platform>Win32</Platform>
  7 + </ProjectConfiguration>
  8 + <ProjectConfiguration Include="Release|Win32">
  9 + <Configuration>Release</Configuration>
  10 + <Platform>Win32</Platform>
  11 + </ProjectConfiguration>
  12 + </ItemGroup>
  13 + <PropertyGroup Label="Globals">
  14 + <ProjectGuid>{5149B9A9-5085-4A10-AD6F-23FBE6854390}</ProjectGuid>
  15 + <Keyword>Win32Proj</Keyword>
  16 + <RootNamespace>srs_play</RootNamespace>
  17 + </PropertyGroup>
  18 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  19 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
  20 + <ConfigurationType>Application</ConfigurationType>
  21 + <UseDebugLibraries>true</UseDebugLibraries>
  22 + <CharacterSet>Unicode</CharacterSet>
  23 + </PropertyGroup>
  24 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
  25 + <ConfigurationType>Application</ConfigurationType>
  26 + <UseDebugLibraries>false</UseDebugLibraries>
  27 + <WholeProgramOptimization>true</WholeProgramOptimization>
  28 + <CharacterSet>Unicode</CharacterSet>
  29 + </PropertyGroup>
  30 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  31 + <ImportGroup Label="ExtensionSettings">
  32 + </ImportGroup>
  33 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  34 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  35 + </ImportGroup>
  36 + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  37 + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  38 + </ImportGroup>
  39 + <PropertyGroup Label="UserMacros" />
  40 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  41 + <LinkIncremental>true</LinkIncremental>
  42 + </PropertyGroup>
  43 + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  44 + <LinkIncremental>false</LinkIncremental>
  45 + </PropertyGroup>
  46 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  47 + <ClCompile>
  48 + <PrecompiledHeader>
  49 + </PrecompiledHeader>
  50 + <WarningLevel>Level3</WarningLevel>
  51 + <Optimization>Disabled</Optimization>
  52 + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  53 + <AdditionalIncludeDirectories>..\src\core;..\src\libs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  54 + </ClCompile>
  55 + <Link>
  56 + <SubSystem>Console</SubSystem>
  57 + <GenerateDebugInformation>true</GenerateDebugInformation>
  58 + <AdditionalDependencies>srs-librtmp.lib;%(AdditionalDependencies)</AdditionalDependencies>
  59 + <AdditionalLibraryDirectories>./debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
  60 + </Link>
  61 + </ItemDefinitionGroup>
  62 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  63 + <ClCompile>
  64 + <WarningLevel>Level3</WarningLevel>
  65 + <PrecompiledHeader>
  66 + </PrecompiledHeader>
  67 + <Optimization>MaxSpeed</Optimization>
  68 + <FunctionLevelLinking>true</FunctionLevelLinking>
  69 + <IntrinsicFunctions>true</IntrinsicFunctions>
  70 + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  71 + </ClCompile>
  72 + <Link>
  73 + <SubSystem>Console</SubSystem>
  74 + <GenerateDebugInformation>true</GenerateDebugInformation>
  75 + <EnableCOMDATFolding>true</EnableCOMDATFolding>
  76 + <OptimizeReferences>true</OptimizeReferences>
  77 + </Link>
  78 + </ItemDefinitionGroup>
  79 + <ItemGroup>
  80 + <ClCompile Include="srs_play.cpp" />
  81 + </ItemGroup>
  82 + <ItemGroup>
  83 + <ClInclude Include="srs_auto_headers.hpp" />
  84 + </ItemGroup>
  85 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  86 + <ImportGroup Label="ExtensionTargets">
  87 + </ImportGroup>
  88 +</Project>
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
3 - <ItemGroup>  
4 - <Filter Include="Source Files">  
5 - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>  
6 - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>  
7 - </Filter>  
8 - <Filter Include="Header Files">  
9 - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>  
10 - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>  
11 - </Filter>  
12 - <Filter Include="Resource Files">  
13 - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>  
14 - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>  
15 - </Filter>  
16 - </ItemGroup>  
17 - <ItemGroup>  
18 - <ClCompile Include="srs_play.c">  
19 - <Filter>Source Files</Filter>  
20 - </ClCompile>  
21 - </ItemGroup>  
22 -</Project> 1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <ItemGroup>
  4 + <Filter Include="Source Files">
  5 + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
  6 + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
  7 + </Filter>
  8 + <Filter Include="Header Files">
  9 + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
  10 + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
  11 + </Filter>
  12 + <Filter Include="Resource Files">
  13 + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
  14 + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
  15 + </Filter>
  16 + </ItemGroup>
  17 + <ItemGroup>
  18 + <ClInclude Include="srs_auto_headers.hpp">
  19 + <Filter>Header Files</Filter>
  20 + </ClInclude>
  21 + </ItemGroup>
  22 + <ItemGroup>
  23 + <ClCompile Include="srs_play.cpp">
  24 + <Filter>Source Files</Filter>
  25 + </ClCompile>
  26 + </ItemGroup>
  27 +</Project>