Skip to content

Commit

Permalink
Include commit hash in version and x64 optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
SuNNjek committed Oct 8, 2016
1 parent 3069bae commit dbf1f26
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 11 deletions.
14 changes: 13 additions & 1 deletion Build/Version.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,23 @@
<Output TaskParameter="ConsoleOutput" PropertyName="vfwPipeVersion" />
</Exec>

<Exec
Command='git rev-parse --short HEAD'
WorkingDirectory="$(SolutionDir)"
ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="commitHash" />
</Exec>

<Message Text="Transforming version.h..." Importance="high" />
<ReplaceFileText
InputFilename="$(SolutionDir)\vfwPipe\version.h"
OutputFilename="$(SolutionDir)\vfwPipe\version_tmp.h"
MatchExpression="\$version\$"
ReplacementText='$(vfwPipeVersion)'/>
ReplacementText='$(vfwPipeVersion)' />
<ReplaceFileText
InputFilename="$(SolutionDir)\vfwPipe\version_tmp.h"
OutputFilename="$(SolutionDir)\vfwPipe\version_tmp.h"
MatchExpression="\$hash\$"
ReplacementText="$(commitHash)" />
</Target>
</Project>
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ Pipes vfw output to an application like ffmpeg via command line
Usage
-----

You can use it with encoders that accept raw video data like ffmpeg. Just select ffmpeg.exe in the file explorer and pass it with command line like these:
You can use it with encoders that accept raw video data like ffmpeg. Just select ffmpeg.exe and an output file in the file explorer and pass it with command line parameters like these:
```
ffmpeg.exe -f rawvideo -vcodec rawvideo -s [[width]]x[[height]] -r 30000/1001 -pix_fmt rgb24 -i pipe:0 -c:v libx264 -preset slower -qp 17 "[[output]]"
-f rawvideo -vcodec rawvideo -s [[width]]x[[height]] -r 30000/1001 -pix_fmt rgb24 -i pipe:0 -c:v libx264 -preset slower -qp 17 "[[output]]"
```

You can also put the placeholders [[width]], [[height]] and [[output]] in the command line and they will be automatically replaced by the corresponding values.

The open new window option is there for programs like ffplay which show video in an extra window.

Build Requirements
------------------

- MSBuild 12 or newer
- Cygwin with git or some other way to start git from your command line; The folder containing git must be in your Path-variable in order for the Version.targets to replace the version number
2 changes: 1 addition & 1 deletion vfwPipe/drvproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
return TRUE;
}

LRESULT WINAPI DriverProc(DWORD_PTR dwDriverId, HDRVR hDriver, UINT uMsg, LONG lParam1, LONG lParam2)
LRESULT WINAPI DriverProc(DWORD_PTR dwDriverId, HDRVR hDriver, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
pipeHandler* ph = (pipeHandler*)dwDriverId;

Expand Down
6 changes: 3 additions & 3 deletions vfwPipe/pipeHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pipeHandler::~pipeHandler()

void pipeHandler::aboutDlg(HWND parent) {
std::wostringstream stream;
stream << L"vfwPipe " << VFWPIPE_VERSION_STRING << L" by SuNNjek ([email protected])";
stream << L"vfwPipe version " << VFWPIPE_VERSION_STRING_WITH_HASH << L"\nBy " << VFWPIPE_AUTHOR_STRING;
MessageBox(parent, stream.str().c_str(), L"About vfwPipe", MB_OK | MB_ICONINFORMATION);
}

Expand Down Expand Up @@ -431,11 +431,11 @@ void pipeHandler::replaceSubstring(std::wstring &input, std::wstring toReplace,
}

INT_PTR CALLBACK ConfigDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
pipeHandler *ph = (pipeHandler*)GetWindowLong(hwndDlg, DWL_USER);
pipeHandler *ph = (pipeHandler*)GetWindowLongPtr(hwndDlg, DWLP_USER);

if (uMsg == WM_INITDIALOG) {
ph = (pipeHandler*)lParam;
SetWindowLong(hwndDlg, DWLP_USER, (LONG)ph);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)ph);
}
if (ph != NULL)
return ph->ConfigDialog(hwndDlg, uMsg, wParam, lParam);
Expand Down
10 changes: 9 additions & 1 deletion vfwPipe/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
#define STRINGIZEMACRO(s) #s
#define STRINGIZE(s) STRINGIZEMACRO(s)

//Build number automatically inserted by .targets-file, include version_tmp.h instead of version.h and ignore the errors, they'll disappear once you build it :P
//Build number and hash automatically inserted by .targets-file, include version_tmp.h instead of version.h and ignore the errors, they'll disappear once you build it :P

#define VFWPIPE_VERSION_MAJOR 1
#define VFWPIPE_VERSION_MINOR 0
#define VFWPIPE_VERSION_PATCH 1
#define VFWPIPE_VERSION_BUILD $version$

//Hash of last git commit to uniquely identify version
#define VFWPIPE_VERSION_HASH "$hash$"

#define VFWPIPE_VERSION_STRING "v" STRINGIZE(VFWPIPE_VERSION_MAJOR) "." STRINGIZE(VFWPIPE_VERSION_MINOR) "." STRINGIZE(VFWPIPE_VERSION_PATCH) "." STRINGIZE(VFWPIPE_VERSION_BUILD)
#define VFWPIPE_VERSION_STRING_WITH_HASH VFWPIPE_VERSION_STRING "-" VFWPIPE_VERSION_HASH

#define VFWPIPE_AUTHOR "Sunner"
#define VFWPIPE_AUTHOR_MAIL "[email protected]"
#define VFWPIPE_AUTHOR_STRING VFWPIPE_AUTHOR " (" VFWPIPE_AUTHOR_MAIL ")"

#endif // !__VERSION_H__
Binary file modified vfwPipe/vfwPipe.rc
Binary file not shown.
8 changes: 5 additions & 3 deletions vfwPipe/vfwPipe.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{6A0F82A6-CA1D-46EE-A24D-74ACB48CD605}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>vfwPipe2</RootNamespace>
<RootNamespace>vfwPipe</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<ProjectName>vfwPipe</ProjectName>
</PropertyGroup>
Expand Down Expand Up @@ -119,11 +119,12 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;VFWPIPE2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -138,11 +139,12 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;VFWPIPE2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down

0 comments on commit dbf1f26

Please sign in to comment.