写博的目的是为了从杂乱无章的学习中理出头绪来。至少作个有用的资料库备份。
回头看,过去这几年都学的有点盲目,没有重点。怎么对什么都有兴趣,居然还花了三分之一的时间去看经济金融。。。。
眼看又是一个小的恶性循环了:haartraining,hmm,ffmpeg, SDL, xcode....必须煞住这股歪风!
牢骚发完,备份点有用的咚咚
终于开始上手mac下的开发了。除了HelloWorld,还没有真正用到Xcode,不过。。。实在实在是喜欢它的界面,各种“古怪”的加亮显示,highlights,。。。。
1。 MacPro上找不到#键,囧。 搜到这个,打印出来背,嘿嘿
Complete Xcode Keyboard Shortcut List
http://cocoasamurai.blogspot.com/2008/02/complete-xcode-keyboard-shortcut-list.html
2. Opencv只认avi格式的视频,简单试了下configure enable ffmpeg的opencv又没成功,就是找不着装好的ffmpeg。另外反正也是调用ffmpeg,不如直接include两个库算了,唯一的问题就是 AVFrame和iplimage的转换。碰巧找到一个现成的例子,还是opencv+ffmpeg+SDL的(连接暂时找不到了)。方便快捷起见,先注掉所有sdl 部分,一通捣鼓后编译通过。
i) img_convert(...); 应该在新版中不用了,ffmpeg网站上的教程中David Hoerl 的是最新的(http://web.me.com/dhoerl/Home/Tech_Blog/Entries/2009/1/22_Revised_avcodec_sample.c.html), 也提到“a key conversion routine, img_convert, was dropped from libavcodec a while ago”
ii)例子中有个小问题。AVFrame中像素应该是RGB顺序,而iplimage中是BGR的,改一下就好了
for(n = 0; n < 3*pCodecCtx->width; n++){
ptr2[n] = ptr1[n];
}
=======>>
for(n = 0; n < pCodecCtx->width; n++){
ptr2[n*3] = ptr1[n*3 + 2];
ptr2[n*3 + 1] = ptr1[n*3 + 1];
ptr2[n*3 + 2] = ptr1[n*3];
}
3。仅仅uncommnet #include <SDL/SDL.h>,遇到问题:
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
这个帖子解释的很详细了
Undefined symbols: main... on OS X (Leopard)
http://www.nabble.com/Undefined-symbols:-main...-on-OS-X-(Leopard)-td22327705.html
in short, the trick is to use the output of 'sdl-config --cflags --libs' in the
gcc command line
4。 一直没整明白Mac下的framework的概念。上面的thread中正好有很通俗的解释
A framework is just the way on MacOSX to bundle a library (or multiple
libraries) together with headers, resources and other stuff.
With -framework, you link to a whole framework (so to all including
libraries and you also have the header search paths), with -l, you
just link to a single lib.
It is the standard way on MacOSX to bundle libraries together to such
frameworks which ideally don't have further dependencies and can be
bundled also into an app bundle.
The SDL library in the SDL framework which can be downloaded is though
much different from SDL if you installed it yourself the Unix way to /
usr/local.
In short: The SDL framework is esp. prepared for running nativly on
MacOSX and for packaging your application to ship with it. And it is
working standalone and has no further dependencies. And it is a
Universal Binary.
You cannot ship your game if it is linked against the /usr/local/ SDL
lib.