Mjpg_Streamer 的移植

1. 移植mjpg-streamer

 

    a.1 移植libjpeg

 

1         tar zxf libjpeg-turbo-1.2.1.tar.gz 
2         cd libjpeg-turbo-1.2.1 
3         ./configure --host=arm-linux --prefix=/work/projects1/mjpeg-stream/libjpeg-turbo-1.2.1/tmp 
4         make 
5         make install 
6         cd tmp/lib 
7         cp *so* /work/nfs_root/fs_mini_mdev_new/lib/ -d 

 


       
    注意:文件体统   
        视频使用的是fs_mini_mdev_new_auto_wifi_ap.tar.bz2,因为自己制作过文件系统,暂时使用的是自己的。
   
 

   a.2 移植mjpg-streamer

 

            tar zxf mjpg-streamer-r63.tar.gz
            cd mjpg-streamer-r63
           
            a.2.1修改所有的Makefile
            vim Makefile            //顶层
                 将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc

            cd plugins/input_gspcav1
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
           
            cd plugins/input_testpicture
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
                    
            cd /plugins/input_uv
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
            cd plugins/output_autofocus
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
            cd plugins/output_file
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
            cd plugins/output_http
            vim Makefile
                将:
                     CC = gcc
                 改为:
                     CC = arm-linux-gcc
             也就是将plugins 目录下面的所有的子目录的Makefile 全部进行修改
       
       

a.2.2 plugins/input_uvc 里面  修改


                cd plugins/input_uvc
                vim Makefile
                将:
                    CFLAGS += -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC
                修改为:
                    CFLAGS += -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -I /work/projects1/mjpeg-stream/libjpeg-turbo-1.2.1/tmp/include
                                        添加的这个是编译libjpeg 库生成的头文件。
                将:
                    input_uvc.so: $(OTHER_HEADERS) input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo
                                    $(CC) $(CFLAGS) -ljpeg -o $@ input_uvc.c v4l2uvc.lo
                                    jpeg_utils.lo dynctrl.lo
                修改为:
                input_uvc.so: $(OTHER_HEADERS) input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo
                    $(CC) $(CFLAGS) -ljpeg -L /work/projects1/mjpeg-stream/libjpeg-turbo-1.2.1/tmp/lib
                    -o $@ input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo
                        //添加了-L /work/projects1/mjpeg-stream/libjpeg-turbo-1.2.1/tmp/lib  指明库文件的位置

                回到顶层目录:make                        生成mjpg_streamer  这个应用程序和很多的.so 文件
               
                cp mjpg_streamer /work/nfs_root/fs_mini_mdev_new/bin/
                cp *so* /work/nfs_root/fs_mini_mdev_new/lib/ -d
 

  a.3  使用


                内核:
                    1.添加UVC
                    cp config_ok  .config
                    make menuconfig
                        <*> Multimedia support  ---> 
                             <*>   Video For Linux
                             [*]   Video capture adapters (NEW)  ---> 
                             [*]   V4L USB devices (NEW)  --->
                                     <*>   USB Video Class (UVC) 
                    执行: make uImage
                // 因为使用的是百问网的制作的USB 摄像头,所以,必须按照第二课1.1.9 视频修改UVC 驱动,修改完在make uImage
                        将修改的好的uvc_video.c 和uvc_driver.c 拷贝到/linux-3.4.2/drivers/media/video/uvc 替换掉
                // 因为百问网的摄像头的特殊性才需要修改,否则是不用修改的
               
                // 配置内核,使其支持 USB 总线驱动,如下
                    Device Drivers --->
                        [*] USB support --->
                        {*} Support for Host-side USB
                        [*] USB device filesystem (DEPRECATED)
                        [*] USB device class-devices (DEPRECATED)
                        <*> OHCI HCD support
                        <*> USB Mass Storage support
                       
                    [*] HID Devices --->
                        {*} Generic HID support
                        [*] /dev/hidraw raw HID device support
                       
                    SCSI device support --->
                    <*> SCSI device support
                    [*] legacy /proc/scsi/ support
                    <*> SCSI disk support
                    <*> SCSI tape support
                   
           

2.支持AR2917WIFI的:


                    make menuconfig
                  Symbol: ATH9K_HTC [=n]                                                                      
                  Type  : tristate                                                                           
                  Prompt: Atheros HTC based wireless cards support                                           
                    Defined at drivers/net/wireless/ath/ath9k/Kconfig:100                                    
                    Depends on: NETDEVICES [=y] && WLAN [=y] && ATH_COMMON [=n] && USB [=y] && MAC80211 [=m] 
                    Location:                                                                                
                      -> Device Drivers                                                                      
                        -> Network device support (NETDEVICES [=y])                                          
                          -> Wireless LAN (WLAN [=y])                                                        
                            -> Atheros Wireless Cards (ATH_COMMON [=n])
                    根据上面的依赖,还需要对ATH_COMMON 和 MAC80211 进行设置
                -> Networking support (NET [=y])                                                         
                -> Wireless (WIRELESS [=y]) 
                              <*>cfg80211 - wireless configuration API
                              <*>Generic IEEE 802.11 Networking Stack (mac80211)
                         
               -> Device Drivers                                                                        
             -> Network device support (NETDEVICES [=y])                                            
               -> Wireless LAN (WLAN [=y])                                                          
                 -> Atheros Wireless Cards (ATH_COMMON [=y]) 
                                  <*>   Atheros HTC based wireless cards support
            3.添加WIFI 固件
                mkdir  /work/nfs_root/fs_mini_mdev_new/lib/firmware
                cp htc_9271.fw /work/nfs_root/fs_mini_mdev_new/lib/firmware
       
        文件系统:
                    使用的是制作好的,包含众多WIFI应用程序的fs_mini_mdev_new_auto_wifi_ap.tar.bz2
        运行:   
                二合一摄像头
                mjpg_streamer -i "input_uvc.so -f 10 -r 320*240" -o "output_http.so -w www"
               
                一般摄像头
                mjpg_streamer -i "input_uvc.so -f 10 -r 320*240 -y" -o "output_http.so -w www"
               
                二合一摄像头
                mjpg_streamer -i "input_uvc.so -f 10 -r 640*480" -o "output_http.so -w www"
               
                一般摄像头
                mjpg_streamer -i "input_uvc.so -f 10 -r 320*240 -y" -o "output_http.so -w www"
       
       
        在火狐浏览器上面执行:   
            http://202.193.53.83:8080/?action=stream
                        // 谷歌、360急速浏览器都是失败的,
                                    
                        
        mjpg_streamer -i "input_uvc.so -f 10 -r 320*240 -y" -o "output_http.so -w www"
            -i : 指定输入的插件。可见指定了input_uvc.so 这个插件,作为输入的驱动。因为我们使用的是UVC摄像头。                   
            -o :指定输出的插件。    output_http.so这个插件。
            ---------------------------------------------------------------
             Help for input plugin..: UVC webcam grabber
             ---------------------------------------------------------------
             The following parameters can be passed to this plugin:
            
             [-d | --device ].......: video device to open (your camera)
             [-r | --resolution ]...: the resolution of the video device,
                                      can be one of the following strings:
                                      QSIF QCIF CGA QVGA CIF VGA
                                      SVGA XGA SXGA
                                      or a custom value like the following
                                      example: 640x480
             [-f | --fps ]..........: frames per second
             [-y | --yuv ]..........: enable YUYV format and disable MJPEG mode
             [-q | --quality ]......: JPEG compression quality in percent
                                      (activates YUYV format, disables MJPEG)
             [-m | --minimum_size ].: drop frames smaller then this limit, useful
                                      if the webcam produces small-sized garbage frames
                                      may happen under low light conditions
             [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
             [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave
                                      it up to the driver using the value "auto"

posted @ 2015-10-28 22:21  qxj511  阅读(553)  评论(0编辑  收藏  举报