一.openssl交叉编译
1.下载
版本不要太高,刚开始版本高了,有些函数取消了,链接不上
使用1.0.1f即可
2.编译成共享库
./config no-asm shared --prefix=/usr/local/arm/openssl
3.修改Makefile
CROSS_COMPILE=arm-none-linux-gnueabi-
4.make
make install
 
二.zlib交叉编译
1.下载
2../configure --prefix=/usr/local/arm/zlib
3.修改Makefile
gcc、ar的地方换成交叉编译器的
 
三.rtmpdump 交叉编译
1.下载
git clone git://git.ffmpeg.org/rtmpdump
2.编译
直接修改makefile,需要修改两个makefile
prefix=/usr/local/arm/librtmp
CROSS_COMPILE=arm-none-linux-gnueabi-
XLDFLAGS=-L/usr/local/arm/openssl/lib -L/usr/local/arm/zlib/lib
XCFLAGS=-I/usr/local/arm/openssl/include -I/usr/local/arm/zlib/include
注意:inlude里不要有文件夹,头文件直接放在include下
3.make
cannot find -lz可能会出现这种错误,产生这种错误是在编译客户程序才出现,此时librtmp库已经生成,直接可以使用.so库
 
 

测试代码
/*
* main.cpp
*
* Created on: Jan 9, 2017
* Author: tla001
*/
extern "C"{
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<netdb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h> #include "rtmp.h"
#include "log.h"
} int printfAVal(const AVal al)
{
int i = ;
for(i = ;i <al.av_len;i++)
printf("%c",al.av_val[i]);
printf("\n");
} const char RTMPProtocolStringsLower_1[][] = {
"rtmp",
"rtmpt",
"rtmpe",
"rtmpte",
"rtmps",
"rtmpts",
"",
"",
"rtmfp"
}; #define DEF_TIMEOUT 30 /* seconds */ int main(int argc,char * argv[])
{
int Ret = -;
RTMP my_rtmp;
AVal Host, App, Playpath;
unsigned int Port = ;
int Protocol = RTMP_PROTOCOL_UNDEFINED; AVal sockshost = { , };
AVal tcUrl = { , };
AVal swfUrl = { , };
AVal pageUrl = { , };
AVal auth = { , };
AVal swfSHA256Hash = { , };
AVal flashVer = { , };
AVal subscribepath = { , };
AVal usherToken = { , };
uint32_t swfSize = ;
uint32_t dSeek = ; // seek position in resume mode, 0 otherwise
int bLiveStream = FALSE; // is it a live stream? then we can't seek/resume
uint32_t dStopOffset = ;
long int timeout = DEF_TIMEOUT; // timeout connection after 120 seconds int fd = ; char *input_rtmp_url = NULL;
char RTMP_RUL[] = "rtmp://live.hkstv.hk.lxdns.com/live/hks";
if(argv[]==NULL){
input_rtmp_url = RTMP_RUL;
}else{
input_rtmp_url = argv[];
} printf("run %s\n",(char*)argv[]);
printf("input_rtmp_url == %s\n",input_rtmp_url); RTMP_Init(&my_rtmp); //InitSockets(); Ret = RTMP_ParseURL(input_rtmp_url, &Protocol, &Host, &Port,
&Playpath, &App);
if(Ret == TRUE){
printfAVal(Host);
printfAVal(App);
printfAVal(Playpath);
printf("%d\n",Port);
}else{
printf("url(%s) con`t parsed!\n",input_rtmp_url);\
goto EXIT;
} if (Port == )
{
if (Protocol & RTMP_FEATURE_SSL)
Port = ;
else if (Protocol & RTMP_FEATURE_HTTP)
Port = ;
else
Port = ;
} if (tcUrl.av_len == )
{
tcUrl.av_len = strlen(RTMPProtocolStringsLower_1[Protocol]) +
Host.av_len + App.av_len + sizeof("://:65535/");
tcUrl.av_val = (char *) malloc(tcUrl.av_len);
if (!tcUrl.av_val)
return -;
tcUrl.av_len = snprintf(tcUrl.av_val, tcUrl.av_len, "%s://%.*s:%d/%.*s",
RTMPProtocolStringsLower_1[Protocol], Host.av_len,
Host.av_val,Port, App.av_len, App.av_val);
} RTMP_SetupStream(&my_rtmp,
Protocol,
&Host,
Port,
&sockshost,
&Playpath,
&tcUrl,
&swfUrl,
&pageUrl,
&App,
&auth,
&swfSHA256Hash,
swfSize,
&flashVer,
&subscribepath,
&usherToken,
dSeek,
dStopOffset,bLiveStream, timeout); RTMP_Connect(&my_rtmp,NULL); RTMP_ConnectStream(&my_rtmp,dSeek); fd = open("test.flv",O_CREAT|O_RDWR); if(fd){
char buf[*] = {};
while(){
memset(buf,,*);
Ret = RTMP_Read(&my_rtmp,buf,*);
printf("read size %d\n",Ret);
if(Ret <= )
break;
else{
write(fd,buf,Ret);
}
}
}
EXIT:
if(fd)
close(fd);
RTMP_Close(&my_rtmp);
return ;
}
 
 

imx6移植librtmp的更多相关文章

  1. IMX6移植htop

    top命令查看CPU利用率并不是很方便,因此打算移植htop到imx6上,主要包括以下几个步骤: - 资源下载 htop 下载http://hisham.hm/htop/releases/1.0.1/ ...

  2. imx6移植ffmpeg2.3

    yasm ./configure --enable-shared --prefix=/usr/local/arm/yasm --host=arm-linux 修改Makefile CC=arm-non ...

  3. ffmpeg relocation error

    在向imx6移植ffmpeg后,一般的编解码操作没有问题,但是当从摄像头录视频时, ffmpeg -f video4linux2 -s 640*480 -r 10 -i /dev/video0 tes ...

  4. qt5.5.0成功移植到IMX6中

    前阵子移植qt4.8.5到板子上成功后,总想着qt4有点旧,于是就想着玩qt5,之前都是在Windows7上写qt,写了个游戏,感觉还不错,但毕竟不能只能在PC机上跑,现在由于项目需要,要将qt搞到I ...

  5. [IMX6]Android6.0移植和分析

    0. 知识点 中断(设备树) [IMX6]设备树分析--dts 1. 编译 Android6.0内核移植(1):分析编译日志 Android6.0内核移植(2):kernel编译内核 单独烧录kern ...

  6. Qt5.5.1移植到freescale imx6

    一.环境 HOST:ubuntu12.04-LTS Embedded:freescale imx6 linux-3.0.35 CROSS_COMPILE:freescale提供的gcc-4.6.2-g ...

  7. 【转载】tslib移植_freescale imx6

    本文来自网络:http://blog.csdn.net/xishuang_gongzi/article/details/49422879 环境:host:Ubuntu12.04target:frees ...

  8. 移植rtmpdump(librtmp)到android

    编译环境:(rtmpdump-master.zip和Polar SSL版本已经打包上传,具体路径在http://download.csdn.net/detail/gyley2/5721061) win ...

  9. imx6 yocto移植 环境搭建

    系统:ubuntu14.04 LTS 切换软件下载源,确保下载资源是最快. 安装必要软件工具: ~$ apt-get install vim ~$ apt-get install openssh-se ...

随机推荐

  1. windows 7 X64 提示“com surrogate 已停止工作”的解决方案

    C:\Windows\SysWOW64\dllhost.exe 把以上文件添加至“数据执行保护”.

  2. shiro无法进入授权的方法org.crazycake.shiro.exception.PrincipalInstanceException: class java.util.HashMap must has getter for field: id

    rg.crazycake.shiro.exception.PrincipalInstanceException: class java.util.HashMap must has getter for ...

  3. UVA1363 - Joseph's Problem(数学,迷之优化)

    题意:给出n和k,1≤n,k≤1e9,计算 切入点是k/i 和 k/(i+1)差距不大.令pi = k/i, ri = k%i.如果pi+1 == pi,那么ri+1 == k - pi(i+1) = ...

  4. Redis(5.0.0)持久化AOF和 RDB 结合源码分析

    主要是挖个坑.候补(代码还没看完..) https://github.com/antirez/redis/tree/5.0 一.Redis保存持久化文件 二.Redis启动加载持久化文件 src/se ...

  5. 2.安装VS Code

    1 打开网站 https://www.visualstudio.com/zh-hans/ 2. 安装 3.可以在程序目录命令行下 code .    用vscode 打开程序 4.下载插件 复制 ex ...

  6. MAC之tar解压与压缩gz打包命令

    tar [-cxtzjvfpPN] 文件与目录 ....参数:-c :建立一个压缩文件的参数指令(create 的意思):-x :解开一个压缩文件的参数指令!-t :查看 tarfile 里面的文件! ...

  7. DeepLearning tutorial(3)MLP多层感知机原理简介+代码详解

    本文介绍多层感知机算法,特别是详细解读其代码实现,基于python theano,代码来自:Multilayer Perceptron,如果你想详细了解多层感知机算法,可以参考:UFLDL教程,或者参 ...

  8. java设计模式——单例模式(三)

    容器单例模式 之前学习Structs2,Spring框架时,经常会听到单例,多例.虽然这与单例模式不太一样,但是都很类似.在程序运行的时候,就加载所有的实例,然后用的时候直接取出 看下面代码: /** ...

  9. BeyondCompare:如何之比较文件内容的不同?

    问题描述: 在使用beyond compare比较文件的时候,常会有很多不同,但是点击打开后,发现内容没有不同.这个是因为工具把文件的日期.大小等非内容因素也比较了进去. 解决方法: 点击“会话” - ...

  10. Oracle 配置文件目录

    Oracle 配置文件目录 ① 在oracle安装目录下,找D:\oracle\product\10.2.0\client_1\NETWORK\ADMIN中的tnsnames.ora文件,找到之后,配 ...