星期五, 6月 16, 2006

ffmpeg - some code reading..

Start point : http://www.cse.msu.edu/~minutsil/linux.html 的ffmpeg_decode.c
ffmpeg 的library有libavformat和libavcodec.

libavformat是分析file, stream codec type用的。
這一篇(http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html)有說明。

目標是要查看分析file 標頭的code:

follow 以上說明文件,開啟video file :
av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL);

會將 filename開啟,填入相關資料到pFormatCtx 結構中。
function的最後3個argument 分別代表: fileformat, buffersize, format_parameter。
設為NULL, 0, NULL 以意思是: 用libavformat detect file format, default buffersize。
av_open_input_file -->  av_probe_input_file
av_probe_input_file則是一一呼叫registered codec中的 read_probe( ) function來解析。

所以要找 parse video file的code,就在各codec的 read_probe( ) function。

先找找register_codec 的function - av_register_input_format( ).

呼叫這個function的有.. 都在libavformat 下..很多 file都有..
並不是每個format 都有 probe function.

以 mpegvideo_probe( )來看..


先build一下好了

ffmpeg要從svn 取得,之後,和一般package一樣,
./configure
make
sudo make install
三步驟。
在common.mk 中可以看到library install 的path,在/usr/local/lib
build test program... 試試.


沒有留言:

網誌存檔