mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
init
This commit is contained in:
31
libs/hwcodec/dev/vs/AMFTest/AMFTest.sln
Normal file
31
libs/hwcodec/dev/vs/AMFTest/AMFTest.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33627.172
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMFTest", "AMFTest.vcxproj", "{59599E6A-52F7-44DD-9EC5-487342FF33F8}"
|
||||
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
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Debug|x64.Build.0 = Debug|x64
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Debug|x86.Build.0 = Debug|Win32
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Release|x64.ActiveCfg = Release|x64
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Release|x64.Build.0 = Release|x64
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Release|x86.ActiveCfg = Release|Win32
|
||||
{59599E6A-52F7-44DD-9EC5-487342FF33F8}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E1168B32-184A-4268-AC43-21E66A82F076}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
154
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj
Normal file
154
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj
Normal file
@@ -0,0 +1,154 @@
|
||||
<?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>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{59599e6a-52f7-44dd-9ec5-487342ff33f8}</ProjectGuid>
|
||||
<RootNamespace>AMFTest</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</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" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;CSO_DIR="../../render/res";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\..\externals\AMF_v1.4.29\amf;..\..\externals\AMF_v1.4.29\amf\public\common;..\..\common\src;..\..\common\src\platform\win;..\..\externals\nvEncDXGIOutputDuplicationSample;..\..\codec\src;..\..\externals\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\..\externals\SDL\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>SDL2.lib;dxgi.lib;d3d11.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\amf\src\common.cpp" />
|
||||
<ClCompile Include="..\..\amf\src\decode.cpp" />
|
||||
<ClCompile Include="..\..\amf\src\encode.cpp" />
|
||||
<ClCompile Include="..\..\capture\src\dxgi.cpp" />
|
||||
<ClCompile Include="..\..\codec\src\data.c" />
|
||||
<ClCompile Include="..\..\codec\src\utils.c" />
|
||||
<ClCompile Include="..\..\common\src\log.cpp" />
|
||||
<ClCompile Include="..\..\common\src\platform\win\win.cpp" />
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\AMFFactory.cpp" />
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\AMFSTL.cpp" />
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\Thread.cpp" />
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\TraceAdapter.cpp" />
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\Windows\ThreadWindows.cpp" />
|
||||
<ClCompile Include="..\..\externals\nvEncDXGIOutputDuplicationSample\DDAImpl.cpp" />
|
||||
<ClCompile Include="..\..\externals\nvEncDXGIOutputDuplicationSample\Preproc.cpp" />
|
||||
<ClCompile Include="..\..\render\src\dxgi_sdl.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
83
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj.filters
Normal file
83
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj.filters
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="source">
|
||||
<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="source\externals">
|
||||
<UniqueIdentifier>{a09eabb2-ceac-4062-b19e-244b29176c2b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\externals\AMF_v1.4.29">
|
||||
<UniqueIdentifier>{8adb5a7a-3fba-4330-9a43-dc4251f2ff2f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\externals\nvEncDXGIOutputDuplicationSample">
|
||||
<UniqueIdentifier>{2bc8fd1a-5082-40fb-a6b5-ac8c3b84d450}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\render">
|
||||
<UniqueIdentifier>{6edc9023-4c96-4474-b544-20059b2e32ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\codec">
|
||||
<UniqueIdentifier>{ccee2176-d5f2-46b3-b138-538ac9bd7d13}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\common">
|
||||
<UniqueIdentifier>{8a1b8e43-9bdb-4e28-98d9-854c8e8bf107}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="source\capture">
|
||||
<UniqueIdentifier>{a65898d7-8992-40d0-9141-7b4f10415e1f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\AMFFactory.cpp">
|
||||
<Filter>source\externals\AMF_v1.4.29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\AMFSTL.cpp">
|
||||
<Filter>source\externals\AMF_v1.4.29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\Thread.cpp">
|
||||
<Filter>source\externals\AMF_v1.4.29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\Windows\ThreadWindows.cpp">
|
||||
<Filter>source\externals\AMF_v1.4.29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\AMF_v1.4.29\amf\public\common\TraceAdapter.cpp">
|
||||
<Filter>source\externals\AMF_v1.4.29</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\nvEncDXGIOutputDuplicationSample\DDAImpl.cpp">
|
||||
<Filter>source\externals\nvEncDXGIOutputDuplicationSample</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\externals\nvEncDXGIOutputDuplicationSample\Preproc.cpp">
|
||||
<Filter>source\externals\nvEncDXGIOutputDuplicationSample</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\common\src\platform\win\win.cpp">
|
||||
<Filter>source\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\capture\src\dxgi.cpp">
|
||||
<Filter>source\capture</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\render\src\dxgi_sdl.cpp">
|
||||
<Filter>source\render</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\codec\src\data.c">
|
||||
<Filter>source\codec</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\codec\src\utils.c">
|
||||
<Filter>source\codec</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\amf\src\common.cpp">
|
||||
<Filter>source\codec</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\amf\src\decode.cpp">
|
||||
<Filter>source\codec</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\amf\src\encode.cpp">
|
||||
<Filter>source\codec</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\common\src\log.cpp">
|
||||
<Filter>source\common</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
4
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj.user
Normal file
4
libs/hwcodec/dev/vs/AMFTest/AMFTest.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
109
libs/hwcodec/dev/vs/AMFTest/main.cpp
Normal file
109
libs/hwcodec/dev/vs/AMFTest/main.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include <Windows.h>
|
||||
#include <callback.h>
|
||||
#include <common.h>
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <system.h>
|
||||
|
||||
extern "C" {
|
||||
void *dxgi_new_capturer(int64_t luid);
|
||||
void *dxgi_device(void *self);
|
||||
int dxgi_width(const void *self);
|
||||
int dxgi_height(const void *self);
|
||||
void *dxgi_capture(void *self, int wait_ms);
|
||||
void destroy_dxgi_capturer(void *self);
|
||||
void *amf_new_encoder(void *hdl, int64_t luid, API api, DataFormat dataFormat,
|
||||
int32_t width, int32_t height, int32_t kbs,
|
||||
int32_t framerate, int32_t gop);
|
||||
int amf_encode(void *e, void *tex, EncodeCallback callback, void *obj);
|
||||
int amf_destroy_encoder(void *e);
|
||||
void *amf_new_decoder(void *device, int64_t luid, int32_t api,
|
||||
int32_t dataFormat, bool outputSharedHandle);
|
||||
int amf_decode(void *decoder, uint8_t *data, int32_t length,
|
||||
DecodeCallback callback, void *obj);
|
||||
int amf_destroy_decoder(void *decoder);
|
||||
void *CreateDXGIRender(long long luid, bool inputSharedHandle);
|
||||
int DXGIRenderTexture(void *render, HANDLE shared_handle);
|
||||
void DestroyDXGIRender(void *render);
|
||||
void *DXGIDevice(void *render);
|
||||
}
|
||||
|
||||
static const uint8_t *encode_data;
|
||||
static int32_t encode_len;
|
||||
static void *decode_shared_handle;
|
||||
|
||||
extern "C" static void encode_callback(const uint8_t *data, int32_t len,
|
||||
int32_t key, const void *obj) {
|
||||
encode_data = data;
|
||||
encode_len = len;
|
||||
std::cerr << "encode len" << len << std::endl;
|
||||
}
|
||||
|
||||
extern "C" static void decode_callback(void *shared_handle, const void *obj) {
|
||||
decode_shared_handle = shared_handle;
|
||||
}
|
||||
|
||||
extern "C" void log_gpucodec(int level, const char *message) {
|
||||
std::cout << message << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
Adapters adapters;
|
||||
adapters.Init(ADAPTER_VENDOR_AMD);
|
||||
if (adapters.adapters_.size() == 0) {
|
||||
std::cout << "no amd adapter" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
int64_t luid = LUID(adapters.adapters_[0].get()->desc1_);
|
||||
DataFormat dataFormat = H264;
|
||||
void *dup = dxgi_new_capturer(luid);
|
||||
if (!dup) {
|
||||
std::cerr << "create duplicator failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
int width = dxgi_width(dup);
|
||||
int height = dxgi_height(dup);
|
||||
std::cout << "width: " << width << " height: " << height << std::endl;
|
||||
void *device = dxgi_device(dup);
|
||||
void *encoder = amf_new_encoder(device, luid, API_DX11, dataFormat, width,
|
||||
height, 4000, 30, 0xFFFF);
|
||||
if (!encoder) {
|
||||
std::cerr << "create encoder failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
void *render = CreateDXGIRender(luid, false);
|
||||
if (!render) {
|
||||
std::cerr << "create render failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *decoder =
|
||||
amf_new_decoder(DXGIDevice(render), luid, API_DX11, dataFormat, false);
|
||||
if (!decoder) {
|
||||
std::cerr << "create decoder failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
void *texture = dxgi_capture(dup, 100);
|
||||
if (!texture) {
|
||||
std::cerr << "texture is NULL" << std::endl;
|
||||
continue;
|
||||
}
|
||||
if (0 != amf_encode(encoder, texture, encode_callback, NULL)) {
|
||||
std::cerr << "encode failed" << std::endl;
|
||||
continue;
|
||||
}
|
||||
if (0 != amf_decode(decoder, (uint8_t *)encode_data, encode_len,
|
||||
decode_callback, NULL)) {
|
||||
std::cerr << "decode failed" << std::endl;
|
||||
continue;
|
||||
}
|
||||
if (0 != DXGIRenderTexture(render, decode_shared_handle)) {
|
||||
std::cerr << "render failed" << std::endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// no release temporarily
|
||||
}
|
||||
Reference in New Issue
Block a user