iOS之PJSIP的编写翻译与简短利用www.weide1946.com

2019-09-17 07:45 来源:未知

公司要做网络通话及网络视频,初试,希望各位多多指点,有做过的希望联系一下我,有些不懂得地方还望指教。首先先谈一下PJSIP的编译,及在编译中我所遇到的问题。

1.生成config_site.h文件

为什么打出的静态库要支持这么多架构?

  1. 去官网下载

  2. 在pjlib/include/pj/目录下,建立一个config_site.h的文件

    1.1.引入头文件

看看这个文章:

cd /Users/eleccomm/Downloads/pjproject-2.6/pjlib/include/pj

    #include 

里面有详细的说明,打出所有库命令如下,因为很容易错,所以我就全部记录下来,以供提醒

vi config_site.h

    1.2.添加宏

这里有参考一位大神写的文章,不过他那个写的比较早没有arm64架构的,我在这里补充一下

根据官方说明文档,我们的文件内容定义如下:

    #define PJ_CONFIG_IPHONE       1

大神文章地址:

#define PJ_CONFIG_IPHONE 1

    #define PJMEDIA_HAS_VIDEO      1 

  1. Ogg-i386的库(模拟器)

#include <pj/config_site_sample.h>

    1.3 添加第三方.a 文件,到 third_party 文件夹内

./configure -prefix=/Users/lenkeng/Documents/speex/libogg-1.3.3/i386 -host=i386-apple-darwin -build=x86_64-apple-darwin16.7.0 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/"

对于小白可能不太熟悉怎样终端插入,按i开始插入内容,输入完成后Esc退出插入,输入:wq回车即可退出编辑状态,然后起还到主目录下,即包含pjlib、pjlib-util、pjmedia、pjnath的目录下

    (openh264,opus1.1.5)

make

  1. 编译静态库

2.开始编译

make install

i386,依次执行下面三行:

    2.1. cd到主目录.

make clean(一定要clean,不然后面编译的都是第一次的编译的内容)

export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer

    2.2. 设置iOS最小版本(openh264 =文件路径   opus=文件路径)

2.ogg-armv6库(无用)

ARCH="-arch i386" CFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" ./configure-iphone

    2.2.1 (armv7)

  1. Ogg-armv7库

make dep && make clean && make

export MIN_IOS="-miphoneos-version-min=8.0"

./configure -prefix=/Users/lenkeng/Documents/speex/libogg-1.3.3/armv7 -host=armv7-apple-darwin -build=x86_64-apple-darwin16.7.0 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

成功后,模拟器编译好的静态库会存在于

./configure-iphone --with-openh264=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/openh264 --with-opus=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/opus1.1.5 

make

pjlib/lib

make dep && make clean && make 

make install

pjlib-util/lib

2.2.2(arm64)

make clean

pjmedia/lib

export MIN_IOS="-miphoneos-version-min=8.0"

  1. Ogg-armv7s库

pjnath/lib

ARCH="-arch arm64" ./configure-iphone --with-openh264=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/openh264 --with-opus=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/opus1.1.5

./configure -prefix=/Users/lenkeng/Documents/speex/libogg-1.3.3/armv7s -host=armv7s-apple-darwin -build=x86_64-apple-darwin16.7.0 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

pjsip/lib

make dep && make clean && make 

make

third_party/lib

2.2.3(armv7s)

make install

armv7,关闭刚刚的终端,重新回到主目录,依次执行以下命令:

export MIN_IOS="-miphoneos-version-min=8.0"

make clean

ARCH='-arch armv7' ./configure-iphone

ARCH='-arch armv7s' ./configure-iphone --with-openh264=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/openh264 --with-opus=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/opus1.1.5   

  1. Ogg-arm64库(所有的库必须支持64位系统)

make dep && make clean && make

make dep && make clean && make 

./configure -prefix=/Users/lenkeng/Documents/speex/libogg-1.3.3/arm64 -host=arm-apple-darwin -build=x86_64-apple-darwin16.7.0 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

armv7s直接执行以下命令:

2.2.4 (i386)

make

ARCH='-arch armv7s' ./configure-iphone

export MIN_IOS="-miphoneos-version-min=8.0"

make install

make dep && make clean && make

export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer

make clean

arm64执行以下命令

ARCH="-arch i386" CFLAGS="-O2 -m32 -mios-simulator-version-min=8.0" LDFLAGS="-O2 -m32 -mios-simulator-version-min=8.0" ./configure-iphone --with-openh264=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/openh264 --with-opus=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/opus1.1.5   

7.speex-i386库(模拟器)

ARCH='-arch arm64' ./configure-iphone

make dep && make clean && make 

./configure -prefix=/Users/lenkeng/Documents/speex/speex-1.2rc1/i386 -host=i386-apple-darwin -disable-shared -enable-static -disable-oggtest -disable-fixed-point -enable-float-api -build=x86_64-apple-darwin16.7.0 -with-ogg=/Users/lenkeng/Document/speex/libogg-1.3.3/i386 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch i386 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.1.sdk/"

make dep && make clean && make

2.2.5. (x86_64)

make

也可以这样编译静态库回到主目录,创建一个文件夹

export MIN_IOS="-miphoneos-version-min=8.0"

make install

mkdir sip

export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer

make clean

编译静态库armv7

ARCH="-arch x86_64" CFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=8.0" ./configure-iphone --with-openh264=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/openh264 --with-opus=/Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/opus1.1.5

8.speex-armv6(无用)

sudo ARCH='-arch armv7' ./configure-iphone --prefix=/Users/eleccomm/Downloads/pjproject-2.6/sip/armv7

make dep && make clean && make 

  1. Speex-armv7库

make dep && make clean && make

3.合并静态库

./configure -prefix=/Users/lenkeng/Documents/speex/speex-1.2rc1/armv7 -host=armv7-apple-darwin -disable-shared -enable-static -disable-oggtest -disable-fixed-point -enable-float-api -build=x86_64-apple-darwin16.7.0 -with-ogg=/Users/lenkeng/Document/speex/libogg-1.3.3/armv7 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch armv7 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

make install

3.1 pjlib(1)

make

armv7s

路径:pj2.7/pjlib/lib

make install

sudo ARCH='-arch armv7s' ./configure-iphone --prefix=/Users/eleccomm/Downloads/pjproject-2.6/sip/armv7s

libpj-armv7-apple-darwin_ios.a   libpj-arm64-apple-darwin_ios.a   libpj-armv7s-apple-darwin_ios.a   libpj-i386-apple-darwin_ios.a   libpj-x86_64-apple-darwin_ios.a = libpj.a

make clean

make dep && make clean && make

命令:

  1. Speex-armv7s库

make install

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/pjlib (备注 直接进入到生成新的库目录)

./configure -prefix=/Users/lenkeng/Documents/speex/speex-1.2rc1/armv7s -host=armv7s-apple-darwin -disable-shared -enable-static -disable-oggtest -disable-fixed-point -enable-float-api -build=x86_64-apple-darwin16.7.0 -with-ogg=/Users/lenkeng/Document/speex/libogg-1.3.3/armv7s CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch armv7s -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

arm64

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib/lib/libpj-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib/lib/libpj-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib/lib/libpj-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib/lib/libpj-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib/lib/libpj-x86_64-apple-darwin_ios.a -output libpj.a

make

sudo ARCH='-arch arm64' ./configure-iphone --prefix=/Users/eleccomm/Downloads/pjproject-2.6/sip/arm64

移动到lib/pjlib文件夹下

make install

make dep && make clean && make

3.2 pjlib-util(2)

make clean

make install

路径:pj2.7/pjlib-util/lib

  1. Speex-arm64库(ios后期必须要64位)

编译模拟器库的时候需要先在主目录下的configure-iphone中添加几行代码

命令:

./configure -prefix=/Users/lenkeng/Documents/speex/speex-1.2rc1/arm64 -host=arm-apple-darwin -disable-shared -enable-static -disable-oggtest -disable-fixed-point -enable-float-api -build=x86_64-apple-darwin16.7.0 -with-ogg=/Users/lenkeng/Document/speex/libogg-1.3.3/arm64 CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -std=c99 -arch arm64 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk"

vim configure-iphone

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/pjlib-util (备注 直接进入到生成新的库目录)

make

在第一个if前面添加上如是代码:

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib-util/lib/libpjlib-util-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib-util/lib/libpjlib-util-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib-util/lib/libpjlib-util-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib-util/lib/libpjlib-util-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjlib-util/lib/libpjlib-util-x86_64-apple-darwin_ios.a -output libpjlib-util.a

make install

if [ "$ARCH" = "-arch x86_64" ]; then DEVPATH="/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" echo "$F: Simulator 64bit, using ${DEVPATH}" fi

3.3 pjmedia(5)

make clean

if [ "$ARCH" = "-arch i386" ]; then DEVPATH="/Applications/XCode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" echo "$F: Simulator 32bit, using ${DEVPATH}" fi

路径:pj2.7/pjmedia/lib

11.合并libogg

i386

命令:

cd 到 libogg-1.3.3 文件夹下建立OutPut_A(mkdir)文件夹

sudo ARCH="-arch i386" CFLAGS="-O2 -m64 -mios-simulator-version-min=7.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=7.0" ./configure-iphone --prefix=/Users/eleccomm/Downloads/pjproject-2.6/sip/x86

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/pjmedia (备注 直接进入到生成新的库目录)

lipo -create i386/lib/libogg.a armv7/lib/libogg.a armv7s/lib/libogg.a arm64/lib/libogg.a -output OutPut_A/libogg.a

make dep && make clean && make

3.3.1 libpjmedia.a

12.合并speex的两个库

make install

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-x86_64-apple-darwin_ios.a -output libpjmedia.a

在speex-1.2rc1建立OutPut_A(mkdir)文件夹:

x64

3.3.2 libpjmedia-audiodev.a

cd Desktop/speexLibrary/speex-1.2rc1/

sudo ARCH="-arch x86_64" CFLAGS="-O2 -m64 -mios-simulator-version-min=7.0" LDFLAGS="-O2 -m64 -mios-simulator-version-min=7.0" ./configure-iphone --prefix=/Users/eleccomm/Downloads/pjproject-2.6/sip/x64

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-audiodev-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-audiodev-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-audiodev-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-audiodev-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-audiodev-x86_64-apple-darwin_ios.a -output libpjmedia-audiodev.a

不带arm6:

make dep && make clean && make

3.3.3 libpjmedia-codec.a

lipo -create i386/lib/libspeex.a armv7/lib/libspeex.a armv7s/lib/libspeex.a arm64/lib/libspeex.a -output OutPut_A/libspeex.a

make install

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-codec-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-codec-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-codec-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-codec-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-codec-x86_64-apple-darwin_ios.a -output libpjmedia-codec.a

lipo -create i386/lib/libspeexdsp.a armv7/lib/libspeexdsp.a armv7s/lib/libspeexdsp.a arm64/lib/libspeexdsp.a -output OutPut_A/libspeexdsp.a

  1. 合并静态库

3.3.4 libpjmedia-videodev.a

通过lipo -info命令可以查看.a文件支持的架构

mkdir sip/all

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-videodev-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-videodev-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-videodev-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-videodev-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjmedia-videodev-x86_64-apple-darwin_ios.a -output libpjmedia-videodev.a

lipo -info libogg.a

mkdir sip/all/lib

3.3.5  libpjsdp.a

lipo -info libspeex.a

cd /Users/eleccomm/Downloads/pjproject-2.6/sip

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjsdp-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjsdp-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjsdp-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjsdp-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjmedia/lib/libpjsdp-x86_64-apple-darwin_ios.a -output libpjsdp.a

lipo -info libspeexdsp.a

合并静态库

3.4 pjnath(1)

Architectures in the fat file: libogg.a are: i386 armv7 armv7s arm64

lipo -create arm64/lib/libg7221codec-arm64-apple-darwin_ios.a armv7/lib/libg7221codec-armv7-apple-darwin_ios.a armv7s/lib/libg7221codec-armv7s-apple-darwin_ios.a x64/lib/libg7221codec-x86_64-apple-darwin_ios.a x86/lib/libg7221codec-i386-apple-darwin_ios.a -output all/lib/libg7221codec.a

路径:pj2.7/pjnath/lib

lipo -create arm64/lib/libgsmcodec-arm64-apple-darwin_ios.a armv7/lib/libgsmcodec-armv7-apple-darwin_ios.a armv7s/lib/libgsmcodec-armv7s-apple-darwin_ios.a x64/lib/libgsmcodec-x86_64-apple-darwin_ios.a x86/lib/libgsmcodec-i386-apple-darwin_ios.a -output all/lib/libgsmcodec.a

命令:

lipo -create arm64/lib/libilbccodec-arm64-apple-darwin_ios.a armv7/lib/libilbccodec-armv7-apple-darwin_ios.a armv7s/lib/libilbccodec-armv7s-apple-darwin_ios.a x64/lib/libilbccodec-x86_64-apple-darwin_ios.a x86/lib/libilbccodec-i386-apple-darwin_ios.a -output all/lib/libilbccodec.a

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/pjnath (备注 直接进入到生成新的库目录)

lipo -create arm64/lib/libpj-arm64-apple-darwin_ios.a armv7/lib/libpj-armv7-apple-darwin_ios.a armv7s/lib/libpj-armv7s-apple-darwin_ios.a x64/lib/libpj-x86_64-apple-darwin_ios.a x86/lib/libpj-i386-apple-darwin_ios.a -output all/lib/libpj.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjnath/lib/libpjnath-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjnath/lib/libpjnath-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjnath/lib/libpjnath-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjnath/lib/libpjnath-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjnath/lib/libpjnath-x86_64-apple-darwin_ios.a -output libpjnath.a 

lipo -create arm64/lib/libpjlib-util-arm64-apple-darwin_ios.a armv7/lib/libpjlib-util-armv7-apple-darwin_ios.a armv7s/lib/libpjlib-util-armv7s-apple-darwin_ios.a x64/lib/libpjlib-util-x86_64-apple-darwin_ios.a x86/lib/libpjlib-util-i386-apple-darwin_ios.a -output all/lib/libpjlib-util.a

3.5 pjsip (5)

lipo -create arm64/lib/libpjmedia-audiodev-arm64-apple-darwin_ios.a armv7/lib/libpjmedia-audiodev-armv7-apple-darwin_ios.a armv7s/lib/libpjmedia-audiodev-armv7s-apple-darwin_ios.a x64/lib/libpjmedia-audiodev-x86_64-apple-darwin_ios.a x86/lib/libpjmedia-audiodev-i386-apple-darwin_ios.a -output all/lib/libpjmedia-audiodev.a

路径:pj2.7/pjsip/lib

lipo -create arm64/lib/libpjmedia-arm64-apple-darwin_ios.a armv7/lib/libpjmedia-armv7-apple-darwin_ios.a armv7s/lib/libpjmedia-armv7s-apple-darwin_ios.a x64/lib/libpjmedia-x86_64-apple-darwin_ios.a x86/lib/libpjmedia-i386-apple-darwin_ios.a -output all/lib/libpjmedia.a

命令:

lipo -create arm64/lib/libpjmedia-codec-arm64-apple-darwin_ios.a armv7/lib/libpjmedia-codec-armv7-apple-darwin_ios.a armv7s/lib/libpjmedia-codec-armv7s-apple-darwin_ios.a x64/lib/libpjmedia-codec-x86_64-apple-darwin_ios.a x86/lib/libpjmedia-codec-i386-apple-darwin_ios.a -output all/lib/libpjmedia-codec.a

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/pjsip (备注 直接进入到生成新的库目录)

lipo -create arm64/lib/libpjmedia-videodev-arm64-apple-darwin_ios.a armv7/lib/libpjmedia-videodev-armv7-apple-darwin_ios.a armv7s/lib/libpjmedia-videodev-armv7s-apple-darwin_ios.a x64/lib/libpjmedia-videodev-x86_64-apple-darwin_ios.a x86/lib/libpjmedia-videodev-i386-apple-darwin_ios.a -output all/lib/libpjmedia-videodev.a

3.5.1  libpjsip.a

lipo -create arm64/lib/libpjnath-arm64-apple-darwin_ios.a armv7/lib/libpjnath-armv7-apple-darwin_ios.a armv7s/lib/libpjnath-armv7s-apple-darwin_ios.a x64/lib/libpjnath-x86_64-apple-darwin_ios.a x86/lib/libpjnath-i386-apple-darwin_ios.a -output all/lib/libpjnath.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-x86_64-apple-darwin_ios.a -output libpjsip.a

lipo -create arm64/lib/libpjsip-arm64-apple-darwin_ios.a armv7/lib/libpjsip-armv7-apple-darwin_ios.a armv7s/lib/libpjsip-armv7s-apple-darwin_ios.a x64/lib/libpjsip-x86_64-apple-darwin_ios.a x86/lib/libpjsip-i386-apple-darwin_ios.a -output all/lib/libpjsip.a

3.5.2 libpjsip-simple.a

lipo -create arm64/lib/libpjsip-simple-arm64-apple-darwin_ios.a armv7/lib/libpjsip-simple-armv7-apple-darwin_ios.a armv7s/lib/libpjsip-simple-armv7s-apple-darwin_ios.a x64/lib/libpjsip-simple-x86_64-apple-darwin_ios.a x86/lib/libpjsip-simple-i386-apple-darwin_ios.a -output all/lib/libpjsip-simple.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-simple-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-simple-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-simple-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-simple-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-simple-x86_64-apple-darwin_ios.a -output libpjsip-simple.a

lipo -create arm64/lib/libpjsip-ua-arm64-apple-darwin_ios.a armv7/lib/libpjsip-ua-armv7-apple-darwin_ios.a armv7s/lib/libpjsip-ua-armv7s-apple-darwin_ios.a x64/lib/libpjsip-ua-x86_64-apple-darwin_ios.a x86/lib/libpjsip-ua-i386-apple-darwin_ios.a -output all/lib/libpjsip-ua.a

3.5.3 libpjsip-ua.a

lipo -create arm64/lib/libpjsua-arm64-apple-darwin_ios.a armv7/lib/libpjsua-armv7-apple-darwin_ios.a armv7s/lib/libpjsua-armv7s-apple-darwin_ios.a x64/lib/libpjsua-x86_64-apple-darwin_ios.a x86/lib/libpjsua-i386-apple-darwin_ios.a -output all/lib/libpjsua.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-ua-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-ua-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-ua-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-ua-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsip-ua-x86_64-apple-darwin_ios.a -output libpjsip-ua.a

lipo -create arm64/lib/libpjsua2-arm64-apple-darwin_ios.a armv7/lib/libpjsua2-armv7-apple-darwin_ios.a armv7s/lib/libpjsua2-armv7s-apple-darwin_ios.a x64/lib/libpjsua2-x86_64-apple-darwin_ios.a x86/lib/libpjsua2-i386-apple-darwin_ios.a -output all/lib/libpjsua2.a

3.5.4 libpjsua.a

lipo -create arm64/lib/libresample-arm64-apple-darwin_ios.a armv7/lib/libresample-armv7-apple-darwin_ios.a armv7s/lib/libresample-armv7s-apple-darwin_ios.a x64/lib/libresample-x86_64-apple-darwin_ios.a x86/lib/libresample-i386-apple-darwin_ios.a -output all/lib/libresample.a

-create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua-x86_64-apple-darwin_ios.a -output libpjsua.a

lipo -create arm64/lib/libspeex-arm64-apple-darwin_ios.a armv7/lib/libspeex-armv7-apple-darwin_ios.a armv7s/lib/libspeex-armv7s-apple-darwin_ios.a x64/lib/libspeex-x86_64-apple-darwin_ios.a x86/lib/libspeex-i386-apple-darwin_ios.a -output all/lib/libspeex.a

3.5.5 libpjsua2.a

lipo -create arm64/lib/libsrtp-arm64-apple-darwin_ios.a armv7/lib/libsrtp-armv7-apple-darwin_ios.a armv7s/lib/libsrtp-armv7s-apple-darwin_ios.a x64/lib/libsrtp-x86_64-apple-darwin_ios.a x86/lib/libsrtp-i386-apple-darwin_ios.a -output all/lib/libsrtp.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua2-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua2-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua2-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua2-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/pjsip/lib/libpjsua2-x86_64-apple-darwin_ios.a -output libpjsua2.a

lipo -create arm64/lib/libyuv-arm64-apple-darwin_ios.a armv7/lib/libyuv-armv7-apple-darwin_ios.a armv7s/lib/libyuv-armv7s-apple-darwin_ios.a x64/lib/libyuv-x86_64-apple-darwin_ios.a x86/lib/libyuv-i386-apple-darwin_ios.a -output all/lib/libyuv.a

3.6  third_party(8)

将arm64中的include文件夹copy到all目录下

路径:pj2.7/third_party/lib

  1. 将编译好的库导入到项目中去配置

命令:

Header Search Paths ——> $(PROJECT_DIR)/phone/all/include;

cd /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/lib/third_party  (备注 直接进入到生成新的库目录)

Other Linker Flags: -ObjC;

3.6.1 libg7221codec.a

Preprocessor Macros: PJ_AUTOCONF=1

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libg7221codec-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libg7221codec-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libg7221codec-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libg7221codec-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libg7221codec-x86_64-apple-darwin_ios.a -output libg7221codec.a

在Build Phases中的Link Binary With Libraries中添加Framework:AudioToolbox、AVFoundation

3.6.2 libgsmcodec.a

最后,附上小demo:

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libgsmcodec-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libgsmcodec-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libgsmcodec-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libgsmcodec-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libgsmcodec-x86_64-apple-darwin_ios.a -output libgsmcodec.a

注:由于CSDN网络总是很不稳定,故预将CSDN博客迁入至简书,原CSDN地址:

3.6.3 libilbccodec.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libilbccodec-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libilbccodec-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libilbccodec-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libilbccodec-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libilbccodec-x86_64-apple-darwin_ios.a -output libilbccodec.a

3.6.4 libresample.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libresample-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libresample-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libresample-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libresample-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libresample-x86_64-apple-darwin_ios.a -output libresample.a

3.6.5 libspeex.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libspeex-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libspeex-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libspeex-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libspeex-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libspeex-x86_64-apple-darwin_ios.a -output libspeex.a

3.6.6 libsrtp.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libsrtp-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libsrtp-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libsrtp-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libsrtp-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libsrtp-x86_64-apple-darwin_ios.a -output libsrtp.a

3.6.7 libwebrtc.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libwebrtc-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libwebrtc-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libwebrtc-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libwebrtc-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libwebrtc-x86_64-apple-darwin_ios.a -output libwebrtc.a

3.6.8 libyuv.a

lipo -create /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libyuv-arm64-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libyuv-armv7-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libyuv-armv7s-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libyuv-i386-apple-darwin_ios.a /Users/sunhaiping/Desktop/原版pj2.7/pjproject-2.7.2/third_party/lib/libyuv-x86_64-apple-darwin_ios.a -output libyuv.a

3.7 将openh264.a 与 oups.a 移动到lib/third_party 中

编译完成

4.导出头文件

    分别把 pjlib; pjlib-util ;pjmedia;pjnath;pjsip;  文件夹中的include文件拷贝到一个文件夹内。

5.导出pjsua 文件

    在目录:pjproject-2.7.2/pjsip-apps/src/pjsua 

    gui.h 

    pjsua_app_cli.c  

    pjsua_app_common.c 

    pjsua_app_common.h 

    pjsua_app_config.c 

    pjsua_app_config.h 

    pjsua_app_legacy.c 

    pjsua_app.c  

    pjsua_app.h

    放到新文件加pjsua中

版权声明:本文由韦德娱乐1946_韦德娱乐1946网页版|韦德国际1946官网发布于网络编程,转载请注明出处:iOS之PJSIP的编写翻译与简短利用www.weide1946.com