zoukankan      html  css  js  c++  java
  • VLCKit编译(IOS)

    VLCKit编译(IOS)

    一、下载

    1.从官网下载VLCKit,下载命令git clone http://code.videolan.org/videolan/VLCKit.git

    2.VLCKit代码下载完成后,还需要下载vlc代码,下载地址可以从buildMobileVLCKit.sh中获取,新建libvlc目录,并进入libvlc中,使用命令git clone https://git.videolan.org/git/vlc/vlc-3.0.git vlc下载vlc代码。

    二、修改编译脚本

    将编译脚本buildMobileVLCKit.sh中关于下载vlc部分的代码注释,避免每次都下载(若不注释,在git rebase的时候会报错),修改的代码如下:

    #if [ "$NONETWORK" != "yes" ]; then
    #    if ! [ -e vlc ]; then
    #        git clone https://git.videolan.org/git/vlc/vlc-3.0.git vlc
    #        info "Applying patches to vlc.git"
    #        cd vlc
    #        git checkout -B localBranch ${TESTEDHASH}
    #        git branch --set-upstream-to=origin/master localBranch
    #        git am ${ROOT_DIR}/Resources/MobileVLCKit/patches/*.patch
    #        if [ $? -ne 0 ]; then
    #            git am --abort
    #            info "Applying the patches failed, aborting git-am"
    #            exit 1
    #        fi
    #        cd ..
    #    else
    #        cd vlc
    #        git pull --rebase
    #        git reset --hard ${TESTEDHASH}
    #        git am ${ROOT_DIR}/Resources/MobileVLCKit/patches/*.patch
    #        cd ..
    #    fi
    #fi
    

    三、选取需要编译的版本

    在通过命令git tag|tail查看最新的稳定版本,选择一个版本,用命令git checkout tag name -b tagname获取需要的版本并建立开发分支,用git branchgit log查看创建的分支是否正确。
    注:编译master版本时,不需要修改vlcVLCKit代码,下载完就可以直接编译,此博不详细说明。

    3.1 VLCKit版本选择

    1.git tag | tail查看所有的tag信息:

    ~/workspace/VLCKit3/VLCKit$ git tag|tail
    2.2.2
    2.2.2-pre1
    2.2.2-pre2
    2.2.2-pre3
    2.2.2-pre4
    2.2.2-pre5
    3.0.0-pre1
    3.0.0-pre2
    3.0.0-pre3
    3.0.0-rc1
    

    2.选择VLCKit 3.0.0-rc1作为基础版本:

    ~/workspace/VLCKit3/VLCKit$ git checkout 3.0.0-rc1 -b tag300rc1
    Switched to a new branch 'tag300rc1'
    ~/workspace/VLCKit3/VLCKit$ git branch
      master
    * tag300rc1		#*表示选择的版本
    

    3.git log显示是tag:3.0.0-rc1版本:

    3.2 vlc版本选择

    ​ 同样的,我们也需要对vlc选取开发的基础版本,我们选择3.0.0-git的版本作为基础版本,如下:

    1.查看所有的tag

    ~/workspace/VLCKit3/VLCKit/libvlc/vlc$ git tag | tail
    2.2.0-git
    3.0.0-git
    3.0.0-rc1
    3.0.0-rc2
    3.0.0-rc3
    3.0.0-rc4
    3.0.0-rc5
    3.0.0-rc6
    3.0.0-rc7
    svn-trunk
    

    2.选择3.0.0-git版本作为基础版本:

    ~/workspace/VLCKit3/VLCKit/libvlc/vlc$ git checkout 3.0.0-git -b tag300
    Switched to a new branch 'tag300'
    ~/workspace/VLCKit3/VLCKit/libvlc/vlc$ git branch
      master
    * tag300		#*表示选择的版本
    

    3.git log显示是3.0.0-git版本:

    4.tag: 3.0.0版本说明:在3.0.0-git后续的版本(3.0.0-r1,3.0.0-r2……3.0.0-r7)中,添加了WeatherWax这玩意儿,并修复了一些bug。编译的方法与3.0.0-git一样。

    3.0.0-git
    object	8d432b090e08f141ce9156dc728afbed4636301b	commit
    author	Jean-Baptiste Kempf <jb@videolan.org>	
    Thu, 30 Nov 2017 08:44:12 +0800 (01:44 +0100)
    VLC media player 3.0.0-git
    
    Splitting the repository of VLC 3.0.x and VLC.git master
    
    3.0.0-rc7
    object	d427a9f90fb866ffd045961c62caabd597badb2a	commit
    author	Jean-Baptiste Kempf <jb@videolan.org>	
    Sat, 20 Jan 2018 02:04:13 +0800 (19:04 +0100)
    VLC media player 3.0.0 'WeatherWax' Release Candidate 7
    
    This is the seventh release candidate of VLC 3.0, named "WeatherWax"
    
    WeatherWax is a major release changing a lot in the media engine of VLC.
    Notably, it:
     - activates hardware decoding on all platforms, of H.264 & H.265, 8 & 10bits,
       allowing 4K60 or even 8K decoding with little CPU consumption;
     - merges all the code from the mobile ports into the same release,
     - supports 360 video and 3D audio, and prepares for VR content,
     - supports direct HDR and HDR tone-mapping,
     - updates the audio passthrough for HD Audio codecs,
     - allows browsing of local network drives like SMB, FTP, SFTP, NFS...
     - stores the passwords securely
     - brings a new subtitle rendering engine, supporting ComplexTextLayout
       and font fallback
     - supports ChromeCast with the new renderer framework,
     - adds support for numerous new formats and codecs, including WebVTT,
       AV1, TTML, HQX, 708 and Cineform,
     - improves Bluray support with Java menus,
     - updates the macOS interface with major cleaning,
     - support HiDPI UI on Windows,
     - prepares the experimental support for Wayland on Linux, and switches to OpenGL by default.
    
    And so many other things...
    

    四、编译

    注意:编译之前,确保已经修改好了buildMobileVLCKit.sh脚本

    ​ 使用命令./buildMobileVLCKit.sh -f编译支持iphonesimulatoriphoneosMobileVLCKit.framework,可能会遇到错误,若遇到错误,而又不知道错误在何处时,可以使用命令./buildMobileVLCKit.sh -f -v,将会打印出编译的详细信息。

    ​ 第一次编译的时候比较长,需要下载libtools工具集,当libtools工具集下载完后,以后的编译,就可以不下载,使用./buildMobileVLCKit.sh -f进行编译。

    ​ 编译过程中遇到错误时,需要修改一些文件才能编译得过,每次修改后,都需要重新编译。

    1.在libvlc/vlc//contrib/iPhoneOS-armv7/gcrypt/cipher/Makefile.am文件开始的位置添加LIBTOOL=@LIBTOOL@ --tag=CC,保存后,进入目录libvlc/vlc//contrib/iPhoneOS-armv7/gcrypt/cipher/运行make distclean命令,删除Makefile文件;

    2.在libvlc/vlc//include/vlc_fixups.h:53行后,添加一个thread_local的宏定义: # define thread_local

    3.在libvlc/vlc//modules/arm_neon/Makefile.am文件开始的位置添加LIBTOOL=@LIBTOOL@ --tag=CC,保存后,进入目录libvlc/vlc//modules/arm_neon/运行make distclean命令,删除Makefile文件;

    4.在libvlc/vlc//contrib/iPhoneOS-armv7s/gcrypt/cipher/Makefile.am文件开始的位置添加LIBTOOL=@LIBTOOL@ --tag=CC,保存后,进入目录保存后,并进入目录libvlc/vlc//contrib/iPhoneOS-armv7s/gcrypt/cipher/运行make distclean命令,删除Makefile文件;

    ​ 到此,就能将vlc编译通过了。但是vlc由于接口与VLCKit不兼容,导致VLCKit还是不能编译通过,需要修改一些文件才行。当vlc编译完成之后,就可以使用 ./buildMobileVLCKit.sh -f -l来编译,此时将跳过vlc的编译,减少时间。

    5.Sources/VLCMedia.m修改内容:

    --- a/Sources/VLCMedia.m
    +++ b/Sources/VLCMedia.m
    @@ -406,10 +406,11 @@ - (int)storeCookie:(NSString * _Nonnull)cookie
             return -1;
         }
     #if TARGET_OS_IPHONE
    -    return libvlc_media_cookie_jar_store(p_md,
    -                                         [cookie UTF8String],
    -                                         [host UTF8String],
    -                                         [path UTF8String]);
    +    return 0;
    +    //libvlc_media_cookie_jar_store(p_md,
    +//                                         [cookie UTF8String],
    +//                                         [host UTF8String],
    +//                                         [path UTF8String]);
     #else
         return -1;
     #endif
    @@ -422,7 +423,7 @@ - (void)clearStoredCookies
         }
     
     #if TARGET_OS_IPHONE
    -    libvlc_media_cookie_jar_clear(p_md);
    +    //libvlc_media_cookie_jar_clear(p_md);
     #endif
     }
    
    

    6.Sources/VLCMediaListPlayer.m修改:

    --- a/Sources/VLCMediaListPlayer.m
    +++ b/Sources/VLCMediaListPlayer.m
    @@ -150,7 +150,7 @@ - (void)pause
             [self performSelectorInBackground:@selector(pause) withObject:nil];
             return;
         }
    -    libvlc_media_list_player_set_pause(instance, 1);
    +    libvlc_media_list_player_pause(instance);
     }
    
    

    ​ 历经重重劫难,付出几个晚上的努力,终于将MobileVLCKit.framework编译成功了。

    五、踩过的坑

    1.未修改buildMobileVLCKit.sh,直接使用,重复的下载代码,导致编译时间增长很多;

    2.修改了libvlc/vlc//contrib/iPhoneOS-armv7/gcrypt/cipher/Makefile.am后,没有执行make distclean,导致第二次编译不过,需要重新再编译一次;

    3.检查编译失败的时候,由于刚开始不知道使用-v参数可以打印出更多的信息,上网查看好久,也未能解决,便将buildMobileVLCKit.sh好好阅读,发现可以通过指定-v参数打印详细信息;

    4.编译好vlc后,不知道使用-l跳过,导致每次都重新编译vlc,浪费了很多时间。

    六、参考资料

    参考1:iOS编译MobileVLCKit客户端 https://www.jianshu.com/p/9e3cdec84884

    参考2:官网 https://code.videolan.org/videolan/VLCKit/issues

    参考3:基于iOS5.0的MobileVLC(vlc for iOS)编译 http://www.cnblogs.com/madongchunqiu/archive/2012/06/07/Compile-MobileVLC-in-iOS5.html

  • 相关阅读:
    cocos2d-x系列笔记技巧篇(2)---关于CREATE_FUNC宏的用法
    Cocos2d-x开源、跨平台的游戏引擎
    Asp.Net Core 文件上传处理
    Asp.Net Core获取当前上下文对象
    Asp.Net Core 视图整理(一)
    SVG渲染顺序及z轴显示问题(zIndex)
    JavaScript Screen对象
    Javascript 对象(object)合并
    SVG.Js事件示例,简单绑定拖动操作
    SVG 文字居中整理
  • 原文地址:https://www.cnblogs.com/Icewine/p/8353709.html
Copyright © 2011-2022 走看看