live555 交叉編譯移植到海思開發板


1、首先到它的主頁下載一個源碼包:

http://www.live555.com/liveMedia/public/

我下載的是latest的,具體什么版本還真不清楚

 

2、放到linux目錄下解壓:

root@kubuntu:/home/frank tar zxvf live555-latest.tar.gz  
root@kubuntu:/home/frank# cd live  
root@kubuntu:/home/frank/live#  
 

3、首先嘗試在PC的Linux上編譯:

區別於傳統的源碼包,不是傳統的配置方式,而是通過genMakefiles配對目錄下的config.*文件生成Makefile
root@kubuntu:/home/frank/live# ./genMakefiles linux  
root@kubuntu:/home/frank/live# make  

編譯很順利,然后上網找一個*.264文件放在當前目錄下

執行mediaServer目錄下的live555MediaServer服務器原型

root@kubuntu:/home/frank/live# ./mediaServer/live555MediaServer  
LIVE555 Media Server  
        version 0.75 (LIVE555 Streaming Media library version 2012.11.08).  
Play streams from this server using the URL  
        rtsp://192.168.1.41:8554/<filename>  
where <filename> is a file present in the current directory.  
Each file's type is inferred from its name suffix:  
        ".264" => a H.264 Video Elementary Stream file  
        ".aac" => an AAC Audio (ADTS format) file  
        ".ac3" => an AC-3 Audio file  
        ".amr" => an AMR Audio file  
        ".dv" => a DV Video file  
        ".m4e" => a MPEG-4 Video Elementary Stream file  
        ".mkv" => a Matroska audio+video+(optional)subtitles file  
        ".mp3" => a MPEG-1 or 2 Audio file  
        ".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file  
        ".ts" => a MPEG Transport Stream file  
                (a ".tsx" index file - if present - provides server 'trick play' support)  
        ".wav" => a WAV Audio file  
        ".webm" => a WebM audio(Vorbis)+video(VP8) file  
See http://www.live555.com/mediaServer/ for additional documentation.  
(We use port 8080 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)  
通過VLC可以點播rtsp://192.168.1.41:8554/test.264視頻,

(注意:test.264所在的目錄要和live555MediaServer執行目錄相一致,若test.264放在live目錄下,則需要在live目錄下執行./mediaServer/live555MediaServer)

 

4、交叉編譯

編譯器arm-hisiv100nptl-linux-g++

同理如果通過genMakefiles生成交叉編譯的Makefile,我們需要一個對應的config.*

因此我們復制一個config.hi3518,命令:cp config.armlinux config.hi3518

CROSS_COMPILE?= arm-hisiv100nptl-linux-
COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
C = c
C_COMPILER = $(CROSS_COMPILE)gcc
C_FLAGS = $(COMPILE_OPTS)
CPP = cpp
CPLUSPLUS_COMPILER = $(CROSS_COMPILE)g++
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 -DLOCALE_NOT_USED
OBJ = o
LINK = $(CROSS_COMPILE)g++ -o
LINK_OPTS =
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LIBRARY_LINK = $(CROSS_COMPILE)ar cr
LIBRARY_LINK_OPTS = $(LINK_OPTS)
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
EXE =
然后與在PC上編譯一樣,進行編譯。

root@kubuntu:/home/frank/live# ./genMakefiles hi3518 
root@kubuntu:/home/frank/live# make clean;make  
這里要記得先make clean,否則因為之前在PC上編譯的目標文件沒清楚會導致鏈接失敗。

編譯時會產生一個錯誤

In file included from MPEG4GenericRTPSink.cpp:22:  
include/Locale.hh:47:123: xlocale.h: No such file or directory  
In file included from MPEG4GenericRTPSink.cpp:22:  
include/Locale.hh:62: error: `locale_t' does not name a type  
make[1]: *** [MPEG4GenericRTPSink.o] Error 1  
make[1]: Leaving directory `/home/frank/live/liveMedia'  
make: *** [all] Error 2  

這個是由於海思使用的是uClinux,並沒有xlocale.h這個頭文件,

而live555內部的一個locale模塊調用了(見liveMeida/locale.hh),因此通過編譯選項把他去掉。

修改config.hi3507,在編譯選項上加入-DLOCALE_NOT_USED把此模塊去掉。上面那段是已經去掉的

 再次生成Makefile並編譯

root@kubuntu:/home/frank/live# ./genMakefiles hi3518
root@kubuntu:/home/frank/live# make  

編譯成功!

5 移植到海思開發板上

將mediaServer的live555MediaServer(你可以試一下,在linux系統中打開這個是出錯誤的),通過nfs掛載到開發板上執行。運行后會出現

LIVE555 Media Server-Test frank
version 0.84 (LIVE555 Streaming Media library version 2014.10.07).
Play streams from this server using the URL
rtsp://0.0.0.0/<filename>
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
".264" => a H.264 Video Elementary Stream file
".265" => a H.265 Video Elementary Stream file
".aac" => an AAC Audio (ADTS format) file
".ac3" => an AC-3 Audio file
".amr" => an AMR Audio file
".dv" => a DV Video file
".m4e" => a MPEG-4 Video Elementary Stream file
".mkv" => a Matroska audio+video+(optional)subtitles file
".mp3" => a MPEG-1 or 2 Audio file
".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file
".ogg" or ".ogv" or ".opus" => an Ogg audio and/or video file
".ts" => a MPEG Transport Stream file
(a ".tsx" index file - if present - provides server 'trick play)
".vob" => a VOB (MPEG-2 video with AC-3 audio) file
".wav" => a WAV Audio file
".webm" => a WebM audio(Vorbis)+video(VP8) file
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 80 for optional RTSP-over-HTTP tunneling, or for HT


測試的時候會發現RTSP的地址是0.0.0.0;

在nfs掛載的時候,已經用ifconfig eth0 192.168.0.166 將板子的IP地址設為了192.168.0.166 ,為什么還是0 呢

需要用到route add default gw 192.168.0.1,這個192.168.0.1是網關的IP地址,也就是你的路由器的IP地址,命令意思的是添加一條默認網關命令,將所有的數據包都轉發到192.168.0.1;注意開發板上是運行./live555MediaServer,發現時沒有端口號的,直接rtsp://192.168.0.166 就可以看到想要的結果,預祝成功。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM