live555交叉編譯RV1126

live555需要openssl,首先配置openssl

下載openssl-1.1.1v.tar.gz

進入解壓後的文件夾,命令行配置

./Configure no-asm linux-armv4 --prefix=/home/alientek/FangTest/openssl-1.1.1v/openssl_install --cross-compile-prefix=arm-linux-gnueabihf-

--prefix=後接自己想設置的安裝路徑,因爲本人用的是某點原子的開發板的系統和交叉編譯器arm-linux-gnueabihf-

隨後設置下編譯環境

export PATH=$PATH:/opt/atk-dlrv1126-toolchain/usr/bin

然後開始編譯吧

make

make install

之後安裝的庫存在與openssl_install文件夾中了.

下載live555live555-latest.tar.gz,把openssl_install文件夾拷貝進live,修改名字爲openssl,

修改config.armlinux

CROSS_COMPILE?=        arm-linux-gnueabihf-
COMPILE_OPTS =        $(INCLUDES) -I/home/alientek/FangTest/live/openssl/include/openssl -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DNO_STD_LIB
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
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 = -L/home/alientek/FangTest/live/openssl/lib -lssl -lcrypto
LIBS_FOR_GUI_APPLICATION =
EXE =

修改完成,命令行  ./genMakefiles armlinux

export PATH=$PATH:/opt/atk-dlrv1126-toolchain/usr/bin

make

編譯後報錯,

include/TLSState.hh:34:10: 致命错误: openssl/ssl.h:没有那个文件或目录
 #include <openssl/ssl.h>

是livemedia文件夾下的include文件夹的TLSState.hh,將/live/openssl/include/下的openssl拷贝过去了/live/liveMedia/include/

make clean

make

交叉編譯通過,先做一個RTSP服務器推流的程序驗證一下

直接在/live/testProgs/testOnDemandRTSPServer.cpp上修改


#include "liveMedia.hh"

#include "BasicUsageEnvironment.hh"
#include "announceURL.hh"
UsageEnvironment* env;

// To make the second and subsequent client for each stream reuse the same
// input stream as the first client (rather than playing the file from the
// start for each client), change the following "False" to "True":
Boolean reuseFirstSource = False;

// To stream *only* MPEG-1 or 2 video "I" frames
// (e.g., to reduce network bandwidth),
// change the following "False" to "True":
Boolean iFramesOnly = False;

static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms,
               char const* streamName, char const* inputFileName); // forward

static char newDemuxWatchVariable;

static MatroskaFileServerDemux* matroskaDemux;
static void onMatroskaDemuxCreation(MatroskaFileServerDemux* newDemux, void* /*clientData*/) {
  matroskaDemux = newDemux;
  newDemuxWatchVariable = 1;
}

static OggFileServerDemux* oggDemux;
static void onOggDemuxCreation(OggFileServerDemux* newDemux, void* /*clientData*/) {
  oggDemux = newDemux;
  newDemuxWatchVariable = 1;
}

static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms,
               char const* streamName, char const* inputFileName) {
  UsageEnvironment& env = rtspServer->envir();

  env << "\n\"" << streamName << "\" stream, from the file \""
      << inputFileName << "\"\n";
  announceURL(rtspServer, sms);
}


int main(int argc, char** argv) {
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);

  UserAuthenticationDatabase* authDB = NULL;


  // Create the RTSP server.  Try first with the default port number (554),
  // and then with the alternative port number (8554):
  RTSPServer* rtspServer;
  portNumBits rtspServerPortNum = 554;
  rtspServer = RTSPServer::createNew(*env, rtspServerPortNum, authDB);
  if (rtspServer == NULL) {
    rtspServerPortNum = 8554;
    rtspServer = RTSPServer::createNew(*env, rtspServerPortNum, authDB);
  }
  if (rtspServer == NULL) {
    *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
    exit(1);
  }

  char const* descriptionString = "Session streamed by \"testOnDemandRTSPServer\"";


  // A H.264 video elementary stream:
  char const* streamName = "h264";
  char const* inputFileName = "test.264";
  ServerMediaSession* sms = ServerMediaSession::createNew(*env, streamName, streamName, descriptionString);
  sms->addSubsession(H264VideoFileServerMediaSubsession::createNew(*env, inputFileName, reuseFirstSource));
  rtspServer->addServerMediaSession(sms);


  announceStream(rtspServer, sms, streamName, inputFileName);
 

  env->taskScheduler().doEventLoop(); // does not return

  return 0; // only to prevent compiler warning

}

編譯後,拷貝執行程序至RV1126,在同網絡下的另一臺PC上使用vlc播放器,代開網絡川流,輸入RTSP地址鏈接,開始測試.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值