在windows上編譯ffplay參考:用msys2與mingw編譯FFmpeg
使用vscode mingw編譯和調試c/c++程序的步驟可以參考:vscode 在windows下使用gcc+mingw調試 c/c++程序
注意編譯ffmpeg的時候configure設置下--enable-debug=3 --disable-stripping --disable-optimizations
的選項
./configure --prefix=build_out \
--enable-gpl \
--enable-sdl2 \
--enable-version3 \
--enable-nonfree \
--disable-doc \
--enable-debug=3 --disable-stripping --disable-optimizations
創(chuàng)建一個launch.json文件,主要修改下program和args西采,program指向ffplay_g.exe的路徑永票,args為命令行的參數认然。
{
"configurations": [
{
"name": "C/C++: gcc.exe 生成和調試活動文件",
"type": "cppdbg",
"request": "launch",
"program": "C:\\workspace\\FFmpeg\\build_out\\ffplay_g.exe",
"args": ["C:\Users\smallest\Desktop\demo.mp4"],
"stopAtEntry": false,
"cwd": "C:\\msys64\\mingw64\\bin",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "為 gdb 啟用整齊打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "將反匯編風格設置為 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe 生成活動文件"
}
],
"version": "2.0.0"
}
然后運行vscode的Run->Start Debugging選項