x264$(EXE): $(OBJCLI) libx264.a
$(CC) -o $@ $+ $(LDFLAGS)
-x264vfw.dll: libx264.a $(wildcard vfw/*.c vfw/*.h)
- $(MAKE) -C vfw/build/cygwin
-
libx264gtk.a: muxers.o libx264.a
$(MAKE) -C gtk
rm -f $(OBJS) $(OBJASM) $(OBJCLI) $(SONAME) *.a x264 x264.exe .depend TAGS
rm -f checkasm checkasm.exe tools/checkasm.o
rm -f tools/avc2avi tools/avc2avi.exe tools/avc2avi.o
- rm -rf vfw/build/cygwin/bin
rm -f $(SRC2:%.c=%.gcda) $(SRC2:%.c=%.gcno)
- sed -e 's/ *-fprofile-\(generate\|use\)//g' config.mak > config.mak2 && mv config.mak2 config.mak
$(MAKE) -C gtk clean
distclean: clean
- rm -f config.mak config.h vfw/build/cygwin/config.mak x264.pc
+ rm -f config.mak config.h x264.pc
$(MAKE) -C gtk distclean
install: x264 $(SONAME)
echo " --help print this message"
echo " --enable-avis-input enables avisynth input (win32 only)"
echo " --enable-mp4-output enables mp4 output (using gpac)"
-echo " --enable-vfw compiles the VfW frontend"
echo " --enable-gtk build GTK+ interface"
echo " --enable-pthread enables multithreaded encoding"
echo " --enable-debug adds -g, doesn't strip"
debug="no"
gprof="no"
pic="no"
-vfw="no"
gtk="no"
vis="no"
shared="no"
;;
--extra-cflags=*)
CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
- VFW_CFLAGS="${opt#--extra-cflags=}"
;;
--extra-ldflags=*)
LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
- VFW_LDFLAGS="${opt#--extra-ldflags=}"
;;
--enable-pthread)
pthread="yes"
--enable-pic)
pic="yes"
;;
- --enable-vfw)
- vfw="yes"
- ;;
- --disable-vfw)
- vfw="no"
- ;;
--enable-gtk)
gtk="yes"
;;
if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
CFLAGS="$CFLAGS -s -fomit-frame-pointer"
LDFLAGS="$LDFLAGS -s"
- VFW_LDFLAGS="$VFW_LDFLAGS -s"
fi
if [ "$debug" = "yes" ]; then
LDFLAGS=$LDFLAGS
AS=$AS
ASFLAGS=$ASFLAGS
-VFW=$vfw
GTK=$gtk
EXE=$EXE
VIS=$vis
cp config.mak gtk/config.mak
-if [ "$vfw" = "yes" ]; then
- rm -f vfw/build/cygwin/config.mak
- cat > vfw/build/cygwin/config.mak << EOF
-CFLAGS=$VFW_CFLAGS
-LDFLAGS=$VFW_LDFLAGS
-EOF
- echo "default: x264vfw.dll" >> config.mak
-fi
-
if [ "$shared" = "yes" ]; then
API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ')
echo "SONAME=libx264.so.$API" >> config.mak
echo "avis input: $avis_input"
echo "mp4 output: $mp4_output"
echo "pthread: $pthread"
-echo "vfw: $vfw"
echo "gtk: $gtk"
echo "debug: $debug"
echo "gprof: $gprof"
+++ /dev/null
-##############################################################################
-#
-# Makefile for x264 VFW driver
-#
-# Author: XviD project:
-# - Milan Cutka <cutka at szm.sk>,
-# - Edouard Gomez <ed.gomez at free.fr>
-# - Peter Ross <pross@xvid.org>
-# Ported to x264 by Laurent Aimar <fenrir@via.ecp.fr>
-#
-# $Id: Makefile,v 1.1 2004/06/03 19:29:33 fenrir Exp $
-##############################################################################
-
-include config.mak
-
-# Dll to build
-DLL=x264vfw.dll
-
-# Installer executable
-INST_EXE=x264vfw.exe
-
-# Current dir
-DIR_CUR=$(shell pwd)
-
-# Path to include filen library and src
-DIR_INC=$(DIR_CUR)/../../..
-DIR_LIB=$(DIR_CUR)/../../..
-DIR_SRC=$(DIR_CUR)/../..
-
-# Sources
-SRC_C= codec.c config.c driverproc.c
-SRC_RES= resource.rc
-
-# Alias
-RM= rm -rf
-WINDRES=windres
-
-##############################################################################
-# CFLAGS
-##############################################################################
-
-# Constants which should not be modified
-# The `mingw-runtime` package is required when building with -mno-cygwin
-CFLAGS += -I$(DIR_SRC)/w32api -I$(DIR_INC)
-CFLAGS += -D_WIN32_IE=0x0500
-CFLAGS += -mno-cygwin
-
-# Optional Compiler options
-CFLAGS += -Wall
-CFLAGS += -O3
-
-##############################################################################
-# Compiler flags for linking stage
-##############################################################################
-
-LDFLAGS += -L$(DIR_LIB) -lx264
-
-##############################################################################
-# Rules
-##############################################################################
-
-OBJECTS = $(SRC_C:.c=.obj)
-OBJECTS+= $(SRC_RES:.rc=.obj)
-
-.SUFFIXES: .obj .rc .c
-
-DIR_BUILD= $(DIR_CUR)/bin
-VPATH = $(DIR_SRC):$(DIR_BUILD)
-
-all: $(DLL)
-
-$(DIR_BUILD):
- @echo " D: $(DIR_BUILD)"
- @mkdir -p $(DIR_BUILD)
-
-.rc.obj:
- @echo " W: $(@D)/$(<F)"
- @mkdir -p $(DIR_BUILD)/$(@D)
- @$(WINDRES) \
- --include-dir=$(DIR_SRC) \
- --input-format=rc \
- --output-format=coff \
- -o $(DIR_BUILD)/$@ $<
-
-.c.obj:
- @echo " C: $(@D)/$(<F)"
- @mkdir -p $(DIR_BUILD)/$(@D)
- @$(CC) $(CFLAGS) -c -o $(DIR_BUILD)/$@ $<
-
-$(DLL): $(DIR_BUILD) $(OBJECTS)
- @echo " L: $(@F)"
- @cp $(DIR_SRC)/driverproc.def $(DIR_BUILD)/driverproc.def
- @cd $(DIR_BUILD) && \
- $(CC) \
- -mno-cygwin -shared -Wl,-dll,--out-implib,$@.a,--enable-stdcall-fixup \
- -o $@ \
- $(OBJECTS) driverproc.def \
- -lgdi32 -lwinmm -lcomdlg32 -lcomctl32 $(LDFLAGS)
-
-clean:
- @echo " Cl: Object files and target lib"
- @$(RM) $(DIR_BUILD)
-
-install:
- @echo " I: x264vfw.dll"
- @cp $(DIR_BUILD)/$(DLL) $(DLL)
- @cp $(DIR_SRC)/build/win32/bin/x264vfw.inf .
- @rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 $(DIR_CUR)/x264vfw.inf
- @rm $(DLL)
- @rm x264vfw.inf
-
-uninstall:
- @echo " U: x264vfw.dll"
- @cp $(DIR_SRC)/build/win32/bin/x264vfw.inf .
- @rundll32.exe setupapi,InstallHinfSection Remove_x264 132 $(DIR_CUR)/x264vfw.inf
- @rm x264vfw.inf
-
-##############################################################################
-# Builds the NSIS installer script for Windows.
-# NSIS 2.x is required and makensis.exe should be in the path
-##############################################################################
-
-build-installer: $(DLL)
- @cp $(DIR_BUILD)/$(DLL) $(DIR_SRC)/installer
- @makensis $(DIR_SRC)/installer/x264-conf.nsi
- @mv $(DIR_SRC)/installer/$(INST_EXE) $(DIR_BUILD)
- @rm $(DIR_SRC)/installer/$(DLL)
+++ /dev/null
-; x264 Codec install
-
-[Version]
-Signature = "$CHICAGO$"
-Class = MEDIA
-
-[SourceDisksNames]
-1="x264 Codec Install Disk",, 0001
-
-[SourceDisksFiles]
-x264vfw.dll=1
-x264vfw.inf=1
-
-[Installable.Drivers]
-x264 = 1:x264vfw.dll, "vidc.X264", "x264 H.264 Video Codec" , , ,
-
-[DefaultInstall]
-CopyFiles=H264.Copy.Inf,H264.Copy
-Updateinis = H264.Updateini
-DelReg = H264.DelConfig
-addreg = H264.AddReg,H264.AddReg9x,H264.DoReg
-MediaType = SOFTWARE
-
-[DefaultInstall.ntx86]
-CopyFiles=H264.Copy.Inf,H264.Copy
-DelReg = H264.DelConfig
-addreg = H264.AddReg,H264.AddRegNT,H264.DoReg
-MediaType = SOFTWARE
-
-[Remove_x264]
-AddReg = H264.Unregister
-DelReg = H264.DelReg
-DelFiles = H264.Copy,H264.Copy.Inf
-UpdateInis = H264.DelIni
-
-[H264.Copy]
-x264vfw.dll
-
-[H264.Copy.Inf]
-x264vfw.inf
-
-[H264.UpdateIni]
-system.ini, drivers32,,"vidc.X264=x264vfw.dll"
-
-[H264.DelIni]
-system.ini, drivers32,"vidc.X264=x264vfw.dll",
-
-[H264.AddReg]
-
-[H264.AddReg9x]
-HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264,Description,,%x264%
-HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264,Driver,,x264vfw.dll
-HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264,FriendlyName,,"x264"
-
-HKLM,%UnInstallPath%,DisplayName,,%UninstallDispName%
-HKLM,%UnInstallPath%,UninstallString,,"%10%\rundll.exe setupx.dll,InstallHinfSection Remove_x264 132 %17%\%InfFile%"
-
-[H264.AddRegNT]
-HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc,x264vfw.dll,,%x264%
-HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32,vidc.X264,,x264vfw.dll
-
-HKLM,%UnInstallPath%,DisplayName,,%UninstallDispName%
-HKLM,%UnInstallPath%,UninstallString,,"%11%\rundll32.exe setupapi,InstallHinfSection Remove_x264 132 %17%\%InfFile%"
-
-[H264.DoReg]
-;HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,"Registering x264 Direct Show ;Decoder...",,"%11%\regsvr32.exe /s %11%\x264.ax"
-
-[H264.DelReg]
-HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264
-
-HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc,x264vfw.dll,,""
-HKLM,%UnInstallPath%
-
-[H264.Unregister]
-;HKLM,Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,"Unregistering x264 Direct Show ;Decoder...",,"%11%\regsvr32.exe /s /u %11%\x264.ax"
-
-[H264.DelConfig]
-HKCU,Software\GNU\x264
-
-[DestinationDirs]
-DefaultDestDir = 11 ; LDID_SYS
-H264.Copy = 11
-H264.Copy.Inf = 17
-
-[Strings]
-x264="x264 H.264 Video Codec"
-InfFile="x264vfw.inf"
-UninstallDispName="x264 H.264/AVC CODEC"
-UnInstallPath="Software\Microsoft\Windows\CurrentVersion\Uninstall\x264"
-MediaClassName="Media Devices"
-mfgname="Fenrir, Justin, CM"
+++ /dev/null
-# Microsoft Developer Studio Project File - Name="x264vfw" - Package Owner=<4>\r
-# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
-# ** DO NOT EDIT **\r
-\r
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
-\r
-CFG=x264vfw - Win32 Debug\r
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
-!MESSAGE use the Export Makefile command and run\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "x264vfw.mak".\r
-!MESSAGE \r
-!MESSAGE You can specify a configuration when running NMAKE\r
-!MESSAGE by defining the macro CFG on the command line. For example:\r
-!MESSAGE \r
-!MESSAGE NMAKE /f "x264vfw.mak" CFG="x264vfw - Win32 Debug"\r
-!MESSAGE \r
-!MESSAGE Possible choices for configuration are:\r
-!MESSAGE \r
-!MESSAGE "x264vfw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE "x264vfw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")\r
-!MESSAGE \r
-\r
-# Begin Project\r
-# PROP AllowPerConfigDependencies 0\r
-# PROP Scc_ProjName ""\r
-# PROP Scc_LocalPath ""\r
-CPP=xicl6.exe\r
-MTL=midl.exe\r
-RSC=rc.exe\r
-\r
-!IF "$(CFG)" == "x264vfw - Win32 Release"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 0\r
-# PROP BASE Output_Dir "Release"\r
-# PROP BASE Intermediate_Dir "Release"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 0\r
-# PROP Output_Dir "obj/Release"\r
-# PROP Intermediate_Dir "obj/Release"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /c\r
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../extras" /I "../../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /FR /YX /FD /c\r
-# SUBTRACT CPP /Z<none>\r
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x804 /d "NDEBUG"\r
-# ADD RSC /l 0x804 /d "NDEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=xilink6.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386\r
-# ADD LINK32 winmm.lib vfw32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"bin/x264vfw.dll"\r
-# SUBTRACT LINK32 /debug\r
-\r
-!ELSEIF "$(CFG)" == "x264vfw - Win32 Debug"\r
-\r
-# PROP BASE Use_MFC 0\r
-# PROP BASE Use_Debug_Libraries 1\r
-# PROP BASE Output_Dir "Debug"\r
-# PROP BASE Intermediate_Dir "Debug"\r
-# PROP BASE Target_Dir ""\r
-# PROP Use_MFC 0\r
-# PROP Use_Debug_Libraries 1\r
-# PROP Output_Dir "obj/Debug"\r
-# PROP Intermediate_Dir "obj/Debug"\r
-# PROP Ignore_Export_Lib 0\r
-# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../extras" /I "../../.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /FR /YX /FD /GZ /c\r
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
-# ADD BASE RSC /l 0x804 /d "_DEBUG"\r
-# ADD RSC /l 0x804 /d "_DEBUG"\r
-BSC32=bscmake.exe\r
-# ADD BASE BSC32 /nologo\r
-# ADD BSC32 /nologo\r
-LINK32=xilink6.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"bin/x264vfw.dll" /pdbtype:sept\r
-\r
-!ENDIF \r
-\r
-# Begin Target\r
-\r
-# Name "x264vfw - Win32 Release"\r
-# Name "x264vfw - Win32 Debug"\r
-# Begin Group "Source Files"\r
-\r
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
-# Begin Source File\r
-\r
-SOURCE=..\..\codec.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\config.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\driverproc.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\driverproc.def\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\resource.rc\r
-# End Source File\r
-# End Group\r
-# Begin Group "Header Files"\r
-\r
-# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
-# Begin Source File\r
-\r
-SOURCE=..\..\resource.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=..\..\x264vfw.h\r
-# End Source File\r
-# End Group\r
-# Begin Group "Resource Files"\r
-\r
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
-# End Group\r
-# Begin Source File\r
-\r
-SOURCE=..\..\..\build\win32\bin\libx264.lib\r
-# End Source File\r
-# End Target\r
-# End Project\r
+++ /dev/null
-Microsoft Developer Studio Workspace File, Format Version 6.00\r
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
-\r
-###############################################################################\r
-\r
-Project: "x264vfw"=.\x264vfw.dsp - Package Owner=<4>\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<4>\r
-{{{\r
-}}}\r
-\r
-###############################################################################\r
-\r
-Global:\r
-\r
-Package=<5>\r
-{{{\r
-}}}\r
-\r
-Package=<3>\r
-{{{\r
-}}}\r
-\r
-###############################################################################\r
-\r
+++ /dev/null
-/*****************************************************************************
- * codec.c: vfw x264 encoder
- *****************************************************************************
- * Copyright (C) 2003 Laurent Aimar
- * $Id: codec.c,v 1.1 2004/06/03 19:27:09 fenrir Exp $
- *
- * Authors: Justin Clay
- * Laurent Aimar <fenrir@via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-#include "x264vfw.h"
-
-#include <stdio.h> /* debug only */
-#include <io.h>
-
-#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
-#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
-
-/* get_csp:
- * return a valid x264 CSP or X264_CSP_NULL if unsuported */
-static int get_csp( BITMAPINFOHEADER *hdr )
-{
- switch( hdr->biCompression )
- {
- case FOURCC_I420:
- case FOURCC_IYUV:
- return X264_CSP_I420;
-
- case FOURCC_YV12:
- return X264_CSP_YV12;
-
- case FOURCC_YUYV:
- case FOURCC_YUY2:
- return X264_CSP_YUYV;
-
- case BI_RGB:
- {
- int i_vflip = hdr->biHeight < 0 ? 0 : X264_CSP_VFLIP;
-
- if( hdr->biBitCount == 24 )
- return X264_CSP_BGR | i_vflip;
- if( hdr->biBitCount == 32 )
- return X264_CSP_BGRA | i_vflip;
- else
- return X264_CSP_NONE;
- }
-
- default:
- return X264_CSP_NONE;
- }
-}
-
-/* Test that we can do the compression */
-LRESULT compress_query( CODEC *codec, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput )
-{
- BITMAPINFOHEADER *inhdr = &lpbiInput->bmiHeader;
- BITMAPINFOHEADER *outhdr = &lpbiOutput->bmiHeader;
- CONFIG *config = &codec->config;
-
- if( get_csp( inhdr ) == X264_CSP_NONE )
- return ICERR_BADFORMAT;
-
- if( lpbiOutput == NULL )
- return ICERR_OK;
-
- if( inhdr->biWidth != outhdr->biWidth ||
- inhdr->biHeight != outhdr->biHeight )
- return ICERR_BADFORMAT;
-
- /* We need x16 width/height */
- if( inhdr->biWidth % 16 != 0 || inhdr->biHeight % 16 != 0 )
- return ICERR_BADFORMAT;
-
-
- if( inhdr->biCompression != mmioFOURCC( config->fcc[0], config->fcc[1],
- config->fcc[2], config->fcc[3] ) )
- return ICERR_BADFORMAT;
-
- return ICERR_OK;
-}
-
-/* */
-LRESULT compress_get_format( CODEC *codec, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput )
-{
- BITMAPINFOHEADER *inhdr = &lpbiInput->bmiHeader;
- BITMAPINFOHEADER *outhdr = &lpbiOutput->bmiHeader;
- CONFIG *config = &codec->config;
-
- if( get_csp( inhdr ) == X264_CSP_NONE )
- return ICERR_BADFORMAT;
-
- if( lpbiOutput == NULL )
- return sizeof(BITMAPINFOHEADER);
-
- memcpy( outhdr, inhdr, sizeof( BITMAPINFOHEADER ) );
- outhdr->biSize = sizeof( BITMAPINFOHEADER );
- outhdr->biSizeImage = compress_get_size( codec, lpbiInput, lpbiOutput );
- outhdr->biXPelsPerMeter = 0;
- outhdr->biYPelsPerMeter = 0;
- outhdr->biClrUsed = 0;
- outhdr->biClrImportant = 0;
- outhdr->biCompression = mmioFOURCC( config->fcc[0], config->fcc[1],
- config->fcc[2], config->fcc[3] );
-
- return ICERR_OK;
-}
-
-/* */
-LRESULT compress_get_size( CODEC *codec, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput )
-{
- return 2 * lpbiOutput->bmiHeader.biWidth * lpbiOutput->bmiHeader.biHeight * 3;
-}
-
-/* */
-LRESULT compress_frames_info(CODEC * codec, ICCOMPRESSFRAMES * icf )
-{
- codec->fincr = icf->dwScale;
- codec->fbase = icf->dwRate;
- codec->config.i_frame_total = icf->lFrameCount;
- return ICERR_OK;
-}
-
-static void x264_log_vfw( void *p_private, int i_level, const char *psz_fmt, va_list arg )
-{
- char error_msg[1024];
- int idx;
- HWND *hCons = p_private;
-
- vsprintf( error_msg, psz_fmt, arg );
-
- /* strip final linefeeds (required) */
- idx=strlen( error_msg ) - 1;
- while( idx >= 0 && error_msg[idx] == '\n' )
- error_msg[idx--] = 0;
-
- if(!( *hCons ) ) {
- *hCons = CreateDialog( g_hInst, MAKEINTRESOURCE( IDD_ERRCONSOLE ), NULL,
- callback_err_console );
- //ShowWindow( *hCons, SW_SHOW );
- }
- idx = SendDlgItemMessage( *hCons, IDC_CONSOLE, LB_ADDSTRING, 0, ( LPARAM )error_msg );
-
- /* make sure that the last item added is visible (autoscroll) */
- if( idx >= 0 )
- SendDlgItemMessage( *hCons, IDC_CONSOLE, LB_SETTOPINDEX, ( WPARAM )idx, 0 );
-
-}
-
-static void statsfilename_renumber( char *dest, char *src, int i_pass )
-{
- char *last_dot = strrchr( src, '.' );
- char *last_slash = X264_MAX( strrchr( src, '/' ), strrchr( src, '\\' ) );
- char pass_str[5];
-
- sprintf( pass_str, "-%i", i_pass );
- strcpy( dest, src );
- if( last_slash < last_dot ) {
- dest[ last_dot - src ] = 0;
- strcat( dest, pass_str );
- strcat( dest, last_dot );
- }
- else
- {
- strcat( dest, pass_str );
- }
-}
-
-/* */
-LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiOutput )
-{
- CONFIG *config = &codec->config;
- x264_param_t param;
- int pass_number;
-
- /* Destroy previous handle */
- if( codec->h != NULL )
- {
- x264_encoder_close( codec->h );
- codec->h = NULL;
- }
-
- /* Get default param */
- x264_param_default( ¶m );
-
- param.rc.psz_stat_out = malloc (MAX_PATH);
- param.rc.psz_stat_in = malloc (MAX_PATH);
- param.i_threads = config->i_threads;
- param.analyse.i_noise_reduction = config->i_noise_reduction;
-
- param.i_log_level = config->i_log_level - 1;
- param.pf_log = x264_log_vfw;
- param.p_log_private = malloc( sizeof( HWND ) );
- *( ( HWND * )param.p_log_private ) = NULL; /* error console window handle */
- codec->hCons = ( HWND * )param.p_log_private;
-
- param.analyse.b_psnr = 0;
-
- /* Set params: TODO to complete */
- param.i_width = lpbiInput->bmiHeader.biWidth;
- param.i_height= lpbiInput->bmiHeader.biHeight;
-
- param.i_fps_num = codec->fbase;
- param.i_fps_den = codec->fincr;
- param.i_frame_total = config->i_frame_total;
-
- param.i_frame_reference = config->i_refmax;
- param.i_keyint_min = config->i_keyint_min;
- param.i_keyint_max = config->i_keyint_max;
- param.i_scenecut_threshold = config->i_scenecut_threshold;
- param.rc.i_qp_min = config->i_qp_min;
- param.rc.i_qp_max = config->i_qp_max;
- param.rc.i_qp_step = config->i_qp_step;
- param.b_deblocking_filter = config->b_filter;
- param.b_cabac = config->b_cabac;
- if( config->b_cabac && config->i_trellis )
- param.analyse.i_trellis = 1;
-
- param.analyse.b_chroma_me = config->b_chroma_me;
- param.rc.f_ip_factor = 1 + (float)config->i_key_boost / 100;
- param.rc.f_pb_factor = 1 + (float)config->i_b_red / 100;
- param.rc.f_qcompress = (float)config->i_curve_comp / 100;
- param.vui.i_sar_width = config->i_sar_width;
- param.vui.i_sar_height = config->i_sar_height;
-
- param.i_bframe = config->i_bframe;
- if( config->i_bframe > 1 && config->b_b_wpred)
- param.analyse.b_weighted_bipred = 1;
- if( config->i_bframe > 1 && config->b_b_refs)
- param.b_bframe_pyramid = 1;
- param.b_bframe_adaptive = config->b_bframe_adaptive;
- param.analyse.b_bidir_me = config->b_bidir_me;
- param.i_bframe_bias = config->i_bframe_bias;
- param.analyse.i_subpel_refine = config->i_subpel_refine + 1; /* 0..5 -> 1..6 */
- if (param.analyse.i_subpel_refine == 7)
- {
- param.analyse.i_subpel_refine = 6;
- param.analyse.b_bframe_rdo = 1;
- }
-
- param.analyse.i_me_method = config->i_me_method;
- param.analyse.i_me_range = config->i_me_range;
-
- /* bframe prediction - gui goes alphabetically, so 1=SPATIAL, 2=TEMPORAL */
- switch(config->i_direct_mv_pred) {
- case 0: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL; break;
- case 1: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL; break;
- }
- param.i_deblocking_filter_alphac0 = config->i_inloop_a;
- param.i_deblocking_filter_beta = config->i_inloop_b;
- param.analyse.inter = 0;
- if( config->b_bsub16x16 )
- param.analyse.inter |= X264_ANALYSE_BSUB16x16;
- if( config->b_psub16x16 )
- {
- param.analyse.inter |= X264_ANALYSE_PSUB16x16;
- if( config->b_psub8x8 )
- param.analyse.inter |= X264_ANALYSE_PSUB8x8;
- }
- if( config->b_i4x4 )
- param.analyse.inter |= X264_ANALYSE_I4x4;
- if( config->b_i8x8 )
- param.analyse.inter |= X264_ANALYSE_I8x8;
- param.analyse.b_transform_8x8 = config->b_dct8x8;
- if( config->b_mixedref )
- param.analyse.b_mixed_references = 1;
-
-
- switch( config->i_encoding_type )
- {
- case 0: /* 1 PASS ABR */
- param.rc.i_rc_method = X264_RC_ABR;
- param.rc.i_bitrate = config->bitrate;
- break;
- case 1: /* 1 PASS CQ */
- param.rc.i_rc_method = X264_RC_CQP;
- param.rc.i_qp_constant = config->i_qp;
- break;
- default:
- case 2: /* 2 PASS */
- {
- for( pass_number = 1; pass_number < 99; pass_number++ )
- {
- FILE *f;
- statsfilename_renumber( param.rc.psz_stat_out, config->stats, pass_number );
- if( ( f = fopen( param.rc.psz_stat_out, "r" ) ) != NULL )
- {
- fclose( f );
- if( config->i_pass == 1 )
- unlink( param.rc.psz_stat_out );
- }
- else break;
- }
-
- if( config->i_pass > pass_number )
- {
- /* missing 1st pass statsfile */
- free( param.rc.psz_stat_out );
- free( param.rc.psz_stat_in );
- return ICERR_ERROR;
- }
-
- param.rc.i_rc_method = X264_RC_ABR;
- param.rc.i_bitrate = config->i_2passbitrate;
-
- if( config->i_pass == 1 )
- {
- statsfilename_renumber( param.rc.psz_stat_out, config->stats, 1 );
- param.rc.b_stat_write = 1;
- param.rc.f_rate_tolerance = 4;
- if( config->b_fast1pass )
- {
- /* adjust or turn off some flags to gain speed, if needed */
- param.analyse.i_subpel_refine = X264_MAX( X264_MIN( 3, param.analyse.i_subpel_refine - 1 ), 1 );
- param.i_frame_reference = ( param.i_frame_reference + 1 ) >> 1;
- param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 );
- param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
- }
- }
- else
- {
- statsfilename_renumber( param.rc.psz_stat_in, config->stats, pass_number - 1 );
- param.rc.b_stat_read = 1;
- if( config->b_updatestats )
- param.rc.b_stat_write = 1;
- param.rc.f_rate_tolerance = 1;
- }
-
- break;
- }
- }
-
- /* Open the encoder */
- codec->h = x264_encoder_open( ¶m );
-
- free( param.rc.psz_stat_out );
- free( param.rc.psz_stat_in );
-
- if( codec->h == NULL )
- return ICERR_ERROR;
-
- return ICERR_OK;
-}
-
-/* */
-LRESULT compress_end(CODEC * codec)
-{
- if( codec->h != NULL )
- {
- x264_encoder_close( codec->h );
- codec->h = NULL;
- }
-
- free( codec->hCons );
- codec->hCons = NULL;
- return ICERR_OK;
-}
-
-/* */
-LRESULT compress( CODEC *codec, ICCOMPRESS *icc )
-{
- BITMAPINFOHEADER *inhdr = icc->lpbiInput;
- BITMAPINFOHEADER *outhdr = icc->lpbiOutput;
-
- x264_picture_t pic;
-
- int i_nal;
- x264_nal_t *nal;
- int i_out;
-
- int i;
-
- /* Init the picture */
- memset( &pic, 0, sizeof( x264_picture_t ) );
- pic.img.i_csp = get_csp( inhdr );
-
- /* For now biWidth can be divided by 16 so no problem */
- switch( pic.img.i_csp & X264_CSP_MASK )
- {
- case X264_CSP_I420:
- case X264_CSP_YV12:
- pic.img.i_plane = 3;
- pic.img.i_stride[0] = inhdr->biWidth;
- pic.img.i_stride[1] =
- pic.img.i_stride[2] = inhdr->biWidth / 2;
-
- pic.img.plane[0] = (uint8_t*)icc->lpInput;
- pic.img.plane[1] = pic.img.plane[0] + inhdr->biWidth * inhdr->biHeight;
- pic.img.plane[2] = pic.img.plane[1] + inhdr->biWidth * inhdr->biHeight / 4;
- break;
-
- case X264_CSP_YUYV:
- pic.img.i_plane = 1;
- pic.img.i_stride[0] = 2 * inhdr->biWidth;
- pic.img.plane[0] = (uint8_t*)icc->lpInput;
- break;
-
- case X264_CSP_BGR:
- pic.img.i_plane = 1;
- pic.img.i_stride[0] = 3 * inhdr->biWidth;
- pic.img.plane[0] = (uint8_t*)icc->lpInput;
- break;
-
- case X264_CSP_BGRA:
- pic.img.i_plane = 1;
- pic.img.i_stride[0] = 4 * inhdr->biWidth;
- pic.img.plane[0] = (uint8_t*)icc->lpInput;
- break;
-
- default:
- return ICERR_BADFORMAT;
- }
-
- /* encode it */
- x264_encoder_encode( codec->h, &nal, &i_nal, &pic, &pic );
-
- /* create bitstream, unless we're dropping it in 1st pass */
- i_out = 0;
-
- if( codec->config.i_encoding_type != 2 || codec->config.i_pass > 1 ) {
- for( i = 0; i < i_nal; i++ ) {
- int i_size = outhdr->biSizeImage - i_out;
- x264_nal_encode( (uint8_t*)icc->lpOutput + i_out, &i_size, 1, &nal[i] );
-
- i_out += i_size;
- }
- }
-
- outhdr->biSizeImage = i_out;
-
- /* Set key frame only for IDR, as they are real synch point, I frame
- aren't always synch point (ex: with multi refs, ref marking) */
- if( pic.i_type == X264_TYPE_IDR )
- *icc->lpdwFlags = AVIIF_KEYFRAME;
- else
- *icc->lpdwFlags = 0;
-
- return ICERR_OK;
-}
-
+++ /dev/null
-/*****************************************************************************
- * config.c: vfw x264 encoder
- *****************************************************************************
- * Copyright (C) 2003 Laurent Aimar
- * $Id: config.c,v 1.1 2004/06/03 19:27:09 fenrir Exp $
- *
- * Authors: Justin Clay
- * Laurent Aimar <fenrir@via.ecp.fr>
- * Antony Boucher <proximodo@free.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-/**************************************************************************
- *
- * History:
- *
- * 2004.05.14 CBR encode mode support
- *
- **************************************************************************/
-
-#include "x264vfw.h"
-#include <stdio.h> /* sprintf */
-#include <commctrl.h>
-
-#ifdef _MSC_VER
-#define X264_VERSION ""
-#else
-#include "config.h"
-#endif
-
-/* Registry */
-#define X264_REG_KEY HKEY_CURRENT_USER
-#define X264_REG_PARENT "Software\\GNU"
-#define X264_REG_CHILD "x264"
-#define X264_REG_CLASS "config"
-
-/* window controls */
-#define BITRATE_MAX 5000
-#define QUANT_MAX 51
-
-/* description */
-#define X264_NAME "x264"
-#define X264_DEF_TEXT "Are you sure you want to load default values?"
-
-/* Registery handling */
-typedef struct
-{
- char *reg_value;
- int *config_int;
- int default_int;
-} reg_int_t;
-
-typedef struct
-{
- char *reg_value;
- char *config_str;
- char *default_str;
- int max_len; /* maximum string length, including the terminating NULL char */
-} reg_str_t;
-
-CONFIG reg;
-HWND hTooltip;
-HWND hTabs[8];
-static const reg_int_t reg_int_table[] =
-{
- /* Main dialog */
- { "bitrate", ®.bitrate, 800 },
- { "quantizer", ®.i_qp, 26 },
- { "encoding_type", ®.i_encoding_type, 1 },
- { "passbitrate", ®.i_2passbitrate, 800 },
- { "pass_number", ®.i_pass, 1 },
- { "fast1pass", ®.b_fast1pass, 1 },
- { "updatestats", ®.b_updatestats, 1 },
-
- /* Rate Control */
- { "key_boost", ®.i_key_boost, 40 },
- { "b_red", ®.i_b_red, 30 },
- { "curve_comp", ®.i_curve_comp, 60 },
- { "qp_min", ®.i_qp_min, 10 },
- { "qp_max", ®.i_qp_max, 51 },
- { "qp_step", ®.i_qp_step, 4 },
- { "scenecut", ®.i_scenecut_threshold, 40 },
- { "keyint_min", ®.i_keyint_min, 25 },
- { "keyint_max", ®.i_keyint_max, 250 },
-
- /* MBs&Frames */
- { "dct8x8", ®.b_dct8x8, 1 },
- { "psub16x16", ®.b_psub16x16, 1 },
- { "bsub16x16", ®.b_bsub16x16, 1 },
- { "psub8x8", ®.b_psub8x8, 0 },
- { "i8x8", ®.b_i8x8, 1 },
- { "i4x4", ®.b_i4x4, 1 },
- { "bmax", ®.i_bframe, 2 },
- { "b_bias", ®.i_bframe_bias, 0 },
- { "b_refs", ®.b_b_refs, 0 },
- { "b_adapt", ®.b_bframe_adaptive, 1 },
- { "b_bidir_me", ®.b_bidir_me, 0 },
- { "b_wpred", ®.b_b_wpred, 1 },
- { "direct_pred", ®.i_direct_mv_pred, 1 },
-
- /* analysis */
- { "subpel", ®.i_subpel_refine, 4 },
- { "me_method", ®.i_me_method, 1 },
- { "me_range", ®.i_me_range, 16 },
- { "chroma_me", ®.b_chroma_me, 1 },
- { "refmax", ®.i_refmax, 1 },
- { "mixedref", ®.b_mixedref, 0 },
- { "sar_width", ®.i_sar_width, 1 },
- { "sar_height", ®.i_sar_height, 1 },
- { "threads", ®.i_threads, 1 },
- { "cabac", ®.b_cabac, 1 },
- { "trellis", ®.i_trellis, 1 },
- { "noise_reduction",®.i_noise_reduction, 0 },
- { "loop_filter", ®.b_filter, 1 },
- { "inloop_a", ®.i_inloop_a, 0 },
- { "inloop_b", ®.i_inloop_b, 0 },
- { "log_level", ®.i_log_level, 1 }
-
-};
-
-static const reg_str_t reg_str_table[] =
-{
- { "fourcc", reg.fcc, "H264", 5 },
- { "statsfile", reg.stats, ".\\x264.stats", MAX_PATH-4 } // -4 because we add pass number
-};
-
-static void set_dlgitem_int(HWND hDlg, UINT item, int value)
-{
- char buf[8];
- sprintf(buf, "%i", value);
- SetDlgItemText(hDlg, item, buf);
-}
-
-
-/* Registry access */
-
-void config_reg_load( CONFIG *config )
-{
- HKEY hKey;
- DWORD i_size;
- int i;
-
- RegOpenKeyEx( X264_REG_KEY, X264_REG_PARENT "\\" X264_REG_CHILD,
- 0, KEY_READ, &hKey );
-
- /* Read all integers */
- for( i = 0; i < sizeof( reg_int_table )/sizeof( reg_int_t); i++ )
- {
- i_size = sizeof( int );
- if( RegQueryValueEx( hKey, reg_int_table[i].reg_value, 0, 0,
- (LPBYTE)reg_int_table[i].config_int,
- &i_size ) != ERROR_SUCCESS )
- *reg_int_table[i].config_int = reg_int_table[i].default_int;
- }
-
- /* Read strings */
- for( i = 0; i < sizeof( reg_str_table )/sizeof( reg_str_t); i++ )
- {
- i_size = reg_str_table[i].max_len;
- if( RegQueryValueEx( hKey, reg_str_table[i].reg_value, 0, 0,
- (LPBYTE)reg_str_table[i].config_str,
- &i_size ) != ERROR_SUCCESS )
- lstrcpy( reg_str_table[i].config_str,
- reg_str_table[i].default_str );
- }
-
- RegCloseKey( hKey );
-
- memcpy( config, ®, sizeof( CONFIG ) );
-}
-
-void config_reg_save( CONFIG *config )
-{
- HKEY hKey;
- DWORD i_size;
- int i;
-
- if( RegCreateKeyEx( X264_REG_KEY,
- X264_REG_PARENT "\\" X264_REG_CHILD,
- 0,
- X264_REG_CLASS,
- REG_OPTION_NON_VOLATILE,
- KEY_WRITE,
- 0, &hKey, &i_size ) != ERROR_SUCCESS )
- return;
-
- memcpy( ®, config, sizeof( CONFIG ) );
-
- /* Save all integers */
- for( i = 0; i < sizeof( reg_int_table )/sizeof( reg_int_t); i++ )
- {
- RegSetValueEx( hKey, reg_int_table[i].reg_value, 0, REG_DWORD,
- (LPBYTE)reg_int_table[i].config_int, sizeof( int ) );
- }
-
- /* Save strings */
- for( i = 0; i < sizeof( reg_str_table )/sizeof( reg_str_t); i++ )
- {
- RegSetValueEx( hKey, reg_str_table[i].reg_value, 0, REG_SZ,
- (LPBYTE)reg_str_table[i].config_str,
- lstrlen(reg_str_table[i].config_str)+1 );
- }
-
- RegCloseKey( hKey );
-}
-
-void config_reg_defaults( CONFIG *config )
-{
- HKEY hKey;
-
- if(RegOpenKeyEx( X264_REG_KEY, X264_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey )) {
- return;
- }
- if( RegDeleteKey( hKey, X264_REG_CHILD ) ) {
- return;
- }
- RegCloseKey( hKey );
-
- /* Just in case */
- memset( config, 0, sizeof( CONFIG ) );
-
- config_reg_load( config );
- config_reg_save( config );
-}
-
-
-/* assigns tooltips */
-
-BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam)
-{
- char help[500];
-
- /* The tooltip for a control is named the same as the control itself */
- if (LoadString(g_hInst, GetDlgCtrlID(hWnd), help, 500))
- {
- TOOLINFO ti;
-
- ti.cbSize = sizeof(TOOLINFO);
- ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
- ti.hwnd = GetParent(hWnd);
- ti.uId = (LPARAM)hWnd;
- ti.lpszText = help;
-
- SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti);
- }
-
- return TRUE;
-}
-
-
-/* Main window */
-
-BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- TCITEM tie;
- CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
-
- switch( uMsg )
- {
- case WM_INITDIALOG :
- {
- RECT rect;
- HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
- SetWindowLong( hDlg, GWL_USERDATA, lParam );
- config = (CONFIG*)lParam;
-
- // insert tabs in tab control
- tie.mask = TCIF_TEXT;
- tie.iImage = -1;
- tie.pszText = "Bitrate"; TabCtrl_InsertItem(hTabCtrl, 0, &tie);
- tie.pszText = "Rate Control"; TabCtrl_InsertItem(hTabCtrl, 1, &tie);
- tie.pszText = "MBs&&Frames"; TabCtrl_InsertItem(hTabCtrl, 2, &tie);
- tie.pszText = "More..."; TabCtrl_InsertItem(hTabCtrl, 3, &tie);
- hTabs[0] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_BITRATE), hDlg, (DLGPROC)callback_tabs, lParam);
- hTabs[1] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_RATECONTROL), hDlg, (DLGPROC)callback_tabs, lParam);
- hTabs[2] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_IPFRAMES), hDlg, (DLGPROC)callback_tabs, lParam);
- hTabs[3] = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_TAB_MISC), hDlg, (DLGPROC)callback_tabs, lParam);
- GetClientRect(hDlg, &rect);
- TabCtrl_AdjustRect(hTabCtrl, FALSE, &rect);
- MoveWindow(hTabs[0], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
- MoveWindow(hTabs[1], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
- MoveWindow(hTabs[2], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
- MoveWindow(hTabs[3], rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top-40, TRUE);
-
- if ((hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- NULL, NULL, g_hInst, NULL)))
- {
- SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
- SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400);
- EnumChildWindows(hDlg, enum_tooltips, 0);
- }
-
- tabs_enable_items( hDlg, config );
- tabs_update_items( hDlg, config );
- ShowWindow( hTabs[0], SW_SHOW );
- BringWindowToTop( hTabs[0] );
- UpdateWindow( hDlg );
- break;
- }
-
- case WM_NOTIFY:
- {
- NMHDR FAR *tem = (NMHDR FAR *)lParam;
- if (tem->code == TCN_SELCHANGING)
- {
- HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
- int num = TabCtrl_GetCurSel(hTabCtrl);
- ShowWindow( hTabs[num], SW_HIDE );
- UpdateWindow( hDlg );
- }
- else if (tem->code == TCN_SELCHANGE)
- {
- HWND hTabCtrl = GetDlgItem( hDlg, IDC_TAB1 );
- int num = TabCtrl_GetCurSel(hTabCtrl);
- ShowWindow( hTabs[num], SW_SHOW );
- BringWindowToTop( hTabs[num] );
- UpdateWindow( hDlg );
- }
- break;
- }
-
- case WM_COMMAND:
- switch ( HIWORD( wParam ) )
- {
- case BN_CLICKED :
- switch( LOWORD( wParam ) )
- {
- case IDOK :
- config->b_save = TRUE;
- EndDialog( hDlg, LOWORD(wParam) );
- break;
-
- case IDCANCEL :
- config->b_save = FALSE;
- EndDialog( hDlg, LOWORD(wParam) );
- break;
-
- case IDC_DEFAULTS :
- if( MessageBox( hDlg, X264_DEF_TEXT, X264_NAME, MB_YESNO ) == IDYES )
- {
- config_reg_defaults( config );
- tabs_enable_items( hDlg, config );
- tabs_update_items( hDlg, config );
- }
- break;
- }
- }
-
- default :
- return 0;
- }
-
- return 1;
-}
-
-
-/* Tabs */
-
-void tabs_enable_items( HWND hDlg, CONFIG * config )
-{
- char szTmp[1024];
- sprintf( szTmp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
- SetDlgItemText( hTabs[0], IDC_BUILDREV, szTmp );
-
- switch( config->i_encoding_type )
- {
- case 0 : /* 1 Pass, Bitrate Based */
- SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Average Bitrate" );
- SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0" );
- sprintf(szTmp, "%d", BITRATE_MAX);
- SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
- EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), FALSE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), FALSE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), FALSE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_CURVECOMP ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMIN ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMAX ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPSTEP ), TRUE );
- break;
-
- case 1 : /* 1 Pass, Quantizer Based */
- SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Quantizer" );
- SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0 (High Quality)" );
- sprintf(szTmp, "(Low Quality) %d", QUANT_MAX);
- SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( 0, QUANT_MAX ) );
- EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), FALSE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), FALSE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), FALSE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_CURVECOMP ), FALSE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMIN ), FALSE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMAX ), FALSE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPSTEP ), FALSE );
- break;
-
- case 2 : /* 2 Pass */
- SetDlgItemText( hTabs[0], IDC_BITRATELABEL, "Target Bitrate" );
- SetDlgItemText( hTabs[0], IDC_BITRATELOW, "0" );
- sprintf(szTmp, "%d", BITRATE_MAX);
- SetDlgItemText( hTabs[0], IDC_BITRATEHIGH, szTmp );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( 0, BITRATE_MAX ) );
- EnableWindow( GetDlgItem( hTabs[0], IDC_UPDATESTATS ), TRUE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE ), TRUE );
- EnableWindow( GetDlgItem( hTabs[0], IDC_STATSFILE_BROWSE ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_CURVECOMP ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMIN ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPMAX ), TRUE );
- EnableWindow( GetDlgItem( hTabs[1], IDC_QPSTEP ), TRUE );
- break;
- }
-
- EnableWindow( GetDlgItem( hTabs[2], IDC_DIRECTPRED ), config->i_bframe > 0 );
- EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_A ), config->b_filter );
- EnableWindow( GetDlgItem( hTabs[3], IDC_INLOOP_B ), config->b_filter );
- EnableWindow( GetDlgItem( hTabs[2], IDC_P4X4 ), config->b_psub16x16 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_I8X8 ), config->b_dct8x8 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_B8X8 ), config->i_bframe > 0 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_BREFS ), config->i_bframe > 1 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_WBPRED ), config->i_bframe > 1 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_BADAPT ), config->i_bframe > 0 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_BIDIR_ME ), config->i_bframe > 0 );
- EnableWindow( GetDlgItem( hTabs[2], IDC_BBIAS ), config->i_bframe > 0 && config->b_bframe_adaptive );
- EnableWindow( GetDlgItem( hTabs[2], IDC_BBIASSLIDER ), config->i_bframe > 0 && config->b_bframe_adaptive );
- EnableWindow( GetDlgItem( hTabs[1], IDC_PBRATIO ), config->i_bframe > 0 );
- EnableWindow( GetDlgItem( hTabs[3], IDC_MERANGE ), config->i_me_method > 1 );
- EnableWindow( GetDlgItem( hTabs[3], IDC_CHROMAME ), config->i_subpel_refine >= 4 );
- EnableWindow( GetDlgItem( hTabs[3], IDC_TRELLIS ), config->b_cabac );
- EnableWindow( GetDlgItem( hTabs[3], IDC_MIXEDREF ), config->i_refmax > 1 );
-}
-
-void tabs_update_items( HWND hDlg, CONFIG * config )
-{
- char fourcc[5];
-
- /* update bitrate tab */
- if (SendMessage( GetDlgItem(hTabs[0],IDC_BITRATEMODE), CB_GETCOUNT, 0, 0 ) == 0)
- {
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Single Pass - Bitrate");
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Single Pass - Quantizer");
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - First Pass");
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - First Pass (fast)");
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_ADDSTRING, 0, (LPARAM)"Multipass - Nth Pass");
- }
- switch( config->i_encoding_type )
- {
- case 0 : /* 1 Pass, Bitrate Based */
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 0, 0);
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->bitrate, FALSE );
- SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
- config->bitrate );
- break;
- case 1 : /* 1 Pass, Quantizer Based */
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 1, 0);
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_qp, FALSE );
- SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
- config->i_qp );
- break;
- case 2 : /* 2 Pass */
- if (config->i_pass >= 2) {
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 4, 0);
- } else if (config->b_fast1pass) {
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 3, 0);
- } else {
- SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_SETCURSEL, 2, 0);
- }
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_2passbitrate, FALSE );
- SendDlgItemMessage(hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE,
- config->i_2passbitrate );
- break;
- }
-
- CheckDlgButton( hTabs[0], IDC_UPDATESTATS, config->b_updatestats ? BST_CHECKED : BST_UNCHECKED );
- SetDlgItemText( hTabs[0], IDC_STATSFILE, config->stats );
-
- /* update rate control tab */
- if (SendMessage( GetDlgItem(hTabs[2],IDC_DIRECTPRED), CB_GETCOUNT, 0, 0 ) == 0)
- {
- SendDlgItemMessage(hTabs[2], IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Spatial");
- SendDlgItemMessage(hTabs[2], IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Temporal");
- }
- SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
- SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
- SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
- SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
- SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
- SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
-
- /* update debug tab */
- if (SendMessage( GetDlgItem(hTabs[3],IDC_LOG), CB_GETCOUNT, 0, 0 ) == 0)
- {
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"None");
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Error");
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Warning");
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Info");
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Debug");
- }
- SendDlgItemMessage(hTabs[3], IDC_LOG, CB_SETCURSEL, (config->i_log_level), 0);
-
- memcpy( fourcc, config->fcc, 4 );
- fourcc[4] = '\0';
- SetDlgItemText( hTabs[3], IDC_FOURCC, fourcc );
-
- /* update misc. tab */
- SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
- SetDlgItemInt( hTabs[3], IDC_NR, config->i_noise_reduction, FALSE );
- CheckDlgButton( hTabs[3],IDC_CABAC,
- config->b_cabac ? BST_CHECKED : BST_UNCHECKED );
- CheckDlgButton( hTabs[3],IDC_TRELLIS,
- config->i_trellis ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[3],IDC_LOOPFILTER,
- config->b_filter ? BST_CHECKED: BST_UNCHECKED );
-
- SetDlgItemInt( hTabs[3], IDC_SAR_W, config->i_sar_width, FALSE );
- SetDlgItemInt( hTabs[3], IDC_SAR_H, config->i_sar_height, FALSE );
-
- SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( -6, 6 ) );
- SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_SETPOS, TRUE,
- config->i_inloop_a );
- set_dlgitem_int( hTabs[3], IDC_LOOPA_TXT, config->i_inloop_a);
- SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( -6, 6 ) );
- SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_SETPOS, TRUE,
- config->i_inloop_b );
- set_dlgitem_int( hTabs[3], IDC_LOOPB_TXT, config->i_inloop_b);
-
- /* update i/p-frames tab */
- CheckDlgButton( hTabs[2],IDC_P8X8,
- config->b_psub16x16 ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_P4X4,
- config->b_psub8x8 ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_I4X4,
- config->b_i4x4 ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_I8X8,
- config->b_i8x8 ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_DCT8X8,
- config->b_dct8x8 ? BST_CHECKED: BST_UNCHECKED );
-
- /* update b-frames tab */
- CheckDlgButton( hTabs[2],IDC_WBPRED,
- config->b_b_wpred ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_BADAPT,
- config->b_bframe_adaptive ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_BIDIR_ME,
- config->b_bidir_me ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_BREFS,
- config->b_b_refs ? BST_CHECKED: BST_UNCHECKED );
- CheckDlgButton( hTabs[2],IDC_B8X8,
- config->b_bsub16x16 ? BST_CHECKED: BST_UNCHECKED );
- SetDlgItemInt( hTabs[2], IDC_BFRAME, config->i_bframe, FALSE );
- SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
- SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_SETRANGE, TRUE,
- (LPARAM) MAKELONG( -100, 100 ) );
- SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_SETPOS, TRUE,
- config->i_bframe_bias );
- SendDlgItemMessage(hTabs[2], IDC_DIRECTPRED, CB_SETCURSEL, (config->i_direct_mv_pred), 0);
-
- /* update scene-cuts tab */
- SetDlgItemInt( hTabs[1], IDC_KEYINTMIN, config->i_keyint_min, FALSE );
- SetDlgItemInt( hTabs[1], IDC_KEYINTMAX, config->i_keyint_max, FALSE );
- SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
-
- /* update motion estimation tab */
- if (SendMessage( GetDlgItem(hTabs[3],IDC_ME_METHOD), CB_GETCOUNT, 0, 0 ) == 0)
- {
- SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Diamond Search");
- SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Hexagonal Search");
- SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Uneven Multi-Hexagon");
- SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Exhaustive Search");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"1 (Fastest)");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"2");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"3");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"4");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"5 (High Quality)");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"6 (RDO)");
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_ADDSTRING, 0, (LPARAM)"6b (RDO on B-frames)");
- }
-
- SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_SETCURSEL, (config->i_me_method), 0);
- SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_SETCURSEL, (config->i_subpel_refine), 0);
- SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
- CheckDlgButton( hTabs[3],IDC_CHROMAME,
- config->b_chroma_me ? BST_CHECKED: BST_UNCHECKED );
- SetDlgItemInt( hTabs[3], IDC_REFFRAMES, config->i_refmax, FALSE );
- CheckDlgButton( hTabs[3],IDC_MIXEDREF,
- config->b_mixedref ? BST_CHECKED: BST_UNCHECKED );
-}
-
-BOOL CALLBACK callback_tabs( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
- switch( uMsg )
- {
- case WM_INITDIALOG :
-
- SetWindowLong( hDlg, GWL_USERDATA, lParam );
- config = (CONFIG*)lParam;
- break;
-
- case WM_COMMAND:
-
- switch ( HIWORD( wParam ) )
- {
- case BN_CLICKED :
-
- switch( LOWORD( wParam ) )
- {
- case IDC_CABAC :
- config->b_cabac = ( IsDlgButtonChecked( hTabs[3], IDC_CABAC ) == BST_CHECKED );
- break;
- case IDC_TRELLIS :
- config->i_trellis = ( IsDlgButtonChecked( hTabs[3], IDC_TRELLIS ) == BST_CHECKED );
- break;
- case IDC_LOOPFILTER :
- config->b_filter = ( IsDlgButtonChecked( hTabs[3], IDC_LOOPFILTER ) == BST_CHECKED );
- break;
- case IDC_BREFS :
- config->b_b_refs = ( IsDlgButtonChecked( hTabs[2], IDC_BREFS ) == BST_CHECKED );
- break;
- case IDC_WBPRED :
- config->b_b_wpred = ( IsDlgButtonChecked( hTabs[2], IDC_WBPRED ) == BST_CHECKED );
- break;
- case IDC_BADAPT :
- config->b_bframe_adaptive = ( IsDlgButtonChecked( hTabs[2], IDC_BADAPT ) == BST_CHECKED );
- break;
- case IDC_BIDIR_ME :
- config->b_bidir_me = ( IsDlgButtonChecked( hTabs[2], IDC_BIDIR_ME ) == BST_CHECKED );
- break;
- case IDC_P8X8 :
- config->b_psub16x16 = ( IsDlgButtonChecked( hTabs[2], IDC_P8X8 ) == BST_CHECKED );
- break;
- case IDC_P4X4 :
- config->b_psub8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_P4X4 ) == BST_CHECKED );
- break;
- case IDC_B8X8 :
- config->b_bsub16x16 = ( IsDlgButtonChecked( hTabs[2], IDC_B8X8 ) == BST_CHECKED );
- break;
- case IDC_I4X4 :
- config->b_i4x4 = ( IsDlgButtonChecked( hTabs[2], IDC_I4X4 ) == BST_CHECKED );
- break;
- case IDC_I8X8 :
- config->b_i8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_I8X8 ) == BST_CHECKED );
- break;
- case IDC_DCT8X8 :
- config->b_dct8x8 = ( IsDlgButtonChecked( hTabs[2], IDC_DCT8X8 ) == BST_CHECKED );
- break;
- case IDC_MIXEDREF :
- config->b_mixedref = ( IsDlgButtonChecked( hTabs[3], IDC_MIXEDREF ) == BST_CHECKED );
- break;
- case IDC_CHROMAME :
- config->b_chroma_me = ( IsDlgButtonChecked( hTabs[3], IDC_CHROMAME ) == BST_CHECKED );
- break;
- case IDC_UPDATESTATS :
- config->b_updatestats = ( IsDlgButtonChecked( hTabs[0], IDC_UPDATESTATS ) == BST_CHECKED );
- break;
- case IDC_STATSFILE_BROWSE :
- {
- OPENFILENAME ofn;
- char tmp[MAX_PATH];
-
- GetDlgItemText( hTabs[0], IDC_STATSFILE, tmp, MAX_PATH );
-
- memset( &ofn, 0, sizeof( OPENFILENAME ) );
- ofn.lStructSize = sizeof( OPENFILENAME );
-
- ofn.hwndOwner = hDlg;
- ofn.lpstrFilter = "Statsfile (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0";
- ofn.lpstrFile = tmp;
- ofn.nMaxFile = MAX_PATH-4;
- ofn.Flags = OFN_PATHMUSTEXIST;
-
- if( config->i_pass == 1 )
- ofn.Flags |= OFN_OVERWRITEPROMPT;
- else ofn.Flags |= OFN_FILEMUSTEXIST;
-
- if( ( config->i_pass == 1 && GetSaveFileName( &ofn ) ) ||
- ( config->i_pass > 1 && GetOpenFileName( &ofn ) ) )
- SetDlgItemText( hTabs[0], IDC_STATSFILE, tmp );
- }
- break;
- }
- break;
-
- case EN_CHANGE :
-
- switch( LOWORD( wParam ) )
- {
- case IDC_FOURCC :
- GetDlgItemText( hTabs[3], IDC_FOURCC, config->fcc, 5 );
- break;
- case IDC_NR :
- config->i_noise_reduction = GetDlgItemInt( hTabs[3], IDC_NR, FALSE, FALSE );
- case IDC_THREADEDIT :
- config->i_threads = GetDlgItemInt( hTabs[3], IDC_THREADEDIT, FALSE, FALSE );
- if (config->i_threads < 1)
- {
- config->i_threads = 1;
- SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
- }
- else if (config->i_threads > 4)
- {
- config->i_threads = 4;
- SetDlgItemInt( hTabs[3], IDC_THREADEDIT, config->i_threads, FALSE );
- }
- break;
- case IDC_BITRATEEDIT :
- switch (config->i_encoding_type)
- {
- case 0:
- config->bitrate = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->bitrate );
- break;
- case 1:
- config->i_qp = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->i_qp );
- break;
- case 2:
- config->i_2passbitrate = GetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, FALSE, FALSE );
- SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->i_2passbitrate );
- break;
- }
- break;
- case IDC_STATSFILE :
- if( GetDlgItemText( hTabs[0], IDC_STATSFILE, config->stats, MAX_PATH ) == 0 )
- lstrcpy( config->stats, ".\\x264.stats" );
- break;
- case IDC_KEYINTMIN :
- config->i_keyint_min = GetDlgItemInt( hTabs[1], IDC_KEYINTMIN, FALSE, FALSE );
- break;
- case IDC_KEYINTMAX :
- config->i_keyint_max = GetDlgItemInt( hTabs[1], IDC_KEYINTMAX, FALSE, FALSE );
- break;
- case IDC_SCENECUT :
- config->i_scenecut_threshold = GetDlgItemInt( hTabs[1], IDC_SCENECUT, FALSE, TRUE );
- if( config->i_scenecut_threshold > 100 )
- {
- config->i_scenecut_threshold = 100;
- SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
- } else if ( config->i_scenecut_threshold < -1 )
- {
- config->i_scenecut_threshold = -1;
- SetDlgItemInt( hTabs[1], IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
- }
- break;
- case IDC_QPMIN :
- config->i_qp_min = GetDlgItemInt( hTabs[1], IDC_QPMIN, FALSE, FALSE );
- if( config->i_qp_min > 51 )
- {
- config->i_qp_min = 51;
- SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
- } else if ( config->i_qp_min < 1 )
- {
- config->i_qp_min = 1;
- SetDlgItemInt( hTabs[1], IDC_QPMIN, config->i_qp_min, FALSE );
- }
- break;
- case IDC_QPMAX :
- config->i_qp_max = GetDlgItemInt( hTabs[1], IDC_QPMAX, FALSE, FALSE );
- if( config->i_qp_max > 51 )
- {
- config->i_qp_max = 51;
- SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
- } else if ( config->i_qp_max < 1 )
- {
- config->i_qp_max = 1;
- SetDlgItemInt( hTabs[1], IDC_QPMAX, config->i_qp_max, FALSE );
- }
- break;
- case IDC_QPSTEP :
- config->i_qp_step = GetDlgItemInt( hTabs[1], IDC_QPSTEP, FALSE, FALSE );
- if( config->i_qp_step > 50 )
- {
- config->i_qp_step = 50;
- SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
- } else if ( config->i_qp_step < 1 )
- {
- config->i_qp_step = 1;
- SetDlgItemInt( hTabs[1], IDC_QPSTEP, config->i_qp_step, FALSE );
- }
- break;
- case IDC_SAR_W :
- config->i_sar_width = GetDlgItemInt( hTabs[3], IDC_SAR_W, FALSE, FALSE );
- break;
- case IDC_SAR_H :
- config->i_sar_height = GetDlgItemInt( hTabs[3], IDC_SAR_H, FALSE, FALSE );
- break;
- case IDC_REFFRAMES :
- config->i_refmax = GetDlgItemInt( hTabs[3], IDC_REFFRAMES, FALSE, FALSE );
- if( config->i_refmax > 16 )
- {
- config->i_refmax = 16;
- SetDlgItemInt( hTabs[3], IDC_REFFRAMES, config->i_refmax, FALSE );
- }
- break;
- case IDC_MERANGE :
- config->i_me_range = GetDlgItemInt( hTabs[3], IDC_MERANGE, FALSE, FALSE );
- if( config->i_me_range > 64 )
- {
- config->i_me_range = 64;
- SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
- }
- break;
-
- case IDC_BFRAME :
- config->i_bframe = GetDlgItemInt( hTabs[2], IDC_BFRAME, FALSE, FALSE );
- if( config->i_bframe > 5 )
- {
- config->i_bframe = 5;
- SetDlgItemInt( hTabs[2], IDC_BFRAME, config->i_bframe, FALSE );
- }
- break;
- case IDC_BBIAS :
- config->i_bframe_bias = GetDlgItemInt( hTabs[2], IDC_BBIAS, FALSE, TRUE );
- SendDlgItemMessage(hTabs[2], IDC_BBIASSLIDER, TBM_SETPOS, 1,
- config->i_bframe_bias);
- if( config->i_bframe_bias > 100 )
- {
- config->i_bframe_bias = 100;
- SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
- } else if ( config->i_bframe_bias < -100 )
- {
- config->i_bframe_bias = -100;
- SetDlgItemInt( hTabs[2], IDC_BBIAS, config->i_bframe_bias, TRUE );
- }
- break;
- case IDC_IPRATIO :
- config->i_key_boost = GetDlgItemInt( hTabs[1], IDC_IPRATIO, FALSE, FALSE );
- if (config->i_key_boost < 0)
- {
- config->i_key_boost = 0;
- SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
- }
- else if (config->i_key_boost > 70)
- {
- config->i_key_boost = 70;
- SetDlgItemInt( hTabs[1], IDC_IPRATIO, config->i_key_boost, FALSE );
- }
- break;
- case IDC_PBRATIO :
- config->i_b_red = GetDlgItemInt( hTabs[1], IDC_PBRATIO, FALSE, FALSE );
- if (config->i_b_red < 0)
- {
- config->i_b_red = 0;
- SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
- }
- else if (config->i_b_red > 60)
- {
- config->i_b_red = 60;
- SetDlgItemInt( hTabs[1], IDC_PBRATIO, config->i_b_red, FALSE );
- }
- break;
- case IDC_CURVECOMP:
- config->i_curve_comp = GetDlgItemInt( hTabs[1], IDC_CURVECOMP, FALSE, FALSE );
- if( config->i_curve_comp < 0 )
- {
- config->i_curve_comp = 0;
- SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
- }
- else if( config->i_curve_comp > 100 )
- {
- config->i_curve_comp = 100;
- SetDlgItemInt( hTabs[1], IDC_CURVECOMP, config->i_curve_comp, FALSE );
- }
- break;
- }
- break;
-
- case LBN_SELCHANGE :
-
- switch ( LOWORD( wParam ) )
- {
- case IDC_DIRECTPRED:
- config->i_direct_mv_pred = SendDlgItemMessage(hTabs[2], IDC_DIRECTPRED, CB_GETCURSEL, 0, 0);
- break;
- case IDC_SUBPEL:
- config->i_subpel_refine = SendDlgItemMessage(hTabs[3], IDC_SUBPEL, CB_GETCURSEL, 0, 0);
- break;
- case IDC_ME_METHOD:
- config->i_me_method = SendDlgItemMessage(hTabs[3], IDC_ME_METHOD, CB_GETCURSEL, 0, 0);
- break;
- case IDC_LOG:
- config->i_log_level = SendDlgItemMessage(hTabs[3], IDC_LOG, CB_GETCURSEL, 0, 0);
- break;
- case IDC_BITRATEMODE:
- switch(SendDlgItemMessage(hTabs[0], IDC_BITRATEMODE, CB_GETCURSEL, 0, 0))
- {
- case 0:
- config->i_encoding_type = 0;
- break;
- case 1:
- config->i_encoding_type = 1;
- break;
- case 2:
- config->i_encoding_type = 2;
- config->i_pass = 1;
- config->b_fast1pass = FALSE;
- break;
- case 3:
- config->i_encoding_type = 2;
- config->i_pass = 1;
- config->b_fast1pass = TRUE;
- break;
- case 4:
- config->i_encoding_type = 2;
- config->i_pass = 2;
- break;
- }
- tabs_update_items( hDlg, config );
- break;
- }
- break;
-
- case EN_KILLFOCUS :
-
- switch( LOWORD( wParam ) )
- {
- case IDC_MERANGE :
- config->i_me_range = GetDlgItemInt( hTabs[3], IDC_MERANGE, FALSE, FALSE );
- if( config->i_me_range < 4 )
- {
- config->i_me_range = 4;
- SetDlgItemInt( hTabs[3], IDC_MERANGE, config->i_me_range, FALSE );
- }
- break;
- }
- break;
- }
- break;
-
- case WM_HSCROLL :
-
- if( (HWND) lParam == GetDlgItem( hTabs[0], IDC_BITRATESLIDER ) )
- {
- switch (config->i_encoding_type)
- {
- case 0:
- config->bitrate = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->bitrate, FALSE );
- break;
- case 1:
- config->i_qp = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_qp, FALSE );
- break;
- case 2:
- config->i_2passbitrate = SendDlgItemMessage( hTabs[0], IDC_BITRATESLIDER, TBM_GETPOS, 0, 0 );
- SetDlgItemInt( hTabs[0], IDC_BITRATEEDIT, config->i_2passbitrate, FALSE );
- break;
- }
- break;
- }
- else if( (HWND) lParam == GetDlgItem( hTabs[3], IDC_INLOOP_A ) )
- {
- config->i_inloop_a = SendDlgItemMessage( hTabs[3], IDC_INLOOP_A, TBM_GETPOS, 0, 0 );
- set_dlgitem_int( hTabs[3], IDC_LOOPA_TXT, config->i_inloop_a);
- }
- else if( (HWND) lParam == GetDlgItem( hTabs[3], IDC_INLOOP_B ) )
- {
- config->i_inloop_b = SendDlgItemMessage( hTabs[3], IDC_INLOOP_B, TBM_GETPOS, 0, 0 );
- set_dlgitem_int( hTabs[3], IDC_LOOPB_TXT, config->i_inloop_b);
- }
- else if( (HWND) lParam == GetDlgItem( hTabs[2], IDC_BBIASSLIDER ) )
- {
- config->i_bframe_bias = SendDlgItemMessage( hTabs[2], IDC_BBIASSLIDER, TBM_GETPOS, 0, 0 );
- set_dlgitem_int( hTabs[2], IDC_BBIAS, config->i_bframe_bias);
- }
- break;
-
- default :
- return 0;
- }
-
- tabs_enable_items( hDlg, config );
- return 1;
-}
-
-
-/* About box */
-
-BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- switch( uMsg )
- {
- case WM_INITDIALOG :
- {
- char temp[1024];
- sprintf( temp, "Core %d%s, build %s %s", X264_BUILD, X264_VERSION, __DATE__, __TIME__ );
- SetDlgItemText( hDlg, IDC_BUILD, temp );
- break;
- }
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_HOMEPAGE && HIWORD(wParam) == STN_CLICKED)
- ShellExecute( hDlg, "open", X264_WEBSITE, NULL, NULL, SW_SHOWNORMAL );
- else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
- EndDialog( hDlg, LOWORD(wParam) );
- break;
-
- default :
- return 0;
- }
-
- return 1;
-}
-
-
-/* Error console */
-
-BOOL CALLBACK callback_err_console( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
-{
- switch( uMsg )
- {
- case WM_INITDIALOG :
- break;
- case WM_DESTROY :
- break;
- case WM_COMMAND :
- if( HIWORD( wParam ) == BN_CLICKED ) {
- switch( LOWORD( wParam ) ) {
- case IDOK :
- DestroyWindow( hWnd );
- break;
- case IDC_COPYCLIP :
- if( OpenClipboard( hWnd ) )
- {
- int i;
- int num_lines = SendDlgItemMessage( hWnd, IDC_CONSOLE,
- LB_GETCOUNT, 0, 0 );
- int text_size;
- char *buffer;
- HGLOBAL clipbuffer;
-
- if( num_lines <= 0 )
- break;
-
- /* calculate text size */
- for( i = 0, text_size = 0; i < num_lines; i++ )
- text_size += SendDlgItemMessage( hWnd, IDC_CONSOLE,
- LB_GETTEXTLEN, ( WPARAM )i, 0 );
-
- /* CR-LF for each line + terminating NULL */
- text_size += 2 * num_lines + 1;
-
- EmptyClipboard( );
- clipbuffer = GlobalAlloc( GMEM_MOVEABLE | GMEM_DDESHARE,
- text_size );
- buffer = (char *)GlobalLock( clipbuffer );
-
- /* concatenate lines of text in the global buffer */
- for( i = 0; i < num_lines; i++ )
- {
- char msg_buf[1024];
-
- SendDlgItemMessage( hWnd, IDC_CONSOLE, LB_GETTEXT,
- ( WPARAM )i, ( LPARAM )msg_buf );
- strcat( msg_buf, "\r\n" );
- memcpy( buffer, msg_buf, strlen( msg_buf ) );
- buffer += strlen( msg_buf );
- }
- *buffer = 0; /* null-terminate the buffer */
-
- GlobalUnlock( clipbuffer );
- SetClipboardData( CF_TEXT, clipbuffer );
- CloseClipboard( );
- }
- break;
- default :
- return 0;
- }
- break;
- }
- break;
-
- default :
- return DefWindowProc( hWnd, uMsg, wParam, lParam );
- }
-
- return 0;
-}
-
-
+++ /dev/null
-/*****************************************************************************
- * drvproc.c: vfw x264 wrapper
- *****************************************************************************
- * Copyright (C) 2003 Laurent Aimar
- * $Id: driverproc.c,v 1.1 2004/06/03 19:27:09 fenrir Exp $
- *
- * Authors: Justin Clay
- * Laurent Aimar <fenrir@via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-#include "x264vfw.h"
-
-/* Global dll instance */
-HINSTANCE g_hInst;
-
-
-/* Calling back point for our DLL so we can keep track of the window in g_hInst */
-BOOL WINAPI DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
-{
- g_hInst = (HINSTANCE) hModule;
- return TRUE;
-}
-
-/* This little puppy handles the calls which vfw programs send out to the codec */
-LRESULT WINAPI DriverProc( DWORD dwDriverId, HDRVR hDriver, UINT uMsg, LPARAM lParam1, LPARAM lParam2 )
-{
- CODEC *codec = (CODEC *)dwDriverId;
-
- switch( uMsg )
- {
- case DRV_LOAD:
- case DRV_FREE:
- return DRV_OK;
-
- case DRV_OPEN:
- {
- ICOPEN *icopen = (ICOPEN *)lParam2;
-
- if( icopen != NULL && icopen->fccType != ICTYPE_VIDEO )
- return DRV_CANCEL;
-
- if( ( codec = malloc( sizeof( CODEC ) ) ) == NULL )
- {
- if( icopen != NULL )
- icopen->dwError = ICERR_MEMORY;
- return 0;
- }
-
- memset( codec, 0, sizeof( CODEC ) );
- config_reg_load( &codec->config );
- codec->h = NULL;
-
- if( icopen != NULL )
- icopen->dwError = ICERR_OK;
- return (LRESULT)codec;
- }
-
- case DRV_CLOSE:
- /* From xvid: compress_end/decompress_end don't always get called */
- compress_end(codec);
- free( codec );
- return DRV_OK;
-
- case DRV_DISABLE:
- case DRV_ENABLE:
- return DRV_OK;
-
- case DRV_INSTALL:
- case DRV_REMOVE:
- return DRV_OK;
-
- case DRV_QUERYCONFIGURE:
- case DRV_CONFIGURE:
- return DRV_CANCEL;
-
- /* info */
- case ICM_GETINFO:
- {
- ICINFO *icinfo = (ICINFO *)lParam1;
-
- /* return a description */
- icinfo->fccType = ICTYPE_VIDEO;
- icinfo->fccHandler = FOURCC_X264;
- icinfo->dwFlags = VIDCF_COMPRESSFRAMES | VIDCF_FASTTEMPORALC;
-
- icinfo->dwVersion = 0;
- icinfo->dwVersionICM = ICVERSION;
-
- wcscpy( icinfo->szName, X264_NAME_L);
- wcscpy( icinfo->szDescription, X264_DESC_L);
-
- return lParam2; /* size of struct */
- }
-
- case ICM_ABOUT:
- if( lParam1 != -1 )
- {
- DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), (HWND)lParam1, callback_about, 0 );
- }
- return ICERR_OK;
-
- case ICM_CONFIGURE:
- if( lParam1 != -1 )
- {
- CONFIG temp;
-
- codec->config.b_save = FALSE;
- memcpy( &temp, &codec->config, sizeof(CONFIG) );
-
- DialogBoxParam( g_hInst, MAKEINTRESOURCE(IDD_MAINCONFIG), (HWND)lParam1, callback_main, (LPARAM)&temp );
-
- if( temp.b_save )
- {
- memcpy( &codec->config, &temp, sizeof(CONFIG) );
- config_reg_save( &codec->config );
- }
- }
- return ICERR_OK;
-
- case ICM_GETSTATE:
- if( (void*)lParam1 == NULL )
- {
- return sizeof( CONFIG );
- }
- memcpy( (void*)lParam1, &codec->config, sizeof( CONFIG ) );
- return ICERR_OK;
-
- case ICM_SETSTATE:
- if( (void*)lParam1 == NULL )
- {
- config_reg_load( &codec->config );
- return 0;
- }
- memcpy( &codec->config, (void*)lParam1, sizeof( CONFIG ) );
- return 0;
-
- /* not sure the difference, private/public data? */
- case ICM_GET:
- case ICM_SET:
- return ICERR_OK;
-
-
- /* older-stype config */
- case ICM_GETDEFAULTQUALITY:
- case ICM_GETQUALITY:
- case ICM_SETQUALITY:
- case ICM_GETBUFFERSWANTED:
- case ICM_GETDEFAULTKEYFRAMERATE:
- return ICERR_UNSUPPORTED;
-
-
- /* compressor */
- case ICM_COMPRESS_QUERY:
- return compress_query(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
-
- case ICM_COMPRESS_GET_FORMAT:
- return compress_get_format(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
-
- case ICM_COMPRESS_GET_SIZE:
- return compress_get_size(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
-
- case ICM_COMPRESS_FRAMES_INFO:
- return compress_frames_info(codec, (ICCOMPRESSFRAMES *)lParam1);
-
- case ICM_COMPRESS_BEGIN:
- return compress_begin(codec, (BITMAPINFO *)lParam1, (BITMAPINFO *)lParam2);
-
- case ICM_COMPRESS_END:
- return compress_end(codec);
-
- case ICM_COMPRESS:
- return compress(codec, (ICCOMPRESS *)lParam1);
-
- /* decompressor : not implemented */
- case ICM_DECOMPRESS_QUERY:
- case ICM_DECOMPRESS_GET_FORMAT:
- case ICM_DECOMPRESS_BEGIN:
- case ICM_DECOMPRESS_END:
- case ICM_DECOMPRESS:
- case ICM_DECOMPRESS_GET_PALETTE:
- case ICM_DECOMPRESS_SET_PALETTE:
- case ICM_DECOMPRESSEX_QUERY:
- case ICM_DECOMPRESSEX_BEGIN:
- case ICM_DECOMPRESSEX_END:
- case ICM_DECOMPRESSEX:
- return ICERR_UNSUPPORTED;
-
- default:
- if (uMsg < DRV_USER)
- return DefDriverProc(dwDriverId, hDriver, uMsg, lParam1, lParam2);
- else
- return ICERR_UNSUPPORTED;
- }
-}
-
-void WINAPI Configure(HWND hwnd, HINSTANCE hinst, LPTSTR lpCmdLine, int nCmdShow)
-{
- DWORD dwDriverId;
-
- dwDriverId = DriverProc(0, 0, DRV_OPEN, 0, 0);
- if (dwDriverId != (DWORD)NULL)
- {
- DriverProc(dwDriverId, 0, ICM_CONFIGURE, (LPARAM)GetDesktopWindow(), 0);
- DriverProc(dwDriverId, 0, DRV_CLOSE, 0, 0);
- }
-}
+++ /dev/null
-; DriverProc.def : Declares the module parameters for the DLL.
-
-DESCRIPTION 'X264 H.264/AVC Video Codec'
-
-EXPORTS
- DriverProc
- Configure
-
+++ /dev/null
-; !packhdr "x264.dat" "upx.exe --best x264.dat"
-; ---------------------------------------------------------------------------
-; ---------------------------------------------------------------------------
-
-!define NAME "x264 H.264/AVC Video Codec"
-!define OUTFILE "x264vfw.exe"
-!define INPUT_PATH ""
-!define VFW_FILE1 "x264vfw.dll"
-!define VFW_FILE2 "x264vfw.ico"
-!define UNINST_NAME "x264-uninstall.exe"
-!define MUI_WELCOMEFINISHPAGE_BITMAP win.bmp
-!define MUI_UNWELCOMEFINISHPAGE_BITMAP win.bmp
-!define MUI_COMPONENTSPAGE_SMALLDESC
-!include "MUI.nsh"
-!include "Sections.nsh"
-!include "LogicLib.nsh"
-
-; ---------------------------------------------------------------------------
-; NOTE: this .NSI script is designed for NSIS v1.8+
-; ---------------------------------------------------------------------------
-
-Name "${NAME}"
-OutFile "${OUTFILE}"
-setcompressor /solid lzma
-
-SetOverwrite ifnewer
-SetDatablockOptimize on ; (can be off)
-CRCCheck on ; (can be off)
-AutoCloseWindow false ; (can be true for the window go away automatically at end)
-ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
-SetDateSave off ; (can be on to have files restored to their orginal date)
-
-!insertmacro MUI_PAGE_WELCOME
-!insertmacro MUI_PAGE_INSTFILES
-
-!insertmacro MUI_UNPAGE_CONFIRM
-!insertmacro MUI_UNPAGE_INSTFILES
-!insertmacro MUI_UNPAGE_FINISH
-!insertmacro MUI_LANGUAGE "English"
-
-; ---------------------------------------------------------------------------
-
-;Section ""
-; MessageBox MB_YESNO "This will install ${NAME}. Do you wish to continue?" IDYES gogogo
-; Abort
-; gogogo:
-;SectionEnd
-
-Section "-hidden section"
-;Section "" ; (default section)
- SetOutPath "$SYSDIR"
- ; add files / whatever that need to be installed here.
- File "${INPUT_PATH}${VFW_FILE1}"
- File "${INPUT_PATH}${VFW_FILE2}"
-
- CreateDirectory $SMPROGRAMS\x264
- CreateShortcut "$SMPROGRAMS\x264\x264 configuration.lnk" $SYSDIR\rundll32.exe x264vfw.dll,Configure x264vfw.ico
- CreateShortcut "$SMPROGRAMS\x264\x264 Uninstall.lnk" $SYSDIR\x264-uninstall.exe
-
- ; write out uninstaller
- WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "DisplayName" "${NAME} (remove only)"
- WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}" "UninstallString" '"$SYSDIR\${UNINST_NAME}"'
- WriteUninstaller "$SYSDIR\${UNINST_NAME}"
-
- DeleteRegKey HKCU "Software\GNU\x264"
-
- WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows NT\CurrentVersion\Drivers32" "vidc.X264" "x264vfw.dll"
- WriteINIStr system.ini drivers32 "vidc.X264" "x264vfw.dll"
- WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "Description" "x264 H.264 Video Codec"
- WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "Driver" "x264vfw.dll"
- WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264" "FriendlyName" "x264"
-
-
-
-SectionEnd ; end of default section
-
-
-
-; ---------------------------------------------------------------------------
-
-; begin uninstall settings/section
-UninstallText "This will uninstall ${NAME} from your system"
-
-Section Uninstall
-
- ; add delete commands to delete whatever files/registry keys/etc you installed here.
- Delete /REBOOTOK "$SYSDIR\${VFW_FILE1}"
- Delete /REBOOTOK "$SYSDIR\${VFW_FILE2}"
- Delete "$SYSDIR\${UNINST_NAME}"
-
- DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${NAME}"
- DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows NT\CurrentVersion\Drivers32\vidc.X264"
- DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Drivers32\vidc.X264"
- DeleteRegKey HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.X264"
- DeleteINIStr system.ini drivers32 "vidc.X264"
- Delete "$SMPROGRAMS\x264\x264 configuration.lnk"
- Delete "$SMPROGRAMS\x264\x264 Uninstall.lnk"
- RMDir "$SMPROGRAMS\x264"
-
-
-SectionEnd ; end of uninstall section
-
-; ---------------------------------------------------------------------------
-
-Function un.onUninstSuccess
- IfRebootFlag 0 NoReboot
- MessageBox MB_OK \
- "A file couldn't be deleted. It will be deleted at next reboot."
- NoReboot:
-FunctionEnd
-
-; ---------------------------------------------------------------------------
-; eof
-; ---------------------------------------------------------------------------
+++ /dev/null
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by resource.rc
-//
-#define IDD_DIALOG1 101
-#define IDD_ABOUT 103
-#define IDD_ERRCONSOLE 104
-#define IDD_TAB_BITRATE 106
-#define IDD_MAINCONFIG 107
-#define IDB_LOGO 108
-#define IDD_TAB_IPFRAMES 109
-#define IDD_TAB_RATECONTROL 113
-#define IDD_TAB_MISC 114
-#define IDC_BITRATESLIDER 1002
-#define IDC_BITRATEEDIT 1003
-#define IDC_BITRATESLIDER2 1004
-#define IDC_QUANTSLIDER 1005
-#define IDC_CABAC 1006
-#define IDC_BITRATEEDIT2 1007
-#define IDC_QUANTEDIT 1008
-#define IDC_B8X8 1009
-#define IDC_2PASSBITRATE_S 1010
-#define IDC_LOOPFILTER 1011
-#define IDC_2PASSBITRATE 1012
-#define IDC_I4X4 1013
-#define IDC_BITRATELOW 1014
-#define IDC_P8X8 1015
-#define IDC_BITRATELOW2 1016
-#define IDC_P4X4 1017
-#define IDC_BITRATEHIGH 1018
-#define IDC_BFRAMES 1019
-#define IDC_BITRATEHIGH2 1020
-#define IDC_KEYINTMIN 1021
-#define IDC_BFRAMES2 1022
-#define IDC_KEYINTMAX 1023
-#define IDC_BITRATELOW3 1024
-#define IDC_EDIT3 1025
-#define IDC_REFFRAMES 1026
-#define IDC_BITRATEHIGH3 1027
-#define IDC_BFRAME 1028
-#define IDC_DEFAULTS 1029
-#define IDC_CHECK3 1030
-#define IDC_ADVANCED 1031
-#define IDC_RADIO1 1032
-#define IDC_RADIOBITRATE 1033
-#define IDC_MODE 1034
-#define IDC_RADIOQUALITY 1035
-#define IDC_RADIOQUANT 1036
-#define IDC_RADIOTWOPASS 1037
-#define IDC_USEADVANCED 1038
-#define IDC_ADVDEFAULTS 1039
-#define IDC_HOMEPAGE 1040
-#define IDC_X264 1041
-#define IDC_BUILD 1042
-#define IDC_FOURCC 1043
-#define IDC_SUBPEL 1044
-#define IDC_DIRECTPRED 1045
-#define IDC_2PASS1 1046
-#define IDC_2PASS2 1047
-#define IDC_INLOOP_A 1048
-#define IDC_LOOPA_TXT 1049
-#define IDC_FAST1PASS 1050
-#define IDC_IPRATIO 1051
-#define IDC_PBRATIO 1052
-#define IDC_CURVECOMP 1053
-#define IDC_UPDATESTATS 1054
-#define IDC_STATSFILE 1055
-#define IDC_STATSFILE_BROWSE 1056
-#define IDC_CONSOLE 1057
-#define IDC_COPYCLIP 1058
-#define IDC_BREFS 1059
-#define IDC_WBPRED 1060
-#define IDC_THREADS 1061
-#define IDC_THREADEDIT 1062
-#define IDC_SAR_W 1063
-#define IDC_SAR_H 1064
-#define IDC_I8X8 1065
-#define IDC_DCT8X8 1066
-#define IDC_NR 1067
-#define IDC_ME_METHOD 1068
-#define IDC_MIXEDREF 1069
-#define IDC_CHROMAME 1070
-#define IDC_MERANGE 1071
-#define IDC_BADAPT 1072
-#define IDC_BBIASSLIDER 1073
-#define IDC_BBIAS 1074
-#define IDC_QPMIN 1075
-#define IDC_QPMAX 1076
-#define IDC_QPSTEP 1077
-#define IDC_INLOOP_B 1078
-#define IDC_LOOPB_TXT 1079
-#define IDC_LOG 1080
-#define IDC_DEBUG 1084
-#define IDC_CPU_MMX 1086
-#define IDC_SCENECUT 1087
-#define IDC_TAB1 1089
-#define IDC_BITRATEMODE 1091
-#define IDC_BITRATELABEL 1092
-#define IDC_LOGO 1093
-#define IDC_BUILDREV 1095
-#define IDC_TRELLIS 1097
-#define IDC_BIDIR_ME 1098
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 109
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1101
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
+++ /dev/null
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_MAINCONFIG DIALOGEX 0, 0, 204, 222
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "x264 Configuration"
-FONT 8, "MS Sans Serif", 400, 0, 0x0
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,156,204,42,14
- CONTROL "",IDC_TAB1,"SysTabControl32",TCS_MULTILINE | WS_TABSTOP,0,0,204,200,WS_EX_TRANSPARENT
- PUSHBUTTON "Load Defaults",IDC_DEFAULTS,6,204,54,14
- PUSHBUTTON "Cancel",IDCANCEL,108,204,42,14
-END
-
-IDD_TAB_BITRATE DIALOGEX 0, 0, 200, 188
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
- CONTROL 108,IDC_LOGO,"Static",SS_BITMAP,31,12,136,39,WS_EX_CLIENTEDGE
- COMBOBOX IDC_BITRATEMODE,30,66,138,66,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "Average Bitrate (kbps)",IDC_BITRATELABEL,30,84,90,12
- CONTROL "",IDC_BITRATESLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,24,98,150,18
- EDITTEXT IDC_BITRATEEDIT,144,84,24,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "0",IDC_BITRATELOW,30,116,66,12
- RTEXT "5000",IDC_BITRATEHIGH,108,116,60,12
- CONTROL "Update Statsfile",IDC_UPDATESTATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,138,72,12
- LTEXT "Statsfile name",IDC_STATIC,12,156,48,12,SS_CENTERIMAGE
- EDITTEXT IDC_STATSFILE,60,156,102,12,ES_AUTOHSCROLL
- PUSHBUTTON "...",IDC_STATSFILE_BROWSE,168,156,18,12
- CTEXT "BUILD",IDC_BUILDREV,7,52,186,8,SS_CENTERIMAGE | WS_DISABLED
-END
-
-IDD_TAB_IPFRAMES DIALOGEX 0, 0, 200, 188
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
- GROUPBOX "Partitions",IDC_STATIC,6,2,186,90,WS_DISABLED
- CONTROL "8x8 Transform",IDC_DCT8X8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,11,60,12,WS_EX_TRANSPARENT
- CONTROL "8x8, 8x16 and 16x8 P-frame search",IDC_P8X8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,24,127,12,WS_EX_TRANSPARENT
- CONTROL "8x8, 8x16 and 16x8 B-frame search",IDC_B8X8,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,37,127,12,WS_EX_TRANSPARENT
- CONTROL "4x4, 4x8 and 8x4 P-frame search",IDC_P4X4,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,50,119,12,WS_EX_TRANSPARENT
- CONTROL "8x8 Intra search",IDC_I8X8,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,30,63,66,12,WS_EX_TRANSPARENT
- CONTROL "4x4 Intra search",IDC_I4X4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,76,66,12,WS_EX_TRANSPARENT
- GROUPBOX "B Frames",IDC_STATIC,6,94,186,86,WS_DISABLED
- LTEXT "Max consecutive",IDC_STATIC,30,103,60,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_BFRAME,126,103,24,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "Bias",IDC_STATIC,30,117,14,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- CONTROL "",IDC_BBIASSLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,48,117,72,12,WS_EX_TRANSPARENT
- EDITTEXT IDC_BBIAS,126,117,24,12,ES_AUTOHSCROLL
- CONTROL "Use as references",IDC_BREFS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,133,71,12,WS_EX_TRANSPARENT
- CONTROL "Bidirectional ME",IDC_BIDIR_ME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,109,133,72,12,WS_EX_TRANSPARENT
- CONTROL "Weighted biprediction",IDC_WBPRED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,145,82,12,WS_EX_TRANSPARENT
- CONTROL "Adaptive",IDC_BADAPT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,145,43,12,WS_EX_TRANSPARENT
- LTEXT "Direct mode",IDC_STATIC,30,161,42,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- COMBOBOX IDC_DIRECTPRED,114,161,54,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-END
-
-IDD_TAB_RATECONTROL DIALOGEX 0, 0, 200, 188
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
- GROUPBOX "Bitrate",IDC_STATIC,6,2,186,53,WS_DISABLED
- LTEXT "Keyframe boost (%)",IDC_STATIC,42,10,68,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "B-frames reduction (%)",IDC_STATIC,42,24,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Bitrate variability (%)",IDC_STATIC,42,38,68,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_IPRATIO,126,10,24,12,ES_AUTOHSCROLL | ES_NUMBER
- EDITTEXT IDC_PBRATIO,126,24,24,12,ES_AUTOHSCROLL | ES_NUMBER
- EDITTEXT IDC_CURVECOMP,126,38,24,12,ES_AUTOHSCROLL | ES_NUMBER
- GROUPBOX "Quantization Limits",IDC_STATIC,6,56,186,52,WS_DISABLED
- LTEXT "Min QP",IDC_STATIC,42,64,24,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Max QP",IDC_STATIC,42,78,26,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Max QP Step",IDC_STATIC,42,92,43,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_QPMIN,126,64,24,12,ES_AUTOHSCROLL
- EDITTEXT IDC_QPMAX,126,78,24,12,ES_AUTOHSCROLL
- EDITTEXT IDC_QPSTEP,126,92,24,12,ES_AUTOHSCROLL
- GROUPBOX "Scene Cuts",IDC_STATIC,6,110,186,56,WS_DISABLED
- LTEXT "Scene Cut Threshold",IDC_STATIC,42,119,72,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Min IDR-frame interval",IDC_STATIC,42,133,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Max IDR-frame interval",IDC_STATIC,42,147,78,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_SCENECUT,126,119,24,12,ES_AUTOHSCROLL
- EDITTEXT IDC_KEYINTMIN,126,133,24,12,ES_AUTOHSCROLL | ES_NUMBER
- EDITTEXT IDC_KEYINTMAX,126,147,24,12,ES_AUTOHSCROLL | ES_NUMBER
-END
-
-IDD_TAB_MISC DIALOGEX 0, 0, 200, 188
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-FONT 8, "MS Shell Dlg", 0, 0, 0x0
-BEGIN
- GROUPBOX "Motion Estimation",IDC_STATIC,7,2,186,82,WS_DISABLED
- LTEXT "Partition decision",IDC_STATIC,30,12,60,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- COMBOBOX IDC_SUBPEL,90,12,84,77,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
- LTEXT "Method",IDC_STATIC,30,30,30,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- COMBOBOX IDC_ME_METHOD,84,30,90,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "Range",IDC_STATIC,30,48,24,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_MERANGE,60,48,24,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "Chroma ME",IDC_CHROMAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,48,48,12,WS_EX_TRANSPARENT
- LTEXT "Max Ref. frames",IDC_STATIC,30,66,54,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- EDITTEXT IDC_REFFRAMES,88,66,24,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "Mixed Refs",IDC_MIXEDREF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,126,66,48,12,WS_EX_TRANSPARENT
- GROUPBOX "Debug",IDC_STATIC,94,91,96,46,WS_DISABLED
- LTEXT "Log level",IDC_STATIC,100,101,36,12,SS_CENTERIMAGE
- LTEXT "FourCC",IDC_STATIC,100,119,36,12,SS_CENTERIMAGE
- COMBOBOX IDC_LOG,136,101,48,67,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_FOURCC,136,119,30,12,ES_AUTOHSCROLL
- GROUPBOX "Misc. options",IDC_STATIC,7,86,186,95,WS_DISABLED
- LTEXT "Sample AR",IDC_STATIC,10,101,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- CTEXT ":",IDC_STATIC,61,101,12,12,SS_CENTERIMAGE
- EDITTEXT IDC_SAR_W,46,101,18,12,ES_AUTOHSCROLL | ES_NUMBER
- EDITTEXT IDC_SAR_H,70,101,18,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "Threads",IDC_THREADS,10,119,30,12,SS_CENTERIMAGE
- EDITTEXT IDC_THREADEDIT,46,119,18,12,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,140,39,12,WS_EX_TRANSPARENT
- CONTROL "Deblocking filter:",IDC_LOOPFILTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,154,66,12
- CONTROL "Trellis",IDC_TRELLIS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,65,140,37,12,WS_EX_TRANSPARENT
- LTEXT "Noise Reduction",IDC_STATIC,111,140,56,12,SS_CENTERIMAGE
- EDITTEXT IDC_NR,168,140,21,12,ES_AUTOHSCROLL | ES_NUMBER
- LTEXT "Strength",IDC_STATIC,87,154,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "Threshold",IDC_STATIC,87,167,36,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- CONTROL "",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,123,155,42,12,WS_EX_TRANSPARENT
- CONTROL "",IDC_INLOOP_B,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,123,167,42,12,WS_EX_TRANSPARENT
- LTEXT "0",IDC_LOOPA_TXT,171,154,12,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
- LTEXT "0",IDC_LOOPB_TXT,171,167,12,12,SS_CENTERIMAGE,WS_EX_TRANSPARENT
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_MAINCONFIG, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 197
- TOPMARGIN, 7
- BOTTOMMARGIN, 215
- END
-
- IDD_TAB_BITRATE, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 193
- TOPMARGIN, 7
- BOTTOMMARGIN, 181
- END
-
- IDD_TAB_IPFRAMES, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 193
- TOPMARGIN, 7
- BOTTOMMARGIN, 181
- END
-
- IDD_TAB_RATECONTROL, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 193
- TOPMARGIN, 7
- BOTTOMMARGIN, 181
- END
-
- IDD_TAB_MISC, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 193
- TOPMARGIN, 7
- BOTTOMMARGIN, 181
- HORZGUIDE, 179
- END
-END
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_LOGO BITMAP "x264.bmp"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// String Table
-//
-
-STRINGTABLE
-BEGIN
- IDC_BADAPT "Use fewer B-frames if needed"
- IDC_BBIAS "Influence how often B-frames are used"
- IDC_BFRAME "Limit consecutive runs of B-frames"
- IDC_BIDIR_ME "Jointly optimize both MVs in B-frames"
- IDC_BREFS "Keep some B-frames as references"
- IDC_DEFAULTS "Reset everything"
- IDC_DIRECTPRED "B-Direct MV prediction mode"
- IDC_KEYINTMIN "Minimum GOP size"
- IDC_KEYINTMAX "Maximum GOP size"
- IDC_MIXEDREF "Decide references on a per partition basis"
- IDC_NR "DCT noise reduction amount"
- IDC_SCENECUT "How aggressively to insert extra I-frames"
- IDC_TRELLIS "Trellis quantization on the final MB"
- IDC_WBPRED "Weighted prediction for B-frames"
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (Canada) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_ABOUT DIALOGEX 0, 0, 213, 130
-STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "About x264"
-FONT 8, "MS Sans Serif", 0, 0, 0x0
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,158,109,48,14
- PUSHBUTTON "Visit Homepage",IDC_HOMEPAGE,7,109,77,14
- CTEXT "BUILD",IDC_BUILD,6,18,199,8
- CTEXT "x264 - H.264/MPEG-4 AVC codec",IDC_X264,6,6,199,8
- CTEXT "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.",IDC_STATIC,6,78,199,26
- CTEXT "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, Måns Rullgård, Loren Merritt",IDC_STATIC,6,48,199,18
-END
-
-IDD_ERRCONSOLE DIALOG 0, 0, 264, 130
-STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
-CAPTION "x264 error console"
-FONT 8, "MS Sans Serif"
-BEGIN
- DEFPUSHBUTTON "OK",IDOK,68,110,48,14
- DEFPUSHBUTTON "Copy",IDC_COPYCLIP,148,110,48,14
- LISTBOX IDC_CONSOLE,6,8,251,95,LBS_NOINTEGRALHEIGHT | LBS_NOSEL
-END
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (Canada) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+++ /dev/null
-#ifndef _INC_VFW
-#define _INC_VFW
-
-#include <mmsystem.h>
-
-#ifndef aviTWOCC
-#define aviTWOCC(C0,C1) ((WORD)(BYTE)(C0)|((WORD)(BYTE)(C1) << 8))
-#endif
-
-#ifndef ICTYPE_VIDEO
-#define ICTYPE_VIDEO mmioFOURCC('v', 'i', 'd', 'c')
-#define ICTYPE_AUDIO mmioFOURCC('a', 'u', 'd', 'c')
-#endif
-
-#ifndef ICERR_OK
-#define ICERR_OK 0L
-#define ICERR_DONTDRAW 1L
-#define ICERR_NEWPALETTE 2L
-#define ICERR_GOTOKEYFRAME 3L
-#define ICERR_STOPDRAWING 4L
-
-#define ICERR_UNSUPPORTED -1L
-#define ICERR_BADFORMAT -2L
-#define ICERR_MEMORY -3L
-#define ICERR_INTERNAL -4L
-#define ICERR_BADFLAGS -5L
-#define ICERR_BADPARAM -6L
-#define ICERR_BADSIZE -7L
-#define ICERR_BADHANDLE -8L
-#define ICERR_CANTUPDATE -9L
-#define ICERR_ABORT -10L
-#define ICERR_ERROR -100L
-#define ICERR_BADBITDEPTH -200L
-#define ICERR_BADIMAGESIZE -201L
-
-#define ICERR_CUSTOM -400L
-#endif
-
-#ifndef ICMODE_COMPRESS
-#define ICMODE_COMPRESS 1
-#define ICMODE_DECOMPRESS 2
-#define ICMODE_FASTDECOMPRESS 3
-#define ICMODE_QUERY 4
-#define ICMODE_FASTCOMPRESS 5
-#define ICMODE_DRAW 8
-#endif
-
-#define AVIIF_LIST 0x00000001L
-#define AVIIF_TWOCC 0x00000002L
-#define AVIIF_KEYFRAME 0x00000010L
-
-#define ICCOMPRESS_KEYFRAME 0x00000001L
-
-typedef struct {
- DWORD dwFlags;
- LPBITMAPINFOHEADER lpbiOutput;
- LPVOID lpOutput;
- LPBITMAPINFOHEADER lpbiInput;
- LPVOID lpInput;
- LPDWORD lpckid;
- LPDWORD lpdwFlags;
- LONG lFrameNum;
- DWORD dwFrameSize;
- DWORD dwQuality;
- LPBITMAPINFOHEADER lpbiPrev;
- LPVOID lpPrev;
-} ICCOMPRESS;
-
-#define ICCOMPRESSFRAMES_PADDING 0x00000001
-
-typedef struct {
- DWORD dwFlags;
- LPBITMAPINFOHEADER lpbiOutput;
- LPARAM lOutput;
- LPBITMAPINFOHEADER lpbiInput;
- LPARAM lInput;
- LONG lStartFrame;
- LONG lFrameCount;
- LONG lQuality;
- LONG lDataRate;
- LONG lKeyRate;
- DWORD dwRate;
- DWORD dwScale;
- DWORD dwOverheadPerFrame;
- DWORD dwReserved2;
- LONG (CALLBACK *GetData)(LPARAM,LONG,LPVOID,LONG);
- LONG (CALLBACK *PutData)(LPARAM,LONG,LPVOID,LONG);
-} ICCOMPRESSFRAMES;
-
-#define ICDECOMPRESS_HURRYUP 0x80000000L
-#define ICDECOMPRESS_UPDATE 0x40000000L
-#define ICDECOMPRESS_PREROLL 0x20000000L
-#define ICDECOMPRESS_NULLFRAME 0x10000000L
-#define ICDECOMPRESS_NOTKEYFRAME 0x08000000L
-
-typedef struct {
- DWORD dwFlags;
- LPBITMAPINFOHEADER lpbiInput;
- LPVOID lpInput;
- LPBITMAPINFOHEADER lpbiOutput;
- LPVOID lpOutput;
- DWORD ckid;
-} ICDECOMPRESS;
-
-typedef struct {
- DWORD dwSize;
- DWORD fccType;
- DWORD fccHandler;
- DWORD dwVersion;
- DWORD dwFlags;
- LRESULT dwError;
- LPVOID pV1Reserved;
- LPVOID pV2Reserved;
- DWORD dnDevNode;
-} ICOPEN;
-
-#define ICM_USER (DRV_USER+0x0000)
-
-#define ICM_RESERVED ICM_RESERVED_LOW
-#define ICM_RESERVED_LOW (DRV_USER+0x1000)
-#define ICM_RESERVED_HIGH (DRV_USER+0x2000)
-
-#define ICM_GETSTATE (ICM_RESERVED+0)
-#define ICM_SETSTATE (ICM_RESERVED+1)
-#define ICM_GETINFO (ICM_RESERVED+2)
-#define ICM_CONFIGURE (ICM_RESERVED+10)
-#define ICM_ABOUT (ICM_RESERVED+11)
-#define ICM_GETERRORTEXT (ICM_RESERVED+12)
-#define ICM_GETFORMATNAME (ICM_RESERVED+20)
-#define ICM_ENUMFORMATS (ICM_RESERVED+21)
-#define ICM_GETDEFAULTQUALITY (ICM_RESERVED+30)
-#define ICM_GETQUALITY (ICM_RESERVED+31)
-#define ICM_SETQUALITY (ICM_RESERVED+32)
-#define ICM_SET (ICM_RESERVED+40)
-#define ICM_GET (ICM_RESERVED+41)
-
-#define ICM_FRAMERATE mmioFOURCC('F','r','m','R')
-#define ICM_KEYFRAMERATE mmioFOURCC('K','e','y','R')
-
-typedef struct {
- DWORD dwSize;
- DWORD fccType;
- DWORD fccHandler;
- DWORD dwFlags;
- DWORD dwVersion;
- DWORD dwVersionICM;
- WCHAR szName[16];
- WCHAR szDescription[128];
- WCHAR szDriver[128];
-} ICINFO;
-
-#define VIDCF_QUALITY 0x0001
-#define VIDCF_CRUNCH 0x0002
-#define VIDCF_TEMPORAL 0x0004
-#define VIDCF_COMPRESSFRAMES 0x0008
-#define VIDCF_DRAW 0x0010
-#define VIDCF_FASTTEMPORALC 0x0020
-#define VIDCF_FASTTEMPORALD 0x0080
-#define VIDCF_QUALITYTIME 0x0040
-#define VIDCF_FASTTEMPORAL (VIDCF_FASTTEMPORALC|VIDCF_FASTTEMPORALD)
-
-#define ICVERSION 0x0104
-
-#define ICM_COMPRESS_GET_FORMAT (ICM_USER+4)
-#define ICM_COMPRESS_GET_SIZE (ICM_USER+5)
-#define ICM_COMPRESS_QUERY (ICM_USER+6)
-#define ICM_COMPRESS_BEGIN (ICM_USER+7)
-#define ICM_COMPRESS (ICM_USER+8)
-#define ICM_COMPRESS_END (ICM_USER+9)
-
-#define ICM_DECOMPRESS_GET_FORMAT (ICM_USER+10)
-#define ICM_DECOMPRESS_QUERY (ICM_USER+11)
-#define ICM_DECOMPRESS_BEGIN (ICM_USER+12)
-#define ICM_DECOMPRESS (ICM_USER+13)
-#define ICM_DECOMPRESS_END (ICM_USER+14)
-#define ICM_DECOMPRESS_SET_PALETTE (ICM_USER+29)
-#define ICM_DECOMPRESS_GET_PALETTE (ICM_USER+30)
-
-#define ICM_DRAW_QUERY (ICM_USER+31)
-#define ICM_DRAW_BEGIN (ICM_USER+15)
-#define ICM_DRAW_GET_PALETTE (ICM_USER+16)
-#define ICM_DRAW_UPDATE (ICM_USER+17)
-#define ICM_DRAW_START (ICM_USER+18)
-#define ICM_DRAW_STOP (ICM_USER+19)
-#define ICM_DRAW_BITS (ICM_USER+20)
-#define ICM_DRAW_END (ICM_USER+21)
-#define ICM_DRAW_GETTIME (ICM_USER+32)
-#define ICM_DRAW (ICM_USER+33)
-#define ICM_DRAW_WINDOW (ICM_USER+34)
-#define ICM_DRAW_SETTIME (ICM_USER+35)
-#define ICM_DRAW_REALIZE (ICM_USER+36)
-#define ICM_DRAW_FLUSH (ICM_USER+37)
-#define ICM_DRAW_RENDERBUFFER (ICM_USER+38)
-#define ICM_DRAW_START_PLAY (ICM_USER+39)
-#define ICM_DRAW_STOP_PLAY (ICM_USER+40)
-#define ICM_DRAW_SUGGESTFORMAT (ICM_USER+50)
-#define ICM_DRAW_CHANGEPALETTE (ICM_USER+51)
-#define ICM_DRAW_IDLE (ICM_USER+52)
-#define ICM_GETBUFFERSWANTED (ICM_USER+41)
-#define ICM_GETDEFAULTKEYFRAMERATE (ICM_USER+42)
-#define ICM_DECOMPRESSEX_BEGIN (ICM_USER+60)
-#define ICM_DECOMPRESSEX_QUERY (ICM_USER+61)
-#define ICM_DECOMPRESSEX (ICM_USER+62)
-#define ICM_DECOMPRESSEX_END (ICM_USER+63)
-#define ICM_COMPRESS_FRAMES_INFO (ICM_USER+70)
-#define ICM_COMPRESS_FRAMES (ICM_USER+71)
-#define ICM_SET_STATUS_PROC (ICM_USER+72)
-
-#endif /* _INC_VFW */
+++ /dev/null
-#ifndef _X264_VFW_H
-#define _X264_VFW_H
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-#include <windows.h>
-#include <vfw.h>
-
-#include <x264.h>
-
-#include "resource.h"
-
-/* Name */
-#define X264_NAME_L L"x264"
-#define X264_DESC_L L"x264 - H264/AVC encoder"
-
-/* Codec fcc */
-#define FOURCC_X264 mmioFOURCC('X','2','6','4')
-
-/* yuv 4:2:0 planar */
-#define FOURCC_I420 mmioFOURCC('I','4','2','0')
-#define FOURCC_IYUV mmioFOURCC('I','Y','U','V')
-#define FOURCC_YV12 mmioFOURCC('Y','V','1','2')
-
-/* yuv 4:2:2 packed */
-#define FOURCC_YUY2 mmioFOURCC('Y','U','Y','2')
-#define FOURCC_YUYV mmioFOURCC('Y','U','Y','V')
-
-#define X264_WEBSITE "http://videolan.org/x264.html"
-
-/* CONFIG: vfw config
- */
-typedef struct
-{
- /********** ATTENTION **********/
- int mode; /* Vidomi directly accesses these vars */
- int bitrate;
- int desired_size; /* please try to avoid modifications here */
- char stats[MAX_PATH];
- /*******************************/
- int i_2passbitrate;
- int i_pass;
-
- int b_fast1pass; /* turns off some flags during 1st pass */
- int b_updatestats; /* updates the statsfile during 2nd pass */
-
- int i_frame_total;
-
- /* Our config */
- int i_refmax;
- int i_keyint_max;
- int i_keyint_min;
- int i_scenecut_threshold;
- int i_qp_min;
- int i_qp_max;
- int i_qp_step;
-
- int i_qp;
- int b_filter;
-
- int b_cabac;
-
- int b_i8x8;
- int b_i4x4;
- int b_psub16x16;
- int b_psub8x8;
- int b_bsub16x16;
- int b_dct8x8;
- int b_mixedref;
-
- int i_bframe;
- int i_subpel_refine;
- int i_me_method;
- int i_me_range;
- int b_chroma_me;
- int i_direct_mv_pred;
- int i_threads;
-
- int i_inloop_a;
- int i_inloop_b;
-
- int b_b_refs;
- int b_b_wpred;
- int i_bframe_bias;
- int b_bframe_adaptive;
-
- int i_key_boost;
- int i_b_red;
- int i_curve_comp;
-
- int i_sar_width;
- int i_sar_height;
-
- int i_log_level;
-
- /* vfw interface */
- int b_save;
- /* fourcc used */
- char fcc[4+1];
- int i_encoding_type;
- int i_trellis;
- int b_bidir_me;
- int i_noise_reduction;
-} CONFIG;
-
-/* CODEC: vfw codec instance
- */
-typedef struct
-{
- CONFIG config;
-
- /* handle */
- x264_t *h;
-
- /* error console handle */
- HWND *hCons;
-
- /* XXX: needed ? */
- unsigned int fincr;
- unsigned int fbase;
-} CODEC;
-
-/* Compress functions */
-LRESULT compress_query(CODEC *, BITMAPINFO *, BITMAPINFO *);
-LRESULT compress_get_format(CODEC *, BITMAPINFO *, BITMAPINFO *);
-LRESULT compress_get_size(CODEC *, BITMAPINFO *, BITMAPINFO *);
-LRESULT compress_frames_info(CODEC *, ICCOMPRESSFRAMES *);
-LRESULT compress_begin(CODEC *, BITMAPINFO *, BITMAPINFO *);
-LRESULT compress_end(CODEC *);
-LRESULT compress(CODEC *, ICCOMPRESS *);
-
-
-/* config functions */
-void config_reg_load( CONFIG * config );
-void config_reg_save( CONFIG * config );
-static void tabs_enable_items( HWND hDlg, CONFIG * config );
-static void tabs_update_items( HWND hDlg, CONFIG * config );
-
-/* Dialog callbacks */
-BOOL CALLBACK callback_main ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-BOOL CALLBACK callback_tabs( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-BOOL CALLBACK callback_err_console( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-
-/* Dll instance */
-extern HINSTANCE g_hInst;
-
-#if defined(_DEBUG)
-#include <stdio.h> /* vsprintf */
-#define DPRINTF_BUF_SZ 1024
-static __inline void DPRINTF(char *fmt, ...)
-{
- va_list args;
- char buf[DPRINTF_BUF_SZ];
-
- va_start(args, fmt);
- vsprintf(buf, fmt, args);
- OutputDebugString(buf);
-}
-#else
-static __inline void DPRINTF(char *fmt, ...) { }
-#endif
-
-
-#endif
-