From 1b3392e2382a0e01f426d9446e7ea06add295068 Mon Sep 17 00:00:00 2001 From: Chunrong Guo Date: Thu, 29 Dec 2022 10:36:26 +0800 Subject: [PATCH] vpu-lib: upgrade to a3109a35b230a57d Signed-off-by: Chunrong Guo --- README.md | 12 +- board/phytium/common/debian-package-installer | 1 + .../post-custom-skeleton-debian-base-11.sh | 2 +- .../post-custom-skeleton-ubuntu-base-20.04.sh | 14 + .../common/ubuntu-additional_packages_list | 4 +- configs/phytium_d2000_debian_defconfig | 4 + .../phytium_d2000_debian_desktop_defconfig | 7 + configs/phytium_d2000_defconfig | 4 + configs/phytium_d2000_ubuntu_defconfig | 7 + configs/phytium_e2000_debian_defconfig | 4 + .../phytium_e2000_debian_desktop_defconfig | 7 + configs/phytium_e2000_defconfig | 2 + configs/phytium_e2000_ubuntu_defconfig | 4 + .../phytium_e2000_ubuntu_desktop_defconfig | 7 + package/Config.in | 1 + ...tomx-plugin-for-vpu-hardware-decoder.patch | 9050 +++++++++++++++++ ...-x86-yuv2rgb-Fix-build-without-SSSE3.patch | 43 - ...264-skip-decode-if-pic-has-no-slices.patch | 36 - .../0003-libavutil-Fix-mips-build.patch | 72 - ...igure-add-extralibs-to-extralibs_xxx.patch | 47 - package/ffmpeg/Config.in | 1 + package/ffmpeg/ffmpeg.hash | 3 +- package/ffmpeg/ffmpeg.mk | 8 +- package/vpu-lib/Config.in | 12 + package/vpu-lib/vpu-lib.mk | 17 + 25 files changed, 9155 insertions(+), 214 deletions(-) create mode 100755 package/ffmpeg/0001-Add-ftomx-plugin-for-vpu-hardware-decoder.patch delete mode 100644 package/ffmpeg/0001-swscale-x86-yuv2rgb-Fix-build-without-SSSE3.patch delete mode 100644 package/ffmpeg/0002-avcodec-vaapi_h264-skip-decode-if-pic-has-no-slices.patch delete mode 100644 package/ffmpeg/0003-libavutil-Fix-mips-build.patch delete mode 100644 package/ffmpeg/0004-configure-add-extralibs-to-extralibs_xxx.patch create mode 100644 package/vpu-lib/Config.in create mode 100644 package/vpu-lib/vpu-lib.mk diff --git a/README.md b/README.md index 55ae010a..00e0df44 100644 --- a/README.md +++ b/README.md @@ -232,14 +232,4 @@ chown -R user:user /home/user ``` 将user用户加入audio组,可解决user用户下没声音的问题 gpasswd -a user audio - -如果经过上述配置后还是没声音,或者在root用户下没声音,需要配置寄存器 -(1)uboot命令行增加: -mw 0x32b30240 0x46; mw 0x32b30244 0x46; -(2)使用devmem2配置寄存器 -devmem2 0x32b30210 w 0x71 -devmem2 0x32b30214 w 0x71 -devmem2 0x32b30218 w 0x71 -devmem2 0x32b3021c w 0x71 -devmem2 0x32b30220 w 0x71 -``` \ No newline at end of file +``` diff --git a/board/phytium/common/debian-package-installer b/board/phytium/common/debian-package-installer index 916b7d11..81faa92e 100755 --- a/board/phytium/common/debian-package-installer +++ b/board/phytium/common/debian-package-installer @@ -86,6 +86,7 @@ do_distrorfs_second_stage() { [ -f /usr/bin/sudo -a ! -u /usr/bin/sudo ] && chmod +s /usr/bin/sudo [ -d /var/cache/man ] && chown -R man:root /var/cache/man [ -d /var/lib/sddm ] && chown -R sddm:sddm /var/lib/sddm + [ -L /lib/lib ] && rm -rf /lib/lib # some shared libraries locate in /lib/aarch64-linux-gnu(or /lib/arm-linux-gnueabihf) and /usr/local/lib echo export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/$sysarch:/lib/$sysarch >> /etc/profile diff --git a/board/phytium/common/post-custom-skeleton-debian-base-11.sh b/board/phytium/common/post-custom-skeleton-debian-base-11.sh index 02de3f8f..d9fc4c31 100755 --- a/board/phytium/common/post-custom-skeleton-debian-base-11.sh +++ b/board/phytium/common/post-custom-skeleton-debian-base-11.sh @@ -78,7 +78,7 @@ do_distrorfs_first_stage() { if [ ! -d $RFSDIR/debootstrap ]; then echo "testdeboot" export LANG=zh_CN.UTF-8 - sudo debootstrap --arch=$1 --foreign bullseye $RFSDIR http://ftp.cn.debian.org/debian/ + sudo debootstrap --arch=$1 --foreign bullseye $RFSDIR http://mirrors.163.com/debian/ echo "installing for second-stage ..." export LC_ALL="zh_CN.UTF-8" && export LANGUAGE="zh_CN:zh" && export LANG="zh_CN.UTF-8" diff --git a/board/phytium/common/post-custom-skeleton-ubuntu-base-20.04.sh b/board/phytium/common/post-custom-skeleton-ubuntu-base-20.04.sh index c0461319..63e22d90 100755 --- a/board/phytium/common/post-custom-skeleton-ubuntu-base-20.04.sh +++ b/board/phytium/common/post-custom-skeleton-ubuntu-base-20.04.sh @@ -99,7 +99,13 @@ do_distrorfs_first_stage() { fi # sudo chroot $RFSDIR systemctl enable systemd-rootfs-resize + file_s=$(sudo find $RFSDIR -perm -4000) sudo chown -R $USER:$GROUPS $RFSDIR + for f in $file_s; do + sudo chmod u+s $f + done + sudo chmod u+s $RFSDIR/sbin/unix_chkpwd + if dpkg-query -l snapd | grep ii 1>/dev/null; then chmod +rw -R $RFSDIR/var/lib/snapd/ fi @@ -237,6 +243,14 @@ main() sudo chroot ${1} systemctl enable systemd-rootfs-chown.service fi + if grep -Eq "^BR2_PACKAGE_VPU_LIB=y$" ${BR2_CONFIG}; then + make vpu-lib-rebuild ${O:+O=$O} + fi + + if grep -Eq "^BR2_PACKAGE_FFMPEG=y$" ${BR2_CONFIG}; then + make ffmpeg-rebuild ${O:+O=$O} + fi + exit $? } diff --git a/board/phytium/common/ubuntu-additional_packages_list b/board/phytium/common/ubuntu-additional_packages_list index 0f2190c5..929bee45 100644 --- a/board/phytium/common/ubuntu-additional_packages_list +++ b/board/phytium/common/ubuntu-additional_packages_list @@ -1,6 +1,6 @@ - # additional packages list for SDK main userland gathered from main repo additional_full_packages_list=" " # for Lite userland gathered from main repo -additional_base_packages_list="net-tools iputils-ping gcc vim make autoconf automake bison bc flex libssl-dev" +additional_base_packages_list="net-tools iputils-ping gcc vim make autoconf automake bison bc flex libssl-dev \ +libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio " diff --git a/configs/phytium_d2000_debian_defconfig b/configs/phytium_d2000_debian_defconfig index 9d63d067..7588dc63 100644 --- a/configs/phytium_d2000_debian_defconfig +++ b/configs/phytium_d2000_debian_defconfig @@ -64,3 +64,7 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_XORG_ROGUE_UMLIBS=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="d2000" diff --git a/configs/phytium_d2000_debian_desktop_defconfig b/configs/phytium_d2000_debian_desktop_defconfig index 1fccc31e..cac7452e 100644 --- a/configs/phytium_d2000_debian_desktop_defconfig +++ b/configs/phytium_d2000_debian_desktop_defconfig @@ -65,3 +65,10 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_ROOTFS_DESKTOP=y BR2_PACKAGE_XORG_ROGUE_UMLIBS=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="d2000" + +# FFmpeg +BR2_PACKAGE_FFMPEG=y diff --git a/configs/phytium_d2000_defconfig b/configs/phytium_d2000_defconfig index aed6c810..f986589c 100644 --- a/configs/phytium_d2000_defconfig +++ b/configs/phytium_d2000_defconfig @@ -131,3 +131,7 @@ BR2_PACKAGE_LIBOPEN62541=y BR2_PACKAGE_LIBOPEN62541_BUILD_EXAMPLES=y BR2_PACKAGE_XORG_ROGUE_UMLIBS=y + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="d2000" diff --git a/configs/phytium_d2000_ubuntu_defconfig b/configs/phytium_d2000_ubuntu_defconfig index a82f5969..4b751cb7 100644 --- a/configs/phytium_d2000_ubuntu_defconfig +++ b/configs/phytium_d2000_ubuntu_defconfig @@ -65,3 +65,10 @@ BR2_PACKAGE_HOST_MTOOLS=y #BR2_PACKAGE_ROOTFS_DESKTOP=y BR2_PACKAGE_XORG_ROGUE_UMLIBS=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="d2000" + +# FFmpeg +BR2_PACKAGE_FFMPEG=y diff --git a/configs/phytium_e2000_debian_defconfig b/configs/phytium_e2000_debian_defconfig index 8af72f54..a03982a6 100644 --- a/configs/phytium_e2000_debian_defconfig +++ b/configs/phytium_e2000_debian_defconfig @@ -59,3 +59,7 @@ BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="e2000" diff --git a/configs/phytium_e2000_debian_desktop_defconfig b/configs/phytium_e2000_debian_desktop_defconfig index eac8aca4..e6ba2542 100644 --- a/configs/phytium_e2000_debian_desktop_defconfig +++ b/configs/phytium_e2000_debian_desktop_defconfig @@ -60,3 +60,10 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_ROOTFS_DESKTOP=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="e2000" + +# FFmpeg +BR2_PACKAGE_FFMPEG=y diff --git a/configs/phytium_e2000_defconfig b/configs/phytium_e2000_defconfig index 9a1459e6..87755fd8 100644 --- a/configs/phytium_e2000_defconfig +++ b/configs/phytium_e2000_defconfig @@ -57,3 +57,5 @@ BR2_TARGET_GRUB2=y BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="e2000" diff --git a/configs/phytium_e2000_ubuntu_defconfig b/configs/phytium_e2000_ubuntu_defconfig index 867ce150..0dfbd1f9 100644 --- a/configs/phytium_e2000_ubuntu_defconfig +++ b/configs/phytium_e2000_ubuntu_defconfig @@ -59,3 +59,7 @@ BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="e2000" diff --git a/configs/phytium_e2000_ubuntu_desktop_defconfig b/configs/phytium_e2000_ubuntu_desktop_defconfig index ff7062ba..dd958e9f 100644 --- a/configs/phytium_e2000_ubuntu_desktop_defconfig +++ b/configs/phytium_e2000_ubuntu_desktop_defconfig @@ -60,3 +60,10 @@ BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_ROOTFS_DESKTOP=y BR2_PACKAGE_BUSYBOX=n + +# Vpu-lib +BR2_PACKAGE_VPU_LIB=y +BR2_PACKAGE_VPU_LIB_CPU_MODEL="e2000" + +# FFmpeg +BR2_PACKAGE_FFMPEG=y diff --git a/package/Config.in b/package/Config.in index b3f427c0..12c5510b 100644 --- a/package/Config.in +++ b/package/Config.in @@ -437,6 +437,7 @@ menu "Firmware" source "package/wilink-bt-firmware/Config.in" source "package/zd1211-firmware/Config.in" source "package/xorg-rogue-umlibs/Config.in" + source "package/vpu-lib/Config.in" endmenu source "package/18xx-ti-utils/Config.in" source "package/a10disp/Config.in" diff --git a/package/ffmpeg/0001-Add-ftomx-plugin-for-vpu-hardware-decoder.patch b/package/ffmpeg/0001-Add-ftomx-plugin-for-vpu-hardware-decoder.patch new file mode 100755 index 00000000..1c4d2908 --- /dev/null +++ b/package/ffmpeg/0001-Add-ftomx-plugin-for-vpu-hardware-decoder.patch @@ -0,0 +1,9050 @@ +From 1bdc339379b383cfb9ead7559b6d0871444234e9 Mon Sep 17 00:00:00 2001 +From: libowen +Date: Tue, 13 Dec 2022 18:20:11 +0800 +Subject: [PATCH] Add ftomx plugin for vpu hardware decoder. + +Signed-off-by: libowen +--- + configure | 4 + + libavcodec/Makefile | 14 +- + libavcodec/OMX_Audio.h | 1344 +++++++++++++++++++++++++++ + libavcodec/OMX_Component.h | 596 ++++++++++++ + libavcodec/OMX_ContentPipe.h | 212 +++++ + libavcodec/OMX_Core.h | 1507 ++++++++++++++++++++++++++++++ + libavcodec/OMX_IVCommon.h | 966 +++++++++++++++++++ + libavcodec/OMX_Image.h | 346 +++++++ + libavcodec/OMX_Index.h | 280 ++++++ + libavcodec/OMX_Other.h | 354 +++++++ + libavcodec/OMX_Types.h | 393 ++++++++ + libavcodec/OMX_Video.h | 1098 ++++++++++++++++++++++ + libavcodec/allcodecs.c | 14 + + libavcodec/ftomx.c | 1699 ++++++++++++++++++++++++++++++++++ + 14 files changed, 8826 insertions(+), 1 deletion(-) + create mode 100755 libavcodec/OMX_Audio.h + create mode 100755 libavcodec/OMX_Component.h + create mode 100755 libavcodec/OMX_ContentPipe.h + create mode 100755 libavcodec/OMX_Core.h + create mode 100755 libavcodec/OMX_IVCommon.h + create mode 100755 libavcodec/OMX_Image.h + create mode 100755 libavcodec/OMX_Index.h + create mode 100755 libavcodec/OMX_Other.h + create mode 100755 libavcodec/OMX_Types.h + create mode 100755 libavcodec/OMX_Video.h + create mode 100755 libavcodec/ftomx.c + +diff --git a/configure b/configure +index 6a7a85c..d0a3cc4 100755 +--- a/configure ++++ b/configure +@@ -334,6 +334,7 @@ External library support: + --disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect] + --disable-nvenc disable Nvidia video encoding code [autodetect] + --enable-omx enable OpenMAX IL code [no] ++ --enable-ftomx enable FT OpenMAX IL code [no] + --enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] + --enable-rkmpp enable Rockchip Media Process Platform code [no] + --disable-v4l2-m2m disable V4L2 mem2mem code [autodetect] +@@ -1850,6 +1851,7 @@ HWACCEL_LIBRARY_LIST=" + libmfx + mmal + omx ++ ftomx + opencl + " + +@@ -2983,6 +2985,7 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" + + # hardware-accelerated codecs + omx_deps="libdl pthreads" ++ftomx_deps="libdl pthreads" + omx_rpi_select="omx" + qsv_deps="libmfx" + qsvdec_select="qsv" +@@ -6350,6 +6353,7 @@ enabled opengl && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL + die "ERROR: opengl not found." + } + enabled omx && require_headers OMX_Core.h ++enabled ftomx + enabled omx_rpi && { check_headers OMX_Core.h || + { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_headers OMX_Core.h ; } || + die "ERROR: OpenMAX IL headers not found"; } && enable omx +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 3cd73fb..d566e3c 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -241,6 +241,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o + OBJS-$(CONFIG_C93_DECODER) += c93.o + OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ + cavsdata.o ++OBJS-$(CONFIG_CAVS_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_CCAPTION_DECODER) += ccaption_dec.o + OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o + OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o +@@ -338,6 +339,7 @@ OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261data.o h261.o + OBJS-$(CONFIG_H263_DECODER) += h263dec.o h263.o ituh263dec.o \ + mpeg4video.o mpeg4videodec.o flvdec.o\ + intelh263dec.o h263data.o ++OBJS-$(CONFIG_H263_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_H263_ENCODER) += mpeg4videoenc.o mpeg4video.o \ + h263.o ituh263enc.o flvenc.o h263data.o + OBJS-$(CONFIG_H263_V4L2M2M_DECODER) += v4l2_m2m_dec.o +@@ -355,6 +357,7 @@ OBJS-$(CONFIG_H264_NVENC_ENCODER) += nvenc_h264.o + OBJS-$(CONFIG_NVENC_ENCODER) += nvenc_h264.o + OBJS-$(CONFIG_NVENC_H264_ENCODER) += nvenc_h264.o + OBJS-$(CONFIG_H264_OMX_ENCODER) += omx.o ++OBJS-$(CONFIG_H264_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec_h2645.o + OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o + OBJS-$(CONFIG_H264_RKMPP_DECODER) += rkmppdec.o +@@ -368,6 +371,7 @@ OBJS-$(CONFIG_HCOM_DECODER) += hcom.o + OBJS-$(CONFIG_HEVC_DECODER) += hevcdec.o hevc_mvs.o \ + hevc_cabac.o hevc_refs.o hevcpred.o \ + hevcdsp.o hevc_filter.o hevc_data.o ++OBJS-$(CONFIG_HEVC_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_HEVC_AMF_ENCODER) += amfenc_hevc.o + OBJS-$(CONFIG_HEVC_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_HEVC_MEDIACODEC_DECODER) += mediacodecdec.o +@@ -462,6 +466,7 @@ OBJS-$(CONFIG_MPEG2_MMAL_DECODER) += mmaldec.o + OBJS-$(CONFIG_MPEG2_QSV_DECODER) += qsvdec_other.o + OBJS-$(CONFIG_MPEG2_QSV_ENCODER) += qsvenc_mpeg2.o + OBJS-$(CONFIG_MPEG2VIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o ++OBJS-$(CONFIG_MPEG2VIDEO_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpeg12.o + OBJS-$(CONFIG_MPEG2_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_MPEG2_MEDIACODEC_DECODER) += mediacodecdec.o +@@ -470,7 +475,8 @@ OBJS-$(CONFIG_MPEG2_V4L2M2M_DECODER) += v4l2_m2m_dec.o + OBJS-$(CONFIG_MPEG4_DECODER) += xvididct.o + OBJS-$(CONFIG_MPEG4_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_MPEG4_MEDIACODEC_DECODER) += mediacodecdec.o +-OBJS-$(CONFIG_MPEG4_OMX_ENCODER) += omx.o ++OBJS-$(CONFIG_MPEG4_OMX_CODER) += omx.o ++OBJS-$(CONFIG_MPEG4_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_MPEG4_V4L2M2M_DECODER) += v4l2_m2m_dec.o + OBJS-$(CONFIG_MPEG4_V4L2M2M_ENCODER) += v4l2_m2m_enc.o + OBJS-$(CONFIG_MPL2_DECODER) += mpl2dec.o ass.o +@@ -561,7 +567,9 @@ OBJS-$(CONFIG_RV10_ENCODER) += rv10enc.o + OBJS-$(CONFIG_RV20_DECODER) += rv10.o + OBJS-$(CONFIG_RV20_ENCODER) += rv20enc.o + OBJS-$(CONFIG_RV30_DECODER) += rv30.o rv34.o rv30dsp.o ++OBJS-$(CONFIG_RV30_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_RV40_DECODER) += rv40.o rv34.o rv40dsp.o ++OBJS-$(CONFIG_RV40_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_SAMI_DECODER) += samidec.o ass.o htmlsubtitles.o + OBJS-$(CONFIG_S302M_DECODER) += s302m.o + OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o +@@ -653,6 +661,7 @@ OBJS-$(CONFIG_VC1_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_VC1_MMAL_DECODER) += mmaldec.o + OBJS-$(CONFIG_VC1_QSV_DECODER) += qsvdec_other.o + OBJS-$(CONFIG_VC1_V4L2M2M_DECODER) += v4l2_m2m_dec.o ++OBJS-$(CONFIG_VC1_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_VC2_ENCODER) += vc2enc.o vc2enc_dwt.o diractab.o + OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o + OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdaudio.o +@@ -666,8 +675,10 @@ OBJS-$(CONFIG_VP3_DECODER) += vp3.o + OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o vp56rac.o + OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \ + vp6dsp.o vp56rac.o ++OBJS-$(CONFIG_VP6_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o + OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o ++OBJS-$(CONFIG_VP8_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_VP8_CUVID_DECODER) += cuviddec.o + OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER) += mediacodecdec.o + OBJS-$(CONFIG_VP8_QSV_DECODER) += qsvdec_other.o +@@ -982,6 +993,7 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o + OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o + OBJS-$(CONFIG_LIBOPENH264_DECODER) += libopenh264dec.o libopenh264.o + OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o ++OBJS-$(CONFIG_FLV_FTOMX_DECODER) += ftomx.o + OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o + OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o + OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \ +diff --git a/libavcodec/OMX_Audio.h b/libavcodec/OMX_Audio.h +new file mode 100755 +index 0000000..cfdb39f +--- /dev/null ++++ b/libavcodec/OMX_Audio.h +@@ -0,0 +1,1344 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/* ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** @file OMX_Audio.h - OpenMax IL version 1.1.2 ++ * The structures needed by Audio components to exchange ++ * parameters and configuration data with the componenmilts. ++ */ ++ ++#ifndef OMX_Audio_h ++#define OMX_Audio_h ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++/* Each OMX header must include all required header files to allow the ++ * header to compile without errors. The includes below are required ++ * for this header file to compile successfully ++ */ ++ ++#include "OMX_Core.h" ++ ++/** @defgroup midi MIDI ++ * @ingroup audio ++ */ ++ ++/** @defgroup effects Audio effects ++ * @ingroup audio ++ */ ++ ++/** @defgroup audio OpenMAX IL Audio Domain ++ * Structures for OpenMAX IL Audio domain ++ * @{ ++ */ ++ ++/** Enumeration used to define the possible audio codings. ++ * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must ++ * be done in a vendor specific way. Since this is for an audio ++ * processing element this enum is relevant. However, for another ++ * type of component other enums would be in this area. ++ */ ++typedef enum OMX_AUDIO_CODINGTYPE { ++ OMX_AUDIO_CodingUnused = 0, /**< Placeholder value when coding is N/A */ ++ OMX_AUDIO_CodingAutoDetect, /**< auto detection of audio format */ ++ OMX_AUDIO_CodingPCM, /**< Any variant of PCM coding */ ++ OMX_AUDIO_CodingADPCM, /**< Any variant of ADPCM encoded data */ ++ OMX_AUDIO_CodingAMR, /**< Any variant of AMR encoded data */ ++ OMX_AUDIO_CodingGSMFR, /**< Any variant of GSM fullrate (i.e. GSM610) */ ++ OMX_AUDIO_CodingGSMEFR, /**< Any variant of GSM Enhanced Fullrate encoded data*/ ++ OMX_AUDIO_CodingGSMHR, /**< Any variant of GSM Halfrate encoded data */ ++ OMX_AUDIO_CodingPDCFR, /**< Any variant of PDC Fullrate encoded data */ ++ OMX_AUDIO_CodingPDCEFR, /**< Any variant of PDC Enhanced Fullrate encoded data */ ++ OMX_AUDIO_CodingPDCHR, /**< Any variant of PDC Halfrate encoded data */ ++ OMX_AUDIO_CodingTDMAFR, /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */ ++ OMX_AUDIO_CodingTDMAEFR, /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */ ++ OMX_AUDIO_CodingQCELP8, /**< Any variant of QCELP 8kbps encoded data */ ++ OMX_AUDIO_CodingQCELP13, /**< Any variant of QCELP 13kbps encoded data */ ++ OMX_AUDIO_CodingEVRC, /**< Any variant of EVRC encoded data */ ++ OMX_AUDIO_CodingSMV, /**< Any variant of SMV encoded data */ ++ OMX_AUDIO_CodingG711, /**< Any variant of G.711 encoded data */ ++ OMX_AUDIO_CodingG723, /**< Any variant of G.723 dot 1 encoded data */ ++ OMX_AUDIO_CodingG726, /**< Any variant of G.726 encoded data */ ++ OMX_AUDIO_CodingG729, /**< Any variant of G.729 encoded data */ ++ OMX_AUDIO_CodingAAC, /**< Any variant of AAC encoded data */ ++ OMX_AUDIO_CodingMP3, /**< Any variant of MP3 encoded data */ ++ OMX_AUDIO_CodingSBC, /**< Any variant of SBC encoded data */ ++ OMX_AUDIO_CodingVORBIS, /**< Any variant of VORBIS encoded data */ ++ OMX_AUDIO_CodingWMA, /**< Any variant of WMA encoded data */ ++ OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */ ++ OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */ ++ OMX_AUDIO_CodingFLAC, /**< Any variant of FLAC encoded data */ ++ OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_CodingMax = 0x7FFFFFFF ++} OMX_AUDIO_CODINGTYPE; ++ ++ ++/** The PortDefinition structure is used to define all of the parameters ++ * necessary for the compliant component to setup an input or an output audio ++ * path. If additional information is needed to define the parameters of the ++ * port (such as frequency), additional structures must be sent such as the ++ * OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port. ++ */ ++typedef struct OMX_AUDIO_PORTDEFINITIONTYPE { ++ OMX_STRING cMIMEType; /**< MIME type of data for the port */ ++ OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference ++ for an output device, ++ otherwise this field is 0 */ ++ OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is ++ supported by the OMX component */ ++ OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this ++ port (e.g. PCM, AMR, MP3, etc) */ ++} OMX_AUDIO_PORTDEFINITIONTYPE; ++ ++ ++/** Port format parameter. This structure is used to enumerate ++ * the various data input/output format supported by the port. ++ */ ++typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Indicates which port to set */ ++ OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */ ++ OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */ ++} OMX_AUDIO_PARAM_PORTFORMATTYPE; ++ ++ ++/** PCM mode type */ ++typedef enum OMX_AUDIO_PCMMODETYPE { ++ OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */ ++ OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */ ++ OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */ ++ OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_PCMModeMax = 0x7FFFFFFF ++} OMX_AUDIO_PCMMODETYPE; ++ ++ ++typedef enum OMX_AUDIO_CHANNELTYPE { ++ OMX_AUDIO_ChannelNone = 0x0, /**< Unused or empty */ ++ OMX_AUDIO_ChannelLF = 0x1, /**< Left front */ ++ OMX_AUDIO_ChannelRF = 0x2, /**< Right front */ ++ OMX_AUDIO_ChannelCF = 0x3, /**< Center front */ ++ OMX_AUDIO_ChannelLS = 0x4, /**< Left surround */ ++ OMX_AUDIO_ChannelRS = 0x5, /**< Right surround */ ++ OMX_AUDIO_ChannelLFE = 0x6, /**< Low frequency effects */ ++ OMX_AUDIO_ChannelCS = 0x7, /**< Back surround */ ++ OMX_AUDIO_ChannelLR = 0x8, /**< Left rear. */ ++ OMX_AUDIO_ChannelRR = 0x9, /**< Right rear. */ ++ OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_ChannelMax = 0x7FFFFFFF ++} OMX_AUDIO_CHANNELTYPE; ++ ++#define OMX_AUDIO_MAXCHANNELS 16 /**< maximum number distinct audio channels that a buffer may contain */ ++#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */ ++ ++/** PCM format description */ ++typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { ++ OMX_U32 nSize; /**< Size of this structure, in Bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */ ++ OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed, unsigned or floating pt. */ ++ OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */ ++ OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for ++ non-interleaved data (e.g. block data) */ ++ OMX_U32 nBitPerSample; /**< Bit per sample */ ++ OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++ OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */ ++ OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */ ++ ++} OMX_AUDIO_PARAM_PCMMODETYPE; ++ ++ ++/** Audio channel mode. This is used by both AAC and MP3, although the names are more appropriate ++ * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC. ++ */ ++typedef enum OMX_AUDIO_CHANNELMODETYPE { ++ OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those ++ two channels changes accordingly to each channel information */ ++ OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between ++ 2 channels for higher compression gain */ ++ OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half ++ the bitrate of the overall bitrate */ ++ OMX_AUDIO_ChannelModeMono, /**< Mono channel mode */ ++ OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF ++} OMX_AUDIO_CHANNELMODETYPE; ++ ++ ++typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE { ++ OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */ ++ OMX_AUDIO_MP3StreamFormatMP2Layer3, /**< MP3 Audio MPEG 2 Layer 3 Stream format */ ++ OMX_AUDIO_MP3StreamFormatMP2_5Layer3, /**< MP3 Audio MPEG2.5 Layer 3 Stream format */ ++ OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_MP3STREAMFORMATTYPE; ++ ++/** MP3 params */ ++typedef struct OMX_AUDIO_PARAM_MP3TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable ++ rate or unknown bit rates */ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++ OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should ++ limit the audio signal. Use 0 to let encoder decide */ ++ OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ ++ OMX_AUDIO_MP3STREAMFORMATTYPE eFormat; /**< MP3 stream format */ ++} OMX_AUDIO_PARAM_MP3TYPE; ++ ++ ++typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE { ++ OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */ ++ OMX_AUDIO_AACStreamFormatMP4ADTS, /**< AAC Audio Data Transport Stream 4 format */ ++ OMX_AUDIO_AACStreamFormatMP4LOAS, /**< AAC Low Overhead Audio Stream format */ ++ OMX_AUDIO_AACStreamFormatMP4LATM, /**< AAC Low overhead Audio Transport Multiplex */ ++ OMX_AUDIO_AACStreamFormatADIF, /**< AAC Audio Data Interchange Format */ ++ OMX_AUDIO_AACStreamFormatMP4FF, /**< AAC inside MPEG-4/ISO File Format */ ++ OMX_AUDIO_AACStreamFormatRAW, /**< AAC Raw Format */ ++ OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_AACSTREAMFORMATTYPE; ++ ++ ++/** AAC mode type. Note that the term profile is used with the MPEG-2 ++ * standard and the term object type and profile is used with MPEG-4 */ ++typedef enum OMX_AUDIO_AACPROFILETYPE{ ++ OMX_AUDIO_AACObjectNull = 0, /**< Null, not used */ ++ OMX_AUDIO_AACObjectMain = 1, /**< AAC Main object */ ++ OMX_AUDIO_AACObjectLC, /**< AAC Low Complexity object (AAC profile) */ ++ OMX_AUDIO_AACObjectSSR, /**< AAC Scalable Sample Rate object */ ++ OMX_AUDIO_AACObjectLTP, /**< AAC Long Term Prediction object */ ++ OMX_AUDIO_AACObjectHE, /**< AAC High Efficiency (object type SBR, HE-AAC profile) */ ++ OMX_AUDIO_AACObjectScalable, /**< AAC Scalable object */ ++ OMX_AUDIO_AACObjectERLC = 17, /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */ ++ OMX_AUDIO_AACObjectER_Scalable = 20, /**< ER AAC scalable object */ ++ OMX_AUDIO_AACObjectLD = 23, /**< AAC Low Delay object (Error Resilient) */ ++ OMX_AUDIO_AACObjectHE_PS = 29, /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */ ++ OMX_AUDIO_AACObjectELD = 39, /** AAC Enhanced Low Delay. NOTE: Pending Khronos standardization **/ ++ OMX_AUDIO_AACObjectXHE = 42, /** extended High Efficiency AAC. NOTE: Pending Khronos standardization */ ++ OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_AACObjectMax = 0x7FFFFFFF ++} OMX_AUDIO_AACPROFILETYPE; ++ ++ ++/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE). ++ * Required for encoder configuration and optional as decoder info output. ++ * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */ ++#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */ ++#define OMX_AUDIO_AACToolMS 0x00000001 /**< MS: Mid/side joint coding tool allowed or active */ ++#define OMX_AUDIO_AACToolIS 0x00000002 /**< IS: Intensity stereo tool allowed or active */ ++#define OMX_AUDIO_AACToolTNS 0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */ ++#define OMX_AUDIO_AACToolPNS 0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */ ++#define OMX_AUDIO_AACToolLTP 0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */ ++#define OMX_AUDIO_AACToolVendor 0x00010000 /**< NOT A KHRONOS VALUE, offset for vendor-specific additions */ ++#define OMX_AUDIO_AACToolAll 0x7FFFFFFF /**< all AAC tools allowed or active (*/ ++ ++/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE). ++ * Required for ER encoder configuration and optional as decoder info output */ ++#define OMX_AUDIO_AACERNone 0x00000000 /**< no AAC ER tools allowed/used */ ++#define OMX_AUDIO_AACERVCB11 0x00000001 /**< VCB11: Virtual Code Books for AAC section data */ ++#define OMX_AUDIO_AACERRVLC 0x00000002 /**< RVLC: Reversible Variable Length Coding */ ++#define OMX_AUDIO_AACERHCR 0x00000004 /**< HCR: Huffman Codeword Reordering */ ++#define OMX_AUDIO_AACERAll 0x7FFFFFFF /**< all AAC ER tools allowed/used */ ++ ++ ++/** AAC params */ ++typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE { ++ OMX_U32 nSize; /**< Size of this structure, in Bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable ++ rate or unknown bit rates */ ++ OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should ++ limit the audio signal. Use 0 to let encoder decide */ ++ OMX_U32 nFrameLength; /**< Frame length (in audio samples per channel) of the codec. ++ Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD). ++ Use 0 to let encoder decide */ ++ OMX_U32 nAACtools; /**< AAC tool usage */ ++ OMX_U32 nAACERtools; /**< MPEG-4 AAC error resilience tool usage */ ++ OMX_AUDIO_AACPROFILETYPE eAACProfile; /**< AAC profile enumeration */ ++ OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */ ++ OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ ++} OMX_AUDIO_PARAM_AACPROFILETYPE; ++ ++ ++/** VORBIS params */ ++typedef struct OMX_AUDIO_PARAM_VORBISTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nBitRate; /**< Bit rate of the encoded data data. Use 0 for variable ++ rate or unknown bit rates. Encoding is set to the ++ bitrate closest to specified value (in bps) */ ++ OMX_U32 nMinBitRate; /**< Sets minimum bitrate (in bps). */ ++ OMX_U32 nMaxBitRate; /**< Sets maximum bitrate (in bps). */ ++ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++ OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should ++ limit the audio signal. Use 0 to let encoder decide */ ++ OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high). ++ In the default mode of operation, teh quality level is 3. ++ Normal quality range is 0 - 10. */ ++ OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the ++ normal VBR encoding, but allows hard or soft bitrate ++ constraints to be enforced by the encoder. This mode can ++ be slower, and may also be lower quality. It is ++ primarily useful for streaming. */ ++ OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on ++ non-stereo streams). Useful for lower-bitrate encoding. */ ++} OMX_AUDIO_PARAM_VORBISTYPE; ++ ++ ++/** FLAC params */ ++typedef struct OMX_AUDIO_PARAM_FLACTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ unknown sampling rate. */ ++ OMX_U32 nCompressionLevel;/**< FLAC compression level, from 0 (fastest compression) ++ to 8 (highest compression */ ++} OMX_AUDIO_PARAM_FLACTYPE; ++ ++ ++/** WMA Version */ ++typedef enum OMX_AUDIO_WMAFORMATTYPE { ++ OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */ ++ OMX_AUDIO_WMAFormat7, /**< Windows Media Audio format 7 */ ++ OMX_AUDIO_WMAFormat8, /**< Windows Media Audio format 8 */ ++ OMX_AUDIO_WMAFormat9, /**< Windows Media Audio format 9 */ ++ OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_WMAFORMATTYPE; ++ ++ ++/** WMA Profile */ ++typedef enum OMX_AUDIO_WMAPROFILETYPE { ++ OMX_AUDIO_WMAProfileUnused = 0, /**< profile unused or unknown */ ++ OMX_AUDIO_WMAProfileL1, /**< Windows Media audio version 9 profile L1 */ ++ OMX_AUDIO_WMAProfileL2, /**< Windows Media audio version 9 profile L2 */ ++ OMX_AUDIO_WMAProfileL3, /**< Windows Media audio version 9 profile L3 */ ++ OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF ++} OMX_AUDIO_WMAPROFILETYPE; ++ ++ ++/** WMA params */ ++typedef struct OMX_AUDIO_PARAM_WMATYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U16 nChannels; /**< Number of channels */ ++ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable ++ rate or unknown bit rates */ ++ OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */ ++ OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */ ++ OMX_U32 nSamplingRate; /**< Sampling rate of the source data */ ++ OMX_U16 nBlockAlign; /**< is the block alignment, or block size, in bytes of the audio codec */ ++ OMX_U16 nEncodeOptions; /**< WMA Type-specific data */ ++ OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */ ++} OMX_AUDIO_PARAM_WMATYPE; ++ ++/** ++ * RealAudio format ++ */ ++typedef enum OMX_AUDIO_RAFORMATTYPE { ++ OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */ ++ OMX_AUDIO_RA8, /**< RealAudio 8 codec */ ++ OMX_AUDIO_RA9, /**< RealAudio 9 codec */ ++ OMX_AUDIO_RA10_AAC, /**< MPEG-4 AAC codec for bitrates of more than 128kbps */ ++ OMX_AUDIO_RA10_CODEC, /**< RealAudio codec for bitrates less than 128 kbps */ ++ OMX_AUDIO_RA10_LOSSLESS, /**< RealAudio Lossless */ ++ OMX_AUDIO_RA10_MULTICHANNEL, /**< RealAudio Multichannel */ ++ OMX_AUDIO_RA10_VOICE, /**< RealAudio Voice for bitrates below 15 kbps */ ++ OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_RAFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_RAFORMATTYPE; ++ ++/** RA (Real Audio) params */ ++typedef struct OMX_AUDIO_PARAM_RATYPE { ++ OMX_U32 nSize; /**< Size of this structure, in Bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */ ++ OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */ ++ OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */ ++ OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ ++ OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */ ++ OMX_U32 nNumRegions; /**< is the number of regions value */ ++ OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */ ++} OMX_AUDIO_PARAM_RATYPE; ++ ++ ++/** SBC Allocation Method Type */ ++typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE { ++ OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */ ++ OMX_AUDIO_SBCAllocMethodSNR, /**< SNR allocation method */ ++ OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF ++} OMX_AUDIO_SBCALLOCMETHODTYPE; ++ ++ ++/** SBC params */ ++typedef struct OMX_AUDIO_PARAM_SBCTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable ++ rate or unknown bit rates */ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++ OMX_U32 nBlocks; /**< Number of blocks */ ++ OMX_U32 nSubbands; /**< Number of subbands */ ++ OMX_U32 nBitPool; /**< Bitpool value */ ++ OMX_BOOL bEnableBitrate; /**< Use bitrate value instead of bitpool */ ++ OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */ ++ OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType; /**< SBC Allocation method type */ ++} OMX_AUDIO_PARAM_SBCTYPE; ++ ++ ++/** ADPCM stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_U32 nBitsPerSample; /**< Number of bits in each sample */ ++ OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for ++ variable or unknown sampling rate. */ ++} OMX_AUDIO_PARAM_ADPCMTYPE; ++ ++ ++/** G723 rate */ ++typedef enum OMX_AUDIO_G723RATE { ++ OMX_AUDIO_G723ModeUnused = 0, /**< AMRNB Mode unused / unknown */ ++ OMX_AUDIO_G723ModeLow, /**< 5300 bps */ ++ OMX_AUDIO_G723ModeHigh, /**< 6300 bps */ ++ OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_G723ModeMax = 0x7FFFFFFF ++} OMX_AUDIO_G723RATE; ++ ++ ++/** G723 - Sample rate must be 8 KHz */ ++typedef struct OMX_AUDIO_PARAM_G723TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_AUDIO_G723RATE eBitRate; /**< todo: Should this be moved to a config? */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++ OMX_BOOL bPostFilter; /**< Enable Post Filter */ ++} OMX_AUDIO_PARAM_G723TYPE; ++ ++ ++/** ITU G726 (ADPCM) rate */ ++typedef enum OMX_AUDIO_G726MODE { ++ OMX_AUDIO_G726ModeUnused = 0, /**< G726 Mode unused / unknown */ ++ OMX_AUDIO_G726Mode16, /**< 16 kbps */ ++ OMX_AUDIO_G726Mode24, /**< 24 kbps */ ++ OMX_AUDIO_G726Mode32, /**< 32 kbps, most common rate, also G721 */ ++ OMX_AUDIO_G726Mode40, /**< 40 kbps */ ++ OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_G726ModeMax = 0x7FFFFFFF ++} OMX_AUDIO_G726MODE; ++ ++ ++/** G.726 stream format parameters - must be at 8KHz */ ++typedef struct OMX_AUDIO_PARAM_G726TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_AUDIO_G726MODE eG726Mode; ++} OMX_AUDIO_PARAM_G726TYPE; ++ ++ ++/** G729 coder type */ ++typedef enum OMX_AUDIO_G729TYPE { ++ OMX_AUDIO_G729 = 0, /**< ITU G.729 encoded data */ ++ OMX_AUDIO_G729A, /**< ITU G.729 annex A encoded data */ ++ OMX_AUDIO_G729B, /**< ITU G.729 with annex B encoded data */ ++ OMX_AUDIO_G729AB, /**< ITU G.729 annexes A and B encoded data */ ++ OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_G729Max = 0x7FFFFFFF ++} OMX_AUDIO_G729TYPE; ++ ++ ++/** G729 stream format parameters - fixed 6KHz sample rate */ ++typedef struct OMX_AUDIO_PARAM_G729TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_AUDIO_G729TYPE eBitType; ++} OMX_AUDIO_PARAM_G729TYPE; ++ ++ ++/** AMR Frame format */ ++typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { ++ OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance ++ (Standard) Format */ ++ OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface ++ Format 1 */ ++ OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface ++ Format 2*/ ++ OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage ++ Format */ ++ OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time ++ Transport Protocol Payload Format */ ++ OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */ ++ OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_AMRFRAMEFORMATTYPE; ++ ++ ++/** AMR band mode */ ++typedef enum OMX_AUDIO_AMRBANDMODETYPE { ++ OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */ ++ OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */ ++ OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */ ++ OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */ ++ OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */ ++ OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */ ++ OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */ ++ OMX_AUDIO_AMRBandModeNB6, /**< AMRNB Mode 6 = 10200 bps */ ++ OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */ ++ OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */ ++ OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */ ++ OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */ ++ OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */ ++ OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */ ++ OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */ ++ OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */ ++ OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */ ++ OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */ ++ OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF ++} OMX_AUDIO_AMRBANDMODETYPE; ++ ++ ++/** AMR Discontinuous Transmission mode */ ++typedef enum OMX_AUDIO_AMRDTXMODETYPE { ++ OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */ ++ OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using ++ Voice Activity Detector 1 (VAD1) is enabled */ ++ OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using ++ Voice Activity Detector 2 (VAD2) is enabled */ ++ OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between ++ Off, VAD1 or VAD2 modes */ ++ ++ OMX_AUDIO_AMRDTXasEFR, /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */ ++ ++ OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF ++} OMX_AUDIO_AMRDTXMODETYPE; ++ ++ ++/** AMR params */ ++typedef struct OMX_AUDIO_PARAM_AMRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels */ ++ OMX_U32 nBitRate; /**< Bit rate read only field */ ++ OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ ++ OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */ ++ OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */ ++} OMX_AUDIO_PARAM_AMRTYPE; ++ ++ ++/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_GSMFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_GSMFRTYPE; ++ ++ ++/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_GSMHRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_GSMHRTYPE; ++ ++ ++/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_GSMEFRTYPE; ++ ++ ++/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_TDMAFRTYPE; ++ ++ ++/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_TDMAEFRTYPE; ++ ++ ++/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_PDCFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_PDCFRTYPE; ++ ++ ++/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_PDCEFRTYPE; ++ ++/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_PDCHRTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ ++ OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ ++} OMX_AUDIO_PARAM_PDCHRTYPE; ++ ++ ++/** CDMA Rate types */ ++typedef enum OMX_AUDIO_CDMARATETYPE { ++ OMX_AUDIO_CDMARateBlank = 0, /**< CDMA encoded frame is blank */ ++ OMX_AUDIO_CDMARateFull, /**< CDMA encoded frame in full rate */ ++ OMX_AUDIO_CDMARateHalf, /**< CDMA encoded frame in half rate */ ++ OMX_AUDIO_CDMARateQuarter, /**< CDMA encoded frame in quarter rate */ ++ OMX_AUDIO_CDMARateEighth, /**< CDMA encoded frame in eighth rate (DTX)*/ ++ OMX_AUDIO_CDMARateErasure, /**< CDMA erasure frame */ ++ OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_CDMARateMax = 0x7FFFFFFF ++} OMX_AUDIO_CDMARATETYPE; ++ ++ ++/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_QCELP8TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable ++ rate or unknown bit rates */ ++ OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ ++ OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ ++ OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ ++} OMX_AUDIO_PARAM_QCELP8TYPE; ++ ++ ++/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_QCELP13TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ ++ OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ ++ OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ ++} OMX_AUDIO_PARAM_QCELP13TYPE; ++ ++ ++/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_EVRCTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */ ++ OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */ ++ OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */ ++ OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */ ++ OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter */ ++ OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */ ++ OMX_BOOL bPostFilter; /**< Enable decoder's post Filter */ ++} OMX_AUDIO_PARAM_EVRCTYPE; ++ ++ ++/** SMV ( up to 8.55kbps coder) stream format parameters */ ++typedef struct OMX_AUDIO_PARAM_SMVTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannels; /**< Number of channels in the data stream (not ++ necessarily the same as the number of channels ++ to be rendered. */ ++ OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */ ++ OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */ ++ OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/ ++ OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/ ++ OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter ??*/ ++ OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */ ++ OMX_BOOL bPostFilter; /**< Enable decoder's post Filter ??*/ ++} OMX_AUDIO_PARAM_SMVTYPE; ++ ++ ++/** MIDI Format ++ * @ingroup midi ++ */ ++typedef enum OMX_AUDIO_MIDIFORMATTYPE ++{ ++ OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */ ++ OMX_AUDIO_MIDIFormatSMF0, /**< Standard MIDI File Type 0 */ ++ OMX_AUDIO_MIDIFormatSMF1, /**< Standard MIDI File Type 1 */ ++ OMX_AUDIO_MIDIFormatSMF2, /**< Standard MIDI File Type 2 */ ++ OMX_AUDIO_MIDIFormatSPMIDI, /**< SP-MIDI */ ++ OMX_AUDIO_MIDIFormatXMF0, /**< eXtensible Music Format type 0 */ ++ OMX_AUDIO_MIDIFormatXMF1, /**< eXtensible Music Format type 1 */ ++ OMX_AUDIO_MIDIFormatMobileXMF, /**< Mobile XMF (eXtensible Music Format type 2) */ ++ OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF ++} OMX_AUDIO_MIDIFORMATTYPE; ++ ++ ++/** MIDI params ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_PARAM_MIDITYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire ++ MIDI file passed in, otherwise if 0x0, the MIDI data ++ is merged and streamed (instead of passed as an ++ entire MIDI file) */ ++ OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic ++ voices. A value of zero indicates that the default ++ polyphony of the device is used */ ++ OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound ++ bank at initialization */ ++ OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */ ++} OMX_AUDIO_PARAM_MIDITYPE; ++ ++ ++/** Type of the MIDI sound bank ++ * @ingroup midi ++ */ ++typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE { ++ OMX_AUDIO_MIDISoundBankUnused = 0, /**< unused/unknown soundbank type */ ++ OMX_AUDIO_MIDISoundBankDLS1, /**< DLS version 1 */ ++ OMX_AUDIO_MIDISoundBankDLS2, /**< DLS version 2 */ ++ OMX_AUDIO_MIDISoundBankMobileDLSBase, /**< Mobile DLS, using the base functionality */ ++ OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */ ++ OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF ++} OMX_AUDIO_MIDISOUNDBANKTYPE; ++ ++ ++/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank ++ * @ingroup midi ++ */ ++typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE { ++ OMX_AUDIO_MIDISoundBankLayoutUnused = 0, /**< unused/unknown soundbank type */ ++ OMX_AUDIO_MIDISoundBankLayoutGM, /**< GS layout (based on bank MSB 0x00) */ ++ OMX_AUDIO_MIDISoundBankLayoutGM2, /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */ ++ OMX_AUDIO_MIDISoundBankLayoutUser, /**< Does not conform to any bank numbering standards */ ++ OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF ++} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE; ++ ++ ++/** MIDI params to load/unload user soundbank ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nDLSIndex; /**< DLS file index to be loaded */ ++ OMX_U32 nDLSSize; /**< Size in bytes */ ++ OMX_PTR pDLSData; /**< Pointer to DLS file data */ ++ OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank; /**< Midi sound bank type enumeration */ ++ OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */ ++} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE; ++ ++ ++/** Structure for Live MIDI events and MIP messages. ++ * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port that this structure applies to */ ++ OMX_U32 nMidiEventSize; /**< Size of immediate MIDI events or MIP message in bytes */ ++ OMX_U8 nMidiEvents[1]; /**< MIDI event array to be rendered immediately, or an ++ array for the MIP message buffer, where the size is ++ indicated by nMidiEventSize */ ++} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE; ++ ++ ++/** MIDI sound bank/ program pair in a given channel ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port that this structure applies to */ ++ OMX_U32 nChannel; /**< Valid channel values range from 1 to 16 */ ++ OMX_U16 nIDProgram; /**< Valid program ID range is 1 to 128 */ ++ OMX_U16 nIDSoundBank; /**< Sound bank ID */ ++ OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks ++ by index if multiple banks are present */ ++} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE; ++ ++ ++/** MIDI control ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 ++ format based on JAVA MMAPI (JSR-135) requirement */ ++ OMX_BU32 sPlayBackRate; /**< Relative playback rate, stored as Q14.17 fixed-point ++ number based on JSR-135 requirement */ ++ OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10 ++ fixed-point number based on JSR-135 requirement */ ++ OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic ++ voices. A value of zero indicates that the default ++ polyphony of the device is used */ ++ OMX_U32 nNumRepeat; /**< Number of times to repeat playback */ ++ OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback ++ will stop automatically. Set to zero if not used */ ++ OMX_U16 nChannelMuteMask; /**< 16 bit mask for channel mute status */ ++ OMX_U16 nChannelSoloMask; /**< 16 bit mask for channel solo status */ ++ OMX_U32 nTrack0031MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */ ++ OMX_U32 nTrack3263MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */ ++ OMX_U32 nTrack0031SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */ ++ OMX_U32 nTrack3263SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */ ++ ++} OMX_AUDIO_CONFIG_MIDICONTROLTYPE; ++ ++ ++/** MIDI Playback States ++ * @ingroup midi ++ */ ++typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE { ++ OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to ++ other defined states */ ++ OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open. ++ The MIDI engine is currently processing ++ MIDI events. */ ++ OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being ++ primed. The MIDI engine is currently ++ processing MIDI events. */ ++ OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but ++ not playing. The MIDI engine is currently ++ processing MIDI events. The transition to ++ this state is only possible from the ++ OMX_AUDIO_MIDIPlayBackStatePlaying state, ++ when the 'playback head' reaches the end ++ of media data or the playback stops due ++ to stop time set.*/ ++ OMX_AUDIO_MIDIPlayBackStatePlaying, /**< A MIDI resource is open and currently ++ playing. The MIDI engine is currently ++ processing MIDI events.*/ ++ OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS ++ resource constraints */ ++ OMX_AUDIO_MIDIPlayBackStatePlayingSilently, /**< Due to system resource constraints and ++ SP-MIDI content constraints, there is ++ no audible MIDI content during playback ++ currently. The situation may change if ++ resources are freed later.*/ ++ OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF ++} OMX_AUDIO_MIDIPLAYBACKSTATETYPE; ++ ++ ++/** MIDI status ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field. ++ NOTE: May not return a meaningful value until the entire ++ file is parsed and buffered. */ ++ OMX_U32 nDuration; /**< The length of the currently open MIDI resource ++ in milliseconds. NOTE: May not return a meaningful value ++ until the entire file is parsed and buffered. */ ++ OMX_U32 nPosition; /**< Current Position of the MIDI resource being played ++ in milliseconds */ ++ OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful ++ value until the entire file is parsed and buffered. */ ++ OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently ++ open MIDI resource. NOTE: May not return a meaningful value ++ until the entire file is parsed and buffered. */ ++ OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing ++ MIDI resource. NOTE: May not return a meaningful value until ++ the entire file is parsed and buffered. */ ++ OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState; /**< MIDI playback state enumeration, read only field */ ++} OMX_AUDIO_CONFIG_MIDISTATUSTYPE; ++ ++ ++/** MIDI Meta Event structure one per Meta Event. ++ * MIDI Meta Events are like audio metadata, except that they are interspersed ++ * with the MIDI content throughout the file and are not localized in the header. ++ * As such, it is necessary to retrieve information about these Meta Events from ++ * the engine, as it encounters these Meta Events within the MIDI content. ++ * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, ++ * author, default tempo, etc.) scattered throughout the file. ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nIndex; /**< Index of Meta Event */ ++ OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */ ++ OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ ++ OMX_U32 nTrack; /**< track number for the meta event */ ++ OMX_U32 nPosition; /**< Position of the meta-event in milliseconds */ ++} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; ++ ++ ++/** MIDI Meta Event Data structure - one per Meta Event. ++ * @ingroup midi ++ */ ++typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nIndex; /**< Index of Meta Event */ ++ OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ ++ OMX_U8 nData[1]; /**< array of one or more bytes of meta data ++ as indicated by the nMetaEventSize field */ ++} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; ++ ++ ++/** Audio Volume adjustment for a port */ ++typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port index indicating which port to ++ set. Select the input port to set ++ just that port's volume. Select the ++ output port to adjust the master ++ volume. */ ++ OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) ++ or logarithmic scale (mB) */ ++ OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR ++ Volume logarithmic setting for this port. The values ++ for volume are in mB (millibels = 1/100 dB) relative ++ to a gain of 1 (e.g. the output is the same as the ++ input level). Values are in mB from nMax ++ (maximum volume) to nMin mB (typically negative). ++ Since the volume is "voltage" ++ and not a "power", it takes a setting of ++ -600 mB to decrease the volume by 1/2. If ++ a component cannot accurately set the ++ volume to the requested value, it must ++ set the volume to the closest value BELOW ++ the requested value. When getting the ++ volume setting, the current actual volume ++ must be returned. */ ++} OMX_AUDIO_CONFIG_VOLUMETYPE; ++ ++ ++/** Audio Volume adjustment for a channel */ ++typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port index indicating which port to ++ set. Select the input port to set ++ just that port's volume. Select the ++ output port to adjust the master ++ volume. */ ++ OMX_U32 nChannel; /**< channel to select from 0 to N-1, ++ using OMX_ALL to apply volume settings ++ to all channels */ ++ OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or ++ logarithmic scale (mB) */ ++ OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR ++ Volume logarithmic setting for this port. ++ The values for volume are in mB ++ (millibels = 1/100 dB) relative to a gain ++ of 1 (e.g. the output is the same as the ++ input level). Values are in mB from nMax ++ (maximum volume) to nMin mB (typically negative). ++ Since the volume is "voltage" ++ and not a "power", it takes a setting of ++ -600 mB to decrease the volume by 1/2. If ++ a component cannot accurately set the ++ volume to the requested value, it must ++ set the volume to the closest value BELOW ++ the requested value. When getting the ++ volume setting, the current actual volume ++ must be returned. */ ++ OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel, ++ FALSE otherwise */ ++} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE; ++ ++ ++/** Audio balance setting */ ++typedef struct OMX_AUDIO_CONFIG_BALANCETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port index indicating which port to ++ set. Select the input port to set ++ just that port's balance. Select the ++ output port to adjust the master ++ balance. */ ++ OMX_S32 nBalance; /**< balance setting for this port ++ (-100 to 100, where -100 indicates ++ all left, and no right */ ++} OMX_AUDIO_CONFIG_BALANCETYPE; ++ ++ ++/** Audio Port mute */ ++typedef struct OMX_AUDIO_CONFIG_MUTETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port index indicating which port to ++ set. Select the input port to set ++ just that port's mute. Select the ++ output port to adjust the master ++ mute. */ ++ OMX_BOOL bMute; /**< Mute setting for this port */ ++} OMX_AUDIO_CONFIG_MUTETYPE; ++ ++ ++/** Audio Channel mute */ ++typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nChannel; /**< channel to select from 0 to N-1, ++ using OMX_ALL to apply mute settings ++ to all channels */ ++ OMX_BOOL bMute; /**< Mute setting for this channel */ ++ OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel, ++ FALSE otherwise */ ++} OMX_AUDIO_CONFIG_CHANNELMUTETYPE; ++ ++ ++ ++/** Enable / Disable for loudness control, which boosts bass and to a ++ * smaller extent high end frequencies to compensate for hearing ++ * ability at the extreme ends of the audio spectrum ++ */ ++typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bLoudness; /**< Enable/disable for loudness */ ++} OMX_AUDIO_CONFIG_LOUDNESSTYPE; ++ ++ ++/** Enable / Disable for bass, which controls low frequencies ++ */ ++typedef struct OMX_AUDIO_CONFIG_BASSTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for bass control */ ++ OMX_S32 nBass; /**< bass setting for the port, as a ++ continuous value from -100 to 100 ++ (0 means no change in bass level)*/ ++} OMX_AUDIO_CONFIG_BASSTYPE; ++ ++ ++/** Enable / Disable for treble, which controls high frequencies tones ++ */ ++typedef struct OMX_AUDIO_CONFIG_TREBLETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for treble control */ ++ OMX_S32 nTreble; /**< treble setting for the port, as a ++ continuous value from -100 to 100 ++ (0 means no change in treble level) */ ++} OMX_AUDIO_CONFIG_TREBLETYPE; ++ ++ ++/** An equalizer is typically used for two reasons: to compensate for an ++ * sub-optimal frequency response of a system to make it sound more natural ++ * or to create intentionally some unnatural coloring to the sound to create ++ * an effect. ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for equalizer */ ++ OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is ++ N-1, where N is the number of bands, lower limit is 0 */ ++ OMX_BU32 sCenterFreq; /**< Center frequecies in Hz. This is a ++ read only element and is used to determine ++ the lower, center and upper frequency of ++ this band. */ ++ OMX_BS32 sBandLevel; /**< band level in millibels */ ++} OMX_AUDIO_CONFIG_EQUALIZERTYPE; ++ ++ ++/** Stereo widening mode type ++ * @ingroup effects ++ */ ++typedef enum OMX_AUDIO_STEREOWIDENINGTYPE { ++ OMX_AUDIO_StereoWideningHeadphones, /**< Stereo widening for loudspeakers */ ++ OMX_AUDIO_StereoWideningLoudspeakers, /**< Stereo widening for closely spaced loudspeakers */ ++ OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF ++} OMX_AUDIO_STEREOWIDENINGTYPE; ++ ++ ++/** Control for stereo widening, which is a special 2-channel ++ * case of the audio virtualizer effect. For example, for 5.1-channel ++ * output, it translates to virtual surround sound. ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for stereo widening control */ ++ OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */ ++ OMX_U32 nStereoWidening; /**< stereo widening setting for the port, ++ as a continuous value from 0 to 100 */ ++} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE; ++ ++ ++/** The chorus effect (or ``choralizer'') is any signal processor which makes ++ * one sound source (such as a voice) sound like many such sources singing ++ * (or playing) in unison. Since performance in unison is never exact, chorus ++ * effects simulate this by making independently modified copies of the input ++ * signal. Modifications may include (1) delay, (2) frequency shift, and ++ * (3) amplitude modulation. ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for chorus */ ++ OMX_BU32 sDelay; /**< average delay in milliseconds */ ++ OMX_BU32 sModulationRate; /**< rate of modulation in millihertz */ ++ OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of ++ delay (i.e. 0 to 100) */ ++ OMX_BU32 nFeedback; /**< Feedback from chorus output to input in percentage */ ++} OMX_AUDIO_CONFIG_CHORUSTYPE; ++ ++ ++/** Reverberation is part of the reflected sound that follows the early ++ * reflections. In a typical room, this consists of a dense succession of ++ * echoes whose energy decays exponentially. The reverberation effect structure ++ * as defined here includes both (early) reflections as well as (late) reverberations. ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bEnable; /**< Enable/disable for reverberation control */ ++ OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect ++ (i.e. both early reflections and late ++ reverberation) in millibels */ ++ OMX_BS32 sRoomHighFreqLevel; /**< Attenuation at high frequencies ++ relative to the intensity at low ++ frequencies in millibels */ ++ OMX_BS32 sReflectionsLevel; /**< Intensity level of early reflections ++ (relative to room value), in millibels */ ++ OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative ++ to the direct path, in milliseconds */ ++ OMX_BS32 sReverbLevel; /**< Intensity level of late reverberation ++ relative to room level, in millibels */ ++ OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection ++ to the beginning of the late reverberation ++ section, in milliseconds */ ++ OMX_BU32 sDecayTime; /**< Late reverberation decay time at low ++ frequencies, in milliseconds */ ++ OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative ++ to low frequency decay time in percent */ ++ OMX_U32 nDensity; /**< Modal density in the late reverberation decay, ++ in percent (i.e. 0 - 100) */ ++ OMX_U32 nDiffusion; /**< Echo density in the late reverberation decay, ++ in percent (i.e. 0 - 100) */ ++ OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is ++ the frequency used as the reference for all ++ the high-frequency settings above */ ++ ++} OMX_AUDIO_CONFIG_REVERBERATIONTYPE; ++ ++ ++/** Possible settings for the Echo Cancelation structure to use ++ * @ingroup effects ++ */ ++typedef enum OMX_AUDIO_ECHOCANTYPE { ++ OMX_AUDIO_EchoCanOff = 0, /**< Echo Cancellation is disabled */ ++ OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation - ++ echo from plastics and face */ ++ OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for ++ Hands Free operation */ ++ OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for ++ Car Kit (longer echo) */ ++ OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_AUDIO_EchoCanMax = 0x7FFFFFFF ++} OMX_AUDIO_ECHOCANTYPE; ++ ++ ++/** Enable / Disable for echo cancelation, which removes undesired echo's ++ * from the audio ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */ ++} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE; ++ ++ ++/** Enable / Disable for noise reduction, which undesired noise from ++ * the audio ++ * @ingroup effects ++ */ ++typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BOOL bNoiseReduction; /**< Enable/disable for noise reduction */ ++} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE; ++ ++/** @} */ ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif ++/* File EOF */ +diff --git a/libavcodec/OMX_Component.h b/libavcodec/OMX_Component.h +new file mode 100755 +index 0000000..8107aa9 +--- /dev/null ++++ b/libavcodec/OMX_Component.h +@@ -0,0 +1,596 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/* ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** OMX_Component.h - OpenMax IL version 1.1.2 ++ * The OMX_Component header file contains the definitions used to define ++ * the public interface of a component. This header file is intended to ++ * be used by both the application and the component. ++ */ ++ ++#ifndef OMX_Component_h ++#define OMX_Component_h ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++ ++ ++/* Each OMX header must include all required header files to allow the ++ * header to compile without errors. The includes below are required ++ * for this header file to compile successfully ++ */ ++ ++#include "OMX_Audio.h" ++#include "OMX_Video.h" ++#include "OMX_Image.h" ++#include "OMX_Other.h" ++ ++/** @ingroup comp */ ++typedef enum OMX_PORTDOMAINTYPE { ++ OMX_PortDomainAudio, ++ OMX_PortDomainVideo, ++ OMX_PortDomainImage, ++ OMX_PortDomainOther, ++ OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_PortDomainMax = 0x7ffffff ++} OMX_PORTDOMAINTYPE; ++ ++/** @ingroup comp */ ++typedef struct OMX_PARAM_PORTDEFINITIONTYPE { ++ OMX_U32 nSize; /**< Size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< Port number the structure applies to */ ++ OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */ ++ OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */ ++ OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */ ++ OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */ ++ OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by ++ OMX_CommandPortEnable/OMX_CommandPortDisable. ++ When disabled a port is unpopulated. A disabled port ++ is not populated with buffers on a transition to IDLE. */ ++ OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by ++ nBufferCountActual. A disabled port is always unpopulated. ++ An enabled port is populated on a transition to OMX_StateIdle ++ and unpopulated on a transition to loaded. */ ++ OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */ ++ union { ++ OMX_AUDIO_PORTDEFINITIONTYPE audio; ++ OMX_VIDEO_PORTDEFINITIONTYPE video; ++ OMX_IMAGE_PORTDEFINITIONTYPE image; ++ OMX_OTHER_PORTDEFINITIONTYPE other; ++ } format; ++ OMX_BOOL bBuffersContiguous; ++ OMX_U32 nBufferAlignment; ++} OMX_PARAM_PORTDEFINITIONTYPE; ++ ++/** @ingroup comp */ ++typedef struct OMX_PARAM_U32TYPE { ++ OMX_U32 nSize; /**< Size of this structure, in Bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_U32 nU32; /**< U32 value */ ++} OMX_PARAM_U32TYPE; ++ ++/** @ingroup rpm */ ++typedef enum OMX_SUSPENSIONPOLICYTYPE { ++ OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */ ++ OMX_SuspensionEnabled, /**< Suspension allowed */ ++ OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_SuspensionPolicyMax = 0x7fffffff ++} OMX_SUSPENSIONPOLICYTYPE; ++ ++/** @ingroup rpm */ ++typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_SUSPENSIONPOLICYTYPE ePolicy; ++} OMX_PARAM_SUSPENSIONPOLICYTYPE; ++ ++/** @ingroup rpm */ ++typedef enum OMX_SUSPENSIONTYPE { ++ OMX_NotSuspended, /**< component is not suspended */ ++ OMX_Suspended, /**< component is suspended */ ++ OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_SuspendMax = 0x7FFFFFFF ++} OMX_SUSPENSIONTYPE; ++ ++/** @ingroup rpm */ ++typedef struct OMX_PARAM_SUSPENSIONTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_SUSPENSIONTYPE eType; ++} OMX_PARAM_SUSPENSIONTYPE ; ++ ++typedef struct OMX_CONFIG_BOOLEANTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bEnabled; ++} OMX_CONFIG_BOOLEANTYPE; ++ ++/* Parameter specifying the content uri to use. */ ++/** @ingroup cp */ ++typedef struct OMX_PARAM_CONTENTURITYPE ++{ ++ OMX_U32 nSize; /**< size of the structure in bytes, including ++ actual URI name */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U8 contentURI[1]; /**< The URI name */ ++} OMX_PARAM_CONTENTURITYPE; ++ ++/* Parameter specifying the pipe to use. */ ++/** @ingroup cp */ ++typedef struct OMX_PARAM_CONTENTPIPETYPE ++{ ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_HANDLETYPE hPipe; /**< The pipe handle*/ ++} OMX_PARAM_CONTENTPIPETYPE; ++ ++/** @ingroup rpm */ ++typedef struct OMX_RESOURCECONCEALMENTTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment ++ methods (like degrading algorithm quality to ++ lower resource consumption or functional bypass) ++ on a component as a resolution to resource conflicts. */ ++} OMX_RESOURCECONCEALMENTTYPE; ++ ++ ++/** @ingroup metadata */ ++typedef enum OMX_METADATACHARSETTYPE { ++ OMX_MetadataCharsetUnknown = 0, ++ OMX_MetadataCharsetASCII, ++ OMX_MetadataCharsetBinary, ++ OMX_MetadataCharsetCodePage1252, ++ OMX_MetadataCharsetUTF8, ++ OMX_MetadataCharsetJavaConformantUTF8, ++ OMX_MetadataCharsetUTF7, ++ OMX_MetadataCharsetImapUTF7, ++ OMX_MetadataCharsetUTF16LE, ++ OMX_MetadataCharsetUTF16BE, ++ OMX_MetadataCharsetGB12345, ++ OMX_MetadataCharsetHZGB2312, ++ OMX_MetadataCharsetGB2312, ++ OMX_MetadataCharsetGB18030, ++ OMX_MetadataCharsetGBK, ++ OMX_MetadataCharsetBig5, ++ OMX_MetadataCharsetISO88591, ++ OMX_MetadataCharsetISO88592, ++ OMX_MetadataCharsetISO88593, ++ OMX_MetadataCharsetISO88594, ++ OMX_MetadataCharsetISO88595, ++ OMX_MetadataCharsetISO88596, ++ OMX_MetadataCharsetISO88597, ++ OMX_MetadataCharsetISO88598, ++ OMX_MetadataCharsetISO88599, ++ OMX_MetadataCharsetISO885910, ++ OMX_MetadataCharsetISO885913, ++ OMX_MetadataCharsetISO885914, ++ OMX_MetadataCharsetISO885915, ++ OMX_MetadataCharsetShiftJIS, ++ OMX_MetadataCharsetISO2022JP, ++ OMX_MetadataCharsetISO2022JP1, ++ OMX_MetadataCharsetISOEUCJP, ++ OMX_MetadataCharsetSMS7Bit, ++ OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_MetadataCharsetTypeMax= 0x7FFFFFFF ++} OMX_METADATACHARSETTYPE; ++ ++/** @ingroup metadata */ ++typedef enum OMX_METADATASCOPETYPE ++{ ++ OMX_MetadataScopeAllLevels, ++ OMX_MetadataScopeTopLevel, ++ OMX_MetadataScopePortLevel, ++ OMX_MetadataScopeNodeLevel, ++ OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_MetadataScopeTypeMax = 0x7fffffff ++} OMX_METADATASCOPETYPE; ++ ++/** @ingroup metadata */ ++typedef enum OMX_METADATASEARCHMODETYPE ++{ ++ OMX_MetadataSearchValueSizeByIndex, ++ OMX_MetadataSearchItemByIndex, ++ OMX_MetadataSearchNextItemByKey, ++ OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_MetadataSearchTypeMax = 0x7fffffff ++} OMX_METADATASEARCHMODETYPE; ++/** @ingroup metadata */ ++typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_METADATASCOPETYPE eScopeMode; ++ OMX_U32 nScopeSpecifier; ++ OMX_U32 nMetadataItemCount; ++} OMX_CONFIG_METADATAITEMCOUNTTYPE; ++ ++/** @ingroup metadata */ ++typedef struct OMX_CONFIG_METADATAITEMTYPE ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_METADATASCOPETYPE eScopeMode; ++ OMX_U32 nScopeSpecifier; ++ OMX_U32 nMetadataItemIndex; ++ OMX_METADATASEARCHMODETYPE eSearchMode; ++ OMX_METADATACHARSETTYPE eKeyCharset; ++ OMX_U8 nKeySizeUsed; ++ OMX_U8 nKey[128]; ++ OMX_METADATACHARSETTYPE eValueCharset; ++ OMX_STRING sLanguageCountry; ++ OMX_U32 nValueMaxSize; ++ OMX_U32 nValueSizeUsed; ++ OMX_U8 nValue[1]; ++} OMX_CONFIG_METADATAITEMTYPE; ++ ++/* @ingroup metadata */ ++typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bAllKeys; ++ OMX_U32 nParentNodeID; ++ OMX_U32 nNumNodes; ++} OMX_CONFIG_CONTAINERNODECOUNTTYPE; ++ ++/** @ingroup metadata */ ++typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bAllKeys; ++ OMX_U32 nParentNodeID; ++ OMX_U32 nNodeIndex; ++ OMX_U32 nNodeID; ++ OMX_STRING cNodeName; ++ OMX_BOOL bIsLeafType; ++} OMX_CONFIG_CONTAINERNODEIDTYPE; ++ ++/** @ingroup metadata */ ++typedef struct OMX_PARAM_METADATAFILTERTYPE ++{ ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and ++ * the three key fields below are ignored */ ++ OMX_METADATACHARSETTYPE eKeyCharset; ++ OMX_U32 nKeySizeUsed; ++ OMX_U8 nKey [128]; ++ OMX_U32 nLanguageCountrySizeUsed; ++ OMX_U8 nLanguageCountry[128]; ++ OMX_BOOL bEnabled; /* if true then key is part of filter (e.g. ++ * retained for query later). If false then ++ * key is not part of filter */ ++} OMX_PARAM_METADATAFILTERTYPE; ++ ++/** The OMX_HANDLETYPE structure defines the component handle. The component ++ * handle is used to access all of the component's public methods and also ++ * contains pointers to the component's private data area. The component ++ * handle is initialized by the OMX core (with help from the component) ++ * during the process of loading the component. After the component is ++ * successfully loaded, the application can safely access any of the ++ * component's public functions (although some may return an error because ++ * the state is inappropriate for the access). ++ * ++ * @ingroup comp ++ */ ++typedef struct OMX_COMPONENTTYPE ++{ ++ /** The size of this structure, in bytes. It is the responsibility ++ of the allocator of this structure to fill in this value. Since ++ this structure is allocated by the GetHandle function, this ++ function will fill in this value. */ ++ OMX_U32 nSize; ++ ++ /** nVersion is the version of the OMX specification that the structure ++ is built against. It is the responsibility of the creator of this ++ structure to initialize this value and every user of this structure ++ should verify that it knows how to use the exact version of ++ this structure found herein. */ ++ OMX_VERSIONTYPE nVersion; ++ ++ /** pComponentPrivate is a pointer to the component private data area. ++ This member is allocated and initialized by the component when the ++ component is first loaded. The application should not access this ++ data area. */ ++ OMX_PTR pComponentPrivate; ++ ++ /** pApplicationPrivate is a pointer that is a parameter to the ++ OMX_GetHandle method, and contains an application private value ++ provided by the IL client. This application private data is ++ returned to the IL Client by OMX in all callbacks */ ++ OMX_PTR pApplicationPrivate; ++ ++ /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL ++ specification for details on the GetComponentVersion method. ++ */ ++ OMX_ERRORTYPE (*GetComponentVersion)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_OUT OMX_STRING pComponentName, ++ OMX_OUT OMX_VERSIONTYPE* pComponentVersion, ++ OMX_OUT OMX_VERSIONTYPE* pSpecVersion, ++ OMX_OUT OMX_UUIDTYPE* pComponentUUID); ++ ++ /** refer to OMX_SendCommand in OMX_core.h or the OMX IL ++ specification for details on the SendCommand method. ++ */ ++ OMX_ERRORTYPE (*SendCommand)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_COMMANDTYPE Cmd, ++ OMX_IN OMX_U32 nParam1, ++ OMX_IN OMX_PTR pCmdData); ++ ++ /** refer to OMX_GetParameter in OMX_core.h or the OMX IL ++ specification for details on the GetParameter method. ++ */ ++ OMX_ERRORTYPE (*GetParameter)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_INDEXTYPE nParamIndex, ++ OMX_INOUT OMX_PTR pComponentParameterStructure); ++ ++ ++ /** refer to OMX_SetParameter in OMX_core.h or the OMX IL ++ specification for details on the SetParameter method. ++ */ ++ OMX_ERRORTYPE (*SetParameter)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_INDEXTYPE nIndex, ++ OMX_IN OMX_PTR pComponentParameterStructure); ++ ++ ++ /** refer to OMX_GetConfig in OMX_core.h or the OMX IL ++ specification for details on the GetConfig method. ++ */ ++ OMX_ERRORTYPE (*GetConfig)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_INDEXTYPE nIndex, ++ OMX_INOUT OMX_PTR pComponentConfigStructure); ++ ++ ++ /** refer to OMX_SetConfig in OMX_core.h or the OMX IL ++ specification for details on the SetConfig method. ++ */ ++ OMX_ERRORTYPE (*SetConfig)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_INDEXTYPE nIndex, ++ OMX_IN OMX_PTR pComponentConfigStructure); ++ ++ ++ /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL ++ specification for details on the GetExtensionIndex method. ++ */ ++ OMX_ERRORTYPE (*GetExtensionIndex)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_STRING cParameterName, ++ OMX_OUT OMX_INDEXTYPE* pIndexType); ++ ++ ++ /** refer to OMX_GetState in OMX_core.h or the OMX IL ++ specification for details on the GetState method. ++ */ ++ OMX_ERRORTYPE (*GetState)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_OUT OMX_STATETYPE* pState); ++ ++ ++ /** The ComponentTunnelRequest method will interact with another OMX ++ component to determine if tunneling is possible and to setup the ++ tunneling. The return codes for this method can be used to ++ determine if tunneling is not possible, or if tunneling is not ++ supported. ++ ++ Base profile components (i.e. non-interop) do not support this ++ method and should return OMX_ErrorNotImplemented ++ ++ The interop profile component MUST support tunneling to another ++ interop profile component with a compatible port parameters. ++ A component may also support proprietary communication. ++ ++ If proprietary communication is supported the negotiation of ++ proprietary communication is done outside of OMX in a vendor ++ specific way. It is only required that the proper result be ++ returned and the details of how the setup is done is left ++ to the component implementation. ++ ++ When this method is invoked when nPort in an output port, the ++ component will: ++ 1. Populate the pTunnelSetup structure with the output port's ++ requirements and constraints for the tunnel. ++ ++ When this method is invoked when nPort in an input port, the ++ component will: ++ 1. Query the necessary parameters from the output port to ++ determine if the ports are compatible for tunneling ++ 2. If the ports are compatible, the component should store ++ the tunnel step provided by the output port ++ 3. Determine which port (either input or output) is the buffer ++ supplier, and call OMX_SetParameter on the output port to ++ indicate this selection. ++ ++ The component will return from this call within 5 msec. ++ ++ @param [in] hComp ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle method. ++ @param [in] nPort ++ nPort is used to select the port on the component to be used ++ for tunneling. ++ @param [in] hTunneledComp ++ Handle of the component to tunnel with. This is the component ++ handle returned by the call to the OMX_GetHandle method. When ++ this parameter is 0x0 the component should setup the port for ++ communication with the application / IL Client. ++ @param [in] nPortOutput ++ nPortOutput is used indicate the port the component should ++ tunnel with. ++ @param [in] pTunnelSetup ++ Pointer to the tunnel setup structure. When nPort is an output port ++ the component should populate the fields of this structure. When ++ When nPort is an input port the component should review the setup ++ provided by the component with the output port. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup tun ++ */ ++ ++ OMX_ERRORTYPE (*ComponentTunnelRequest)( ++ OMX_IN OMX_HANDLETYPE hComp, ++ OMX_IN OMX_U32 nPort, ++ OMX_IN OMX_HANDLETYPE hTunneledComp, ++ OMX_IN OMX_U32 nTunneledPort, ++ OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup); ++ ++ /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL ++ specification for details on the UseBuffer method. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*UseBuffer)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, ++ OMX_IN OMX_U32 nPortIndex, ++ OMX_IN OMX_PTR pAppPrivate, ++ OMX_IN OMX_U32 nSizeBytes, ++ OMX_IN OMX_U8* pBuffer); ++ ++ /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL ++ specification for details on the AllocateBuffer method. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*AllocateBuffer)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer, ++ OMX_IN OMX_U32 nPortIndex, ++ OMX_IN OMX_PTR pAppPrivate, ++ OMX_IN OMX_U32 nSizeBytes); ++ ++ /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL ++ specification for details on the FreeBuffer method. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*FreeBuffer)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_U32 nPortIndex, ++ OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); ++ ++ /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL ++ specification for details on the EmptyThisBuffer method. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*EmptyThisBuffer)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); ++ ++ /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL ++ specification for details on the FillThisBuffer method. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*FillThisBuffer)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); ++ ++ /** The SetCallbacks method is used by the core to specify the callback ++ structure from the application to the component. This is a blocking ++ call. The component will return from this call within 5 msec. ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the GetHandle function. ++ @param [in] pCallbacks ++ pointer to an OMX_CALLBACKTYPE structure used to provide the ++ callback information to the component ++ @param [in] pAppData ++ pointer to an application defined value. It is anticipated that ++ the application will pass a pointer to a data structure or a "this ++ pointer" in this area to allow the callback (in the application) ++ to determine the context of the call ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ */ ++ OMX_ERRORTYPE (*SetCallbacks)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_CALLBACKTYPE* pCallbacks, ++ OMX_IN OMX_PTR pAppData); ++ ++ /** ComponentDeInit method is used to deinitialize the component ++ providing a means to free any resources allocated at component ++ initialization. NOTE: After this call the component handle is ++ not valid for further use. ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the GetHandle function. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ */ ++ OMX_ERRORTYPE (*ComponentDeInit)( ++ OMX_IN OMX_HANDLETYPE hComponent); ++ ++ /** @ingroup buf */ ++ OMX_ERRORTYPE (*UseEGLImage)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, ++ OMX_IN OMX_U32 nPortIndex, ++ OMX_IN OMX_PTR pAppPrivate, ++ OMX_IN void* eglImage); ++ ++ OMX_ERRORTYPE (*ComponentRoleEnum)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_OUT OMX_U8 *cRole, ++ OMX_IN OMX_U32 nIndex); ++ ++} OMX_COMPONENTTYPE; ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif ++/* File EOF */ +diff --git a/libavcodec/OMX_ContentPipe.h b/libavcodec/OMX_ContentPipe.h +new file mode 100755 +index 0000000..0224c8a +--- /dev/null ++++ b/libavcodec/OMX_ContentPipe.h +@@ -0,0 +1,212 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/* ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** OMX_ContentPipe.h - OpenMax IL version 1.1.2 ++ * The OMX_ContentPipe header file contains the definitions used to define ++ * the public interface for content piples. This header file is intended to ++ * be used by the component. ++ */ ++ ++#ifndef OMX_CONTENTPIPE_H ++#define OMX_CONTENTPIPE_H ++ ++#ifndef KD_EACCES ++/* OpenKODE error codes. CPResult values may be zero (indicating success ++ or one of the following values) */ ++#define KD_EACCES (1) ++#define KD_EADDRINUSE (2) ++#define KD_EAGAIN (5) ++#define KD_EBADF (7) ++#define KD_EBUSY (8) ++#define KD_ECONNREFUSED (9) ++#define KD_ECONNRESET (10) ++#define KD_EDEADLK (11) ++#define KD_EDESTADDRREQ (12) ++#define KD_ERANGE (35) ++#define KD_EEXIST (13) ++#define KD_EFBIG (14) ++#define KD_EHOSTUNREACH (15) ++#define KD_EINVAL (17) ++#define KD_EIO (18) ++#define KD_EISCONN (20) ++#define KD_EISDIR (21) ++#define KD_EMFILE (22) ++#define KD_ENAMETOOLONG (23) ++#define KD_ENOENT (24) ++#define KD_ENOMEM (25) ++#define KD_ENOSPC (26) ++#define KD_ENOSYS (27) ++#define KD_ENOTCONN (28) ++#define KD_EPERM (33) ++#define KD_ETIMEDOUT (36) ++#define KD_EILSEQ (19) ++#endif ++ ++/** Map types from OMX standard types only here so interface is as generic as possible. */ ++typedef OMX_U32 CPresult; ++typedef char * CPstring; ++typedef void * CPhandle; ++typedef OMX_U32 CPuint; ++typedef OMX_S32 CPint; ++typedef char CPbyte; ++typedef OMX_BOOL CPbool; ++ ++/** enumeration of origin types used in the CP_PIPETYPE's Seek function ++ * @ingroup cp ++ */ ++typedef enum CP_ORIGINTYPE { ++ CP_OriginBegin, ++ CP_OriginCur, ++ CP_OriginEnd, ++ CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ CP_OriginMax = 0X7FFFFFFF ++} CP_ORIGINTYPE; ++ ++/** enumeration of contact access types used in the CP_PIPETYPE's Open function ++ * @ingroup cp ++ */ ++typedef enum CP_ACCESSTYPE { ++ CP_AccessRead, ++ CP_AccessWrite, ++ CP_AccessReadWrite, ++ CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ CP_AccessMax = 0X7FFFFFFF ++} CP_ACCESSTYPE; ++ ++/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function ++ * @ingroup cp ++ */ ++typedef enum CP_CHECKBYTESRESULTTYPE ++{ ++ CP_CheckBytesOk, /**< There are at least the request number ++ of bytes available */ ++ CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes ++ and presently lacks sufficient bytes. ++ Client will be called when they are ++ sufficient bytes are available. */ ++ CP_CheckBytesInsufficientBytes, /**< The pipe has retrieved all bytes ++ but those available are less than those ++ requested */ ++ CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream ++ and no more bytes are available. */ ++ CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */ ++ CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ CP_CheckBytesMax = 0X7FFFFFFF ++} CP_CHECKBYTESRESULTTYPE; ++ ++/** enumeration of content pipe events sent to the client callback. ++ * @ingroup cp ++ */ ++typedef enum CP_EVENTTYPE{ ++ CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/ ++ CP_Overflow, /** enumeration of content pipe events sent to the client callback*/ ++ CP_PipeDisconnected, /** enumeration of content pipe events sent to the client callback*/ ++ CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ CP_EventMax = 0X7FFFFFFF ++} CP_EVENTTYPE; ++ ++/** content pipe definition ++ * @ingroup cp ++ */ ++typedef struct CP_PIPETYPE ++{ ++ /** Open a content stream for reading or writing. */ ++ CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess ); ++ ++ /** Close a content stream. */ ++ CPresult (*Close)( CPhandle hContent ); ++ ++ /** Create a content source and open it for writing. */ ++ CPresult (*Create)( CPhandle *hContent, CPstring szURI ); ++ ++ /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/ ++ CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult ); ++ ++ /** Seek to certain position in the content relative to the specified origin. */ ++ CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin); ++ ++ /** Retrieve the current position relative to the start of the content. */ ++ CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition); ++ ++ /** Retrieve data of the specified size from the content stream (advance content pointer by size of data). ++ Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */ ++ CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); ++ ++ /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. ++ Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also ++ returns the size of the block actually read. Content pointer advances the by the returned size. ++ Note: pipe provides pointer. This function is appropriate for large reads. The client must call ++ ReleaseReadBuffer when done with buffer. ++ ++ In some cases the requested block may not reside in contiguous memory within the ++ pipe implementation. For instance if the pipe leverages a circular buffer then the requested ++ block may straddle the boundary of the circular buffer. By default a pipe implementation ++ performs a copy in this case to provide the block to the pipe client in one contiguous buffer. ++ If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory ++ boundary. Here the client may retrieve the data in segments over successive calls. */ ++ CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy); ++ ++ /** Release a buffer obtained by ReadBuffer back to the pipe. */ ++ CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer); ++ ++ /** Write data of the specified size to the content (advance content pointer by size of data). ++ Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */ ++ CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); ++ ++ /** Retrieve a buffer allocated by the pipe used to write data to the content. ++ Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate ++ for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/ ++ CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize); ++ ++ /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the ++ the contents of the buffer to content and advance content pointer by the size of the buffer */ ++ CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize); ++ ++ /** Register a per-handle client callback with the content pipe. */ ++ CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam)); ++ ++} CP_PIPETYPE; ++ ++#endif ++ +diff --git a/libavcodec/OMX_Core.h b/libavcodec/OMX_Core.h +new file mode 100755 +index 0000000..70fa3da +--- /dev/null ++++ b/libavcodec/OMX_Core.h +@@ -0,0 +1,1507 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/* ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** OMX_Core.h - OpenMax IL version 1.1.2 ++ * The OMX_Core header file contains the definitions used by both the ++ * application and the component to access common items. ++ */ ++ ++#ifndef OMX_Core_h ++#define OMX_Core_h ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++ ++/* Each OMX header shall include all required header files to allow the ++ * header to compile without errors. The includes below are required ++ * for this header file to compile successfully ++ */ ++ ++#include "OMX_Index.h" ++ ++ ++/** The OMX_COMMANDTYPE enumeration is used to specify the action in the ++ * OMX_SendCommand macro. ++ * @ingroup core ++ */ ++typedef enum OMX_COMMANDTYPE ++{ ++ OMX_CommandStateSet, /**< Change the component state */ ++ OMX_CommandFlush, /**< Flush the data queue(s) of a component */ ++ OMX_CommandPortDisable, /**< Disable a port on a component. */ ++ OMX_CommandPortEnable, /**< Enable a port on a component. */ ++ OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */ ++ OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_CommandMax = 0X7FFFFFFF ++} OMX_COMMANDTYPE; ++ ++ ++ ++/** The OMX_STATETYPE enumeration is used to indicate or change the component ++ * state. This enumeration reflects the current state of the component when ++ * used with the OMX_GetState macro or becomes the parameter in a state change ++ * command when used with the OMX_SendCommand macro. ++ * ++ * The component will be in the Loaded state after the component is initially ++ * loaded into memory. In the Loaded state, the component is not allowed to ++ * allocate or hold resources other than to build it's internal parameter ++ * and configuration tables. The application will send one or more ++ * SetParameters/GetParameters and SetConfig/GetConfig commands to the ++ * component and the component will record each of these parameter and ++ * configuration changes for use later. When the application sends the ++ * Idle command, the component will acquire the resources needed for the ++ * specified configuration and will transition to the idle state if the ++ * allocation is successful. If the component cannot successfully ++ * transition to the idle state for any reason, the state of the component ++ * shall be fully rolled back to the Loaded state (e.g. all allocated ++ * resources shall be released). When the component receives the command ++ * to go to the Executing state, it shall begin processing buffers by ++ * sending all input buffers it holds to the application. While ++ * the component is in the Idle state, the application may also send the ++ * Pause command. If the component receives the pause command while in the ++ * Idle state, the component shall send all input buffers it holds to the ++ * application, but shall not begin processing buffers. This will allow the ++ * application to prefill buffers. ++ * ++ * @ingroup comp ++ */ ++ ++typedef enum OMX_STATETYPE ++{ ++ OMX_StateInvalid, /**< component has detected that it's internal data ++ structures are corrupted to the point that ++ it cannot determine it's state properly */ ++ OMX_StateLoaded, /**< component has been loaded but has not completed ++ initialization. The OMX_SetParameter macro ++ and the OMX_GetParameter macro are the only ++ valid macros allowed to be sent to the ++ component in this state. */ ++ OMX_StateIdle, /**< component initialization has been completed ++ successfully and the component is ready to ++ to start. */ ++ OMX_StateExecuting, /**< component has accepted the start command and ++ is processing data (if data is available) */ ++ OMX_StatePause, /**< component has received pause command */ ++ OMX_StateWaitForResources, /**< component is waiting for resources, either after ++ preemption or before it gets the resources requested. ++ See specification for complete details. */ ++ OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_StateMax = 0X7FFFFFFF ++} OMX_STATETYPE; ++ ++/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These ++ * errors should cover most of the common failure cases. However, ++ * vendors are free to add additional error messages of their own as ++ * long as they follow these rules: ++ * 1. Vendor error messages shall be in the range of 0x90000000 to ++ * 0x9000FFFF. ++ * 2. Vendor error messages shall be defined in a header file provided ++ * with the component. No error messages are allowed that are ++ * not defined. ++ */ ++typedef enum OMX_ERRORTYPE ++{ ++ OMX_ErrorNone = 0, ++ ++ /** There were insufficient resources to perform the requested operation */ ++ OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000, ++ ++ /** There was an error, but the cause of the error could not be determined */ ++ OMX_ErrorUndefined = (OMX_S32) 0x80001001, ++ ++ /** The component name string was not valid */ ++ OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002, ++ ++ /** No component with the specified name string was found */ ++ OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003, ++ ++ /** The component specified did not have a "OMX_ComponentInit" or ++ "OMX_ComponentDeInit entry point */ ++ OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004, ++ ++ /** One or more parameters were not valid */ ++ OMX_ErrorBadParameter = (OMX_S32) 0x80001005, ++ ++ /** The requested function is not implemented */ ++ OMX_ErrorNotImplemented = (OMX_S32) 0x80001006, ++ ++ /** The buffer was emptied before the next buffer was ready */ ++ OMX_ErrorUnderflow = (OMX_S32) 0x80001007, ++ ++ /** The buffer was not available when it was needed */ ++ OMX_ErrorOverflow = (OMX_S32) 0x80001008, ++ ++ /** The hardware failed to respond as expected */ ++ OMX_ErrorHardware = (OMX_S32) 0x80001009, ++ ++ /** The component is in the state OMX_StateInvalid */ ++ OMX_ErrorInvalidState = (OMX_S32) 0x8000100A, ++ ++ /** Stream is found to be corrupt */ ++ OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B, ++ ++ /** Ports being connected are not compatible */ ++ OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C, ++ ++ /** Resources allocated to an idle component have been ++ lost resulting in the component returning to the loaded state */ ++ OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D, ++ ++ /** No more indicies can be enumerated */ ++ OMX_ErrorNoMore = (OMX_S32) 0x8000100E, ++ ++ /** The component detected a version mismatch */ ++ OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F, ++ ++ /** The component is not ready to return data at this time */ ++ OMX_ErrorNotReady = (OMX_S32) 0x80001010, ++ ++ /** There was a timeout that occurred */ ++ OMX_ErrorTimeout = (OMX_S32) 0x80001011, ++ ++ /** This error occurs when trying to transition into the state you are already in */ ++ OMX_ErrorSameState = (OMX_S32) 0x80001012, ++ ++ /** Resources allocated to an executing or paused component have been ++ preempted, causing the component to return to the idle state */ ++ OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, ++ ++ /** A non-supplier port sends this error to the IL client (via the EventHandler callback) ++ during the allocation of buffers (on a transition from the LOADED to the IDLE state or ++ on a port restart) when it deems that it has waited an unusually long time for the supplier ++ to send it an allocated buffer via a UseBuffer call. */ ++ OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014, ++ ++ /** A non-supplier port sends this error to the IL client (via the EventHandler callback) ++ during the deallocation of buffers (on a transition from the IDLE to LOADED state or ++ on a port stop) when it deems that it has waited an unusually long time for the supplier ++ to request the deallocation of a buffer header via a FreeBuffer call. */ ++ OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015, ++ ++ /** A supplier port sends this error to the IL client (via the EventHandler callback) ++ during the stopping of a port (either on a transition from the IDLE to LOADED ++ state or a port stop) when it deems that it has waited an unusually long time for ++ the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */ ++ OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016, ++ ++ /** Attempting a state transtion that is not allowed */ ++ OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017, ++ ++ /* Attempting a command that is not allowed during the present state. */ ++ OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, ++ ++ /** The values encapsulated in the parameter or config structure are not supported. */ ++ OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019, ++ ++ /** The parameter or config indicated by the given index is not supported. */ ++ OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A, ++ ++ /** The port index supplied is incorrect. */ ++ OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B, ++ ++ /** The port has lost one or more of its buffers and it thus unpopulated. */ ++ OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C, ++ ++ /** Component suspended due to temporary loss of resources */ ++ OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D, ++ ++ /** Component suspended due to an inability to acquire dynamic resources */ ++ OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E, ++ ++ /** When the macroblock error reporting is enabled the component returns new error ++ for every frame that has errors */ ++ OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F, ++ ++ /** A component reports this error when it cannot parse or determine the format of an input stream. */ ++ OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, ++ ++ /** The content open operation failed. */ ++ OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021, ++ ++ /** The content creation operation failed. */ ++ OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022, ++ ++ /** Separate table information is being used */ ++ OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023, ++ ++ /** Tunneling is unsupported by the component*/ ++ OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024, ++ ++ OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_ErrorMax = 0x7FFFFFFF ++} OMX_ERRORTYPE; ++ ++/** @ingroup core */ ++typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent); ++ ++/** @ingroup core */ ++typedef struct OMX_COMPONENTREGISTERTYPE ++{ ++ const char * pName; /* Component name, 128 byte limit (including '\0') applies */ ++ OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */ ++} OMX_COMPONENTREGISTERTYPE; ++ ++/** @ingroup core */ ++extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[]; ++ ++/** @ingroup rpm */ ++typedef struct OMX_PRIORITYMGMTTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nGroupPriority; /**< Priority of the component group */ ++ OMX_U32 nGroupID; /**< ID of the component group */ ++} OMX_PRIORITYMGMTTYPE; ++ ++/* Component name and Role names are limited to 128 characters including the terminating '\0'. */ ++#define OMX_MAX_STRINGNAME_SIZE 128 ++ ++/** @ingroup comp */ ++typedef struct OMX_PARAM_COMPONENTROLETYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */ ++} OMX_PARAM_COMPONENTROLETYPE; ++ ++/** End of Stream Buffer Flag: ++ * ++ * A component sets EOS when it has no more data to emit on a particular ++ * output port. Thus an output port shall set EOS on the last buffer it ++ * emits. A component's determination of when an output port should ++ * cease sending data is implemenation specific. ++ * @ingroup buf ++ */ ++ ++#define OMX_BUFFERFLAG_EOS 0x00000001 ++ ++/** Start Time Buffer Flag: ++ * ++ * The source of a stream (e.g. a demux component) sets the STARTTIME ++ * flag on the buffer that contains the starting timestamp for the ++ * stream. The starting timestamp corresponds to the first data that ++ * should be displayed at startup or after a seek. ++ * The first timestamp of the stream is not necessarily the start time. ++ * For instance, in the case of a seek to a particular video frame, ++ * the target frame may be an interframe. Thus the first buffer of ++ * the stream will be the intra-frame preceding the target frame and ++ * the starttime will occur with the target frame (with any other ++ * required frames required to reconstruct the target intervening). ++ * ++ * The STARTTIME flag is directly associated with the buffer's ++ * timestamp ' thus its association to buffer data and its ++ * propagation is identical to the timestamp's. ++ * ++ * When a Sync Component client receives a buffer with the ++ * STARTTIME flag it shall perform a SetConfig on its sync port ++ * using OMX_ConfigTimeClientStartTime and passing the buffer's ++ * timestamp. ++ * ++ * @ingroup buf ++ */ ++ ++#define OMX_BUFFERFLAG_STARTTIME 0x00000002 ++ ++ ++ ++/** Decode Only Buffer Flag: ++ * ++ * The source of a stream (e.g. a demux component) sets the DECODEONLY ++ * flag on any buffer that should shall be decoded but should not be ++ * displayed. This flag is used, for instance, when a source seeks to ++ * a target interframe that requires the decode of frames preceding the ++ * target to facilitate the target's reconstruction. In this case the ++ * source would emit the frames preceding the target downstream ++ * but mark them as decode only. ++ * ++ * The DECODEONLY is associated with buffer data and propagated in a ++ * manner identical to the buffer timestamp. ++ * ++ * A component that renders data should ignore all buffers with ++ * the DECODEONLY flag set. ++ * ++ * @ingroup buf ++ */ ++ ++#define OMX_BUFFERFLAG_DECODEONLY 0x00000004 ++ ++ ++/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt ++ * @ingroup buf ++ */ ++ ++#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008 ++ ++/* End of Frame: The buffer contains exactly one end of frame and no data ++ * occurs after the end of frame. This flag is an optional hint. The absence ++ * of this flag does not imply the absence of an end of frame within the buffer. ++ * @ingroup buf ++*/ ++#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010 ++ ++/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' ++ * a frame that has no dependency on any other frame information ++ * @ingroup buf ++ */ ++#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020 ++ ++/* Extra data present flag: there is extra data appended to the data stream ++ * residing in the buffer ++ * @ingroup buf ++ */ ++#define OMX_BUFFERFLAG_EXTRADATA 0x00000040 ++ ++/** Codec Config Buffer Flag: ++* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an ++* output port when all bytes in the buffer form part or all of a set of ++* codec specific configuration data. Examples include SPS/PPS nal units ++* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for ++* OMX_AUDIO_CodingAAC. Any component that for a given stream sets ++* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes ++* with frame data in the same buffer, and shall send all buffers ++* containing codec configuration bytes before any buffers containing ++* frame data that those configurations bytes describe. ++* If the stream format for a particular codec has a frame specific ++* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or ++* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as ++* normal without setting OMX_BUFFERFLAG_CODECCONFIG. ++ * @ingroup buf ++ */ ++#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080 ++ ++ ++ ++/** @ingroup buf */ ++typedef struct OMX_BUFFERHEADERTYPE ++{ ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U8* pBuffer; /**< Pointer to actual block of memory ++ that is acting as the buffer */ ++ OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */ ++ OMX_U32 nFilledLen; /**< number of bytes currently in the ++ buffer */ ++ OMX_U32 nOffset; /**< start offset of valid data in bytes from ++ the start of the buffer */ ++ OMX_PTR pAppPrivate; /**< pointer to any data the application ++ wants to associate with this buffer */ ++ OMX_PTR pPlatformPrivate; /**< pointer to any data the platform ++ wants to associate with this buffer */ ++ OMX_PTR pInputPortPrivate; /**< pointer to any data the input port ++ wants to associate with this buffer */ ++ OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port ++ wants to associate with this buffer */ ++ OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a ++ mark event upon processing this buffer. */ ++ OMX_PTR pMarkData; /**< Application specific data associated with ++ the mark sent on a mark event to disambiguate ++ this mark from others. */ ++ OMX_U32 nTickCount; /**< Optional entry that the component and ++ application can update with a tick count ++ when they access the component. This ++ value should be in microseconds. Since ++ this is a value relative to an arbitrary ++ starting point, this value cannot be used ++ to determine absolute time. This is an ++ optional entry and not all components ++ will update it.*/ ++ OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample ++ starting at the first logical sample ++ boundary in the buffer. Timestamps of ++ successive samples within the buffer may ++ be inferred by adding the duration of the ++ of the preceding buffer to the timestamp ++ of the preceding buffer.*/ ++ OMX_U32 nFlags; /**< buffer specific flags */ ++ OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using ++ this buffer */ ++ OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using ++ this buffer */ ++#if 1 //jiangy ++ OMX_U8 *pRealBuf; /* device address use to store frame/pict data */ ++ OMX_U8 *pHostPrivBuf; /* host address to upload/download fram/pict data */ ++ OMX_U8 *pHostBuf; /* aligned host buf address */ ++#endif ++} OMX_BUFFERHEADERTYPE; ++ ++/** The OMX_EXTRADATATYPE enumeration is used to define the ++ * possible extra data payload types. ++ * NB: this enum is binary backwards compatible with the previous ++ * OMX_EXTRADATA_QUANT define. This should be replaced with ++ * OMX_ExtraDataQuantization. ++ */ ++typedef enum OMX_EXTRADATATYPE ++{ ++ OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */ ++ OMX_ExtraDataQuantization, /**< The data payload contains quantization data */ ++ OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_ExtraDataMax = 0x7FFFFFFF ++} OMX_EXTRADATATYPE; ++ ++ ++typedef struct OMX_OTHER_EXTRADATATYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_EXTRADATATYPE eType; /* Extra Data type */ ++ OMX_U32 nDataSize; /* Size of the supporting data to follow */ ++ OMX_U8 data[1]; /* Supporting data hint */ ++} OMX_OTHER_EXTRADATATYPE; ++ ++/** @ingroup comp */ ++typedef struct OMX_PORT_PARAM_TYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPorts; /**< The number of ports for this component */ ++ OMX_U32 nStartPortNumber; /** first port number for this type of port */ ++} OMX_PORT_PARAM_TYPE; ++ ++/** @ingroup comp */ ++typedef enum OMX_EVENTTYPE ++{ ++ OMX_EventCmdComplete, /**< component has sucessfully completed a command */ ++ OMX_EventError, /**< component has detected an error condition */ ++ OMX_EventMark, /**< component has detected a buffer mark */ ++ OMX_EventPortSettingsChanged, /**< component is reported a port settings change */ ++ OMX_EventBufferFlag, /**< component has detected an EOS */ ++ OMX_EventResourcesAcquired, /**< component has been granted resources and is ++ automatically starting the state change from ++ OMX_StateWaitForResources to OMX_StateIdle. */ ++ OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */ ++ OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */ ++ OMX_EventPortFormatDetected, /**< Component has detected a supported format. */ ++ OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ ++ /** Event when tunneled decoder has rendered an output or reached EOS ++ * nData1 must contain the number of timestamps returned ++ * pEventData must point to an array of the OMX_VIDEO_RENDEREVENTTYPE structs containing the ++ * render-timestamps of each frame. Component may batch rendered timestamps using this event, ++ * but must signal the event no more than 40ms after the first frame in the batch. The frames ++ * must be ordered by system timestamp inside and across batches. ++ * ++ * The component shall signal the render-timestamp of the very first frame (as well as the ++ * first frame after each flush) unbatched (with nData1 set to 1) within 5 msec. ++ * ++ * If component is doing frame-rate conversion, it must signal the render time of each ++ * converted frame, and must interpolate media timestamps for in-between frames. ++ * ++ * When the component reached EOS, it must signal an EOS timestamp using the same mechanism. ++ * This is in addition to the timestamp of the last rendered frame, and should follow that ++ * frame. ++ */ ++ OMX_EventOutputRendered = 0x7F000001, ++ ++ /** For framework internal use only: event sent by OMXNodeInstance when it receives a graphic ++ * input buffer with a new dataspace for encoding. |arg1| will contain the dataspace. |arg2| ++ * will contain the ColorAspects requested by the component (or framework defaults) using ++ * the following bitfield layout: ++ * ++ * +----------+-------------+----------------+------------+ ++ * | Range | Primaries | MatrixCoeffs | Transfer | ++ * +----------+-------------+----------------+------------+ ++ * bits: 31....24 23.......16 15...........8 7........0 ++ * ++ * TODO: We would really need to tie this to an output buffer, but OMX does not provide a ++ * fool-proof way to do that for video encoders. ++ */ ++ OMX_EventDataSpaceChanged, ++ ++ /** ++ * Event when a component has an updated configuration on output for the client to retrieve. ++ * |arg1| contains the port index (currently only output port is valid). |arg2| contains the ++ * index of the updated config. ++ * ++ * For config updates that's associated with one frame, the update should be applied to the ++ * next output frame that comes in EmptyBufferDone callback. ++ * ++ * Upon receiving this event, the client must call the corresponding OMX_GetConfig to retrieve ++ * the config update. ++ */ ++ OMX_EventConfigUpdate, ++ ++ OMX_EventMax = 0x7FFFFFFF ++} OMX_EVENTTYPE; ++ ++typedef struct OMX_CALLBACKTYPE ++{ ++ /** The EventHandler method is used to notify the application when an ++ event of interest occurs. Events are defined in the OMX_EVENTTYPE ++ enumeration. Please see that enumeration for details of what will ++ be returned for each type of event. Callbacks should not return ++ an error to the component, so if an error occurs, the application ++ shall handle it internally. This is a blocking call. ++ ++ The application should return from this call within 5 msec to avoid ++ blocking the component for an excessively long period of time. ++ ++ @param hComponent ++ handle of the component to access. This is the component ++ handle returned by the call to the GetHandle function. ++ @param pAppData ++ pointer to an application defined value that was provided in the ++ pAppData parameter to the OMX_GetHandle method for the component. ++ This application defined value is provided so that the application ++ can have a component specific context when receiving the callback. ++ @param eEvent ++ Event that the component wants to notify the application about. ++ @param nData1 ++ nData will be the OMX_ERRORTYPE for an error event and will be ++ an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event. ++ @param nData2 ++ nData2 will hold further information related to the event. Can be OMX_STATETYPE for ++ a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event. ++ Default value is 0 if not used. ) ++ @param pEventData ++ Pointer to additional event-specific data (see spec for meaning). ++ */ ++ ++ OMX_ERRORTYPE (*EventHandler)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_PTR pAppData, ++ OMX_IN OMX_EVENTTYPE eEvent, ++ OMX_IN OMX_U32 nData1, ++ OMX_IN OMX_U32 nData2, ++ OMX_IN OMX_PTR pEventData); ++ ++ /** The EmptyBufferDone method is used to return emptied buffers from an ++ input port back to the application for reuse. This is a blocking call ++ so the application should not attempt to refill the buffers during this ++ call, but should queue them and refill them in another thread. There ++ is no error return, so the application shall handle any errors generated ++ internally. ++ ++ The application should return from this call within 5 msec. ++ ++ @param hComponent ++ handle of the component to access. This is the component ++ handle returned by the call to the GetHandle function. ++ @param pAppData ++ pointer to an application defined value that was provided in the ++ pAppData parameter to the OMX_GetHandle method for the component. ++ This application defined value is provided so that the application ++ can have a component specific context when receiving the callback. ++ @param pBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer ++ or AllocateBuffer indicating the buffer that was emptied. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*EmptyBufferDone)( ++ OMX_IN OMX_HANDLETYPE hComponent, ++ OMX_IN OMX_PTR pAppData, ++ OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); ++ ++ /** The FillBufferDone method is used to return filled buffers from an ++ output port back to the application for emptying and then reuse. ++ This is a blocking call so the application should not attempt to ++ empty the buffers during this call, but should queue the buffers ++ and empty them in another thread. There is no error return, so ++ the application shall handle any errors generated internally. The ++ application shall also update the buffer header to indicate the ++ number of bytes placed into the buffer. ++ ++ The application should return from this call within 5 msec. ++ ++ @param hComponent ++ handle of the component to access. This is the component ++ handle returned by the call to the GetHandle function. ++ @param pAppData ++ pointer to an application defined value that was provided in the ++ pAppData parameter to the OMX_GetHandle method for the component. ++ This application defined value is provided so that the application ++ can have a component specific context when receiving the callback. ++ @param pBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer ++ or AllocateBuffer indicating the buffer that was filled. ++ @ingroup buf ++ */ ++ OMX_ERRORTYPE (*FillBufferDone)( ++ OMX_OUT OMX_HANDLETYPE hComponent, ++ OMX_OUT OMX_PTR pAppData, ++ OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); ++ ++} OMX_CALLBACKTYPE; ++ ++/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier ++ preference when tunneling between two ports. ++ @ingroup tun buf ++*/ ++typedef enum OMX_BUFFERSUPPLIERTYPE ++{ ++ OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified, ++ or don't care */ ++ OMX_BufferSupplyInput, /**< input port supplies the buffers */ ++ OMX_BufferSupplyOutput, /**< output port supplies the buffers */ ++ OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_BufferSupplyMax = 0x7FFFFFFF ++} OMX_BUFFERSUPPLIERTYPE; ++ ++ ++/** buffer supplier parameter ++ * @ingroup tun ++ */ ++typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE { ++ OMX_U32 nSize; /**< size of the structure in bytes */ ++ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ ++ OMX_U32 nPortIndex; /**< port that this structure applies to */ ++ OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */ ++} OMX_PARAM_BUFFERSUPPLIERTYPE; ++ ++ ++/**< indicates that buffers received by an input port of a tunnel ++ may not modify the data in the buffers ++ @ingroup tun ++ */ ++#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 ++ ++ ++/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output ++ port to an input port as part the two ComponentTunnelRequest calls ++ resulting from a OMX_SetupTunnel call from the IL Client. ++ @ingroup tun ++ */ ++typedef struct OMX_TUNNELSETUPTYPE ++{ ++ OMX_U32 nTunnelFlags; /**< bit flags for tunneling */ ++ OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */ ++} OMX_TUNNELSETUPTYPE; ++ ++/* OMX Component headers is included to enable the core to use ++ macros for functions into the component for OMX release 1.0. ++ Developers should not access any structures or data from within ++ the component header directly */ ++/* TO BE REMOVED - #include */ ++ ++/** GetComponentVersion will return information about the component. ++ This is a blocking call. This macro will go directly from the ++ application to the component (via a core macro). The ++ component will return from this call within 5 msec. ++ @param [in] hComponent ++ handle of component to execute the command ++ @param [out] pComponentName ++ pointer to an empty string of length 128 bytes. The component ++ will write its name into this string. The name will be ++ terminated by a single zero byte. The name of a component will ++ be 127 bytes or less to leave room for the trailing zero byte. ++ An example of a valid component name is "OMX.ABC.ChannelMixer\0". ++ @param [out] pComponentVersion ++ pointer to an OMX Version structure that the component will fill ++ in. The component will fill in a value that indicates the ++ component version. NOTE: the component version is NOT the same ++ as the OMX Specification version (found in all structures). The ++ component version is defined by the vendor of the component and ++ its value is entirely up to the component vendor. ++ @param [out] pSpecVersion ++ pointer to an OMX Version structure that the component will fill ++ in. The SpecVersion is the version of the specification that the ++ component was built against. Please note that this value may or ++ may not match the structure's version. For example, if the ++ component was built against the 2.0 specification, but the ++ application (which creates the structure is built against the ++ 1.0 specification the versions would be different. ++ @param [out] pComponentUUID ++ pointer to the UUID of the component which will be filled in by ++ the component. The UUID is a unique identifier that is set at ++ RUN time for the component and is unique to each instantion of ++ the component. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_GetComponentVersion( \ ++ hComponent, \ ++ pComponentName, \ ++ pComponentVersion, \ ++ pSpecVersion, \ ++ pComponentUUID) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->GetComponentVersion(\ ++ hComponent, \ ++ pComponentName, \ ++ pComponentVersion, \ ++ pSpecVersion, \ ++ pComponentUUID) /* Macro End */ ++ ++ ++/** Send a command to the component. This call is a non-blocking call. ++ The component should check the parameters and then queue the command ++ to the component thread to be executed. The component thread shall ++ send the EventHandler() callback at the conclusion of the command. ++ This macro will go directly from the application to the component (via ++ a core macro). The component will return from this call within 5 msec. ++ ++ When the command is "OMX_CommandStateSet" the component will queue a ++ state transition to the new state idenfied in nParam. ++ ++ The component shall transition from executing to loaded state within 500 msec. ++ ++ When the command is "OMX_CommandFlush", to flush a port's buffer queues, ++ the command will force the component to return all buffers NOT CURRENTLY ++ BEING PROCESSED to the application, in the order in which the buffers ++ were received. ++ ++ The component shall finish flusing each port within 5 msec. ++ ++ When the command is "OMX_CommandPortDisable" or ++ "OMX_CommandPortEnable", the component's port (given by the value of ++ nParam) will be stopped or restarted. ++ ++ The component shall finish disabling/reenabling each port within 5 msec. ++ ++ When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the ++ pCmdData will point to a OMX_MARKTYPE structure containing the component ++ handle of the component to examine the buffer chain for the mark. nParam1 ++ contains the index of the port on which the buffer mark is applied. ++ ++ Specification text for more details. ++ ++ @param [in] hComponent ++ handle of component to execute the command ++ @param [in] Cmd ++ Command for the component to execute ++ @param [in] nParam ++ Parameter for the command to be executed. When Cmd has the value ++ OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has ++ the value OMX_CommandFlush, value of nParam indicates which port(s) ++ to flush. -1 is used to flush all ports a single port index will ++ only flush that port. When Cmd has the value "OMX_CommandPortDisable" ++ or "OMX_CommandPortEnable", the component's port is given by ++ the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer" ++ the components pot is given by the value of nParam. ++ @param [in] pCmdData ++ Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value ++ "OMX_CommandMarkBuffer". ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_SendCommand( \ ++ hComponent, \ ++ Cmd, \ ++ nParam, \ ++ pCmdData) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->SendCommand( \ ++ hComponent, \ ++ Cmd, \ ++ nParam, \ ++ pCmdData) /* Macro End */ ++ ++ ++/** The OMX_GetParameter macro will get one of the current parameter ++ settings from the component. This macro cannot only be invoked when ++ the component is in the OMX_StateInvalid state. The nParamIndex ++ parameter is used to indicate which structure is being requested from ++ the component. The application shall allocate the correct structure ++ and shall fill in the structure size and version information before ++ invoking this macro. When the parameter applies to a port, the ++ caller shall fill in the appropriate nPortIndex value indicating the ++ port on which the parameter applies. If the component has not had ++ any settings changed, then the component should return a set of ++ valid DEFAULT parameters for the component. This is a blocking ++ call. ++ ++ The component should return from this call within 20 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] nParamIndex ++ Index of the structure to be filled. This value is from the ++ OMX_INDEXTYPE enumeration. ++ @param [in,out] pComponentParameterStructure ++ Pointer to application allocated structure to be filled by the ++ component. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_GetParameter( \ ++ hComponent, \ ++ nParamIndex, \ ++ pComponentParameterStructure) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->GetParameter( \ ++ hComponent, \ ++ nParamIndex, \ ++ pComponentParameterStructure) /* Macro End */ ++ ++ ++/** The OMX_SetParameter macro will send an initialization parameter ++ structure to a component. Each structure shall be sent one at a time, ++ in a separate invocation of the macro. This macro can only be ++ invoked when the component is in the OMX_StateLoaded state, or the ++ port is disabled (when the parameter applies to a port). The ++ nParamIndex parameter is used to indicate which structure is being ++ passed to the component. The application shall allocate the ++ correct structure and shall fill in the structure size and version ++ information (as well as the actual data) before invoking this macro. ++ The application is free to dispose of this structure after the call ++ as the component is required to copy any data it shall retain. This ++ is a blocking call. ++ ++ The component should return from this call within 20 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] nIndex ++ Index of the structure to be sent. This value is from the ++ OMX_INDEXTYPE enumeration. ++ @param [in] pComponentParameterStructure ++ pointer to application allocated structure to be used for ++ initialization by the component. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_SetParameter( \ ++ hComponent, \ ++ nParamIndex, \ ++ pComponentParameterStructure) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->SetParameter( \ ++ hComponent, \ ++ nParamIndex, \ ++ pComponentParameterStructure) /* Macro End */ ++ ++ ++/** The OMX_GetConfig macro will get one of the configuration structures ++ from a component. This macro can be invoked anytime after the ++ component has been loaded. The nParamIndex call parameter is used to ++ indicate which structure is being requested from the component. The ++ application shall allocate the correct structure and shall fill in the ++ structure size and version information before invoking this macro. ++ If the component has not had this configuration parameter sent before, ++ then the component should return a set of valid DEFAULT values for the ++ component. This is a blocking call. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] nIndex ++ Index of the structure to be filled. This value is from the ++ OMX_INDEXTYPE enumeration. ++ @param [in,out] pComponentConfigStructure ++ pointer to application allocated structure to be filled by the ++ component. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++*/ ++#define OMX_GetConfig( \ ++ hComponent, \ ++ nConfigIndex, \ ++ pComponentConfigStructure) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->GetConfig( \ ++ hComponent, \ ++ nConfigIndex, \ ++ pComponentConfigStructure) /* Macro End */ ++ ++ ++/** The OMX_SetConfig macro will send one of the configuration ++ structures to a component. Each structure shall be sent one at a time, ++ each in a separate invocation of the macro. This macro can be invoked ++ anytime after the component has been loaded. The application shall ++ allocate the correct structure and shall fill in the structure size ++ and version information (as well as the actual data) before invoking ++ this macro. The application is free to dispose of this structure after ++ the call as the component is required to copy any data it shall retain. ++ This is a blocking call. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] nConfigIndex ++ Index of the structure to be sent. This value is from the ++ OMX_INDEXTYPE enumeration above. ++ @param [in] pComponentConfigStructure ++ pointer to application allocated structure to be used for ++ initialization by the component. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_SetConfig( \ ++ hComponent, \ ++ nConfigIndex, \ ++ pComponentConfigStructure) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->SetConfig( \ ++ hComponent, \ ++ nConfigIndex, \ ++ pComponentConfigStructure) /* Macro End */ ++ ++ ++/** The OMX_GetExtensionIndex macro will invoke a component to translate ++ a vendor specific configuration or parameter string into an OMX ++ structure index. There is no requirement for the vendor to support ++ this command for the indexes already found in the OMX_INDEXTYPE ++ enumeration (this is done to save space in small components). The ++ component shall support all vendor supplied extension indexes not found ++ in the master OMX_INDEXTYPE enumeration. This is a blocking call. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the GetHandle function. ++ @param [in] cParameterName ++ OMX_STRING that shall be less than 128 characters long including ++ the trailing null byte. This is the string that will get ++ translated by the component into a configuration index. ++ @param [out] pIndexType ++ a pointer to a OMX_INDEXTYPE to receive the index value. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_GetExtensionIndex( \ ++ hComponent, \ ++ cParameterName, \ ++ pIndexType) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->GetExtensionIndex( \ ++ hComponent, \ ++ cParameterName, \ ++ pIndexType) /* Macro End */ ++ ++ ++/** The OMX_GetState macro will invoke the component to get the current ++ state of the component and place the state value into the location ++ pointed to by pState. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [out] pState ++ pointer to the location to receive the state. The value returned ++ is one of the OMX_STATETYPE members ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp ++ */ ++#define OMX_GetState( \ ++ hComponent, \ ++ pState) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->GetState( \ ++ hComponent, \ ++ pState) /* Macro End */ ++ ++ ++/** The OMX_UseBuffer macro will request that the component use ++ a buffer (and allocate its own buffer header) already allocated ++ by another component, or by the IL Client. This is a blocking ++ call. ++ ++ The component should return from this call within 20 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [out] ppBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure used to receive the ++ pointer to the buffer header ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++ ++#define OMX_UseBuffer( \ ++ hComponent, \ ++ ppBufferHdr, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ nSizeBytes, \ ++ pBuffer) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->UseBuffer( \ ++ hComponent, \ ++ ppBufferHdr, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ nSizeBytes, \ ++ pBuffer) ++ ++ ++/** The OMX_AllocateBuffer macro will request that the component allocate ++ a new buffer and buffer header. The component will allocate the ++ buffer and the buffer header and return a pointer to the buffer ++ header. This is a blocking call. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [out] ppBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure used to receive ++ the pointer to the buffer header ++ @param [in] nPortIndex ++ nPortIndex is used to select the port on the component the buffer will ++ be used with. The port can be found by using the nPortIndex ++ value as an index into the Port Definition array of the component. ++ @param [in] pAppPrivate ++ pAppPrivate is used to initialize the pAppPrivate member of the ++ buffer header structure. ++ @param [in] nSizeBytes ++ size of the buffer to allocate. Used when bAllocateNew is true. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++#define OMX_AllocateBuffer( \ ++ hComponent, \ ++ ppBuffer, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ nSizeBytes) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->AllocateBuffer( \ ++ hComponent, \ ++ ppBuffer, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ nSizeBytes) /* Macro End */ ++ ++ ++/** The OMX_FreeBuffer macro will release a buffer header from the component ++ which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If ++ the component allocated the buffer (see the OMX_UseBuffer macro) then ++ the component shall free the buffer and buffer header. This is a ++ blocking call. ++ ++ The component should return from this call within 20 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] nPortIndex ++ nPortIndex is used to select the port on the component the buffer will ++ be used with. ++ @param [in] pBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer ++ or AllocateBuffer. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++#define OMX_FreeBuffer( \ ++ hComponent, \ ++ nPortIndex, \ ++ pBuffer) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->FreeBuffer( \ ++ hComponent, \ ++ nPortIndex, \ ++ pBuffer) /* Macro End */ ++ ++ ++/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an ++ input port of a component. The buffer will be emptied by the component ++ and returned to the application via the EmptyBufferDone call back. ++ This is a non-blocking call in that the component will record the buffer ++ and return immediately and then empty the buffer, later, at the proper ++ time. As expected, this macro may be invoked only while the component ++ is in the OMX_StateExecuting. If nPortIndex does not specify an input ++ port, the component shall return an error. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] pBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer ++ or AllocateBuffer. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++#define OMX_EmptyThisBuffer( \ ++ hComponent, \ ++ pBuffer) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->EmptyThisBuffer( \ ++ hComponent, \ ++ pBuffer) /* Macro End */ ++ ++ ++/** The OMX_FillThisBuffer macro will send an empty buffer to an ++ output port of a component. The buffer will be filled by the component ++ and returned to the application via the FillBufferDone call back. ++ This is a non-blocking call in that the component will record the buffer ++ and return immediately and then fill the buffer, later, at the proper ++ time. As expected, this macro may be invoked only while the component ++ is in the OMX_ExecutingState. If nPortIndex does not specify an output ++ port, the component shall return an error. ++ ++ The component should return from this call within 5 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [in] pBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer ++ or AllocateBuffer. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++#define OMX_FillThisBuffer( \ ++ hComponent, \ ++ pBuffer) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->FillThisBuffer( \ ++ hComponent, \ ++ pBuffer) /* Macro End */ ++ ++ ++ ++/** The OMX_UseEGLImage macro will request that the component use ++ a EGLImage provided by EGL (and allocate its own buffer header) ++ This is a blocking call. ++ ++ The component should return from this call within 20 msec. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the OMX_GetHandle function. ++ @param [out] ppBuffer ++ pointer to an OMX_BUFFERHEADERTYPE structure used to receive the ++ pointer to the buffer header. Note that the memory location used ++ for this buffer is NOT visible to the IL Client. ++ @param [in] nPortIndex ++ nPortIndex is used to select the port on the component the buffer will ++ be used with. The port can be found by using the nPortIndex ++ value as an index into the Port Definition array of the component. ++ @param [in] pAppPrivate ++ pAppPrivate is used to initialize the pAppPrivate member of the ++ buffer header structure. ++ @param [in] eglImage ++ eglImage contains the handle of the EGLImage to use as a buffer on the ++ specified port. The component is expected to validate properties of ++ the EGLImage against the configuration of the port to ensure the component ++ can use the EGLImage as a buffer. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup comp buf ++ */ ++#define OMX_UseEGLImage( \ ++ hComponent, \ ++ ppBufferHdr, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ eglImage) \ ++ ((OMX_COMPONENTTYPE*)(hComponent))->UseEGLImage( \ ++ hComponent, \ ++ ppBufferHdr, \ ++ nPortIndex, \ ++ pAppPrivate, \ ++ eglImage) ++ ++/** The OMX_Init method is used to initialize the OMX core. It shall be the ++ first call made into OMX and it should only be executed one time without ++ an interviening OMX_Deinit call. ++ ++ The core should return from this call within 20 msec. ++ ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void); ++ ++ ++/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be ++ the last call made into OMX. In the event that the core determines that ++ thare are components loaded when this call is made, the core may return ++ with an error rather than try to unload the components. ++ ++ The core should return from this call within 20 msec. ++ ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void); ++ ++ ++/** The OMX_ComponentNameEnum method will enumerate through all the names of ++ recognised valid components in the system. This function is provided ++ as a means to detect all the components in the system run-time. There is ++ no strict ordering to the enumeration order of component names, although ++ each name will only be enumerated once. If the OMX core supports run-time ++ installation of new components, it is only requried to detect newly ++ installed components when the first call to enumerate component names ++ is made (i.e. when nIndex is 0x0). ++ ++ The core should return from this call in 20 msec. ++ ++ @param [out] cComponentName ++ pointer to a null terminated string with the component name. The ++ names of the components are strings less than 127 bytes in length ++ plus the trailing null for a maximum size of 128 bytes. An example ++ of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are ++ assigned by the vendor, but shall start with "OMX." and then have ++ the Vendor designation next. ++ @param [in] nNameLength ++ number of characters in the cComponentName string. With all ++ component name strings restricted to less than 128 characters ++ (including the trailing null) it is recomended that the caller ++ provide a input string for the cComponentName of 128 characters. ++ @param [in] nIndex ++ number containing the enumeration index for the component. ++ Multiple calls to OMX_ComponentNameEnum with increasing values ++ of nIndex will enumerate through the component names in the ++ system until OMX_ErrorNoMore is returned. The value of nIndex ++ is 0 to (N-1), where N is the number of valid installed components ++ in the system. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. When the value of nIndex exceeds the number of ++ components in the system minus 1, OMX_ErrorNoMore will be ++ returned. Otherwise the appropriate OMX error will be returned. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum( ++ OMX_OUT OMX_STRING cComponentName, ++ OMX_IN OMX_U32 nNameLength, ++ OMX_IN OMX_U32 nIndex); ++ ++ ++/** The OMX_GetHandle method will locate the component specified by the ++ component name given, load that component into memory and then invoke ++ the component's methods to create an instance of the component. ++ ++ The core should return from this call within 20 msec. ++ ++ @param [out] pHandle ++ pointer to an OMX_HANDLETYPE pointer to be filled in by this method. ++ @param [in] cComponentName ++ pointer to a null terminated string with the component name. The ++ names of the components are strings less than 127 bytes in length ++ plus the trailing null for a maximum size of 128 bytes. An example ++ of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are ++ assigned by the vendor, but shall start with "OMX." and then have ++ the Vendor designation next. ++ @param [in] pAppData ++ pointer to an application defined value that will be returned ++ during callbacks so that the application can identify the source ++ of the callback. ++ @param [in] pCallBacks ++ pointer to a OMX_CALLBACKTYPE structure that will be passed to the ++ component to initialize it with. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( ++ OMX_OUT OMX_HANDLETYPE* pHandle, ++ OMX_IN OMX_STRING cComponentName, ++ OMX_IN OMX_PTR pAppData, ++ OMX_IN OMX_CALLBACKTYPE* pCallBacks); ++ ++ ++/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle ++ method. If the component reference count goes to zero, the component will ++ be unloaded from memory. ++ ++ The core should return from this call within 20 msec when the component is ++ in the OMX_StateLoaded state. ++ ++ @param [in] hComponent ++ Handle of the component to be accessed. This is the component ++ handle returned by the call to the GetHandle function. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( ++ OMX_IN OMX_HANDLETYPE hComponent); ++ ++ ++ ++/** The OMX_SetupTunnel method will handle the necessary calls to the components ++ to setup the specified tunnel the two components. NOTE: This is ++ an actual method (not a #define macro). This method will make calls into ++ the component ComponentTunnelRequest method to do the actual tunnel ++ connection. ++ ++ The ComponentTunnelRequest method on both components will be called. ++ This method shall not be called unless the component is in the ++ OMX_StateLoaded state except when the ports used for the tunnel are ++ disabled. In this case, the component may be in the OMX_StateExecuting, ++ OMX_StatePause, or OMX_StateIdle states. ++ ++ The core should return from this call within 20 msec. ++ ++ @param [in] hOutput ++ Handle of the component to be accessed. Also this is the handle ++ of the component whose port, specified in the nPortOutput parameter ++ will be used the source for the tunnel. This is the component handle ++ returned by the call to the OMX_GetHandle function. There is a ++ requirement that hOutput be the source for the data when ++ tunelling (i.e. nPortOutput is an output port). If 0x0, the component ++ specified in hInput will have it's port specified in nPortInput ++ setup for communication with the application / IL client. ++ @param [in] nPortOutput ++ nPortOutput is used to select the source port on component to be ++ used in the tunnel. ++ @param [in] hInput ++ This is the component to setup the tunnel with. This is the handle ++ of the component whose port, specified in the nPortInput parameter ++ will be used the destination for the tunnel. This is the component handle ++ returned by the call to the OMX_GetHandle function. There is a ++ requirement that hInput be the destination for the data when ++ tunelling (i.e. nPortInut is an input port). If 0x0, the component ++ specified in hOutput will have it's port specified in nPortPOutput ++ setup for communication with the application / IL client. ++ @param [in] nPortInput ++ nPortInput is used to select the destination port on component to be ++ used in the tunnel. ++ @return OMX_ERRORTYPE ++ If the command successfully executes, the return code will be ++ OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. ++ When OMX_ErrorNotImplemented is returned, one or both components is ++ a non-interop component and does not support tunneling. ++ ++ On failure, the ports of both components are setup for communication ++ with the application / IL Client. ++ @ingroup core tun ++ */ ++OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel( ++ OMX_IN OMX_HANDLETYPE hOutput, ++ OMX_IN OMX_U32 nPortOutput, ++ OMX_IN OMX_HANDLETYPE hInput, ++ OMX_IN OMX_U32 nPortInput); ++ ++/** @ingroup cp */ ++OMX_API OMX_ERRORTYPE OMX_GetContentPipe( ++ OMX_OUT OMX_HANDLETYPE *hPipe, ++ OMX_IN OMX_STRING szURI); ++ ++/** The OMX_GetComponentsOfRole method will return the number of components that support the given ++ role and (if the compNames field is non-NULL) the names of those components. The call will fail if ++ an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the ++ client should: ++ * first call this function with the compNames field NULL to determine the number of component names ++ * second call this function with the compNames field pointing to an array of names allocated ++ according to the number returned by the first call. ++ ++ The core should return from this call within 5 msec. ++ ++ @param [in] role ++ This is generic standard component name consisting only of component class ++ name and the type within that class (e.g. 'audio_decoder.aac'). ++ @param [inout] pNumComps ++ This is used both as input and output. ++ ++ If compNames is NULL, the input is ignored and the output specifies how many components support ++ the given role. ++ ++ If compNames is not NULL, on input it bounds the size of the input structure and ++ on output, it specifies the number of components string names listed within the compNames parameter. ++ @param [inout] compNames ++ If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts ++ a list of the names of all physical components that implement the specified standard component name. ++ Each name is NULL terminated. numComps indicates the number of names. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( ++ OMX_IN OMX_STRING role, ++ OMX_INOUT OMX_U32 *pNumComps, ++ OMX_INOUT OMX_U8 **compNames); ++ ++/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given ++ component and (if the roles field is non-NULL) the names of those roles. The call will fail if ++ an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the ++ client should: ++ * first call this function with the roles field NULL to determine the number of role names ++ * second call this function with the roles field pointing to an array of names allocated ++ according to the number returned by the first call. ++ ++ The core should return from this call within 5 msec. ++ ++ @param [in] compName ++ This is the name of the component being queried about. ++ @param [inout] pNumRoles ++ This is used both as input and output. ++ ++ If roles is NULL, the input is ignored and the output specifies how many roles the component supports. ++ ++ If compNames is not NULL, on input it bounds the size of the input structure and ++ on output, it specifies the number of roles string names listed within the roles parameter. ++ @param [out] roles ++ If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings ++ which accepts a list of the names of all standard components roles implemented on the ++ specified component name. numComps indicates the number of names. ++ @ingroup core ++ */ ++OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( ++ OMX_IN OMX_STRING compName, ++ OMX_INOUT OMX_U32 *pNumRoles, ++ OMX_OUT OMX_U8 **roles); ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif ++/* File EOF */ ++ +diff --git a/libavcodec/OMX_IVCommon.h b/libavcodec/OMX_IVCommon.h +new file mode 100755 +index 0000000..40bd3f7 +--- /dev/null ++++ b/libavcodec/OMX_IVCommon.h +@@ -0,0 +1,966 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/** ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** ++ * @file OMX_IVCommon.h - OpenMax IL version 1.1.2 ++ * The structures needed by Video and Image components to exchange ++ * parameters and configuration data with the components. ++ */ ++#ifndef OMX_IVCommon_h ++#define OMX_IVCommon_h ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++/** ++ * Each OMX header must include all required header files to allow the header ++ * to compile without errors. The includes below are required for this header ++ * file to compile successfully ++ */ ++ ++#include "OMX_Core.h" ++ ++/** @defgroup iv OpenMAX IL Imaging and Video Domain ++ * Common structures for OpenMAX IL Imaging and Video domains ++ * @{ ++ */ ++ ++ ++/** ++ * Enumeration defining possible uncompressed image/video formats. ++ * ++ * ENUMS: ++ * Unused : Placeholder value when format is N/A ++ * Monochrome : black and white ++ * 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0 ++ * 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0 ++ * 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0 ++ * 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0 ++ * 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0 ++ * 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0 ++ * 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0 ++ * 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0 ++ * 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0 ++ * 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0 ++ * 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0 ++ * 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0 ++ * 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0 ++ * 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0 ++ * 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0 ++ * YUV411Planar : U,Y are subsampled by a factor of 4 horizontally ++ * YUV411PackedPlanar : packed per payload in planar slices ++ * YUV420Planar : Three arrays Y,U,V. ++ * YUV420PackedPlanar : packed per payload in planar slices ++ * YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V ++ * YUV422Planar : Three arrays Y,U,V. ++ * YUV422PackedPlanar : packed per payload in planar slices ++ * YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V ++ * YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr) ++ * YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb) ++ * CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY) ++ * CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY) ++ * YUV444Interleaved : Each pixel contains equal parts YUV ++ * RawBayer8bit : SMIA camera output format ++ * RawBayer10bit : SMIA camera output format ++ * RawBayer8bitcompressed : SMIA camera output format ++ */ ++typedef enum OMX_COLOR_FORMATTYPE { ++ OMX_COLOR_FormatUnused, ++ OMX_COLOR_FormatMonochrome, ++ OMX_COLOR_Format8bitRGB332, ++ OMX_COLOR_Format12bitRGB444, ++ OMX_COLOR_Format16bitARGB4444, ++ OMX_COLOR_Format16bitARGB1555, ++ OMX_COLOR_Format16bitRGB565, ++ OMX_COLOR_Format16bitBGR565, ++ OMX_COLOR_Format18bitRGB666, ++ OMX_COLOR_Format18bitARGB1665, ++ OMX_COLOR_Format19bitARGB1666, ++ OMX_COLOR_Format24bitRGB888, ++ OMX_COLOR_Format24bitBGR888, ++ OMX_COLOR_Format24bitARGB1887, ++ OMX_COLOR_Format25bitARGB1888, ++ OMX_COLOR_Format32bitBGRA8888, ++ OMX_COLOR_Format32bitARGB8888, ++ OMX_COLOR_FormatYUV411Planar, ++ OMX_COLOR_FormatYUV411PackedPlanar, ++ OMX_COLOR_FormatYUV420Planar, ++ OMX_COLOR_FormatYUV420PackedPlanar, ++ OMX_COLOR_FormatYUV420SemiPlanar, ++ OMX_COLOR_FormatYUV422Planar, ++ OMX_COLOR_FormatYUV422PackedPlanar, ++ OMX_COLOR_FormatYUV422SemiPlanar, ++ OMX_COLOR_FormatYCbYCr, ++ OMX_COLOR_FormatYCrYCb, ++ OMX_COLOR_FormatCbYCrY, ++ OMX_COLOR_FormatCrYCbY, ++ OMX_COLOR_FormatYUV444Interleaved, ++ OMX_COLOR_FormatRawBayer8bit, ++ OMX_COLOR_FormatRawBayer10bit, ++ OMX_COLOR_FormatRawBayer8bitcompressed, ++ OMX_COLOR_FormatL2, ++ OMX_COLOR_FormatL4, ++ OMX_COLOR_FormatL8, ++ OMX_COLOR_FormatL16, ++ OMX_COLOR_FormatL24, ++ OMX_COLOR_FormatL32, ++ OMX_COLOR_FormatYUV420PackedSemiPlanar, ++ OMX_COLOR_FormatYUV422PackedSemiPlanar, ++ OMX_COLOR_Format18BitBGR666, ++ OMX_COLOR_Format24BitARGB6666, ++ OMX_COLOR_Format24BitABGR6666, ++ OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ /** ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++/** The OMX_API and OMX_APIENTRY are platform specific definitions used ++ * to declare OMX function prototypes. They are modified to meet the ++ * requirements for a particular platform */ ++#ifdef __SYMBIAN32__ ++# ifdef __OMX_EXPORTS ++# define OMX_API __declspec(dllexport) ++# else ++# ifdef _WIN32 ++# define OMX_API __declspec(dllexport) ++# else ++# define OMX_API __declspec(dllimport) ++# endif ++# endif ++#else ++# ifdef _WIN32 ++# ifdef __OMX_EXPORTS ++# define OMX_API __declspec(dllexport) ++# else ++//# define OMX_API __declspec(dllimport) ++#define OMX_API ++# endif ++# else ++# ifdef __OMX_EXPORTS ++# define OMX_API ++# else ++# define OMX_API extern ++# endif ++# endif ++#endif ++ ++#ifndef OMX_APIENTRY ++#define OMX_APIENTRY ++#endif ++ ++/** OMX_IN is used to identify inputs to an OMX function. This designation ++ will also be used in the case of a pointer that points to a parameter ++ that is used as an output. */ ++#ifndef OMX_IN ++#define OMX_IN ++#endif ++ ++/** OMX_OUT is used to identify outputs from an OMX function. This ++ designation will also be used in the case of a pointer that points ++ to a parameter that is used as an input. */ ++#ifndef OMX_OUT ++#define OMX_OUT ++#endif ++ ++ ++/** OMX_INOUT is used to identify parameters that may be either inputs or ++ outputs from an OMX function at the same time. This designation will ++ also be used in the case of a pointer that points to a parameter that ++ is used both as an input and an output. */ ++#ifndef OMX_INOUT ++#define OMX_INOUT ++#endif ++ ++/** OMX_ALL is used to as a wildcard to select all entities of the same type ++ * when specifying the index, or referring to a object by an index. (i.e. ++ * use OMX_ALL to indicate all N channels). When used as a port index ++ * for a config or parameter this OMX_ALL denotes that the config or ++ * parameter applies to the entire component not just one port. */ ++#define OMX_ALL 0xFFFFFFFF ++ ++/** In the following we define groups that help building doxygen documentation */ ++ ++/** @defgroup core OpenMAX IL core ++ * Functions and structure related to the OMX IL core ++ */ ++ ++ /** @defgroup comp OpenMAX IL component ++ * Functions and structure related to the OMX IL component ++ */ ++ ++/** @defgroup rpm Resource and Policy Management ++ * Structures for resource and policy management of components ++ */ ++ ++/** @defgroup buf Buffer Management ++ * Buffer handling functions and structures ++ */ ++ ++/** @defgroup tun Tunneling ++ * @ingroup core comp ++ * Structures and functions to manage tunnels among component ports ++ */ ++ ++/** @defgroup cp Content Pipes ++ * @ingroup core ++ */ ++ ++ /** @defgroup metadata Metadata handling ++ * ++ */ ++ ++/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */ ++typedef unsigned char OMX_U8; ++ ++/** OMX_S8 is an 8 bit signed quantity that is byte aligned */ ++typedef signed char OMX_S8; ++ ++/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */ ++typedef unsigned short OMX_U16; ++ ++/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */ ++typedef signed short OMX_S16; ++ ++/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */ ++typedef uint32_t OMX_U32; ++ ++/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */ ++typedef int32_t OMX_S32; ++ ++ ++/* Users with compilers that cannot accept the "long long" designation should ++ define the OMX_SKIP64BIT macro. It should be noted that this may cause ++ some components to fail to compile if the component was written to require ++ 64 bit integral types. However, these components would NOT compile anyway ++ since the compiler does not support the way the component was written. ++*/ ++#ifndef OMX_SKIP64BIT ++#ifdef __SYMBIAN32__ ++/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ ++typedef unsigned long long OMX_U64; ++ ++/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ ++typedef signed long long OMX_S64; ++ ++#elif defined(WIN32) ++ ++/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ ++typedef unsigned __int64 OMX_U64; ++ ++/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ ++typedef signed __int64 OMX_S64; ++ ++#else /* WIN32 */ ++ ++/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ ++typedef unsigned long long OMX_U64; ++ ++/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ ++typedef signed long long OMX_S64; ++ ++#endif /* WIN32 */ ++#endif ++ ++ ++/** The OMX_BOOL type is intended to be used to represent a true or a false ++ value when passing parameters to and from the OMX core and components. The ++ OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary. ++ */ ++typedef enum OMX_BOOL { ++ OMX_FALSE = 0, ++ OMX_TRUE = !OMX_FALSE, ++ OMX_BOOL_MAX = 0x7FFFFFFF ++} OMX_BOOL; ++ ++/* ++ * Temporary Android 64 bit modification ++ * ++ * #define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS ++ * overrides all OMX pointer types to be uint32_t. ++ * ++ * After this change, OMX codecs will work in 32 bit only, so 64 bit processes ++ * must communicate to a remote 32 bit process for OMX to work. ++ */ ++ ++#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS ++ ++typedef uint32_t OMX_PTR; ++typedef OMX_PTR OMX_STRING; ++typedef OMX_PTR OMX_BYTE; ++ ++#else /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */ ++ ++/** The OMX_PTR type is intended to be used to pass pointers between the OMX ++ applications and the OMX Core and components. This is a 32 bit pointer and ++ is aligned on a 32 bit boundary. ++ */ ++typedef void* OMX_PTR; ++ ++/** The OMX_STRING type is intended to be used to pass "C" type strings between ++ the application and the core and component. The OMX_STRING type is a 32 ++ bit pointer to a zero terminated string. The pointer is word aligned and ++ the string is byte aligned. ++ */ ++typedef char* OMX_STRING; ++ ++/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as ++ buffers between the application and the component and core. The OMX_BYTE ++ type is a 32 bit pointer to a zero terminated string. The pointer is word ++ aligned and the string is byte aligned. ++ */ ++typedef unsigned char* OMX_BYTE; ++ ++#endif /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */ ++ ++/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify ++ at runtime. This identifier should be generated by a component in a way ++ that guarantees that every instance of the identifier running on the system ++ is unique. */ ++typedef unsigned char OMX_UUIDTYPE[128]; ++ ++/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or ++ an output port. This enumeration is common across all component types. ++ */ ++typedef enum OMX_DIRTYPE ++{ ++ OMX_DirInput, /**< Port is an input port */ ++ OMX_DirOutput, /**< Port is an output port */ ++ OMX_DirMax = 0x7FFFFFFF ++} OMX_DIRTYPE; ++ ++/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering ++ for numerical data (i.e. big endian, or little endian). ++ */ ++typedef enum OMX_ENDIANTYPE ++{ ++ OMX_EndianBig, /**< big endian */ ++ OMX_EndianLittle, /**< little endian */ ++ OMX_EndianMax = 0x7FFFFFFF ++} OMX_ENDIANTYPE; ++ ++ ++/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data ++ is signed, unsigned or floating point (Android extension). ++ ++ Android floating point support policy: ++ If component does not support floating point raw audio, it can reset ++ configuration to signed 16-bit integer (support for which is required.) ++ nBitsPerSample will be set to 32 for float data. ++ */ ++typedef enum OMX_NUMERICALDATATYPE ++{ ++ OMX_NumericalDataSigned, /**< signed data */ ++ OMX_NumericalDataUnsigned, /**< unsigned data */ ++ OMX_NumericalDataFloat = 0x7F000001, /**< floating point data */ ++ OMX_NumercialDataMax = 0x7FFFFFFF ++} OMX_NUMERICALDATATYPE; ++ ++ ++/** Unsigned bounded value type */ ++typedef struct OMX_BU32 { ++ OMX_U32 nValue; /**< actual value */ ++ OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */ ++ OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */ ++} OMX_BU32; ++ ++ ++/** Signed bounded value type */ ++typedef struct OMX_BS32 { ++ OMX_S32 nValue; /**< actual value */ ++ OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */ ++ OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */ ++} OMX_BS32; ++ ++ ++/** Structure representing some time or duration in microseconds. This structure ++ * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate ++ * negative deltas and preroll scenarios. The quantity is represented in microseconds ++ * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based ++ * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. ++ * individual audio samples delivered at 192 kHz). The quantity is 64 bit to ++ * accommodate a large dynamic range (signed 32 bit values would allow only for plus ++ * or minus 35 minutes). ++ * ++ * Implementations with limited precision may convert the signed 64 bit value to ++ * a signed 32 bit value internally but risk loss of precision. ++ */ ++#ifndef OMX_SKIP64BIT ++typedef OMX_S64 OMX_TICKS; ++#else ++typedef struct OMX_TICKS ++{ ++ OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */ ++ OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */ ++} OMX_TICKS; ++#endif ++#define OMX_TICKS_PER_SECOND 1000000 ++ ++/** Define the public interface for the OMX Handle. The core will not use ++ this value internally, but the application should only use this value. ++ */ ++typedef OMX_PTR OMX_HANDLETYPE; ++ ++typedef struct OMX_MARKTYPE ++{ ++ OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will ++ generate a mark event upon ++ processing the mark. */ ++ OMX_PTR pMarkData; /**< Application specific data associated with ++ the mark sent on a mark event to disambiguate ++ this mark from others. */ ++} OMX_MARKTYPE; ++ ++ ++/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the ++ * platform & operating specific object used to reference the display ++ * or can be used by a audio port for native audio rendering */ ++typedef OMX_PTR OMX_NATIVE_DEVICETYPE; ++ ++/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the ++ * platform & operating specific object used to reference the window */ ++typedef OMX_PTR OMX_NATIVE_WINDOWTYPE; ++ ++/** The OMX_VERSIONTYPE union is used to specify the version for ++ a structure or component. For a component, the version is entirely ++ specified by the component vendor. Components doing the same function ++ from different vendors may or may not have the same version. For ++ structures, the version shall be set by the entity that allocates the ++ structure. For structures specified in the OMX 1.1 specification, the ++ value of the version shall be set to 1.1.0.0 in all cases. Access to the ++ OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or ++ by accessing one of the structure elements to, for example, check only ++ the Major revision. ++ */ ++typedef union OMX_VERSIONTYPE ++{ ++ struct ++ { ++ OMX_U8 nVersionMajor; /**< Major version accessor element */ ++ OMX_U8 nVersionMinor; /**< Minor version accessor element */ ++ OMX_U8 nRevision; /**< Revision version accessor element */ ++ OMX_U8 nStep; /**< Step version accessor element */ ++ } s; ++ OMX_U32 nVersion; /**< 32 bit value to make accessing the ++ version easily done in a single word ++ size copy/compare operation */ ++} OMX_VERSIONTYPE; ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif ++/* File EOF */ +diff --git a/libavcodec/OMX_Video.h b/libavcodec/OMX_Video.h +new file mode 100755 +index 0000000..1d220c7 +--- /dev/null ++++ b/libavcodec/OMX_Video.h +@@ -0,0 +1,1098 @@ ++/* ------------------------------------------------------------------ ++ * Copyright (C) 1998-2009 PacketVideo ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ++ * express or implied. ++ * See the License for the specific language governing permissions ++ * and limitations under the License. ++ * ------------------------------------------------------------------- ++ */ ++/** ++ * Copyright (c) 2008 The Khronos Group Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject ++ * to the following conditions: ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ * ++ */ ++ ++/** ++ * @file OMX_Video.h - OpenMax IL version 1.1.2 ++ * The structures is needed by Video components to exchange parameters ++ * and configuration data with OMX components. ++ */ ++#ifndef OMX_Video_h ++#define OMX_Video_h ++ ++/** @defgroup video OpenMAX IL Video Domain ++ * @ingroup iv ++ * Structures for OpenMAX IL Video domain ++ * @{ ++ */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++ ++/** ++ * Each OMX header must include all required header files to allow the ++ * header to compile without errors. The includes below are required ++ * for this header file to compile successfully ++ */ ++ ++#include "OMX_IVCommon.h" ++ ++ ++/** ++ * Enumeration used to define the possible video compression codings. ++ * NOTE: This essentially refers to file extensions. If the coding is ++ * being used to specify the ENCODE type, then additional work ++ * must be done to configure the exact flavor of the compression ++ * to be used. For decode cases where the user application can ++ * not differentiate between MPEG-4 and H.264 bit streams, it is ++ * up to the codec to handle this. ++ */ ++typedef enum OMX_VIDEO_CODINGTYPE { ++ OMX_VIDEO_CodingUnused, /**< Value when coding is N/A */ ++ OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */ ++ OMX_VIDEO_CodingMPEG2, /**< AKA: H.262 */ ++ OMX_VIDEO_CodingH263, /**< H.263 */ ++ OMX_VIDEO_CodingMPEG4, /**< MPEG-4 */ ++ OMX_VIDEO_CodingWMV, /**< all versions of Windows Media Video */ ++ OMX_VIDEO_CodingRV, /**< all versions of Real Video */ ++ OMX_VIDEO_CodingAVC, /**< H.264/AVC */ ++ OMX_VIDEO_CodingMJPEG, /**< Motion JPEG */ ++ OMX_VIDEO_CodingVP8, /**< Google VP8, formerly known as On2 VP8 */ ++ OMX_VIDEO_CodingVP9, /**< Google VP9 */ ++ OMX_VIDEO_CodingHEVC, /**< ITU H.265/HEVC */ ++ OMX_VIDEO_CodingDolbyVision,/**< Dolby Vision */ ++ OMX_VIDEO_CodingImageHEIC, /**< HEIF image encoded with HEVC */ ++ OMX_VIDEO_CodingAV1, /**< AV1 */ ++ OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_CodingMax = 0x7FFFFFFF ++} OMX_VIDEO_CODINGTYPE; ++ ++ ++/** ++ * Data structure used to define a video path. The number of Video paths for ++ * input and output will vary by type of the Video component. ++ * ++ * Input (aka Source) : zero Inputs, one Output, ++ * Splitter : one Input, 2 or more Outputs, ++ * Processing Element : one Input, one output, ++ * Mixer : 2 or more inputs, one output, ++ * Output (aka Sink) : one Input, zero outputs. ++ * ++ * The PortDefinition structure is used to define all of the parameters ++ * necessary for the compliant component to setup an input or an output video ++ * path. If additional vendor specific data is required, it should be ++ * transmitted to the component using the CustomCommand function. Compliant ++ * components will prepopulate this structure with optimal values during the ++ * GetDefaultInitParams command. ++ * ++ * STRUCT MEMBERS: ++ * cMIMEType : MIME type of data for the port ++ * pNativeRender : Platform specific reference for a display if a ++ * sync, otherwise this field is 0 ++ * nFrameWidth : Width of frame to be used on channel if ++ * uncompressed format is used. Use 0 for unknown, ++ * don't care or variable ++ * nFrameHeight : Height of frame to be used on channel if ++ * uncompressed format is used. Use 0 for unknown, ++ * don't care or variable ++ * nStride : Number of bytes per span of an image ++ * (i.e. indicates the number of bytes to get ++ * from span N to span N+1, where negative stride ++ * indicates the image is bottom up ++ * nSliceHeight : Height used when encoding in slices ++ * nBitrate : Bit rate of frame to be used on channel if ++ * compressed format is used. Use 0 for unknown, ++ * don't care or variable ++ * xFramerate : Frame rate to be used on channel if uncompressed ++ * format is used. Use 0 for unknown, don't care or ++ * variable. Units are Q16 frames per second. ++ * bFlagErrorConcealment : Turns on error concealment if it is supported by ++ * the OMX component ++ * eCompressionFormat : Compression format used in this instance of the ++ * component. When OMX_VIDEO_CodingUnused is ++ * specified, eColorFormat is used ++ * eColorFormat : Decompressed format used by this component ++ * pNativeWindow : Platform specific reference for a window object if a ++ * display sink , otherwise this field is 0x0. ++ */ ++typedef struct OMX_VIDEO_PORTDEFINITIONTYPE { ++ OMX_STRING cMIMEType; ++ OMX_NATIVE_DEVICETYPE pNativeRender; ++ OMX_U32 nFrameWidth; ++ OMX_U32 nFrameHeight; ++ OMX_S32 nStride; ++ OMX_U32 nSliceHeight; ++ OMX_U32 nBitrate; ++ OMX_U32 xFramerate; ++ OMX_BOOL bFlagErrorConcealment; ++ OMX_VIDEO_CODINGTYPE eCompressionFormat; ++ OMX_COLOR_FORMATTYPE eColorFormat; ++ OMX_NATIVE_WINDOWTYPE pNativeWindow; ++} OMX_VIDEO_PORTDEFINITIONTYPE; ++ ++/** ++ * Port format parameter. This structure is used to enumerate the various ++ * data input/output format supported by the port. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Indicates which port to set ++ * nIndex : Indicates the enumeration index for the format from ++ * 0x0 to N-1 ++ * eCompressionFormat : Compression format used in this instance of the ++ * component. When OMX_VIDEO_CodingUnused is specified, ++ * eColorFormat is used ++ * eColorFormat : Decompressed format used by this component ++ * xFrameRate : Indicates the video frame rate in Q16 format ++ */ ++typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nIndex; ++ OMX_VIDEO_CODINGTYPE eCompressionFormat; ++ OMX_COLOR_FORMATTYPE eColorFormat; ++ OMX_U32 xFramerate; ++} OMX_VIDEO_PARAM_PORTFORMATTYPE; ++ ++ ++/** ++ * This is a structure for configuring video compression quantization ++ * parameter values. Codecs may support different QP values for different ++ * frame types. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version info ++ * nPortIndex : Port that this structure applies to ++ * nQpI : QP value to use for index frames ++ * nQpP : QP value to use for P frames ++ * nQpB : QP values to use for bidirectional frames ++ */ ++typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nQpI; ++ OMX_U32 nQpP; ++ OMX_U32 nQpB; ++} OMX_VIDEO_PARAM_QUANTIZATIONTYPE; ++ ++ ++/** ++ * Structure for configuration of video fast update parameters. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version info ++ * nPortIndex : Port that this structure applies to ++ * bEnableVFU : Enable/Disable video fast update ++ * nFirstGOB : Specifies the number of the first macroblock row ++ * nFirstMB : specifies the first MB relative to the specified first GOB ++ * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB ++ * and nFirstMB ++ */ ++typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bEnableVFU; ++ OMX_U32 nFirstGOB; ++ OMX_U32 nFirstMB; ++ OMX_U32 nNumMBs; ++} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE; ++ ++ ++/** ++ * Enumeration of possible bitrate control types ++ */ ++typedef enum OMX_VIDEO_CONTROLRATETYPE { ++ OMX_Video_ControlRateDisable, ++ OMX_Video_ControlRateVariable, ++ OMX_Video_ControlRateConstant, ++ OMX_Video_ControlRateVariableSkipFrames, ++ OMX_Video_ControlRateConstantSkipFrames, ++ OMX_Video_ControlRateConstantQuality, ++ OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_Video_ControlRateMax = 0x7FFFFFFF ++} OMX_VIDEO_CONTROLRATETYPE; ++ ++ ++/** ++ * Structure for configuring bitrate mode of a codec. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the struct in bytes ++ * nVersion : OMX spec version info ++ * nPortIndex : Port that this struct applies to ++ * eControlRate : Control rate type enum ++ * nTargetBitrate : Target bitrate to encode with (used when eControlRate is ++ * not OMX_Video_ControlRateConstantQuality) ++ * nQualityFactor : Quality to encode with (used when eControlRate is ++ * OMX_Video_ControlRateConstantQuality only) ++ */ ++typedef struct OMX_VIDEO_PARAM_BITRATETYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_CONTROLRATETYPE eControlRate; ++ union { ++ OMX_U32 nTargetBitrate; ++ OMX_U32 nQualityFactor; ++ }; ++} OMX_VIDEO_PARAM_BITRATETYPE; ++ ++ ++/** ++ * Enumeration of possible motion vector (MV) types ++ */ ++typedef enum OMX_VIDEO_MOTIONVECTORTYPE { ++ OMX_Video_MotionVectorPixel, ++ OMX_Video_MotionVectorHalfPel, ++ OMX_Video_MotionVectorQuarterPel, ++ OMX_Video_MotionVectorEighthPel, ++ OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_Video_MotionVectorMax = 0x7FFFFFFF ++} OMX_VIDEO_MOTIONVECTORTYPE; ++ ++ ++/** ++ * Structure for configuring the number of motion vectors used as well ++ * as their accuracy. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the struct in bytes ++ * nVersion : OMX spec version info ++ * nPortIndex : port that this structure applies to ++ * eAccuracy : Enumerated MV accuracy ++ * bUnrestrictedMVs : Allow unrestricted MVs ++ * bFourMV : Allow use of 4 MVs ++ * sXSearchRange : Search range in horizontal direction for MVs ++ * sYSearchRange : Search range in vertical direction for MVs ++ */ ++typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_MOTIONVECTORTYPE eAccuracy; ++ OMX_BOOL bUnrestrictedMVs; ++ OMX_BOOL bFourMV; ++ OMX_S32 sXSearchRange; ++ OMX_S32 sYSearchRange; ++} OMX_VIDEO_PARAM_MOTIONVECTORTYPE; ++ ++ ++/** ++ * Enumeration of possible methods to use for Intra Refresh ++ */ ++typedef enum OMX_VIDEO_INTRAREFRESHTYPE { ++ OMX_VIDEO_IntraRefreshCyclic, ++ OMX_VIDEO_IntraRefreshAdaptive, ++ OMX_VIDEO_IntraRefreshBoth, ++ OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF ++} OMX_VIDEO_INTRAREFRESHTYPE; ++ ++ ++/** ++ * Structure for configuring intra refresh mode ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * eRefreshMode : Cyclic, Adaptive, or Both ++ * nAirMBs : Number of intra macroblocks to refresh in a frame when ++ * AIR is enabled ++ * nAirRef : Number of times a motion marked macroblock has to be ++ * intra coded ++ * nCirMBs : Number of consecutive macroblocks to be coded as "intra" ++ * when CIR is enabled ++ */ ++typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode; ++ OMX_U32 nAirMBs; ++ OMX_U32 nAirRef; ++ OMX_U32 nCirMBs; ++} OMX_VIDEO_PARAM_INTRAREFRESHTYPE; ++ ++ ++/** ++ * Structure for enabling various error correction methods for video ++ * compression. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * bEnableHEC : Enable/disable header extension codes (HEC) ++ * bEnableResync : Enable/disable resynchronization markers ++ * nResynchMarkerSpacing : Resynch markers interval (in bits) to be ++ * applied in the stream ++ * bEnableDataPartitioning : Enable/disable data partitioning ++ * bEnableRVLC : Enable/disable reversible variable length ++ * coding ++ */ ++typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bEnableHEC; ++ OMX_BOOL bEnableResync; ++ OMX_U32 nResynchMarkerSpacing; ++ OMX_BOOL bEnableDataPartitioning; ++ OMX_BOOL bEnableRVLC; ++} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE; ++ ++ ++/** ++ * Configuration of variable block-size motion compensation (VBSMC) ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * b16x16 : Enable inter block search 16x16 ++ * b16x8 : Enable inter block search 16x8 ++ * b8x16 : Enable inter block search 8x16 ++ * b8x8 : Enable inter block search 8x8 ++ * b8x4 : Enable inter block search 8x4 ++ * b4x8 : Enable inter block search 4x8 ++ * b4x4 : Enable inter block search 4x4 ++ */ ++typedef struct OMX_VIDEO_PARAM_VBSMCTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL b16x16; ++ OMX_BOOL b16x8; ++ OMX_BOOL b8x16; ++ OMX_BOOL b8x8; ++ OMX_BOOL b8x4; ++ OMX_BOOL b4x8; ++ OMX_BOOL b4x4; ++} OMX_VIDEO_PARAM_VBSMCTYPE; ++ ++ ++/** ++ * H.263 profile types, each profile indicates support for various ++ * performance bounds and different annexes. ++ * ++ * ENUMS: ++ * Baseline : Baseline Profile: H.263 (V1), no optional modes ++ * H320 Coding : H.320 Coding Efficiency Backward Compatibility ++ * Profile: H.263+ (V2), includes annexes I, J, L.4 ++ * and T ++ * BackwardCompatible : Backward Compatibility Profile: H.263 (V1), ++ * includes annex F ++ * ISWV2 : Interactive Streaming Wireless Profile: H.263+ ++ * (V2), includes annexes I, J, K and T ++ * ISWV3 : Interactive Streaming Wireless Profile: H.263++ ++ * (V3), includes profile 3 and annexes V and W.6.3.8 ++ * HighCompression : Conversational High Compression Profile: H.263++ ++ * (V3), includes profiles 1 & 2 and annexes D and U ++ * Internet : Conversational Internet Profile: H.263++ (V3), ++ * includes profile 5 and annex K ++ * Interlace : Conversational Interlace Profile: H.263++ (V3), ++ * includes profile 5 and annex W.6.3.11 ++ * HighLatency : High Latency Profile: H.263++ (V3), includes ++ * profile 6 and annexes O.1 and P.5 ++ */ ++typedef enum OMX_VIDEO_H263PROFILETYPE { ++ OMX_VIDEO_H263ProfileBaseline = 0x01, ++ OMX_VIDEO_H263ProfileH320Coding = 0x02, ++ OMX_VIDEO_H263ProfileBackwardCompatible = 0x04, ++ OMX_VIDEO_H263ProfileISWV2 = 0x08, ++ OMX_VIDEO_H263ProfileISWV3 = 0x10, ++ OMX_VIDEO_H263ProfileHighCompression = 0x20, ++ OMX_VIDEO_H263ProfileInternet = 0x40, ++ OMX_VIDEO_H263ProfileInterlace = 0x80, ++ OMX_VIDEO_H263ProfileHighLatency = 0x100, ++ OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_H263PROFILETYPE; ++ ++ ++/** ++ * H.263 level types, each level indicates support for various frame sizes, ++ * bit rates, decoder frame rates. ++ */ ++typedef enum OMX_VIDEO_H263LEVELTYPE { ++ OMX_VIDEO_H263Level10 = 0x01, ++ OMX_VIDEO_H263Level20 = 0x02, ++ OMX_VIDEO_H263Level30 = 0x04, ++ OMX_VIDEO_H263Level40 = 0x08, ++ OMX_VIDEO_H263Level45 = 0x10, ++ OMX_VIDEO_H263Level50 = 0x20, ++ OMX_VIDEO_H263Level60 = 0x40, ++ OMX_VIDEO_H263Level70 = 0x80, ++ OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_H263LevelMax = 0x7FFFFFFF ++} OMX_VIDEO_H263LEVELTYPE; ++ ++ ++/** ++ * Specifies the picture type. These values should be OR'd to signal all ++ * pictures types which are allowed. ++ * ++ * ENUMS: ++ * Generic Picture Types: I, P and B ++ * H.263 Specific Picture Types: SI and SP ++ * H.264 Specific Picture Types: EI and EP ++ * MPEG-4 Specific Picture Types: S ++ */ ++typedef enum OMX_VIDEO_PICTURETYPE { ++ OMX_VIDEO_PictureTypeI = 0x01, ++ OMX_VIDEO_PictureTypeP = 0x02, ++ OMX_VIDEO_PictureTypeB = 0x04, ++ OMX_VIDEO_PictureTypeSI = 0x08, ++ OMX_VIDEO_PictureTypeSP = 0x10, ++ OMX_VIDEO_PictureTypeEI = 0x11, ++ OMX_VIDEO_PictureTypeEP = 0x12, ++ OMX_VIDEO_PictureTypeS = 0x14, ++ OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF ++} OMX_VIDEO_PICTURETYPE; ++ ++ ++/** ++ * H.263 Params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nPFrames : Number of P frames between each I frame ++ * nBFrames : Number of B frames between each I frame ++ * eProfile : H.263 profile(s) to use ++ * eLevel : H.263 level(s) to use ++ * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE ++ * (specified in the 1998 version of H.263) to ++ * indicate custom picture sizes or clock ++ * frequencies ++ * nAllowedPictureTypes : Specifies the picture types allowed in the ++ * bitstream ++ * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is ++ * not constrained. It is recommended to change ++ * the value of the RTYPE bit for each reference ++ * picture in error-free communication ++ * nPictureHeaderRepetition : Specifies the frequency of picture header ++ * repetition ++ * nGOBHeaderInterval : Specifies the interval of non-empty GOB ++ * headers in units of GOBs ++ */ ++typedef struct OMX_VIDEO_PARAM_H263TYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nPFrames; ++ OMX_U32 nBFrames; ++ OMX_VIDEO_H263PROFILETYPE eProfile; ++ OMX_VIDEO_H263LEVELTYPE eLevel; ++ OMX_BOOL bPLUSPTYPEAllowed; ++ OMX_U32 nAllowedPictureTypes; ++ OMX_BOOL bForceRoundingTypeToZero; ++ OMX_U32 nPictureHeaderRepetition; ++ OMX_U32 nGOBHeaderInterval; ++} OMX_VIDEO_PARAM_H263TYPE; ++ ++ ++/** ++ * MPEG-2 profile types, each profile indicates support for various ++ * performance bounds and different annexes. ++ */ ++typedef enum OMX_VIDEO_MPEG2PROFILETYPE { ++ OMX_VIDEO_MPEG2ProfileSimple = 0, /**< Simple Profile */ ++ OMX_VIDEO_MPEG2ProfileMain, /**< Main Profile */ ++ OMX_VIDEO_MPEG2Profile422, /**< 4:2:2 Profile */ ++ OMX_VIDEO_MPEG2ProfileSNR, /**< SNR Profile */ ++ OMX_VIDEO_MPEG2ProfileSpatial, /**< Spatial Profile */ ++ OMX_VIDEO_MPEG2ProfileHigh, /**< High Profile */ ++ OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_MPEG2PROFILETYPE; ++ ++ ++/** ++ * MPEG-2 level types, each level indicates support for various frame ++ * sizes, bit rates, decoder frame rates. No need ++ */ ++typedef enum OMX_VIDEO_MPEG2LEVELTYPE { ++ OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */ ++ OMX_VIDEO_MPEG2LevelML, /**< Main Level */ ++ OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */ ++ OMX_VIDEO_MPEG2LevelHL, /**< High Level */ ++ OMX_VIDEO_MPEG2LevelHP, /**< HighP Level */ ++ OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF ++} OMX_VIDEO_MPEG2LEVELTYPE; ++ ++ ++/** ++ * MPEG-2 params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nPFrames : Number of P frames between each I frame ++ * nBFrames : Number of B frames between each I frame ++ * eProfile : MPEG-2 profile(s) to use ++ * eLevel : MPEG-2 levels(s) to use ++ */ ++typedef struct OMX_VIDEO_PARAM_MPEG2TYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nPFrames; ++ OMX_U32 nBFrames; ++ OMX_VIDEO_MPEG2PROFILETYPE eProfile; ++ OMX_VIDEO_MPEG2LEVELTYPE eLevel; ++} OMX_VIDEO_PARAM_MPEG2TYPE; ++ ++ ++/** ++ * MPEG-4 profile types, each profile indicates support for various ++ * performance bounds and different annexes. ++ * ++ * ENUMS: ++ * - Simple Profile, Levels 1-3 ++ * - Simple Scalable Profile, Levels 1-2 ++ * - Core Profile, Levels 1-2 ++ * - Main Profile, Levels 2-4 ++ * - N-bit Profile, Level 2 ++ * - Scalable Texture Profile, Level 1 ++ * - Simple Face Animation Profile, Levels 1-2 ++ * - Simple Face and Body Animation (FBA) Profile, Levels 1-2 ++ * - Basic Animated Texture Profile, Levels 1-2 ++ * - Hybrid Profile, Levels 1-2 ++ * - Advanced Real Time Simple Profiles, Levels 1-4 ++ * - Core Scalable Profile, Levels 1-3 ++ * - Advanced Coding Efficiency Profile, Levels 1-4 ++ * - Advanced Core Profile, Levels 1-2 ++ * - Advanced Scalable Texture, Levels 2-3 ++ */ ++typedef enum OMX_VIDEO_MPEG4PROFILETYPE { ++ OMX_VIDEO_MPEG4ProfileSimple = 0x01, ++ OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02, ++ OMX_VIDEO_MPEG4ProfileCore = 0x04, ++ OMX_VIDEO_MPEG4ProfileMain = 0x08, ++ OMX_VIDEO_MPEG4ProfileNbit = 0x10, ++ OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20, ++ OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40, ++ OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80, ++ OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100, ++ OMX_VIDEO_MPEG4ProfileHybrid = 0x200, ++ OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400, ++ OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800, ++ OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000, ++ OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000, ++ OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000, ++ OMX_VIDEO_MPEG4ProfileAdvancedSimple = 0x8000, ++ OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_MPEG4PROFILETYPE; ++ ++ ++/** ++ * MPEG-4 level types, each level indicates support for various frame ++ * sizes, bit rates, decoder frame rates. No need ++ */ ++typedef enum OMX_VIDEO_MPEG4LEVELTYPE { ++ OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ ++ OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ ++ OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ ++ OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ ++ OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ ++ /* normally levels are powers of 2s, but 3b was missed and levels must be properly ordered */ ++ OMX_VIDEO_MPEG4Level3b = 0x18, /**< Level 3a */ ++ OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ ++ OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ ++ OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ ++ OMX_VIDEO_MPEG4Level6 = 0x100, /**< Level 6 */ ++ OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF ++} OMX_VIDEO_MPEG4LEVELTYPE; ++ ++ ++/** ++ * MPEG-4 configuration. This structure handles configuration options ++ * which are specific to MPEG4 algorithms ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+ ++ * Annex K). Put zero if not used ++ * bSVH : Enable Short Video Header mode ++ * bGov : Flag to enable GOV ++ * nPFrames : Number of P frames between each I frame (also called ++ * GOV period) ++ * nBFrames : Number of B frames between each I frame ++ * nIDCVLCThreshold : Value of intra DC VLC threshold ++ * bACPred : Flag to use ac prediction ++ * nMaxPacketSize : Maximum size of packet in bytes. ++ * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4. ++ * Interpreted as described in MPEG4 standard. ++ * eProfile : MPEG-4 profile(s) to use. ++ * eLevel : MPEG-4 level(s) to use. ++ * nAllowedPictureTypes : Specifies the picture types allowed in the bitstream ++ * nHeaderExtension : Specifies the number of consecutive video packet ++ * headers within a VOP ++ * bReversibleVLC : Specifies whether reversible variable length coding ++ * is in use ++ */ ++typedef struct OMX_VIDEO_PARAM_MPEG4TYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nSliceHeaderSpacing; ++ OMX_BOOL bSVH; ++ OMX_BOOL bGov; ++ OMX_U32 nPFrames; ++ OMX_U32 nBFrames; ++ OMX_U32 nIDCVLCThreshold; ++ OMX_BOOL bACPred; ++ OMX_U32 nMaxPacketSize; ++ OMX_U32 nTimeIncRes; ++ OMX_VIDEO_MPEG4PROFILETYPE eProfile; ++ OMX_VIDEO_MPEG4LEVELTYPE eLevel; ++ OMX_U32 nAllowedPictureTypes; ++ OMX_U32 nHeaderExtension; ++ OMX_BOOL bReversibleVLC; ++} OMX_VIDEO_PARAM_MPEG4TYPE; ++ ++ ++/** ++ * WMV Versions ++ */ ++typedef enum OMX_VIDEO_WMVFORMATTYPE { ++ OMX_VIDEO_WMVFormatUnused = 0x01, /**< Format unused or unknown */ ++ OMX_VIDEO_WMVFormat7 = 0x02, /**< Windows Media Video format 7 */ ++ OMX_VIDEO_WMVFormat8 = 0x04, /**< Windows Media Video format 8 */ ++ OMX_VIDEO_WMVFormat9 = 0x08, /**< Windows Media Video format 9 */ ++ OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_WMVFormatMax = 0x7FFFFFFF ++} OMX_VIDEO_WMVFORMATTYPE; ++ ++ ++/** ++ * WMV Params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * eFormat : Version of WMV stream / data ++ */ ++typedef struct OMX_VIDEO_PARAM_WMVTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_WMVFORMATTYPE eFormat; ++} OMX_VIDEO_PARAM_WMVTYPE; ++ ++ ++/** ++ * Real Video Version ++ */ ++typedef enum OMX_VIDEO_RVFORMATTYPE { ++ OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */ ++ OMX_VIDEO_RVFormat8, /**< Real Video format 8 */ ++ OMX_VIDEO_RVFormat9, /**< Real Video format 9 */ ++ OMX_VIDEO_RVFormatG2, /**< Real Video Format G2 */ ++ OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_RVFormatMax = 0x7FFFFFFF ++} OMX_VIDEO_RVFORMATTYPE; ++ ++ ++/** ++ * Real Video Params ++ * ++ * STUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * eFormat : Version of RV stream / data ++ * nBitsPerPixel : Bits per pixel coded in the frame ++ * nPaddedWidth : Padded width in pixel of a video frame ++ * nPaddedHeight : Padded Height in pixels of a video frame ++ * nFrameRate : Rate of video in frames per second ++ * nBitstreamFlags : Flags which internal information about the bitstream ++ * nBitstreamVersion : Bitstream version ++ * nMaxEncodeFrameSize: Max encoded frame size ++ * bEnablePostFilter : Turn on/off post filter ++ * bEnableTemporalInterpolation : Turn on/off temporal interpolation ++ * bEnableLatencyMode : When enabled, the decoder does not display a decoded ++ * frame until it has detected that no enhancement layer ++ * frames or dependent B frames will be coming. This ++ * detection usually occurs when a subsequent non-B ++ * frame is encountered ++ */ ++typedef struct OMX_VIDEO_PARAM_RVTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_VIDEO_RVFORMATTYPE eFormat; ++ OMX_U16 nBitsPerPixel; ++ OMX_U16 nPaddedWidth; ++ OMX_U16 nPaddedHeight; ++ OMX_U32 nFrameRate; ++ OMX_U32 nBitstreamFlags; ++ OMX_U32 nBitstreamVersion; ++ OMX_U32 nMaxEncodeFrameSize; ++ OMX_BOOL bEnablePostFilter; ++ OMX_BOOL bEnableTemporalInterpolation; ++ OMX_BOOL bEnableLatencyMode; ++} OMX_VIDEO_PARAM_RVTYPE; ++ ++ ++/** ++ * AVC profile types, each profile indicates support for various ++ * performance bounds and different annexes. ++ */ ++typedef enum OMX_VIDEO_AVCPROFILETYPE { ++ OMX_VIDEO_AVCProfileBaseline = 0x01, /**< Baseline profile */ ++ OMX_VIDEO_AVCProfileMain = 0x02, /**< Main profile */ ++ OMX_VIDEO_AVCProfileExtended = 0x04, /**< Extended profile */ ++ OMX_VIDEO_AVCProfileHigh = 0x08, /**< High profile */ ++ OMX_VIDEO_AVCProfileHigh10 = 0x10, /**< High 10 profile */ ++ OMX_VIDEO_AVCProfileHigh422 = 0x20, /**< High 4:2:2 profile */ ++ OMX_VIDEO_AVCProfileHigh444 = 0x40, /**< High 4:4:4 profile */ ++ OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF ++} OMX_VIDEO_AVCPROFILETYPE; ++ ++ ++/** ++ * AVC level types, each level indicates support for various frame sizes, ++ * bit rates, decoder frame rates. No need ++ */ ++typedef enum OMX_VIDEO_AVCLEVELTYPE { ++ OMX_VIDEO_AVCLevel1 = 0x01, /**< Level 1 */ ++ OMX_VIDEO_AVCLevel1b = 0x02, /**< Level 1b */ ++ OMX_VIDEO_AVCLevel11 = 0x04, /**< Level 1.1 */ ++ OMX_VIDEO_AVCLevel12 = 0x08, /**< Level 1.2 */ ++ OMX_VIDEO_AVCLevel13 = 0x10, /**< Level 1.3 */ ++ OMX_VIDEO_AVCLevel2 = 0x20, /**< Level 2 */ ++ OMX_VIDEO_AVCLevel21 = 0x40, /**< Level 2.1 */ ++ OMX_VIDEO_AVCLevel22 = 0x80, /**< Level 2.2 */ ++ OMX_VIDEO_AVCLevel3 = 0x100, /**< Level 3 */ ++ OMX_VIDEO_AVCLevel31 = 0x200, /**< Level 3.1 */ ++ OMX_VIDEO_AVCLevel32 = 0x400, /**< Level 3.2 */ ++ OMX_VIDEO_AVCLevel4 = 0x800, /**< Level 4 */ ++ OMX_VIDEO_AVCLevel41 = 0x1000, /**< Level 4.1 */ ++ OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */ ++ OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */ ++ OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */ ++ OMX_VIDEO_AVCLevel52 = 0x10000, /**< Level 5.2 */ ++ OMX_VIDEO_AVCLevel6 = 0x20000, /**< Level 6 */ ++ OMX_VIDEO_AVCLevel61 = 0x40000, /**< Level 6.1 */ ++ OMX_VIDEO_AVCLevel62 = 0x80000, /**< Level 6.2 */ ++ OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF ++} OMX_VIDEO_AVCLEVELTYPE; ++ ++ ++/** ++ * AVC loop filter modes ++ * ++ * OMX_VIDEO_AVCLoopFilterEnable : Enable ++ * OMX_VIDEO_AVCLoopFilterDisable : Disable ++ * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries ++ */ ++typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE { ++ OMX_VIDEO_AVCLoopFilterEnable = 0, ++ OMX_VIDEO_AVCLoopFilterDisable, ++ OMX_VIDEO_AVCLoopFilterDisableSliceBoundary, ++ OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF ++} OMX_VIDEO_AVCLOOPFILTERTYPE; ++ ++ ++/** ++ * AVC params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nSliceHeaderSpacing : Number of macroblocks between slice header, put ++ * zero if not used ++ * nPFrames : Number of P frames between each I frame ++ * nBFrames : Number of B frames between each I frame ++ * bUseHadamard : Enable/disable Hadamard transform ++ * nRefFrames : Max number of reference frames to use for inter ++ * motion search (1-16) ++ * nRefIdxTrailing : Pic param set ref frame index (index into ref ++ * frame buffer of trailing frames list), B frame ++ * support ++ * nRefIdxForward : Pic param set ref frame index (index into ref ++ * frame buffer of forward frames list), B frame ++ * support ++ * bEnableUEP : Enable/disable unequal error protection. This ++ * is only valid of data partitioning is enabled. ++ * bEnableFMO : Enable/disable flexible macroblock ordering ++ * bEnableASO : Enable/disable arbitrary slice ordering ++ * bEnableRS : Enable/disable sending of redundant slices ++ * eProfile : AVC profile(s) to use ++ * eLevel : AVC level(s) to use ++ * nAllowedPictureTypes : Specifies the picture types allowed in the ++ * bitstream ++ * bFrameMBsOnly : specifies that every coded picture of the ++ * coded video sequence is a coded frame ++ * containing only frame macroblocks ++ * bMBAFF : Enable/disable switching between frame and ++ * field macroblocks within a picture ++ * bEntropyCodingCABAC : Entropy decoding method to be applied for the ++ * syntax elements for which two descriptors appear ++ * in the syntax tables ++ * bWeightedPPrediction : Enable/disable weighted prediction shall not ++ * be applied to P and SP slices ++ * nWeightedBipredicitonMode : Default weighted prediction is applied to B ++ * slices ++ * bconstIpred : Enable/disable intra prediction ++ * bDirect8x8Inference : Specifies the method used in the derivation ++ * process for luma motion vectors for B_Skip, ++ * B_Direct_16x16 and B_Direct_8x8 as specified ++ * in subclause 8.4.1.2 of the AVC spec ++ * bDirectSpatialTemporal : Flag indicating spatial or temporal direct ++ * mode used in B slice coding (related to ++ * bDirect8x8Inference) . Spatial direct mode is ++ * more common and should be the default. ++ * nCabacInitIdx : Index used to init CABAC contexts ++ * eLoopFilterMode : Enable/disable loop filter ++ */ ++typedef struct OMX_VIDEO_PARAM_AVCTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nSliceHeaderSpacing; ++ OMX_U32 nPFrames; ++ OMX_U32 nBFrames; ++ OMX_BOOL bUseHadamard; ++ OMX_U32 nRefFrames; ++ OMX_U32 nRefIdx10ActiveMinus1; ++ OMX_U32 nRefIdx11ActiveMinus1; ++ OMX_BOOL bEnableUEP; ++ OMX_BOOL bEnableFMO; ++ OMX_BOOL bEnableASO; ++ OMX_BOOL bEnableRS; ++ OMX_VIDEO_AVCPROFILETYPE eProfile; ++ OMX_VIDEO_AVCLEVELTYPE eLevel; ++ OMX_U32 nAllowedPictureTypes; ++ OMX_BOOL bFrameMBsOnly; ++ OMX_BOOL bMBAFF; ++ OMX_BOOL bEntropyCodingCABAC; ++ OMX_BOOL bWeightedPPrediction; ++ OMX_U32 nWeightedBipredicitonMode; ++ OMX_BOOL bconstIpred ; ++ OMX_BOOL bDirect8x8Inference; ++ OMX_BOOL bDirectSpatialTemporal; ++ OMX_U32 nCabacInitIdc; ++ OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode; ++} OMX_VIDEO_PARAM_AVCTYPE; ++ ++typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, ++ or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ ++ OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, ++ or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ ++ OMX_U32 nProfileIndex; /**< Used to query for individual profile support information, ++ This parameter is valid only for ++ OMX_IndexParamVideoProfileLevelQuerySupported index, ++ For all other indices this parameter is to be ignored. */ ++} OMX_VIDEO_PARAM_PROFILELEVELTYPE; ++ ++/** ++ * Structure for dynamically configuring bitrate mode of a codec. ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the struct in bytes ++ * nVersion : OMX spec version info ++ * nPortIndex : Port that this struct applies to ++ * nEncodeBitrate : Target average bitrate to be generated in bps ++ */ ++typedef struct OMX_VIDEO_CONFIG_BITRATETYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nEncodeBitrate; ++} OMX_VIDEO_CONFIG_BITRATETYPE; ++ ++/** ++ * Defines Encoder Frame Rate setting ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * xEncodeFramerate : Encoding framerate represented in Q16 format ++ */ ++typedef struct OMX_CONFIG_FRAMERATETYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 xEncodeFramerate; /* Q16 format */ ++} OMX_CONFIG_FRAMERATETYPE; ++ ++typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL IntraRefreshVOP; ++} OMX_CONFIG_INTRAREFRESHVOPTYPE; ++ ++typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nErrMapSize; /* Size of the Error Map in bytes */ ++ OMX_U8 ErrMap[1]; /* Error map hint */ ++} OMX_CONFIG_MACROBLOCKERRORMAPTYPE; ++ ++typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_BOOL bEnabled; ++} OMX_CONFIG_MBERRORREPORTINGTYPE; ++ ++typedef struct OMX_PARAM_MACROBLOCKSTYPE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nMacroblocks; ++} OMX_PARAM_MACROBLOCKSTYPE; ++ ++/** ++ * AVC Slice Mode modes ++ * ++ * OMX_VIDEO_SLICEMODE_AVCDefault : Normal frame encoding, one slice per frame ++ * OMX_VIDEO_SLICEMODE_AVCMBSlice : NAL mode, number of MBs per frame ++ * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame ++ */ ++typedef enum OMX_VIDEO_AVCSLICEMODETYPE { ++ OMX_VIDEO_SLICEMODE_AVCDefault = 0, ++ OMX_VIDEO_SLICEMODE_AVCMBSlice, ++ OMX_VIDEO_SLICEMODE_AVCByteSlice, ++ OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ ++ OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ ++ OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF ++} OMX_VIDEO_AVCSLICEMODETYPE; ++ ++/** ++ * AVC FMO Slice Mode Params ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nNumSliceGroups : Specifies the number of slice groups ++ * nSliceGroupMapType : Specifies the type of slice groups ++ * eSliceMode : Specifies the type of slice ++ */ ++typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U8 nNumSliceGroups; ++ OMX_U8 nSliceGroupMapType; ++ OMX_VIDEO_AVCSLICEMODETYPE eSliceMode; ++} OMX_VIDEO_PARAM_AVCSLICEFMO; ++ ++/** ++ * AVC IDR Period Configs ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nIDRPeriod : Specifies periodicity of IDR frames ++ * nPFrames : Specifies internal of coding Intra frames ++ */ ++typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nIDRPeriod; ++ OMX_U32 nPFrames; ++} OMX_VIDEO_CONFIG_AVCINTRAPERIOD; ++ ++/** ++ * AVC NAL Size Configs ++ * ++ * STRUCT MEMBERS: ++ * nSize : Size of the structure in bytes ++ * nVersion : OMX specification version information ++ * nPortIndex : Port that this structure applies to ++ * nNaluBytes : Specifies the NAL unit size ++ */ ++typedef struct OMX_VIDEO_CONFIG_NALSIZE { ++ OMX_U32 nSize; ++ OMX_VERSIONTYPE nVersion; ++ OMX_U32 nPortIndex; ++ OMX_U32 nNaluBytes; ++} OMX_VIDEO_CONFIG_NALSIZE; ++ ++/** @} */ ++ ++#ifdef __cplusplus ++} ++#endif /* __cplusplus */ ++ ++#endif ++/* File EOF */ ++ +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index d2f9a39..bc1c38a 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -29,6 +29,20 @@ + #include "avcodec.h" + #include "version.h" + ++/* ft omx */ ++extern AVCodec ff_h263_ftomx_decoder; ++extern AVCodec ff_h264_ftomx_decoder; ++extern AVCodec ff_hevc_ftomx_decoder; ++extern AVCodec ff_mpeg2_ftomx_decoder; ++extern AVCodec ff_mpeg4_ftomx_decoder; ++extern AVCodec ff_vp6_ftomx_decoder; ++extern AVCodec ff_vp8_ftomx_decoder; ++extern AVCodec ff_vc1_ftomx_decoder; ++extern AVCodec ff_rv30_ftomx_decoder; ++extern AVCodec ff_rv40_ftomx_decoder; ++extern AVCodec ff_flv_ftomx_decoder; ++extern AVCodec ff_cavs_ftomx_decoder; ++ + extern AVCodec ff_a64multi_encoder; + extern AVCodec ff_a64multi5_encoder; + extern AVCodec ff_aasc_decoder; +diff --git a/libavcodec/ftomx.c b/libavcodec/ftomx.c +new file mode 100755 +index 0000000..f4f70d3 +--- /dev/null ++++ b/libavcodec/ftomx.c +@@ -0,0 +1,1699 @@ ++/* ++ * OMX Video encoder ++ * Copyright (C) 2011 Martin Storsjo ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "config.h" ++ ++#if CONFIG_OMX_RPI ++#define OMX_SKIP64BIT ++#endif ++ ++#include ++#include "OMX_Core.h" ++#include "OMX_Component.h" ++#include ++#include ++#include ++#include ++ ++#include "libavutil/avstring.h" ++#include "libavutil/avutil.h" ++#include "libavutil/common.h" ++#include "libavutil/imgutils.h" ++#include "libavutil/log.h" ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++ ++#include "avcodec.h" ++#include "h264.h" ++#include "internal.h" ++ ++/* extend omx format */ ++#define OMX_COLOR_FormatYVU422PackedSemiPlanar 52 ++ ++#define OMX_COLOR_FormatYVU420SemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000001 ++#define OMX_COLOR_FormatYVU420PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000002 ++ ++#define OMX_COLOR_FormatYUV444PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000021 /**< YUV444 packed semi-planar format */ ++#define OMX_COLOR_FormatYVU444PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000022 /**< YVU444 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYUV420PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000023 /**< 10-bit Msb YUV420 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYVU420PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000024 /**< 10-bit Msb YVU420 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYUV422PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000025 /**< 10-bit Msb YVU422 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYVU422PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000026 /**< 10-bit Msb YVU422 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYUV444PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000027 /**< 10-bit Msb YUV444 packed semi-planar format */ ++#define OMX_COLOR_Format10bitMsbYVU444PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000028 /**< 10-bit Msb YVU444 packed semi-planar format */ ++#define OMX_COLOR_Format10bitYVU422PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000029 /*Packed version of For 10bit 422 PL21 : packed 3 pixel values in 32bit word*/ ++#define OMX_COLOR_Format10bitYUV422PackedSemiPlanar OMX_COLOR_FormatVendorStartUnused + 0x00000030 /*Packed version of For 10bit 422 PL21 : packed 3 pixel values in 32bit word*/ ++ ++/* extend omx codingtype */ ++#define OMX_VIDEO_CodingVP8 9 ++#define OMX_VIDEO_CodingVP9 10 ++#define OMX_VIDEO_CodingHEVC 11 ++ ++#define OMX_VIDEO_CodingVC1 OMX_VIDEO_CodingVendorStartUnused + 0x00000002 ++#define OMX_VIDEO_CodingSorensonSpark OMX_VIDEO_CodingVendorStartUnused + 0x00000003 ++#define OMX_VIDEO_CodingVP6 OMX_VIDEO_CodingVendorStartUnused + 0x00000004 ++#define OMX_VIDEO_CodingAVS OMX_VIDEO_CodingVendorStartUnused + 0x00000005 ++ ++#define MIN(a, b) (((a) < (b)) ? (a) : (b)) ++//#define FTOMX_MAX_FRAME_BUFFER 12 ++#define FTOMX_MAX_DELAYED_BUF 100 ++ ++#define USEC_PER_SEC 1000000 ++ ++#ifdef OMX_SKIP64BIT ++static OMX_TICKS to_omx_ticks(int64_t value) ++{ ++ OMX_TICKS s; ++ s.nLowPart = value & 0xffffffff; ++ s.nHighPart = value >> 32; ++ return s; ++} ++static int64_t from_omx_ticks(OMX_TICKS value) ++{ ++ return (((int64_t)value.nHighPart) << 32) | value.nLowPart; ++} ++#else ++#define to_omx_ticks(x) (x) ++#define from_omx_ticks(x) (x) ++#endif ++ ++#define OMX_VERSION_MAJOR 1 ++#define OMX_VERSION_MINOR 2 ++#define OMX_VERSION_REVISION 0 ++#define OMX_VERSION_STEP 0 ++ ++#define INIT_STRUCT(x) do { \ ++ x.nSize = sizeof(x); \ ++ x.nVersion = s->version; \ ++ } while (0) ++#define CHECK(x) do { \ ++ if (x != OMX_ErrorNone) { \ ++ av_log(avctx, AV_LOG_ERROR, \ ++ "err %x (%d) on line %d\n", x, x, __LINE__); \ ++ return AVERROR_UNKNOWN; \ ++ } \ ++ } while (0) ++ ++#define FT_OMX_INIT_STRUCT(st) do { \ ++ memset ((st), 0, sizeof (*(st))); \ ++ (st)->nSize = sizeof (*(st)); \ ++ (st)->nVersion.s.nVersionMajor = OMX_VERSION_MAJOR; \ ++ (st)->nVersion.s.nVersionMinor = OMX_VERSION_MINOR; \ ++ (st)->nVersion.s.nRevision = OMX_VERSION_REVISION; \ ++ (st)->nVersion.s.nStep = OMX_VERSION_STEP; \ ++} while(0) ++ ++typedef struct FTOMXContext { ++ void *lib; ++ OMX_ERRORTYPE (*ptr_Init)(void); ++ OMX_ERRORTYPE (*ptr_Deinit)(void); ++ OMX_ERRORTYPE (*ptr_ComponentNameEnum)(OMX_STRING, OMX_U32, OMX_U32); ++ OMX_ERRORTYPE (*ptr_GetHandle)(OMX_HANDLETYPE*, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE*); ++ OMX_ERRORTYPE (*ptr_FreeHandle)(OMX_HANDLETYPE); ++ OMX_ERRORTYPE (*ptr_GetComponentsOfRole)(OMX_STRING, OMX_U32*, OMX_U8**); ++ OMX_ERRORTYPE (*ptr_GetRolesOfComponent)(OMX_STRING, OMX_U32*, OMX_U8**); ++} FTOMXContext; ++ ++typedef struct FTOMXCodecContext { ++ const AVClass *class; ++ char *libname; ++ FTOMXContext *omx_context; ++ ++ AVCodecContext *avctx; ++ ++ char component_name[OMX_MAX_STRINGNAME_SIZE]; ++ OMX_VERSIONTYPE version; ++ OMX_HANDLETYPE handle; ++ int in_port, out_port; ++ OMX_COLOR_FORMATTYPE color_format; ++ int stride, plane_size; ++ ++ int num_in_buffers, num_out_buffers; ++ OMX_BUFFERHEADERTYPE **in_buffer_headers; ++ OMX_BUFFERHEADERTYPE **out_buffer_headers; ++ int num_free_in_buffers; ++ OMX_BUFFERHEADERTYPE **free_in_buffers; ++ int num_done_out_buffers; ++ OMX_BUFFERHEADERTYPE **done_out_buffers; ++ pthread_mutex_t input_mutex; ++ pthread_cond_t input_cond; ++ pthread_mutex_t output_mutex; ++ pthread_cond_t output_cond; ++ ++ pthread_mutex_t state_mutex; ++ pthread_cond_t state_cond; ++ pthread_mutex_t port_mutex; ++ pthread_cond_t port_cond; ++ pthread_mutex_t flush_mutex; ++ pthread_cond_t flush_cond; ++ pthread_mutex_t buffer_mutex; ++ pthread_cond_t buffer_cond; ++ OMX_STATETYPE state; ++ OMX_ERRORTYPE error; ++ ++ int mutex_cond_inited; ++ ++ OMX_BOOL eos_sent, got_eos; ++ ++ int profile; ++ ++ int64_t last_timestamp; ++ OMX_BUFFERHEADERTYPE *cur; ++ OMX_BOOL configed; ++ OMX_BOOL started; ++ OMX_BOOL seeked; ++ OMX_PARAM_PORTDEFINITIONTYPE in_port_params; ++ OMX_PARAM_PORTDEFINITIONTYPE out_port_params; ++ ++ OMX_BOOL port_flushing[2]; ++ ++ OMX_BOOL b_has_keyframe; ++ ++ int64_t req_num; ++ int64_t done_num; ++ ++ OMX_BOOL extradata_decoded; ++ OMX_BOOL inited; ++} FTOMXCodecContext; ++ ++int ft_omx_switch_port(FTOMXCodecContext *s, int index, OMX_BOOL on, OMX_BOOL wait); ++int ft_omx_port_flush(FTOMXCodecContext *s, int index, OMX_BOOL wait); ++void ftomx_wait_port_flushed(FTOMXCodecContext *s, int index); ++static OMX_BOOL fill_frame_buffer(FTOMXCodecContext *s, AVFrame *pict, uint8_t *buf); ++static void update_color_format(AVCodecContext *avctx, OMX_COLOR_FORMATTYPE color_format); ++static av_cold int ftomx_decodec_end(AVCodecContext *avctx); ++ ++static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond, ++ int* array_size, OMX_BUFFERHEADERTYPE **array, ++ OMX_BUFFERHEADERTYPE *buffer); ++static void ftomx_reconfig_outport(FTOMXCodecContext *s); ++ ++static av_cold int ft_try_load(FTOMXContext *s, void *logavctx, ++ const char *libname) ++{ ++ s->lib = dlopen(libname, RTLD_NOW | RTLD_GLOBAL); ++ if (!s->lib) { ++ av_log(logavctx, AV_LOG_WARNING, "%s not found\n", libname); ++ return AVERROR_ENCODER_NOT_FOUND; ++ } ++ s->ptr_Init = dlsym(s->lib, "OMX_Init"); ++ s->ptr_Deinit = dlsym(s->lib, "OMX_Deinit"); ++ s->ptr_ComponentNameEnum = dlsym(s->lib, "OMX_ComponentNameEnum"); ++ s->ptr_GetHandle = dlsym(s->lib, "OMX_GetHandle"); ++ s->ptr_FreeHandle = dlsym(s->lib, "OMX_FreeHandle"); ++ s->ptr_GetComponentsOfRole = dlsym(s->lib, "OMX_GetComponentsOfRole"); ++ s->ptr_GetRolesOfComponent = dlsym(s->lib, "OMX_GetRolesOfComponent"); ++ if (!s->ptr_Init || !s->ptr_Deinit || !s->ptr_ComponentNameEnum || ++ !s->ptr_GetHandle || !s->ptr_FreeHandle || ++ !s->ptr_GetComponentsOfRole || !s->ptr_GetRolesOfComponent) { ++ av_log(logavctx, AV_LOG_WARNING, "Not all functions found in %s\n", libname); ++ dlclose(s->lib); ++ s->lib = NULL; ++ return AVERROR_ENCODER_NOT_FOUND; ++ } ++ return 0; ++} ++ ++static av_cold FTOMXContext *ftomx_init(void *logavctx, const char *libname) ++{ ++ static const char * const libnames[] = { ++ "libomx_vxd.so", NULL, ++ NULL ++ }; ++ const char* const* nameptr; ++ int ret = AVERROR_ENCODER_NOT_FOUND; ++ FTOMXContext *omx_context; ++ ++ omx_context = av_mallocz(sizeof(*omx_context)); ++ if (!omx_context) ++ return NULL; ++ if (libname) { ++ ret = ft_try_load(omx_context, logavctx, libname); ++ if (ret < 0) { ++ av_free(omx_context); ++ return NULL; ++ } ++ } else { ++ for (nameptr = libnames; *nameptr; nameptr += 2) ++ if (!(ret = ft_try_load(omx_context, logavctx, nameptr[0]))) ++ break; ++ if (!*nameptr) { ++ av_free(omx_context); ++ return NULL; ++ } ++ } ++ ++ omx_context->ptr_Init(); ++ return omx_context; ++} ++ ++static av_cold void omx_deinit(FTOMXContext *omx_context) ++{ ++ if (!omx_context) ++ return; ++ omx_context->ptr_Deinit(); ++ dlclose(omx_context->lib); ++ av_free(omx_context); ++} ++ ++static OMX_ERRORTYPE ft_omx_get_port_definition(FTOMXCodecContext *s, ++ int index, ++ OMX_PARAM_PORTDEFINITIONTYPE * port_def); ++ ++static void ftomx_reset_buffer(OMX_BUFFERHEADERTYPE *buf) { ++ buf->nFlags = 0; ++ buf->nOffset = 0; ++ buf->nFilledLen = 0; ++ buf->nTimeStamp = 0; ++ buf->pAppPrivate = NULL; ++} ++ ++static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond, ++ int* array_size, OMX_BUFFERHEADERTYPE **array, ++ OMX_BUFFERHEADERTYPE *buffer) ++{ ++ pthread_mutex_lock(mutex); ++ array[(*array_size)++] = buffer; ++ pthread_cond_broadcast(cond); ++ pthread_mutex_unlock(mutex); ++} ++ ++static OMX_BUFFERHEADERTYPE *get_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond, ++ int* array_size, OMX_BUFFERHEADERTYPE **array, ++ int wait) ++{ ++ OMX_BUFFERHEADERTYPE *buffer; ++ pthread_mutex_lock(mutex); ++ if (wait) { ++ while (!*array_size) ++ pthread_cond_wait(cond, mutex); ++ } ++ if (*array_size > 0) { ++ buffer = array[0]; ++ (*array_size)--; ++ memmove(&array[0], &array[1], (*array_size) * sizeof(OMX_BUFFERHEADERTYPE*)); ++ } else { ++ buffer = NULL; ++ } ++ pthread_mutex_unlock(mutex); ++ return buffer; ++} ++ ++static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event, ++ OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data) ++{ ++ FTOMXCodecContext *s = app_data; ++ // This uses casts in the printfs, since OMX_U32 actually is a typedef for ++ // unsigned long in official header versions (but there are also modified ++ // versions where it is something else). ++ switch (event) { ++ case OMX_EventError: ++ pthread_mutex_lock(&s->state_mutex); ++ av_log(s->avctx, AV_LOG_ERROR, "OMX error %"PRIx32"\n", (uint32_t) data1); ++ s->error = data1; ++ pthread_cond_broadcast(&s->state_cond); ++ pthread_mutex_unlock(&s->state_mutex); ++ break; ++ case OMX_EventCmdComplete: ++ switch (data1) { ++ case OMX_CommandStateSet: ++ pthread_mutex_lock(&s->state_mutex); ++ s->state = data2; ++ av_log(s->avctx, AV_LOG_INFO, "OMX state changed to %"PRIu32"\n", (uint32_t) data2); ++ pthread_cond_broadcast(&s->state_cond); ++ pthread_mutex_unlock(&s->state_mutex); ++ break; ++ ++ case OMX_CommandPortDisable: ++ pthread_mutex_lock(&s->port_mutex); ++ av_log(s->avctx, AV_LOG_INFO, "OMX port %"PRIu32" disabled\n", (uint32_t) data2); ++ pthread_cond_broadcast(&s->port_cond); ++ pthread_mutex_unlock(&s->port_mutex); ++ break; ++ ++ case OMX_CommandPortEnable: ++ pthread_mutex_lock(&s->port_mutex); ++ av_log(s->avctx, AV_LOG_INFO, "OMX port %"PRIu32" enabled\n", (uint32_t) data2); ++ pthread_cond_broadcast(&s->port_cond); ++ pthread_mutex_unlock(&s->port_mutex); ++ break; ++ ++ case OMX_CommandFlush: ++ pthread_mutex_lock(&s->flush_mutex); ++ s->port_flushing[data2] = OMX_FALSE; ++ pthread_cond_broadcast(&s->flush_cond); ++ pthread_mutex_unlock(&s->flush_mutex); ++ av_log(s->avctx, AV_LOG_INFO, "OMX port %"PRIu32" flushed\n", (uint32_t) data2); ++ break; ++ ++ default: ++ av_log(s->avctx, AV_LOG_ERROR, "OMX command complete, command %"PRIu32", value %"PRIu32"\n", ++ (uint32_t) data1, (uint32_t) data2); ++ break; ++ } ++ break; ++ ++ case OMX_EventPortSettingsChanged: ++ av_log(s->avctx, AV_LOG_INFO, "OMX port %"PRIu32" settings changed\n", (uint32_t) data1); ++ if (data2 == OMX_IndexParamPortDefinition) { ++ if (data1 == s->in_port) { ++ ft_omx_get_port_definition(s, (uint32_t)data1, &s->in_port_params); ++ } else { ++ ft_omx_get_port_definition(s, (uint32_t)data1, &s->out_port_params); ++ ++ pthread_mutex_lock(&s->port_mutex); ++ s->configed = OMX_TRUE; ++ pthread_cond_broadcast(&s->port_cond); ++ pthread_mutex_unlock(&s->port_mutex); ++ } ++ } ++ break; ++ ++ case OMX_EventBufferFlag: ++ pthread_mutex_lock(&s->buffer_mutex); ++ if ((data1 == s->out_port) && (data2 == OMX_BUFFERFLAG_EOS)) { ++ s->got_eos = OMX_TRUE; ++ av_log(s->avctx, AV_LOG_INFO, "receive eos event\n"); ++ pthread_cond_broadcast(&s->buffer_cond); ++ } ++ pthread_mutex_unlock(&s->buffer_mutex); ++ break; ++ ++ default: ++ av_log(s->avctx, AV_LOG_ERROR, "OMX event %d %"PRIx32" %"PRIx32"\n", ++ event, (uint32_t) data1, (uint32_t) data2); ++ break; ++ } ++ return OMX_ErrorNone; ++} ++ ++static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, ++ OMX_BUFFERHEADERTYPE *buffer) ++{ ++ FTOMXCodecContext *s = app_data; ++ ++ buffer->nFlags = 0; ++ buffer->nOffset = 0; ++ buffer->nFilledLen = 0; ++ buffer->nTimeStamp = 0; ++ ++ append_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, buffer); ++ return OMX_ErrorNone; ++} ++ ++static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data, ++ OMX_BUFFERHEADERTYPE *buffer) ++{ ++ FTOMXCodecContext *s = app_data; ++ //printf("append buf:0x%llx\n", buffer); ++ av_assert0(!buffer->pAppPrivate); ++ append_buffer(&s->output_mutex, &s->output_cond, ++ &s->num_done_out_buffers, s->done_out_buffers, buffer); ++ return OMX_ErrorNone; ++} ++ ++static const OMX_CALLBACKTYPE callbacks = { ++ event_handler, ++ empty_buffer_done, ++ fill_buffer_done ++}; ++ ++static av_cold int find_component(FTOMXContext *ft_context, void *logavctx, ++ const char *role, char *str, int str_size) ++{ ++ OMX_U32 i, num = 0; ++ char **components; ++ int ret = 0; ++ ++ ft_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, NULL); ++ if (!num) { ++ av_log(logavctx, AV_LOG_WARNING, "No component for role %s found\n", role); ++ return AVERROR_ENCODER_NOT_FOUND; ++ } ++ components = av_mallocz_array(num, sizeof(*components)); ++ if (!components) ++ return AVERROR(ENOMEM); ++ for (i = 0; i < num; i++) { ++ components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE); ++ if (!components[i]) { ++ ret = AVERROR(ENOMEM); ++ goto end; ++ } ++ } ++ ft_context->ptr_GetComponentsOfRole((OMX_STRING) role, &num, (OMX_U8**) components); ++ av_strlcpy(str, components[0], str_size); ++end: ++ for (i = 0; i < num; i++) ++ av_free(components[i]); ++ av_free(components); ++ return ret; ++} ++ ++static av_cold int wait_for_state(FTOMXCodecContext *s, OMX_STATETYPE state) ++{ ++ int ret = 0; ++ pthread_mutex_lock(&s->state_mutex); ++ while (s->state != state && s->error == OMX_ErrorNone) ++ pthread_cond_wait(&s->state_cond, &s->state_mutex); ++ if (s->error != OMX_ErrorNone) ++ ret = AVERROR_ENCODER_NOT_FOUND; ++ pthread_mutex_unlock(&s->state_mutex); ++ return ret; ++} ++ ++static void wait_eos_event(FTOMXCodecContext *s) ++{ ++ pthread_mutex_lock(&s->buffer_mutex); ++ while (!s->got_eos) ++ pthread_cond_wait(&s->buffer_cond, &s->buffer_mutex); ++ pthread_mutex_unlock(&s->buffer_mutex); ++ return; ++} ++ ++static OMX_ERRORTYPE ft_omx_get_port_definition(FTOMXCodecContext *s, ++ int index, ++ OMX_PARAM_PORTDEFINITIONTYPE * port_def) ++{ ++ OMX_ERRORTYPE err; ++ FT_OMX_INIT_STRUCT(port_def); ++ port_def->nPortIndex = index; ++ ++ err = OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, port_def); ++ ++ return err; ++} ++ ++static av_cold int wait_for_port_onoff(FTOMXCodecContext *s, int index, OMX_BOOL enable) ++{ ++ int ret = 0; ++ OMX_PARAM_PORTDEFINITIONTYPE *port_def = NULL; ++ if (index == s->in_port) { ++ port_def = &s->in_port_params; ++ } else { ++ port_def = &s->out_port_params; ++ } ++ ++ pthread_mutex_lock(&s->port_mutex); ++ ft_omx_get_port_definition(s, index, port_def); ++ while (port_def->bEnabled != enable) { ++ pthread_cond_wait(&s->port_cond, &s->port_mutex); ++ ft_omx_get_port_definition(s, index, port_def); ++ } ++ if (s->error != OMX_ErrorNone) ++ ret = AVERROR_ENCODER_NOT_FOUND; ++ pthread_mutex_unlock(&s->port_mutex); ++ return ret; ++} ++ ++static OMX_ERRORTYPE ft_omx_update_port_definition (FTOMXCodecContext *s, ++ OMX_PARAM_PORTDEFINITIONTYPE * port_def) ++{ ++ OMX_ERRORTYPE err; ++ ++ if (port_def) { ++ err = OMX_SetParameter(s->handle, OMX_IndexParamPortDefinition, port_def); ++ } ++ ++ OMX_GetParameter(s->handle, OMX_IndexParamPortDefinition, port_def); ++ ++ return err; ++} ++ ++int ft_omx_switch_port(FTOMXCodecContext *s, int index, OMX_BOOL on, OMX_BOOL wait) { ++ int err = 0; ++ AVCodecContext *avctx = s->avctx; ++ ++ if (on) { ++ err = OMX_SendCommand(s->handle, OMX_CommandPortEnable, index, NULL); ++ } else { ++ err = OMX_SendCommand(s->handle, OMX_CommandPortDisable, index, NULL); ++ } ++ CHECK(err); ++ ++ if (wait) { ++ wait_for_port_onoff(s, index, on); ++ } ++ return err; ++} ++ ++int ft_omx_port_flush(FTOMXCodecContext *s, int index, OMX_BOOL wait) { ++ int err = 0; ++ s->port_flushing[index] = OMX_TRUE; ++ ++ err = OMX_SendCommand(s->handle, OMX_CommandFlush, index, NULL); ++ if (wait) { ++ pthread_mutex_lock(&s->flush_mutex); ++ while (s->port_flushing[index]) { ++ pthread_cond_wait(&s->flush_cond, &s->flush_mutex); ++ } ++ pthread_mutex_unlock(&s->flush_mutex); ++ } ++ ++ return err; ++} ++ ++void ftomx_wait_port_flushed(FTOMXCodecContext *s, int index) { ++ pthread_mutex_lock(&s->flush_mutex); ++ while (s->port_flushing[index]) { ++ pthread_cond_wait(&s->flush_cond, &s->flush_mutex); ++ } ++ pthread_mutex_unlock(&s->flush_mutex); ++ ++ return; ++} ++ ++static av_cold void wait_port_configed(FTOMXCodecContext *s) ++{ ++ int width, height; ++ enum AVCodecID codecid = s->avctx->codec->id; ++ ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ width = s->out_port_params.format.video.nFrameWidth; ++ height = s->out_port_params.format.video.nFrameHeight; ++ } else { ++ width = s->out_port_params.format.image.nFrameWidth; ++ height = s->out_port_params.format.image.nFrameHeight; ++ } ++ ++ if (s->avctx->width && s->avctx->height) { ++ if ((width < s->avctx->width) || (height < s->avctx->height)) { ++ s->configed = OMX_FALSE; ++ } ++ } ++ ++ while (!s->configed) { ++ pthread_mutex_lock(&s->port_mutex); ++ if (!s->configed) { ++ pthread_cond_wait(&s->port_cond, &s->port_mutex); ++ } ++ pthread_mutex_unlock(&s->port_mutex); ++ ++ if (s->avctx->width && s->avctx->height) { ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ width = s->out_port_params.format.video.nFrameWidth; ++ height = s->out_port_params.format.video.nFrameHeight; ++ } else { ++ width = s->out_port_params.format.image.nFrameWidth; ++ height = s->out_port_params.format.image.nFrameHeight; ++ } ++ if ((width < s->avctx->width) || (height < s->avctx->height)) { ++ s->configed = OMX_FALSE; ++ } ++ } ++ } ++ return; ++} ++ ++static av_cold int ft_component_init(AVCodecContext *avctx, const char *role) ++{ ++ FTOMXCodecContext *s = avctx->priv_data; ++ OMX_PARAM_COMPONENTROLETYPE role_params = { 0 }; ++ OMX_VIDEO_PARAM_PORTFORMATTYPE video_port_format = { 0 }; ++ OMX_PARAM_PORTDEFINITIONTYPE *port_def = NULL; ++ OMX_ERRORTYPE err; ++ enum AVCodecID codecid = avctx->codec->id; ++ int i; ++ ++ s->version.s.nVersionMajor = 1; ++ s->version.s.nVersionMinor = 2; ++ s->version.s.nRevision = 0; ++ ++ err = s->omx_context->ptr_GetHandle(&s->handle, s->component_name, s, (OMX_CALLBACKTYPE*) &callbacks); ++ if (err != OMX_ErrorNone) { ++ av_log(avctx, AV_LOG_ERROR, "OMX_GetHandle(%s) failed: %x\n", s->component_name, err); ++ return AVERROR_UNKNOWN; ++ } ++ ++ // This one crashes the mediaserver on qcom, if used over IOMX ++ INIT_STRUCT(role_params); ++ av_strlcpy(role_params.cRole, role, sizeof(role_params.cRole)); ++ // Intentionally ignore errors on this one ++ OMX_SetParameter(s->handle, OMX_IndexParamStandardComponentRole, &role_params); ++ ++ s->in_port = 0; ++ s->out_port = 1; ++ ft_omx_get_port_definition(s, 0, &s->in_port_params); ++ if (s->in_port_params.eDir != OMX_DirInput) { ++ memcpy(&s->out_port_params, &s->in_port_params, sizeof(s->in_port_params)); ++ ft_omx_get_port_definition(s, 1, &s->in_port_params); ++ s->in_port = 1; ++ s->out_port = 0; ++ } else { ++ ft_omx_get_port_definition(s, 1, &s->out_port_params); ++ } ++ ++ s->stride = avctx->width; ++ s->plane_size = avctx->height; ++ ++ /* config in port */ ++ port_def = &s->in_port_params; ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ port_def->format.video.nFrameWidth = avctx->width; ++ port_def->format.video.nFrameHeight = avctx->height; ++ port_def->eDomain = OMX_PortDomainVideo; ++ if (avctx->framerate.den > 0 && avctx->framerate.num > 0) ++ port_def->format.video.xFramerate = (1LL << 16) * avctx->framerate.num / avctx->framerate.den; ++ else ++ port_def->format.video.xFramerate = (1LL << 16) * avctx->time_base.den / avctx->time_base.num; ++ } else { ++ port_def->format.image.nFrameWidth = avctx->width; ++ port_def->format.image.nFrameHeight = avctx->height; ++ port_def->eDomain = OMX_PortDomainImage; ++ } ++ ++ err = ft_omx_update_port_definition(s, port_def); ++ CHECK(err); ++ ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ s->stride = port_def->format.video.nStride; ++ s->plane_size = port_def->format.video.nSliceHeight; ++ } else { ++ s->stride = port_def->format.image.nStride; ++ s->plane_size = port_def->format.image.nSliceHeight; ++ } ++ s->num_in_buffers = port_def->nBufferCountActual; ++ ++ if (avctx->codec->id == AV_CODEC_ID_H264) { ++ OMX_VIDEO_PARAM_AVCTYPE avc = { 0 }; ++ INIT_STRUCT(avc); ++ avc.nPortIndex = s->out_port; ++ err = OMX_GetParameter(s->handle, OMX_IndexParamVideoAvc, &avc); ++ CHECK(err); ++ avc.nBFrames = 0; ++ avc.nPFrames = avctx->gop_size - 1; ++ switch (s->profile == FF_PROFILE_UNKNOWN ? avctx->profile : s->profile) { ++ case FF_PROFILE_H264_BASELINE: ++ avc.eProfile = OMX_VIDEO_AVCProfileBaseline; ++ break; ++ case FF_PROFILE_H264_MAIN: ++ avc.eProfile = OMX_VIDEO_AVCProfileMain; ++ break; ++ case FF_PROFILE_H264_HIGH: ++ avc.eProfile = OMX_VIDEO_AVCProfileHigh; ++ break; ++ default: ++ break; ++ } ++ err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc); ++ CHECK(err); ++ } ++ ++ /* config output port */ ++ s->color_format = 0; ++ for (i = 0; ; i++) { ++ INIT_STRUCT(video_port_format); ++ video_port_format.nIndex = i; ++ video_port_format.nPortIndex = s->out_port; ++ if (OMX_GetParameter(s->handle, OMX_IndexParamVideoPortFormat, &video_port_format) != OMX_ErrorNone) ++ break; ++ if (video_port_format.eColorFormat == OMX_COLOR_FormatYUV420PackedSemiPlanar || ++ video_port_format.eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar) { ++ s->color_format = video_port_format.eColorFormat; ++ break; ++ } ++ } ++ ++ if (s->color_format == 0) { ++ av_log(avctx, AV_LOG_ERROR, "No supported pixel formats (%d formats available)\n", i); ++ return AVERROR_UNKNOWN; ++ } ++ ++ port_def = &s->out_port_params; ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ port_def->format.video.eColorFormat = s->color_format; ++ } else { ++ port_def->format.image.eColorFormat = s->color_format; ++ } ++ ++ switch (avctx->codec->id) { ++ case AV_CODEC_ID_H263: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingH263; ++ break; ++ case AV_CODEC_ID_H264: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingAVC; ++ break; ++ case AV_CODEC_ID_HEVC: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingHEVC; ++ break; ++ case AV_CODEC_ID_MPEG2VIDEO: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG2; ++ break; ++ case AV_CODEC_ID_MPEG4: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4; ++ break; ++ case AV_CODEC_ID_VC1: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingVC1; ++ break; ++ case AV_CODEC_ID_VP6: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingVP6; ++ break; ++ case AV_CODEC_ID_VP8: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingVP8; ++ break; ++ case AV_CODEC_ID_JPEG2000: ++ port_def->format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG2K; ++ break; ++ case AV_CODEC_ID_MJPEG: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingMJPEG; ++ break; ++ case AV_CODEC_ID_CAVS: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingAVS; ++ break; ++ case AV_CODEC_ID_RV30: ++ case AV_CODEC_ID_RV40: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingRV; ++ break; ++ case AV_CODEC_ID_FLV1: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingSorensonSpark; ++ break; ++ default: ++ port_def->format.video.eCompressionFormat = OMX_VIDEO_CodingAutoDetect; ++ break; ++ } ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ port_def->format.video.nFrameWidth = avctx->width; ++ port_def->format.video.nFrameHeight = avctx->height; ++ port_def->eDomain = OMX_PortDomainVideo; ++ } else { ++ port_def->format.image.nFrameWidth = avctx->width; ++ port_def->format.image.nFrameHeight = avctx->height; ++ port_def->eDomain = OMX_PortDomainImage; ++ } ++ err = ft_omx_update_port_definition(s, port_def); ++ ++ //s->num_out_buffers = FTOMX_MAX_FRAME_BUFFER; ++ s->in_buffer_headers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_in_buffers); ++ s->free_in_buffers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_in_buffers); ++ if (!s->in_buffer_headers || !s->free_in_buffers) ++ return AVERROR(ENOMEM); ++ ++ /* disable output port */ ++ ft_omx_switch_port(s, s->out_port, OMX_FALSE, OMX_TRUE); ++ err = OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); ++ CHECK(err); ++ ++ for (i = 0; i < s->num_in_buffers && err == OMX_ErrorNone; i++) { ++ err = OMX_AllocateBuffer(s->handle, &s->in_buffer_headers[i], s->in_port, s, s->in_port_params.nBufferSize); ++ } ++ CHECK(err); ++ s->num_in_buffers = i; ++ for (i = 0; i < s->num_in_buffers; i++) ++ s->free_in_buffers[s->num_free_in_buffers++] = s->in_buffer_headers[i]; ++ ++ if (wait_for_state(s, OMX_StateIdle) < 0) { ++ av_log(avctx, AV_LOG_ERROR, "wait OMX_StateIdle failed\n"); ++ return AVERROR_UNKNOWN; ++ } ++ ++ err = OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL); ++ CHECK(err); ++ if (wait_for_state(s, OMX_StateExecuting) < 0) { ++ av_log(avctx, AV_LOG_ERROR, "wait OMX_StateExecuting failed\n"); ++ return AVERROR_UNKNOWN; ++ } ++ ++ return err != OMX_ErrorNone ? AVERROR_UNKNOWN : 0; ++} ++ ++static void ftomx_flush(AVCodecContext *avctx) { ++ int executing; ++ FTOMXCodecContext *s = avctx->priv_data; ++ OMX_BUFFERHEADERTYPE* out_buffer = NULL; ++ int i = 0; ++ ++ if (!s->started) { ++ av_log(avctx, AV_LOG_ERROR, "stream stopped\n"); ++ return; ++ } ++ ++ s->seeked = OMX_TRUE; ++ ++ pthread_mutex_lock(&s->state_mutex); ++ executing = s->state == OMX_StateExecuting; ++ pthread_mutex_unlock(&s->state_mutex); ++ ++ if (executing) { ++ OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StatePause, NULL); ++ wait_for_state(s, OMX_StatePause); ++ ++ ft_omx_port_flush(s, s->in_port, OMX_TRUE); ++ ++ OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL); ++ wait_for_state(s, OMX_StateExecuting); ++ ++ ft_omx_port_flush(s, s->out_port, OMX_TRUE); ++ ++ av_log(avctx, AV_LOG_TRACE, "%d buffer received\n", s->num_done_out_buffers); ++ ++ for (i = 0; i < s->num_out_buffers; i++) { ++ if (!s->out_buffer_headers[i]) { ++ continue; ++ } ++ ++ out_buffer = get_buffer(&s->output_mutex, &s->output_cond, ++ &s->num_done_out_buffers, s->done_out_buffers, 1); ++ if (out_buffer->nFlags & OMX_BUFFERFLAG_EOS) { ++ av_log(avctx, AV_LOG_DEBUG, "receive eos when flush\n"); ++ } ++ ftomx_reset_buffer(out_buffer); ++ OMX_FillThisBuffer(s->handle, out_buffer); ++ } ++ ++ if (s->eos_sent && !s->got_eos) { ++ av_log(avctx, AV_LOG_DEBUG, "need resent eos after flush"); ++ s->eos_sent = OMX_FALSE; //need resent eos ++ } ++ av_log(avctx, AV_LOG_TRACE, "last timestamp before flush 0x%lx\n", s->last_timestamp); ++ } ++} ++ ++static av_cold void cleanup(FTOMXCodecContext *s) ++{ ++ int i, executing; ++ ++ pthread_mutex_lock(&s->state_mutex); ++ executing = s->state == OMX_StateExecuting; ++ pthread_mutex_unlock(&s->state_mutex); ++ ++ s->started = OMX_FALSE; ++ ++ if (executing) { ++ ft_omx_port_flush(s, s->in_port, OMX_TRUE); ++ ft_omx_port_flush(s, s->out_port, OMX_TRUE); ++ ++ OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateIdle, NULL); ++ wait_for_state(s, OMX_StateIdle); ++ OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); ++ for (i = 0; i < s->num_in_buffers; i++) { ++ OMX_BUFFERHEADERTYPE *buffer = get_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, 1); ++ OMX_FreeBuffer(s->handle, s->in_port, buffer); ++ } ++ ++ for (i = 0; i < s->num_out_buffers; i++) { ++ OMX_BUFFERHEADERTYPE *buffer = s->out_buffer_headers[i]; ++ if (!buffer) { ++ continue; ++ } ++ OMX_FreeBuffer(s->handle, s->out_port, buffer); ++ } ++ ++ wait_for_state(s, OMX_StateLoaded); ++ } ++ ++ if (s->handle) { ++ s->omx_context->ptr_FreeHandle(s->handle); ++ s->handle = NULL; ++ } ++ ++ av_log(s->avctx, AV_LOG_DEBUG, "cleanup finish\n"); ++ ++ omx_deinit(s->omx_context); ++ s->omx_context = NULL; ++ if (s->mutex_cond_inited) { ++ pthread_cond_destroy(&s->state_cond); ++ pthread_mutex_destroy(&s->state_mutex); ++ pthread_cond_destroy(&s->input_cond); ++ pthread_mutex_destroy(&s->input_mutex); ++ pthread_cond_destroy(&s->output_cond); ++ pthread_mutex_destroy(&s->output_mutex); ++ pthread_cond_destroy(&s->port_cond); ++ pthread_mutex_destroy(&s->port_mutex); ++ pthread_cond_destroy(&s->flush_cond); ++ pthread_mutex_destroy(&s->flush_mutex); ++ pthread_cond_destroy(&s->buffer_cond); ++ pthread_mutex_destroy(&s->buffer_mutex); ++ s->mutex_cond_inited = 0; ++ } ++ ++ av_freep(&s->in_buffer_headers); ++ av_freep(&s->out_buffer_headers); ++ av_freep(&s->free_in_buffers); ++ av_freep(&s->done_out_buffers); ++} ++ ++static av_cold int ftomx_decode_init(AVCodecContext *avctx) ++{ ++ FTOMXCodecContext *s = avctx->priv_data; ++ int ret = AVERROR_ENCODER_NOT_FOUND; ++ const char *role; ++ ++ if (s->inited) { ++ ftomx_decodec_end(avctx); ++ } ++ ++ s->omx_context = ftomx_init(avctx, s->libname); ++ if (!s->omx_context) { ++ return AVERROR_ENCODER_NOT_FOUND; ++ } ++ ++ pthread_mutex_init(&s->state_mutex, NULL); ++ pthread_cond_init(&s->state_cond, NULL); ++ pthread_mutex_init(&s->port_mutex, NULL); ++ pthread_cond_init(&s->port_cond, NULL); ++ pthread_mutex_init(&s->flush_mutex, NULL); ++ pthread_cond_init(&s->flush_cond, NULL); ++ pthread_mutex_init(&s->input_mutex, NULL); ++ pthread_cond_init(&s->input_cond, NULL); ++ pthread_mutex_init(&s->output_mutex, NULL); ++ pthread_cond_init(&s->output_cond, NULL); ++ pthread_mutex_init(&s->buffer_mutex, NULL); ++ pthread_cond_init(&s->buffer_cond, NULL); ++ s->mutex_cond_inited = 1; ++ s->avctx = avctx; ++ s->state = OMX_StateLoaded; ++ s->error = OMX_ErrorNone; ++ ++ switch (avctx->codec->id) { ++ case AV_CODEC_ID_MPEG2VIDEO: ++ role = "video_decoder.mpeg2"; ++ break; ++ case AV_CODEC_ID_MPEG4: ++ role = "video_decoder.mpeg4"; ++ break; ++ case AV_CODEC_ID_H263: ++ role = "video_decoder.h263"; ++ break; ++ case AV_CODEC_ID_H264: ++ role = "video_decoder.avc"; ++ break; ++ case AV_CODEC_ID_HEVC: ++ role = "video_decoder.hevc"; ++ break; ++ case AV_CODEC_ID_VC1: ++ role = "video_decoder.vc1"; ++ break; ++ case AV_CODEC_ID_VP6: ++ role = "video_decoder.vp6"; ++ break; ++ case AV_CODEC_ID_VP8: ++ role = "video_decoder.vp8"; ++ break; ++ case AV_CODEC_ID_CAVS: ++ role = "video_decoder.avs"; ++ break; ++ case AV_CODEC_ID_RV30: ++ case AV_CODEC_ID_RV40: ++ role = "video_decoder.real"; ++ break; ++ case AV_CODEC_ID_JPEG2000: ++ role = "image_decoder.JPEG"; ++ break; ++ case AV_CODEC_ID_MJPEG: ++ role = "video_decoder.mjpeg"; ++ break; ++ case AV_CODEC_ID_FLV1: ++ role = "video_decoder.sorenson"; ++ break; ++ ++ default: ++ return AVERROR(ENOSYS); ++ } ++ ++ if ((ret = find_component(s->omx_context, avctx, role, s->component_name, sizeof(s->component_name))) < 0) ++ goto fail; ++ ++ av_log(avctx, AV_LOG_DEBUG, "Using %s\n", s->component_name); ++ ++ if ((ret = ft_component_init(avctx, role)) < 0) ++ goto fail; ++ ++ s->last_timestamp = AV_NOPTS_VALUE; ++ ++ s->inited = OMX_TRUE; ++ ++ return 0; ++fail: ++ return ret; ++} ++ ++static int ftomx_recv_new_pict(FTOMXCodecContext *s, AVFrame *pict, OMX_BUFFERHEADERTYPE* out_buffer) { ++ AVCodecContext *avctx = s->avctx; ++ OMX_ERRORTYPE err; ++ int got = 0; ++ ++ if (!fill_frame_buffer(s, pict, out_buffer->pBuffer)) { ++ goto DONE; ++ } ++ pict->pts = from_omx_ticks(out_buffer->nTimeStamp); ++ if (pict->pts == AV_NOPTS_VALUE) { ++ pict->pkt_pos = -1; ++ } ++ ++ s->done_num++; ++ if (1 == s->done_num) { ++ av_log(avctx, AV_LOG_DEBUG, "delay:%ld\n", s->req_num - s->done_num); ++ } ++ av_log(avctx, AV_LOG_TRACE, "done:%ld, pts:%ld\n", s->done_num, pict->pts); ++ ++ ftomx_reset_buffer(out_buffer); ++ err = OMX_FillThisBuffer(s->handle, out_buffer); ++ if (err != OMX_ErrorNone) { ++ append_buffer(&s->output_mutex, &s->output_cond, &s->num_done_out_buffers, s->done_out_buffers, out_buffer); ++ av_log(s->avctx, AV_LOG_ERROR, "OMX_FillThisBuffer failed: %x\n", err); ++ } ++ ++ got = 1; ++ ++DONE: ++ return got; ++} ++ ++static void update_color_format(AVCodecContext *avctx, OMX_COLOR_FORMATTYPE color_format) { ++ switch (color_format) { ++ //yuv420 ++ case OMX_COLOR_FormatYUV420PackedPlanar: ++ //1.5x ++ avctx->pix_fmt = AV_PIX_FMT_YUV420P; ++ break; ++ ++ case OMX_COLOR_FormatYUV420SemiPlanar: ++ case OMX_COLOR_FormatYUV420PackedSemiPlanar: ++ //1.5x ++ avctx->pix_fmt = AV_PIX_FMT_NV12; ++ break; ++ ++ case OMX_COLOR_FormatYVU420SemiPlanar: ++ case OMX_COLOR_FormatYVU420PackedSemiPlanar: ++ //1.5x ++ avctx->pix_fmt = AV_PIX_FMT_NV21; ++ break; ++ ++ //10 bits format using most siginficant bits of a word (16b) ++ case OMX_COLOR_Format10bitMsbYUV420PackedSemiPlanar: ++ //3x ++ avctx->pix_fmt = AV_PIX_FMT_P010LE; //6bit shift ++ break; ++ ++ case OMX_COLOR_Format10bitMsbYVU420PackedSemiPlanar: ++ //3x ++ //10bit NV21 ++ break; ++ ++ //yuv422 ++ case OMX_COLOR_FormatYUV422PackedPlanar: ++ //2x ++ avctx->pix_fmt = AV_PIX_FMT_YUV422P; ++ break; ++ ++ case OMX_COLOR_FormatYCbYCr: ++ //2x ++ avctx->pix_fmt = AV_PIX_FMT_YUYV422; ++ break; ++ ++ case OMX_COLOR_FormatCbYCrY: ++ //2x ++ avctx->pix_fmt = AV_PIX_FMT_UYVY422; ++ break; ++ ++ case OMX_COLOR_FormatYUV422PackedSemiPlanar: ++ //2x ++ avctx->pix_fmt = AV_PIX_FMT_NV16; ++ break; ++ ++ case OMX_COLOR_FormatYVU422PackedSemiPlanar: ++ //2x ++ break; ++ ++ case OMX_COLOR_Format10bitMsbYUV422PackedSemiPlanar: ++ //4x ++ //mismatch: NV20LE offset=0, request offset=6; ++ //fix when output ++ avctx->pix_fmt = AV_PIX_FMT_NV20LE; ++ break; ++ ++ case OMX_COLOR_Format10bitMsbYVU422PackedSemiPlanar: ++ //4x ++ break; ++ ++ //0b00CCCCCCCCCBBBBBBBBBBAAAAAAAAAA, 30bit from dword ++ //每3个像素连续中间没有pad, Y与Y之间也是如此(每3个Y使用一个双字), 3个像素之后有2bit填充 ++ //这样3个像素合用dword ++ case OMX_COLOR_Format10bitYUV422PackedSemiPlanar: ++ case OMX_COLOR_Format10bitYVU422PackedSemiPlanar: ++ //((width + 2) / 3) * 4 * height ++ break; ++ ++#if 0 //not support ++ //yuv444 ++ case OMX_COLOR_FormatYUV444PackedSemiPlanar: ++ //3x ++ avctx->pix_fmt = AV_PIX_FMT_NV24; ++ break; ++ ++ case OMX_COLOR_FormatYVU444PackedSemiPlanar: ++ //3x ++ avctx->pix_fmt = AV_PIX_FMT_NV42; ++ break; ++ ++ case OMX_COLOR_Format10bitMsbYUV444PackedSemiPlanar: ++ //8x ++ break; ++ ++ case OMX_COLOR_Format10bitMsbYVU444PackedSemiPlanar: ++ //8x ++ break; ++#endif ++ ++ case OMX_COLOR_FormatL8: ++ avctx->pix_fmt = AV_PIX_FMT_GRAY8; ++ break; ++ ++ default: ++ avctx->pix_fmt = AV_PIX_FMT_NV12; ++ break; ++ } ++} ++ ++static OMX_BOOL fill_frame_buffer(FTOMXCodecContext *s, AVFrame *pict, uint8_t *buf) { ++ AVCodecContext *avctx = s->avctx; ++ OMX_PARAM_PORTDEFINITIONTYPE *port_def = NULL; ++ uint8_t *src_data[4] = {0}; ++ int src_linesizes[4] = {0}; ++ int stride, slice; ++ int aligned_width = 0; ++ int aligned_height = 0; ++ enum AVCodecID codecid = s->avctx->codec->id; ++ ++ port_def = &s->out_port_params; ++ ++ stride = port_def->format.video.nStride; ++ slice = port_def->format.video.nSliceHeight; ++ aligned_width = stride; ++ aligned_height = slice; ++ ++ src_linesizes[0] = stride; ++ src_data[0] = buf; ++ ++ switch (avctx->pix_fmt) { ++ //1.5x ++ case AV_PIX_FMT_YUV420P: ++ src_linesizes[1] = stride / 2; ++ src_linesizes[2] = stride / 2; ++ src_data[1] = buf + stride * slice; ++ src_data[2] = src_data[1] + stride * slice / 4; ++ break; ++ ++ case AV_PIX_FMT_P010LE: ++ case AV_PIX_FMT_P010BE: ++ src_linesizes[1] = stride; ++ src_data[1] = buf + stride * slice; ++ ++ //fix stride; ++ aligned_width = stride / 2; ++ break; ++ ++ ++ //3x, nv12, 10bit ++ case AV_PIX_FMT_P016LE: ++ case AV_PIX_FMT_P016BE: ++ src_linesizes[1] = stride; ++ src_data[1] = buf + stride * slice; ++ ++ //fix stride; ++ aligned_width = stride / 2; ++ break; ++ ++ //2x ++ case AV_PIX_FMT_YUV422P: ++ src_linesizes[1] = stride / 2; ++ src_linesizes[2] = stride / 2; ++ src_data[1] = buf + stride * slice; ++ src_data[2] = src_data[1] + stride * slice / 2; ++ break; ++ ++ //2x ++ case AV_PIX_FMT_YUYV422: ++ case AV_PIX_FMT_UYVY422: ++ src_linesizes[0] = stride * 2; ++ break; ++ ++ //2x, YUV422, UV order ++ case AV_PIX_FMT_NV16: ++ src_linesizes[1] = stride; ++ src_data[1] = buf + stride * slice; ++ break; ++ ++ //4x, YUV422, nv20, 10bit ++ case AV_PIX_FMT_NV20BE: ++ case AV_PIX_FMT_NV20LE: ++ src_linesizes[1] = stride; ++ src_data[1] = buf + stride * slice; ++ //convert to NV20 ++ { ++ unsigned short *ptr = (unsigned short *)src_data[0]; ++ unsigned short *end = (unsigned short *)(buf + stride * slice * 2); ++ while (ptr < end) { ++ *ptr = (*ptr) >> 6; ++ ptr++; ++ } ++ } ++ ++ //fix stride; ++ aligned_width = stride / 2; ++ break; ++ ++#if 0 //not support ++ //3x, YUV444 ++ case AV_PIX_FMT_NV24: ++ case AV_PIX_FMT_NV42: ++ src_linesizes[1] = stride * 2; ++ src_data[1] = buf + stride * slice; ++ break; ++#endif ++ ++ case AV_PIX_FMT_GRAY8: ++ break; ++ ++ //1.5x ++ case AV_PIX_FMT_NV12: ++ case AV_PIX_FMT_NV21: ++ default: ++ src_linesizes[1] = stride; ++ src_data[1] = buf + stride * slice; ++ break; ++ } ++ ++ pict->format = avctx->pix_fmt; ++ if (!avctx->width) { ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ avctx->width = port_def->format.video.nFrameWidth; //display size ++ } else { ++ avctx->width = port_def->format.image.nFrameWidth; //display size ++ } ++ } ++ if (!avctx->height) { ++ if (AV_CODEC_ID_JPEG2000 != codecid) { ++ avctx->height = port_def->format.video.nFrameHeight; ++ } else { ++ avctx->height = port_def->format.image.nFrameHeight; ++ } ++ } ++ //不能使用width和height,否则get_buffer获取的buffer大小不对 ++ pict->width = aligned_width; ++ pict->height = aligned_height; ++ avctx->coded_width = aligned_width; ++ avctx->coded_height = aligned_height; ++ ++ if (ff_get_buffer(avctx, pict, 0) < 0) { ++ av_log(s->avctx, AV_LOG_ERROR, "get_buffer failed\n"); ++ goto DONE; ++ } ++ ++ /* 修正 */ ++ pict->width = avctx->width; ++ pict->height = avctx->height; ++ ++ av_image_copy(pict->data, pict->linesize, (const uint8_t**)&src_data, src_linesizes, avctx->pix_fmt, aligned_width, aligned_height); ++ ++ return OMX_TRUE; ++ ++DONE: ++ return OMX_FALSE; ++} ++ ++static void ftomx_reconfig_outport(FTOMXCodecContext *s) { ++ AVCodecContext *avctx = s->avctx; ++ OMX_ERRORTYPE err = OMX_ErrorNone; ++ OMX_BUFFERHEADERTYPE* out_buffer = NULL; ++ int i = 0; ++ ++ ft_omx_get_port_definition(s, s->out_port, &s->out_port_params); ++ s->num_out_buffers = s->out_port_params.nBufferCountActual; ++ ++ update_color_format(avctx, s->out_port_params.format.video.eColorFormat); ++ ++ if (!s->out_port_params.bEnabled) { ++ s->num_done_out_buffers = 0; ++ ++ if (!s->out_buffer_headers) { ++ s->out_buffer_headers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_out_buffers); ++ } ++ if (!s->done_out_buffers) { ++ s->done_out_buffers = av_mallocz(sizeof(OMX_BUFFERHEADERTYPE*) * s->num_out_buffers); ++ } ++ ++ //startup output port ++ ft_omx_switch_port(s, s->out_port, OMX_TRUE, OMX_FALSE); ++ ++ for (i = 0; i < s->num_out_buffers && err == OMX_ErrorNone; i++) { ++ err = OMX_AllocateBuffer(s->handle, &s->out_buffer_headers[i], s->out_port, NULL, s->out_port_params.nBufferSize); ++ } ++ //CHECK(err); ++ wait_for_port_onoff(s, s->out_port, OMX_TRUE); ++ ++ //OMX_SendCommand(s->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL); ++ //wait_for_state(s, OMX_StateExecuting); ++ ++ for (i = 0; i < s->num_out_buffers && err == OMX_ErrorNone; i++) { ++ err = OMX_FillThisBuffer(s->handle, s->out_buffer_headers[i]); ++ } ++ ++ if (err != OMX_ErrorNone) { ++ for (; i < s->num_out_buffers; i++) ++ s->done_out_buffers[s->num_done_out_buffers++] = s->out_buffer_headers[i]; ++ } ++ ft_omx_get_port_definition(s, s->out_port, &s->out_port_params); ++ } else { ++ ft_omx_port_flush(s, s->out_port, OMX_TRUE); ++ ++ av_log(avctx, AV_LOG_DEBUG, "reconfig: %d out buffer received\n", s->num_done_out_buffers); ++ ++ for (i = 0; i < s->num_out_buffers; i++) { ++ out_buffer = get_buffer(&s->output_mutex, &s->output_cond, ++ &s->num_done_out_buffers, s->done_out_buffers, 1); ++ if (out_buffer->nFlags & OMX_BUFFERFLAG_EOS) { ++ av_log(avctx, AV_LOG_DEBUG, "receive eos when reconfig\n"); ++ } ++ ftomx_reset_buffer(out_buffer); ++ OMX_FillThisBuffer(s->handle, out_buffer); ++ } ++ } ++ ++ s->started = OMX_TRUE; ++ s->got_eos = OMX_FALSE; //replay, reset got_eos ++ av_log(s->avctx, AV_LOG_DEBUG, "reconfig outport finish\n"); ++} ++ ++static int ftomx_decode_frame(AVCodecContext *avctx, void *data, ++ int *got_frame, AVPacket *avpkt) ++{ ++ FTOMXCodecContext *s = avctx->priv_data; ++ OMX_BUFFERHEADERTYPE* buffer = NULL; ++ OMX_BUFFERHEADERTYPE* out_buffer = NULL; ++ OMX_ERRORTYPE err; ++ AVFrame *pict = data; ++ int new_extradata_size; ++ uint8_t *new_extradata; ++ int ret = 0; ++ ++ if (avpkt && avpkt->size && !s->eos_sent) { ++ const uint8_t *buf = avpkt->data; ++ int buf_size = avpkt->size; ++ int64_t pts; ++ int offset = 0; ++ int wait = 0; ++ ++ av_log(avctx, AV_LOG_TRACE, "receive pkt pts:0x%lx, is_key:%d\n", avpkt->pts, avpkt->flags & AV_PKT_FLAG_KEY); ++ ++ //global extradata ++ if (!s->extradata_decoded) { ++ if (avctx->extradata && (avctx->extradata_size > 0)) { ++ buffer = get_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, 1); ++ ++ if (buffer) { ++ av_assert0(avctx->extradata_size <= buffer->nAllocLen); ++ ++ buffer->nFlags |= OMX_BUFFERFLAG_CODECCONFIG; ++ buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; ++ buffer->nFilledLen = avctx->extradata_size; ++ memcpy(buffer->pBuffer + buffer->nOffset, avctx->extradata, avctx->extradata_size); ++ ++ err = OMX_EmptyThisBuffer(s->handle, buffer); ++ if (err != OMX_ErrorNone) { ++ append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer); ++ av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ } ++ s->extradata_decoded = OMX_TRUE; ++ } ++ ++ new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, ++ &new_extradata_size); ++ ++ while (offset < buf_size) { ++ pts = avpkt->pts; ++ wait = 0; ++ ++ //handle pkt side data ++ if (new_extradata && new_extradata_size > 0) { ++ buffer = get_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, 0); ++ ++ if (buffer) { ++ av_assert0(new_extradata_size <= buffer->nAllocLen); ++ ++ buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; ++ buffer->nFilledLen = new_extradata_size; ++ memcpy(buffer->pBuffer + buffer->nOffset, new_extradata, new_extradata_size); ++ ++ err = OMX_EmptyThisBuffer(s->handle, buffer); ++ if (err != OMX_ErrorNone) { ++ append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer); ++ av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err); ++ return AVERROR_UNKNOWN; ++ } ++ new_extradata = NULL; ++ new_extradata_size = 0; ++ } ++ } ++ ++ if (!new_extradata) { ++ buffer = get_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, 0); ++ } ++ ++ if (buffer) { ++ if (buffer->nAllocLen - buffer->nOffset <= 0) { ++ OMX_EmptyThisBuffer(s->handle, buffer); ++ ++ av_log(avctx, AV_LOG_ERROR, "no enough buffer\n"); ++ return AVERROR(EAGAIN); ++ } ++ ++ if ((0 == offset) && (avpkt->flags & AV_PKT_FLAG_KEY)) { ++ buffer->nFlags |= OMX_BUFFERFLAG_SYNCFRAME; ++ } ++ ++ buffer->nFilledLen = MIN(buf_size - offset, buffer->nAllocLen - buffer->nOffset); ++ memcpy(buffer->pBuffer + buffer->nOffset, buf + offset, buffer->nFilledLen); ++ ++ offset += buffer->nFilledLen; ++ ++ // Convert the timestamps to microseconds; some encoders can ignore ++ // the framerate and do VFR bit allocation based on timestamps. ++ buffer->nTimeStamp = to_omx_ticks(pts); ++ if ((pts != AV_NOPTS_VALUE) && (pts > s->last_timestamp)) { ++ s->last_timestamp = pts; ++ } ++ ++ if (offset == buf_size) { ++ s->req_num++; ++ buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; ++ ++ av_log(avctx, AV_LOG_TRACE, "req:%ld, pts:%ld\n", s->req_num, pts); ++ } ++ ++ err = OMX_EmptyThisBuffer(s->handle, buffer); ++ if (err != OMX_ErrorNone) { ++ append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer); ++ av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ ++ /* reconfig output port */ ++ if (!s->started && (!buffer || s->configed)) { ++ wait_port_configed(s); ++ ftomx_reconfig_outport(s); ++ } ++ ++ //handle decoded buffer, then release input buffer to fill cur packet ++ if (!*got_frame && s->started) { ++ wait = 1; ++ if (buffer) { ++ wait = 0; ++ } ++retry: ++ out_buffer = get_buffer(&s->output_mutex, &s->output_cond, ++ &s->num_done_out_buffers, s->done_out_buffers, wait); ++ if (out_buffer) { ++ if (out_buffer->nFlags & OMX_BUFFERFLAG_EOS) { ++ s->got_eos = OMX_TRUE; ++ av_log(avctx, AV_LOG_ERROR, "unexpected EOS flag received\n"); ++ ++ ftomx_reset_buffer(out_buffer); ++ err = OMX_FillThisBuffer(s->handle, out_buffer); ++ ret = AVERROR(EAGAIN); ++ goto DONE; ++ } else if (!out_buffer->nFilledLen) { ++ av_log(avctx, AV_LOG_ERROR, "empty outbuf:0x%lx\n", (long int)out_buffer); ++ ++ ftomx_reset_buffer(out_buffer); ++ err = OMX_FillThisBuffer(s->handle, out_buffer); ++ goto retry; ++ } else { ++ *got_frame = ftomx_recv_new_pict(s, pict, out_buffer); ++ if (!*got_frame) { ++ goto DONE; ++ } ++ } ++ } ++ } ++ } ++ ++ if (!*got_frame) { ++ ret = AVERROR(EAGAIN); ++ } ++ goto DONE; ++ } ++ ++ if (!s->started) { ++ //invalid pkg ++ if (s->got_eos) { ++ ret = AVERROR_EOF; ++ } else { ++ ret = AVERROR(EAGAIN); ++ } ++ goto DONE; ++ } ++ ++ /* send eof */ ++ if (!s->eos_sent) { ++ buffer = get_buffer(&s->input_mutex, &s->input_cond, ++ &s->num_free_in_buffers, s->free_in_buffers, 1); ++ ++ buffer->nFilledLen = 0; ++ buffer->nFlags = OMX_BUFFERFLAG_EOS; ++ buffer->pAppPrivate = s; ++ err = OMX_EmptyThisBuffer(s->handle, buffer); ++ if (err != OMX_ErrorNone) { ++ append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, 0); ++ av_log(avctx, AV_LOG_ERROR, "OMX_EmptyThisBuffer failed: %x\n", err); ++ return AVERROR_UNKNOWN; ++ } ++ s->eos_sent = OMX_TRUE; ++ av_log(avctx, AV_LOG_INFO, "sent eos\n"); ++ } ++ ++ while (!s->got_eos) { ++ out_buffer = get_buffer(&s->output_mutex, &s->output_cond, ++ &s->num_done_out_buffers, s->done_out_buffers, !s->got_eos); ++ ++ if (!out_buffer) { ++ av_log(avctx, AV_LOG_ERROR, "get buffer failed after eos\n"); ++ break; ++ } ++ ++ if (out_buffer->nFlags & OMX_BUFFERFLAG_EOS) { ++ av_log(avctx, AV_LOG_INFO, "receive eos\n"); ++ ftomx_reset_buffer(out_buffer); ++ err = OMX_FillThisBuffer(s->handle, out_buffer); ++ s->got_eos = OMX_TRUE; ++ break; ++ } ++ ++ if (out_buffer->nFilledLen > 0) { ++ *got_frame = ftomx_recv_new_pict(s, pict, out_buffer); ++ if (!*got_frame) { ++ s->got_eos = OMX_TRUE; ++ s->started = OMX_FALSE; ++ s->eos_sent = OMX_FALSE; ++ ret = AVERROR_EOF; ++ } ++ goto DONE; ++ } else { ++ s->got_eos = OMX_TRUE; ++ av_log(avctx, AV_LOG_INFO, "empty out buffer: 0x%lx\n", (long int)out_buffer); ++ ftomx_reset_buffer(out_buffer); ++ err = OMX_FillThisBuffer(s->handle, out_buffer); ++ break; ++ } ++ } ++ ++ if (!s->got_eos) { ++ wait_eos_event(s); ++ } ++ ++ s->started = OMX_FALSE; ++ s->eos_sent = OMX_FALSE; ++ ++ s->extradata_decoded = OMX_FALSE; ++ ++ ret = AVERROR_EOF; ++ av_log(avctx, AV_LOG_INFO, "Stream finish\n"); ++DONE: ++ return ret; ++} ++ ++static av_cold int ftomx_decodec_end(AVCodecContext *avctx) ++{ ++ FTOMXCodecContext *s = avctx->priv_data; ++ cleanup(s); ++ memset(s, 0, sizeof(*s)); ++ ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(FTOMXCodecContext, x) ++static const AVOption options[] = { ++ { "omx_libname", "OpenMAX library name", OFFSET(libname), AV_OPT_TYPE_STRING, { 0 }, 0, 0, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM }, ++ { NULL } ++}; ++ ++static const enum AVPixelFormat ftomx_decoder_pix_fmts[] = { ++ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NV12, AV_PIX_FMT_NV16, AV_PIX_FMT_NV20LE, AV_PIX_FMT_NONE ++}; ++ ++#define FTOMXDEC(NAME, LONGNAME, CODEC, bsf_name) \ ++static const AVClass ftomx_ ## NAME ## _dec_class = {\ ++ .class_name = #NAME "_ftomx_decoder",\ ++ .item_name = av_default_item_name,\ ++ .option = options,\ ++ .version = LIBAVUTIL_VERSION_INT,\ ++};\ ++\ ++AVCodec ff_ ## NAME ## _ftomx_decoder = { \ ++ .name = #NAME "ftomx" ,\ ++ .long_name = NULL_IF_CONFIG_SMALL("ft omx " LONGNAME " decoder wrapper"),\ ++ .type = AVMEDIA_TYPE_VIDEO,\ ++ .id = CODEC ,\ ++ .priv_data_size = sizeof(FTOMXCodecContext),\ ++ .priv_class = &ftomx_ ## NAME ## _dec_class,\ ++ .pix_fmts = (enum AVPixelFormat*)&ftomx_decoder_pix_fmts, \ ++ .init = ftomx_decode_init,\ ++ .decode = ftomx_decode_frame,\ ++ .flush = ftomx_flush, \ ++ .close = ftomx_decodec_end,\ ++ .bsfs = bsf_name, \ ++ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, \ ++ /*.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING,*/ \ ++ .wrapper_name = "ftomx", \ ++}; ++ ++FTOMXDEC(h263, "H.263", AV_CODEC_ID_H263, NULL); ++FTOMXDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb"); ++FTOMXDEC(hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb"); ++FTOMXDEC(mpeg2, "MPEG2", AV_CODEC_ID_MPEG2VIDEO, NULL); ++FTOMXDEC(mpeg4, "MPEG4", AV_CODEC_ID_MPEG4, NULL); ++FTOMXDEC(vc1 , "VC1", AV_CODEC_ID_VC1, NULL); ++FTOMXDEC(vp6, "VP6", AV_CODEC_ID_VP6, NULL); ++FTOMXDEC(vp8, "VP8", AV_CODEC_ID_VP8, NULL); ++FTOMXDEC(cavs, "CAVS", AV_CODEC_ID_CAVS, NULL); ++//FTOMXDEC(jpeg, "JPEG", AV_CODEC_ID_JPEG2000, NULL); ++//FTOMXDEC(mjpeg, "MJPEG", AV_CODEC_ID_MJPEG, NULL); ++FTOMXDEC(rv30, "RV30", AV_CODEC_ID_RV30, NULL); ++FTOMXDEC(rv40, "RV40", AV_CODEC_ID_RV40, NULL); ++FTOMXDEC(flv, "FLV", AV_CODEC_ID_FLV1, NULL); +-- +2.25.1 + diff --git a/package/ffmpeg/0001-swscale-x86-yuv2rgb-Fix-build-without-SSSE3.patch b/package/ffmpeg/0001-swscale-x86-yuv2rgb-Fix-build-without-SSSE3.patch deleted file mode 100644 index 951ce418..00000000 --- a/package/ffmpeg/0001-swscale-x86-yuv2rgb-Fix-build-without-SSSE3.patch +++ /dev/null @@ -1,43 +0,0 @@ -From bf8eae2d30a205bb76ac625e04c0351106981b9e Mon Sep 17 00:00:00 2001 -From: Parker Ernest <@> -Date: Sun, 23 Feb 2020 13:22:42 +0100 -Subject: [PATCH] swscale/x86/yuv2rgb: Fix build without SSSE3 - -commit fc6a5883d6af8cae0e96af84dda0ad74b360a084 breaks build on -x86_64 CPUs which do not have SSSE3, e.g. AMD Phenom-II - -Signed-off-by: Michael Niedermayer -[bernd.kuhls@t-online.de: - - retrieved from upstream patchwork: - https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200223122256.23402-1-michael@niedermayer.cc/ -] -Signed-off-by: Bernd Kuhls -[yann.morin.1998@free.fr: fix reference top patchwork and SoB order] -Signed-off-by: Yann E. MORIN ---- - libswscale/x86/yuv2rgb.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c -index c12e88cbb5..4791e5b93a 100644 ---- a/libswscale/x86/yuv2rgb.c -+++ b/libswscale/x86/yuv2rgb.c -@@ -83,6 +83,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) - #if HAVE_X86ASM - int cpu_flags = av_get_cpu_flags(); - -+#if HAVE_SSSE3 - if (EXTERNAL_SSSE3(cpu_flags)) { - switch (c->dstFormat) { - case AV_PIX_FMT_RGB32: -@@ -111,6 +112,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) - return yuv420_rgb15_ssse3; - } - } -+#endif - - if (EXTERNAL_MMXEXT(cpu_flags)) { - switch (c->dstFormat) { --- -2.26.2 - diff --git a/package/ffmpeg/0002-avcodec-vaapi_h264-skip-decode-if-pic-has-no-slices.patch b/package/ffmpeg/0002-avcodec-vaapi_h264-skip-decode-if-pic-has-no-slices.patch deleted file mode 100644 index 2892df9d..00000000 --- a/package/ffmpeg/0002-avcodec-vaapi_h264-skip-decode-if-pic-has-no-slices.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 2c6b3f357331e203ad87214984661c40704aceb7 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 26 Jan 2019 19:48:35 +0100 -Subject: [PATCH] avcodec/vaapi_h264: skip decode if pic has no slices - -This fixes / workarounds https://bugs.freedesktop.org/show_bug.cgi?id=105368. -It was hit frequently when watching h264 channels received via DVB-X. -Corresponding kodi bug: https://github.com/xbmc/xbmc/issues/15704 - -Downloaded from Kodi ffmpeg repo: -https://github.com/xbmc/FFmpeg/commit/2c6b3f357331e203ad87214984661c40704aceb7 - -Patch was sent upstream: -http://ffmpeg.org/pipermail/ffmpeg-devel/2019-March/240863.html - -Signed-off-by: Bernd Kuhls ---- - libavcodec/vaapi_h264.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c -index dd2a6571604..e521a05c4ff 100644 ---- a/libavcodec/vaapi_h264.c -+++ b/libavcodec/vaapi_h264.c -@@ -314,6 +314,11 @@ static int vaapi_h264_end_frame(AVCodecContext *avctx) - H264SliceContext *sl = &h->slice_ctx[0]; - int ret; - -+ if (pic->nb_slices == 0) { -+ ret = AVERROR_INVALIDDATA; -+ goto finish; -+ } -+ - ret = ff_vaapi_decode_issue(avctx, pic); - if (ret < 0) - goto finish; diff --git a/package/ffmpeg/0003-libavutil-Fix-mips-build.patch b/package/ffmpeg/0003-libavutil-Fix-mips-build.patch deleted file mode 100644 index 8b81e669..00000000 --- a/package/ffmpeg/0003-libavutil-Fix-mips-build.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6e8daf0d502a2a822f1f08f42368d7d676dc1a9e Mon Sep 17 00:00:00 2001 -From: Bernd Kuhls -Date: Sun, 6 Jun 2021 08:54:53 +0200 -Subject: [PATCH] libavutil: Fix mips build - -Check for sys/auxv.h because not all toolchains contain this header. - -Fixes https://trac.ffmpeg.org/ticket/9138 - -Patch sent upstream: -http://ffmpeg.org/pipermail/ffmpeg-devel/2021-June/281272.html - -Signed-off-by: Bernd Kuhls ---- - configure | 2 ++ - libavutil/mips/cpu.c | 6 +++--- - 2 files changed, 5 insertions(+), 3 deletions(-) - -diff --git a/configure b/configure -index 6bfd98b384..773a7d516c 100755 ---- a/configure -+++ b/configure -@@ -2161,6 +2161,7 @@ HEADERS_LIST=" - opencv2_core_core_c_h - OpenGL_gl3_h - poll_h -+ sys_auxv_h - sys_param_h - sys_resource_h - sys_select_h -@@ -6218,6 +6219,7 @@ check_func_headers VideoToolbox/VTCompressionSession.h VTCompressionSessionPrepa - check_headers windows.h - check_headers X11/extensions/XvMClib.h - check_headers asm/types.h -+check_headers sys/auxv.h - - # it seems there are versions of clang in some distros that try to use the - # gcc headers, which explodes for stdatomic -diff --git a/libavutil/mips/cpu.c b/libavutil/mips/cpu.c -index 59619d54de..19196de50b 100644 ---- a/libavutil/mips/cpu.c -+++ b/libavutil/mips/cpu.c -@@ -19,7 +19,7 @@ - #include "libavutil/cpu.h" - #include "libavutil/cpu_internal.h" - #include "config.h" --#if defined __linux__ || defined __ANDROID__ -+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H - #include - #include - #include -@@ -28,7 +28,7 @@ - #include "libavutil/avstring.h" - #endif - --#if defined __linux__ || defined __ANDROID__ -+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H - - #define HWCAP_LOONGSON_CPUCFG (1 << 14) - -@@ -105,7 +105,7 @@ static int cpu_flags_cpuinfo(void) - - int ff_get_cpu_flags_mips(void) - { --#if defined __linux__ || defined __ANDROID__ -+#if (defined __linux__ || defined __ANDROID__) && HAVE_SYS_AUXV_H - if (cpucfg_available()) - return cpu_flags_cpucfg(); - else --- -2.29.2 - diff --git a/package/ffmpeg/0004-configure-add-extralibs-to-extralibs_xxx.patch b/package/ffmpeg/0004-configure-add-extralibs-to-extralibs_xxx.patch deleted file mode 100644 index dbc19c1c..00000000 --- a/package/ffmpeg/0004-configure-add-extralibs-to-extralibs_xxx.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0c288853630b7b4e004774c39945d4a804afcfa8 Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine -Date: Fri, 6 Aug 2021 09:17:20 +0200 -Subject: [PATCH] configure: add extralibs to extralibs_xxx - -Add extralibs to extralibs_xxx (e.g. extralibs_avformat) to allow -applications such as motion to retrieve ffmpeg dependencies such as --latomic through pkg-config - -Signed-off-by: Fabrice Fontaine -[Upstream status: not upstreamable] ---- - configure | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - -diff --git a/configure b/configure -index 0bb3a7cf2b..3bda99e415 100755 ---- a/configure -+++ b/configure -@@ -7602,15 +7602,15 @@ rpath=$(enabled rpath && echo "-Wl,-rpath,\${libdir}") - source_path=${source_path} - LIBPREF=${LIBPREF} - LIBSUF=${LIBSUF} --extralibs_avutil="$avutil_extralibs" --extralibs_avcodec="$avcodec_extralibs" --extralibs_avformat="$avformat_extralibs" --extralibs_avdevice="$avdevice_extralibs" --extralibs_avfilter="$avfilter_extralibs" --extralibs_avresample="$avresample_extralibs" --extralibs_postproc="$postproc_extralibs" --extralibs_swscale="$swscale_extralibs" --extralibs_swresample="$swresample_extralibs" -+extralibs_avutil="$avutil_extralibs $extralibs" -+extralibs_avcodec="$avcodec_extralibs $extralibs" -+extralibs_avformat="$avformat_extralibs $extralibs" -+extralibs_avdevice="$avdevice_extralibs $extralibs" -+extralibs_avfilter="$avfilter_extralibs $extralibs" -+extralibs_avresample="$avresample_extralibs $extralibs" -+extralibs_postproc="$postproc_extralibs $extralibs" -+extralibs_swscale="$swscale_extralibs $extralibs" -+extralibs_swresample="$swresample_extralibs $extralibs" - EOF - - for lib in $LIBRARY_LIST; do --- -2.30.2 - diff --git a/package/ffmpeg/Config.in b/package/ffmpeg/Config.in index 2efef7dd..9577d0f6 100644 --- a/package/ffmpeg/Config.in +++ b/package/ffmpeg/Config.in @@ -50,6 +50,7 @@ config BR2_PACKAGE_FFMPEG_FFMPEG config BR2_PACKAGE_FFMPEG_FFPLAY bool "Build ffplay" + default y depends on !BR2_STATIC_LIBS # sdl2 select BR2_PACKAGE_FFMPEG_SWSCALE select BR2_PACKAGE_SDL2 diff --git a/package/ffmpeg/ffmpeg.hash b/package/ffmpeg/ffmpeg.hash index abb397f8..e4c5314d 100644 --- a/package/ffmpeg/ffmpeg.hash +++ b/package/ffmpeg/ffmpeg.hash @@ -1,5 +1,6 @@ # Locally calculated -sha256 eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02 ffmpeg-4.4.1.tar.xz +#sha256 eadbad9e9ab30b25f5520fbfde99fae4a92a1ae3c0257a8d68569a4651e30e02 ffmpeg-4.4.1.tar.xz +sha256 0d5da81feba073ee78e0f18e0966bcaf91464ae75e18e9a0135186249e3d2a0b ffmpeg-4.2.4.tar.xz sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING.GPLv2 sha256 b634ab5640e258563c536e658cad87080553df6f34f62269a21d554844e58bfe COPYING.LGPLv2.1 sha256 cb48bf09a11f5fb576cddb0431c8f5ed0a60157a9ec942adffc13907cbe083f2 LICENSE.md diff --git a/package/ffmpeg/ffmpeg.mk b/package/ffmpeg/ffmpeg.mk index 5a79faed..3732a550 100644 --- a/package/ffmpeg/ffmpeg.mk +++ b/package/ffmpeg/ffmpeg.mk @@ -4,7 +4,7 @@ # ################################################################################ -FFMPEG_VERSION = 4.4.1 +FFMPEG_VERSION = 4.2.4 FFMPEG_SOURCE = ffmpeg-$(FFMPEG_VERSION).tar.xz FFMPEG_SITE = http://ffmpeg.org/releases FFMPEG_INSTALL_STAGING = YES @@ -34,6 +34,7 @@ FFMPEG_CONF_OPTS = \ --disable-small \ --enable-dct \ --enable-fft \ + --enable-ftomx \ --enable-mdct \ --enable-rdft \ --disable-crystalhd \ @@ -573,4 +574,9 @@ define FFMPEG_REMOVE_EXAMPLE_SRC_FILES endef FFMPEG_POST_INSTALL_TARGET_HOOKS += FFMPEG_REMOVE_EXAMPLE_SRC_FILES +define FFMPEG_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR) + cp $(TARGET_DIR)/usr/lib/libavcodec.so.58.54.100 $(TARGET_DIR)/usr/lib/aarch64-linux-gnu +endef + $(eval $(autotools-package)) diff --git a/package/vpu-lib/Config.in b/package/vpu-lib/Config.in new file mode 100644 index 00000000..d96f38eb --- /dev/null +++ b/package/vpu-lib/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_VPU_LIB + bool "vpu-lib" + help + This is a comment that explains what vpu-lib is. The help text + should be wrapped. + + https://gitee.com/phytium_embedded/vpu-lib.git + +config BR2_PACKAGE_VPU_LIB_CPU_MODEL + string "cpu model" + help + This is a comment that defines cpu model is, d2000 or e2000 diff --git a/package/vpu-lib/vpu-lib.mk b/package/vpu-lib/vpu-lib.mk new file mode 100644 index 00000000..3d3bd31d --- /dev/null +++ b/package/vpu-lib/vpu-lib.mk @@ -0,0 +1,17 @@ +################################################################################ +# +# vpu lib +# +################################################################################ + +VPU_LIB_VERSION = a3109a35b230a57d860bce66d4369a74c56f12a8 +VPU_LIB_SITE = https://gitee.com/phytium_embedded/vpu-lib.git +VPU_LIB_INSTALL_IMAGES = YES +VPU_LIB_SITE_METHOD = git +VPU_LIB_DEPENDENCIES = linux + +define VPU_LIB_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR) CPU_MODEL=$(BR2_PACKAGE_VPU_LIB_CPU_MODEL) +endef + +$(eval $(generic-package))