---WebCam网络摄像头6 编译WebCam

直接使用天嵌提供的交叉编译器编译WebCam而生成的input_uvc.so output_http.souvc_stream放在micro2440下面可以直接使用--两个开发板几乎没什么不同。。。
而如果要用友善提供的交叉编译器,去编译天嵌的WebCam会发生错误。。。因为编译的时候需要SDL库,而友善的4.3.2没有加入此库。下面是源码树。
http://download.csdn.net/detail/songqqnew/3887473

[root@localhost WebCam]# pwd
/opt/FriendlyArm/mini2440/WebCam
[root@localhost WebCam]# tree
.
`-- mjpg-streamer
    |-- mjpeg-client
    |   |-- bin
    |   |   |-- linux_i386_upx
    |   |   |   `-- viewer
    |   |   `-- win32_upx
    |   |       |-- properties.ini
    |   |       `-- viewer.exe
    |   |-- main.lfm
    |   |-- main.lrs
    |   |-- main.pas
    |   |-- mjpegviewer.lpi
    |   `-- mjpegviewer.lpr
    |-- mjpg-streamer
    |   |-- CHANGELOG
    |   |-- LICENSE
    |   |-- Makefile
    |   |-- README
    |   |-- mjpg_streamer.c
    |   |-- mjpg_streamer.h
    |   |-- plugins
    |   |   |-- input.h
    |   |   |-- input_cmoscamera
    |   |   |   |-- Makefile
    |   |   |   |-- dynctrl.c
    |   |   |   |-- dynctrl.h
    |   |   |   |-- dynctrl.lo
    |   |   |   |-- huffman.h
    |   |   |   |-- input_cmoscamera.so
    |   |   |   |-- input_uvc.c
    |   |   |   |-- jpeg_utils.c
    |   |   |   |-- jpeg_utils.h
    |   |   |   |-- jpeg_utils.lo
    |   |   |   |-- uvc_compat.h
    |   |   |   |-- uvcvideo.h
    |   |   |   |-- v4l2uvc.c
    |   |   |   |-- v4l2uvc.h
    |   |   |   `-- v4l2uvc.lo
    |   |   |-- input_control
    |   |   |   |-- Makefile
    |   |   |   |-- dynctrl.c
    |   |   |   |-- dynctrl.h
    |   |   |   |-- input_uvc.c
    |   |   |   |-- uvc_compat.h
    |   |   |   `-- uvcvideo.h
    |   |   |-- input_file
    |   |   |   |-- Makefile
    |   |   |   |-- input_file.c
    |   |   |   `-- input_file.so
    |   |   |-- input_gspcav1
    |   |   |   |-- Makefile
    |   |   |   |-- encoder.c
    |   |   |   |-- encoder.h
    |   |   |   |-- huffman.c
    |   |   |   |-- huffman.h
    |   |   |   |-- input_gspcav1.c
    |   |   |   |-- jconfig.h
    |   |   |   |-- jdatatype.h
    |   |   |   |-- marker.c
    |   |   |   |-- marker.h
    |   |   |   |-- quant.c
    |   |   |   |-- quant.h
    |   |   |   |-- readme.spcacat
    |   |   |   |-- spcaframe.h
    |   |   |   |-- spcav4l.c
    |   |   |   |-- spcav4l.h
    |   |   |   |-- utils.c
    |   |   |   `-- utils.h
    |   |   |-- input_testpicture
    |   |   |   |-- Makefile
    |   |   |   |-- input_testpicture.c
    |   |   |   |-- pictures
    |   |   |   |   |-- 160x120_1.jpg
    |   |   |   |   |-- 160x120_2.jpg
    |   |   |   |   |-- 320x240_1.jpg
    |   |   |   |   |-- 320x240_2.jpg
    |   |   |   |   |-- 640x480_1.jpg
    |   |   |   |   |-- 640x480_2.jpg
    |   |   |   |   |-- 960x720_1.jpg
    |   |   |   |   `-- 960x720_2.jpg
    |   |   |   `-- testpictures.h
    |   |   |-- input_uvc
    |   |   |   |-- Makefile
    |   |   |   |-- dynctrl.c
    |   |   |   |-- dynctrl.h
    |   |   |   |-- huffman.h
    |   |   |   |-- input_uvc.c
    |   |   |   |-- jpeg_utils.c
    |   |   |   |-- jpeg_utils.h
    |   |   |   |-- uvc_compat.h
    |   |   |   |-- uvcvideo.h
    |   |   |   |-- v4l2uvc.c
    |   |   |   `-- v4l2uvc.h
    |   |   |-- output.h
    |   |   |-- output_autofocus
    |   |   |   |-- Makefile
    |   |   |   |-- output_autofocus.c
    |   |   |   |-- processJPEG_onlyCenter.c
    |   |   |   `-- processJPEG_onlyCenter.h
    |   |   |-- output_file
    |   |   |   |-- Makefile
    |   |   |   |-- examples
    |   |   |   |   |-- change_filename.sh
    |   |   |   |   |-- ftp_upload.sh
    |   |   |   |   `-- show_filename.sh
    |   |   |   `-- output_file.c
    |   |   |-- output_http
    |   |   |   |-- Makefile
    |   |   |   |-- httpd.c
    |   |   |   |-- httpd.h
    |   |   |   `-- output_http.c
    |   |   `-- output_viewer
    |   |       |-- Makefile
    |   |       `-- output_viewer.c
    |   |-- scripts
    |   |   `-- make_deb.sh
    |   |-- start.sh
    |   |-- utils.c
    |   |-- utils.h
    |   `-- www
    |       |-- LICENSE.txt
    |       |-- bodybg.gif
    |       |-- cambozola.jar
    |       |-- control.htm
    |       |-- example.jpg
    |       |-- favicon.ico
    |       |-- favicon.png
    |       |-- fix.css
    |       |-- functions.js
    |       |-- index.html
    |       |-- java.html
    |       |-- java_control.html
    |       |-- java_simple.html
    |       |-- javascript.html
    |       |-- javascript_motiondetection.html
    |       |-- javascript_simple.html
    |       |-- sidebarbg.gif
    |       |-- static.html
    |       |-- static_simple.html
    |       |-- stream.html
    |       |-- stream_simple.html
    |       |-- style.css
    |       `-- videolan.html
    `-- uvc-streamer
        |-- CHANGELOG
        |-- LICENSE
        |-- Makefile
        |-- README
        |-- color.c
        |-- color.h
        |-- color.o
        |-- control.c
        |-- control.h
        |-- control.o
        |-- huffman.h
        |-- utils.c
        |-- utils.h
        |-- utils.o
        |-- uvc_compat.h
        |-- uvc_stream
        |-- uvc_stream.c
        |-- uvc_stream.o
        |-- uvcvideo.h
        |-- v4l2uvc.c
        |-- v4l2uvc.h
        `-- v4l2uvc.o

22 directories, 144 files
[root@localhost WebCam]# 


 
以下所有编译使用友善配的4.3.2编译器
参考天嵌摄像头移植手册
[root@localhost mjpg-streamer]# which arm-linux-gcc
/usr/local/arm/4.3.2/bin/arm-linux-gcc

1.移植SDL库:
http://www.libsdl.org/release/SDL-1.2.13.tar.gz   下载之后考到/opt/FriendlyArm/mini2440/目录下
[root@localhost SDL-1.2.13]# pwd
/opt/FriendlyArm/mini2440/SDL-1.2.13
[root@localhost SDL-1.2.13]# mkdir __install
[root@localhost SDL-1.2.13]# ./configure --prefix=/opt/FriendlyArm/mini2440/SDL-1.2.13/__install --disable-video-dummy --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --target=arm-linux --host=arm-linux  --disable-video-directfb --disable-input-tslib --enable-video-fbcon --disable-video-x11-dgamouse --enable-video-qtopia --disable-video-x11-vm --disable-video-x11-xv --disable-video-x11-xinerama --disable-video-x11-xme --disable-video-x11-xrandr --disable-video-x11-dpms --disable-video-photon --disable-video-cocoa --disable-video-ps2gs   --disable-video-svga --disable-video-vgl  --disable-video-wscons --disable-video-xbios  --disable-video-gem   --disable-video-opengl   --disable-stdio-redirect  --disable-directx  --disable-pulseaudio
[root@localhost SDL-1.2.13]# make 
[root@localhost SDL-1.2.13]# make install
[root@localhost SDL-1.2.13]# cd __install
[root@localhost __install]# cp lib/*  /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/
[root@localhost __install]# cp -rf include/*  /usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/usr/include/

2.
编译uvc-streamer
[root@localhost uvc-streamer]# pwd
/opt/FriendlyArm/mini2440/WebCam/mjpg-streamer/uvc-streamer
[root@localhost uvc-streamer]# make
编译mjpg-streamer,并打包所需文件为bin-song.tgz
[root@localhost mjpg-streamer]# pwd
/opt/FriendlyArm/mini2440/WebCam/mjpg-streamer/mjpg-streamer
[root@localhost mjpg-streamer]# make
[root@localhost mjpg-streamer]# tar cvzf bin-song.tgz mjpg_streamer input_uvc.so input_cmoscamera.so output_http.so www/ ../uvc-streamer/uvc_stream
3.
将bin-song.tgz弄到micro2440上,执行:

[root@FriendlyARM plg]# mkdir bin-song
[root@FriendlyARM plg]# cd bin-song/
[root@FriendlyARM bin-song]# tar xvzf ../bin-song.tgz 
[root@FriendlyARM bin-song]# ls
input_cmoscamera.so  mjpg_streamer        uvc-streamer
input_uvc.so         output_http.so       www

[root@FriendlyARM bin-song]# ./uvc-streamer/uvc_stream 
Using V4L2 device.....: /dev/video0
Resolution............: 640 x 480
frames per second.....: 5
TCP port..............: 8080
motor control TCP port: 8081
zc3xx: probe 2wr ov vga 0x0000
^Cshutdown...

[root@FriendlyARM bin-song]#  ./mjpg_streamer  -i "./input_uvc.so" -o "./output_http.so -w ./www/"   
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
 DBG(mjpg_streamer.c, main(), 374): starting input plugin
 DBG(mjpg_streamer.c, main(), 382): starting 1 output plugin(s)
zc3xx: probe 2wr ov vga 0x0000
^Csetting signal to stop


[root@FriendlyARM bin-song]# ./mjpg_streamer  -i "./input_cmoscamera.so" -o "./output_http.so -w ./www/"             
MJPG Streamer Version.: 2.0
 i: Using CMOS Camera device.: /dev/camera
 i: Desired Resolution: 640 x 512
 i: Frames Per Second.: 5
 i: Format............: YUV
 i: JPEG Quality......: 80
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
 DBG(mjpg_streamer.c, main(), 374): starting input plugin
 DBG(mjpg_streamer.c, main(), 382): starting 1 output plugin(s)
^Csetting signal to stop



posted on 2011-11-27 08:16  _song  阅读(518)  评论(0编辑  收藏  举报