參考 http://dranger.com/ffmpeg/tutorial07.html 進行實作練習,
以下附上一個可以在 ffmpeg 1.1.1 (build Jan 27 2013) 正確編譯的例子。
// tutorial07.c
// A pedagogical video player that really works! Now with seeking features.
//
// Code based on FFplay, Copyright (c) 2003 Fabrice Bellard,
// and a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de)
// Tested on Gentoo, CVS version 5/01/07 compiled with GCC 4.1.1
// Use
//
// gcc -o tutorial07 tutorial07.c -lavformat -lavcodec -lz -lm `sdl-config --cflags --libs`
// to build (assuming libavformat and libavcodec are correctly installed,
// and assuming you have sdl-config. Please refer to SDL docs for your installation.)
//
// Run using
// tutorial07 myvideofile.mpg
//
// to play the video.
// 20130205 albert.liao modified start
//#include
//#include
//#include
//#include
#include
#include
#include
#include
#include
//#undef main /* Prevents SDL from overriding main() */
// 20130205 albert.liao modified end
#ifdef __MINGW32__
#undef main /* Prevents SDL from overriding main() */
#endif
#include
#include