Before the notes with the note, turned out, finishing ha
FFmpeg compilation on Windows is cumbersome, and if MINGW-GCC compiles, it can't be debugged in vs.
So before just started playing ffmpeg, a bit of effort, with the VS compilation debugging FFmpeg, of course, in MinGW debugging is also possible.
Because of the previous notes, there are some areas that are not very detailed and are mainly recorded in key areas.
You can also download the vs2013 project directly from the compiled configuration.
First, the Preparation tool
1. Msysgit Environment, https://github.com/msysgit/msysgit/
2. Then download the yasm,pkg_config,glib version of Windows, placed in the bin directory
Yasm can be downloaded directly from the official website to download the Win64. exe version (VS version has a problem). renamed to Yasm.exe after download
Pkg_config, Http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip
Glib,http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib_2.18.4-1_win32.zip
Second, compiling ffmpeg
1. Search for Link.exe in MinGW, rename or delete, because of link conflict with VS
2.
Export pkg_config_path=/mingw/lib/pkgconfig:/usr/local/lib/"C:\Program Files" (x86) \ Microsoft Visual Studio 12.0\vc\bin\vcvars32.bat"
3. Configure FFmpeg, the default compilation parameter is O2 optimization, so it's not easy to debug
Attempts to disable optimizations can result in a large number of errors at compile time, so use O1 optimization so that debugging will not be optimized too much
./configure--enable-shared--enable-memalign-hack--ENABLE-GPL--enable-libx264--enable-postproc--prefix=./vs2013 _build/debug--toolchain=msvc --disable-optimizations--disable-stripping --enable-debug--optflags=' -o1-zo-arch:sse2 '--extra-cflags='-gy-mdd-id:/code/libx264' -- extra-ldflags='-opt:ref-debug -verbose-libpath:d:/code/libx264'
O1 optimization, the local variable will be optimized out, the other should not have much impact
The-zo parameter (vs2012 in/d2zi+) allows debugging to run in optimized mode (note that the/z7 parameter in config.mk cannot be removed)
/GY enables function-level linking.
-arch::sse2 to solve SSE MMX and other instructions can not link.
Four, the compiled Lib embedded in the VS project, but also need to make some changes
Error c2054:expected ' (' to follow ' inline '
Error C2085: ' av_cmp_q ': not in formal parameter list
Directly change project->[setting]->[c/c++]->preprocessor definitions: Enter Inline=__inline in the edit box.
Inline=__inline
You also need to define
snprintf=_snprintf
Ffplay.c in CMDUTILS.C Print_all_libs_info
Comments
Print_lib_info (Avresample, avresample, flags, level);
Print_lib_info (Postproc, Postproc, flags, level);
Modify Config.h
#define HAVE_STRUCT_POLLFD 1
Five, compile x264
Msysgit compiled with the-enable-win32thread parameter will not rely on LIBGCC and pthread
./configure--enable-shared--host=i686-pc---enable-static --enable-win32thread Pexports libx264-142. dll > libx264-142/machine:x86/def:libx264-142. Def
Msys compiled, there will be a problem is that the GCC version is too old.
In addition Msysgit, you may need to remove some GCC compilation parameters in Configure-WL,--nxcompat-wl,--dynamicbase, which may cause GCC to be unrecognized. Error is no working C compiler
FFmpeg and x264 that can be debugged under compile vs