enable cef support ffmpeg

refefences:

https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding

这里有源码包列表。如果automate-git.py git下载失败,只能申请海外服务器。

 

Env precondition:

Win 7+, VS2015u3, Win10.0.14393 SDK, Ninja

 

1. install Git

windown上安装 git bash

2. install ninja

set  env path for ninja 

3. install python

https://www.python.org/downloads/windows/

python 2.7.6

使用python3+, 会有一些语法错误。

 

4 设置系统区域为

  英语(美国), 否则编译是有编码错误。 因为大部分source file 被转成了GB2312, 还有少部分 UTF-8的, 相互引用,编译不能通过。 设置为 英语, 所有的source  files就是UTF-8。

 

 

 

5 设置git 代理 

设置git http  https代理为 翻墙软件的 port。

 

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global http.sslVerify false

git config --list    #列出所有设置
git config --global --unset http.proxy  #去掉配置
git config --global --edit   #编译配置

 

landtern 的设置

 

c:\>set http_proxy=http://127.0.0.1:1080

c:\>set https_proxy=https://127.0.0.1:1080

 

 

 

 

 

4.  GYP 编译模式 适用老版本

before automate-git.py,    set some virable.

https://bitbucket.org/chromiumembedded/cef/wiki/AutomatedBuildSetup.md#markdown-header-linux-configuration

 

set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_DEFINES=proprietary_codecs=1 ffmpeg_branding=Chrome    #(to enable MP3 and MP4)
set GYP_MSVS_VERSION=2015
 
set GYP_GENERATORS=ninja,msvs-ninja
set CEF_ARCHIVE_FORMAT=tar.bz2

 

  python ./automate-git.py  --download-dir=/f/Library/cef  --branch=2704 --no-release-build

 

#-   --force-clean  清除参数

 

5.  GN 编译模式,适用新版本

 

 

set CEF_USE_GN=1
set GN_DEFINES=proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*

 

 

 

 

 

automate-git.py --download-dir=F:\f\3112  --branch=3112 --depot-tools-dir=F:\f\3112\depot_tools  --minimal-distrib

depot_tools的update流程会下载安装对应的python,ninja,git。

#--minimal-distrib 不是必须的, 可以用  --no-release-build    --no-debug-build 选择编译输出。

编译成功后  chromium\src\cef\binary_distrib    , 有对应的binbinary工程,可以生成VS  wrapper工程。

 

如果下载不成功,经常中断,只能申请一台海外的服务器下载编译。编译时需要安装对应的SDK版本,vs安装中的sdk安装后没有debug tools,会有编译错误,需要单独安装sdk。不能安装wdk,会有编译错误。

 

 

6.  GYP编译后,选择对应的wrapper工程,copy相应文件。

编译成功后, copy    

libcef.dll

libcef.lib       rename from libcef.dll.lib to libcef.lib

natives_blob.bin

snapshot_blob.bin

libyuv.lib   # maybe no use

 

到 cef wrapper 工程的Debug  或者Release 目录下, 重新编译,就可以播放 视频了。

 

cef  wrapper 工程需要和 cef source工程对应,不然 libcef.dll 导出的API是对不上的。 

 

cef wrapper:   http://opensource.spotify.com/cefbuilds/index.html#windows32_builds

 

 

7.  enable support more format video/audio

 

F:\f\3112\chromium\src\third_party\ffmpeg\chromium\scripts\build_ffmpeg.py
  configure_flags['Chrome'].extend([
      '--enable-decoder=aac,h264,mp3',
      '--enable-demuxer=aac,mp3,mov',
      '--enable-parser=aac,h264,mpegaudio',
  ])

change to:
    # Google Chrome & ChromeOS specific configuration.
  configure_flags['Chrome'].extend([
      '--enable-decoder=aac,h264,mp3,mpeg4,amrnb,amrwb,flv',
      '--enable-demuxer=aac,mp3,mov,avi,amr,flv',
      '--enable-parser=aac,h264,mpegaudio,mpeg4video,h263',
  ])

这里可能还要修改  chromium\src\third_party\ffmpeg\chromium\config\Chrome\win\ia32\config.h config.asm; 不确定。

修改chromium\src\third_party\ffmpeg\ffmpeg_generated.gni; 加入对应的源文件。

 

 

if ((current_cpu == "x64" && ffmpeg_branding == "Chrome") || (is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (is_android && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (is_android && current_cpu == "mips64el" && ffmpeg_branding == "Chrome") || (is_android && current_cpu == "mipsel" && ffmpeg_branding == "Chrome") || (is_android && current_cpu == "x86" && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm" && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "arm" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "arm64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "mipsel" && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "mipsel" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x64" && ffmpeg_branding == "ChromeOS") || (is_linux && current_cpu == "x86" && ffmpeg_branding == "Chrome") || (is_linux && current_cpu == "x86" && ffmpeg_branding == "ChromeOS") || (is_win && ffmpeg_branding == "Chrome")) {
  ffmpeg_c_sources += [
    "libavcodec/x86/blockdsp_init.c",
    "libavcodec/x86/fdct.c",
    "libavcodec/x86/fdctdsp_init.c",
    "libavcodec/x86/h263dsp_init.c",
    "libavcodec/x86/idctdsp_init.c",
    "libavcodec/x86/me_cmp_init.c",
    "libavcodec/x86/mpegvideo.c",
    "libavcodec/x86/mpegvideodsp.c",
    "libavcodec/x86/pixblockdsp_init.c",
    "libavcodec/x86/qpeldsp_init.c",
    "libavcodec/x86/simple_idct.c",
    "libavcodec/x86/xvididct_init.c",
    "libavcodec/autorename_libavcodec_simple_idct.c",
    "libavcodec/autorename_libavcodec_pixblockdsp.c",
    "libavcodec/autorename_libavcodec_mpegvideodsp.c",
    "libavcodec/autorename_libavcodec_idctdsp.c",
    "libavcodec/autorename_libavcodec_gsmdec.c",
    "libavcodec/autorename_libavcodec_blockdsp.c",
    "libavcodec/autorename_libavcodec_mpegvideo.c",
    "libavcodec/autorename_libavcodec_xvididct.c",
    "libavcodec/autorename_libavcodec_qpeldsp.c",
    "libavcodec/autorename_libavcodec_me_cmp.c",
    "libavcodec/autorename_libavcodec_aacdec.c",
    "libavcodec/autorename_libavcodec_mpegaudiodsp.c",
    "libavcodec/autorename_libavcodec_sbrdsp.c",
    "libavcodec/acelp_filters.c",
    "libavcodec/acelp_pitch_delay.c",
    "libavcodec/acelp_vectors.c",
    "libavcodec/aac_ac3_parser.c",
    "libavcodec/aac_parser.c",
    "libavcodec/aacadtsdec.c",
    "libavcodec/aacps_float.c",
    "libavcodec/aacpsdsp_float.c",
    "libavcodec/aacsbr.c",
    "libavcodec/aactab.c",
    "libavcodec/ac3tab.c",
    "libavcodec/cbrt_data.c",
    "libavcodec/dct.c",
    "libavcodec/dct32_fixed.c",
    "libavcodec/dct32_float.c",
    "libavcodec/kbdwin.c",
    "libavcodec/mdct15.c",
    "libavcodec/mpegaudio.c",
    "libavcodec/mpegaudio_parser.c",
    "libavcodec/mpegaudiodec_fixed.c",
    "libavcodec/mpegaudiodecheader.c",
    "libavcodec/mpegaudiodsp_data.c",
    "libavcodec/mpegaudiodsp_fixed.c",
    "libavcodec/mpegaudiodsp_float.c",
    "libavcodec/sinewin.c",
    "libavcodec/sinewin_fixed.c",
    "libavformat/aacdec.c",
    "libavformat/apetag.c",
    "libavformat/img2.c",
    "libavformat/mov.c",
    "libavformat/mov_chan.c",
    "libavformat/mp3dec.c",
    "libavcodec/exif.c",
    "libavcodec/flvdec.c",
    "libavformat/autorename_flvdec.c",
    "libavcodec/celp_filters.c",
    "libavcodec/celp_math.c",
    "libavcodec/error_resilience.c",
    "libavcodec/faandct.c",
    "libavcodec/faanidct.c",
    "libavcodec/fdctdsp.c",
    "libavcodec/h263.c",
    "libavcodec/h263_parser.c",
    "libavcodec/h263data.c",
    "libavcodec/h263dec.c",
    "libavcodec/h263dsp.c",
    "libavcodec/intelh263dec.c",
    "libavcodec/ituh263dec.c",
    "libavcodec/jfdctfst.c",
    "libavcodec/jfdctint.c",
    "libavcodec/jrevdct.c",
    "libavcodec/lsp.c",
    "libavcodec/mpeg4video.c",
    "libavcodec/mpeg4video_parser.c",
    "libavcodec/mpeg4videodec.c",
    "libavcodec/mpeg_er.c",
    "libavcodec/mpegpicture.c",
    "libavcodec/mpegutils.c",
    "libavcodec/mpegvideo_motion.c",
    "libavcodec/mpegvideodata.c",
    "libavcodec/rl.c",
    "libavcodec/tiff_common.c",
    "libavformat/avidec.c",
  ]
  
    ffmpeg_yasm_sources += [
    "libavcodec/x86/blockdsp.asm",
    "libavcodec/x86/h263_loopfilter.asm",
    "libavcodec/x86/idctdsp.asm",
    "libavcodec/x86/me_cmp.asm",
    "libavcodec/x86/pixblockdsp.asm",
    "libavcodec/x86/qpeldsp.asm",
    "libavcodec/x86/simple_idct10.asm",
    "libavcodec/x86/xvididct.asm",
  ]
}


编译cef成功。但是,cefclient还是不能支持除了mp4/ogv/webm 的其它格式,这个HTML5不支持。不是底层解码库的问题。

 

Error list:

 

1. 编译时的UTF-8编码错误, 也可以用shell都转换为 GB2312,比较麻烦。

, VS2015默认是gd2312, 可能因此生成的大部分源文件是 GB2312编码, 但还是有一些UTF-8 的文件, 相互include会产生错误

error C2220: 警告被视为错误 - 没有生成“object”文件
f:\f\library\chromium\src\third_party\pdfium\third_party\freetype\src\sfnt\ttload.c: warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文 件保存为 Unicode 格式以防止数据丢失

有这种错误, 因此需要想办法转换 UTF-8  to  GB2312, 做了个Shell转换。 大部分文件是能转换成功的, 有个别包含拉丁文的会转换有问题, 需要手动干预。

 

 

#!/bin/bash


counter=0
fcounter=0
running=0
basedir=/f/f/Library
resultok=$basedir/result_ok
resultfail=$basedir/result_fail
resultdir=$basedir/result/


echo $resultok


function getdir(){
    for element in `ls $1`
    do  
        dir_or_file=$1"/"$element
        if [ -d $dir_or_file ]
        then 
            getdir $dir_or_file
        else
            #echo $dir_or_file 
extension="${dir_or_file##*.}"
 
if [ "$extension"x = "h"x -o "$extension"x = "hh"x -o "$extension"x = "cc"x  -o "$extension"x = "c"x -o "$extension"x = "cpp"x ];then
   encode=`file -bi $dir_or_file | cut -d\= -f 2`
#echo $encode
running=$((running+1))
echo  $running
   if [ "$encode"x = "utf-8"x ];then
               echo $encode      $dir_or_file
cp $dir_or_file  $resultdir
iconv -f utf-8 -t GB2312 $dir_or_file > $1"/"tmpfile
if [ $? -eq 0 ];then
  mv -f  $1"/"tmpfile  $dir_or_file
  echo $dir_or_file change from utf-8 to GB2312 is ok!
  echo $dir_or_file >> $resultok
  counter=$((counter+1))
else
  fcounter=$((fcounter+1))
  echo $dir_or_file >> $resultfail
  ret=`iconv -c -f utf-8 -t GB2312//TRANSLIT $dir_or_file > $1"/"tmpfile`
  echo  "iconv -c -f utf-8 -t GB2312//TRANSLIT $dir_or_file > $1"/"tmpfile     [$ret]  $?"
  mv -f  $1"/"tmpfile  $dir_or_file
  #rm $1"/"tmpfile
  #if [ $? -eq 0 ];then
   #   mv -f  $1"/"tmpfile  $dir_or_file
  #else
   #   rm $1"/"tmpfile
                       #fi   
fi  
                fi

fi
 
        fi  
    done
}


echo  $1
date
getdir $1
echo transfer ok $counter
echo transfer fail $fcounter
date

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值