Commit 9f05a7fd authored by Loren Merritt's avatar Loren Merritt

no more vfw


git-svn-id: svn://svn.videolan.org/x264/trunk@581 df754926-b1dd-0310-bc7b-ec298dee348c
parent aabb91c8
......@@ -75,9 +75,6 @@ $(SONAME): .depend $(OBJS) $(OBJASM)
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
......@@ -133,13 +130,12 @@ clean:
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)
......
......@@ -9,7 +9,6 @@ echo ""
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"
......@@ -51,7 +50,6 @@ pthread="auto"
debug="no"
gprof="no"
pic="no"
vfw="no"
gtk="no"
vis="no"
shared="no"
......@@ -218,11 +216,9 @@ for opt do
;;
--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"
......@@ -241,12 +237,6 @@ for opt do
--enable-pic)
pic="yes"
;;
--enable-vfw)
vfw="yes"
;;
--disable-vfw)
vfw="no"
;;
--enable-gtk)
gtk="yes"
;;
......@@ -326,7 +316,6 @@ fi
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
......@@ -358,7 +347,6 @@ CFLAGS=$CFLAGS
LDFLAGS=$LDFLAGS
AS=$AS
ASFLAGS=$ASFLAGS
VFW=$vfw
GTK=$gtk
EXE=$EXE
VIS=$vis
......@@ -374,15 +362,6 @@ echo '' >> config.mak
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
......@@ -428,7 +407,6 @@ echo "System: $SYS"
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"
......
##############################################################################
#
# 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)
; 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"
# Microsoft Developer Studio Project File - Name="x264vfw" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=x264vfw - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "x264vfw.mak" CFG="x264vfw - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "x264vfw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "x264vfw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "x264vfw - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "obj/Release"
# PROP Intermediate_Dir "obj/Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VFW_EXPORTS" /YX /FD /c
# 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
# SUBTRACT CPP /Z<none>
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# 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
# 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"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "x264vfw - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "obj/Debug"
# PROP Intermediate_Dir "obj/Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# 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
# 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
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "_DEBUG"
# ADD RSC /l 0x804 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
# 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
# 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
!ENDIF
# Begin Target
# Name "x264vfw - Win32 Release"
# Name "x264vfw - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\codec.c
# End Source File
# Begin Source File
SOURCE=..\..\config.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.c
# End Source File
# Begin Source File
SOURCE=..\..\driverproc.def
# End Source File
# Begin Source File
SOURCE=..\..\resource.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\resource.h
# End Source File
# Begin Source File
SOURCE=..\..\x264vfw.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=..\..\..\build\win32\bin\libx264.lib
# End Source File
# End Target
# End Project
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "x264vfw"=.\x264vfw.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
/*****************************************************************************
* 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( &param );
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 )