ref: a4de0689955cae430342a5ade5432801d497c3b6
parent: 866f8f4086e4de41a793eb1961c3d6af69a02850
author: Sam Leitch <[email protected]>
date: Mon May 5 12:31:04 EDT 2014
Added test app for win32 console
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,6 @@
*.xcworkspacedata
*.xcuserstate
xcuserdata
+win/Debug/
+win/h264bsdTest/Debug/
+*.opensdf
--- a/win/h264bsd.sln
+++ b/win/h264bsd.sln
@@ -3,6 +3,11 @@
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "h264bsd", "h264bsd.vcxproj", "{FC89E991-5229-4CEB-94AF-96C09943FCA4}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "h264bsdTest", "h264bsdTest\h264bsdTest.vcxproj", "{04A99141-FC96-4246-A12C-E47256190982}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FC89E991-5229-4CEB-94AF-96C09943FCA4} = {FC89E991-5229-4CEB-94AF-96C09943FCA4}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -19,6 +24,12 @@
{FC89E991-5229-4CEB-94AF-96C09943FCA4}.Release|Win32.Build.0 = Release|Win32
{FC89E991-5229-4CEB-94AF-96C09943FCA4}.Release|x64.ActiveCfg = Release|x64
{FC89E991-5229-4CEB-94AF-96C09943FCA4}.Release|x64.Build.0 = Release|x64
+ {04A99141-FC96-4246-A12C-E47256190982}.Debug|Win32.ActiveCfg = Debug|Win32
+ {04A99141-FC96-4246-A12C-E47256190982}.Debug|Win32.Build.0 = Debug|Win32
+ {04A99141-FC96-4246-A12C-E47256190982}.Debug|x64.ActiveCfg = Debug|Win32
+ {04A99141-FC96-4246-A12C-E47256190982}.Release|Win32.ActiveCfg = Release|Win32
+ {04A99141-FC96-4246-A12C-E47256190982}.Release|Win32.Build.0 = Release|Win32
+ {04A99141-FC96-4246-A12C-E47256190982}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
--- /dev/null
+++ b/win/h264bsdTest/h264bsdTest.cpp
@@ -1,0 +1,68 @@
+// h264bsdTest.cpp : Defines the entry point for the console application.
+//
+
+#include <SDKDDKVer.h>
+#include <stdio.h>
+#include <tchar.h>
+
+extern "C"
+{
+#include "h264bsd_decoder.h"
+}
+
+
+int _tmain(int argc, _TCHAR* argv[])
+{
+ storage_t *decoder = NULL;
+ char filename[1024];
+ sprintf_s(filename, 1024, "%S", argv[1]);
+ FILE *input = fopen(filename, "rb");
+
+ fseek(input, 0L, SEEK_END);
+ long fileSize = ftell(input);
+
+ u8 *fileData = (u8*)malloc(fileSize);
+ if(fileData == NULL) return 1;
+
+ while(true) {
+ fseek(input, 0L, SEEK_SET);
+ size_t inputRead = fread(fileData, sizeof(u8), fileSize, input);
+
+ u8* byteStrm = fileData;
+ u32 len = fileSize;
+ u32 bytesRead = 0;
+ u32 status = H264BSD_RDY;
+
+ decoder = h264bsdAlloc();
+ status = h264bsdInit(decoder, 0);
+ if(status > 0) return 2;
+
+ while(len > 0) {
+ status = h264bsdDecode(decoder, byteStrm, len, 0, &bytesRead);
+
+ if(status == H264BSD_ERROR) {
+ printf("General Error with %i bytes left\n", len);
+ }
+
+ if(status == H264BSD_PARAM_SET_ERROR) {
+ printf("Param Set Error with %i bytes left\n", len);
+ }
+
+ if(status == H264BSD_MEMALLOC_ERROR) {
+ printf("Malloc Error with %i bytes left\n", len);
+ }
+
+ byteStrm += bytesRead;
+ len-= bytesRead;
+ status = H264BSD_RDY;
+ }
+
+ h264bsdShutdown(decoder);
+ h264bsdFree(decoder);
+
+ printf("Decode complete\n");
+ }
+
+ return 0;
+}
+
--- /dev/null
+++ b/win/h264bsdTest/h264bsdTest.vcxproj
@@ -1,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" 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>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{04A99141-FC96-4246-A12C-E47256190982}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>h264bsdTest</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </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>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>h264bsd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\bin\$(Configuration)\$(Platform)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="h264bsdTest.cpp" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+++ b/win/h264bsdTest/h264bsdTest.vcxproj.filters
@@ -1,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <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>
+ <ClCompile Include="h264bsdTest.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file