Bläddra i källkod

Add EasyGBD_Win

Babosa 7 månader sedan
förälder
incheckning
80d03e7b56

+ 31 - 0
Win/EasyGBD.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.35130.168
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EasyGBD_Demo", "EasyGBD_Demo.vcxproj", "{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Debug|x64.ActiveCfg = Debug|x64
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Debug|x64.Build.0 = Debug|x64
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Debug|x86.ActiveCfg = Debug|Win32
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Debug|x86.Build.0 = Debug|Win32
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Release|x64.ActiveCfg = Release|x64
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Release|x64.Build.0 = Release|x64
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Release|x86.ActiveCfg = Release|Win32
+		{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {B4D53F0B-46A2-4974-A7E8-C2E037AB7BEB}
+	EndGlobalSection
+EndGlobal

BIN
Win/EasyGBDDemo.aps


BIN
Win/EasyGBDDemo.rc


+ 118 - 0
Win/EasyGBD_Demo.cpp

@@ -0,0 +1,118 @@
+
+// EasyGBD_Demo.cpp: 定义应用程序的类行为。
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "EasyGBD_Demo.h"
+#include "EasyGBD_DemoDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CEasyGBDDemoApp
+
+BEGIN_MESSAGE_MAP(CEasyGBDDemoApp, CWinApp)
+	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CEasyGBDDemoApp 构造
+
+CEasyGBDDemoApp::CEasyGBDDemoApp()
+{
+	// 支持重新启动管理器
+	m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+	// TODO: 在此处添加构造代码,
+	// 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的 CEasyGBDDemoApp 对象
+
+CEasyGBDDemoApp theApp;
+
+
+// CEasyGBDDemoApp 初始化
+
+BOOL CEasyGBDDemoApp::InitInstance()
+{
+	// 如果一个运行在 Windows XP 上的应用程序清单指定要
+	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
+	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 将它设置为包括所有要在应用程序中使用的
+	// 公共控件类。
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+
+	AfxEnableControlContainer();
+	AfxInitRichEdit2();
+
+	// 创建 shell 管理器,以防对话框包含
+	// 任何 shell 树视图控件或 shell 列表视图控件。
+	CShellManager *pShellManager = new CShellManager;
+
+	// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
+	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+	// 标准初始化
+	// 如果未使用这些功能并希望减小
+	// 最终可执行文件的大小,则应移除下列
+	// 不需要的特定初始化例程
+	// 更改用于存储设置的注册表项
+	// TODO: 应适当修改该字符串,
+	// 例如修改为公司或组织名
+	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
+
+	CEasyGBDDemoDlg dlg;
+	m_pMainWnd = &dlg;
+	INT_PTR nResponse = dlg.DoModal();
+	if (nResponse == IDOK)
+	{
+		// TODO: 在此放置处理何时用
+		//  “确定”来关闭对话框的代码
+	}
+	else if (nResponse == IDCANCEL)
+	{
+		// TODO: 在此放置处理何时用
+		//  “取消”来关闭对话框的代码
+	}
+	else if (nResponse == -1)
+	{
+		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
+		TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
+	}
+
+	// 删除上面创建的 shell 管理器。
+	if (pShellManager != nullptr)
+	{
+		delete pShellManager;
+	}
+
+#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
+	ControlBarCleanUp();
+#endif
+
+	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
+	//  而不是启动应用程序的消息泵。
+	return FALSE;
+}
+
+
+BOOL CEasyGBDDemoApp::PreTranslateMessage(MSG* pMsg)
+{
+	if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
+	{
+		return TRUE;
+	}
+
+	return CWinApp::PreTranslateMessage(pMsg);
+}

+ 33 - 0
Win/EasyGBD_Demo.h

@@ -0,0 +1,33 @@
+
+// EasyGBD_Demo.h: PROJECT_NAME 应用程序的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "在包含此文件之前包含 'pch.h' 以生成 PCH"
+#endif
+
+#include "resource.h"		// 主符号
+
+
+// CEasyGBDDemoApp:
+// 有关此类的实现,请参阅 EasyGBD_Demo.cpp
+//
+
+class CEasyGBDDemoApp : public CWinApp
+{
+public:
+	CEasyGBDDemoApp();
+
+// 重写
+public:
+	virtual BOOL InitInstance();
+
+// 实现
+
+	DECLARE_MESSAGE_MAP()
+	virtual BOOL PreTranslateMessage(MSG* pMsg);
+};
+
+extern CEasyGBDDemoApp theApp;

+ 234 - 0
Win/EasyGBD_Demo.vcxproj

@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <ProjectGuid>{EA6E05D1-E1EF-4AAE-B000-A05F6B00ED30}</ProjectGuid>
+    <Keyword>MFCProj</Keyword>
+    <RootNamespace>EasyGBDDemo</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+    <ProjectName>EasyGBD</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>.\Lib\x64</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>.\Lib\x64</OutDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <AdditionalOptions>/D "_CRT_SECURE_NO_WARNINGS" %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalLibraryDirectories>.\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>libEasyStreamClient.lib;GB28181Device.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <AdditionalOptions>/D "_CRT_SECURE_NO_WARNINGS" %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>.\Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>libEasyStreamClient.lib;GB28181Device.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="EasyGBD_Demo.h" />
+    <ClInclude Include="EasyGBD_DemoDlg.h" />
+    <ClInclude Include="framework.h" />
+    <ClInclude Include="osmutex.h" />
+    <ClInclude Include="pch.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="EasyGBD_Demo.cpp" />
+    <ClCompile Include="EasyGBD_DemoDlg.cpp" />
+    <ClCompile Include="osmutex.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
+    </ClCompile>
+    <ClCompile Include="pch.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="EasyGBDDemo.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\EasyGBDDemo.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\EasyGBD_Demo.ico" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="EasyGBDDemo.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
+</Project>

+ 69 - 0
Win/EasyGBD_Demo.vcxproj.filters

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="源文件">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="头文件">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="资源文件">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="EasyGBD_Demo.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="EasyGBD_DemoDlg.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="framework.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="pch.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="osmutex.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="EasyGBD_Demo.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="EasyGBD_DemoDlg.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="pch.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="osmutex.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="EasyGBDDemo.rc">
+      <Filter>资源文件</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\EasyGBDDemo.rc2">
+      <Filter>资源文件</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\EasyGBD_Demo.ico">
+      <Filter>资源文件</Filter>
+    </Image>
+  </ItemGroup>
+</Project>

+ 14 - 0
Win/EasyGBD_Demo.vcxproj.user

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <RESOURCE_FILE>EasyGBDDemo.rc</RESOURCE_FILE>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LocalDebuggerEnvironment>path=%path%;.\Lib\x64</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LocalDebuggerEnvironment>path=%path%;.\Lib\x64</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>

+ 660 - 0
Win/EasyGBD_DemoDlg.cpp

@@ -0,0 +1,660 @@
+
+// EasyGBD_DemoDlg.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "EasyGBD_Demo.h"
+#include "EasyGBD_DemoDlg.h"
+#include "afxdialogex.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+
+
+// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
+
+class CAboutDlg : public CDialogEx
+{
+public:
+	CAboutDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_ABOUTBOX };
+#endif
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+// 实现
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CEasyGBDDemoDlg 对话框
+
+
+
+CEasyGBDDemoDlg::CEasyGBDDemoDlg(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_EASYGBD_DEMO_DIALOG, pParent)
+{
+	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+
+	InitMutex(&mLogMutex);
+	memset(&mGB28181Device, 0x00, sizeof(GB28181_DEVICE_T));
+}
+
+void CEasyGBDDemoDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CEasyGBDDemoDlg, CDialogEx)
+	ON_WM_SYSCOMMAND()
+	ON_WM_PAINT()
+	ON_WM_QUERYDRAGICON()
+	ON_BN_CLICKED(IDC_BUTTON_STARTUP, &CEasyGBDDemoDlg::OnBnClickedButtonStart)
+	ON_WM_DESTROY()
+	ON_BN_CLICKED(IDC_BUTTON_SHUTDOWN, &CEasyGBDDemoDlg::OnBnClickedButtonShutdown)
+	ON_BN_CLICKED(IDC_BUTTON_BROWSE, &CEasyGBDDemoDlg::OnBnClickedButtonBrowse)
+	ON_MESSAGE(WM_UPDATE_LOG, OnUpdateLog)
+END_MESSAGE_MAP()
+
+
+// CEasyGBDDemoDlg 消息处理程序
+
+BOOL CEasyGBDDemoDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// 将“关于...”菜单项添加到系统菜单中。
+
+	// IDM_ABOUTBOX 必须在系统命令范围内。
+	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+	ASSERT(IDM_ABOUTBOX < 0xF000);
+
+	CMenu* pSysMenu = GetSystemMenu(FALSE);
+	if (pSysMenu != nullptr)
+	{
+		BOOL bNameValid;
+		CString strAboutMenu;
+		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
+		ASSERT(bNameValid);
+		if (!strAboutMenu.IsEmpty())
+		{
+			pSysMenu->AppendMenu(MF_SEPARATOR);
+			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+		}
+	}
+
+	// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
+	//  执行此操作
+	SetIcon(m_hIcon, TRUE);			// 设置大图标
+	SetIcon(m_hIcon, FALSE);		// 设置小图标
+
+	// TODO: 在此添加额外的初始化代码
+
+	SetWindowText(TEXT("EasyGBD_Win(Powered by EasyDarwin)"));
+
+	pEdtServerSipID = (CEdit*)GetDlgItem(IDC_EDIT_SERVER_SIPID);
+	pEdtServerIP = (CEdit*)GetDlgItem(IDC_EDIT_SERVER_IP);
+	pEdtServerPort = (CEdit*)GetDlgItem(IDC_EDIT_SERVER_PORT);
+	pEdtRegExpire = (CEdit*)GetDlgItem(IDC_EDIT_REG_EXPIRE);
+	pEdtHeartbeatCount = (CEdit*)GetDlgItem(IDC_EDIT_HEARTBEAT_COUNT);
+	pEdtHeartbeatInterval = (CEdit*)GetDlgItem(IDC_EDIT_HEARTBEAT_INTERVAL);
+	pComboxProtocol = (CComboBox*)GetDlgItem(IDC_COMBO_PROTOCOL);
+	pEdtPassword = (CEdit*)GetDlgItem(IDC_EDIT_PASSWORD);
+	pEdtLocalSipID = (CEdit*)GetDlgItem(IDC_EDIT_LOCAL_SIPID);
+	pEdtLocalPort = (CEdit*)GetDlgItem(IDC_EDIT_LOCAL_PORT);
+	pEdtSourceURL = (CEdit*)GetDlgItem(IDC_EDIT_SOURCE_URL);
+
+	pBtnStartup = (CButton*)GetDlgItem(IDC_BUTTON_STARTUP);
+	pBtnShutdown = (CButton*)GetDlgItem(IDC_BUTTON_SHUTDOWN);
+	pRichEditLog = (CRichEditCtrl*)GetDlgItem(IDC_RICHEDIT2_LOG);
+
+
+	pEdtServerSipID->SetWindowTextW(TEXT("11010100032008000001"));
+	pEdtServerIP->SetWindowTextW(TEXT("192.168.0.106"));
+	pEdtServerPort->SetWindowTextW(TEXT("5060"));
+	pEdtRegExpire->SetWindowTextW(TEXT("3600"));
+	pEdtHeartbeatCount->SetWindowTextW(TEXT("3"));
+	pEdtHeartbeatInterval->SetWindowTextW(TEXT("60"));
+	pComboxProtocol->AddString(TEXT("UDP"));
+	pComboxProtocol->AddString(TEXT("TCP"));
+	pComboxProtocol->SetCurSel(0);
+	pEdtPassword->SetWindowTextW(TEXT("12345678"));
+	pEdtLocalSipID->SetWindowTextW(TEXT("34020000001320000911"));
+	pEdtLocalPort->SetWindowTextW(TEXT("15090"));
+	pEdtSourceURL->SetWindowTextW(TEXT("视频源或者文件URL,例如:\"rtsp://...\",\"D:\\video\\gb.mp4\",\"http://...\""));
+
+	OnBnClickedButtonShutdown();
+
+	
+
+	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
+}
+
+void CEasyGBDDemoDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+	{
+		CAboutDlg dlgAbout;
+		dlgAbout.DoModal();
+	}
+	else
+	{
+		CDialogEx::OnSysCommand(nID, lParam);
+	}
+}
+
+// 如果向对话框添加最小化按钮,则需要下面的代码
+//  来绘制该图标。  对于使用文档/视图模型的 MFC 应用程序,
+//  这将由框架自动完成。
+
+void CEasyGBDDemoDlg::OnPaint()
+{
+	if (IsIconic())
+	{
+		CPaintDC dc(this); // 用于绘制的设备上下文
+
+		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+		// 使图标在工作区矩形中居中
+		int cxIcon = GetSystemMetrics(SM_CXICON);
+		int cyIcon = GetSystemMetrics(SM_CYICON);
+		CRect rect;
+		GetClientRect(&rect);
+		int x = (rect.Width() - cxIcon + 1) / 2;
+		int y = (rect.Height() - cyIcon + 1) / 2;
+
+		// 绘制图标
+		dc.DrawIcon(x, y, m_hIcon);
+	}
+	else
+	{
+		CDialogEx::OnPaint();
+	}
+}
+
+//当用户拖动最小化窗口时系统调用此函数取得光标
+//显示。
+HCURSOR CEasyGBDDemoDlg::OnQueryDragIcon()
+{
+	return static_cast<HCURSOR>(m_hIcon);
+}
+
+
+
+bool MByteToWChar(LPCSTR lpcszStr, LPWSTR lpwszStr, DWORD dwSize)
+{
+	// Get the required size of the buffer that receives the Unicode
+	// string.
+	DWORD dwMinSize;
+	dwMinSize = MultiByteToWideChar(CP_ACP, 0, lpcszStr, -1, NULL, 0);
+
+	if (dwSize < dwMinSize)
+	{
+		return false;
+	}
+
+	// Convert headers from ASCII to Unicode.
+	MultiByteToWideChar(CP_ACP, 0, lpcszStr, -1, lpwszStr, dwMinSize);
+	return true;
+}
+bool WCharToMByte(LPCWSTR lpcwszStr, LPSTR lpszStr, DWORD dwSize)
+{
+	DWORD dwMinSize;
+	dwMinSize = WideCharToMultiByte(CP_UTF8, NULL, lpcwszStr, -1, NULL, 0, NULL, FALSE);
+	if (dwSize < dwMinSize)
+	{
+		return false;
+	}
+	WideCharToMultiByte(CP_UTF8, NULL, lpcwszStr, -1, lpszStr, dwSize, NULL, FALSE);
+	return true;
+}
+
+void CEasyGBDDemoDlg::OnBnClickedButtonStart()
+{
+	// TODO: 在此添加控件通知处理程序代码
+
+	wchar_t wszServerSipId[32] = { 0 };
+	char szServerSipId[32] = { 0 };
+	pEdtServerSipID->GetWindowTextW(wszServerSipId, sizeof(wszServerSipId));
+	WCharToMByte(wszServerSipId, szServerSipId, sizeof(szServerSipId) / sizeof(szServerSipId[0]));
+
+	wchar_t wszServerIP[32] = { 0 };
+	char szServerIP[32] = { 0 };
+	pEdtServerIP->GetWindowTextW(wszServerIP, sizeof(wszServerIP));
+	WCharToMByte(wszServerIP, szServerIP, sizeof(szServerIP) / sizeof(szServerIP[0]));
+
+	wchar_t wszServerPort[16] = { 0 };
+	char szServerPort[16] = { 0 };
+	pEdtServerPort->GetWindowTextW(wszServerPort, sizeof(wszServerPort));
+	WCharToMByte(wszServerPort, szServerPort, sizeof(szServerPort) / sizeof(szServerPort[0]));
+
+	wchar_t wszRegExpire[16] = { 0 };
+	char szRegExpire[16] = { 0 };
+	pEdtRegExpire->GetWindowTextW(wszRegExpire, sizeof(wszRegExpire));
+	WCharToMByte(wszRegExpire, szRegExpire, sizeof(szRegExpire) / sizeof(szRegExpire[0]));
+
+	wchar_t wszHeartbeatCount[16] = { 0 };
+	char szHeartbeatCount[16] = { 0 };
+	pEdtHeartbeatCount->GetWindowTextW(wszHeartbeatCount, sizeof(wszHeartbeatCount));
+	WCharToMByte(wszHeartbeatCount, szHeartbeatCount, sizeof(szHeartbeatCount) / sizeof(szHeartbeatCount[0]));
+
+	wchar_t wszHeartbeatInterval[16] = { 0 };
+	char szHeartbeatInterval[16] = { 0 };
+	pEdtHeartbeatInterval->GetWindowTextW(wszHeartbeatInterval, sizeof(wszHeartbeatInterval));
+	WCharToMByte(wszHeartbeatInterval, szHeartbeatInterval, sizeof(szHeartbeatInterval) / sizeof(szHeartbeatInterval[0]));
+
+	int protocol = pComboxProtocol->GetCurSel();
+
+	wchar_t wszPassword[32] = { 0 };
+	char szPassword[32] = { 0 };
+	pEdtPassword->GetWindowTextW(wszPassword, sizeof(wszPassword));
+	WCharToMByte(wszPassword, szPassword, sizeof(szPassword) / sizeof(szPassword[0]));
+
+	wchar_t wszLocalSipID[32] = { 0 };
+	char szLocalSipID[32] = { 0 };
+	pEdtLocalSipID->GetWindowTextW(wszLocalSipID, sizeof(wszLocalSipID));
+	WCharToMByte(wszLocalSipID, szLocalSipID, sizeof(szLocalSipID) / sizeof(szLocalSipID[0]));
+
+	wchar_t wszLocalPort[16] = { 0 };
+	char szLocalPort[16] = { 0 };
+	pEdtLocalPort->GetWindowTextW(wszLocalPort, sizeof(wszLocalPort));
+	WCharToMByte(wszLocalPort, szLocalPort, sizeof(szLocalPort) / sizeof(szLocalPort[0]));
+
+	wchar_t wszSourceURL[1024] = { 0 };
+	char szSourceURL[1024] = { 0 };
+	pEdtSourceURL->GetWindowTextW(wszSourceURL, sizeof(wszSourceURL));
+	WCharToMByte(wszSourceURL, szSourceURL, sizeof(szSourceURL) / sizeof(szSourceURL[0]));
+
+	Startup(szServerSipId, szServerIP, atoi(szServerPort), atoi(szRegExpire), atoi(szHeartbeatCount), atoi(szHeartbeatInterval),
+		protocol, szPassword, szLocalSipID, atoi(szLocalPort), szSourceURL);
+
+
+	pBtnStartup->EnableWindow(FALSE);
+	pBtnShutdown->EnableWindow(TRUE);
+}
+
+
+void CEasyGBDDemoDlg::OnBnClickedButtonShutdown()
+{
+	Shutdown();
+
+	pBtnStartup->EnableWindow(TRUE);
+	pBtnShutdown->EnableWindow(FALSE);
+}
+
+
+int CEasyGBDDemoDlg::OutputLog(char* szFormat, ...)
+{
+	char	pbuf[1024] = { 0 };
+
+	va_list args;
+	va_start(args, szFormat);
+	vsnprintf(pbuf, sizeof(pbuf) - 1, szFormat, args);
+	va_end(args);
+
+
+
+	LockLogMutex();
+	mLogVector.push_back(pbuf);
+	UnlockLogMutex();
+
+	PostMessage(WM_UPDATE_LOG);
+
+	return 0;
+}
+
+LRESULT CEasyGBDDemoDlg::OnUpdateLog(WPARAM, LPARAM)
+{
+
+	OutputLog2UI();
+	return 0;
+}
+
+void CEasyGBDDemoDlg::OutputLog2UI()
+{
+	LockLogMutex();
+	LOG_VECTOR::iterator it = mLogVector.begin();
+	while (it != mLogVector.end())
+	{
+		wchar_t wszBuf[1024] = { 0 };
+		MByteToWChar(it->data(), wszBuf, sizeof(wszBuf) / sizeof(wszBuf[0]));
+
+		pRichEditLog->SetSel(-1, -1);
+		pRichEditLog->ReplaceSel(wszBuf);
+
+		mLogVector.erase(it);
+		it = mLogVector.begin();
+		if (it == mLogVector.end())		break;
+	}
+	UnlockLogMutex();
+}
+
+
+
+int CALLBACK __GB28181DeviceCALLBACK(void* userPtr, int channelId, int eventType, char* eventParams, int paramLength)
+{
+	GB28181_DEVICE_T* pGB28181Device = (GB28181_DEVICE_T*)userPtr;
+	GB28181_CHANNEL_T* pChannel = &pGB28181Device->pChannel[channelId];
+
+	if (NULL == pChannel)		return 0;
+
+	CEasyGBDDemoDlg* pThis = (CEasyGBDDemoDlg*)pChannel->userptr;
+
+	if (GB28181_DEVICE_EVENT_CONNECTING == eventType)
+	{
+		pThis->OutputLog("GB/T28181服务连接中...  %s\n", eventParams);
+
+	}
+	else if (GB28181_DEVICE_EVENT_REGISTER_ING == eventType)
+	{
+		pThis->OutputLog("GB/T28181 注册中....\n");
+	}
+	if (GB28181_DEVICE_EVENT_REGISTER_OK == eventType)
+	{
+		pThis->OutputLog("GB/T28181 注册成功.\n");
+	}
+	else if (GB28181_DEVICE_EVENT_REGISTER_AUTH_FAIL == eventType)
+	{
+		pThis->OutputLog("GB/T28181 鉴权失败.\n");
+	}
+
+	else if (GB28181_DEVICE_EVENT_START_AUDIO_VIDEO == eventType)
+	{
+		pThis->OutputLog("GB/T28181 请求视频.  ID: %s\n", eventParams);
+		pChannel->sendStatus = 1;
+	}
+	else if (GB28181_DEVICE_EVENT_STOP_AUDIO_VIDEO == eventType)
+	{
+		pThis->OutputLog("GB/T28181 停止视频.  ID: %s\n", eventParams);
+		pChannel->sendStatus = 0;
+	}
+	else if (GB28181_DEVICE_EVENT_TALK_AUDIO_DATA == eventType)
+	{
+		//pThis->OutputLog("GB/T28181 音频对讲数据...\n");
+	}
+
+	return 0;
+}
+
+int Easy_APICALL __EasyStreamClientCallBack(void* _channelPtr, int _frameType, void* pBuf, EASY_FRAME_INFO* _frameInfo)
+{
+	GB28181_CHANNEL_T* pChannel = (GB28181_CHANNEL_T*)_channelPtr;
+	CEasyGBDDemoDlg* pThis = (CEasyGBDDemoDlg*)pChannel->userptr;
+
+	if (_frameType == EASY_SDK_VIDEO_FRAME_FLAG)
+	{
+		if (pChannel->videoCodec < 1)
+		{
+			pThis->OutputLog("设置视频编码格式: %s\n", _frameInfo->codec == EASY_SDK_VIDEO_CODEC_H264 ? "H264" : "H265");
+
+			libGB28181Device_SetVideoFormat(pChannel->id, _frameInfo->codec, 0, 0, 0);
+			libGB28181Device_SetAudioFormat(pChannel->id, EASY_SDK_AUDIO_CODEC_AAC, 8000, 1, 16);
+
+			pChannel->videoCodec = _frameInfo->codec;
+		}
+
+		if (pChannel->sendStatus == 1)
+		{
+			if (_frameInfo->type == 0x01)
+			{
+				char* buf = (char*)pBuf;
+				pThis->OutputLog("推送关键帧: %d  Bytes: %02X %02X %02X %02X %02X %02X %02X %02X\n", _frameInfo->length,
+					(unsigned char)buf[0], (unsigned char)buf[1], (unsigned char)buf[2], (unsigned char)buf[3],
+					(unsigned char)buf[4], (unsigned char)buf[5], (unsigned char)buf[6], (unsigned char)buf[7]);
+			}
+
+			libGB28181Device_AddVideoData(pChannel->id, (char*)pBuf, _frameInfo->length, _frameInfo->type);
+		}
+	}
+	else if (_frameType == EASY_SDK_AUDIO_FRAME_FLAG)
+	{
+		if (pChannel->sendStatus == 1)
+		{
+			libGB28181Device_AddAudioData(pChannel->id, _frameInfo->codec, (char*)pBuf, _frameInfo->length, _frameInfo->length);
+		}
+
+		//if (pChannel->sendStatus == 1)
+		//{
+		//	if (NULL == pChannel->atcHandle)
+		//	{
+		//	    ATC_Init(&pChannel->atcHandle, pChannel->audioOutputFormat,//TRANSCODE_AUDIO_TYPE_AAC,
+		//	        //pChannel->srcAudioCodec, frameinfo->sample_rate, 1, frameinfo->bitsPerSample);
+		//	        pChannel->srcAudioCodec, _frameInfo->sample_rate, _frameInfo->channels, _frameInfo->bits_per_sample);
+		//	}
+		//	if (pChannel->atcHandle)
+		//	{
+		//	    unsigned char* dstBuf = NULL;
+		//	    int dstBufSize = 0;
+		//	    if (0 == ATC_Transcode(pChannel->atcHandle, &dstBuf, &dstBufSize, (unsigned char*)pBuf, _frameInfo->length))
+		//	    {
+		//	        //printf("Audio frame length: %d   -->    %d\n", frameinfo->length, dstBufSize);
+
+		//	        //if (NULL != pChannel->pDSPlayer)
+		//	        //{
+		//	        //    pChannel->pDSPlayer->Write((char*)dstBuf, dstBufSize);
+		//	        //}
+
+		//	        if (pChannel->sendStatus == 1)
+		//	        {
+		//	            libGB28181Device_AddAudioData(pChannel->id, pChannel->audioOutputFormat, (char*)dstBuf, dstBufSize, dstBufSize);// dstBufSize);
+		//	            //libGB28181Device_AddAudioData(7, (char*)dstBuf, dstBufSize, dstBufSize);// dstBufSize);
+		//	        }
+
+		//	        //if (NULL == pChannel->fDat)
+		//	        //{
+		//	        //    //pGB28181Device->fDat = fopen("1.aac", "wb");
+		//	        //    pChannel->fDat = fopen("1.711u", "wb");
+		//	        //}
+		//	        //if (NULL != pChannel->fDat)
+		//	        //{
+		//	        //    fwrite(pBuf, 1, _frameInfo->length, pChannel->fDat);
+		//	        //}
+		//	    }
+		//	}
+
+		//	//libGB28181Device_AddAudioData(pChannel->id, _frameInfo->codec, (char*)pBuf, _frameInfo->length, _frameInfo->length);
+		//}
+	}
+	else if (_frameType == EASY_SDK_EVENT_FRAME_FLAG)
+	{
+		if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_DISCONNECTED)
+		{
+			pThis->OutputLog("当前视频源已断开!\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_CONNECTED)
+		{
+			pThis->OutputLog("当前视频源连接成功!\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_EXIT)
+		{
+			pThis->OutputLog("当前视频源已正常断开连接!\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_CONNECT_FAILED)
+		{
+			pThis->OutputLog("当前视频源连接失败!\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_CONNECTING)
+		{
+			pThis->OutputLog("当前视频源连接中...\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_CONNECTED)
+		{
+			pThis->OutputLog("当前视频源连接成功.\n");
+		}
+		else if (_frameInfo->codec == EASY_STREAM_CLIENT_STATE_CONNECT_ABORT)
+		{
+			pThis->OutputLog("当前视频源连接异常中断.\n");
+		}
+	}
+
+	return 0;
+}
+
+
+
+int		CEasyGBDDemoDlg::Startup(const char* serverSIPId, const char* serverIP, const int serverPort,
+								const int reg_expires, const int heartbeatCount, const int heartbeatInterval,
+								const int protocol, const char* password, const char* localSIPId, const int localPort, const char* sourceURL)
+{
+	int ret = 0;
+
+	if (NULL == mGB28181Device.pChannel)
+	{
+		OutputLog("启动中...\n");
+
+		mGB28181Device.pChannel = new GB28181_CHANNEL_T[MAX_GB28181_CHANNEL_NUM];
+		if (mGB28181Device.pChannel)
+		{
+			memset(mGB28181Device.pChannel, 0x00, sizeof(GB28181_CHANNEL_T) * MAX_GB28181_CHANNEL_NUM);
+			for (int i = 0; i < MAX_GB28181_CHANNEL_NUM; i++)
+			{
+				mGB28181Device.pChannel[i].id = i;
+				mGB28181Device.pChannel[i].userptr = this;
+				strcpy(mGB28181Device.pChannel[i].sourceURL, sourceURL);// "rtsp://admin:admin12345@192.168.6.41");
+			}
+
+			GB28181_DEVICE_INFO_T   gb28181DeviceInfo;
+			memset(&gb28181DeviceInfo, 0x00, sizeof(GB28181_DEVICE_INFO_T));
+
+			strcpy(gb28181DeviceInfo.server_id, serverSIPId);
+			memcpy(gb28181DeviceInfo.server_domain, gb28181DeviceInfo.server_id, 10);
+			strcpy(gb28181DeviceInfo.server_ip, serverIP);
+			gb28181DeviceInfo.server_port = serverPort;
+			gb28181DeviceInfo.reg_expires = reg_expires;
+			gb28181DeviceInfo.heartbeat_count = heartbeatCount;
+			gb28181DeviceInfo.heartbeat_interval = heartbeatInterval;
+			gb28181DeviceInfo.protocol = protocol; //0 - udp; 1 - tcp
+			strcpy(gb28181DeviceInfo.password, password);
+			gb28181DeviceInfo.log_enable = 1;         // log enable flag
+			gb28181DeviceInfo.log_level = 0;          // log level(0:TRACE,1:DEBUG,2:INFO,3:WARNING,4:ERROR,5:FATAL)
+
+			strcpy(gb28181DeviceInfo.device_id, localSIPId);
+			gb28181DeviceInfo.localSipPort = localPort;
+
+			gb28181DeviceInfo.channel_nums = MAX_GB28181_CHANNEL_NUM;
+			for (int i = 0; i < gb28181DeviceInfo.channel_nums; i++)
+			{
+				sprintf(gb28181DeviceInfo.channel[i].id, "%s1310%06d", gb28181DeviceInfo.server_domain, i + 1);
+				sprintf(gb28181DeviceInfo.channel[i].name, "ch %02d", i + 1);
+				strcpy(gb28181DeviceInfo.channel[i].model, "IPCamera");
+				sprintf(gb28181DeviceInfo.channel[i].owner, "Owner %02d", i + 1);
+				strcpy(gb28181DeviceInfo.channel[i].manufacturer, "Easy");
+				gb28181DeviceInfo.channel[i].longitude = (double)i + 100;
+				gb28181DeviceInfo.channel[i].latitude = (double)i + 10;
+			}
+
+			libGB28181Device_Create(&gb28181DeviceInfo/*为NULL则表示从当前目录下读取config.xml*/, __GB28181DeviceCALLBACK, (void*)&mGB28181Device);
+
+			for (int i = 0; i < MAX_GB28181_CHANNEL_NUM; i++)
+			{
+				if (0 == strcmp(mGB28181Device.pChannel[i].sourceURL, "\0"))    continue;
+
+
+				EasyStreamClient_Init(&mGB28181Device.pChannel[i].streamClientHandle, 0);
+				EasyStreamClient_SetCallback(mGB28181Device.pChannel[i].streamClientHandle, __EasyStreamClientCallBack);
+				EasyStreamClient_OpenStream(mGB28181Device.pChannel[i].streamClientHandle,
+					mGB28181Device.pChannel[i].sourceURL, EASY_RTP_OVER_TCP, &mGB28181Device.pChannel[i], 1, 5, 1);
+				EasyStreamClient_SetAudioEnable(mGB28181Device.pChannel[i].streamClientHandle, 1);
+
+				//mGB28181Device.pChannel[i].audioOutputFormat = TRANSCODE_AUDIO_TYPE_G711U;// TRANSCODE_AUDIO_TYPE_G711U;
+
+				//libGB28181Device_SetVideoFormat(i, EASY_SDK_VIDEO_CODEC_H265, 0, 0, 0);
+				//libGB28181Device_SetAudioFormat(i, EASY_SDK_AUDIO_CODEC_AAC, 8000, 1, 16);
+			}
+
+			OutputLog("已启动..\n");
+		}
+		else
+		{
+			OutputLog("启动失败...\n");
+			ret = -1000;
+			return ret;
+		}
+	}
+
+
+	return ret;
+}
+void	CEasyGBDDemoDlg::Shutdown()
+{
+	if (NULL == mGB28181Device.pChannel)		return;
+
+	OutputLog("停止中...\n");
+
+	for (int i = 0; i < MAX_GB28181_CHANNEL_NUM; i++)
+	{
+		if (0 == strcmp(mGB28181Device.pChannel[i].sourceURL, "\0"))    continue;
+
+		mGB28181Device.pChannel[i].sendStatus = 0;
+
+		EasyStreamClient_Deinit(mGB28181Device.pChannel[i].streamClientHandle);
+		mGB28181Device.pChannel[i].streamClientHandle = NULL;
+
+		//ATC_Deinit(&mGB28181Device.pChannel[i].atcHandle);
+
+		if (NULL != mGB28181Device.pChannel[i].fDat)
+		{
+			fclose(mGB28181Device.pChannel[i].fDat);
+			mGB28181Device.pChannel[i].fDat = NULL;
+		}
+	}
+
+	delete[]mGB28181Device.pChannel;
+	mGB28181Device.pChannel = NULL;
+
+	libGB28181Device_Release();
+
+
+	OutputLog("已停止.\n");
+}
+
+void CEasyGBDDemoDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+
+	Shutdown();
+	DeinitMutex(&mLogMutex);
+}
+
+
+
+void CEasyGBDDemoDlg::OnBnClickedButtonBrowse()
+{
+	//wchar_t szDefaultOpenPath[MAX_PATH] = { 0 };
+	//MByteToWChar(globalRecordingPath, szDefaultOpenPath, sizeof(szDefaultOpenPath) / sizeof(szDefaultOpenPath[0]));
+
+	CFileDialog file(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, L"媒体文件(*.*)|*.*||");
+	//file.m_ofn.lpstrInitialDir = szDefaultOpenPath;
+	if (file.DoModal() != IDOK)		return;
+
+	//获取文件名称
+	file.GetFileName();
+	//获取文件路径,此处只想说明下file.GetPathName()的返回值类型。
+	CString filePath = file.GetPathName();
+
+	pEdtSourceURL->SetWindowTextW(filePath);
+}
+
+
+

+ 111 - 0
Win/EasyGBD_DemoDlg.h

@@ -0,0 +1,111 @@
+
+// EasyGBD_DemoDlg.h: 头文件
+//
+
+#pragma once
+
+#include "osmutex.h"
+#include <vector>
+#include "GB28181DeviceAPI.h"
+#include "EasyStreamClientAPI.h"
+//#pragma comment(lib, "libEasyStreamClient.lib")
+
+#include <string>
+using namespace std;
+typedef vector<string>	LOG_VECTOR;
+
+#define WM_UPDATE_LOG		(WM_USER+1001)
+
+typedef struct __GB28181_CHANNEL_T
+{
+	int         id;
+	char        sourceURL[260];
+	Easy_Handle  streamClientHandle;
+	//ATC_HANDLE  atcHandle;
+
+	int			videoCodec;
+	int         srcAudioCodec;
+	int         sendStatus;
+
+	int         audioOutputFormat;
+
+
+	FILE* fDat;
+
+	void* userptr;
+}GB28181_CHANNEL_T;
+
+typedef struct __GB28181_DEVICE_T
+{
+	GB28181_CHANNEL_T* pChannel;
+}GB28181_DEVICE_T;
+
+#define MAX_GB28181_CHANNEL_NUM		1
+
+// CEasyGBDDemoDlg 对话框
+class CEasyGBDDemoDlg : public CDialogEx
+{
+// 构造
+public:
+	CEasyGBDDemoDlg(CWnd* pParent = nullptr);	// 标准构造函数
+
+	CEdit* pEdtServerSipID;			//IDC_EDIT_SERVER_SIPID
+	CEdit* pEdtServerIP;			//IDC_EDIT_SERVER_IP
+	CEdit* pEdtServerPort;			//IDC_EDIT_SERVER_PORT
+	CEdit* pEdtRegExpire;			//IDC_EDIT_REG_EXPIRE
+	CEdit* pEdtHeartbeatCount;		//IDC_EDIT_HEARTBEAT_COUNT
+	CEdit* pEdtHeartbeatInterval;	//IDC_EDIT_HEARTBEAT_INTERVAL
+	CComboBox* pComboxProtocol;		//IDC_COMBO_PROTOCOL
+	CEdit* pEdtPassword;			//IDC_EDIT_PASSWORD
+	CEdit* pEdtLocalSipID;			//IDC_EDIT_LOCAL_SIPID
+	CEdit* pEdtLocalPort;			//IDC_EDIT_LOCAL_PORT
+	CEdit* pEdtSourceURL;			//IDC_EDIT_SOURCE_URL
+
+	CButton* pBtnStartup;			//IDC_BUTTON_STARTUP
+	CButton* pBtnShutdown;			//IDC_BUTTON_SHUTDOWN
+	CRichEditCtrl* pRichEditLog;	//IDC_RICHEDIT2_LOG
+
+
+
+	int		Startup(const char *serverSIPId, const char *serverIP, const int serverPort,
+		const int reg_expires, const int heartbeatCount, const int heartbeatInterval,
+		const int protocol, const char *password, const char *localSIPId, const int localPort, const char *sourceURL);
+	void	Shutdown();
+
+	GB28181_DEVICE_T	mGB28181Device;
+
+	int OutputLog(char* szFormat, ...);
+	void OutputLog2UI();
+	void	LockLogMutex() { LockMutex(&mLogMutex); }
+	void	UnlockLogMutex() { UnlockMutex(&mLogMutex); }
+	LOG_VECTOR		mLogVector;
+	OSMutex			mLogMutex;
+
+
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_EASYGBD_DEMO_DIALOG };
+#endif
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持
+
+
+// 实现
+protected:
+	HICON m_hIcon;
+
+	// 生成的消息映射函数
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+	afx_msg void OnPaint();
+	afx_msg HCURSOR OnQueryDragIcon();
+	DECLARE_MESSAGE_MAP()
+	afx_msg LRESULT OnUpdateLog(WPARAM, LPARAM);
+public:
+	afx_msg void OnBnClickedButtonStart();
+	afx_msg void OnDestroy();
+	afx_msg void OnBnClickedButtonShutdown();
+	afx_msg void OnBnClickedButtonBrowse();
+};

+ 84 - 0
Win/EasyStreamClientAPI.h

@@ -0,0 +1,84 @@
+/*
+	Copyright (c) 2013-2015 EasyDarwin.ORG.  All rights reserved.
+	Github: https://github.com/EasyDarwin
+	WEChat: EasyDarwin
+	Website: http://www.easydarwin.org
+*/
+#ifndef _EASY_STREAM_CLIENT_API_H
+#define _EASY_STREAM_CLIENT_API_H
+
+#include "EasyTypes.h"
+
+/* 推送事件类型定义 */
+typedef enum __EASY_STREAM_CLIENT_STATE_T
+{
+	EASY_STREAM_CLIENT_STATE_CONNECTING = 1,		 /* 连接中 */
+	EASY_STREAM_CLIENT_STATE_CONNECTED,              /* 连接成功 */
+	EASY_STREAM_CLIENT_STATE_CONNECT_FAILED,         /* 连接失败 */
+	EASY_STREAM_CLIENT_STATE_CONNECT_ABORT,          /* 连接中断 */
+	EASY_STREAM_CLIENT_STATE_PUSHING,                /* 推流中 */
+	EASY_STREAM_CLIENT_STATE_DISCONNECTED,           /* 断开连接 */
+	EASY_STREAM_CLIENT_STATE_EXIT,					 /* 退出连接 */
+	EASY_STREAM_CLIENT_STATE_ERROR
+} EASY_STREAM_CLIENT_STATE_T;
+
+/*
+_channelPtr:	通道对应对象,暂时不用
+_frameType:		EASY_SDK_VIDEO_FRAME_FLAG/EASY_SDK_AUDIO_FRAME_FLAG/EASY_SDK_EVENT_FRAME_FLAG/...
+_pBuf:			回调的数据部分,具体用法看Demo
+_frameInfo:		帧结构数据
+*/
+typedef int (Easy_APICALL *EasyStreamClientCallBack)(void *_channelPtr, int _frameType, void *pBuf, EASY_FRAME_INFO* _frameInfo);
+typedef int (Easy_APICALL *EasyDownloadCallBack)(void *userptr, const char* path);
+
+#ifdef __cplusplus
+extern "C" 
+{
+#endif
+	/* 创建EasyStreamClient句柄  返回0表示成功,返回非0表示失败 ;  loglevel : 0 - quiet  1 - debug*/
+	Easy_API int Easy_APICALL EasyStreamClient_Init(Easy_Handle *handle, int loglevel);
+
+	/* 释放EasyStreamClient 参数为EasyStreamClient句柄 */
+	Easy_API int Easy_APICALL EasyStreamClient_Deinit(Easy_Handle handle);
+
+	/* 设置背景音 flag: 1 开启 0:关闭 url:背景音路径包含文件名 ret: 0:成功  < 0:配置失败 1:不支持背景音功能*/
+	Easy_API int Easy_APICALL EasyStreamClient_SetBackAudio(Easy_Handle handle, int flag, char* url);
+
+	/* 设置数据回调 */
+	Easy_API int Easy_APICALL EasyStreamClient_SetCallback(Easy_Handle handle, EasyStreamClientCallBack callback);
+
+	/* 设置叠加图片 */
+	Easy_API int Easy_APICALL EasyStreamClient_SetOverlayImage(Easy_Handle handle, int left, int top, int scaleWidth, int scaleHeight, const char* imageFilePath);
+
+	/* 打开网络流 */
+	Easy_API int Easy_APICALL EasyStreamClient_OpenStream(Easy_Handle handle, char *url, EASY_RTP_CONNECT_TYPE connType, void *userPtr, int reconn, int timeout, int useExtraData);
+
+	/* 获取输入流的context */
+	Easy_API int Easy_APICALL EasyStreamClient_GetStreamContext(Easy_Handle handle, void** avFormatContext, void** avCodecContext);
+
+	/* 获取快照 */
+	Easy_API int Easy_APICALL EasyStreamClient_GetSnap(Easy_Handle handle);
+
+
+	Easy_API int Easy_APICALL EasyStreamClient_ConvertFrame2Image(const unsigned int videoCodec, const unsigned char* keyFrameData, int keyFrameDataSize, unsigned char** outImage, int* outImageSize);
+	Easy_API int Easy_APICALL EasyStreamClient_ReleaseImageData(unsigned char** imageData);
+
+
+
+	/* 设置音频是否启用 */
+	Easy_API int Easy_APICALL EasyStreamClient_SetAudioEnable(Easy_Handle handle, int enable);
+
+	Easy_API int Easy_APICALL EasyStreamClient_SetAudioOutFormat(Easy_Handle handle, unsigned int audioFormat, int samplerate, int channels);
+
+	/* 获取音频是否启用 */
+	Easy_API int Easy_APICALL EasyStreamClient_GetAudioEnable(Easy_Handle handle);
+
+	/*录像下载*/
+	Easy_API int Easy_APICALL EasyStreamClient_SetDownloadCallback(EasyDownloadCallBack callback);
+	Easy_API int Easy_APICALL EasyStreamClient_DownloadOneRecord(const char* rootPath, const char* streamName, const char* startTime, void* userPtr);
+	Easy_API int Easy_APICALL EasyStreamClient_DownloadPeriod(const char* rootPath, const char* streamName, const char* startTime, const char* endTime, void* userPtr);
+#ifdef __cplusplus
+};
+#endif
+
+#endif

+ 168 - 0
Win/EasyTypes.h

@@ -0,0 +1,168 @@
+/*
+	Copyright (c) 2012-2019 TSINGSEE.COM.  All rights reserved.
+	Github: https://github.com/tsingsee
+	WEChat: tsingsee
+	Website: http://www.tsingsee.com
+*/
+#ifndef _Easy_Types_H
+#define _Easy_Types_H
+
+#ifdef _WIN32
+#define Easy_API  __declspec(dllexport)
+#define Easy_APICALL  __stdcall
+#define WIN32_LEAN_AND_MEAN
+#else
+#define Easy_API __attribute__ ((visibility("default")))
+#define Easy_APICALL  __attribute__ ((visibility("default")))
+#endif
+
+#define Easy_Handle void*
+
+typedef int						Easy_I32;
+typedef unsigned char           Easy_U8;
+typedef unsigned char           Easy_UChar;
+typedef unsigned short          Easy_U16;
+typedef unsigned int            Easy_U32;
+typedef unsigned char			Easy_Bool;
+
+enum
+{
+    Easy_NoErr						= 0,
+    Easy_RequestFailed				= -1,
+    Easy_Unimplemented				= -2,
+    Easy_RequestArrived				= -3,
+    Easy_OutOfState					= -4,
+    Easy_NotAModule					= -5,
+    Easy_WrongVersion				= -6,
+    Easy_IllegalService				= -7,
+    Easy_BadIndex					= -8,
+    Easy_ValueNotFound				= -9,
+    Easy_BadArgument				= -10,
+    Easy_ReadOnly					= -11,
+	Easy_NotPreemptiveSafe			= -12,
+    Easy_NotEnoughSpace				= -13,
+    Easy_WouldBlock					= -14,
+    Easy_NotConnected				= -15,
+    Easy_FileNotFound				= -16,
+    Easy_NoMoreData					= -17,
+    Easy_AttrDoesntExist			= -18,
+    Easy_AttrNameExists				= -19,
+    Easy_InstanceAttrsNotAllowed	= -20,
+	Easy_InvalidSocket				= -21,
+	Easy_MallocError				= -22,
+	Easy_ConnectError				= -23,
+	Easy_SendError					= -24
+};
+typedef int Easy_Error;
+
+typedef enum __EASY_ACTIVATE_ERR_CODE_ENUM
+{
+	EASY_ACTIVATE_INVALID_KEY		=		-1,			/* 无效Key */
+	EASY_ACTIVATE_TIME_ERR			=		-2,			/* 时间错误 */
+	EASY_ACTIVATE_PROCESS_NAME_LEN_ERR	=	-3,			/* 进程名称长度不匹配 */
+	EASY_ACTIVATE_PROCESS_NAME_ERR	=		-4,			/* 进程名称不匹配 */
+	EASY_ACTIVATE_VALIDITY_PERIOD_ERR=		-5,			/* 有效期校验不一致 */
+	EASY_ACTIVATE_PLATFORM_ERR		=		-6,			/* 平台不匹配 */
+	EASY_ACTIVATE_COMPANY_ID_LEN_ERR=		-7,			/* 授权使用商不匹配 */
+	EASY_ACTIVATE_SUCCESS			=		9999,		/* 激活成功 */
+
+}EASY_ACTIVATE_ERR_CODE_ENUM;
+
+/* 视频编码 */
+#define EASY_SDK_VIDEO_CODEC_H264	0x1C		/* H264  */
+#define EASY_SDK_VIDEO_CODEC_H265	0xAE	  /* H265 */
+#define	EASY_SDK_VIDEO_CODEC_MJPEG	0x08		/* MJPEG */
+#define	EASY_SDK_VIDEO_CODEC_MPEG4	0x0D		/* MPEG4 */
+
+/* 音频编码 */
+#define EASY_SDK_AUDIO_CODEC_AAC	0x15002		/* AAC */
+#define EASY_SDK_AUDIO_CODEC_G711U	0x10006		/* G711 ulaw*/
+#define EASY_SDK_AUDIO_CODEC_G711A	0x10007		/* G711 alaw*/
+#define EASY_SDK_AUDIO_CODEC_G726	0x1100B		/* G726 */
+
+#define EASY_SDK_EVENT_CODEC_ERROR	0x63657272	/* ERROR */
+#define EASY_SDK_EVENT_CODEC_EXIT	0x65786974	/* EXIT */
+
+/* 音视频帧标识 */
+#define EASY_SDK_VIDEO_FRAME_FLAG	0x00000001		/* 视频帧标志 */
+#define EASY_SDK_AUDIO_FRAME_FLAG	0x00000002		/* 音频帧标志 */
+#define EASY_SDK_EVENT_FRAME_FLAG	0x00000004		/* 事件帧标志 */
+#define EASY_SDK_RTP_FRAME_FLAG		0x00000008		/* RTP帧标志 */
+#define EASY_SDK_SDP_FRAME_FLAG		0x00000010		/* SDP帧标志 */
+#define EASY_SDK_MEDIA_INFO_FLAG	0x00000020		/* 媒体类型标志*/
+#define EASY_SDK_SNAP_FRAME_FLAG	0x00000040		/* 图片标志*/
+
+/* 视频关键字标识 */
+#define EASY_SDK_VIDEO_FRAME_I		0x01		/* I帧 */
+#define EASY_SDK_VIDEO_FRAME_P		0x02		/* P帧 */
+#define EASY_SDK_VIDEO_FRAME_B		0x03		/* B帧 */
+#define EASY_SDK_VIDEO_FRAME_J		0x04		/* JPEG */
+
+/* 连接类型 */
+typedef enum __EASY_RTP_CONNECT_TYPE
+{
+	EASY_RTP_OVER_TCP	=	0x01,		/* RTP Over TCP */
+	EASY_RTP_OVER_UDP,					/* RTP Over UDP */
+	EASY_RTP_OVER_MULTICAST				/* RTP Over MULTICAST */
+}EASY_RTP_CONNECT_TYPE;
+
+typedef struct __EASY_AV_Frame
+{
+	Easy_U32    u32AVFrameFlag;		/* 帧标志  视频 or 音频 */
+	Easy_U32    u32AVFrameLen;		/* 帧的长度 */
+	Easy_U32    u32VFrameType;		/* 视频的类型,I帧或P帧 */
+	Easy_U8     *pBuffer;			/* 数据 */
+	Easy_U32	u32TimestampSec;	/* 时间戳(秒)*/
+	Easy_U32	u32TimestampUsec;	/* 时间戳(微秒) */
+	Easy_U32    u32PTS;
+} EASY_AV_Frame;
+
+/* 媒体信息 */
+typedef struct __EASY_MEDIA_INFO_T
+{
+	Easy_U32 u32VideoCodec;				/* 视频编码类型 */
+	Easy_U32 u32VideoFps;				/* 视频帧率 */
+
+	Easy_U32 u32AudioCodec;				/* 音频编码类型 */
+	Easy_U32 u32AudioSamplerate;		/* 音频采样率 */
+	Easy_U32 u32AudioChannel;			/* 音频通道数 */
+	Easy_U32 u32AudioBitsPerSample;		/* 音频采样精度 */
+
+	Easy_U32 u32VpsLength;
+	Easy_U32 u32SpsLength;
+	Easy_U32 u32PpsLength;
+	Easy_U32 u32SeiLength;
+	Easy_U8	 u8Vps[256];
+	Easy_U8	 u8Sps[256];
+	Easy_U8	 u8Pps[128];
+	Easy_U8	 u8Sei[128];
+}EASY_MEDIA_INFO_T;
+
+/* 帧信息 */
+typedef struct 
+{
+	unsigned int	codec;				/* 音视频格式 */
+
+	unsigned int	type;				/* 视频帧类型 */
+	unsigned char	fps;				/* 视频帧率 */
+	unsigned short	width;				/* 视频宽 */
+	unsigned short  height;				/* 视频高 */
+
+	unsigned int	reserved1;			/* 保留参数1 */
+	unsigned int	reserved2;			/* 保留参数2 */
+	unsigned int	reserved3;			/* 保留参数3 */
+
+	unsigned int	sample_rate;		/* 音频采样率 */
+	unsigned int	channels;			/* 音频声道数 */
+	unsigned int	bits_per_sample;	/* 音频采样精度 */
+
+	unsigned int	length;				/* 音视频帧大小 */
+	unsigned int    timestamp_usec;		/* 时间戳,微妙 */
+	unsigned int	timestamp_sec;		/* 时间戳 秒 */
+	unsigned int	pts;
+	
+	float			bitrate;			/* 比特率 */
+	float			losspacket;			/* 丢包率 */
+}EASY_FRAME_INFO;
+
+#endif

+ 154 - 0
Win/GB28181DeviceAPI.h

@@ -0,0 +1,154 @@
+#ifndef __GB28181_DEVICE_API_H__
+#define __GB28181_DEVICE_API_H__
+
+#ifdef ANDROID
+#include <android/log.h>
+#define  LOG_TAG  "GB28181Device"
+#define LOGI(...)  __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+#define LOGE(...)  __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
+#define LOGD(...)  __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
+#endif
+
+#ifdef _WIN32
+#include <winsock2.h>
+#define GB28181DEVICE_API  __declspec(dllexport)
+#define GB28181DEVICE_APICALL  __stdcall
+#define WIN32_LEAN_AND_MEAN
+#else
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#define GB28181DEVICE_API __attribute__ ((visibility("default")))
+#define GB28181DEVICE_APICALL 
+#define CALLBACK
+#endif
+
+typedef enum __GB28181_DEVICE_EVENT_TYPE_ENUM_T
+{
+	GB28181_DEVICE_EVENT_CONNECTING = 1,		//连接中
+	GB28181_DEVICE_EVENT_REGISTER_ING,			//注册中
+	GB28181_DEVICE_EVENT_REGISTER_OK,			//注册成功
+	GB28181_DEVICE_EVENT_REGISTER_AUTH_FAIL,	//用户验证失败
+	GB28181_DEVICE_EVENT_START_AUDIO_VIDEO,		//请求推送音视频
+	GB28181_DEVICE_EVENT_STOP_AUDIO_VIDEO,		//请求停止推送音视频
+	GB28181_DEVICE_EVENT_TALK_AUDIO_DATA,		//对端对讲数据
+
+	GB28181_DEVICE_EVENT_DISCONNECT				//已断线
+}GB28181_DEVICE_EVENT_TYPE_ENUM_T;
+
+#define MAX_CH_NUMS     8
+
+
+typedef struct __GB28181_CHANNEL_INFO_T
+{
+	char	id[32];
+	char	name[64];
+	char	manufacturer[32];
+	char	model[32];
+	char	parentId[32];
+	char	owner[32];
+	char	civilCode[32];
+	char	address[64];
+	double	longitude;
+	double  latitude;
+
+}GB28181_CHANNEL_INFO_T;
+
+typedef struct __GB28181_DEVICE_INFO_T
+{
+	char	server_ip[128];     // server ip
+	int		server_port;        // server port
+	char    server_id[32];      // server id
+	char	server_domain[64];  // server domain
+	char	device_id[32];      // device id
+	int		localSipPort;		//Local sip port
+	int     channel_nums;       // channel numbers
+	GB28181_CHANNEL_INFO_T channel[MAX_CH_NUMS];
+	char	password[32];	    // password
+	int		protocol;			// 0 - udp; 1 - tcp
+	int		reg_expires;        // sip reg user expires, unit is second
+	int		heartbeat_interval; // gb28181 heartbeat interval, unit is second
+	int		heartbeat_count;    // gb28181 heartbeat count
+	int     log_enable;         // log enable flag
+	int     log_level;          // log level(0:TRACE,1:DEBUG,2:INFO,3:WARNING,4:ERROR,5:FATAL)
+}GB28181_DEVICE_INFO_T;
+
+typedef int (CALLBACK* GB28181DeviceCALLBACK)(void *userPtr, int channelId, int eventType, char *eventParams, int paramLength);
+
+
+//创建GB28181设备端资源
+/*
+pDeviceInfo:		设备端信息, 为NULL则从当前目录中读取config.xml
+callbackPtr:		回调函数
+userPtr:			用户自定义指针,用于在回调函数中回调给调用者
+*/
+int GB28181DEVICE_API	libGB28181Device_Create(GB28181_DEVICE_INFO_T *pDeviceInfo, GB28181DeviceCALLBACK callbackPtr, void *userPtr);
+
+int GB28181DEVICE_API	libGB28181Device_Create2(char* serverIP, int serverPort, char* serverId, char* serverDomain,
+													char* deviceId, int localSipPort, int channelNum,
+													GB28181_CHANNEL_INFO_T*pChannel,
+													char* password, int protocol,
+													int regExpires, int heartbeatInterval, int heartbeatCount,
+													GB28181DeviceCALLBACK callbackPtr, void* userPtr);
+
+//指定视频格式
+/*
+codec:
+		#define EASY_SDK_VIDEO_CODEC_H264	0x1C		//H264
+		#define EASY_SDK_VIDEO_CODEC_H265	0xAE		//H265
+width:	可选
+height:	可选
+framerate: 可选
+*/
+int GB28181DEVICE_API	libGB28181Device_SetVideoFormat(int channelId, unsigned int codec, int width, int height, int framerate);
+
+//指定音频格式
+/*
+audioDstCodec:
+		#define EASY_SDK_AUDIO_CODEC_AAC	0x15002		// AAC
+		#define EASY_SDK_AUDIO_CODEC_G711U	0x10006		// G711 ulaw
+		#define EASY_SDK_AUDIO_CODEC_G711A	0x10007		// G711 alaw
+samplerate:		采样率
+channels:		声道数
+bitPerSample:	采样精度
+*/
+int GB28181DEVICE_API	libGB28181Device_SetAudioFormat(int channelId, unsigned int audioDstCodec, int samplerate, int channels, int bitPerSamples);
+
+//设置通道实时经纬度信息
+int GB28181DEVICE_API	libGB28181Device_SetLotLat(int channelId, double longitude, double latitude);
+
+//推送视频数据
+/*
+framedata:	视频帧数据
+framesize:	视频帧大小
+keyframe:	关键帧填1, 否则填0
+*/
+int GB28181DEVICE_API	libGB28181Device_AddVideoData(int channelId, char* framedata, int framesize, int keyframe);
+
+//推送音频数据
+/*
+audioSrcCodec:	当前音频源格式
+		#define EASY_SDK_AUDIO_CODEC_G711U	0x10006		// G711 ulaw
+		#define EASY_SDK_AUDIO_CODEC_G711A	0x10007		// G711 alaw
+		#define EASY_SDK_AUDIO_CODEC_PCM	0x00007		// PCM
+
+		如果audioSrcCodec和libGB28181Device_SetAudioFormat中指定的audioDstCodec不一致时, 则会自动进行转换, 
+		但仅限于从PCM转为G711,即此处的audioSrcCodec为PCM, 而audioDstCodec为G711
+framedata:	音频帧数据
+framesize:  音频帧大小
+nbsamples:	同音频帧大小
+*/
+int GB28181DEVICE_API	libGB28181Device_AddAudioData(int channelId, unsigned int audioSrcCodec, char* framedata, int framesize, int nbsamples);
+
+
+//释放资源
+int GB28181DEVICE_API	libGB28181Device_Release();
+
+
+#ifdef ANDROID
+#include <jni.h>
+extern JavaVM *g_vm;
+#endif
+
+
+#endif

BIN
Win/Lib/x64/GB28181Device.dll


BIN
Win/Lib/x64/GB28181Device.lib


BIN
Win/Lib/x64/avcodec-58.dll


BIN
Win/Lib/x64/avdevice-58.dll


BIN
Win/Lib/x64/avfilter-7.dll


BIN
Win/Lib/x64/avformat-58.dll


BIN
Win/Lib/x64/avutil-56.dll


BIN
Win/Lib/x64/libEasyStreamClient.dll


BIN
Win/Lib/x64/libEasyStreamClient.lib


BIN
Win/Lib/x64/libeay32.dll


BIN
Win/Lib/x64/postproc-55.dll


BIN
Win/Lib/x64/ssleay32.dll


BIN
Win/Lib/x64/swresample-3.dll


BIN
Win/Lib/x64/swscale-5.dll


+ 49 - 0
Win/framework.h

@@ -0,0 +1,49 @@
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+
+#include <afxdisp.h>        // MFC 自动化类
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h>     // MFC 支持功能区和控制条
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+

+ 44 - 0
Win/osmutex.cpp

@@ -0,0 +1,44 @@
+#include "osmutex.h"
+
+
+
+int InitMutex(OSMutex *mutex)
+{
+#ifdef _WIN32
+	InitializeCriticalSection(mutex);
+#else
+	pthread_mutex_init(mutex, NULL);
+#endif
+	return 0;
+}
+
+int	LockMutex(OSMutex *mutex)
+{
+#ifdef _WIN32
+	EnterCriticalSection(mutex);
+#else
+	(void)pthread_mutex_lock(mutex);
+#endif
+	return 0;
+}
+
+int UnlockMutex(OSMutex *mutex)
+{
+#ifdef _WIN32
+	LeaveCriticalSection(mutex);
+#else
+	pthread_mutex_unlock(mutex);
+#endif
+	return 0;
+}
+
+int DeinitMutex(OSMutex *mutex)
+{
+#ifdef _WIN32
+	DeleteCriticalSection(mutex);
+#else
+	pthread_mutex_destroy(mutex);
+#endif
+	return 0;
+}
+

+ 26 - 0
Win/osmutex.h

@@ -0,0 +1,26 @@
+#ifndef __OS_MUTEX_H__
+#define __OS_MUTEX_H__
+
+#ifdef _WIN32
+#include <winsock2.h>
+
+#else
+#include <pthread.h>
+
+#endif
+
+#ifdef _WIN32
+typedef	CRITICAL_SECTION	OSMutex;
+#else
+typedef	pthread_mutex_t		OSMutex;
+#endif
+
+
+int InitMutex(OSMutex *mutex);
+int	LockMutex(OSMutex *mutex);
+int UnlockMutex(OSMutex *mutex);
+int DeinitMutex(OSMutex *mutex);
+
+
+
+#endif

+ 5 - 0
Win/pch.cpp

@@ -0,0 +1,5 @@
+// pch.cpp: 与预编译标头对应的源文件
+
+#include "pch.h"
+
+// 当使用预编译的头时,需要使用此源文件,编译才能成功。

+ 13 - 0
Win/pch.h

@@ -0,0 +1,13 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+
+// 添加要在此处预编译的标头
+#include "framework.h"
+
+#endif //PCH_H

BIN
Win/res/EasyGBDDemo.rc2


BIN
Win/res/EasyGBD_Demo.ico


BIN
Win/resource.h


+ 8 - 0
Win/targetver.h

@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+//如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>