[FFmpeg-devel] [PATCH 1/2 v2] update configure etc to use libyami for h264 decode

Zhao, Halley halley.zhao at intel.com
Wed Jan 14 05:39:45 CET 2015


From: "Zhao, Halley" <halley.zhao at intel.com>

add possible C++ based library dependency
add multiple packages dependency for one component
add h264dec basing on libyami
---
 configure              | 78 ++++++++++++++++++++++++++++++++++++--------------
 libavcodec/Makefile    |  1 +
 libavcodec/allcodecs.c |  1 +
 3 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/configure b/configure
index a0dbafb..8131935 100755
--- a/configure
+++ b/configure
@@ -239,6 +239,7 @@ External library support:
   --enable-libspeex        enable Speex de/encoding via libspeex [no]
   --enable-libssh          enable SFTP protocol via libssh [no]
   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
+  --enable-libyami-h264    enable H.264 decoding via libyami [no]
   --enable-libtheora       enable Theora encoding via libtheora [no]
   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
   --enable-libutvideo      enable Ut Video encoding and decoding via libutvideo [no]
@@ -1023,11 +1024,12 @@ int main(void){ return (int) foo; }
 EOF
 }
 
-check_func_headers(){
-    log check_func_headers "$@"
-    headers=$1
-    funcs=$2
-    shift 2
+check_func_headers_(){
+    log check_func_headers_ "$@"
+    compiler=$1
+    headers=$2
+    funcs=$3
+    shift 3
     {
         for hdr in $headers; do
             print_include $hdr
@@ -1036,7 +1038,10 @@ check_func_headers(){
             echo "long check_$func(void) { return (long) $func; }"
         done
         echo "int main(void) { return 0; }"
-    } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
+    } | check_ld "$compiler" "$@" && enable $funcs && enable_safe $headers
+}
+check_func_headers() {
+	check_func_headers_ "cc" "$@"
 }
 
 check_class_headers_cpp(){
@@ -1095,20 +1100,26 @@ check_lib_cpp(){
     check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
 }
 
-check_pkg_config(){
-    log check_pkg_config "$@"
-    pkgandversion="$1"
-    pkg="${1%% *}"
-    headers="$2"
-    funcs="$3"
-    shift 3
-    check_cmd $pkg_config --exists --print-errors $pkgandversion || return
-    pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
-    pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
-    check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
+check_pkg_config_(){
+    log check_pkg_config_ "$@"
+    compiler="$1"
+    ## one component may depend on multiple pkgs
+    allpkgs="$2"
+    pkg="${2%% *}"
+    headers="$3"
+    funcs="$4"
+    shift 4
+    check_cmd $pkg_config --exists --print-errors $allpkgs || return
+    pkg_cflags=$($pkg_config --cflags $pkg_config_flags $allpkgs)
+    pkg_libs=$($pkg_config --libs $pkg_config_flags $allpkgs)
+    log "compiler:" "$compiler" "; headers:" "$headers" "; funcs:" "$funcs"
+    check_func_headers_ "$compiler" "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
         set_safe ${pkg}_cflags $pkg_cflags   &&
         set_safe ${pkg}_libs   $pkg_libs
 }
+check_pkg_config() {
+	check_pkg_config_ "cc" "$@"
+}
 
 check_exec(){
     check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
@@ -1208,15 +1219,37 @@ require_cpp(){
     check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
 }
 
-use_pkg_config(){
-    pkg="$1"
-    check_pkg_config "$@" || return 1
+use_pkg_config_(){
+    log "use_pkg_config_:" "$@"
+    pkg="$2"
+    check_pkg_config_ "$@" || return 1
     add_cflags    $(get_safe ${pkg}_cflags)
     add_extralibs $(get_safe ${pkg}_libs)
 }
 
+use_pkg_config(){
+    use_pkg_config_ "cc" "$@"
+}
+
+require_pkg_config_(){
+    use_pkg_config_ "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
+}
+
+cxx_extralibs_added="no"
+add_cxx_extralibs(){
+    if [ "$cxx_extralibs_added" = "no" ]; then
+        add_extralibs "-lstdc++ -Wl,--no-as-needed -ldl"
+        cxx_extralibs_added="yes"
+    fi
+}
+
 require_pkg_config(){
-    use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
+	require_pkg_config_ "cc" "$@"
+}
+
+require_pkg_config_cxx(){
+	require_pkg_config_ "cxx" "$@"
+	add_cxx_extralibs
 }
 
 require_libfreetype(){
@@ -1381,6 +1414,7 @@ EXTERNAL_LIBRARY_LIST="
     libspeex
     libssh
     libstagefright_h264
+    libyami_h264
     libtheora
     libtwolame
     libutvideo
@@ -2379,6 +2413,7 @@ libspeex_decoder_deps="libspeex"
 libspeex_encoder_deps="libspeex"
 libspeex_encoder_select="audio_frame_queue"
 libstagefright_h264_decoder_deps="libstagefright_h264"
+libyami_h264_decoder_deps="libyami_h264"
 libtheora_encoder_deps="libtheora"
 libtwolame_encoder_deps="libtwolame"
 libvo_aacenc_encoder_deps="libvo_aacenc"
@@ -4909,6 +4944,7 @@ enabled libspeex          && require_pkg_config speex speex/speex.h speex_decode
 enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
     media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
     media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
+enabled libyami_h264      && require_pkg_config_cxx "libyami_decoder libva" VideoDecoderHost.h createVideoDecoder
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame &&
                              { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 80ee389..c95d2d1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -750,6 +750,7 @@ OBJS-$(CONFIG_LIBSHINE_ENCODER)           += libshine.o
 OBJS-$(CONFIG_LIBSPEEX_DECODER)           += libspeexdec.o
 OBJS-$(CONFIG_LIBSPEEX_ENCODER)           += libspeexenc.o
 OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o
+OBJS-$(CONFIG_LIBYAMI_H264_DECODER)       += libyami.o
 OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
 OBJS-$(CONFIG_LIBTWOLAME_ENCODER)         += libtwolame.o
 OBJS-$(CONFIG_LIBUTVIDEO_DECODER)         += libutvideodec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 29b45f3..d2c245e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -97,6 +97,7 @@ void avcodec_register_all(void)
     REGISTER_HWACCEL(WMV3_VDPAU,        wmv3_vdpau);
 
     /* video codecs */
+    REGISTER_DECODER(LIBYAMI_H264,      libyami_h264);
     REGISTER_ENCODER(A64MULTI,          a64multi);
     REGISTER_ENCODER(A64MULTI5,         a64multi5);
     REGISTER_DECODER(AASC,              aasc);
-- 
1.8.3.2



More information about the ffmpeg-devel mailing list