diff options
author | harinarayan <harinarayan@24075187-2e39-4e88-bbb8-bc8aa768f540> | 2011-10-13 11:06:38 +0000 |
---|---|---|
committer | harinarayan <harinarayan@24075187-2e39-4e88-bbb8-bc8aa768f540> | 2011-10-13 11:06:38 +0000 |
commit | 368b109a9ecc2880444a31290239e7778fe928f5 (patch) | |
tree | 5e683ff6b04c60042e918d3de67804d55b12fe3a | |
parent | a33af7fbd198aec08fbca42becb4e1bbec449aa0 (diff) |
git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@971 24075187-2e39-4e88-bbb8-bc8aa768f540
274 files changed, 49920 insertions, 0 deletions
diff --git a/gstreamer_ti_dm81xx/Makefile b/gstreamer_ti_dm81xx/Makefile new file mode 100644 index 0000000..287084c --- /dev/null +++ b/gstreamer_ti_dm81xx/Makefile @@ -0,0 +1,113 @@ +# Makefile +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# Include common build settings. +#------------------------------------------------------------------------------ +include ./Makefile.common + +#------------------------------------------------------------------------------ +# SUBDIRS +# list of subdirectories to build +# TARGET_DEMO_DIR +# target directory for gstreamer demo scripts +#------------------------------------------------------------------------------ +SUBDIRS = opensource_build ti_build +TARGET_DEMO_DIR = $(TARGET_ROOT_DIR)/opt/gstreamer_demo + +#------------------------------------------------------------------------------ +# Build targets +#------------------------------------------------------------------------------ +.PHONY: $(SUBDIRS) default help all gstreamer_demo + +default: help + +all: +# $(CMD_PREFIX) $(MAKE) opensource_build $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) ti_build $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) gstreamer_demo $(BUILD_INSTALL) + +clean_dev: + @echo "Removing header files....." + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/include + @echo "Removing pkgconfig files....." + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/lib/pkgconfig + @echo "Removing static libraries....." + $(CMD_PREFIX) find $(TARGET_GSTREAMER_DIR) -type f -name "*.a" -exec rm {} \; + $(CMD_PREFIX) find $(TARGET_GSTREAMER_DIR) -type f -name "*.la" -exec rm {} \; + @echo "Stripping executables and shared libraries....." + $(CMD_PREFIX) find $(TARGET_GSTREAMER_DIR) -type f -exec $(MVTOOL_PREFIX)strip {} \; > /dev/null 2>&1 + +clean_docs: + @echo "Removing docs....." + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/share/man + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/share/doc + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/share/gtk-doc + $(CMD_PREFIX) rm -rf $(TARGET_GSTREAMER_DIR)/share/info + +$(SUBDIRS): + @echo Building $@ + $(CMD_PREFIX) $(MAKE) $(MAKE_VERBOSE) -C $@ all $(BUILD_INSTALL) VERBOSE=$(VERBOSE) + +gstreamer_demo: + @echo copying gstreamer_demo directory to target + $(CMD_PREFIX) install -d ./gstreamer_demo $(TARGET_DEMO_DIR) + $(CMD_PREFIX) install -d ./gstreamer_demo/$(GST_TI_PLATFORM) $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM) + $(CMD_PREFIX) install ./gstreamer_demo/$(GST_TI_PLATFORM)/* $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM) + + @echo copying relevant kernel modules + $(CMD_PREFIX) if [ -d $(DVSDK_INSTALL_DIR)/kernel_binaries/$(PLATFORM) ]; then \ + install $(DVSDK_INSTALL_DIR)/kernel_binaries/$(PLATFORM)/* $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM); \ + fi + + @echo copying mapdmaq if platform needs it + $(CMD_PREFIX) if [ $(GST_TI_PLATFORM) = "dm355" ]; then \ + install $(DVSDK_INSTALL_DIR)/mapdmaq/mapdmaq $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM); \ + fi + + @echo copying mapdmaq-hd if platform needs it + $(CMD_PREFIX) if [ $(GST_TI_PLATFORM) = "dm6467" ]; then \ + install $(DVSDK_INSTALL_DIR)/mapdmaq-hd/mapdmaq-hd $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM); \ + fi + + @echo copying codec combos if platform needs it + $(CMD_PREFIX) for file in `find $(CODEC_INSTALL_DIR) -name "*.x64P"`; do \ + install $${file} $(TARGET_DEMO_DIR)/$(GST_TI_PLATFORM); \ + done + +install: + +#------------------------------------------------------------------------------ +# clean: clean up everything +#------------------------------------------------------------------------------ +CLEAN_SUBDIRS = $(addsuffix .clean, $(SUBDIRS)) +.PHONY: clean $(CLEAN_SUBDIRS) +clean: $(CLEAN_SUBDIRS) +$(CLEAN_SUBDIRS): + @echo "***** Cleaning $(basename $@)" + $(CMD_PREFIX) make -C $(basename $@) clean + +#------------------------------------------------------------------------------ +# help: build target for help screen +#------------------------------------------------------------------------------ +.PHONY: help +help: + @echo + @echo "Make usage for all components:" + @echo + @echo " Build only:" + @echo " make all" + @echo " Build and install:" + @echo " make all install" + @echo + diff --git a/gstreamer_ti_dm81xx/Makefile.common b/gstreamer_ti_dm81xx/Makefile.common new file mode 100755 index 0000000..509f5fe --- /dev/null +++ b/gstreamer_ti_dm81xx/Makefile.common @@ -0,0 +1,438 @@ +# Makefile.common +# +# Specifies common settings for all build scripts. +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# User specified paths: +# EZSDK_INSTALL_DIR +# location of EZSDK installation directory; settings from the DVSDK's +# Rules.make will be used for the build. +# TARGET_ROOT_DIR +# root directory of target filesystem on host machine +# GSTREAMER_DIR +# location of gstreamer installation on target filesystem. This setting +# should assume that "/" is the root file system of the target, not the +# host. +# CROSS_COMPILER +# Cross compiler being used. A default is chosen based on the platform +# you are building for, but you can set it explicitly to one of these +# values: +# MVL_5_0: MontaVista v5.0 +# CS_2008Q1: CodeSourcery v2008q1 +# CS_2009Q1: CodeSourcery v2009q1 +# GST_TI_PLATFORM +# In most cases this variable will be automatically set to be the same +# as the PLATFORM variable in the Rules.make for the DVSDK. Currently +# the only time it must be set here is when building for dm6467 or +# dm6467t. +# +# These paths must be specified or the build will fail. +#------------------------------------------------------------------------------ +TARGET_ROOT_DIR = /proj/NEE/hari/prashant_gstreamer/target +GSTREAMER_DIR = /opt/gstreamer +GST_TI_PLATFORM = dm814x +EZSDK_INSTALL_DIR = /proj/NEE/hari/ti-ezsdk_dm814x-evm_5_02_01_59 +#------------------------------------------------------------------------------ +# Build configuration: +# +# VERBOSE +# Set to "true" to see all build commands. +#------------------------------------------------------------------------------ +VERBOSE = true + +#------------------------------------------------------------------------------ +# Pull in build settings from the DVSDK, and error-check the settings we get. +#------------------------------------------------------------------------------ +ifndef EZSDK_INSTALL_DIR + $(error EZSDK_INSTALL_DIR must be set in Makefile before building) +endif + +include $(EZSDK_INSTALL_DIR)/Rules.make + +# Set GST_TI_PLATFORM from the DVSDK's variable if it hasn't been set already +ifndef GST_TI_PLATFORM +$(error when building for dm816x or dm814x, the platform type must be specified explicity at the top of Makefile.commom with GST_TI_PLATFORM=dm814x or GST_TI_PLATFORM=dm816x) +endif + +# DVSDK 1.30 doesn't include DMAI, so make sure it gets added to the Rules.make +ifneq ($(GST_TI_PLATFORM), dm816x) +ifneq ($(GST_TI_PLATFORM), dm814x) + $(error the platform type must be specified explicity at the top of Makefile.commom with GST_TI_PLATFORM=dm814x or GST_TI_PLATFORM=dm816x) +endif +endif + +# Ensure the target root directory is set. +ifndef TARGET_ROOT_DIR + $(error TARGET_ROOT_DIR must be set in Makefile before building) +endif + +# Export Rules.make variables so they are visible to the sub-makes +export BIOS_INSTALL_DIR +export CE_INSTALL_DIR +export CMEM_INSTALL_DIR +export CODEC_INSTALL_DIR +export DMAI_INSTALL_DIR +export FC_INSTALL_DIR +export LINK_INSTALL_DIR +export LINK_XDC_ROOT = $(LINK_INSTALL_DIR)/packages +export LINUXLIBS_INSTALL_DIR +export LINUXKERNEL_INSTALL_DIR +export LPM_INSTALL_DIR +export MVTOOL_DIR +export MVTOOL_PREFIX +export GST_TI_PLATFORM +export XDAIS_INSTALL_DIR +export XDC_INSTALL_DIR +export EDMA3_LLD_INSTALL_DIR +export USER_XDC_PATH +export LINUX_DEVKIT_DIR +export UIA_INSTALL_DIR + +#------------------------------------------------------------------------------ +# Location of gstreamer installation on target +#------------------------------------------------------------------------------ +TARGET_GSTREAMER_DIR = $(TARGET_ROOT_DIR)/$(GSTREAMER_DIR) + +#------------------------------------------------------------------------------ +# Set a default cross compiler if one has not been specified +#------------------------------------------------------------------------------ +ifndef CROSS_COMPILER + ifeq ($(GST_TI_PLATFORM), dm355) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm6446) + CROSS_COMPILER=MVL_5_0 + endif + ifeq ($(GST_TI_PLATFORM), dm6467) + CROSS_COMPILER=MVL_5_0 + endif + ifeq ($(GST_TI_PLATFORM), dm6467t) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm365) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm368) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), omap3530) + CROSS_COMPILER=CS_2008Q1 + endif + ifeq ($(GST_TI_PLATFORM), omapl138) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm3730) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm816x) + CROSS_COMPILER=CS_2009Q1 + endif + ifeq ($(GST_TI_PLATFORM), dm814x) + CROSS_COMPILER=CS_2009Q1 + endif +endif + +#------------------------------------------------------------------------------ +# Set the CROSS_COMPILE_PREFIX variable, this is used by libtool while linking +# the cross compiled libraries on MV platform +#------------------------------------------------------------------------------ +# NOTE: If you're using the MontaVista toolchain, CROSS_COMPILE_PREFIX must be +# the location of the filesystem within the MontaVista directory, not +# your custom filesystem. MontaVista will sometimes fail to link +# libraries such as -lpthread correctly if you specify a target +# filesystem in a different location. +#------------------------------------------------------------------------------ +export CROSS_COMPILE_PREFIX = $(TARGET_ROOT_DIR) + +ifeq ($(CROSS_COMPILER), MVL_5_0) + export CROSS_COMPILE_PREFIX = $(MVLTOOL_DIR)/target +endif + + +#------------------------------------------------------------------------------ +# Set XDC target and platform based on PLATFORM variable +#------------------------------------------------------------------------------ +ifeq ($(GST_TI_PLATFORM), dm355) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmDM355 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) +endif + +ifeq ($(GST_TI_PLATFORM), dm6446) + export XDC_TARGET = gnu.targets.MVArm9 + export XDC_PLATFORM = ti.platforms.evmDM6446 +endif + +ifeq ($(GST_TI_PLATFORM), dm365) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmDM365 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LIBTOOL_SYSROOT_PATH = $(LINUXLIBS_INSTALL_DIR)/.. + export ENABLE_TIDISPLAYSINK2 = true +endif + +ifeq ($(GST_TI_PLATFORM), dm368) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmDM365 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LIBTOOL_SYSROOT_PATH = $(LINUXLIBS_INSTALL_DIR)/.. + export ENABLE_TIDISPLAYSINK2 = true +endif + +ifeq ($(GST_TI_PLATFORM), dm6467) + export XDC_TARGET = gnu.targets.MVArm9 + export XDC_PLATFORM = ti.platforms.evmDM6467 +endif + +ifeq ($(GST_TI_PLATFORM), dm6467t) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmDM6467 + export LINK_XDC_ROOT = $(LINK_INSTALL_DIR) + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) +endif + +ifeq ($(GST_TI_PLATFORM), omap3530) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evm3530 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LINK_XDC_ROOT = $(LINK_INSTALL_DIR) + export C6ACCEL_INSTALL_DIR + export ENABLE_C6ACCEL = true + export C6ACCEL_PLATFORM = $(GST_TI_PLATFORM) + export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/.. + export ENABLE_TIDISPLAYSINK2 = true +endif + +ifeq ($(GST_TI_PLATFORM), dm3730) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evm3530 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LINK_XDC_ROOT = $(LINK_INSTALL_DIR) + export C6ACCEL_INSTALL_DIR + export ENABLE_C6ACCEL = true + export C6ACCEL_PLATFORM = omap3530 + export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/.. + export ENABLE_TIDISPLAYSINK2 = true +endif + +ifeq ($(GST_TI_PLATFORM), omapl138) + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmOMAPL138 + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LINK_XDC_ROOT = $(LINK_INSTALL_DIR) + export C6ACCEL_INSTALL_DIR + export ENABLE_C6ACCEL = true + export C6ACCEL_PLATFORM = $(GST_TI_PLATFORM) + export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/.. + export ENABLE_TIDISPLAYSINK2 = true +endif + +ifeq ($(GST_TI_PLATFORM), dm816x) + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LINUXLIBS_INSTALL_DIR=$(LINUX_DEVKIT_DIR)/arm-none-linux-gnueabi/usr + export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/.. + export OMX_INSTALL_DIR + export OMX_PLATFORM = ti816x-evm + export SYSBIOS_INSTALL_DIR + export OSAL_INSTALL_DIR + export IPC_INSTALL_DIR + export SYSLINK_INSTALL_DIR + export IVAHD_HDVICP20API_INSTALL_DIR + export TMS470_CODEGEN_INSTALL_DIR + export HDVPSS_INSTALL_DIR + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmTI816X + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export OMTB_INSTALL_DIR + export LINUXUTILS_INSTALL_DIR +endif + +ifeq ($(GST_TI_PLATFORM), dm814x) + export MVTOOL_PREFIX = $(CSTOOL_PREFIX) + export MVTOOL_DIR = $(CSTOOL_DIR) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export LINUXLIBS_INSTALL_DIR=$(LINUX_DEVKIT_DIR)/arm-none-linux-gnueabi/usr + export LIBTOOL_SYSROOT_PATH=$(LINUXLIBS_INSTALL_DIR)/.. + export OMX_INSTALL_DIR + export OMX_PLATFORM = ti814x-evm + export SYSBIOS_INSTALL_DIR + export OSAL_INSTALL_DIR + export IPC_INSTALL_DIR + export SYSLINK_INSTALL_DIR + export IVAHD_HDVICP20API_INSTALL_DIR + export TMS470_CODEGEN_INSTALL_DIR + export HDVPSS_INSTALL_DIR + export XDC_TARGET = gnu.targets.arm.GCArmv5T + export XDC_PLATFORM = ti.platforms.evmTI816X + export PLATFORM_XDC = $(XDC_PLATFORM) + export CROSS_COMPILE = $(CSTOOL_PREFIX) + export OMTB_INSTALL_DIR + export LINUXUTILS_INSTALL_DIR +endif + + +#------------------------------------------------------------------------------ +# CPPFLAGS/CFLAGS/LDFLAGS that should be used when building packages. +# +# CPPFLAGS_all - Prerocessor flags used with all platforms +# CPPFLAGS_<platform> - Additional preprocessor flags for <platform> +# +# CFLAGS_all - Compiler flags used with all platforms +# CFLAGS_<platform> - Additional compiler flags for <platform> +# +# LDFLAGS_all - Linker flags used with all platforms +# LDFLAGS_<platform> - Additional linker flags for <platform> +# +# Note on platforms that have "-I$(LINUXKERNEL_INSTALL_DIR)/include": +# +# On MVL-based LSPs we need to include the LSP headers directly +# in order to gain access to custom V4L2 ioctls. This is ok on MVL-based +# platforms, as we know the kernel headers in the PSP are in sync with +# the kernel headers in the gcc toolset. However, it is not safe to do +# this on platforms that use non-MVL PSPs. Fortunately, the new PSPs based +# on the later GIT kernels do not have custom ioctls, so including the PSP +# headers directly is not needed, and the headers that come with gcc should +# be sufficient. +#------------------------------------------------------------------------------ +CPPFLAGS_all = -DPlatform_$(GST_TI_PLATFORM) +CPPFLAGS_all += -I$(TARGET_GSTREAMER_DIR)/include +CPPFLAGS_dm6446 = -DMVL_LSP +CPPFLAGS_dm6446 += -I$(LINUXKERNEL_INSTALL_DIR)/include +CPPFLAGS_dm6467 = -DMVL_LSP +CPPFLAGS_dm6467 += -I$(LINUXKERNEL_INSTALL_DIR)/include +CPPFLAGS_dm355 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm365 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm365 += -I$(LINUXKERNEL_INSTALL_DIR)/include +CPPFLAGS_dm368 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm368 += -I$(LINUXKERNEL_INSTALL_DIR)/include +CPPFLAGS_dm6467t = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_omap3530 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm3730 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_omapl138 = -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm816x = -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/include +CPPFLAGS_dm816x += -I$(LINUXLIBS_INSTALL_DIR)/include +CPPFLAGS_dm814x = -I$(LINUXKERNEL_INSTALL_DIR)/include -I$(LINUXKERNEL_INSTALL_DIR)/arch/arm/include +CPPFLAGS_dm814x += -I$(LINUXLIBS_INSTALL_DIR)/include + +CFLAGS_all = -O2 +CFLAGS_dm355 = -march=armv5te -mtune=arm926ej-s +CFLAGS_dm6446 = -march=armv5te -mtune=arm926ej-s +CFLAGS_dm365 = -march=armv5te -mtune=arm926ej-s +CFLAGS_dm368 = -march=armv5te -mtune=arm926ej-s +CFLAGS_dm6467 = -march=armv5te -mtune=arm926ej-s +CFLAGS_dm6467t = -march=armv5te -mtune=arm926ej-s +CFLAGS_omapl138 = -march=armv5te -mtune=arm926ej-s +CFLAGS_omap3530 = -march=armv7-a -mtune=cortex-a8 +CFLAGS_omap3530 += -mfpu=neon -mfloat-abi=softfp +CFLAGS_dm3730 = -march=armv7-a -mtune=cortex-a8 +CFLAGS_dm3730 += -mfpu=neon -mfloat-abi=softfp +CFLAGS_dm816x = -march=armv7-a -mtune=cortex-a8 +CFLAGS_dm816x += -mfpu=neon -mfloat-abi=softfp +CFLAGS_dm814x = -march=armv7-a -mtune=cortex-a8 +CFLAGS_dm814x += -mfpu=neon -mfloat-abi=softfp + +LDFLAGS_all = -L$(TARGET_GSTREAMER_DIR)/lib +LDFLAGS_dm355 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm365 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm368 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm6467t = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_omap3530 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm3730 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_omapl138 = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm816x = -L$(LINUXLIBS_INSTALL_DIR)/lib +LDFLAGS_dm814x = -L$(LINUXLIBS_INSTALL_DIR)/lib + +#------------------------------------------------------------------------------ +# Enable ALSA support based on the CROSS_COMPILER we're using +#------------------------------------------------------------------------------ +ifeq ($(CROSS_COMPILER), MVL_5_0) + export ALSA_SUPPORT = --enable-alsa +endif +ifeq ($(CROSS_COMPILER), CS_2008Q1) + export ALSA_SUPPORT = --enable-alsa --with-alsa-inc-prefix=$(LINUXLIBS_INSTALL_DIR)/include --with-alsa-prefix=$(LINUXLIBS_INSTALL_DIR)/lib +endif +ifeq ($(CROSS_COMPILER), CS_2009Q1) + export ALSA_SUPPORT = --enable-alsa --with-alsa-inc-prefix=$(LINUXLIBS_INSTALL_DIR)/include --with-alsa-prefix=$(LINUXLIBS_INSTALL_DIR)/lib +endif + +#------------------------------------------------------------------------------ +# Configure amount of output we will generate based on the VERBOSE variable +# setting. +#------------------------------------------------------------------------------ +ifeq ($(VERBOSE), false) + override CMD_PREFIX = @ + override TAR_VERBOSE = + override CONFIGURE_VERBOSE = -q + override PATCH_VERBOSE = -s + override MAKE_VERBOSE = -s +else + override CMD_PREFIX = + override TAR_VERBOSE = v + override CONFIGURE_VERBOSE = + override PATCH_VERBOSE = + override MAKE_VERBOSE = +endif + +#------------------------------------------------------------------------------ +# If the word "install" appears on the command line, we will invoke sub-make +# commands with "make install" instead of just "make". +#------------------------------------------------------------------------------ +ifeq ($(findstring install,$(MAKECMDGOALS)),install) + override BUILD_INSTALL = install +else + override BUILD_INSTALL = +endif + +#------------------------------------------------------------------------------ +# Configure command set up to do a cross-compile and install into the target +# filesystem. +#------------------------------------------------------------------------------ +CC_CONFIGURE_OPTS = --build=i686-linux --host=arm-linux +CC_CONFIGURE_OPTS = --build=i686-linux --host=arm-none-linux-gnueabi +CC_CONFIGURE_OPTS += --prefix=$(TARGET_GSTREAMER_DIR) +CC_CONFIGURE_OPTS += NM=$(MVTOOL_PREFIX)nm +CC_CONFIGURE_OPTS += RANLIB=$(MVTOOL_PREFIX)ranlib +CC_CONFIGURE_OPTS += CPPFLAGS="$(CPPFLAGS_all) $(CPPFLAGS_$(GST_TI_PLATFORM))" +CC_CONFIGURE_OPTS += CFLAGS="$(CFLAGS_all) $(CFLAGS_$(GST_TI_PLATFORM))" +CC_CONFIGURE_OPTS += LDFLAGS="$(LDFLAGS_all) $(LDFLAGS_$(GST_TI_PLATFORM))" + +export CC = $(MVTOOL_PREFIX)gcc +export CXX = $(MVTOOL_PREFIX)g++ +export PKG_CONFIG_PATH = $(TARGET_GSTREAMER_DIR)/lib/pkgconfig +export PKG_CONFIG_LIBDIR = $(PKG_CONFIG_PATH) + diff --git a/gstreamer_ti_dm81xx/README.TXT b/gstreamer_ti_dm81xx/README.TXT new file mode 100644 index 0000000..afa2895 --- /dev/null +++ b/gstreamer_ti_dm81xx/README.TXT @@ -0,0 +1,314 @@ +# +# README.TXT +# +# This file describes the build and run process for GStreamer on TI +# DaVinci and OMAP platforms. +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# + +Contents +======== +This package contains open-source base components required to build and run +GStreamer on TI DaVinci platforms, as well as a plugin that provides GStreamer +elements that interfaces with Codec Engine. + +Open Source Components +---------------------- +The following components are provided in the opensource_build/distfiles +directory, and are automatically built during the build process +(see the Build Instructions section below). + +gstreamer-0.10.30 + Description: GStreamer library + Project Page: http://gstreamer.freedesktop.org/ + Download URL: http://gstreamer.freedesktop.org/src/gstreamer/ + +gst-plugins-base-0.10.30 + Description: GStreamer plugins base library + Project Page: http://gstreamer.freedesktop.org/ + Download URL: http://gstreamer.freedesktop.org/src/gst-plugins-base/ + +gst-plugins-good-0.10.25 + Description: Select plugins from gst-plugins-good + Project Page: http://gstreamer.freedesktop.org/ + Download URL: http://gstreamer.freedesktop.org/src/gst-plugins-good/ + +gst-plugins-bad-0.10.20 + Description: Select plugins from gst-plugins-bad + Project Page: http://gstreamer.freedesktop.org/ + Download URL: http://gstreamer.freedesktop.org/src/gst-plugins-bad/ + +gst-plugins-ugly-0.10.16 + Description: Select plugins from gst-plugins-ugly + Project Page: http://gstreamer.freedesktop.org + Download URL: http://gstreamer.freedesktop.org/src/gst-plugins-ugly + +glib-2.24.2 + Description: GLib library + Project Page: http://www.gtk.org/ + Download URL: http://ftp.gnome.org/pub/gnome/sources/glib/ + +check-0.9.8 + Description: Check: a unit test framework for C + Project Page: http://sourceforge.net/projects/check/ + +libid3tag-0.15.1b + Description: ID3 tag manipulation library + Project Page: http://www.underbit.com/products/mad + Download URL: http://sourceforge.net/projects/mad/files + +libmad-0.15.1b + Description: MPEG audio decoder library + Project Page: http://www.underbit.com/products/mad + Download URL: http://sourceforge.net/projects/mad/files + +lame-398-2 + Description: MPEG Audio Layer III (MP3) encoder + Project Page: http://lame.sourceforge.net/ + Download URL: http://lame.sourceforge.net/download.php + +TI Plugin Elements +------------------ +Video Elements: +* TIViddec2: xDM 1.2 Video Decoder +* TIVidenc1: xDM 1.x Video Encoder + +Audio Elements: +* TIAuddec1: xDM 1.0 Audio Decoder +* TIAudenc1: xDM 1.x Audio Encoder + +Imaging Elements: +* TIImgenc1: xDM 1.0 Image Encoder +* TIImgdec1: xDM 1.0 Image Decoder + +Other Elements: +* TIDmaiVideoSink: Video sink supporting both framebuffer and V4L2 displays +* tidisplaysink2: TIDmaiVideoSink version 2, supported on DM36x, DM3730 and OMAPL138 +* TIVidResize: This element resizes video frames. +* TIPrepEncBuf: Prepare input buffer for encoding (hardware-accelerated + copy or color-conversion into physically-contiguous + buffer for TIVidenc1) + +Supported Platforms +=================== +This GStreamer plug-in has been built and tested on the following platforms: + +Platform DVSDK Version +-------- ------------- +DM6446 2.00.00.22 +DM355 3.10.00.19 +DM6467 2.00.00.22 +DM6467T 3.10.00.19 +DM365 4.01.00.09 +DM368 4.01.00.09 +OMAPL138 4.01.00.09 +DM37x/OMAP3530 4.01.00.09 + +Prerequisites +============= +- Linux host running RHEL 4.6. Other linux distributions may work, but have + not been tested. Some of the tools in RHEL 4.6 are too old to build the + GStreamer components. The following opensource components needed to be + installed on a RHEL 4.6 linux host in order to complete the build: + + pkg-config-0.18 + Description: pkg-config helper build tool + Project Page: http://pkg-config.freedesktop.org/wiki/ + Download URL: http://pkgconfig.freedesktop.org/releases/ + + flex-2.5.35 + Description: flex: The Fast Lexical Analyzer + Project Page: http://flex.sourceforge.net/ + Download URL: http://sourceforge.net/projects/flex/ + + The above components are provided in the opensource_build/host_tools + directory, but you must buid and install them manually on your system. + +- The DVSDK for the platform is installed on the Linux host. DVSDK versions + earlier than 2.00 are not actively supported. +- The DVSDK is configured to use the Linux kernel provided by the LSP package + associated with the DVSDK being used. + +Build Instructions +================== +Make sure the file named "Rules.make" in your top level DVSDK directory is +configured to rebuild the DVSDK components, and the PLATFORM variable is set +correctly. The settings in Rules.make will also be used to build the GStreamer +components. + +Next, change to the top level "gstreamer_ti" directory, and open the +file named "Makefile.common" in your favorite editor (vi, emacs, etc.). +Set the following variables at the top of the file: + + DVSDK_INSTALL_DIR: Location of your DVSDK installation directory + TARGET_ROOT_DIR: Location of the target filesystem's root directory + on the Linux host machine. + CROSS_COMPILER: Cross compiler being used. A default is chosen based + on the platform you are building for, but you can set + it explicitly to one of these values: + MVL_5_0: MontaVista v5.0 + CS_2008Q1: CodeSourcery v2008q1 + CS_2009Q1: CodeSourcery v2009q1 + +Execute this command from the top-level "gstreamer_ti" directory: +% make all install VERBOSE=true + +If you want less output during the build, you can omit the "VERBOSE=true" +above. + +By default, the GStreamer binaries will be installed to "/opt/gstreamer" on +the target, and some demonstration scripts will be installed to +"/opt/gstreamer_demo". + +Special Notes on DM6467 and DM6467T Build +----------------------------------------- +When building for DM6467 or DM6467T you must edit the Makefile.common file and +set GST_TI_PLATFORM to the EVM you are using. + +DM6467 example: + GST_TI_PLATFORM = dm6467 + +DM6467T example: + GST_TI_PLATFORM = dm6467t + +If you fail to set this variable, you will get the following error when you +build: + + Makefile.common:72: *** when building for dm6467 or dm6467t, the platform + type must be specified explicity at the top of Makefile.commom with + GST_TI_PLATFORM=dm6467 or GST_TI_PLATFORM=dm6467t. Stop. + +Board Set-Up +============ +After installation, there will be a target directory named +"/opt/gstreamer_demo/<platform>", where <platform> is the name of your target +(dm6446, dm355, etc.). In this directory there is a script for board set-up +named "loadmodules.sh". Run this script once the board is running to +initialize the relevant kernel modules for your platform. + +Other scripts are also available in this directory that demonstrate how you can +use the TI plugin via the gst-launch command, and are explained below. + +Special Notes: DVSDK 2.00 +-------------------------- +DVSDK 2.00 comes with linuxutils version 2.23.01. This version of linuxutils +has a bug in the CMEM module that will cause CMEM to incorrectly throw an error +at the end of playback that looks like this: + + CMEMK Error: FREE: Not a registered user of physical buffer 0x87968000 + CMEM Error: free: failed to free 0x43316000 + +To resolve this issue, you must update your linuxutils component to version +2.24.04.05. Linuxutils 2.24.04.05 can be downloaded from this page: + +http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/linuxutils/index.html + +Un-tar the updated version of linuxutils into your DVSDK 2.00 directory, and +update the following line in your Rules.make: + +Old setting: +CMEM_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/linuxutils_2_23_01 + +New setting: +CMEM_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/linuxutils_2_24_04_05 + +Then re-build the DVSDK components as follows: + +1) Change to the DVSDK directory +2) Double-check your Rules.make settings if needed to make sure all the + components point to valid component directories +3) Run "make linux" +4) Run "make clean; make" + +Special Notes: DVSDK 3.00 +-------------------------- +These additional set-up steps are required when using DVSDK 3.00 with an +OMAP35xx EVM. + +* Before running the loadmodules.sh script mentioned above, you must first run + /opt/dvsdk/omap3530/unloadmodules.sh on the EVM to ensure the kernel + modules are configured properly for GStreamer. +* On OMAP35xx EVMs with only 128M of memory, it may be desirable to use the + following bootargs setting in U-Boot to reduce the amount of memory allocated + by the video driver and make it available to the system: + + OMAP3_EVM # setenv nfshost <ip address of nfs host> + OMAP3_EVM # setenv rootpath <directory to mount> + OMAP3_EVM # setenv bootargs 'console=ttyS0,115200n8 noinitrd rw ip=dhcp + root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=99M + mpurate=600 omapfb.rotate=1 omapfb.rotate_type=1 + omap_vout.vid1_static_vrfb_alloc=y + omap_vout.video1_numbuffers=3 omap_vout.video1_bufsize=829440 + omap_vout.video2_numbuffers=0' + + Each "setenv" command should be entered on a single line. + + Depending on the complexity of your GStreamer pipeline and the clips you are + playing, failure to adjust the video driver's memory allocation could result + in OOM killers. + + Other platforms should use the bootargs settings in the DVSDK Getting + Started Guide. + +Special Notes: DVSDK 3.10 +-------------------------- + +1) Linuxlibs Installation + +You must download and install the "linuxlibs" component from the DVSDK download +page, and set LINUXLIBS_INSTALL_DIR in the DVSDK's Rules.make to its location. +If you don't, the GStreamer build may fail to find libraries that are pre-built +on the target filesystem, such as "libz". + +2) Kernel Patches for MMAP Driver Buffers + +By default, GStreamer uses mmap buffer drivers for the capture and display. +With the more recent kernels, there are no guarantees that it will be able to +allocate enough space for these buffers when requested. For DVSDK 3.10, you +need to use seven additional patches available on this kernel staging branch in +order to make mmap buffer usage reliable: + +http://arago-project.org/git/projects/?p=linux-davinci.git;a=shortlog;h=refs/heads/video-boot-time-mem-alloc + +When viewing this page, you can either click on the "snapshot" link to the +right of the top-most commit to download a full version of the kernel source +with these patches already applied, or you can download the patches separately +and apply them to the kernel source provided with the DVSDK. + +With these kernel patches applied, you should be using the kernel boot +arguments below to make sure space is allocated for mmap driver buffers. Note +that all of the bootargs options should be on a single line. + +DM6467T: + +bootargs=console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs + nfsroot=<nfsserver_ip>:<path to root filesystem>,nolock + vpif_display.ch2_numbuffers=0 vpif_display.ch3_numbuffers=0 mem=104M + vpif_display.cont_bufsize=12582912 vpif_capture.cont_bufoffset=12582912 + vpif_capture.cont_bufsize=12582912 + +DM355: + +bootargs=console=ttyS0,115200n8 root=/dev/nfs + nfsroot=<nfsserver_ip>:<path to root filesystem>,nolock ip=dhcp mem=93M + davinci_display.cont2_bufsize=3145728 vpfe_capture.cont_bufoffset=3145728 + vpfe_capture.cont_bufsize=3145728 + +Example GStreamer Usage +======================= +Many example GStreamer pipelines that use the TI GStreamer Plugin are available +at: + + http://wiki.davincidsp.com/index.php/Example_GStreamer_Pipelines + +These examples cover how to play clips of various types, perform capture and +encode, as well as network streaming. Additional example contributions are +welcome! + +Known Issues +============ +Known issues are listed in the RELEASE_NOTES.TXT file. For a list of all +issues please the the tracker items on the GStreamer project site at: +https://gstreamer.ti.com/gf/project/gstreamer_ti/tracker/ + diff --git a/gstreamer_ti_dm81xx/RELEASE_NOTES.TXT b/gstreamer_ti_dm81xx/RELEASE_NOTES.TXT new file mode 100644 index 0000000..279790b --- /dev/null +++ b/gstreamer_ti_dm81xx/RELEASE_NOTES.TXT @@ -0,0 +1,371 @@ +Release 1.02 +============ + + +New Features +------------ + DM365 Support: + - Tracker 976 - Support for the video/x-xvid mime type + + DVSDK Support: + + General: + - Tracker 966 - Update open-source base components + - Tracker 997 - Add "encodingPreset" property in encoder elements + - Tracker 1009 - Add support for MPEG-4 video inside quicktime container + - Tracker 1012 - videnc: add support for generating packetized/byte stream + - Tracker 1031 - Resolve build issues when using the CodeSourcery 2009q1 + toolset + - Tracker 1055 - Add support for DVSDK 3.10 + - Tracker 1070 - Add support for new DSPLink directory structure + - Tracker 1087 - Add support for new DSPLink directory structure in + Makefile.external + - Tracker 1089 - Build all components with -O2 by default + - Tracker 1094 - Add v4l2src support for the latest GIT kernels in + gst-plugins-g ood-0.10.16 + - Tracker 1096 - Add support for the NV16 colorspace in TIVidenc1 + - Tracker 1097 - Add support for the NV16 colorspace in TIDmaiVideoSink + - Tracker 1098 - Add support for the NV16 colorspace in TIVidResize + - Tracker 1099 - Add support for the 1080P_60 video standard in + TIDmaiVideoSink + - Tracker 1120 - Remove DM357 support + - Tracker 1126 - Create and integrate a new "TIDmaiBufTab" buffer table + object + - Tracker 1127 - Remove support for xDM 0.9-based codecs + - Tracker 1128 - Add support for user-allocated buffers in TIDmaiVideoSink + - Tracker 1139 - Add a property to hide the OSD on DM365/DM6446/DM355 + during video playback. + - Tracker 1160 - Add TIAuddec1 support for decoding AC3 audio streams + - Tracker 1163 - Add parameter to gst_ti_calc_buffer_size that specifies + pitch (bytes per line) + - Tracker 1165 - Remove MontaVista 4.0.1 configuration from Makefile.common + - Tracker 1167 - DVSDK 3.10 Support for DM6467T + - Tracker 1168 - DVSDK 3.10 Support for DM365 + - Tracker 1169 - DVSDK 3.10 Support for DM355 + + +Fixed Issues +------------ + - Tracker 962 - DM355 JPEG corruption in the lower right corner + - Tracker 970 - dmai-perf inaccuracy in fps and bps calculation + - Tracker 1001 - Handle the case when audio decoder outputs zero byte + - Tracker 1010 - rtph264pay may cause alignment trap signal + - Tracker 1015 - Do not abort the decoder thread when codec reports an + error or bit error + - Tracker 1016 - playbin2 fixes + - Tracker 1018 - dmaivideosink: enable the resizer support + - Tracker 1020 - dmaivideosink: use GST_ELEMENT_ERROR instead of GST_ERROR + - Tracker 1067 - Fix liboil preprocessor checks + - Tracker 1068 - Change format of patches for dependent components to match + review process + - Tracker 1073 - Always return NULL for the base sink's last-buffer property + - Tracker 1088 - Remove --force-mem option when building libmad with -O2 + - Tracker 1090 - Add clean_dev and clean_docs makefile targets + - Tracker 1091 - Fix typos in error messages + - Tracker 1092 - Fix assertion failure in TIImgenc1 + - Tracker 1093 - Don't error out if DMAI_INSTALL_DIR is set by Rules.make. + - Tracker 1095 - Correct size metadata imgdec1->hInBuf prior to calling the + code c + - Tracker 1100 - Remove DM365 guard for NV12 fourcc check + - Tracker 1101 - Create source caps information for MPEG-2 streams in + TIVidenc1 + - Tracker 1102 - Add support for the DivX and XviD mime types in TIViddec2 + - Tracker 1103 - Add GST_TI_PLATFORM variable to replace previous usage of + PLATFORM + - Tracker 1113 - Corrected TI Copyright notices (replaced $year with proper + years) + - Tracker 1114 - DM365: Leave the IPIPE open during UYVY capture + - Tracker 1115 - Force the TIViddec2 frameRate property to override + upstream caps + - Tracker 1116 - Fix duration query in TIAuddec1 + - Tracker 1121 - Remove v4l2 patch that resets bytesperline to 0 + - Tracker 1122 - Correct the way source caps information is generated in + TIViddec2 + - Tracker 1123 - Add static declaration for gst_tidmaivideosink_process_caps + - Tracker 1124 - Remove GST_TIDMAIVIDEOSINK_CAST macro + - Tracker 1125 - Push all display initialization code into + gst_tidmaivideosink_init_display + - Tracker 1140 - Fix assertion failures when generating debug log + information + - Tracker 1141 - Declare all useMask _FREE flags in + gsttidmaibuffertransport.h + - Tracker 1159 - TIViddec1's resolution property should override caps + settings + - Tracker 1161 - Detect audio/mpeg, mpegversion=2 as AAC + - Tracker 1162 - Make sure capture buffer size is aligned on DM365 + - Tracker 1165 - Specify explicit pitch when allocating user buffers in + TIDmaiVideoSink + - Tracker 1172 - Fix race condition in GstTIDmaiBufTab + - Tracker 1189 - Use DMAI_INSTALL_DIR defined in DVSDK Rules.make + - Tracker 1190 - Export CROSS_COMPILE/PLATFORM_XDC environment variables + needed by cfg + - Tracker 1203 - Fix intermittent assertion failure in circular buffer + + +Known Issues +------------ + +Release 1.02: + - Tracker 1205 - Without kernel real-time patch, A/V decode on DM355 may + not play smoothly + - Tracker 1206 - On DM355, video decode to frame buffer is not a supported + configuration + - Tracker 1209 - Need to use YUV420P color space instead of UYVY when doing + JPEG encode + - Tracker 1220 - Specify the capture resolution to reduce memory + requirements + - Tracker 1222 - DM6467 doesn't support AAC encode + - Tracker 963 - MPEG4 decoding crashes + - Tracker 808 - [PATCH] Fix bug#798 + - Tracker 1204 - gsttidmaiperf CPU's workload issue solved for single core + platforms + + + +Release 1.01 +============ + +New Features +------------ + DM365 Support: + - Tracker 678 - Preliminary decode support. + - Tracker 918 - Capture support via v4l2src. + - Tracker 921 - Set TIDmaiVideoSink colorspace based on input buffer. + - Tracker 925 - Video encode support. + - Tracker 933 - Enhance video encoder to use hardware-accelerated frame + copy into circular buffer. + - Tracker 947 - General refinements to loadmodules.sh. + - Tracker 948 - Only adjust display buffer color space for non-DMAI input + buffers (refine tracker 921). + - Tracker 954 - Add new method for displaying frames multiple times without + additional frame copies. + - Tracker 955 - Adjustments to loadmodules.sh for H.264. + + DVSDK Support: + - Tracker 760 - Add support for DVSDK 2.00.00.22 on DM6446, DM355, and + DM6467. + - Tracker 824 - Add support for DVSDK 3.00.02.44 on OMAP35x. + + General: + - Tracker 700 - Plugin can be built with either libtool 1.5.x or 2.2.x. + - Tracker 714 - Make the configure --host argument configurable from the + "make". + - Tracker 773 - Upgrade open source software components to the latest + versions available on June 12th, 2009. + - Tracker 848 - Plugin can be configured to always load codec server from a + fixed location. + - Tracker 926 - Add support for xDM 1.x audio encoders. + - Tracker 941 - Add the "TIVidResize" element for resizing video. + - Tracker 953 - Add the "dmaiperf" DMAI-based performance data gathering + element. + - Tracker 956 - Only build open source packages that don't change once. + - Tracker 969 - Remove demo scripts from gstreamer_demo directory. Example + pipelines are now available at + http://wiki.davincidsp.com/index.php/Example_GStreamer_Pipelines + + +Fixed Issues +------------ + - Tracker 198 - GStremer 0.10.15 introduces a major performance degradation. + - Tracker 272 - Assertion while playing h264 elementry stream (fixed in + tracker 807). + - Tracker 309 - Decodebin and playbin not working. + - Tracker 496 - TIAuddec1 and TIViddec2 leaking memory during state + transition from PLAYING to NULL (fixed in tracker 745). + - Tracker 519 - TIAuddec1 and TIViddec2 leaking memory at EOS (fixed in + tracker 745). + - Tracker 716 - Destroy custom thread attribute object after we're done + using it. + - Tracker 717 - Fix TIAuddec memory leak. + - Tracker 744 - Fix free memory read during error check. + - Tracker 745 - Fix memory leak during the destruction of + TIDmaiBufferTransport. + - Tracker 770 - Assertions when playing back H.264 video (fixed in tracker + 807). + - Tracker 787 - Correct cmem output ownership waiting until fully released + before de-allocating them. + - Tracker 797 - Handle problematic downstream elements, like playbin that + don't unref sink buffers at EOS. + - Tracker 807 - If no NAL prefix code for h264 decode, then parse + codec_data to construct NAL header. + - Tracker 845 - TIViddec2 crashes when it on EOS after decode_thread stops + the codec. + - Tracker 912 - Remove the queue thread from all elements. This resolves + some potential issues on EOS. + - Tracker 913 - Guarantee that the input buffer is always unref'd by + creating single exit point in *_chain functions. + - Tracker 914 - Guarantee that the circular buffer will not be accessed + during shut-down. + - Tracker 915 - Since other threads may be checking the circular buffer + pointer, set the circular buffer pointer to NULL before + unref'ing it. + - Tracker 916 - When calling drain_pipeline, set drainingEOS to TRUE AFTER + the check for codec exists. + - Tracker 919 - Add error checking to circular buffer API's. + - Tracker 924 - Circular buffer allocation fix for TIAuddec and TIAuddec1. + - Tracker 929 - Replace GST_ERROR function with GST_ELEMENT_ERROR in all + elements. + - Tracker 934 - Work around DMAI 1.20.00.06 defect in non-accelerated frame + copy for YUV420PSEMI data. + - Tracker 940 - Enable hardware-accelerated frame copy when encoder is + receiving dmai transport buffer. + - Tracker 945 - Set parent_class in gst_tidmaivideosink_class_init(). + - Tracker 967 - Codec fails to initialize when encoding from a file with no + caps negotiation. + - Tracker 964 - Changes to remove queue thread caused memory leak with + packetized h.264 streams (refine tracker 912). + - Tracker 959 - AAC decoding crashes while running gst-launch pipeline. + - Tracker 957 - Fix printf formatting warnings that were causing build + failures. + - Tracker 958 - Improved clean target so it doesn't fail if the + configuration step hasn't been performed. + - Tracker 874 - Update codec table to add video encoder strings. + - Tracker 871 - v4l2src: Fix frame rate numerator and denominator values. + - Tracker 858 - Delete temporary buffer created in circular buffer during + video encode process. + + +Known Issues +------------ + +Release 1.01: + - Tighter memory constraints in OMAP35x may cause OOM killers in + some cases. See the README.TXT for information on modifying + bootarg settings to make more memory available to the system. + - If you don't have "gperf" installed on your system, it may manifest + as a mysterious run issue with libid3tag involving unresolved + symbols (something like "undefined symbol: id3_frametype_unknown"). + The gperf package that comes with RHEL 4.6 is sufficient, but you need + to make sure it is installed. + - The JPEG image elements support multiple color spaces. However, + not every codec supports every color space. If you specify a + color space that is not supported you will get an error message + indicating that the plugin failed to create the codec. Check + the codec user's guide to determine if your codec supports the + color spaces used for the input and output. + - If clip size is smaller and TIDmaiVideoSink element reports + "assertion" then try disabling hardware-accelerated frame-copies. This + can be disabled by specifying accelFrameCopy=FALSE for TIDmaiVideoSink. + Note: disabling hardware-accelerated frame-copies will affect + performance. + - Tracker 972 - AVI video playback crash in VGA video standard. + When playing an AVI file with VGA video standard, it plays ok + the first time it runs, the second time it crashes. + - The plugin will not build on DM357 unless you upgrade the version of + DMAI in DVSDK 2.05 to DMAI 1.20.00.06. More information is available + in the README.TXT. + + +Trackers unresolved for release 1.01 scheduled for next release + + - Tracker 970 - dmai-perf inaccuracy in fps and bps calculation. + - Tracker 966 - Update open-source base components. + - Tracker 903 - DMAI video encoder support refactor. + - Tracker 867 - Improve video encoders timestamp handling. + - Tracker 532 - Buffers used during for decoding uses fixed sizes buffers. + - Tracker 881 - Changing the video Output to use from LCD to DVI crashes + the system. + + +Trackers for defects in other non-plugin software components + + - Tracker 965 - Building gst-plugins-good-0.10.15 with X11 development + headers installed on host machine fails. + - Tracker 968 - 1: command not found when building DM357 DVSDK. + - Tracker 930 - gstticodecplugin should fail to initialize if + CERuntime_init() fails. + + +Trackers unresolved for release 1.01 + + - Tracker 974 - Video playback freezes with H264 and MPEG2 (1080i test) + - Tracker 971 - Video playback freezes + - Tracker 963 - MPEG4 decoding crashes + - Tracker 962 - Blockiness on encoded image + - Tracker 960 - MP4 decoding crashes when using accelerated frame copy + - Tracker 893 - TIViddec2 buffer processing thread takes about one minute + before invoking the decoder thread + - Tracker 883 - If GStreamer is killed forcibly, the process becomes a + zombie in DVSDK 3.00.00.40 + - Tracker 870 - BUG: TIViddec2 crashes on transition from PLAYING to NULL + during playback + - Tracker 194 - Figure out why open source AVI demuxer crashes on really + large clips + - Tracker 200 - GLib 2.14.1 introduces code that crashes DM6446 + - Tracker 250 - about playback stalls problem during playing + - Tracker 274 - H.264 Quality with TIViddec2 is poor on DM6467 + - Tracker 342 - Lip Sync missing in Audio and Video + - Tracker 498 - TIDmaiVideoSink fails if DISPLAY_WIDTH - VIDEO_WIDTH is not + a multiple of 32 + - Tracker 521 - TIViddec2 / TIAuddec1 audio / video get out of sync after + long MP4 playback + - Tracker 523 - Can not play back captured H264 stored in MP4 with common + players + - Tracker 525 - H264 encoded AVI file doesn't play on common players + - Tracker 677 - Multiple Pipelines + - Tracker 484 - Patches to support MP4/H.264/AAC encode on OMAP3 platform + { PSP 1.0.2/DVSDK 3.00.00.29} + - Tracker 808 - [PATCH] Fix bug#798 + - Tracker 196 - Remove #if defined(Platform_omap3530) preprocessor macros + from display sink + - Tracker 267 - Analyze memory usage on all platforms and define reasonable + default CMEM pools. + - Tracker 412 - Provide benchmarking numbers with the GStreamer release + - Tracker 457 - Add support for contiguous input buffers to image encoders + - Tracker 505 - Create one codec combo for encode and decode + - Tracker 840 - MPEG4(AAC) audio stream not played by aachedec. Is played + properly with libfaad + + + + +Release 1.00 +============ + + +New Features +------------ + - Added support for video encoding elements TIVidenc and TIVidenc1. + These elements support the DM355, DM6446, DM357, DM367 and + OMAP35x devices. + - Patches for v4l2src element in the GST good plugin collection + - Patch 503 Support decodebin and playbin + + +Fixed Issues +------------ + - Patch 499 Fix memory leak during Fifo flush + - Patch 506 Fix data type mismatch int / bool for resizer and + autoselect properties in TIDmaiVideoSink + - Bug 303 Playback of audio and video increments VmallocUsed + - Bug 389 Memory leak in gsttividdec.c and gsttiauddec.c + (and probably others) + - Bug 707 Decode of mp4 file plays back with skips + + +Known Issues +------------ + - Video encode is not supported on DM6467. DM6467 requires DMAI + version at least 1.20.00.06 which is meant to be used with + DVSDK 2.00. Official support for video encoding on DM6467 + will be added when DVSDK 2.00 is released. For customer that + already have DVSDK 2.00 you can upgrade the DMAI version in + order to use the video encoder. + - If you don't have "gperf" installed on your system, it may manifest + as a mysterious run issue with libid3tag involving unresolved + symbols. The gperf package that comes with RHEL 4.6 is sufficient, + but you need to make sure it is installed. + - The JPEG image elements support multiple color spaces. However, + not every codec supports every color space. If you specify a + color space that is not supported you will get an error message + indicating that the plugin failed to create the codec. Check + the codec user's guide to determine if your codec supports the + color spaces used for the input and output. + - If clip size is smaller and dmaivideosink element reports + "assertion" then try disabling hw accelerated framecopy. This can + be disabled with -c option in scripts. Note: disabling hw accel + framecopy will affect performance. + - H264 encoded video from TIVidenc works with VLC if it has a + file extension of .264. In the 1.00.00 release, it was + incorrectly stated there was a problem playing H264 files + with VLC. diff --git a/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/example_pipeline.sh b/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/example_pipeline.sh new file mode 100644 index 0000000..ce1a6c5 --- /dev/null +++ b/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/example_pipeline.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# export environment +export GST_REGISTRY=/tmp/gst_registry.bin +export LD_LIBRARY_PATH=/opt/gstreamer/lib +export GST_PLUGIN_PATH=/opt/gstreamer/lib/gstreamer-0.10 +export PATH=/opt/gstreamer/bin:$PATH +export GST_PLUGIN_SCANNER=/opt/gstreamer/libexec/gstreamer-0.10/gst-plugin-scanner + +# pipeline decode elemenatry H.264 stream +gst-launch filesrc location=sample.264 ! typefind ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false -v + +# pipeline to decode MP4 container (H.264 + AAC). Note that currently AV is disabled. +gst-launch -v filesrc location=sample.mp4 ! qtdemux name=demux demux.audio_00 ! queue max-size-buffers=8000 max-size-time=0 max-size-bytes=0 ! faad ! alsasink sync=false demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false + +# pipeline to display the videotest pattern using omx sink +gst-launch -v videotestsrc ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false + +# pipeline to color convert videotestsrc pattern from NV12 to YUY2 using HW accelerated omx element and then display using omx sink +gst-launch -v videotestsrc ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false + +# pipeline to scale the decoded video to 720P using omx_scaler element +gst-launch filesrc location=sample.264 ! typefind ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1280,height=720' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false -v + +# pipeline to scale the QVGA video test pattern to VGA +gst-launch -v videotestsrc ! 'video/x-raw-yuv,width=320,height=240' ! omx_scaler ! 'video/x-raw-yuv,width=640,height=480' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false -v + +# pipeline to encode videotest pattern in H.264 +gst-launch -v videotestsrc num-buffers=1000 ! omx_h264enc ! filesink location=sample.264 + +# play mp4 using playbin2 +gst-launch playbin2 uri=file:///home/root/sample.mp4 -v + diff --git a/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/loadmodule.sh b/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/loadmodule.sh new file mode 100644 index 0000000..13f4793 --- /dev/null +++ b/gstreamer_ti_dm81xx/gstreamer_demo/dm814x/loadmodule.sh @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/example_pipeline.sh b/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/example_pipeline.sh new file mode 100644 index 0000000..ce1a6c5 --- /dev/null +++ b/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/example_pipeline.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# export environment +export GST_REGISTRY=/tmp/gst_registry.bin +export LD_LIBRARY_PATH=/opt/gstreamer/lib +export GST_PLUGIN_PATH=/opt/gstreamer/lib/gstreamer-0.10 +export PATH=/opt/gstreamer/bin:$PATH +export GST_PLUGIN_SCANNER=/opt/gstreamer/libexec/gstreamer-0.10/gst-plugin-scanner + +# pipeline decode elemenatry H.264 stream +gst-launch filesrc location=sample.264 ! typefind ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false -v + +# pipeline to decode MP4 container (H.264 + AAC). Note that currently AV is disabled. +gst-launch -v filesrc location=sample.mp4 ! qtdemux name=demux demux.audio_00 ! queue max-size-buffers=8000 max-size-time=0 max-size-bytes=0 ! faad ! alsasink sync=false demux.video_00 ! queue ! nal2bytestream_h264 ! omx_h264dec ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false + +# pipeline to display the videotest pattern using omx sink +gst-launch -v videotestsrc ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false + +# pipeline to color convert videotestsrc pattern from NV12 to YUY2 using HW accelerated omx element and then display using omx sink +gst-launch -v videotestsrc ! omx_scaler ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false + +# pipeline to scale the decoded video to 720P using omx_scaler element +gst-launch filesrc location=sample.264 ! typefind ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! 'video/x-raw-yuv,width=1280,height=720' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false -v + +# pipeline to scale the QVGA video test pattern to VGA +gst-launch -v videotestsrc ! 'video/x-raw-yuv,width=320,height=240' ! omx_scaler ! 'video/x-raw-yuv,width=640,height=480' ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false -v + +# pipeline to encode videotest pattern in H.264 +gst-launch -v videotestsrc num-buffers=1000 ! omx_h264enc ! filesink location=sample.264 + +# play mp4 using playbin2 +gst-launch playbin2 uri=file:///home/root/sample.mp4 -v + diff --git a/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/loadmodule.sh b/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/loadmodule.sh new file mode 100644 index 0000000..13f4793 --- /dev/null +++ b/gstreamer_ti_dm81xx/gstreamer_demo/dm816x/loadmodule.sh @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/gstreamer_ti_dm81xx/opensource_build/Makefile b/gstreamer_ti_dm81xx/opensource_build/Makefile new file mode 100644 index 0000000..1822a59 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/Makefile @@ -0,0 +1,170 @@ +# Makefile +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# Include common build settings. +#------------------------------------------------------------------------------ +include ../Makefile.common + +#------------------------------------------------------------------------------ +# Location of distribution files (.tar.gz archives) +#------------------------------------------------------------------------------ +DISTFILES_DIR=$(CURDIR)/distfiles +PATCHFILES_DIR=$(CURDIR)/patchfiles + +#------------------------------------------------------------------------------ +# Packages processed by this build script. +#------------------------------------------------------------------------------ +ifeq ($(GST_TI_PLATFORM), dm816x) + include ./Packages.make.dm81xx +endif +ifeq ($(GST_TI_PLATFORM), dm814x) + include ./Packages.make.dm81xx +endif + +PACKAGES = $(BASE_PACKAGES) $(PLUGIN_PACKAGES) + +#------------------------------------------------------------------------------ +# Build targets +#------------------------------------------------------------------------------ +.PHONY: default install all base plugins + +default: help + +all: .plugins + +.base: + $(CMD_PREFIX) $(MAKE) base $(BUILD_INSTALL) && touch $@ + +.plugins: .base + $(CMD_PREFIX) $(MAKE) plugins $(BUILD_INSTALL) && touch $@ + +base: + $(CMD_PREFIX) $(MAKE) orc $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) glib $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) check $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) gstreamer $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) id3tag $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) mad $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) lame $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) faad $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) faac $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) plugins_base $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) ffmpeg $(BUILD_INSTALL) + $(CMD_PREFIX) $(MAKE) plugin_h264 $(BUILD_INSTALL) + +plugins: $(PLUGIN_PACKAGES) +$(PACKAGES): % : %.build + +install: + +#------------------------------------------------------------------------------ +# clean: Remove all build sources +#------------------------------------------------------------------------------ +CLEAN_PACKAGES = $(addsuffix .clean, $(PACKAGES)) +.PHONY: clean $(CLEAN_PACKAGES) +clean: $(CLEAN_PACKAGES) + rm -f .base .plugins + +$(CLEAN_PACKAGES): + @echo "***** Cleaning $(basename $@)" + $(CMD_PREFIX) rm -rf $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) + +#------------------------------------------------------------------------------ +# Build a package +#------------------------------------------------------------------------------ +BUILD_PACKAGES = $(addsuffix .build, $(PACKAGES)) +.PHONY: $(BUILD_PACKAGES) +$(BUILD_PACKAGES): %.build : %.patch_postconfig + $(CMD_PREFIX) if [ "$(PACKAGE_$(basename $@)_BUILD_DIRS)" = "" ]; then \ + echo "***** building $(basename $@)"; \ + $(MAKE) $(MAKE_VERBOSE) -C $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) $(BUILD_INSTALL); \ + else \ + ( for dir in $(PACKAGE_$(basename $@)_BUILD_DIRS); do \ + echo "***** building $(basename $@) ($${dir})"; \ + $(MAKE) $(MAKE_VERBOSE) -C $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME)/$${dir} $(BUILD_INSTALL) || exit -1; \ + done; ) ;\ + fi + +#------------------------------------------------------------------------------ +# Apply patch files to a package after the configure step +#------------------------------------------------------------------------------ +PATCH_PACKAGES = $(addsuffix .patch_postconfig, $(PACKAGES)) +.PHONY: $(PATCH_PACKAGES) +$(PATCH_PACKAGES): %.patch_postconfig : %.configure + $(CMD_PREFIX) if [ "$(PACKAGE_$(basename $@)_POSTCONFIG_PATCHES)" != "" ]; then \ + echo "***** Patching $(basename $@)"; \ + for patch in $(PACKAGE_$(basename $@)_POSTCONFIG_PATCHES); do \ + patch $(PATCH_VERBOSE) -d $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) -p1 < $(PATCHFILES_DIR)/$(PACKAGE_$(basename $@)_ARCHIVE_BASENAME)/$${patch}; \ + done; \ + fi + +#------------------------------------------------------------------------------ +# Configure a package +#------------------------------------------------------------------------------ +CONFIGURE_PACKAGES = $(addsuffix .configure, $(PACKAGES)) +.PHONY: $(CONFIGURE_PACKAGES) +$(CONFIGURE_PACKAGES): %.configure : %.patch_preconfig + @echo "***** Configuring $(basename $@)" + $(CMD_PREFIX) if [ "$(PACKAGE_$(basename $@)_RUN_AUTOGEN)" = "true" ]; then cd $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) && ./autogen.sh --disable-gtk-doc --noconfigure; fi + $(CMD_PREFIX) cd $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) && ./configure $(CONFIGURE_VERBOSE) $(CC_CONFIGURE_OPTS) $(PACKAGE_$(basename $@)_CONFIGURE_OPTS) + +#------------------------------------------------------------------------------ +# Apply patch files to a package before the configure step +#------------------------------------------------------------------------------ +PATCH_PACKAGES = $(addsuffix .patch_preconfig, $(PACKAGES)) +.PHONY: $(PATCH_PACKAGES) +$(PATCH_PACKAGES): %.patch_preconfig : %.extract + $(CMD_PREFIX) if [ "$(PACKAGE_$(basename $@)_PRECONFIG_PATCHES)" != "" ]; then \ + echo "***** Patching $(basename $@)"; \ + for patch in $(PACKAGE_$(basename $@)_PRECONFIG_PATCHES); do \ + patch $(PATCH_VERBOSE) -d $(PACKAGE_$(basename $@)_ARCHIVE_BASENAME) -p1 < $(PATCHFILES_DIR)/$(PACKAGE_$(basename $@)_ARCHIVE_BASENAME)/$${patch}; \ + done; \ + fi + +#------------------------------------------------------------------------------ +# Extract a package +#------------------------------------------------------------------------------ +EXTRACT_PACKAGES = $(addsuffix .extract, $(PACKAGES)) +.PHONY: $(EXTRACT_PACKAGES) +$(EXTRACT_PACKAGES): %.extract : + @echo "***** Extracting $(basename $@)" + $(CMD_PREFIX) tar $(TAR_VERBOSE)xzf $(DISTFILES_DIR)/$(PACKAGE_$(basename $@)_ARCHIVE_BASENAME).tar.gz + +#------------------------------------------------------------------------------ +# help: build target for help screen +#------------------------------------------------------------------------------ +HELP_DESC_BASE = $(foreach pkg,$(BASE_PACKAGES)," $(pkg) :\n $(PACKAGE_$(pkg)_DESCRIPTION)\n") +HELP_DESC_PLUGINS = $(foreach pkg,$(PLUGIN_PACKAGES)," $(pkg) :\n $(PACKAGE_$(pkg)_DESCRIPTION)\n") + +.PHONY: help +help: + @echo + @echo "You must specify a build target. Available targets are:" + @echo + @echo " General Targets" + @echo " ---------------" + @echo " all :" + @echo " build everything" + @echo " base :" + @echo " build all base components" + @echo " plugins :" + @echo " build all plugins" + @echo + @echo " Base Component Targets" + @echo " ----------------------" + @echo -e " "$(HELP_DESC_BASE) + @echo " Plugin Targets" + @echo " --------------" + @echo -e " "$(HELP_DESC_PLUGINS) + diff --git a/gstreamer_ti_dm81xx/opensource_build/Packages.make b/gstreamer_ti_dm81xx/opensource_build/Packages.make new file mode 100644 index 0000000..de704f0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/Packages.make @@ -0,0 +1,175 @@ +# Packages.make +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# Packages processed by this build script. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Package glib +#------------------------------------------------------------------------------ +PACKAGE_glib_BUILD_TARGET = glib +PACKAGE_glib_ARCHIVE_BASENAME = glib-2.24.2 +PACKAGE_glib_PRECONFIG_PATCHES = +PACKAGE_glib_CONFIGURE_OPTS = glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes +PACKAGE_glib_POSTCONFIG_PATCHES = +PACKAGE_glib_BUILD_DIRS = +PACKAGE_glib_DESCRIPTION = GLib library +BASE_PACKAGES += $(PACKAGE_glib_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package check +#------------------------------------------------------------------------------ +PACKAGE_check_BUILD_TARGET = check +PACKAGE_check_ARCHIVE_BASENAME = check-0.9.8 +PACKAGE_check_PRECONFIG_PATCHES = +PACKAGE_check_CONFIGURE_OPTS = +PACKAGE_check_POSTCONFIG_PATCHES = +PACKAGE_check_BUILD_DIRS = +PACKAGE_check_DESCRIPTION = Check: a unit test framework for C +BASE_PACKAGES += $(PACKAGE_check_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package gstreamer +#------------------------------------------------------------------------------ +PACKAGE_gstreamer_BUILD_TARGET = gstreamer +PACKAGE_gstreamer_ARCHIVE_BASENAME = gstreamer-0.10.30 +PACKAGE_gstreamer_PRECONFIG_PATCHES = \ + 0001-Disable-last-buffer-feature-by-default.patch +PACKAGE_gstreamer_CONFIGURE_OPTS = --disable-loadsave --disable-tests --disable-examples +PACKAGE_gstreamer_POSTCONFIG_PATCHES = +PACKAGE_gstreamer_BUILD_DIRS = +PACKAGE_gstreamer_DESCRIPTION = GStreamer library +BASE_PACKAGES += $(PACKAGE_gstreamer_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package libid3tag +#------------------------------------------------------------------------------ +PACKAGE_id3tag_BUILD_TARGET = id3tag +PACKAGE_id3tag_ARCHIVE_BASENAME = libid3tag-0.15.1b +PACKAGE_id3tag_PRECONFIG_PATCHES = \ + 0001-Converted-from-libid3tag1_0_15_1b.patch.patch +PACKAGE_id3tag_CONFIGURE_OPTS = +PACKAGE_id3tag_POSTCONFIG_PATCHES = +PACKAGE_id3tag_DESCRIPTION = id3 tag library +BASE_PACKAGES += $(PACKAGE_id3tag_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package libmad +#------------------------------------------------------------------------------ +PACKAGE_mad_BUILD_TARGET = mad +PACKAGE_mad_ARCHIVE_BASENAME = libmad-0.15.1b +PACKAGE_mad_PRECONFIG_PATCHES = \ + 0001-Converted-from-libmad1_0_15_1b.patch \ + 0002-Remove-fforce-mem-option-when-building-with-O2.patch +PACKAGE_mad_POSTCONFIG_PATCHES = +PACKAGE_mad_DESCRIPTION = mpeg audio decoder library +BASE_PACKAGES += $(PACKAGE_mad_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_base +#------------------------------------------------------------------------------ +PACKAGE_plugins_base_BUILD_TARGET = plugins_base +PACKAGE_plugins_base_ARCHIVE_BASENAME = gst-plugins-base-0.10.30 +PACKAGE_plugins_base_PRECONFIG_PATCHES = +PACKAGE_plugins_base_CONFIGURE_OPTS = --disable-examples --disable-x --disable-ogg --disable-vorbis --disable-pango $(ALSA_SUPPORT) +PACKAGE_plugins_base_POSTCONFIG_PATCHES = +PACKAGE_plugins_base_BUILD_DIRS = +PACKAGE_plugins_base_DESCRIPTION = GStreamer plugins base library +BASE_PACKAGES += $(PACKAGE_plugins_base_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_good +#------------------------------------------------------------------------------ +PACKAGE_plugins_good_BUILD_TARGET = plugins_good +PACKAGE_plugins_good_ARCHIVE_BASENAME = gst-plugins-good-0.10.25 +PACKAGE_plugins_good_PRECONFIG_PATCHES = \ + 0001-v4l2src-add-input-src-property-to-specify-capture-in.patch \ + 0002-v4l2src-keep-track-of-the-input-ID-that-will-be-used.patch \ + 0003-v4l2src-make-sure-capture-buffer-size-is-aligned-on-.patch \ + 0004-osssink-handle-all-supported-sample-rates.patch \ + 0005-v4l2src-add-support-for-DaVinci-platforms-using-MVL-.patch \ + 0006-v4l2src-support-NV12-capture-on-DM365-using-the-IPIP.patch \ + 0007-v4l2src-accept-EPERM-as-a-non-fatal-error-for-VIDIOC.patch \ + 0008-v4l2src-try-progressive-mode-first-for-component-inp.patch \ + 0009-v4l2src-add-support-for-NV16-colorspace.patch \ + 0010-v4l2src-set-bytesperline-and-sizeimage-before-callin.patch \ + 0011-v4l2src-update-gst_v4l2_get_norm-to-handle-DM6467T-a.patch \ + 0012-v4l2src-add-V4L2-ioctl-calls-to-initialize-capture-d.patch \ + 0013-v4l2src-disable-video-device-polling-by-default-on-D.patch \ + 0014-v4l2src-Skip-detection-of-private-controls.patch \ + 0015-v4l2src-Remove-short-circuit-of-VIDIOC_S_FMT-call.patch \ + 0016-v4l2src-add-feature-to-artifically-lower-framerate-b.patch \ + 0017-v4l2src-always-set-the-desired-framerate-on-DM365.patch +PACKAGE_plugins_good_CONFIGURE_OPTS = +PACKAGE_plugins_good_POSTCONFIG_PATCHES = +PACKAGE_plugins_good_BUILD_DIRS = gst/avi +PACKAGE_plugins_good_BUILD_DIRS += gst/qtdemux +PACKAGE_plugins_good_BUILD_DIRS += sys/oss +PACKAGE_plugins_good_BUILD_DIRS += sys/v4l2 +PACKAGE_plugins_good_BUILD_DIRS += gst/autodetect +PACKAGE_plugins_good_BUILD_DIRS += gst/rtp +PACKAGE_plugins_good_BUILD_DIRS += gst/rtsp +PACKAGE_plugins_good_BUILD_DIRS += gst/rtpmanager +PACKAGE_plugins_good_BUILD_DIRS += gst/udp +PACKAGE_plugins_good_DESCRIPTION = \ + Select plugins from GStreamer good-plugins (avi, qtdemux, oss, v4l2) +PLUGIN_PACKAGES += $(PACKAGE_plugins_good_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_bad +#------------------------------------------------------------------------------ +PACKAGE_plugins_bad_BUILD_TARGET = plugins_bad +PACKAGE_plugins_bad_ARCHIVE_BASENAME = gst-plugins-bad-0.10.21 +PACKAGE_plugins_bad_PRECONFIG_PATCHES = \ + 0001-freeze-Add-timeout-property.patch \ + 0002-fixes-to-mux-h264-stream-utilizing-ctts.patch \ + 0003-ugly-hack-to-avoid-a-memcpy.patch \ + 0004-h264parse-Add-workaround-for-separate-codec_config-a.patch \ + 0005-jpegparse-ignore-unhandled-application-markers.patch +PACKAGE_plugins_bad_POSTCONFIG_PATCHES = +PACKAGE_plugins_bad_BUILD_DIRS = gst/mpegdemux +PACKAGE_plugins_bad_BUILD_DIRS += gst/rtpmux +PACKAGE_plugins_bad_BUILD_DIRS += gst/qtmux +PACKAGE_plugins_bad_DESCRIPTION = \ + Select plugins from GStreamer bad-plugins +PLUGIN_PACKAGES += $(PACKAGE_plugins_bad_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package plugins_ugly +#------------------------------------------------------------------------------- +PACKAGE_plugins_ugly_BUILD_TARGET = plugins_ugly +PACKAGE_plugins_ugly_ARCHIVE_BASENAME = gst-plugins-ugly-0.10.16 +PACKAGE_plugins_ugly_PRECONFIG_PATCHES = +ifeq ($(ALSA_SUPPORT), --disable-alsa) + PACKAGE_plugins_ugly_PRECONFIG_PATCHES += \ + 0001-Optimize-the-mad-element-to-output-16-bit-samples-in.patch +endif +PACKAGE_plugins_ugly_CONFIGURE_OPTS = --enable-lame +PACKAGE_plugins_ugly_POSTCONFIG_PATCHES = +PACKAGE_plugins_ugly_BUILD_DIRS = ext/mad +PACKAGE_plugins_ugly_BUILD_DIRS += ext/lame +PACKAGE_plugins_ugly_DESCRIPTION = \ + Selected plugins from Gstreamer ugly-plugins (id3tag, mad, lame) +PLUGIN_PACKAGES += $(PACKAGE_plugins_ugly_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package lame +#------------------------------------------------------------------------------- +PACKAGE_lame_BUILD_TARGET = lame +PACKAGE_lame_ARCHIVE_BASENAME = lame-398-2 +PACKAGE_lame_PRECONFIG_PATCHES = +PACKAGE_lame_CONFIGURE_OPTS = +PACKAGE_lame_DESCRIPTION = \ + lame lib for encoding mp3 +PLUGIN_PACKAGES += $(PACKAGE_lame_BUILD_TARGET) diff --git a/gstreamer_ti_dm81xx/opensource_build/Packages.make.dm81xx b/gstreamer_ti_dm81xx/opensource_build/Packages.make.dm81xx new file mode 100755 index 0000000..5a25ad9 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/Packages.make.dm81xx @@ -0,0 +1,259 @@ +# Packages.make +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# Packages processed by this build script. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Package glib +#------------------------------------------------------------------------------ +PACKAGE_glib_BUILD_TARGET = glib +PACKAGE_glib_ARCHIVE_BASENAME = glib-2.24.2 +PACKAGE_glib_PRECONFIG_PATCHES = +PACKAGE_glib_CONFIGURE_OPTS = glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes +PACKAGE_glib_POSTCONFIG_PATCHES = +PACKAGE_glib_BUILD_DIRS = +PACKAGE_glib_DESCRIPTION = GLib library +BASE_PACKAGES += $(PACKAGE_glib_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package check +#------------------------------------------------------------------------------ +PACKAGE_check_BUILD_TARGET = check +PACKAGE_check_ARCHIVE_BASENAME = check-0.9.8 +PACKAGE_check_PRECONFIG_PATCHES = +PACKAGE_check_CONFIGURE_OPTS = +PACKAGE_check_POSTCONFIG_PATCHES = +PACKAGE_check_BUILD_DIRS = +PACKAGE_check_DESCRIPTION = Check: a unit test framework for C +BASE_PACKAGES += $(PACKAGE_check_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package orc +#------------------------------------------------------------------------------- +PACKAGE_orc_BUILD_TARGET = orc +PACKAGE_orc_ARCHIVE_BASENAME = orc-0.4.14 +PACKAGE_orc_PRECONFIG_PATCHES = +PACKAGE_orc_CONFIGURE_OPTS = +PACKAGE_orc_POSTCONFIG_PATCHES = +PACKAGE_orc_DESCRIPTION = \ + ORC compiler +PLUGIN_PACKAGES += $(PACKAGE_orc_BUILD_TARGET) + + +#------------------------------------------------------------------------------ +# Package gstreamer +#------------------------------------------------------------------------------ +PACKAGE_gstreamer_BUILD_TARGET = gstreamer +PACKAGE_gstreamer_ARCHIVE_BASENAME = gstreamer-0.10.32 +PACKAGE_gstreamer_PRECONFIG_PATCHES = \ + 0001-gst-launch-add-loop-argument.patch \ + 0003-add-GstQueryBuffers-query.patch \ + 0004-Add-GstEventCrop-event.patch \ + 0005-basetransform-don-t-do-unnecessary-pad_alloc.patch +PACKAGE_gstreamer_CONFIGURE_OPTS = --disable-loadsave --disable-tests --disable-examples +PACKAGE_gstreamer_POSTCONFIG_PATCHES = +PACKAGE_gstreamer_BUILD_DIRS = +PACKAGE_gstreamer_DESCRIPTION = GStreamer library +BASE_PACKAGES += $(PACKAGE_gstreamer_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package libid3tag +#------------------------------------------------------------------------------ +PACKAGE_id3tag_BUILD_TARGET = id3tag +PACKAGE_id3tag_ARCHIVE_BASENAME = libid3tag-0.15.1b +PACKAGE_id3tag_PRECONFIG_PATCHES = \ + 0001-Converted-from-libid3tag1_0_15_1b.patch.patch +PACKAGE_id3tag_CONFIGURE_OPTS = +PACKAGE_id3tag_POSTCONFIG_PATCHES = +PACKAGE_id3tag_DESCRIPTION = id3 tag library +BASE_PACKAGES += $(PACKAGE_id3tag_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package libmad +#------------------------------------------------------------------------------ +PACKAGE_mad_BUILD_TARGET = mad +PACKAGE_mad_ARCHIVE_BASENAME = libmad-0.15.1b +PACKAGE_mad_PRECONFIG_PATCHES = \ + 0001-Converted-from-libmad1_0_15_1b.patch \ + 0002-Remove-fforce-mem-option-when-building-with-O2.patch +PACKAGE_mad_POSTCONFIG_PATCHES = +PACKAGE_mad_DESCRIPTION = mpeg audio decoder library +BASE_PACKAGES += $(PACKAGE_mad_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_base +#------------------------------------------------------------------------------ +PACKAGE_plugins_base_BUILD_TARGET = plugins_base +PACKAGE_plugins_base_ARCHIVE_BASENAME = gst-plugins-base-0.10.32 +PACKAGE_plugins_base_PRECONFIG_PATCHES = \ + 0001-add-rowstride-support-to-video-utility-functions.patch \ + 0002-stridetransform-skeletal-implementation-of-stridetra.patch \ + 0003-stridetransform-implement-caps-negotiation-and-relat.patch \ + 0004-stridetransform-implement-transform-function.patch \ + 0005-add-gst_stride_transform_transform_size.patch \ + 0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch \ + 0007-Add-NV12-support-in-stridetransform.patch \ + 0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch \ + 0009-fix-to-avoid-parsing-caps-on-every-frame.patch \ + 0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch \ + 0011-add-some-neon.patch \ + 0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch \ + 0013-Add-support-for-RGB565-to-stridetransform.patch \ + 0014-stridetransform-updates-for-new-extra-anal-compiler-.patch \ + 0015-stridetransform-fix-problem-transforming-caps-with-l.patch \ + 0016-modify-playbin-to-use-stridetransform.patch \ + 0017-playbin-disable-interlaced-support.patch \ + 0018-textoverlay-add-stride-support.patch \ + 0019-video-more-flexible-video-caps-utility.patch \ + 0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch \ + 0021-stride-more-flexible-stride-color-conversion.patch \ + 0022-stride-support-for-32bit-RGB-formats.patch \ + 0023-ffmpegcolorspace-support-for-rowstride.patch \ + 0024-discoverer-rowstride-support.patch \ + 0025-playsink-link-omx_colorconv-to-do-HW-accel-color-con.patch +PACKAGE_plugins_base_RUN_AUTOGEN = true +PACKAGE_plugins_base_CONFIGURE_OPTS = --disable-examples --disable-x --disable-ogg --disable-vorbis --disable-pango $(ALSA_SUPPORT) +PACKAGE_plugins_base_POSTCONFIG_PATCHES = +PACKAGE_plugins_base_DESCRIPTION = GStreamer plugins base library +BASE_PACKAGES += $(PACKAGE_plugins_base_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_good +#------------------------------------------------------------------------------ +PACKAGE_plugins_good_BUILD_TARGET = plugins_good +PACKAGE_plugins_good_ARCHIVE_BASENAME = gst-plugins-good-0.10.27 +PACKAGE_plugins_good_CONFIGURE_OPTS = --disable-x --disable-shout2 --enable-experimental --disable-aalib --disable-esd +PACKAGE_plugins_good_PRECONFIG_PATCHES = \ + 0001-v4l2-fix-handling-of-RGB32-BGR32-formats.patch \ + 0002-v4l2sink-Add-rotation-support.patch \ + 0003-v4l2sink-Add-flip-property.patch \ + 0004-v4l2sink-Add-support-for-omap24xxvout-driver.patch \ + 0005-v4l2sink-Add-support-for-omap_vout-driver.patch \ + 0006-v4l2-increase-v4l2sink-element-rank.patch \ + 0007-use-GstQueryBuffers-to-get-buffer-requirements.patch \ + 0008-add-rowstride-support.patch \ + 0009-use-GstEventCrop-to-get-crop-info.patch \ + 0010-v4l2-prefer-NV12.patch \ + 0011-v4l2sink-fix-issue-seen-with-autoconvert.patch \ + 0012-v4l2sink-Add-Userptr-support.patch +PACKAGE_plugins_good_POSTCONFIG_PATCHES = +PACKAGE_plugins_good_DESCRIPTION = \ + Select plugins from GStreamer good-plugins (avi, qtdemux, oss, v4l2) +PLUGIN_PACKAGES += $(PACKAGE_plugins_good_BUILD_TARGET) + +#------------------------------------------------------------------------------ +# Package plugins_bad +#------------------------------------------------------------------------------ +PACKAGE_plugins_bad_BUILD_TARGET = plugins_bad +PACKAGE_plugins_bad_ARCHIVE_BASENAME = gst-plugins-bad-0.10.21 +PACKAGE_plugins_bad_PRECONFIG_PATCHES = \ + 0001-freeze-Add-timeout-property.patch \ + 0002-fixes-to-mux-h264-stream-utilizing-ctts.patch \ + 0003-ugly-hack-to-avoid-a-memcpy.patch \ + 0004-h264parse-Add-workaround-for-separate-codec_config-a.patch \ + 0005-jpegparse-ignore-unhandled-application-markers.patch \ + 0006-mpegvideoparse-merge-sequence-header.patch \ + 0007-h264parse-fix-boundary-condition.patch +PACKAGE_plugins_bad_POSTCONFIG_PATCHES = +PACKAGE_plugins_bad_BUILD_DIRS = +PACKAGE_plugins_bad_CONFIGURE_OPTS = --disable-sdl +PACKAGE_plugins_bad_DESCRIPTION = \ + Select plugins from GStreamer bad-plugins +PLUGIN_PACKAGES += $(PACKAGE_plugins_bad_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package plugins_ugly +#------------------------------------------------------------------------------- +PACKAGE_plugins_ugly_BUILD_TARGET = plugins_ugly +PACKAGE_plugins_ugly_ARCHIVE_BASENAME = gst-plugins-ugly-0.10.17 +PACKAGE_plugins_ugly_PRECONFIG_PATCHES = +ifeq ($(ALSA_SUPPORT), --disable-alsa) + PACKAGE_plugins_ugly_PRECONFIG_PATCHES += \ + 0001-Optimize-the-mad-element-to-output-16-bit-samples-in.patch +endif +PACKAGE_plugins_ugly_CONFIGURE_OPTS = --enable-lame +PACKAGE_plugins_ugly_POSTCONFIG_PATCHES = +PACKAGE_plugins_ugly_DESCRIPTION = \ + Selected plugins from Gstreamer ugly-plugins (id3tag, mad, lame) +PLUGIN_PACKAGES += $(PACKAGE_plugins_ugly_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package lame +#------------------------------------------------------------------------------- +PACKAGE_lame_BUILD_TARGET = lame +PACKAGE_lame_ARCHIVE_BASENAME = lame-398-2 +PACKAGE_lame_PRECONFIG_PATCHES = +PACKAGE_lame_CONFIGURE_OPTS = +PACKAGE_lame_DESCRIPTION = \ + lame lib for encoding mp3 +PLUGIN_PACKAGES += $(PACKAGE_lame_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package faad +#------------------------------------------------------------------------------- +PACKAGE_faad_BUILD_TARGET = faad +PACKAGE_faad_ARCHIVE_BASENAME = faad2-2.7 +PACKAGE_faad_PRECONFIG_PATCHES = +PACKAGE_faad_CONFIGURE_OPTS = +PACKAGE_faad_DESCRIPTION = \ + faad lib for decoding AAC +PLUGIN_PACKAGES += $(PACKAGE_faad_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package faac +#------------------------------------------------------------------------------- +PACKAGE_faac_BUILD_TARGET = faac +PACKAGE_faac_ARCHIVE_BASENAME = faac-1.28 +PACKAGE_faac_PRECONFIG_PATCHES = +PACKAGE_faac_CONFIGURE_OPTS = +PACKAGE_faac_DESCRIPTION = \ + faac lib for encoding AAC +PLUGIN_PACKAGES += $(PACKAGE_faac_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package gst-ffmpeg +#------------------------------------------------------------------------------- +PACKAGE_ffmpeg_BUILD_TARGET = ffmpeg +PACKAGE_ffmpeg_ARCHIVE_BASENAME = gst-ffmpeg-0.10.11 +PACKAGE_ffmpeg_CONFIGURE_OPTS = --with-ffmpeg-extra-configure="--target-os=linux" +PACKAGE_ffmpeg_PRECONFIG_PATCHES = +PACKAGE_ffmpeg_DESCRIPTION = \ + gst-ffmpeg lib +PLUGIN_PACKAGES += $(PACKAGE_ffmpeg_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package plugin h264 +#------------------------------------------------------------------------------- +PACKAGE_plugin_h264_BUILD_TARGET = plugin_h264 +PACKAGE_plugin_h264_ARCHIVE_BASENAME = gst-plugin-h264-L24.13 +PACKAGE_plugin_h264_PRECONFIG_PATCHES = +PACKAGE_plugin_h264_CONFIGURE_OPTS = --disable-gtk-doc +PACKAGE_plugin_h264_POSTCONFIG_PATCHES = +PACKAGE_plugin_h264_DESCRIPTION = \ + Plugin to build nalbytestream_h264 parser +PLUGIN_PACKAGES += $(PACKAGE_plugin_h264_BUILD_TARGET) + +#------------------------------------------------------------------------------- +# Package orc +#------------------------------------------------------------------------------- +PACKAGE_orc_BUILD_TARGET = orc +PACKAGE_orc_ARCHIVE_BASENAME = orc-0.4.14 +PACKAGE_orc_PRECONFIG_PATCHES = +PACKAGE_orc_CONFIGURE_OPTS = +PACKAGE_orc_POSTCONFIG_PATCHES = +PACKAGE_orc_DESCRIPTION = \ + ORC compiler +PLUGIN_PACKAGES += $(PACKAGE_orc_BUILD_TARGET) + diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz Binary files differnew file mode 100644 index 0000000..5ee0e3e --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz.sha256sum new file mode 100644 index 0000000..7508e69 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/check-0.9.8.tar.gz.sha256sum @@ -0,0 +1 @@ +82acf956bb07584ffea2bf04d5989fe939c3e74ecf93133a21037fd0f7996a7f check-0.9.8.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/faac-1.28.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/faac-1.28.tar.gz Binary files differnew file mode 100644 index 0000000..adf3651 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/faac-1.28.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/faad2-2.7.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/faad2-2.7.tar.gz Binary files differnew file mode 100644 index 0000000..c0c3cb0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/faad2-2.7.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz Binary files differnew file mode 100644 index 0000000..9b5fa7d --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz.sha256sum new file mode 100644 index 0000000..d39b4ad --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/glib-2.24.2.tar.gz.sha256sum @@ -0,0 +1 @@ +a6874b847d99618edb4bf86732ce00357711529a2592ded17e246063ad9f3374 glib-2.24.2.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz Binary files differnew file mode 100644 index 0000000..6d87aa5 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz.sha256sum new file mode 100644 index 0000000..87e5332 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-ffmpeg-0.10.11.tar.gz.sha256sum @@ -0,0 +1 @@ +41c6e16b5b171736241fb01f72d9bf9f gst-ffmpeg-0.10.11.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz Binary files differnew file mode 100644 index 0000000..f739f36 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz.sha256sum new file mode 100644 index 0000000..2097895 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugin-h264-L24.13.tar.gz.sha256sum @@ -0,0 +1 @@ +04f9de612488fcd53f2b94de7d6dda762be3b732cfc9056d8bd1204325a34bb4 gst-plugin-h264-L24.13.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz Binary files differnew file mode 100644 index 0000000..9f1ef87 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz.sha256sum new file mode 100644 index 0000000..067c6b7 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.20.tar.gz.sha256sum @@ -0,0 +1 @@ +8cd816a94dbb0989592f8c7c83bed24dbb2ad9379232b11bb4215b32e154f6f5 gst-plugins-bad-0.10.20.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.21.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.21.tar.gz Binary files differnew file mode 100644 index 0000000..f5404f4 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-bad-0.10.21.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz Binary files differnew file mode 100644 index 0000000..1fca966 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz.sha256sum new file mode 100644 index 0000000..7cca8e0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.30.tar.gz.sha256sum @@ -0,0 +1 @@ +fab968e8f78482e10b34a5afb65a94340f2280bd56179ab02dc56cdb96f9b360 gst-plugins-base-0.10.30.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.32.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.32.tar.gz Binary files differnew file mode 100644 index 0000000..40a10c1 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-base-0.10.32.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz Binary files differnew file mode 100644 index 0000000..84fd191 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz.sha256sum new file mode 100644 index 0000000..3abedb7 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.25.tar.gz.sha256sum @@ -0,0 +1 @@ +64e97c54cca02dd9c2305dfd074e323e6ae6f2ade2198a4210e34e332b934d52 gst-plugins-good-0.10.25.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.27.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.27.tar.gz Binary files differnew file mode 100644 index 0000000..15bbb50 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-good-0.10.27.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz Binary files differnew file mode 100644 index 0000000..873a733 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz.sha256sum new file mode 100644 index 0000000..8f7bf50 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.16.tar.gz.sha256sum @@ -0,0 +1 @@ +e946453802d172f67228539009fec22efd44361e0153026aa4222a753ae4d760 gst-plugins-ugly-0.10.16.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.17.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.17.tar.gz Binary files differnew file mode 100644 index 0000000..0e4f4be --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gst-plugins-ugly-0.10.17.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz Binary files differnew file mode 100644 index 0000000..faf346b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz.sha256sum new file mode 100644 index 0000000..aaec710 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.30.tar.gz.sha256sum @@ -0,0 +1 @@ +9be9196261895a57d6deb0af9bbd03792fe91e6d1b15edec87f6728a34137e33 gstreamer-0.10.30.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.32.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.32.tar.gz Binary files differnew file mode 100644 index 0000000..0b76d69 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/gstreamer-0.10.32.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz Binary files differnew file mode 100644 index 0000000..6a79a2d --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz.sha256sum new file mode 100644 index 0000000..21e8b20 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/lame-398-2.tar.gz.sha256sum @@ -0,0 +1 @@ +a17a28569d8ed1e514915c1f12bdf4eedac506e5fbdf9a429ba97d5d42c9af32 lame-398-2.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz Binary files differnew file mode 100644 index 0000000..7c6fe25 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz.sha256sum new file mode 100644 index 0000000..18471f3 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/libid3tag-0.15.1b.tar.gz.sha256sum @@ -0,0 +1 @@ +63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151 libid3tag-0.15.1b.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz Binary files differnew file mode 100644 index 0000000..a68496c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz.sha256sum b/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz.sha256sum new file mode 100644 index 0000000..a4b9c3c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/libmad-0.15.1b.tar.gz.sha256sum @@ -0,0 +1 @@ +bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690 libmad-0.15.1b.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/distfiles/orc-0.4.14.tar.gz b/gstreamer_ti_dm81xx/opensource_build/distfiles/orc-0.4.14.tar.gz Binary files differnew file mode 100644 index 0000000..8d35f75 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/distfiles/orc-0.4.14.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/host_tools/flex-2.5.35.tar.gz b/gstreamer_ti_dm81xx/opensource_build/host_tools/flex-2.5.35.tar.gz Binary files differnew file mode 100644 index 0000000..e5c51ae --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/host_tools/flex-2.5.35.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/host_tools/pkgconfig-0.18.tar.gz b/gstreamer_ti_dm81xx/opensource_build/host_tools/pkgconfig-0.18.tar.gz Binary files differnew file mode 100644 index 0000000..e3e1374 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/host_tools/pkgconfig-0.18.tar.gz diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0001-freeze-Add-timeout-property.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0001-freeze-Add-timeout-property.patch new file mode 100644 index 0000000..ff7d48f --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0001-freeze-Add-timeout-property.patch @@ -0,0 +1,118 @@ +From 8a710ac33e367d5d8c48c98b0d818280cb08bf81 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <yosoy@danieldiaz.org> +Date: Thu, 17 Dec 2009 17:24:37 -0600 +Subject: [PATCH 1/5] freeze: Add timeout property. + +--- + gst/freeze/gstfreeze.c | 40 ++++++++++++++++++++++++++++++++++++++++ + gst/freeze/gstfreeze.h | 1 + + 2 files changed, 41 insertions(+), 0 deletions(-) + +diff --git a/gst/freeze/gstfreeze.c b/gst/freeze/gstfreeze.c +index 0d63eb7..90e3ea3 100644 +--- a/gst/freeze/gstfreeze.c ++++ b/gst/freeze/gstfreeze.c +@@ -44,6 +44,7 @@ enum + { + ARG_0, + ARG_MAX_BUFFERS, ++ ARG_TIMEOUT, + }; + + static GstStaticPadTemplate gst_freeze_src_template = +@@ -74,6 +75,8 @@ static gboolean gst_freeze_sink_activate_pull (GstPad * sinkpad, + static gboolean gst_freeze_sink_event (GstPad * pad, GstEvent * event); + static void gst_freeze_clear_buffer (GstFreeze * freeze); + static void gst_freeze_buffer_free (gpointer data, gpointer user_data); ++static void gst_freeze_set_timeout (gpointer data); ++static gboolean gst_freeze_finish_stream (gpointer data); + + + GST_BOILERPLATE (GstFreeze, gst_freeze, GstElement, GST_TYPE_ELEMENT); +@@ -113,6 +116,12 @@ gst_freeze_class_init (GstFreezeClass * klass) + "Maximum number of buffers", 0, G_MAXUINT, 1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (object_class, ++ ARG_TIMEOUT, ++ g_param_spec_int ("timeout", ++ "timeout", ++ "Timeout before closing stream", 0, G_MAXINT, 1, G_PARAM_READWRITE)); ++ + object_class->dispose = gst_freeze_dispose; + + } +@@ -165,6 +174,10 @@ gst_freeze_set_property (GObject * object, guint prop_id, + case ARG_MAX_BUFFERS: + freeze->max_buffers = g_value_get_uint (value); + break; ++ case ARG_TIMEOUT: ++ freeze->timeout = g_value_get_int (value); ++ g_print ("set_property, timeout=%d\n", freeze->timeout); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -181,6 +194,9 @@ gst_freeze_get_property (GObject * object, guint prop_id, + case ARG_MAX_BUFFERS: + g_value_set_uint (value, freeze->max_buffers); + break; ++ case ARG_TIMEOUT: ++ g_value_set_int (value, freeze->timeout); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -206,6 +222,7 @@ gst_freeze_change_state (GstElement * element, GstStateChange transition) + case GST_STATE_CHANGE_NULL_TO_READY: + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + freeze->timestamp_offset = freeze->running_time = 0; ++ gst_freeze_set_timeout (freeze); + break; + default: + break; +@@ -369,6 +386,29 @@ gst_freeze_sink_event (GstPad * pad, GstEvent * event) + } + + static gboolean ++gst_freeze_finish_stream (gpointer data) ++{ ++ GstFreeze *freeze = GST_FREEZE (data); ++ GstState cur_state; ++ ++ gst_element_get_state (GST_ELEMENT (freeze), &cur_state, NULL, 0); ++ if (cur_state != GST_STATE_PLAYING) ++ return TRUE; ++ ++ gst_pad_push_event (freeze->srcpad, gst_event_new_eos ()); ++ return FALSE; ++} ++ ++static void ++gst_freeze_set_timeout (gpointer data) ++{ ++ GstFreeze *freeze = GST_FREEZE (data); ++ ++ if (freeze->timeout > 0) ++ g_timeout_add (freeze->timeout * 1000, gst_freeze_finish_stream, freeze); ++} ++ ++static gboolean + plugin_init (GstPlugin * plugin) + { + GST_DEBUG_CATEGORY_INIT (freeze_debug, "freeze", 0, "Stream freezer"); +diff --git a/gst/freeze/gstfreeze.h b/gst/freeze/gstfreeze.h +index 47cead7..1d8715b 100644 +--- a/gst/freeze/gstfreeze.h ++++ b/gst/freeze/gstfreeze.h +@@ -43,6 +43,7 @@ struct _GstFreeze + GstBuffer *current; + + guint max_buffers; ++ gint timeout; + + gint64 timestamp_offset; + gint64 offset; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0002-fixes-to-mux-h264-stream-utilizing-ctts.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0002-fixes-to-mux-h264-stream-utilizing-ctts.patch new file mode 100644 index 0000000..ec7171c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0002-fixes-to-mux-h264-stream-utilizing-ctts.patch @@ -0,0 +1,38 @@ +From 89655fc3d8aa16d4caa7352e36d3f643090308f8 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sun, 14 Feb 2010 16:11:25 -0600 +Subject: [PATCH 2/5] fixes to mux h264 stream utilizing ctts + +--- + gst/qtmux/gstqtmux.c | 8 +++++++- + 1 files changed, 7 insertions(+), 1 deletions(-) + +diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c +index 1477db7..c6b164b 100644 +--- a/gst/qtmux/gstqtmux.c ++++ b/gst/qtmux/gstqtmux.c +@@ -2221,7 +2221,12 @@ again: + } else { + nsamples = 1; + sample_size = GST_BUFFER_SIZE (last_buf); +- if (pad->have_dts) { ++ /* note: by default offset_end will be 0, but qtdemux (and perhaps ++ * others) sets this to -1. So treat either as invalid values. ++ */ ++ if (pad->have_dts && ++ (GST_BUFFER_OFFSET_END (last_buf) != -1) && ++ (GST_BUFFER_OFFSET_END (last_buf) != 0)) { + gint64 scaled_dts; + pad->last_dts = GST_BUFFER_OFFSET_END (last_buf); + if ((gint64) (pad->last_dts) < 0) { +@@ -2939,6 +2944,7 @@ gst_qt_mux_video_sink_set_caps (GstPad * pad, GstCaps * caps) + } + } else if (strcmp (mimetype, "video/x-h264") == 0) { + entry.fourcc = FOURCC_avc1; ++ qtpad->have_dts = TRUE; + if (qtpad->avg_bitrate == 0) { + gint avg_bitrate = 0; + gst_structure_get_int (structure, "bitrate", &avg_bitrate); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0003-ugly-hack-to-avoid-a-memcpy.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0003-ugly-hack-to-avoid-a-memcpy.patch new file mode 100644 index 0000000..324bc5c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0003-ugly-hack-to-avoid-a-memcpy.patch @@ -0,0 +1,719 @@ +From 2d8a29fbe64e7874e818aca43a8c04ddd5e30ac4 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sat, 12 Jun 2010 17:51:03 -0500 +Subject: [PATCH 3/5] ugly hack to avoid a memcpy + +Ideally, we'd rather libvpx could decode directly into a gst buffer, but for +now this is how to avoid an extra memcpy + +Also enable multi-thread support, and for now disable encoder. +--- + configure.ac | 1 + + ext/vp8/Makefile.am | 1 + + ext/vp8/armv7.s | 182 +++++++++++++++++++ + ext/vp8/gst/video/gstbasevideoutils.c | 278 ++++++++++++++++++++++++++++++ + ext/vp8/gstvp8dec.c | 101 +++++++++++- + ext/vp8/plugin.c | 4 +- + gst-libs/gst/video/gstbasevideodecoder.c | 8 +- + gst-libs/gst/video/gstbasevideoutils.h | 2 +- + 8 files changed, 568 insertions(+), 9 deletions(-) + create mode 100644 ext/vp8/armv7.s + create mode 100644 ext/vp8/gst/video/gstbasevideoutils.c + +diff --git a/configure.ac b/configure.ac +index fa6193d..51d7ed1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -48,6 +48,7 @@ dnl AS_LIBTOOL_TAGS([CXX]) + + AC_LIBTOOL_WIN32_DLL + AM_PROG_LIBTOOL ++AM_PROG_AS + + dnl *** required versions of GStreamer stuff *** + GST_REQ=0.10.32 +diff --git a/ext/vp8/Makefile.am b/ext/vp8/Makefile.am +index 43989d6..f1a4438 100644 +--- a/ext/vp8/Makefile.am ++++ b/ext/vp8/Makefile.am +@@ -2,6 +2,7 @@ plugin_LTLIBRARIES = \ + libgstvp8.la + + libgstvp8_la_SOURCES = \ ++ armv7.s \ + gstvp8dec.c \ + gstvp8enc.c \ + gstvp8utils.c \ +diff --git a/ext/vp8/armv7.s b/ext/vp8/armv7.s +new file mode 100644 +index 0000000..2697a14 +--- /dev/null ++++ b/ext/vp8/armv7.s +@@ -0,0 +1,182 @@ ++@ GStreamer ++@ ++@ Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++@ ++@ Description: NEON/VFP accelerated functions for armv7 architecture ++@ Created on: Nov 27, 2009 ++@ Author: Rob Clark <rob@ti.com> ++@ ++@ This library is free software; you can redistribute it and/or ++@ modify it under the terms of the GNU Library General Public ++@ License as published by the Free Software Foundation; either ++@ version 2 of the License, or (at your option) any later version. ++@ ++@ This library 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 ++@ Library General Public License for more details. ++@ ++@ You should have received a copy of the GNU Library General Public ++@ License along with this library; if not, write to the ++@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++@ Boston, MA 02111-1307, USA. ++ ++ .fpu neon ++ .text ++ ++ .align ++ .global stride_copy_zip2 ++ .type stride_copy_zip2, %function ++@void ++@stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy_zip2: ++@ interleave remaining >= 16 bytes: ++ pld [r1, #64] ++ pld [r2, #64] ++ cmp r3, #16 ++ blt stride_copy_zip2_2 ++stride_copy_zip2_1: ++ vld1.8 {q8}, [r1]! ++ vld1.8 {q9}, [r2]! ++ ++ vzip.8 q8, q9 ++ ++ pld [r1, #64] ++ vst1.8 {q8,q9}, [r0]! ++ pld [r2, #64] ++ sub r3, r3, #16 ++ ++ cmp r3, #16 ++ bge stride_copy_zip2_1 ++@ interleave remaining >= 8 bytes: ++stride_copy_zip2_2: ++ cmp r3, #8 ++ blt stride_copy_zip2_3 ++ ++ vld1.8 {d16}, [r1]! ++ vld1.8 {d17}, [r2]! ++ ++ vzip.8 d16, d17 ++ ++ vst1.8 {d16,d17}, [r0]! ++ sub r3, r3, #8 ++ ++@ interleave remaining < 8 bytes: ++stride_copy_zip2_3: ++@XXX ++ bx lr ++@} ++ ++ ++ .align ++ .global stride_copy_zip3a ++ .type stride_copy_zip3a, %function ++@void ++@stride_copy_zip3a (guchar *new_buf, ++@ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy_zip3a: ++ pld [r1, #64] ++ pld [r2, #64] ++ pld [r3, #64] ++ ldr ip, [sp] @ the sz arg ++@ interleave remaining >= 32 bytes: ++ cmp ip, #32 ++ blt stride_copy_zip3a_2 ++stride_copy_zip3a_1: ++ vld1.8 {q8}, [r1]! @ Y ++ vld1.8 {q10}, [r1]! @ Y ++ vld1.8 {q9}, [r2]! @ U ++ vld1.8 {q11}, [r3]! @ V ++ ++ pld [r1, #64] ++ pld [r2, #64] ++ pld [r3, #64] ++ ++ vzip.8 q9, q11 @ interleave U&V ++ vzip.8 q8, q9 @ interleave Y1UV1 ++ vzip.8 q10, q11 @ interleave Y2UV2 ++ ++ vst1.8 {q8,q9}, [r0]! ++ vst1.8 {q10,q11}, [r0]! ++ ++ sub ip, ip, #32 ++ ++ cmp ip, #32 ++ bge stride_copy_zip3a_1 ++@ interleave remaining >= 16 bytes: ++stride_copy_zip3a_2: ++ cmp ip, #16 ++ blt stride_copy_zip3a_3 ++ ++ vld1.8 {d16}, [r1]! @ Y ++ vld1.8 {d18}, [r1]! @ Y ++ vld1.8 {d17}, [r2]! @ U ++ vld1.8 {d19}, [r3]! @ V ++ ++ vzip.8 d17, d19 @ interleave U&V ++ vzip.8 d16, d17 @ interleave Y1UV1 ++ vzip.8 d18, d19 @ interleave Y2UV2 ++ ++ vst1.8 {d16,d17}, [r0]! ++ vst1.8 {d18,d19}, [r0]! ++ ++ sub ip, ip, #16 ++@ copy remaining >= 8 bytes: ++stride_copy_zip3a_3: ++@XXX ++ bx lr ++@} ++ ++ ++ .align ++ .global stride_copy ++ .type stride_copy, %function ++@void ++@stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy: ++@ copy remaining >= 64 bytes: ++ pld [r1, #64] ++ cmp r2, #64 ++ blt stride_copy_2 ++stride_copy_1: ++ vld1.8 {q8-q9}, [r1]! ++ sub r2, r2, #64 ++ vld1.8 {q10-q11},[r1]! ++ vst1.8 {q8-q9}, [r0]! ++ pld [r1, #64] ++ cmp r2, #64 ++ vst1.8 {q10-q11},[r0]! ++ bge stride_copy_1 ++@ copy remaining >= 32 bytes: ++stride_copy_2: ++ cmp r2, #32 ++ blt stride_copy_3 ++ vld1.8 {q8-q9}, [r1]! ++ sub r2, r2, #32 ++ vst1.8 {q8-q9}, [r0]! ++@ copy remaining >= 16 bytes: ++stride_copy_3: ++ cmp r2, #16 ++ blt stride_copy_4 ++ vld1.8 {q8}, [r1]! ++ sub r2, r2, #16 ++ vst1.8 {q8}, [r0]! ++@ copy remaining >= 8 bytes: ++stride_copy_4: ++ cmp r2, #8 ++ blt stride_copy_5 ++ vld1.8 {d16}, [r1]! ++ sub r2, r2, #8 ++ vst1.8 {d16}, [r0]! ++@ copy remaining < 8 bytes: ++stride_copy_5: ++@XXX ++ bx lr ++@} ++ +diff --git a/ext/vp8/gst/video/gstbasevideoutils.c b/ext/vp8/gst/video/gstbasevideoutils.c +new file mode 100644 +index 0000000..f26e068 +--- /dev/null ++++ b/ext/vp8/gst/video/gstbasevideoutils.c +@@ -0,0 +1,278 @@ ++/* GStreamer ++ * Copyright (C) 2008 David Schleef <ds@schleef.org> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gstbasevideoutils.h" ++ ++#include <string.h> ++ ++GST_DEBUG_CATEGORY_EXTERN (basevideo_debug); ++#define GST_CAT_DEFAULT basevideo_debug ++ ++ ++#if 0 ++guint64 ++gst_base_video_convert_bytes_to_frames (GstVideoState * state, guint64 bytes) ++{ ++ return gst_util_uint64_scale_int (bytes, 1, state->bytes_per_picture); ++} ++ ++guint64 ++gst_base_video_convert_frames_to_bytes (GstVideoState * state, guint64 frames) ++{ ++ return frames * state->bytes_per_picture; ++} ++#endif ++ ++ ++gboolean ++gst_base_video_rawvideo_convert (GstVideoState * state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = FALSE; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ if (src_format == GST_FORMAT_BYTES && ++ *dest_format == GST_FORMAT_DEFAULT && state->bytes_per_picture != 0) { ++ /* convert bytes to frames */ ++ *dest_value = gst_util_uint64_scale_int (src_value, 1, ++ state->bytes_per_picture); ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_DEFAULT && ++ *dest_format == GST_FORMAT_BYTES && state->bytes_per_picture != 0) { ++ /* convert bytes to frames */ ++ *dest_value = src_value * state->bytes_per_picture; ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_DEFAULT && ++ *dest_format == GST_FORMAT_TIME && state->fps_n != 0) { ++ /* convert frames to time */ ++ /* FIXME add segment time? */ ++ *dest_value = gst_util_uint64_scale (src_value, ++ GST_SECOND * state->fps_d, state->fps_n); ++ res = TRUE; ++ } else if (src_format == GST_FORMAT_TIME && ++ *dest_format == GST_FORMAT_DEFAULT && state->fps_d != 0) { ++ /* convert time to frames */ ++ /* FIXME subtract segment time? */ ++ *dest_value = gst_util_uint64_scale (src_value, state->fps_n, ++ GST_SECOND * state->fps_d); ++ res = TRUE; ++ } ++ ++ /* FIXME add bytes <--> time */ ++ ++ return res; ++} ++ ++gboolean ++gst_base_video_encoded_video_convert (GstVideoState * state, ++ GstFormat src_format, gint64 src_value, ++ GstFormat * dest_format, gint64 * dest_value) ++{ ++ gboolean res = FALSE; ++ ++ if (src_format == *dest_format) { ++ *dest_value = src_value; ++ return TRUE; ++ } ++ ++ GST_DEBUG ("src convert"); ++ ++#if 0 ++ if (src_format == GST_FORMAT_DEFAULT && *dest_format == GST_FORMAT_TIME) { ++ if (dec->fps_d != 0) { ++ *dest_value = gst_util_uint64_scale (granulepos_to_frame (src_value), ++ dec->fps_d * GST_SECOND, dec->fps_n); ++ res = TRUE; ++ } else { ++ res = FALSE; ++ } ++ } else { ++ GST_WARNING ("unhandled conversion from %d to %d", src_format, ++ *dest_format); ++ res = FALSE; ++ } ++#endif ++ ++ return res; ++} ++ ++gboolean ++gst_base_video_state_from_caps (GstVideoState * state, GstCaps * caps) ++{ ++ ++ gst_video_format_parse_caps_strided (caps, &state->format, ++ &state->width, &state->height, &state->rowstride); ++ ++ gst_video_parse_caps_framerate (caps, &state->fps_n, &state->fps_d); ++ ++ state->par_n = 1; ++ state->par_d = 1; ++ gst_video_parse_caps_pixel_aspect_ratio (caps, &state->par_n, &state->par_d); ++ ++ { ++ GstStructure *structure = gst_caps_get_structure (caps, 0); ++ state->interlaced = FALSE; ++ gst_structure_get_boolean (structure, "interlaced", &state->interlaced); ++ } ++ ++ state->clean_width = state->width; ++ state->clean_height = state->height; ++ state->clean_offset_left = 0; ++ state->clean_offset_top = 0; ++ ++ /* FIXME need better error handling */ ++ return TRUE; ++} ++ ++GstClockTime ++gst_video_state_get_timestamp (const GstVideoState * state, ++ GstSegment * segment, int frame_number) ++{ ++ if (frame_number < 0) { ++ return segment->start - ++ (gint64) gst_util_uint64_scale (-frame_number, ++ state->fps_d * GST_SECOND, state->fps_n); ++ } else { ++ return segment->start + ++ gst_util_uint64_scale (frame_number, ++ state->fps_d * GST_SECOND, state->fps_n); ++ } ++} ++ ++/* gst adapter */ ++ ++static GSList * ++get_chunk (GstAdapter * adapter, int offset, int *skip) ++{ ++ GSList *g; ++ ++#if 1 ++ if (skip) ++ *skip = 0; ++#endif ++ ++ g_return_val_if_fail (offset >= 0, NULL); ++ g_return_val_if_fail (offset < adapter->size, NULL); ++ ++ offset += adapter->skip; ++ g = adapter->buflist; ++ while (g) { ++ if (offset < GST_BUFFER_SIZE (GST_BUFFER_CAST (g->data))) { ++ if (skip) ++ *skip = offset; ++ return g; ++ } ++ offset -= GST_BUFFER_SIZE (GST_BUFFER_CAST (g->data)); ++ g = g->next; ++ } ++ ++ g_assert_not_reached (); ++} ++ ++static int ++scan_fast (guint8 * data, guint32 pattern, guint32 mask, int n) ++{ ++ int i; ++ ++ pattern &= mask; ++ for (i = 0; i < n; i++) { ++ if ((GST_READ_UINT32_BE (data + i) & mask) == pattern) { ++ return i; ++ } ++ } ++ return n; ++} ++ ++static gboolean ++scan_slow (GstAdapter * adapter, GSList * g, int skip, guint32 pattern, ++ guint32 mask) ++{ ++ guint8 tmp[4]; ++ int j; ++ ++ pattern &= mask; ++ for (j = 0; j < 4; j++) { ++ tmp[j] = ((guint8 *) GST_BUFFER_DATA (GST_BUFFER_CAST (g->data)))[skip]; ++ skip++; ++ if (skip >= GST_BUFFER_SIZE (GST_BUFFER_CAST (g->data))) { ++ g = g->next; ++ skip = 0; ++ } ++ } ++ ++ return ((GST_READ_UINT32_BE (tmp) & mask) == pattern); ++} ++ ++int ++gst_adapter_masked_scan_uint32_compat (GstAdapter * adapter, guint32 mask, ++ guint32 pattern, guint offset, guint n) ++{ ++ GSList *g; ++ int j; ++ int k; ++ int skip; ++ int m; ++ ++ g_return_val_if_fail (n >= 0, -1); ++ g_return_val_if_fail (offset >= 0, -1); ++ g_return_val_if_fail (offset + n + 4 <= adapter->size, -1); ++ ++ g = get_chunk (adapter, offset, &skip); ++ j = 0; ++ while (j < n) { ++ m = MIN (GST_BUFFER_SIZE (GST_BUFFER_CAST (g->data)) - skip - 4, 0); ++ if (m > 0) { ++ k = scan_fast (GST_BUFFER_DATA (GST_BUFFER_CAST (g->data)) + skip, ++ pattern, mask, m); ++ if (k < m) { ++ return offset + j + k; ++ } ++ j += m; ++ skip += m; ++ } else { ++ if (scan_slow (adapter, g, skip, pattern, mask)) { ++ return offset + j; ++ } ++ j++; ++ skip++; ++ } ++ if (skip >= GST_BUFFER_SIZE (GST_BUFFER_CAST (g->data))) { ++ g = g->next; ++ skip = 0; ++ } ++ } ++ ++ return -1; ++} ++ ++GstBuffer * ++gst_adapter_get_buffer (GstAdapter * adapter) ++{ ++ return gst_buffer_ref (GST_BUFFER_CAST (adapter->buflist->data)); ++ ++} +diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c +index 3d8567f..fa93057 100644 +--- a/ext/vp8/gstvp8dec.c ++++ b/ext/vp8/gstvp8dec.c +@@ -115,7 +115,7 @@ static GstStaticPadTemplate gst_vp8_dec_src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, +- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")) ++ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ("NV12", "[0, max]")) + ); + + GST_BOILERPLATE (GstVP8Dec, gst_vp8_dec, GstBaseVideoDecoder, +@@ -309,10 +309,103 @@ gst_vp8_dec_send_tags (GstVP8Dec * dec) + GST_BASE_VIDEO_CODEC_SRC_PAD (dec), list); + } + ++#define WEAK __attribute__((weak)) ++ ++void stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, ++ guchar * orig_buf2, gint sz); ++WEAK void ++stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, ++ gint sz) ++{ ++ while (sz--) { ++ *new_buf++ = *orig_buf1++; ++ *new_buf++ = *orig_buf2++; ++ } ++} ++ ++void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); ++WEAK void ++stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) ++{ ++ memcpy (new_buf, orig_buf, sz); ++} ++ ++/** ++ * move to strided buffer, interleaving two planes of identical dimensions ++ */ ++static void ++stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, ++ gint new_stride, gint orig_stride, gint width, gint height) ++{ ++ int row; ++ ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_stride > orig_stride) { ++ for (row = height - 1; row >= 0; row--) { ++ stride_copy_zip2 (new_buf + (new_stride * row), ++ orig_buf1 + (orig_stride * row), ++ orig_buf2 + (orig_stride * row), width); ++ } ++ } else { ++ for (row = 0; row < height; row++) { ++ stride_copy_zip2 (new_buf + (new_stride * row), ++ orig_buf1 + (orig_stride * row), ++ orig_buf2 + (orig_stride * row), width); ++ } ++ } ++} ++ ++/** ++ * Convert from one stride to another... like memmove, but can convert stride in ++ * the process. This function is not aware of pixels, only of bytes. So widths ++ * are given in bytes, not pixels. The new_buf and orig_buf can point to the ++ * same buffers to do an in-place conversion, but the buffer should be large ++ * enough. ++ */ ++static void ++stridemove (guchar * new_buf, guchar * orig_buf, ++ gint new_stride, gint orig_stride, gint width, gint height) ++{ ++ int row; ++ ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_stride > orig_stride) { ++ for (row = height - 1; row >= 0; row--) { ++ stride_copy (new_buf + (new_stride * row), orig_buf + (orig_stride * row), ++ width); ++ } ++ } else { ++ for (row = 0; row < height; row++) { ++ stride_copy (new_buf + (new_stride * row), orig_buf + (orig_stride * row), ++ width); ++ } ++ } ++} ++ + static void + gst_vp8_dec_image_to_buffer (GstVP8Dec * dec, const vpx_image_t * img, + GstBuffer * buffer) + { ++ GstBaseVideoDecoder *decoder = (GstBaseVideoDecoder *) dec; ++#if 1 ++ int stride, w, h; ++ guint8 *d; ++ ++ stride = decoder->state.rowstride; ++ h = decoder->state.height; ++ w = decoder->state.width; ++ ++ d = GST_BUFFER_DATA (buffer); ++ stridemove (d, img->planes[PLANE_Y], stride, img->stride[PLANE_Y], w, h); ++ stridemove_zip2 (d + (h * stride), img->planes[PLANE_U], ++ img->planes[PLANE_V], stride, img->stride[PLANE_U], w / 2, h / 2); ++#else + int stride, w, h, i; + guint8 *d; + GstVideoState *state = &GST_BASE_VIDEO_CODEC (dec)->state; +@@ -349,6 +442,7 @@ gst_vp8_dec_image_to_buffer (GstVP8Dec * dec, const vpx_image_t * img, + for (i = 0; i < h; i++) + memcpy (d + i * stride, + img->planes[VPX_PLANE_V] + i * img->stride[VPX_PLANE_V], w); ++#endif + } + + static GstFlowReturn +@@ -388,7 +482,8 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) + /* should set size here */ + state->width = stream_info.w; + state->height = stream_info.h; +- state->format = GST_VIDEO_FORMAT_I420; ++ state->rowstride = 4096; ++ state->format = GST_VIDEO_FORMAT_NV12; + gst_vp8_dec_send_tags (dec); + + caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo); +@@ -411,6 +506,8 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame) + return GST_FLOW_ERROR; + } + ++ dec->decoder.config.dec->threads = 8; ++ + if ((caps & VPX_CODEC_CAP_POSTPROC) && dec->post_processing) { + vp8_postproc_cfg_t pp_cfg = { 0, }; + +diff --git a/ext/vp8/plugin.c b/ext/vp8/plugin.c +index cdecdc3..d62bee5 100644 +--- a/ext/vp8/plugin.c ++++ b/ext/vp8/plugin.c +@@ -37,8 +37,8 @@ plugin_init (GstPlugin * plugin) + #endif + + #ifdef HAVE_VP8_ENCODER +- gst_element_register (plugin, "vp8enc", GST_RANK_PRIMARY, +- gst_vp8_enc_get_type ()); ++// gst_element_register (plugin, "vp8enc", GST_RANK_PRIMARY, ++// gst_vp8_enc_get_type ()); + #endif + + return TRUE; +diff --git a/gst-libs/gst/video/gstbasevideodecoder.c b/gst-libs/gst/video/gstbasevideodecoder.c +index bcad367..509d6c0 100644 +--- a/gst-libs/gst/video/gstbasevideodecoder.c ++++ b/gst-libs/gst/video/gstbasevideodecoder.c +@@ -1453,8 +1453,8 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder) + if (base_video_decoder->have_src_caps) + return; + +- caps = gst_video_format_new_caps (state->format, +- state->width, state->height, ++ caps = gst_video_format_new_caps_strided (state->format, ++ state->width, state->height, state->rowstride, + state->fps_n, state->fps_d, state->par_n, state->par_d); + gst_caps_set_simple (caps, "interlaced", + G_TYPE_BOOLEAN, state->interlaced, NULL); +@@ -1478,8 +1478,8 @@ gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder * + + gst_base_video_decoder_set_src_caps (base_video_decoder); + +- num_bytes = gst_video_format_get_size (state->format, state->width, +- state->height); ++ num_bytes = gst_video_format_get_size_strided (state->format, ++ state->width, state->height, state->rowstride); + flow_ret = + gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD + (base_video_decoder), GST_BUFFER_OFFSET_NONE, num_bytes, +diff --git a/gst-libs/gst/video/gstbasevideoutils.h b/gst-libs/gst/video/gstbasevideoutils.h +index 5f71aee..be3b759 100644 +--- a/gst-libs/gst/video/gstbasevideoutils.h ++++ b/gst-libs/gst/video/gstbasevideoutils.h +@@ -37,7 +37,7 @@ typedef struct _GstVideoFrame GstVideoFrame; + struct _GstVideoState + { + GstVideoFormat format; +- int width, height; ++ int width, height, rowstride; + int fps_n, fps_d; + int par_n, par_d; + +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0004-h264parse-Add-workaround-for-separate-codec_config-a.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0004-h264parse-Add-workaround-for-separate-codec_config-a.patch new file mode 100644 index 0000000..f3bb247 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0004-h264parse-Add-workaround-for-separate-codec_config-a.patch @@ -0,0 +1,60 @@ +From da1a3659081d2b4a3cbf6c311dfaa7f1442dda4b Mon Sep 17 00:00:00 2001 +From: Amber Jain <amber@ti.com> +Date: Thu, 29 Jul 2010 11:10:42 +0200 +Subject: [PATCH 4/5] h264parse: Add workaround for separate codec_config as bytestream. + +Signed-off-by: Amber Jain <amber@ti.com> +Signed-off-by: Daniel Diaz <ddiaz@ti.com> +--- + gst/h264parse/gsth264parse.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c +index 9c35d3b..915677b 100644 +--- a/gst/h264parse/gsth264parse.c ++++ b/gst/h264parse/gsth264parse.c +@@ -1380,6 +1380,7 @@ gst_h264_parse_sink_setcaps (GstPad * pad, GstCaps * caps) + { + GstH264Parse *h264parse; + GstStructure *str; ++ GstCaps *src_caps = NULL; + const GValue *value; + guint8 *data; + guint size, num_sps, num_pps; +@@ -1394,6 +1395,25 @@ gst_h264_parse_sink_setcaps (GstPad * pad, GstCaps * caps) + gst_structure_get_fraction (str, "framerate", &h264parse->fps_num, + &h264parse->fps_den); + ++ /****** WORKAROUND **********/ ++ /* don't treat codec-data as an AVC format codec-data, but treat it like a ++ * normal byte-stream buffer, and handle like bytestream. ++ */ ++ /* need to remove the codec_data */ ++ if (G_UNLIKELY (h264parse->src_caps == NULL)) { ++ src_caps = gst_caps_copy (caps); ++ } else { ++ src_caps = gst_caps_ref (h264parse->src_caps); ++ } ++ src_caps = gst_caps_make_writable (src_caps); ++ g_return_val_if_fail (src_caps != NULL, FALSE); ++ str = gst_caps_get_structure (src_caps, 0); ++ if (gst_structure_has_field (str, "codec_data")) { ++ gst_structure_remove_field (str, "codec_data"); ++ gst_caps_replace (&h264parse->src_caps, src_caps); ++ } ++ /******** END WORKAROUND ************/ ++ + /* packetized video has a codec_data */ + if ((value = gst_structure_get_value (str, "codec_data"))) { + GstBuffer *buffer; +@@ -1475,6 +1495,7 @@ gst_h264_parse_sink_setcaps (GstPad * pad, GstCaps * caps) + /* we have 4 sync bytes */ + h264parse->nal_length_size = 4; + } ++ gst_caps_unref (src_caps); + + /* forward the caps */ + return gst_h264_parse_update_src_caps (h264parse, caps); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0005-jpegparse-ignore-unhandled-application-markers.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0005-jpegparse-ignore-unhandled-application-markers.patch new file mode 100644 index 0000000..561842c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0005-jpegparse-ignore-unhandled-application-markers.patch @@ -0,0 +1,71 @@ +From 1715a40398d7c04644808f24ef09263405bd81bc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= <vjaquez@igalia.com> +Date: Wed, 11 Aug 2010 13:06:32 +0200 +Subject: [PATCH 5/5] jpegparse: ignore unhandled application markers + +https://bugzilla.gnome.org/show_bug.cgi?id=626618 +--- + gst/jpegformat/gstjpegformat.h | 1 + + gst/jpegformat/gstjpegparse.c | 27 +++++++++++---------------- + 2 files changed, 12 insertions(+), 16 deletions(-) + +diff --git a/gst/jpegformat/gstjpegformat.h b/gst/jpegformat/gstjpegformat.h +index 118dd7a..41df961 100644 +--- a/gst/jpegformat/gstjpegformat.h ++++ b/gst/jpegformat/gstjpegformat.h +@@ -77,6 +77,7 @@ G_BEGIN_DECLS + #define APP0 0xe0 /* Application marker */ + #define APP1 0xe1 + #define APP2 0xe2 ++#define APP12 0xec /* "Picture Info" used by old cameras */ + #define APP13 0xed + #define APP14 0xee + #define APP15 0xef +diff --git a/gst/jpegformat/gstjpegparse.c b/gst/jpegformat/gstjpegparse.c +index ca9ac1f..ae567fb 100644 +--- a/gst/jpegformat/gstjpegparse.c ++++ b/gst/jpegformat/gstjpegparse.c +@@ -661,22 +661,7 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer) + } + break; + } +- case APP0: +- case APP2: +- case APP13: +- case APP14: +- case APP15:{ +- const gchar *id_str; +- if (!gst_byte_reader_get_uint16_be (&reader, &size)) +- goto error; +- if (!gst_byte_reader_get_string_utf8 (&reader, &id_str)) +- goto error; +- if (!gst_byte_reader_skip (&reader, size - 3 - strlen (id_str))) +- goto error; +- GST_LOG_OBJECT (parse, "unhandled marker %x: '%s' skiping %u bytes", +- marker, id_str, size - 2); +- break; +- } ++ + case DHT: + case DQT: + /* Ignore these codes */ +@@ -720,6 +705,16 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer) + if (!gst_jpeg_parse_skip_marker (parse, &reader, marker)) + goto error; + #endif ++ } else if (marker >= APP0 && marker <= APP15) { ++ const gchar *id_str; ++ if (!gst_byte_reader_get_uint16_be (&reader, &size)) ++ goto error; ++ if (!gst_byte_reader_get_string_utf8 (&reader, &id_str)) ++ goto error; ++ if (!gst_byte_reader_skip (&reader, size - 3 - strlen (id_str))) ++ goto error; ++ GST_LOG_OBJECT (parse, "application marker %x: '%s' skiping %u bytes", ++ marker, id_str, size - 2); + } else { + GST_WARNING_OBJECT (parse, "unhandled marker %x, leaving", marker); + /* Not SOF or SOI. Must not be a JPEG file (or file pointer +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0006-mpegvideoparse-merge-sequence-header.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0006-mpegvideoparse-merge-sequence-header.patch new file mode 100755 index 0000000..c6745e4 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0006-mpegvideoparse-merge-sequence-header.patch @@ -0,0 +1,50 @@ +--- gst-plugins-bad-0.10.21/gst/mpegvideoparse/mpegpacketiser.c 2011-01-08 00:41:04.000000000 +0530 ++++ gst-plugins-bad-0.10.21.bak/gst/mpegvideoparse/mpegpacketiser.c 2011-08-29 13:50:49.283361090 +0530 +@@ -306,7 +306,11 @@ handle_packet (MPEGPacketiser * p, guint + case MPEG_PACKET_SEQUENCE: + case MPEG_PACKET_GOP: + /* Start a new block */ +- start_new_block (p, offset, pack_type); ++ if (p->prev_sync_packet != MPEG_PACKET_SEQUENCE) { ++ start_new_block (p, offset, pack_type); ++ } else { ++ append_to_current_block (p, offset, pack_type); ++ } + p->prev_sync_packet = pack_type; + break; + case MPEG_PACKET_PICTURE:{ +@@ -349,6 +353,11 @@ handle_packet (MPEGPacketiser * p, guint + } + break; + } ++ case MPEG_PACKET_SEQUENCE_END: ++ printf("sequence end!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); ++ start_new_block (p, offset, pack_type); ++ //mpeg_packetiser_handle_eos(p); ++ break; + default: + append_to_current_block (p, offset, pack_type); + break; +--- gst-plugins-bad-0.10.21/gst/mpegvideoparse/mpegvideoparse.c 2011-01-08 00:41:04.000000000 +0530 ++++ gst-plugins-bad-0.10.21.bak/gst/mpegvideoparse/mpegvideoparse.c 2011-08-29 11:46:08.079360486 +0530 +@@ -264,9 +264,9 @@ mpegvideoparse_handle_sequence (MpegVide + + /* Store the entire sequence header + sequence header extension + for output as codec_data */ +- seq_buf = gst_buffer_copy (buf); ++ /*seq_buf = gst_buffer_copy (buf); + gst_buffer_replace (&mpegvideoparse->seq_hdr_buf, seq_buf); +- gst_buffer_unref (seq_buf); ++ gst_buffer_unref (seq_buf);*/ + + caps = gst_caps_new_simple ("video/mpeg", + "systemstream", G_TYPE_BOOLEAN, FALSE, +@@ -277,7 +277,7 @@ mpegvideoparse_handle_sequence (MpegVide + "framerate", GST_TYPE_FRACTION, new_hdr.fps_n, new_hdr.fps_d, + "pixel-aspect-ratio", GST_TYPE_FRACTION, new_hdr.par_w, new_hdr.par_h, + "interlaced", G_TYPE_BOOLEAN, !new_hdr.progressive, +- "codec_data", GST_TYPE_BUFFER, seq_buf, NULL); ++ /*"codec_data", GST_TYPE_BUFFER, seq_buf,*/ NULL); + + if (new_hdr.mpeg_version == 2) { + const gchar *profile = NULL, *level = NULL; diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0007-h264parse-fix-boundary-condition.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0007-h264parse-fix-boundary-condition.patch new file mode 100644 index 0000000..0efe8af --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-bad-0.10.21/0007-h264parse-fix-boundary-condition.patch @@ -0,0 +1,20 @@ +--- gst-plugins-bad-0.10.21/gst/h264parse/gsth264parse.c 2011-10-04 00:59:02.703867368 +0530 ++++ gst-plugins-bad-0.10.21.bak/gst/h264parse/gsth264parse.c 2011-09-30 09:58:40.623360816 +0530 +@@ -1803,6 +1803,7 @@ gst_h264_parse_push_nal (GstH264Parse * + /* first_mb_in_slice == 0 considered start of frame */ + start = h264parse->picture_start && (data[nal_length + 1] & 0x80); + if (G_UNLIKELY (!next_nal)) { ++ printf("Frame complete!!\n"); + complete = TRUE; + } else { + /* consider a coded slices (IDR or not) to start a picture, +@@ -2118,6 +2119,9 @@ gst_h264_parse_chain_forward (GstH264Par + + /* packetized will have no next data, which serves fine here */ + next_data = (guint8 *) gst_adapter_peek (h264parse->adapter, 6); ++ GST_DEBUG("next_data:%p",next_data); ++ if(next_data == NULL) ++ return GST_FLOW_OK; + outbuf = gst_h264_parse_push_nal (h264parse, outbuf, next_data, &start); + if (!outbuf) { + /* no complete unit yet, go for next round */ diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0001-add-rowstride-support-to-video-utility-functions.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0001-add-rowstride-support-to-video-utility-functions.patch new file mode 100644 index 0000000..7a76826 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0001-add-rowstride-support-to-video-utility-functions.patch @@ -0,0 +1,536 @@ +From 481cda8686336999ccccbdbf239bcbd520bcdfc7 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 30 Jul 2009 14:50:05 -0500 +Subject: [PATCH 01/24] add rowstride support to video utility functions + +--- + gst-libs/gst/video/gstvideofilter.c | 8 +- + gst-libs/gst/video/video.c | 244 ++++++++++++++++++++++++++++------- + gst-libs/gst/video/video.h | 27 +++-- + 3 files changed, 220 insertions(+), 59 deletions(-) + +diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c +index 2d08a60..6b2d7b7 100644 +--- a/gst-libs/gst/video/gstvideofilter.c ++++ b/gst-libs/gst/video/gstvideofilter.c +@@ -21,7 +21,7 @@ + /** + * SECTION:gstvideofilter + * @short_description: Base class for video filters +- * ++ * + * <refsect2> + * <para> + * Provides useful functions and a base class for video filters. +@@ -78,14 +78,14 @@ gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, + guint * size) + { + GstVideoFormat fmt; +- gint width, height; ++ gint width, height, rowstride; + +- if (!gst_video_format_parse_caps (caps, &fmt, &width, &height)) { ++ if (!gst_video_format_parse_caps_strided (caps, &fmt, &width, &height, &rowstride)) { + GST_WARNING_OBJECT (btrans, "Failed to parse caps %" GST_PTR_FORMAT, caps); + return FALSE; + } + +- *size = gst_video_format_get_size (fmt, width, height); ++ *size = gst_video_format_get_size_strided (fmt, width, height, rowstride); + + GST_DEBUG_OBJECT (btrans, "Returning size %u bytes for caps %" + GST_PTR_FORMAT, *size, caps); +diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c +index d9fa50b..24f1ac8 100644 +--- a/gst-libs/gst/video/video.c ++++ b/gst-libs/gst/video/video.c +@@ -31,7 +31,7 @@ + * + * <refsect2> + * <para> +- * This library contains some helper functions and includes the ++ * This library contains some helper functions and includes the + * videosink and videofilter base classes. + * </para> + * </refsect2> +@@ -53,7 +53,7 @@ static GstVideoFormat gst_video_format_from_rgb16_masks (int red_mask, + * + * A convenience function to retrieve a GValue holding the framerate + * from the caps on a pad. +- * ++ * + * The pad needs to have negotiated caps containing a framerate property. + * + * Returns: NULL if the pad has no configured caps or the configured caps +@@ -106,7 +106,7 @@ gst_video_frame_rate (GstPad * pad) + * + * Inspect the caps of the provided pad and retrieve the width and height of + * the video frames it is configured for. +- * ++ * + * The pad needs to have negotiated caps containing width and height properties. + * + * Returns: TRUE if the width and height could be retrieved. +@@ -158,13 +158,13 @@ gst_video_get_size (GstPad * pad, gint * width, gint * height) + * @display_par_n: Numerator of the pixel aspect ratio of the display device + * @display_par_d: Denominator of the pixel aspect ratio of the display device + * +- * Given the Pixel Aspect Ratio and size of an input video frame, and the +- * pixel aspect ratio of the intended display device, calculates the actual ++ * Given the Pixel Aspect Ratio and size of an input video frame, and the ++ * pixel aspect ratio of the intended display device, calculates the actual + * display ratio the video will be rendered with. + * +- * Returns: A boolean indicating success and a calculated Display Ratio in the +- * dar_n and dar_d parameters. +- * The return value is FALSE in the case of integer overflow or other error. ++ * Returns: A boolean indicating success and a calculated Display Ratio in the ++ * dar_n and dar_d parameters. ++ * The return value is FALSE in the case of integer overflow or other error. + * + * Since: 0.10.7 + */ +@@ -308,28 +308,15 @@ gst_video_parse_caps_chroma_site (GstCaps * caps) + } + + /** +- * gst_video_format_parse_caps: +- * @caps: the #GstCaps to parse +- * @format: the #GstVideoFormat of the video represented by @caps (output) +- * @width: the width of the video represented by @caps, may be NULL (output) +- * @height: the height of the video represented by @caps, may be NULL (output) +- * +- * Determines the #GstVideoFormat of @caps and places it in the location +- * pointed to by @format. Extracts the size of the video and places it +- * in the location pointed to by @width and @height. If @caps does not +- * represent one of the raw video formats listed in #GstVideoFormat, the +- * function will fail and return FALSE. +- * +- * Since: 0.10.16 +- * +- * Returns: TRUE if @caps was parsed correctly. ++ * see gst_video_format_parse_caps_strided and gst_video_format_parse_caps + */ +-gboolean +-gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, +- int *width, int *height) ++static gboolean ++parse_caps (GstCaps * caps, GstVideoFormat * format, gint *width, gint *height, ++ gboolean stride_ok, gint *rowstride) + { + GstStructure *structure; + gboolean ok = TRUE; ++ gboolean strided = FALSE; + + if (!gst_caps_is_fixed (caps)) + return FALSE; +@@ -337,7 +324,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, + structure = gst_caps_get_structure (caps, 0); + + if (format) { +- if (gst_structure_has_name (structure, "video/x-raw-yuv")) { ++ if (gst_structure_has_name (structure, "video/x-raw-yuv") || ++ (stride_ok && ++ gst_structure_has_name (structure, "video/x-raw-yuv-strided") && ++ (strided=TRUE) /* single '=' intentional */)) { + guint32 fourcc; + + ok &= gst_structure_get_fourcc (structure, "format", &fourcc); +@@ -346,7 +336,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, + if (*format == GST_VIDEO_FORMAT_UNKNOWN) { + ok = FALSE; + } +- } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) { ++ } else if (gst_structure_has_name (structure, "video/x-raw-rgb") || ++ (stride_ok && ++ gst_structure_has_name (structure, "video/x-raw-rgb-strided") && ++ (strided=TRUE) /* single '=' intentional */)) { + int depth; + int bpp; + int endianness = 0; +@@ -423,6 +416,10 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, + } + } + ++ /* note: should we require that the caps have these fields, even if ++ * the caller does not particularly request them?? ++ */ ++ + if (width) { + ok &= gst_structure_get_int (structure, "width", width); + } +@@ -431,11 +428,70 @@ gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, + ok &= gst_structure_get_int (structure, "height", height); + } + ++ if (rowstride) { ++ if (strided) { ++ ok &= gst_structure_get_int (structure, "rowstride", rowstride); ++ } else { ++ *rowstride = 0; /* not a strided format */ ++ } ++ } ++ + return ok; + } + + + /** ++ * gst_video_format_parse_caps_strided: ++ * @caps: the #GstCaps to parse ++ * @format: the #GstVideoFormat of the video represented by @caps (output) ++ * @width: the width of the video represented by @caps, may be NULL (output) ++ * @height: the height of the video represented by @caps, may be NULL (output) ++ * @rowstride: the rowstride (in bytes) represented by @caps, or 0 if there ++ * is no rowstride, may be NULL (output) ++ * ++ * Determines the #GstVideoFormat of @caps and places it in the location ++ * pointed to by @format. Extracts the size of the video and places it ++ * in the location pointed to by @width and @height. Extracts the row- ++ * stride and places it in the location pointed to by @rowstride. If ++ * @caps does not represent one of the raw video formats listed in ++ * #GstVideoFormat, the function will fail and return FALSE. ++ * ++ * Since: ??? ++ * ++ * Returns: TRUE if @caps was parsed correctly. ++ */ ++gboolean ++gst_video_format_parse_caps_strided (GstCaps * caps, GstVideoFormat * format, ++ int *width, int *height, int *rowstride) ++{ ++ return parse_caps (caps, format, width, height, TRUE, rowstride); ++} ++ ++/** ++ * gst_video_format_parse_caps: ++ * @caps: the #GstCaps to parse ++ * @format: the #GstVideoFormat of the video represented by @caps (output) ++ * @width: the width of the video represented by @caps, may be NULL (output) ++ * @height: the height of the video represented by @caps, may be NULL (output) ++ * ++ * Determines the #GstVideoFormat of @caps and places it in the location ++ * pointed to by @format. Extracts the size of the video and places it ++ * in the location pointed to by @width and @height. If @caps does not ++ * represent one of the raw video formats listed in #GstVideoFormat, the ++ * function will fail and return FALSE. ++ * ++ * Since: 0.10.16 ++ * ++ * Returns: TRUE if @caps was parsed correctly. ++ */ ++gboolean ++gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format, ++ int *width, int *height) ++{ ++ return parse_caps (caps, format, width, height, FALSE, NULL); ++} ++ ++/** + * gst_video_parse_caps_framerate: + * @caps: pointer to a #GstCaps instance + * @fps_n: pointer to integer to hold numerator of frame rate (output) +@@ -534,10 +590,11 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + } + + /** +- * gst_video_format_new_caps: ++ * gst_video_format_new_caps_strided: + * @format: the #GstVideoFormat describing the raw video format + * @width: width of video + * @height: height of video ++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride + * @framerate_n: numerator of frame rate + * @framerate_d: denominator of frame rate + * @par_n: numerator of pixel aspect ratio +@@ -545,26 +602,29 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + * + * Creates a new #GstCaps object based on the parameters provided. + * +- * Since: 0.10.16 ++ * Since: ??? + * + * Returns: a new #GstCaps object, or NULL if there was an error + */ + GstCaps * +-gst_video_format_new_caps (GstVideoFormat format, int width, +- int height, int framerate_n, int framerate_d, int par_n, int par_d) ++gst_video_format_new_caps_strided (GstVideoFormat format, ++ int width, int height, int rowstride, ++ int framerate_n, int framerate_d, int par_n, int par_d) + { ++ GstCaps *caps = NULL; ++ + g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); + g_return_val_if_fail (width > 0 && height > 0, NULL); + + if (gst_video_format_is_yuv (format)) { +- return gst_caps_new_simple ("video/x-raw-yuv", ++ caps = gst_caps_new_simple ( ++ rowstride ? "video/x-raw-yuv-strided" : "video/x-raw-yuv", + "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, + "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); +- } +- if (gst_video_format_is_rgb (format)) { ++ } else if (gst_video_format_is_rgb (format)) { + GstCaps *caps; + int red_mask = 0; + int blue_mask = 0; +@@ -663,7 +723,8 @@ gst_video_format_new_caps (GstVideoFormat format, int width, + return NULL; + } + +- caps = gst_caps_new_simple ("video/x-raw-rgb", ++ caps = gst_caps_new_simple ( ++ rowstride ? "video/x-raw-rgb-strided" : "video/x-raw-rgb", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "width", G_TYPE_INT, width, +@@ -685,11 +746,7 @@ gst_video_format_new_caps (GstVideoFormat format, int width, + width, height)); + gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); + } +- return caps; +- } +- +- if (gst_video_format_is_gray (format)) { +- GstCaps *caps; ++ } else if (gst_video_format_is_gray (format)) { + int bpp; + int depth; + int endianness; +@@ -730,11 +787,39 @@ gst_video_format_new_caps (GstVideoFormat format, int width, + "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, + "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); + } ++ } else { ++ return NULL; ++ } + +- return caps; ++ if (rowstride) { ++ gst_caps_set_simple (caps, "rowstride", G_TYPE_INT, rowstride, NULL); + } + +- return NULL; ++ return caps; ++} ++ ++/** ++ * gst_video_format_new_caps: ++ * @format: the #GstVideoFormat describing the raw video format ++ * @width: width of video ++ * @height: height of video ++ * @framerate_n: numerator of frame rate ++ * @framerate_d: denominator of frame rate ++ * @par_n: numerator of pixel aspect ratio ++ * @par_d: denominator of pixel aspect ratio ++ * ++ * Creates a new #GstCaps object based on the parameters provided. ++ * ++ * Since: 0.10.16 ++ * ++ * Returns: a new #GstCaps object, or NULL if there was an error ++ */ ++GstCaps * ++gst_video_format_new_caps (GstVideoFormat format, int width, int height, ++ int framerate_n, int framerate_d, int par_n, int par_d) ++{ ++ return gst_video_format_new_caps_strided (format, width, height, 0, ++ framerate_n, framerate_d, par_n, par_d); + } + + /** +@@ -874,7 +959,7 @@ gst_video_format_to_fourcc (GstVideoFormat format) + * @blue_mask: blue bit mask + * + * Converts red, green, blue bit masks into the corresponding +- * #GstVideoFormat. ++ * #GstVideoFormat. + * + * Since: 0.10.16 + * +@@ -1107,7 +1192,7 @@ gst_video_format_is_gray (GstVideoFormat format) + /** + * gst_video_format_has_alpha: + * @format: a #GstVideoFormat +- * ++ * + * Returns TRUE or FALSE depending on if the video format provides an + * alpha channel. + * +@@ -1877,6 +1962,75 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height) + } + + /** ++ * gst_video_format_get_size_strided: ++ * @format: a #GstVideoFormat ++ * @width: the width of video (in pixels) ++ * @height: the height of video (in pixels) ++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride (in which ++ * case the returned value is same as #gst_video_format_get_size()) ++ * ++ * Calculates the total number of bytes in the raw video format, for a buffer ++ * which may have a rowstride in bytes ++ * ++ * Since: ??? ++ * ++ * Returns: size (in bytes) of raw video format ++ */ ++int ++gst_video_format_get_size_strided (GstVideoFormat format, ++ int width, int height, int rowstride) ++{ ++ if(!rowstride) ++ return gst_video_format_get_size (format, width, height); ++ ++ g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0); ++ g_return_val_if_fail (width > 0 && height > 0, 0); ++ ++ switch (format) { ++ /* all packed formats have the same calculation, ie. rowstride * height ++ */ ++ case GST_VIDEO_FORMAT_RGBx: ++ case GST_VIDEO_FORMAT_BGRx: ++ case GST_VIDEO_FORMAT_xRGB: ++ case GST_VIDEO_FORMAT_xBGR: ++ case GST_VIDEO_FORMAT_RGBA: ++ case GST_VIDEO_FORMAT_BGRA: ++ case GST_VIDEO_FORMAT_ARGB: ++ case GST_VIDEO_FORMAT_ABGR: ++ case GST_VIDEO_FORMAT_RGB16: ++ case GST_VIDEO_FORMAT_BGR16: ++ case GST_VIDEO_FORMAT_RGB15: ++ case GST_VIDEO_FORMAT_BGR15: ++ case GST_VIDEO_FORMAT_RGB: ++ case GST_VIDEO_FORMAT_BGR: ++ case GST_VIDEO_FORMAT_YUY2: ++ case GST_VIDEO_FORMAT_YVYU: ++ case GST_VIDEO_FORMAT_UYVY: ++ case GST_VIDEO_FORMAT_AYUV: ++ case GST_VIDEO_FORMAT_v210: ++ case GST_VIDEO_FORMAT_v216: ++ return GST_ROUND_UP_4 (rowstride * height); ++ ++ /* these planar formats have 2x sub-sampling in the vertical direction, ++ * so U/V have half as many rows as Y: ++ */ ++ case GST_VIDEO_FORMAT_I420: ++ case GST_VIDEO_FORMAT_YV12: ++ return GST_ROUND_UP_4 (2 * rowstride * height); ++ ++ /* these planar formats have no sub-sampling in the vertical direction, ++ * so each plane has 'height' number of rows ++ */ ++ case GST_VIDEO_FORMAT_Y41B: ++ case GST_VIDEO_FORMAT_Y42B: ++ case GST_VIDEO_FORMAT_Y444: ++ return GST_ROUND_UP_4 (3 * rowstride * height); ++ default: ++ return 0; ++ } ++} ++ ++/** + * gst_video_format_convert: + * @format: a #GstVideoFormat + * @width: the width of video +diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h +index 96c5a85..a6a2293 100644 +--- a/gst-libs/gst/video/video.h ++++ b/gst-libs/gst/video/video.h +@@ -33,7 +33,7 @@ G_BEGIN_DECLS + * @GST_VIDEO_FORMAT_I420: planar 4:2:0 YUV + * @GST_VIDEO_FORMAT_YV12: planar 4:2:0 YVU (like I420 but UV planes swapped) + * @GST_VIDEO_FORMAT_YUY2: packed 4:2:2 YUV (Y0-U0-Y1-V0 Y2-U2-Y3-V2 Y4 ...) +- * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) ++ * @GST_VIDEO_FORMAT_UYVY: packed 4:2:2 YUV (U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4 ...) + * @GST_VIDEO_FORMAT_AYUV: packed 4:4:4 YUV with alpha channel (A0-Y0-U0-V0 ...) + * @GST_VIDEO_FORMAT_RGBx: sparse rgb packed into 32 bit, space last + * @GST_VIDEO_FORMAT_BGRx: sparse reverse rgb packed into 32 bit, space last +@@ -245,13 +245,13 @@ typedef enum { + + #define GST_VIDEO_CAPS_RGBx \ + __GST_VIDEO_CAPS_MAKE_32 (1, 2, 3) +- ++ + #define GST_VIDEO_CAPS_xRGB \ + __GST_VIDEO_CAPS_MAKE_32 (2, 3, 4) +- ++ + #define GST_VIDEO_CAPS_BGRx \ + __GST_VIDEO_CAPS_MAKE_32 (3, 2, 1) +- ++ + #define GST_VIDEO_CAPS_xBGR \ + __GST_VIDEO_CAPS_MAKE_32 (4, 3, 2) + +@@ -259,13 +259,13 @@ typedef enum { + + #define GST_VIDEO_CAPS_RGBA \ + __GST_VIDEO_CAPS_MAKE_32A (1, 2, 3, 4) +- ++ + #define GST_VIDEO_CAPS_ARGB \ + __GST_VIDEO_CAPS_MAKE_32A (2, 3, 4, 1) +- ++ + #define GST_VIDEO_CAPS_BGRA \ + __GST_VIDEO_CAPS_MAKE_32A (3, 2, 1, 4) +- ++ + #define GST_VIDEO_CAPS_ABGR \ + __GST_VIDEO_CAPS_MAKE_32A (4, 3, 2, 1) + +@@ -281,7 +281,7 @@ typedef enum { + #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \ + GST_VIDEO_CAPS_xRGB + #endif +- ++ + /* 15/16 bit */ + + #define GST_VIDEO_CAPS_RGB_16 \ +@@ -395,13 +395,15 @@ gboolean gst_video_get_size (GstPad *pad, + gint *height); + + gboolean gst_video_calculate_display_ratio (guint *dar_n, guint *dar_d, +- guint video_width, guint video_height, +- guint video_par_n, guint video_par_d, ++ guint video_width, guint video_height, ++ guint video_par_n, guint video_par_d, + guint display_par_n, guint display_par_d); + + gboolean gst_video_format_parse_caps (GstCaps *caps, GstVideoFormat *format, + int *width, int *height); + gboolean gst_video_format_parse_caps_interlaced (GstCaps *caps, gboolean *interlaced); ++gboolean gst_video_format_parse_caps_strided (GstCaps * caps, GstVideoFormat * format, ++ int *width, int *height, int *rowstride); + gboolean gst_video_parse_caps_framerate (GstCaps *caps, + int *fps_n, int *fps_d); + gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps, +@@ -415,6 +417,9 @@ GstCaps * gst_video_format_new_caps (GstVideoFormat format, + GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format, + int width, int height, int framerate_n, int framerate_d, + int par_n, int par_d, gboolean interlaced); ++GstCaps * gst_video_format_new_caps_strided (GstVideoFormat format, ++ int width, int height, int rowstride, ++ int framerate_n, int framerate_d, int par_n, int par_d); + GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); + guint32 gst_video_format_to_fourcc (GstVideoFormat format); + gboolean gst_video_format_is_rgb (GstVideoFormat format); +@@ -431,6 +436,8 @@ int gst_video_format_get_component_height (GstVideoFormat format, int component, + int gst_video_format_get_component_offset (GstVideoFormat format, int component, + int width, int height); + int gst_video_format_get_size (GstVideoFormat format, int width, int height); ++int gst_video_format_get_size_strided (GstVideoFormat format, ++ int width, int height, int rowstride); + gboolean gst_video_format_convert (GstVideoFormat format, int width, int height, + int fps_n, int fps_d, + GstFormat src_format, gint64 src_value, +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0002-stridetransform-skeletal-implementation-of-stridetra.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0002-stridetransform-skeletal-implementation-of-stridetra.patch new file mode 100644 index 0000000..a1b1276 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0002-stridetransform-skeletal-implementation-of-stridetra.patch @@ -0,0 +1,368 @@ +From 9820616aad713a23aa9d0e2afe44835d9e9278e5 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 30 Jul 2009 20:41:18 -0500 +Subject: [PATCH 02/24] stridetransform: skeletal implementation of stridetransform element + +--- + configure.ac | 2 + + gst/stride/Makefile.am | 15 ++++ + gst/stride/gststridetransform.c | 178 +++++++++++++++++++++++++++++++++++++++ + gst/stride/gststridetransform.h | 66 ++++++++++++++ + gst/stride/plugin.c | 45 ++++++++++ + 5 files changed, 306 insertions(+), 0 deletions(-) + create mode 100644 gst/stride/Makefile.am + create mode 100644 gst/stride/gststridetransform.c + create mode 100644 gst/stride/gststridetransform.h + create mode 100644 gst/stride/plugin.c + +diff --git a/configure.ac b/configure.ac +index 3325abc..af6cd52 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -427,6 +427,7 @@ AG_GST_CHECK_PLUGIN(ffmpegcolorspace) + AG_GST_CHECK_PLUGIN(gdp) + AG_GST_CHECK_PLUGIN(playback) + AG_GST_CHECK_PLUGIN(audioresample) ++AG_GST_CHECK_PLUGIN(stride) + AG_GST_CHECK_PLUGIN(subparse) + AG_GST_CHECK_PLUGIN(tcp) + AG_GST_CHECK_PLUGIN(typefind) +@@ -925,6 +926,7 @@ gst/ffmpegcolorspace/Makefile + gst/gdp/Makefile + gst/playback/Makefile + gst/audioresample/Makefile ++gst/stride/Makefile + gst/subparse/Makefile + gst/tcp/Makefile + gst/typefind/Makefile +diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am +new file mode 100644 +index 0000000..1adc197 +--- /dev/null ++++ b/gst/stride/Makefile.am +@@ -0,0 +1,15 @@ ++plugin_LTLIBRARIES = libgststridetransform.la ++ ++libgststridetransform_la_SOURCES = \ ++ gststridetransform.c \ ++ plugin.c ++ ++libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) ++libgststridetransform_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) ++libgststridetransform_la_LIBADD = \ ++ $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \ ++ $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) ++libgststridetransform_la_LIBTOOLFLAGS = --tag=disable-static ++ ++noinst_HEADERS = \ ++ gststridetransform.h +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +new file mode 100644 +index 0000000..21f2d6e +--- /dev/null ++++ b/gst/stride/gststridetransform.c +@@ -0,0 +1,178 @@ ++/* GStreamer ++ * ++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++ * ++ * Description: V4L2 sink element ++ * Created on: Jul 30, 2009 ++ * Author: Rob Clark <rob@ti.com> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++ ++/** ++ * SECTION:element-stridetransform ++ * ++ * stridetransform can be used to convert between video buffers ++ * with and without stride, or between buffers with differing ++ * stride ++ * ++ * <refsect2> ++ * <title>Example launch lines</title> ++ * |[ ++ * gst-launch ???? TODO ++ * ]| This pipeline ???? TODO ++ * </refsect2> ++ */ ++ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include "gststridetransform.h" ++#include "gst/gst-i18n-plugin.h" ++ ++ ++static const GstElementDetails stridetransform_details = ++GST_ELEMENT_DETAILS ("Stride transform", ++ "Filter/Converter/Video", ++ "Convert between video buffers with and without stride, or with differing stride", ++ "Rob Clark <rob@ti.com>,"); ++ ++GST_DEBUG_CATEGORY (stridetransform_debug); ++#define GST_CAT_DEFAULT stridetransform_debug ++ ++/* type functions */ ++static void gst_stride_transform_dispose (GObject * obj); ++ ++/* GstBaseTransform functions */ ++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, ++ GstCaps * caps, guint * size); ++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps); ++static void gst_stride_transform_fixate_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); ++static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, ++ GstCaps * incaps, GstCaps * outcaps); ++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, ++ GstBuffer * inbuf, GstBuffer * outbuf); ++static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base, ++ GstBuffer * buf); ++ ++GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); ++ ++ ++static void ++gst_stride_transform_base_init (gpointer g_class) ++{ ++ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); ++ ++ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); ++ ++ gst_element_class_set_details (gstelement_class, &stridetransform_details); ++} ++ ++static void ++gst_stride_transform_class_init (GstStrideTransformClass * klass) ++{ ++ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); ++ GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); ++ ++ gobject_class->dispose = gst_stride_transform_dispose; ++ ++ basetransform_class->get_unit_size = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); ++ basetransform_class->transform_caps = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); ++ basetransform_class->fixate_caps = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps); ++ basetransform_class->set_caps = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); ++ basetransform_class->transform_ip = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip); ++ basetransform_class->transform = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform); ++ ++ basetransform_class->passthrough_on_same_caps = TRUE; ++} ++ ++static void ++gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass) ++{ ++ GST_DEBUG_OBJECT (self, "not implemented"); ++} ++ ++ ++static void ++gst_stride_transform_dispose (GObject * object) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ G_OBJECT_CLASS (parent_class)->dispose (object); ++} ++ ++static gboolean ++gst_stride_transform_get_unit_size (GstBaseTransform * base, ++ GstCaps * caps, guint * size) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ return FALSE; ++} ++ ++static GstCaps * ++gst_stride_transform_transform_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ return NULL; ++} ++ ++static void ++gst_stride_transform_fixate_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++} ++ ++static gboolean ++gst_stride_transform_set_caps (GstBaseTransform * base, ++ GstCaps * incaps, GstCaps * outcaps) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ return FALSE; ++} ++ ++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, ++ GstBuffer * inbuf, GstBuffer * outbuf) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ return GST_FLOW_ERROR; ++} ++ ++static GstFlowReturn ++gst_stride_transform_transform_ip (GstBaseTransform * base, ++ GstBuffer * buf) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GST_DEBUG_OBJECT (self, "not implemented"); ++ return GST_FLOW_ERROR; ++} +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +new file mode 100644 +index 0000000..b4f7d59 +--- /dev/null ++++ b/gst/stride/gststridetransform.h +@@ -0,0 +1,66 @@ ++/* GStreamer ++ * ++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++ * ++ * Description: V4L2 sink element ++ * Created on: Jul 2, 2009 ++ * Author: Rob Clark <rob@ti.com> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef __GSTSTRIDETRANSFORM_H__ ++#define __GSTSTRIDETRANSFORM_H__ ++ ++ ++#include <gst/video/gstvideofilter.h> ++ ++G_BEGIN_DECLS ++ ++#define GST_TYPE_STRIDE_TRANSFORM \ ++ (gst_stride_transform_get_type()) ++#define GST_STRIDE_TRANSFORM(obj) \ ++ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransform)) ++#define GST_STRIDE_TRANSFORM_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransformClass)) ++#define GST_IS_STRIDE_TRANSFORM(obj) \ ++ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STRIDE_TRANSFORM)) ++#define GST_IS_STRIDE_TRANSFORM_CLASS(klass) \ ++ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STRIDE_TRANSFORM)) ++ ++typedef struct _GstStrideTransform GstStrideTransform; ++typedef struct _GstStrideTransformClass GstStrideTransformClass; ++ ++/** ++ * GstStrideTransform: ++ * ++ * Opaque datastructure. ++ */ ++struct _GstStrideTransform { ++ GstVideoFilter videofilter; ++ ++}; ++ ++struct _GstStrideTransformClass { ++ GstVideoFilterClass parent_class; ++}; ++ ++GType gst_stride_transform_get_type (void); ++ ++G_END_DECLS ++ ++ ++#endif /* __GSTSTRIDETRANSFORM_H__ */ +diff --git a/gst/stride/plugin.c b/gst/stride/plugin.c +new file mode 100644 +index 0000000..7672bdc +--- /dev/null ++++ b/gst/stride/plugin.c +@@ -0,0 +1,45 @@ ++/* GStreamer ++ * ++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++ * ++ * Description: V4L2 sink element ++ * Created on: Jul 30, 2009 ++ * Author: Rob Clark <rob@ti.com> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "gststridetransform.h" ++ ++static gboolean ++plugin_init (GstPlugin * plugin) ++{ ++ if (!gst_element_register (plugin, "stridetransform", ++ GST_RANK_PRIMARY, gst_stride_transform_get_type ())) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, ++ GST_VERSION_MINOR, ++ "stridetransform", ++ "Convert video from strided to non-strided, or between different row-strides", ++ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0003-stridetransform-implement-caps-negotiation-and-relat.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0003-stridetransform-implement-caps-negotiation-and-relat.patch new file mode 100644 index 0000000..a574af3 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0003-stridetransform-implement-caps-negotiation-and-relat.patch @@ -0,0 +1,379 @@ +From c235770f9e1c73dc75d6873166bc1ef69770a6c1 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 31 Jul 2009 16:31:42 -0500 +Subject: [PATCH 03/24] stridetransform: implement caps negotiation and related parts + +now all that is left is to implement the actual transform functions +--- + gst-libs/gst/video/video.h | 10 ++ + gst/stride/gststridetransform.c | 190 ++++++++++++++++++++++++++++++--------- + gst/stride/gststridetransform.h | 38 ++++++++ + 3 files changed, 196 insertions(+), 42 deletions(-) + +diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h +index a6a2293..5bac21f 100644 +--- a/gst-libs/gst/video/video.h ++++ b/gst-libs/gst/video/video.h +@@ -356,6 +356,16 @@ typedef enum { + "height = " GST_VIDEO_SIZE_RANGE ", " \ + "framerate = " GST_VIDEO_FPS_RANGE + ++ ++#define GST_VIDEO_CAPS_YUV_STRIDED(fourcc, rowstride) \ ++ GST_VIDEO_CAPS_YUV(fourcc) "; " \ ++ "video/x-raw-yuv-strided, " \ ++ "format = (fourcc) " fourcc ", " \ ++ "rowstride = (int) " rowstride ", " \ ++ "width = " GST_VIDEO_SIZE_RANGE ", " \ ++ "height = " GST_VIDEO_SIZE_RANGE ", " \ ++ "framerate = " GST_VIDEO_FPS_RANGE ++ + /* buffer flags */ + + /** +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 21f2d6e..e31bf11 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -33,7 +33,10 @@ + * <refsect2> + * <title>Example launch lines</title> + * |[ +- * gst-launch ???? TODO ++ * gst-launch videotestsrc ! video/x-raw-yuv,format=(fourcc)YUY2,width=320,height=240,framerate=30/1 ! ++ * stridetransform ! video/x-raw-yuv-strided,format=(fourcc)YUY2,width=320,height=240,rowstride=700,framerate=30/1 ! ++ * stridetransform ! video/x-raw-yuv,format=(fourcc)YUY2,width=320,height=240,framerate=30/1 ! ++ * v4l2sink + * ]| This pipeline ???? TODO + * </refsect2> + */ +@@ -43,8 +46,11 @@ + #include <config.h> + #endif + +-#include "gststridetransform.h" ++#include <string.h> ++#include <gst/video/video.h> ++ + #include "gst/gst-i18n-plugin.h" ++#include "gststridetransform.h" + + + static const GstElementDetails stridetransform_details = +@@ -53,25 +59,44 @@ GST_ELEMENT_DETAILS ("Stride transform", + "Convert between video buffers with and without stride, or with differing stride", + "Rob Clark <rob@ti.com>,"); + ++ ++/* TODO: add rgb formats too! */ ++#define SUPPORTED_CAPS \ ++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2 }", "[ 0, max ]") ++ ++ ++static GstStaticPadTemplate src_template = ++GST_STATIC_PAD_TEMPLATE ("src", ++ GST_PAD_SRC, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS (SUPPORTED_CAPS) ++ ); ++ ++static GstStaticPadTemplate sink_template = ++GST_STATIC_PAD_TEMPLATE ("sink", ++ GST_PAD_SINK, ++ GST_PAD_ALWAYS, ++ GST_STATIC_CAPS (SUPPORTED_CAPS) ++ ); ++ ++ + GST_DEBUG_CATEGORY (stridetransform_debug); + #define GST_CAT_DEFAULT stridetransform_debug + + /* type functions */ +-static void gst_stride_transform_dispose (GObject * obj); ++static void gst_stride_transform_dispose (GObject *obj); + + /* GstBaseTransform functions */ +-static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, +- GstCaps * caps, guint * size); +-static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, +- GstPadDirection direction, GstCaps * caps); +-static void gst_stride_transform_fixate_caps (GstBaseTransform * base, +- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); +-static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, +- GstCaps * incaps, GstCaps * outcaps); +-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, +- GstBuffer * inbuf, GstBuffer * outbuf); +-static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base, +- GstBuffer * buf); ++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, ++ GstCaps *caps, guint *size); ++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, ++ GstPadDirection direction, GstCaps *caps); ++static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, ++ GstCaps *incaps, GstCaps *outcaps); ++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, ++ GstBuffer *inbuf, GstBuffer *outbuf); ++static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform *base, ++ GstBuffer *buf); + + GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); + +@@ -84,10 +109,15 @@ gst_stride_transform_base_init (gpointer g_class) + GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); + + gst_element_class_set_details (gstelement_class, &stridetransform_details); ++ ++ gst_element_class_add_pad_template (gstelement_class, ++ gst_static_pad_template_get (&sink_template)); ++ gst_element_class_add_pad_template (gstelement_class, ++ gst_static_pad_template_get (&src_template)); + } + + static void +-gst_stride_transform_class_init (GstStrideTransformClass * klass) ++gst_stride_transform_class_init (GstStrideTransformClass *klass) + { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); +@@ -98,8 +128,6 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) + GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); + basetransform_class->transform_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); +- basetransform_class->fixate_caps = +- GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps); + basetransform_class->set_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); + basetransform_class->transform_ip = +@@ -111,57 +139,135 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) + } + + static void +-gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass) ++gst_stride_transform_init (GstStrideTransform *self, GstStrideTransformClass *klass) + { + GST_DEBUG_OBJECT (self, "not implemented"); + } + + + static void +-gst_stride_transform_dispose (GObject * object) ++gst_stride_transform_dispose (GObject *object) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); + GST_DEBUG_OBJECT (self, "not implemented"); + G_OBJECT_CLASS (parent_class)->dispose (object); + } + ++/** ++ * figure out the required buffer size based on @caps ++ */ + static gboolean +-gst_stride_transform_get_unit_size (GstBaseTransform * base, +- GstCaps * caps, guint * size) ++gst_stride_transform_get_unit_size (GstBaseTransform *base, ++ GstCaps *caps, guint *size) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); +- return FALSE; ++ GstVideoFormat format; ++ gint width, height, rowstride; ++ ++ g_return_val_if_fail (gst_video_format_parse_caps_strided ( ++ caps, &format, &width, &height, &rowstride), FALSE); ++ ++ *size = gst_video_format_get_size_strided (format, width, height, rowstride); ++ ++ GST_DEBUG_OBJECT (self, ++ "format=%d, width=%d, height=%d, rowstride=%d -> size=%d", ++ format, width, height, rowstride, *size); ++ ++ return TRUE; + } + +-static GstCaps * +-gst_stride_transform_transform_caps (GstBaseTransform * base, +- GstPadDirection direction, GstCaps * caps) ++ ++/** ++ * helper to add all fields, other than rowstride to @caps, copied from @s. ++ */ ++static void ++add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride) + { +- GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); +- return NULL; ++ gint idx; ++ GstStructure *new_s = gst_structure_new (name, NULL); ++ ++ if (rowstride) { ++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // XXX ++ } ++ ++ idx = gst_structure_n_fields (s) - 1; ++ while (idx >= 0) { ++ const gchar *name = gst_structure_nth_field_name (s, idx); ++ if (strcmp ("rowstride", name)) { ++ const GValue *val = gst_structure_get_value (s, name); ++ gst_structure_set_value (new_s, name, val); ++ } ++ idx--; ++ } ++ ++ gst_caps_merge_structure (caps, new_s); + } + +-static void +-gst_stride_transform_fixate_caps (GstBaseTransform * base, +- GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) ++ ++/** ++ * we can transform @caps to strided or non-strided caps with otherwise ++ * identical parameters ++ */ ++static GstCaps * ++gst_stride_transform_transform_caps (GstBaseTransform *base, ++ GstPadDirection direction, GstCaps *caps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); ++ GstCaps *ret; ++ GstStructure *s; ++ ++ g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); ++ ++ GST_DEBUG_OBJECT (self, "direction=%d, caps=%p", direction, caps); ++ LOG_CAPS (self, caps); ++ ++ ret = gst_caps_new_empty (); ++ s = gst_caps_get_structure (caps, 0); ++ ++ if (gst_structure_has_name (s, "video/x-raw-yuv") || ++ gst_structure_has_name (s, "video/x-raw-yuv-strided")) { ++ ++ add_all_fields (ret, "video/x-raw-yuv", s, FALSE); ++ add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE); ++ ++ } else if (gst_structure_has_name (s, "video/x-raw-rgb") || ++ gst_structure_has_name (s, "video/x-raw-rgb-strided")) { ++ ++ add_all_fields (ret, "video/x-raw-rgb", s, FALSE); ++ add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE); ++ ++ } ++ ++ LOG_CAPS (self, ret); ++ ++ return ret; + } + ++/** ++ * at this point, we have identical fourcc, width, and height for @incaps ++ * and @outcaps.. so we need to extract these to use for transforming, ++ * plus the requested rowstride of the @incaps and @outcaps ++ */ + static gboolean +-gst_stride_transform_set_caps (GstBaseTransform * base, +- GstCaps * incaps, GstCaps * outcaps) ++gst_stride_transform_set_caps (GstBaseTransform *base, ++ GstCaps *incaps, GstCaps *outcaps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); +- return FALSE; ++ ++ LOG_CAPS (self, incaps); ++ LOG_CAPS (self, outcaps); ++ ++ g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, ++ &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); ++ g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, ++ NULL, NULL, NULL, &self->out_rowstride), FALSE); ++ ++ return TRUE; + } + +-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, +- GstBuffer * inbuf, GstBuffer * outbuf) ++static GstFlowReturn ++gst_stride_transform_transform (GstBaseTransform *base, ++ GstBuffer *inbuf, GstBuffer *outbuf) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); +@@ -169,8 +275,8 @@ static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, + } + + static GstFlowReturn +-gst_stride_transform_transform_ip (GstBaseTransform * base, +- GstBuffer * buf) ++gst_stride_transform_transform_ip (GstBaseTransform *base, ++ GstBuffer *buf) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +index b4f7d59..d80197f 100644 +--- a/gst/stride/gststridetransform.h ++++ b/gst/stride/gststridetransform.h +@@ -27,6 +27,8 @@ + + + #include <gst/video/gstvideofilter.h> ++#include <gst/video/video.h> ++ + + G_BEGIN_DECLS + +@@ -52,6 +54,11 @@ typedef struct _GstStrideTransformClass GstStrideTransformClass; + struct _GstStrideTransform { + GstVideoFilter videofilter; + ++ /*< private >*/ ++ GstVideoFormat format; ++ gint width, height; ++ gint in_rowstride; ++ gint out_rowstride; + }; + + struct _GstStrideTransformClass { +@@ -63,4 +70,35 @@ GType gst_stride_transform_get_type (void); + G_END_DECLS + + ++ ++ ++/* note: in case this is a build with TTIF logging, we can optimize slightly ++ * and avoid the gst_caps_to_string() in case logging isn't enabled by using ++ * the TTIF_TRACE_ARG_PROCESSOR feature of ttif_trace_fprintf(): ++ */ ++#ifdef GST_LOG_OVER_TTIF ++# define LOG_CAPS(obj, caps) G_STMT_START { \ ++ if (caps) { \ ++ static TTIF_TRACE_ARG_PROCESSOR proc = { \ ++ .convert = (char (*)(void *))gst_caps_to_string, \ ++ .free = (void (*)(char *))g_free \ ++ }; \ ++ GST_DEBUG_OBJECT (obj, "%s: %qs", #caps, &proc, (caps)); \ ++ } else { \ ++ GST_DEBUG_OBJECT (obj, "null"); \ ++ } \ ++ } G_STMT_END ++#else ++# define LOG_CAPS(obj, caps) G_STMT_START { \ ++ if (caps) { \ ++ gchar *capstr = gst_caps_to_string (caps); \ ++ GST_DEBUG_OBJECT (obj, "%s: %s", #caps, capstr); \ ++ g_free (capstr); \ ++ } else { \ ++ GST_DEBUG_OBJECT (obj, "null"); \ ++ } \ ++ } G_STMT_END ++#endif ++ ++ + #endif /* __GSTSTRIDETRANSFORM_H__ */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0004-stridetransform-implement-transform-function.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0004-stridetransform-implement-transform-function.patch new file mode 100644 index 0000000..3c9587b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0004-stridetransform-implement-transform-function.patch @@ -0,0 +1,215 @@ +From 44d68a183355bce2dd7b6c890f67420ab300e0b4 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 31 Jul 2009 17:39:47 -0500 +Subject: [PATCH 04/24] stridetransform: implement transform function + +Still needed are a few details, like conversion from one stride to another (instead of just strided->nonstrided or visa versa), and support for RGB and more YUV color formats. +--- + gst/stride/gststridetransform.c | 163 +++++++++++++++++++++++++++++++++++++-- + 1 files changed, 157 insertions(+), 6 deletions(-) + +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index e31bf11..a911cd0 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -187,7 +187,7 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + GstStructure *new_s = gst_structure_new (name, NULL); + + if (rowstride) { +- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // XXX ++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // TODO + } + + idx = gst_structure_n_fields (s) - 1; +@@ -253,6 +253,8 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + GstCaps *incaps, GstCaps *outcaps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ GstVideoFormat format; ++ gint width, height; + + LOG_CAPS (self, incaps); + LOG_CAPS (self, outcaps); +@@ -260,17 +262,166 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, + &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); + g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, +- NULL, NULL, NULL, &self->out_rowstride), FALSE); ++ &format, &width, &height, &self->out_rowstride), FALSE); ++ ++ g_return_val_if_fail (self->format == format, FALSE); ++ g_return_val_if_fail (self->width == width, FALSE); ++ g_return_val_if_fail (self->height == height, FALSE); + + return TRUE; + } + ++/* ************************************************************************* */ ++ ++/** ++ * Convert from one stride to another... like memmove, but can convert stride in ++ * the process. This function is not aware of pixels, only of bytes. So widths ++ * are given in bytes, not pixels. The new_buf and orig_buf can point to the ++ * same buffers to do an in-place conversion, but the buffer should be large ++ * enough. ++ */ ++static void ++stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) ++{ ++ int row; ++ ++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", ++ new_buf, orig_buf, new_width, orig_width, height); ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_width > orig_width) { ++ for (row=height-1; row>=0; row--) { ++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ } ++ } else { ++ for (row=0; row<height; row++) { ++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ } ++ } ++} ++ ++ ++/** ++ * Convert from a non-strided buffer to strided. The two buffer pointers could ++ * be pointing to the same memory block for in-place transform.. assuming that ++ * the buffer is large enough ++ * ++ * @strided: the pointer to the resulting strided buffer ++ * @unstrided: the pointer to the initial unstrided buffer ++ * @fourcc: the color format ++ * @stride: the stride, in bytes ++ * @width: the width in pixels ++ * @height: the height in pixels ++ */ ++static GstFlowReturn ++stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ switch (self->format) { ++#if 0 /* TODO */ ++ case GST_VIDEO_FORMAT_NV12: ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ stridemove (strided, unstrided, stride, width, height * 1.5); ++ return GST_FLOW_OK; ++#endif ++ case GST_VIDEO_FORMAT_I420: ++ case GST_VIDEO_FORMAT_YV12: ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ stridemove ( ++ strided + (int)(height*stride*1.5), ++ unstrided + (int)(height*width*1.5), ++ stride, width/2, height); /* move U/V */ ++ stridemove ( ++ strided + (height*stride), ++ unstrided + (height*width), ++ stride, width/2, height); /* move V/U */ ++ stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ return GST_FLOW_OK; ++ case GST_VIDEO_FORMAT_YUY2: ++ case GST_VIDEO_FORMAT_UYVY: ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ stridemove (strided, unstrided, stride, width*2, height); ++ return GST_FLOW_OK; ++ default: ++ GST_WARNING ("unknown color format!\n"); ++ return GST_FLOW_ERROR; ++ } ++} ++ ++ ++/** ++ * Convert from a strided buffer to non-strided. The two buffer pointers could ++ * be pointing to the same memory block for in-place transform.. ++ * ++ * @unstrided: the pointer to the resulting unstrided buffer ++ * @strided: the pointer to the initial strided buffer ++ */ ++static GstFlowReturn ++unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; ++ ++ switch (self->format) { ++#if 0 /* TODO */ ++ case GST_VIDEO_FORMAT_NV12: ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ stridemove (unstrided, strided, width, stride, height * 1.5); ++ return GST_FLOW_OK; ++#endif ++ case GST_VIDEO_FORMAT_I420: ++ case GST_VIDEO_FORMAT_YV12: ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ stridemove (unstrided, strided, width, stride, height); /* move Y */ ++ stridemove ( ++ unstrided + (height*width), ++ strided + (height*stride), ++ width/2, stride, height); /* move V/U */ ++ stridemove ( ++ unstrided + (int)(height*width*1.5), ++ strided + (int)(height*stride*1.5), ++ width/2, stride, height); /* move U/V */ ++ return GST_FLOW_OK; ++ case GST_VIDEO_FORMAT_YUY2: ++ case GST_VIDEO_FORMAT_UYVY: ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ stridemove (unstrided, strided, width*2, stride, height); ++ return GST_FLOW_OK; ++ default: ++ GST_WARNING ("unknown color format!\n"); ++ return GST_FLOW_ERROR; ++ } ++} ++ ++ + static GstFlowReturn + gst_stride_transform_transform (GstBaseTransform *base, + GstBuffer *inbuf, GstBuffer *outbuf) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); ++ ++ GST_DEBUG_OBJECT (self, "inbuf=%p, outbuf=%p", inbuf, outbuf); ++ ++ if (self->in_rowstride && self->out_rowstride) { ++ GST_DEBUG_OBJECT (self, "not implemented"); // TODO ++ return GST_FLOW_ERROR; ++ } else if (self->in_rowstride) { ++ return unstridify (self, ++ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); ++ } else if (self->out_rowstride) { ++ return stridify (self, ++ GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); ++ } ++ ++ GST_DEBUG_OBJECT (self, "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", ++ self->in_rowstride, self->out_rowstride); ++ + return GST_FLOW_ERROR; + } + +@@ -278,7 +429,7 @@ static GstFlowReturn + gst_stride_transform_transform_ip (GstBaseTransform *base, + GstBuffer *buf) + { +- GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GST_DEBUG_OBJECT (self, "not implemented"); +- return GST_FLOW_ERROR; ++ /* transform function is safe to call with same buffer ptr: ++ */ ++ return gst_stride_transform_transform (base, buf, buf); + } +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0005-add-gst_stride_transform_transform_size.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0005-add-gst_stride_transform_transform_size.patch new file mode 100644 index 0000000..9f50d7b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0005-add-gst_stride_transform_transform_size.patch @@ -0,0 +1,143 @@ +From c1b33e01fa6fa867b950ba0e6f4426e5a878cbe7 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sun, 16 Aug 2009 21:04:40 -0500 +Subject: [PATCH 05/24] add gst_stride_transform_transform_size() + +input buffer size and output buffer size many not be multiples of a common unit size, so the transform_size() method should be used +--- + gst/stride/gststridetransform.c | 38 ++++++++++++++++++++++++++++++++++++-- + gst/stride/gststridetransform.h | 34 +++++----------------------------- + 2 files changed, 41 insertions(+), 31 deletions(-) + +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index a911cd0..adc22ce 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -62,7 +62,7 @@ GST_ELEMENT_DETAILS ("Stride transform", + + /* TODO: add rgb formats too! */ + #define SUPPORTED_CAPS \ +- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2 }", "[ 0, max ]") ++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY }", "[ 0, max ]") + + + static GstStaticPadTemplate src_template = +@@ -89,6 +89,10 @@ static void gst_stride_transform_dispose (GObject *obj); + /* GstBaseTransform functions */ + static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, + GstCaps *caps, guint *size); ++static gboolean gst_stride_transform_transform_size (GstBaseTransform *base, ++ GstPadDirection direction, ++ GstCaps *caps, guint size, ++ GstCaps *othercaps, guint *othersize); + static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, + GstPadDirection direction, GstCaps *caps); + static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, +@@ -126,6 +130,8 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) + + basetransform_class->get_unit_size = + GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); ++ basetransform_class->transform_size = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_size); + basetransform_class->transform_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); + basetransform_class->set_caps = +@@ -176,6 +182,34 @@ gst_stride_transform_get_unit_size (GstBaseTransform *base, + return TRUE; + } + ++/** ++ * Default transform_size function is no good, as it assumes that the output ++ * buffer size is a multiple of the unit size.. which doesn't hold true. ++ */ ++static gboolean ++gst_stride_transform_transform_size (GstBaseTransform *base, ++ GstPadDirection direction, ++ GstCaps *caps, guint size, ++ GstCaps *othercaps, guint *othersize) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); ++ guint idx = (direction == GST_PAD_SINK) ? 0 : 1; ++ ++ if (self->cached_caps[idx] != othercaps) ++ { ++ if (!gst_stride_transform_get_unit_size (base, othercaps, ++ &(self->cached_size[idx]))) ++ { ++ return FALSE; ++ } ++ } ++ ++ *othersize = self->cached_size[idx]; ++ ++ return TRUE; ++} ++ ++ + + /** + * helper to add all fields, other than rowstride to @caps, copied from @s. +@@ -187,7 +221,7 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + GstStructure *new_s = gst_structure_new (name, NULL); + + if (rowstride) { +- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, 1000, NULL); // TODO ++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + } + + idx = gst_structure_n_fields (s) - 1; +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +index d80197f..481959e 100644 +--- a/gst/stride/gststridetransform.h ++++ b/gst/stride/gststridetransform.h +@@ -59,6 +59,10 @@ struct _GstStrideTransform { + gint width, height; + gint in_rowstride; + gint out_rowstride; ++ ++ /* for caching the tranform_size() results.. */ ++ GstCaps *cached_caps[2]; ++ guint cached_size[2]; + }; + + struct _GstStrideTransformClass { +@@ -70,35 +74,7 @@ GType gst_stride_transform_get_type (void); + G_END_DECLS + + +- +- +-/* note: in case this is a build with TTIF logging, we can optimize slightly +- * and avoid the gst_caps_to_string() in case logging isn't enabled by using +- * the TTIF_TRACE_ARG_PROCESSOR feature of ttif_trace_fprintf(): +- */ +-#ifdef GST_LOG_OVER_TTIF +-# define LOG_CAPS(obj, caps) G_STMT_START { \ +- if (caps) { \ +- static TTIF_TRACE_ARG_PROCESSOR proc = { \ +- .convert = (char (*)(void *))gst_caps_to_string, \ +- .free = (void (*)(char *))g_free \ +- }; \ +- GST_DEBUG_OBJECT (obj, "%s: %qs", #caps, &proc, (caps)); \ +- } else { \ +- GST_DEBUG_OBJECT (obj, "null"); \ +- } \ +- } G_STMT_END +-#else +-# define LOG_CAPS(obj, caps) G_STMT_START { \ +- if (caps) { \ +- gchar *capstr = gst_caps_to_string (caps); \ +- GST_DEBUG_OBJECT (obj, "%s: %s", #caps, capstr); \ +- g_free (capstr); \ +- } else { \ +- GST_DEBUG_OBJECT (obj, "null"); \ +- } \ +- } G_STMT_END +-#endif ++#define LOG_CAPS(obj, caps) GST_DEBUG_OBJECT (obj, "%s: %"GST_PTR_FORMAT, #caps, caps) + + + #endif /* __GSTSTRIDETRANSFORM_H__ */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch new file mode 100644 index 0000000..95c7bec --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0006-fix-a-small-typo.-need-to-use-the-smaller-of-new_wid.patch @@ -0,0 +1,36 @@ +From db7698656e71dc4a898fec9e46ae6c9d04352447 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 19 Aug 2009 15:33:50 -0500 +Subject: [PATCH 06/24] fix a small typo.. need to use the smaller of {new_width, orig_width} for the line-by-line copy to avoid overwriting past end of buffer + +--- + gst/stride/gststridetransform.c | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index adc22ce..ea52500 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -331,7 +331,7 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, + } + } else { + for (row=0; row<height; row++) { +- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); + } + } + } +@@ -440,7 +440,9 @@ gst_stride_transform_transform (GstBaseTransform *base, + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + +- GST_DEBUG_OBJECT (self, "inbuf=%p, outbuf=%p", inbuf, outbuf); ++ GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", ++ inbuf, GST_BUFFER_SIZE (inbuf), ++ outbuf, GST_BUFFER_SIZE (outbuf)); + + if (self->in_rowstride && self->out_rowstride) { + GST_DEBUG_OBJECT (self, "not implemented"); // TODO +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0007-Add-NV12-support-in-stridetransform.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0007-Add-NV12-support-in-stridetransform.patch new file mode 100644 index 0000000..2fcaea7 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0007-Add-NV12-support-in-stridetransform.patch @@ -0,0 +1,77 @@ +From f392c3f35052b57343e814d8f2d52b4f788d5d45 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 20 Nov 2009 18:43:12 -0600 +Subject: [PATCH 07/24] Add NV12 support in stridetransform + +--- + gst-libs/gst/video/video.c | 3 +++ + gst/stride/gststridetransform.c | 12 ++++-------- + 2 files changed, 7 insertions(+), 8 deletions(-) + +diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c +index 24f1ac8..ff9c4fb 100644 +--- a/gst-libs/gst/video/video.c ++++ b/gst-libs/gst/video/video.c +@@ -2025,6 +2025,9 @@ gst_video_format_get_size_strided (GstVideoFormat format, + case GST_VIDEO_FORMAT_Y42B: + case GST_VIDEO_FORMAT_Y444: + return GST_ROUND_UP_4 (3 * rowstride * height); ++ case GST_VIDEO_FORMAT_NV12: ++ case GST_VIDEO_FORMAT_NV21: ++ return GST_ROUND_UP_4 (rowstride) * GST_ROUND_UP_2 (height) * 3 / 2; + default: + return 0; + } +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index ea52500..56207d0 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -2,7 +2,7 @@ + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * +- * Description: V4L2 sink element ++ * Description: stride transform element + * Created on: Jul 30, 2009 + * Author: Rob Clark <rob@ti.com> + * +@@ -62,7 +62,7 @@ GST_ELEMENT_DETAILS ("Stride transform", + + /* TODO: add rgb formats too! */ + #define SUPPORTED_CAPS \ +- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY }", "[ 0, max ]") ++ GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") + + + static GstStaticPadTemplate src_template = +@@ -357,12 +357,10 @@ stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) + gint stride = self->out_rowstride; + + switch (self->format) { +-#if 0 /* TODO */ + case GST_VIDEO_FORMAT_NV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (strided, unstrided, stride, width, height * 1.5); ++ stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); + return GST_FLOW_OK; +-#endif + case GST_VIDEO_FORMAT_I420: + case GST_VIDEO_FORMAT_YV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +@@ -403,12 +401,10 @@ unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) + gint stride = self->in_rowstride; + + switch (self->format) { +-#if 0 /* TODO */ + case GST_VIDEO_FORMAT_NV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (unstrided, strided, width, stride, height * 1.5); ++ stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); + return GST_FLOW_OK; +-#endif + case GST_VIDEO_FORMAT_I420: + case GST_VIDEO_FORMAT_YV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch new file mode 100644 index 0000000..63cd16a --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0008-add-basic-support-for-I420-NV12-colorspace-conversio.patch @@ -0,0 +1,186 @@ +From 4b74d1b679855e8c709fde124fd9f0027ba8d916 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 27 Nov 2009 11:13:47 -0600 +Subject: [PATCH 08/24] add basic support for I420->NV12 colorspace conversion + +--- + gst/stride/gststridetransform.c | 109 ++++++++++++++++++++++++++++++++++++--- + gst/stride/gststridetransform.h | 2 +- + 2 files changed, 103 insertions(+), 8 deletions(-) + +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 56207d0..03deeb1 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -227,11 +227,43 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + idx = gst_structure_n_fields (s) - 1; + while (idx >= 0) { + const gchar *name = gst_structure_nth_field_name (s, idx); ++ idx--; ++ if (!strcmp ("format", name)) { ++ // we can do simple color format translations, such as converting from one ++ // YUV420 format to another: ++ GValue formats = {0}; ++ GValue fourccval = {0}; ++ guint fourcc; ++ if (gst_structure_get_fourcc (s, name, &fourcc)) { ++ switch (gst_video_format_from_fourcc (fourcc)) { ++ case GST_VIDEO_FORMAT_NV12: ++ case GST_VIDEO_FORMAT_I420: ++GST_DEBUG ("Hmm, let's say I can convert I420<-->NV12.."); ++ g_value_init (&formats, GST_TYPE_LIST); ++ g_value_init (&fourccval, GST_TYPE_FOURCC); ++ gst_value_set_fourcc (&fourccval, ++ GST_MAKE_FOURCC ('I', '4', '2', '0')); ++ gst_value_list_append_value (&formats, &fourccval); ++ gst_value_set_fourcc (&fourccval, ++ GST_MAKE_FOURCC ('N', 'V', '1', '2')); ++ gst_value_list_append_value (&formats, &fourccval); ++ gst_structure_set_value (new_s, "format", &formats); ++ continue; ++/* maybe handle other cases later.. ++ case GST_VIDEO_FORMAT_YV12: ++ case GST_VIDEO_FORMAT_YUY2: ++ case GST_VIDEO_FORMAT_UYVY: ++*/ ++ default: ++ break; ++ } ++ } ++ } ++ + if (strcmp ("rowstride", name)) { + const GValue *val = gst_structure_get_value (s, name); + gst_structure_set_value (new_s, name, val); + } +- idx--; + } + + gst_caps_merge_structure (caps, new_s); +@@ -287,18 +319,16 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + GstCaps *incaps, GstCaps *outcaps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GstVideoFormat format; + gint width, height; + + LOG_CAPS (self, incaps); + LOG_CAPS (self, outcaps); + + g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, +- &self->format, &self->width, &self->height, &self->in_rowstride), FALSE); ++ &self->in_format, &self->width, &self->height, &self->in_rowstride), FALSE); + g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, +- &format, &width, &height, &self->out_rowstride), FALSE); ++ &self->out_format, &width, &height, &self->out_rowstride), FALSE); + +- g_return_val_if_fail (self->format == format, FALSE); + g_return_val_if_fail (self->width == width, FALSE); + g_return_val_if_fail (self->height == height, FALSE); + +@@ -307,6 +337,49 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + + /* ************************************************************************* */ + ++static void ++memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) ++{ ++ if (new_buf > orig_buf) { ++ /* copy backwards */ ++ new_buf += (sz * pxstride); ++ orig_buf += sz; ++ while(sz--) { ++ *new_buf = *orig_buf; ++ new_buf -= pxstride; ++ orig_buf--; ++ } ++ } else { ++ while(sz--) { ++ *new_buf = *orig_buf; ++ new_buf += pxstride; ++ orig_buf++; ++ } ++ } ++} ++ ++static void ++stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) ++{ ++ int row; ++ ++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", ++ new_buf, orig_buf, new_width, orig_width, height); ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_width > orig_width) { ++ for (row=height-1; row>=0; row--) { ++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); ++ } ++ } else { ++ for (row=0; row<height; row++) { ++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); ++ } ++ } ++} ++ + /** + * Convert from one stride to another... like memmove, but can convert stride in + * the process. This function is not aware of pixels, only of bytes. So widths +@@ -356,7 +429,29 @@ stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) + gint height = self->height; + gint stride = self->out_rowstride; + +- switch (self->format) { ++ if (self->out_format != self->in_format) { ++ ++ if ((self->in_format == GST_VIDEO_FORMAT_I420) && ++ (self->out_format == GST_VIDEO_FORMAT_NV12)) { ++ /* note: if not an in-place conversion, then doing the U&V in one pass ++ * would be more efficient... but if it is an in-place conversion, I'd ++ * need to think about whether it is potential for the new UV plane to ++ * corrupt the V plane before it is done copying.. ++ */ ++ stridemove_demux ( ++ strided + (height*stride) + 1, ++ unstrided + (int)(height*width*1.25), ++ stride, width/2, height/2, 2); /* move V */ ++ stridemove_demux ( ++ strided + (height*stride), ++ unstrided + (height*width), ++ stride, width/2, height/2, 2); /* move U */ ++ stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ return GST_FLOW_OK; ++ } ++ } ++ ++ switch (self->out_format) { + case GST_VIDEO_FORMAT_NV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); +@@ -400,7 +495,7 @@ unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) + gint height = self->height; + gint stride = self->in_rowstride; + +- switch (self->format) { ++ switch (self->out_format) { + case GST_VIDEO_FORMAT_NV12: + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +index 481959e..0141571 100644 +--- a/gst/stride/gststridetransform.h ++++ b/gst/stride/gststridetransform.h +@@ -55,7 +55,7 @@ struct _GstStrideTransform { + GstVideoFilter videofilter; + + /*< private >*/ +- GstVideoFormat format; ++ GstVideoFormat in_format, out_format; + gint width, height; + gint in_rowstride; + gint out_rowstride; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0009-fix-to-avoid-parsing-caps-on-every-frame.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0009-fix-to-avoid-parsing-caps-on-every-frame.patch new file mode 100644 index 0000000..dab77a5 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0009-fix-to-avoid-parsing-caps-on-every-frame.patch @@ -0,0 +1,35 @@ +From 8132aecf99071faab59739ebabd7bcd41a2ab581 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 27 Nov 2009 11:14:58 -0600 +Subject: [PATCH 09/24] fix to avoid parsing caps on every frame + +--- + gst/stride/gststridetransform.c | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 03deeb1..143a9f7 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -197,11 +197,15 @@ gst_stride_transform_transform_size (GstBaseTransform *base, + + if (self->cached_caps[idx] != othercaps) + { +- if (!gst_stride_transform_get_unit_size (base, othercaps, +- &(self->cached_size[idx]))) +- { ++ guint sz; ++ if (!gst_stride_transform_get_unit_size (base, othercaps, &sz)) { + return FALSE; + } ++ if (self->cached_caps[idx]) { ++ gst_caps_unref (self->cached_caps[idx]); ++ } ++ self->cached_size[idx] = sz; ++ self->cached_caps[idx] = gst_caps_ref (othercaps); + } + + *othersize = self->cached_size[idx]; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch new file mode 100644 index 0000000..b378965 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0010-refactor-stridetransform-to-make-it-easier-to-add-ne.patch @@ -0,0 +1,759 @@ +From c854bfe87a39d640dfd3381bcba83281d9316b50 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 27 Nov 2009 15:05:56 -0600 +Subject: [PATCH 10/24] refactor stridetransform to make it easier to add new transforms (stride and/or colorspace) + +--- + gst/stride/Makefile.am | 1 + + gst/stride/convert.c | 267 +++++++++++++++++++++++++++++++++++ + gst/stride/gststridetransform.c | 295 ++++++++------------------------------- + gst/stride/gststridetransform.h | 18 ++- + 4 files changed, 340 insertions(+), 241 deletions(-) + create mode 100644 gst/stride/convert.c + +diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am +index 1adc197..0b61d55 100644 +--- a/gst/stride/Makefile.am ++++ b/gst/stride/Makefile.am +@@ -2,6 +2,7 @@ plugin_LTLIBRARIES = libgststridetransform.la + + libgststridetransform_la_SOURCES = \ + gststridetransform.c \ ++ convert.c \ + plugin.c + + libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +new file mode 100644 +index 0000000..860f16c +--- /dev/null ++++ b/gst/stride/convert.c +@@ -0,0 +1,267 @@ ++/* GStreamer ++ * ++ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++ * ++ * Description: stride transform conversion utilities ++ * Created on: Nov 27, 2009 ++ * Author: Rob Clark <rob@ti.com> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include <string.h> ++#include <gst/video/video.h> ++ ++#include "gststridetransform.h" ++ ++ ++GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); ++#define GST_CAT_DEFAULT stridetransform_debug ++ ++ ++/* ++ * Conversion utilities: ++ */ ++ ++static void ++memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) ++{ ++ if (new_buf > orig_buf) { ++ /* copy backwards */ ++ new_buf += ((sz - 1) * pxstride); ++ orig_buf += sz - 1; ++ while(sz--) { ++ *new_buf = *orig_buf; ++ new_buf -= pxstride; ++ orig_buf--; ++ } ++ } else { ++ while(sz--) { ++ *new_buf = *orig_buf; ++ new_buf += pxstride; ++ orig_buf++; ++ } ++ } ++} ++ ++static void ++stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) ++{ ++ int row; ++ ++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", ++ new_buf, orig_buf, new_width, orig_width, height); ++ ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_width > orig_width) { ++ for (row=height-1; row>=0; row--) { ++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); ++ } ++ } else { ++ for (row=0; row<height; row++) { ++ memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); ++ } ++ } ++} ++ ++/** ++ * Convert from one stride to another... like memmove, but can convert stride in ++ * the process. This function is not aware of pixels, only of bytes. So widths ++ * are given in bytes, not pixels. The new_buf and orig_buf can point to the ++ * same buffers to do an in-place conversion, but the buffer should be large ++ * enough. ++ */ ++static void ++stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) ++{ ++ int row; ++ ++ GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", ++ new_buf, orig_buf, new_width, orig_width, height); ++ ++ /* if increasing the stride, work from bottom-up to avoid overwriting data ++ * that has not been moved yet.. otherwise, work in the opposite order, ++ * for the same reason. ++ */ ++ if (new_width > orig_width) { ++ for (row=height-1; row>=0; row--) { ++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ } ++ } else { ++ for (row=0; row<height; row++) { ++ memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); ++ } ++ } ++} ++ ++/* ++ * Conversion Functions: ++ */ ++ ++/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ ++static GstFlowReturn ++unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ stridemove (unstrided, strided, width, stride, ++ (GST_ROUND_UP_2 (height) * 3) / 2); ++ ++ return GST_FLOW_OK; ++} ++static GstFlowReturn ++stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ stridemove (strided, unstrided, stride, width, ++ (GST_ROUND_UP_2 (height) * 3) / 2); ++ ++ return GST_FLOW_OK; ++} ++ ++/** convert 4:2:0 planar to same 4:2:0 planar */ ++static GstFlowReturn ++unstridify_420p_420p (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ stridemove (unstrided, strided, width, stride, height); /* move Y */ ++ stridemove ( ++ unstrided + (height*width), ++ strided + (height*stride), ++ width/2, stride, height); /* move V/U */ ++ /* XXX odd widths/heights/strides: */ ++ stridemove ( ++ unstrided + (int)(height*width*1.5), ++ strided + (int)(height*stride*1.5), ++ width/2, stride, height); /* move U/V */ ++ ++ return GST_FLOW_OK; ++} ++static GstFlowReturn ++stridify_420p_420p (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ /* XXX odd widths/heights/strides: */ ++ stridemove ( ++ strided + (int)(height*stride*1.5), ++ unstrided + (int)(height*width*1.5), ++ stride, width/2, height); /* move U/V */ ++ stridemove ( ++ strided + (height*stride), ++ unstrided + (height*width), ++ stride, width/2, height); /* move V/U */ ++ stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ ++ return GST_FLOW_OK; ++} ++ ++/** convert 4:2:2 packed to same 4:2:2 packed */ ++static GstFlowReturn ++unstridify_422i_422i (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; ++ ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ ++ stridemove (unstrided, strided, width*2, stride, height); ++ ++ return GST_FLOW_OK; ++} ++static GstFlowReturn ++stridify_422i_422i (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ ++ stridemove (strided, unstrided, stride, width*2, height); ++ ++ return GST_FLOW_OK; ++} ++ ++/** convert I420 unstrided to NV12 strided */ ++static GstFlowReturn ++stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ /* note: if not an in-place conversion, then doing the U&V in one pass ++ * would be more efficient... but if it is an in-place conversion, I'd ++ * need to think about whether it is potential for the new UV plane to ++ * corrupt the V plane before it is done copying.. ++ */ ++ stridemove_demux ( ++ strided + (height*stride) + 1, ++ unstrided + (int)(height*width*1.25), ++ stride, width/2, height/2, 2); /* move V */ ++ stridemove_demux ( ++ strided + (height*stride), ++ unstrided + (height*width), ++ stride, width/2, height/2, 2); /* move U */ ++ stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ ++ return GST_FLOW_OK; ++} ++ ++/* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ ++Conversion stride_conversions[] = { ++ { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, ++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_I420 }, stridify_420p_420p, unstridify_420p_420p }, ++ { { GST_VIDEO_FORMAT_YV12, GST_VIDEO_FORMAT_YV12 }, stridify_420p_420p, unstridify_420p_420p }, ++ { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, ++ { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, ++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, ++ /* add new entries before here */ ++ { { GST_VIDEO_FORMAT_UNKNOWN } } ++}; ++ ++ +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 143a9f7..6ab0479 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -47,12 +47,17 @@ + #endif + + #include <string.h> ++ + #include <gst/video/video.h> + + #include "gst/gst-i18n-plugin.h" + #include "gststridetransform.h" + + ++/* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ ++extern const Conversion stride_conversions[]; ++ ++ + static const GstElementDetails stridetransform_details = + GST_ELEMENT_DETAILS ("Stride transform", + "Filter/Converter/Video", +@@ -70,14 +75,14 @@ GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SUPPORTED_CAPS) +- ); ++); + + static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (SUPPORTED_CAPS) +- ); ++); + + + GST_DEBUG_CATEGORY (stridetransform_debug); +@@ -99,8 +104,6 @@ static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, + GstCaps *incaps, GstCaps *outcaps); + static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, + GstBuffer *inbuf, GstBuffer *outbuf); +-static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform *base, +- GstBuffer *buf); + + GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); + +@@ -136,8 +139,6 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) + GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); + basetransform_class->set_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); +- basetransform_class->transform_ip = +- GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip); + basetransform_class->transform = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform); + +@@ -219,7 +220,7 @@ gst_stride_transform_transform_size (GstBaseTransform *base, + * helper to add all fields, other than rowstride to @caps, copied from @s. + */ + static void +-add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride) ++add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride, GstPadDirection direction) + { + gint idx; + GstStructure *new_s = gst_structure_new (name, NULL); +@@ -232,38 +233,39 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + while (idx >= 0) { + const gchar *name = gst_structure_nth_field_name (s, idx); + idx--; ++ ++ /* for format field, check the stride_conversions table to see what ++ * we can support: ++ */ + if (!strcmp ("format", name)) { +- // we can do simple color format translations, such as converting from one +- // YUV420 format to another: +- GValue formats = {0}; +- GValue fourccval = {0}; + guint fourcc; +- if (gst_structure_get_fourcc (s, name, &fourcc)) { +- switch (gst_video_format_from_fourcc (fourcc)) { +- case GST_VIDEO_FORMAT_NV12: +- case GST_VIDEO_FORMAT_I420: +-GST_DEBUG ("Hmm, let's say I can convert I420<-->NV12.."); +- g_value_init (&formats, GST_TYPE_LIST); +- g_value_init (&fourccval, GST_TYPE_FOURCC); +- gst_value_set_fourcc (&fourccval, +- GST_MAKE_FOURCC ('I', '4', '2', '0')); +- gst_value_list_append_value (&formats, &fourccval); +- gst_value_set_fourcc (&fourccval, +- GST_MAKE_FOURCC ('N', 'V', '1', '2')); ++ ++ /* XXX double check this: */ ++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; ++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; ++ ++ if (gst_structure_get_fourcc (s, "format", &fourcc)) { ++ GValue formats = {0}; ++ GValue fourccval = {0}; ++ gint i; ++ GstVideoFormat format = gst_video_format_from_fourcc (fourcc); ++ ++ g_value_init (&formats, GST_TYPE_LIST); ++ g_value_init (&fourccval, GST_TYPE_FOURCC); ++ ++ for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { ++ if (stride_conversions[i].format[from_format] == format) { ++ gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc ++ (stride_conversions[i].format[to_format])); + gst_value_list_append_value (&formats, &fourccval); +- gst_structure_set_value (new_s, "format", &formats); +- continue; +-/* maybe handle other cases later.. +- case GST_VIDEO_FORMAT_YV12: +- case GST_VIDEO_FORMAT_YUY2: +- case GST_VIDEO_FORMAT_UYVY: +-*/ +- default: +- break; ++ } + } ++ ++ continue; + } + } + ++ /* copy over all other non-rowstride fields: */ + if (strcmp ("rowstride", name)) { + const GValue *val = gst_structure_get_value (s, name); + gst_structure_set_value (new_s, name, val); +@@ -297,14 +299,14 @@ gst_stride_transform_transform_caps (GstBaseTransform *base, + if (gst_structure_has_name (s, "video/x-raw-yuv") || + gst_structure_has_name (s, "video/x-raw-yuv-strided")) { + +- add_all_fields (ret, "video/x-raw-yuv", s, FALSE); +- add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE); ++ add_all_fields (ret, "video/x-raw-yuv", s, FALSE, direction); ++ add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE, direction); + + } else if (gst_structure_has_name (s, "video/x-raw-rgb") || + gst_structure_has_name (s, "video/x-raw-rgb-strided")) { + +- add_all_fields (ret, "video/x-raw-rgb", s, FALSE); +- add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE); ++ add_all_fields (ret, "video/x-raw-rgb", s, FALSE, direction); ++ add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE, direction); + + } + +@@ -324,211 +326,37 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + gint width, height; ++ GstVideoFormat in_format, out_format; ++ gint i; + + LOG_CAPS (self, incaps); + LOG_CAPS (self, outcaps); + + g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, +- &self->in_format, &self->width, &self->height, &self->in_rowstride), FALSE); ++ &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); + g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, +- &self->out_format, &width, &height, &self->out_rowstride), FALSE); +- +- g_return_val_if_fail (self->width == width, FALSE); +- g_return_val_if_fail (self->height == height, FALSE); +- +- return TRUE; +-} +- +-/* ************************************************************************* */ +- +-static void +-memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) +-{ +- if (new_buf > orig_buf) { +- /* copy backwards */ +- new_buf += (sz * pxstride); +- orig_buf += sz; +- while(sz--) { +- *new_buf = *orig_buf; +- new_buf -= pxstride; +- orig_buf--; +- } +- } else { +- while(sz--) { +- *new_buf = *orig_buf; +- new_buf += pxstride; +- orig_buf++; +- } +- } +-} +- +-static void +-stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) +-{ +- int row; +- +- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", +- new_buf, orig_buf, new_width, orig_width, height); +- /* if increasing the stride, work from bottom-up to avoid overwriting data +- * that has not been moved yet.. otherwise, work in the opposite order, +- * for the same reason. +- */ +- if (new_width > orig_width) { +- for (row=height-1; row>=0; row--) { +- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); +- } +- } else { +- for (row=0; row<height; row++) { +- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); +- } +- } +-} ++ &out_format, &width, &height, &self->out_rowstride), FALSE); + +-/** +- * Convert from one stride to another... like memmove, but can convert stride in +- * the process. This function is not aware of pixels, only of bytes. So widths +- * are given in bytes, not pixels. The new_buf and orig_buf can point to the +- * same buffers to do an in-place conversion, but the buffer should be large +- * enough. +- */ +-static void +-stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) +-{ +- int row; +- +- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", +- new_buf, orig_buf, new_width, orig_width, height); +- /* if increasing the stride, work from bottom-up to avoid overwriting data +- * that has not been moved yet.. otherwise, work in the opposite order, +- * for the same reason. +- */ +- if (new_width > orig_width) { +- for (row=height-1; row>=0; row--) { +- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); +- } +- } else { +- for (row=0; row<height; row++) { +- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); +- } +- } +-} ++ self->conversion = NULL; + +- +-/** +- * Convert from a non-strided buffer to strided. The two buffer pointers could +- * be pointing to the same memory block for in-place transform.. assuming that +- * the buffer is large enough +- * +- * @strided: the pointer to the resulting strided buffer +- * @unstrided: the pointer to the initial unstrided buffer +- * @fourcc: the color format +- * @stride: the stride, in bytes +- * @width: the width in pixels +- * @height: the height in pixels +- */ +-static GstFlowReturn +-stridify (GstStrideTransform *self, guchar *strided, guchar *unstrided) +-{ +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; +- +- if (self->out_format != self->in_format) { +- +- if ((self->in_format == GST_VIDEO_FORMAT_I420) && +- (self->out_format == GST_VIDEO_FORMAT_NV12)) { +- /* note: if not an in-place conversion, then doing the U&V in one pass +- * would be more efficient... but if it is an in-place conversion, I'd +- * need to think about whether it is potential for the new UV plane to +- * corrupt the V plane before it is done copying.. +- */ +- stridemove_demux ( +- strided + (height*stride) + 1, +- unstrided + (int)(height*width*1.25), +- stride, width/2, height/2, 2); /* move V */ +- stridemove_demux ( +- strided + (height*stride), +- unstrided + (height*width), +- stride, width/2, height/2, 2); /* move U */ +- stridemove (strided, unstrided, stride, width, height); /* move Y */ +- return GST_FLOW_OK; ++ for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { ++ if ((stride_conversions[i].format[0] == in_format) && ++ (stride_conversions[i].format[1] == out_format)) { ++ GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); ++ self->conversion = &stride_conversions[i]; ++ break; + } + } + +- switch (self->out_format) { +- case GST_VIDEO_FORMAT_NV12: +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (strided, unstrided, stride, width, (GST_ROUND_UP_2 (height) * 3) / 2); +- return GST_FLOW_OK; +- case GST_VIDEO_FORMAT_I420: +- case GST_VIDEO_FORMAT_YV12: +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove ( +- strided + (int)(height*stride*1.5), +- unstrided + (int)(height*width*1.5), +- stride, width/2, height); /* move U/V */ +- stridemove ( +- strided + (height*stride), +- unstrided + (height*width), +- stride, width/2, height); /* move V/U */ +- stridemove (strided, unstrided, stride, width, height); /* move Y */ +- return GST_FLOW_OK; +- case GST_VIDEO_FORMAT_YUY2: +- case GST_VIDEO_FORMAT_UYVY: +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); +- stridemove (strided, unstrided, stride, width*2, height); +- return GST_FLOW_OK; +- default: +- GST_WARNING ("unknown color format!\n"); +- return GST_FLOW_ERROR; +- } +-} +- ++ g_return_val_if_fail (self->conversion, FALSE); ++ g_return_val_if_fail (self->conversion->unstridify || !self->in_rowstride, FALSE); ++ g_return_val_if_fail (self->conversion->stridify || !self->out_rowstride, FALSE); ++ g_return_val_if_fail (self->width == width, FALSE); ++ g_return_val_if_fail (self->height == height, FALSE); + +-/** +- * Convert from a strided buffer to non-strided. The two buffer pointers could +- * be pointing to the same memory block for in-place transform.. +- * +- * @unstrided: the pointer to the resulting unstrided buffer +- * @strided: the pointer to the initial strided buffer +- */ +-static GstFlowReturn +-unstridify (GstStrideTransform *self, guchar *unstrided, guchar *strided) +-{ +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; +- +- switch (self->out_format) { +- case GST_VIDEO_FORMAT_NV12: +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (unstrided, strided, width, stride, (GST_ROUND_UP_2 (height) * 3) / 2); +- return GST_FLOW_OK; +- case GST_VIDEO_FORMAT_I420: +- case GST_VIDEO_FORMAT_YV12: +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (unstrided, strided, width, stride, height); /* move Y */ +- stridemove ( +- unstrided + (height*width), +- strided + (height*stride), +- width/2, stride, height); /* move V/U */ +- stridemove ( +- unstrided + (int)(height*width*1.5), +- strided + (int)(height*stride*1.5), +- width/2, stride, height); /* move U/V */ +- return GST_FLOW_OK; +- case GST_VIDEO_FORMAT_YUY2: +- case GST_VIDEO_FORMAT_UYVY: +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); +- stridemove (unstrided, strided, width*2, stride, height); +- return GST_FLOW_OK; +- default: +- GST_WARNING ("unknown color format!\n"); +- return GST_FLOW_ERROR; +- } ++ return TRUE; + } + +- + static GstFlowReturn + gst_stride_transform_transform (GstBaseTransform *base, + GstBuffer *inbuf, GstBuffer *outbuf) +@@ -543,10 +371,10 @@ gst_stride_transform_transform (GstBaseTransform *base, + GST_DEBUG_OBJECT (self, "not implemented"); // TODO + return GST_FLOW_ERROR; + } else if (self->in_rowstride) { +- return unstridify (self, ++ return self->conversion->unstridify (self, + GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); + } else if (self->out_rowstride) { +- return stridify (self, ++ return self->conversion->stridify (self, + GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); + } + +@@ -555,12 +383,3 @@ gst_stride_transform_transform (GstBaseTransform *base, + + return GST_FLOW_ERROR; + } +- +-static GstFlowReturn +-gst_stride_transform_transform_ip (GstBaseTransform *base, +- GstBuffer *buf) +-{ +- /* transform function is safe to call with same buffer ptr: +- */ +- return gst_stride_transform_transform (base, buf, buf); +-} +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +index 0141571..bce2526 100644 +--- a/gst/stride/gststridetransform.h ++++ b/gst/stride/gststridetransform.h +@@ -2,7 +2,7 @@ + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * +- * Description: V4L2 sink element ++ * Description: stride transform element + * Created on: Jul 2, 2009 + * Author: Rob Clark <rob@ti.com> + * +@@ -29,7 +29,6 @@ + #include <gst/video/gstvideofilter.h> + #include <gst/video/video.h> + +- + G_BEGIN_DECLS + + #define GST_TYPE_STRIDE_TRANSFORM \ +@@ -47,6 +46,19 @@ typedef struct _GstStrideTransform GstStrideTransform; + typedef struct _GstStrideTransformClass GstStrideTransformClass; + + /** ++ * stride/colorspace conversion table (used internally) ++ */ ++typedef struct { ++ ++ GstVideoFormat format[2]; /* in_format, out_format */ ++ ++ GstFlowReturn (*stridify) (GstStrideTransform *self, guchar *strided, guchar *unstrided); ++ GstFlowReturn (*unstridify) (GstStrideTransform *self, guchar *unstrided, guchar *strided); ++ ++} Conversion; ++ ++ ++/** + * GstStrideTransform: + * + * Opaque datastructure. +@@ -55,10 +67,10 @@ struct _GstStrideTransform { + GstVideoFilter videofilter; + + /*< private >*/ +- GstVideoFormat in_format, out_format; + gint width, height; + gint in_rowstride; + gint out_rowstride; ++ const Conversion *conversion; + + /* for caching the tranform_size() results.. */ + GstCaps *cached_caps[2]; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0011-add-some-neon.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0011-add-some-neon.patch new file mode 100644 index 0000000..14f6a16 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0011-add-some-neon.patch @@ -0,0 +1,293 @@ +From 537d185b9e9b25f7dacb5e5c4dab47bb8524da34 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 8 Apr 2010 00:30:25 -0500 +Subject: [PATCH 11/24] add some neon + +--- + configure.ac | 1 + + gst/stride/Makefile.am | 1 + + gst/stride/armv7.s | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ + gst/stride/convert.c | 76 ++++++++++++++++-------------- + 4 files changed, 162 insertions(+), 35 deletions(-) + create mode 100644 gst/stride/armv7.s + +diff --git a/configure.ac b/configure.ac +index af6cd52..8e7ba18 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -58,6 +58,7 @@ dnl AS_LIBTOOL_TAGS + + AC_LIBTOOL_WIN32_DLL + AM_PROG_LIBTOOL ++AM_PROG_AS + + dnl *** required versions of GStreamer stuff *** + GST_REQ=0.10.32 +diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am +index 0b61d55..3b466de 100644 +--- a/gst/stride/Makefile.am ++++ b/gst/stride/Makefile.am +@@ -3,6 +3,7 @@ plugin_LTLIBRARIES = libgststridetransform.la + libgststridetransform_la_SOURCES = \ + gststridetransform.c \ + convert.c \ ++ armv7.s \ + plugin.c + + libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) +diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s +new file mode 100644 +index 0000000..ed636f7 +--- /dev/null ++++ b/gst/stride/armv7.s +@@ -0,0 +1,119 @@ ++@ GStreamer ++@ ++@ Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ ++@ ++@ Description: NEON/VFP accelerated functions for armv7 architecture ++@ Created on: Nov 27, 2009 ++@ Author: Rob Clark <rob@ti.com> ++@ ++@ This library is free software; you can redistribute it and/or ++@ modify it under the terms of the GNU Library General Public ++@ License as published by the Free Software Foundation; either ++@ version 2 of the License, or (at your option) any later version. ++@ ++@ This library 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 ++@ Library General Public License for more details. ++@ ++@ You should have received a copy of the GNU Library General Public ++@ License along with this library; if not, write to the ++@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++@ Boston, MA 02111-1307, USA. ++ ++ .fpu neon ++ .text ++ ++ .align ++ .global stride_copy_zip2 ++ .type stride_copy_zip2, %function ++@void ++@stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy_zip2: ++@ interleave remaining >= 16 bytes: ++ pld [r1, #64] ++ pld [r2, #64] ++ cmp r3, #16 ++ blt stride_copy_zip2_2 ++stride_copy_zip2_1: ++ vld1.8 {q8}, [r1]! ++ vld1.8 {q9}, [r2]! ++ ++ vzip.8 q8, q9 ++ ++ pld [r1, #64] ++ vst1.8 {q8,q9}, [r0]! ++ pld [r2, #64] ++ sub r3, r3, #16 ++ ++ cmp r3, #16 ++ bge stride_copy_zip2_1 ++@ interleave remaining >= 8 bytes: ++stride_copy_zip2_2: ++ cmp r3, #8 ++ blt stride_copy_zip2_3 ++ ++ vld1.8 {d16}, [r1]! ++ vld1.8 {d17}, [r2]! ++ ++ vzip.8 d16, d17 ++ ++ vst1.8 {d16,d17}, [r0]! ++ sub r3, r3, #8 ++ ++@ interleave remaining < 8 bytes: ++stride_copy_zip2_3: ++@XXX ++ bx lr ++@} ++ ++ .align ++ .global stride_copy ++ .type stride_copy, %function ++@void ++@stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy: ++@ copy remaining >= 64 bytes: ++ pld [r1, #64] ++ cmp r2, #64 ++ blt stride_copy_2 ++stride_copy_1: ++ vld1.8 {q8-q9}, [r1]! ++ sub r2, r2, #64 ++ vld1.8 {q10-q11},[r1]! ++ vst1.8 {q8-q9}, [r0]! ++ pld [r1, #64] ++ cmp r2, #64 ++ vst1.8 {q10-q11},[r0]! ++ bge stride_copy_1 ++@ copy remaining >= 32 bytes: ++stride_copy_2: ++ cmp r2, #32 ++ blt stride_copy_3 ++ vld1.8 {q8-q9}, [r1]! ++ sub r2, r2, #32 ++ vst1.8 {q8-q9}, [r0]! ++@ copy remaining >= 16 bytes: ++stride_copy_3: ++ cmp r2, #16 ++ blt stride_copy_4 ++ vld1.8 {q8}, [r1]! ++ sub r2, r2, #16 ++ vst1.8 {q8}, [r0]! ++@ copy remaining >= 8 bytes: ++stride_copy_4: ++ cmp r2, #8 ++ blt stride_copy_5 ++ vld1.8 {d16}, [r1]! ++ sub r2, r2, #8 ++ vst1.8 {d16}, [r0]! ++@ copy remaining < 8 bytes: ++stride_copy_5: ++@XXX ++ bx lr ++@} ++ +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index 860f16c..a15063b 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -37,38 +37,43 @@ GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); + #define GST_CAT_DEFAULT stridetransform_debug + + ++/* note: some parts of code support in-place transform.. some do not.. I'm ++ * not sure if zip/interleave functions could really support in-place copy.. ++ * I need to think about this after having some sleep ;-) ++ */ ++ ++#define WEAK __attribute__((weak)) ++ + /* + * Conversion utilities: + */ + +-static void +-memmove_demux (guchar *new_buf, guchar *orig_buf, gint sz, gint pxstride) ++WEAK void ++stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) + { +- if (new_buf > orig_buf) { +- /* copy backwards */ +- new_buf += ((sz - 1) * pxstride); +- orig_buf += sz - 1; +- while(sz--) { +- *new_buf = *orig_buf; +- new_buf -= pxstride; +- orig_buf--; +- } +- } else { +- while(sz--) { +- *new_buf = *orig_buf; +- new_buf += pxstride; +- orig_buf++; +- } ++ while (sz--) { ++ *new_buf++ = *orig_buf1++; ++ *new_buf++ = *orig_buf2++; + } + } + ++WEAK void ++stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) ++{ ++ memcpy (new_buf, orig_buf, sz); ++} ++ ++ ++/** ++ * move to strided buffer, interleaving two planes of identical dimensions ++ */ + static void +-stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height, gint pxstride) ++stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new_width, gint orig_width, gint height) + { + int row; + +- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", +- new_buf, orig_buf, new_width, orig_width, height); ++ GST_DEBUG ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", ++ new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); + + /* if increasing the stride, work from bottom-up to avoid overwriting data + * that has not been moved yet.. otherwise, work in the opposite order, +@@ -76,11 +81,19 @@ stridemove_demux (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_w + */ + if (new_width > orig_width) { + for (row=height-1; row>=0; row--) { +- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width, pxstride); ++ stride_copy_zip2 ( ++ new_buf+(new_width*row), ++ orig_buf1+(orig_width*row), ++ orig_buf2+(orig_width*row), ++ orig_width); + } + } else { + for (row=0; row<height; row++) { +- memmove_demux (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width, pxstride); ++ stride_copy_zip2 ( ++ new_buf+(new_width*row), ++ orig_buf1+(orig_width*row), ++ orig_buf2+(orig_width*row), ++ new_width); + } + } + } +@@ -106,11 +119,11 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, + */ + if (new_width > orig_width) { + for (row=height-1; row>=0; row--) { +- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); + } + } else { + for (row=0; row<height; row++) { +- memmove (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); ++ stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); + } + } + } +@@ -234,19 +247,12 @@ stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided + + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + +- /* note: if not an in-place conversion, then doing the U&V in one pass +- * would be more efficient... but if it is an in-place conversion, I'd +- * need to think about whether it is potential for the new UV plane to +- * corrupt the V plane before it is done copying.. +- */ +- stridemove_demux ( +- strided + (height*stride) + 1, +- unstrided + (int)(height*width*1.25), +- stride, width/2, height/2, 2); /* move V */ +- stridemove_demux ( ++ /* XXX widths/heights/strides that are not multiple of four??: */ ++ stridemove_zip2 ( + strided + (height*stride), + unstrided + (height*width), +- stride, width/2, height/2, 2); /* move U */ ++ unstrided + (int)(height*width*1.25), ++ stride, width/2, height/2); /* interleave U&V */ + stridemove (strided, unstrided, stride, width, height); /* move Y */ + + return GST_FLOW_OK; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch new file mode 100644 index 0000000..d2c565c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0012-add-support-to-convert-to-YUY2-YUYV-color-format.patch @@ -0,0 +1,197 @@ +From 2f3ab39353cb9dde02ba64ab89b7c7725b25ae3b Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Tue, 1 Dec 2009 22:42:43 -0600 +Subject: [PATCH 12/24] add support to convert to YUY2/YUYV color format + +--- + gst/stride/armv7.s | 63 ++++++++++++++++++++++++++++++++++++++++++ + gst/stride/convert.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++--- + 2 files changed, 133 insertions(+), 4 deletions(-) + +diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s +index ed636f7..2697a14 100644 +--- a/gst/stride/armv7.s ++++ b/gst/stride/armv7.s +@@ -69,6 +69,69 @@ stride_copy_zip2_3: + bx lr + @} + ++ ++ .align ++ .global stride_copy_zip3a ++ .type stride_copy_zip3a, %function ++@void ++@stride_copy_zip3a (guchar *new_buf, ++@ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) ++@{ ++@@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved ++stride_copy_zip3a: ++ pld [r1, #64] ++ pld [r2, #64] ++ pld [r3, #64] ++ ldr ip, [sp] @ the sz arg ++@ interleave remaining >= 32 bytes: ++ cmp ip, #32 ++ blt stride_copy_zip3a_2 ++stride_copy_zip3a_1: ++ vld1.8 {q8}, [r1]! @ Y ++ vld1.8 {q10}, [r1]! @ Y ++ vld1.8 {q9}, [r2]! @ U ++ vld1.8 {q11}, [r3]! @ V ++ ++ pld [r1, #64] ++ pld [r2, #64] ++ pld [r3, #64] ++ ++ vzip.8 q9, q11 @ interleave U&V ++ vzip.8 q8, q9 @ interleave Y1UV1 ++ vzip.8 q10, q11 @ interleave Y2UV2 ++ ++ vst1.8 {q8,q9}, [r0]! ++ vst1.8 {q10,q11}, [r0]! ++ ++ sub ip, ip, #32 ++ ++ cmp ip, #32 ++ bge stride_copy_zip3a_1 ++@ interleave remaining >= 16 bytes: ++stride_copy_zip3a_2: ++ cmp ip, #16 ++ blt stride_copy_zip3a_3 ++ ++ vld1.8 {d16}, [r1]! @ Y ++ vld1.8 {d18}, [r1]! @ Y ++ vld1.8 {d17}, [r2]! @ U ++ vld1.8 {d19}, [r3]! @ V ++ ++ vzip.8 d17, d19 @ interleave U&V ++ vzip.8 d16, d17 @ interleave Y1UV1 ++ vzip.8 d18, d19 @ interleave Y2UV2 ++ ++ vst1.8 {d16,d17}, [r0]! ++ vst1.8 {d18,d19}, [r0]! ++ ++ sub ip, ip, #16 ++@ copy remaining >= 8 bytes: ++stride_copy_zip3a_3: ++@XXX ++ bx lr ++@} ++ ++ + .align + .global stride_copy + .type stride_copy, %function +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index a15063b..0f59e78 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -58,6 +58,19 @@ stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz + } + + WEAK void ++stride_copy_zip3a (guchar *new_buf, ++ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) ++{ ++ while (sz > 1) { ++ *new_buf++ = *orig_buf1++; ++ *new_buf++ = *orig_buf2++; ++ *new_buf++ = *orig_buf1++; ++ *new_buf++ = *orig_buf3++; ++ sz -= 2; ++ } ++} ++ ++WEAK void + stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) + { + memcpy (new_buf, orig_buf, sz); +@@ -99,6 +112,36 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new + } + + /** ++ * move to strided buffer, interleaving three planes, where the first plane ++ * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. ++ */ ++static void ++stridemove_zip3a (guchar *new_buf, ++ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, ++ guint new_width, gint orig_width, gint height) ++{ ++ gint copy_width = (new_width < orig_width) ? new_width : orig_width; ++ ++ while (height > 0) { ++ ++ /* even row */ ++ stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); ++ new_buf += new_width; ++ orig_buf1 += orig_width; ++ ++ /* odd row, recycles same U & V */ ++ stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); ++ new_buf += new_width; ++ orig_buf1 += orig_width; ++ ++ orig_buf2 += orig_width/2; ++ orig_buf3 += orig_width/2; ++ ++ height -= 2; ++ } ++} ++ ++/** + * Convert from one stride to another... like memmove, but can convert stride in + * the process. This function is not aware of pixels, only of bytes. So widths + * are given in bytes, not pixels. The new_buf and orig_buf can point to the +@@ -250,14 +293,36 @@ stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided + /* XXX widths/heights/strides that are not multiple of four??: */ + stridemove_zip2 ( + strided + (height*stride), +- unstrided + (height*width), +- unstrided + (int)(height*width*1.25), +- stride, width/2, height/2); /* interleave U&V */ +- stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ unstrided + (height*width), /* U */ ++ unstrided + (int)(height*width*1.25), /* V */ ++ stride, width/2, height/2); ++ stridemove (strided, unstrided, stride, width, height); /* Y */ ++ ++ return GST_FLOW_OK; ++} ++ ++/** convert I420 unstrided to YUY2 strided */ ++static GstFlowReturn ++stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ++ /* XXX widths/heights/strides that are not multiple of four??: */ ++ stridemove_zip3a ( ++ strided, ++ unstrided, /* Y */ ++ unstrided + (height*width), /* U */ ++ unstrided + (int)(height*width*1.25), /* V */ ++ stride, width, height); + + return GST_FLOW_OK; + } + ++ + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ + Conversion stride_conversions[] = { + { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, +@@ -266,6 +331,7 @@ Conversion stride_conversions[] = { + { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, + { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, + { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, ++ { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, + /* add new entries before here */ + { { GST_VIDEO_FORMAT_UNKNOWN } } + }; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0013-Add-support-for-RGB565-to-stridetransform.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0013-Add-support-for-RGB565-to-stridetransform.patch new file mode 100644 index 0000000..da51b33 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0013-Add-support-for-RGB565-to-stridetransform.patch @@ -0,0 +1,336 @@ +From 28a5ad7c5ccfa98ffa7bb1425dc38ab16535fc26 Mon Sep 17 00:00:00 2001 +From: Castaneda Sheissa, Roberto <rsheissa@ti.com> +Date: Sun, 3 Jan 2010 13:40:30 -0600 +Subject: [PATCH 13/24] Add support for RGB565 to stridetransform + +--- + gst/stride/convert.c | 30 ++++++++++ + gst/stride/gststridetransform.c | 120 ++++++++++++++++++++------------------ + 2 files changed, 93 insertions(+), 57 deletions(-) + +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index 0f59e78..fdb02ae 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -322,6 +322,35 @@ stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided + return GST_FLOW_OK; + } + ++/** convert RGB565 to RGB565 strided **/ ++static GstFlowReturn ++stridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; ++ ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ ++ stridemove (strided, unstrided, stride, width*2, height); ++ ++ return GST_FLOW_OK; ++} ++ ++/** convert RGB565 strided to RGB565 **/ ++static GstFlowReturn ++unstridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++{ ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; ++ ++ g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ ++ stridemove (unstrided, strided, width*2, stride, height); ++ return GST_FLOW_OK; ++} ++ + + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ + Conversion stride_conversions[] = { +@@ -332,6 +361,7 @@ Conversion stride_conversions[] = { + { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, + { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, + { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, ++ { { GST_VIDEO_FORMAT_RGB16, GST_VIDEO_FORMAT_RGB16 }, stridify_rgb565_rgb565, unstridify_rgb565_rgb565 }, + /* add new entries before here */ + { { GST_VIDEO_FORMAT_UNKNOWN } } + }; +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 6ab0479..c35be73 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -66,46 +66,47 @@ GST_ELEMENT_DETAILS ("Stride transform", + + + /* TODO: add rgb formats too! */ +-#define SUPPORTED_CAPS \ +- GST_VIDEO_CAPS_YUV_STRIDED ("{ I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") ++#define YUV_SUPPORTED_CAPS \ ++ GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") + ++#define RGB_SUPPORTED_CAPS \ ++ GST_VIDEO_CAPS_RGB_16_STRIDED ("[ 0, max ]") + +-static GstStaticPadTemplate src_template = +-GST_STATIC_PAD_TEMPLATE ("src", ++ ++static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, +- GST_STATIC_CAPS (SUPPORTED_CAPS) +-); ++ GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) ++ ); + +-static GstStaticPadTemplate sink_template = +-GST_STATIC_PAD_TEMPLATE ("sink", ++static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, +- GST_STATIC_CAPS (SUPPORTED_CAPS) +-); ++ GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) ++ ); + + + GST_DEBUG_CATEGORY (stridetransform_debug); + #define GST_CAT_DEFAULT stridetransform_debug + + /* type functions */ +-static void gst_stride_transform_dispose (GObject *obj); ++static void gst_stride_transform_dispose (GObject * obj); + + /* GstBaseTransform functions */ +-static gboolean gst_stride_transform_get_unit_size (GstBaseTransform *base, +- GstCaps *caps, guint *size); +-static gboolean gst_stride_transform_transform_size (GstBaseTransform *base, ++static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, ++ GstCaps * caps, guint * size); ++static gboolean gst_stride_transform_transform_size (GstBaseTransform * base, + GstPadDirection direction, +- GstCaps *caps, guint size, +- GstCaps *othercaps, guint *othersize); +-static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform *base, +- GstPadDirection direction, GstCaps *caps); +-static gboolean gst_stride_transform_set_caps (GstBaseTransform *base, +- GstCaps *incaps, GstCaps *outcaps); +-static GstFlowReturn gst_stride_transform_transform (GstBaseTransform *base, +- GstBuffer *inbuf, GstBuffer *outbuf); ++ GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize); ++static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps); ++static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, ++ GstCaps * incaps, GstCaps * outcaps); ++static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, ++ GstBuffer * inbuf, GstBuffer * outbuf); + +-GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); ++GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, ++ GST_TYPE_VIDEO_FILTER); + + + static void +@@ -113,7 +114,8 @@ gst_stride_transform_base_init (gpointer g_class) + { + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + +- GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); ++ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, ++ "stride transform element"); + + gst_element_class_set_details (gstelement_class, &stridetransform_details); + +@@ -124,7 +126,7 @@ gst_stride_transform_base_init (gpointer g_class) + } + + static void +-gst_stride_transform_class_init (GstStrideTransformClass *klass) ++gst_stride_transform_class_init (GstStrideTransformClass * klass) + { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); +@@ -146,14 +148,15 @@ gst_stride_transform_class_init (GstStrideTransformClass *klass) + } + + static void +-gst_stride_transform_init (GstStrideTransform *self, GstStrideTransformClass *klass) ++gst_stride_transform_init (GstStrideTransform * self, ++ GstStrideTransformClass * klass) + { + GST_DEBUG_OBJECT (self, "not implemented"); + } + + + static void +-gst_stride_transform_dispose (GObject *object) ++gst_stride_transform_dispose (GObject * object) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); + GST_DEBUG_OBJECT (self, "not implemented"); +@@ -164,15 +167,15 @@ gst_stride_transform_dispose (GObject *object) + * figure out the required buffer size based on @caps + */ + static gboolean +-gst_stride_transform_get_unit_size (GstBaseTransform *base, +- GstCaps *caps, guint *size) ++gst_stride_transform_get_unit_size (GstBaseTransform * base, ++ GstCaps * caps, guint * size) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GstVideoFormat format; + gint width, height, rowstride; + +- g_return_val_if_fail (gst_video_format_parse_caps_strided ( +- caps, &format, &width, &height, &rowstride), FALSE); ++ g_return_val_if_fail (gst_video_format_parse_caps_strided (caps, &format, ++ &width, &height, &rowstride), FALSE); + + *size = gst_video_format_get_size_strided (format, width, height, rowstride); + +@@ -188,16 +191,14 @@ gst_stride_transform_get_unit_size (GstBaseTransform *base, + * buffer size is a multiple of the unit size.. which doesn't hold true. + */ + static gboolean +-gst_stride_transform_transform_size (GstBaseTransform *base, ++gst_stride_transform_transform_size (GstBaseTransform * base, + GstPadDirection direction, +- GstCaps *caps, guint size, +- GstCaps *othercaps, guint *othersize) ++ GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + guint idx = (direction == GST_PAD_SINK) ? 0 : 1; + +- if (self->cached_caps[idx] != othercaps) +- { ++ if (self->cached_caps[idx] != othercaps) { + guint sz; + if (!gst_stride_transform_get_unit_size (base, othercaps, &sz)) { + return FALSE; +@@ -220,13 +221,15 @@ gst_stride_transform_transform_size (GstBaseTransform *base, + * helper to add all fields, other than rowstride to @caps, copied from @s. + */ + static void +-add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rowstride, GstPadDirection direction) ++add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, ++ gboolean rowstride, GstPadDirection direction) + { + gint idx; + GstStructure *new_s = gst_structure_new (name, NULL); + + if (rowstride) { +- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); ++ gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, ++ NULL); + } + + idx = gst_structure_n_fields (s) - 1; +@@ -245,15 +248,16 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; + + if (gst_structure_get_fourcc (s, "format", &fourcc)) { +- GValue formats = {0}; +- GValue fourccval = {0}; ++ GValue formats = { 0 }; ++ GValue fourccval = { 0 }; + gint i; + GstVideoFormat format = gst_video_format_from_fourcc (fourcc); + + g_value_init (&formats, GST_TYPE_LIST); + g_value_init (&fourccval, GST_TYPE_FOURCC); + +- for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { ++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; ++ i++) { + if (stride_conversions[i].format[from_format] == format) { + gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc + (stride_conversions[i].format[to_format])); +@@ -281,8 +285,8 @@ add_all_fields (GstCaps *caps, const gchar *name, GstStructure *s, gboolean rows + * identical parameters + */ + static GstCaps * +-gst_stride_transform_transform_caps (GstBaseTransform *base, +- GstPadDirection direction, GstCaps *caps) ++gst_stride_transform_transform_caps (GstBaseTransform * base, ++ GstPadDirection direction, GstCaps * caps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GstCaps *ret; +@@ -321,8 +325,8 @@ gst_stride_transform_transform_caps (GstBaseTransform *base, + * plus the requested rowstride of the @incaps and @outcaps + */ + static gboolean +-gst_stride_transform_set_caps (GstBaseTransform *base, +- GstCaps *incaps, GstCaps *outcaps) ++gst_stride_transform_set_caps (GstBaseTransform * base, ++ GstCaps * incaps, GstCaps * outcaps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + gint width, height; +@@ -333,13 +337,13 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + LOG_CAPS (self, outcaps); + + g_return_val_if_fail (gst_video_format_parse_caps_strided (incaps, +- &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); ++ &in_format, &self->width, &self->height, &self->in_rowstride), FALSE); + g_return_val_if_fail (gst_video_format_parse_caps_strided (outcaps, +- &out_format, &width, &height, &self->out_rowstride), FALSE); ++ &out_format, &width, &height, &self->out_rowstride), FALSE); + + self->conversion = NULL; + +- for (i=0; stride_conversions[i].format[0]!=GST_VIDEO_FORMAT_UNKNOWN; i++) { ++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { + if ((stride_conversions[i].format[0] == in_format) && + (stride_conversions[i].format[1] == out_format)) { + GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); +@@ -349,26 +353,27 @@ gst_stride_transform_set_caps (GstBaseTransform *base, + } + + g_return_val_if_fail (self->conversion, FALSE); +- g_return_val_if_fail (self->conversion->unstridify || !self->in_rowstride, FALSE); +- g_return_val_if_fail (self->conversion->stridify || !self->out_rowstride, FALSE); +- g_return_val_if_fail (self->width == width, FALSE); ++ g_return_val_if_fail (self->conversion->unstridify ++ || !self->in_rowstride, FALSE); ++ g_return_val_if_fail (self->conversion->stridify ++ || !self->out_rowstride, FALSE); ++ g_return_val_if_fail (self->width == width, FALSE); + g_return_val_if_fail (self->height == height, FALSE); + + return TRUE; + } + + static GstFlowReturn +-gst_stride_transform_transform (GstBaseTransform *base, +- GstBuffer *inbuf, GstBuffer *outbuf) ++gst_stride_transform_transform (GstBaseTransform * base, ++ GstBuffer * inbuf, GstBuffer * outbuf) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + + GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", +- inbuf, GST_BUFFER_SIZE (inbuf), +- outbuf, GST_BUFFER_SIZE (outbuf)); ++ inbuf, GST_BUFFER_SIZE (inbuf), outbuf, GST_BUFFER_SIZE (outbuf)); + + if (self->in_rowstride && self->out_rowstride) { +- GST_DEBUG_OBJECT (self, "not implemented"); // TODO ++ GST_DEBUG_OBJECT (self, "not implemented"); // TODO + return GST_FLOW_ERROR; + } else if (self->in_rowstride) { + return self->conversion->unstridify (self, +@@ -378,7 +383,8 @@ gst_stride_transform_transform (GstBaseTransform *base, + GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); + } + +- GST_DEBUG_OBJECT (self, "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", ++ GST_DEBUG_OBJECT (self, ++ "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", + self->in_rowstride, self->out_rowstride); + + return GST_FLOW_ERROR; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0014-stridetransform-updates-for-new-extra-anal-compiler-.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0014-stridetransform-updates-for-new-extra-anal-compiler-.patch new file mode 100644 index 0000000..a4442c3 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0014-stridetransform-updates-for-new-extra-anal-compiler-.patch @@ -0,0 +1,61 @@ +From e97373aac252f312c5ac69305228db50886a7c5c Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 8 Apr 2010 03:30:35 -0500 +Subject: [PATCH 14/24] stridetransform: updates for new extra-anal compiler warning flags + +--- + gst/stride/convert.c | 6 ++++++ + gst/stride/gststridetransform.c | 13 ++++--------- + 2 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index fdb02ae..ad9c0aa 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -48,6 +48,12 @@ GST_DEBUG_CATEGORY_EXTERN (stridetransform_debug); + * Conversion utilities: + */ + ++void stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, ++ guchar * orig_buf2, gint sz); ++void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, ++ guchar * orig_buf2, guchar * orig_buf3, gint sz); ++void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); ++ + WEAK void + stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) + { +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index c35be73..de07c11 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -57,14 +57,6 @@ + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ + extern const Conversion stride_conversions[]; + +- +-static const GstElementDetails stridetransform_details = +-GST_ELEMENT_DETAILS ("Stride transform", +- "Filter/Converter/Video", +- "Convert between video buffers with and without stride, or with differing stride", +- "Rob Clark <rob@ti.com>,"); +- +- + /* TODO: add rgb formats too! */ + #define YUV_SUPPORTED_CAPS \ + GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") +@@ -117,7 +109,10 @@ gst_stride_transform_base_init (gpointer g_class) + GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, + "stride transform element"); + +- gst_element_class_set_details (gstelement_class, &stridetransform_details); ++ gst_element_class_set_details_simple (gstelement_class, ++ "Stride transform", "Filter/Converter/Video", ++ "Convert between video buffers with and without stride, or with differing stride", ++ "Rob Clark <rob@ti.com>,"); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sink_template)); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0015-stridetransform-fix-problem-transforming-caps-with-l.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0015-stridetransform-fix-problem-transforming-caps-with-l.patch new file mode 100644 index 0000000..b46f7a9 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0015-stridetransform-fix-problem-transforming-caps-with-l.patch @@ -0,0 +1,544 @@ +From c8db3522e32ca6afbbd117b816068516eed8c594 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sat, 30 Jan 2010 14:32:42 -0600 +Subject: [PATCH 15/24] stridetransform: fix problem transforming caps with list of fourcc's + +previous logic assumed that the format field would contain just a single fourcc +--- + gst/stride/convert.c | 206 ++++++++++++++++++++------------------- + gst/stride/gststridetransform.c | 78 +++++++++++----- + 2 files changed, 159 insertions(+), 125 deletions(-) + +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index ad9c0aa..17f9e2a 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -55,7 +55,8 @@ void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, + void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); + + WEAK void +-stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) ++stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, ++ gint sz) + { + while (sz--) { + *new_buf++ = *orig_buf1++; +@@ -64,8 +65,8 @@ stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz + } + + WEAK void +-stride_copy_zip3a (guchar *new_buf, +- guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) ++stride_copy_zip3a (guchar * new_buf, ++ guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, gint sz) + { + while (sz > 1) { + *new_buf++ = *orig_buf1++; +@@ -77,7 +78,7 @@ stride_copy_zip3a (guchar *new_buf, + } + + WEAK void +-stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) ++stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) + { + memcpy (new_buf, orig_buf, sz); + } +@@ -87,11 +88,13 @@ stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) + * move to strided buffer, interleaving two planes of identical dimensions + */ + static void +-stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new_width, gint orig_width, gint height) ++stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, ++ gint new_width, gint orig_width, gint height) + { + int row; + +- GST_DEBUG ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", ++ GST_DEBUG ++ ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", + new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); + + /* if increasing the stride, work from bottom-up to avoid overwriting data +@@ -99,20 +102,16 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new + * for the same reason. + */ + if (new_width > orig_width) { +- for (row=height-1; row>=0; row--) { +- stride_copy_zip2 ( +- new_buf+(new_width*row), +- orig_buf1+(orig_width*row), +- orig_buf2+(orig_width*row), +- orig_width); ++ for (row = height - 1; row >= 0; row--) { ++ stride_copy_zip2 (new_buf + (new_width * row), ++ orig_buf1 + (orig_width * row), ++ orig_buf2 + (orig_width * row), orig_width); + } + } else { +- for (row=0; row<height; row++) { +- stride_copy_zip2 ( +- new_buf+(new_width*row), +- orig_buf1+(orig_width*row), +- orig_buf2+(orig_width*row), +- new_width); ++ for (row = 0; row < height; row++) { ++ stride_copy_zip2 (new_buf + (new_width * row), ++ orig_buf1 + (orig_width * row), ++ orig_buf2 + (orig_width * row), new_width); + } + } + } +@@ -122,8 +121,8 @@ stridemove_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint new + * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. + */ + static void +-stridemove_zip3a (guchar *new_buf, +- guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, ++stridemove_zip3a (guchar * new_buf, ++ guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, + guint new_width, gint orig_width, gint height) + { + gint copy_width = (new_width < orig_width) ? new_width : orig_width; +@@ -140,8 +139,8 @@ stridemove_zip3a (guchar *new_buf, + new_buf += new_width; + orig_buf1 += orig_width; + +- orig_buf2 += orig_width/2; +- orig_buf3 += orig_width/2; ++ orig_buf2 += orig_width / 2; ++ orig_buf3 += orig_width / 2; + + height -= 2; + } +@@ -155,7 +154,8 @@ stridemove_zip3a (guchar *new_buf, + * enough. + */ + static void +-stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, gint height) ++stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, ++ gint orig_width, gint height) + { + int row; + +@@ -167,12 +167,14 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, + * for the same reason. + */ + if (new_width > orig_width) { +- for (row=height-1; row>=0; row--) { +- stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), orig_width); ++ for (row = height - 1; row >= 0; row--) { ++ stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), ++ orig_width); + } + } else { +- for (row=0; row<height; row++) { +- stride_copy (new_buf+(new_width*row), orig_buf+(orig_width*row), new_width); ++ for (row = 0; row < height; row++) { ++ stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), ++ new_width); + } + } + } +@@ -183,9 +185,10 @@ stridemove (guchar *new_buf, guchar *orig_buf, gint new_width, gint orig_width, + + /** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ + static GstFlowReturn +-unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++unstridify_420sp_420sp (GstStrideTransform * self, guchar * unstrided, ++ guchar * strided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->in_rowstride; + +@@ -196,10 +199,12 @@ unstridify_420sp_420sp (GstStrideTransform *self, guchar *unstrided, guchar *str + + return GST_FLOW_OK; + } ++ + static GstFlowReturn +-stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_420sp_420sp (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->out_rowstride; + +@@ -214,115 +219,107 @@ stridify_420sp_420sp (GstStrideTransform *self, guchar *strided, guchar *unstrid + + /** convert 4:2:0 planar to same 4:2:0 planar */ + static GstFlowReturn +-unstridify_420p_420p (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++unstridify_420p_420p (GstStrideTransform * self, guchar * unstrided, ++ guchar * strided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->in_rowstride; + + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + +- stridemove (unstrided, strided, width, stride, height); /* move Y */ +- stridemove ( +- unstrided + (height*width), +- strided + (height*stride), +- width/2, stride, height); /* move V/U */ ++ stridemove (unstrided, strided, width, stride, height); /* move Y */ ++ stridemove (unstrided + (height * width), strided + (height * stride), width / 2, stride, height); /* move V/U */ + /* XXX odd widths/heights/strides: */ +- stridemove ( +- unstrided + (int)(height*width*1.5), +- strided + (int)(height*stride*1.5), +- width/2, stride, height); /* move U/V */ ++ stridemove (unstrided + (int) (height * width * 1.5), strided + (int) (height * stride * 1.5), width / 2, stride, height); /* move U/V */ + + return GST_FLOW_OK; + } ++ + static GstFlowReturn +-stridify_420p_420p (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_420p_420p (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->out_rowstride; + + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + + /* XXX odd widths/heights/strides: */ +- stridemove ( +- strided + (int)(height*stride*1.5), +- unstrided + (int)(height*width*1.5), +- stride, width/2, height); /* move U/V */ +- stridemove ( +- strided + (height*stride), +- unstrided + (height*width), +- stride, width/2, height); /* move V/U */ +- stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ stridemove (strided + (int) (height * stride * 1.5), unstrided + (int) (height * width * 1.5), stride, width / 2, height); /* move U/V */ ++ stridemove (strided + (height * stride), unstrided + (height * width), stride, width / 2, height); /* move V/U */ ++ stridemove (strided, unstrided, stride, width, height); /* move Y */ + + return GST_FLOW_OK; + } + + /** convert 4:2:2 packed to same 4:2:2 packed */ + static GstFlowReturn +-unstridify_422i_422i (GstStrideTransform *self, guchar *unstrided, guchar *strided) ++unstridify_422i_422i (GstStrideTransform * self, guchar * unstrided, ++ guchar * strided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->in_rowstride; + +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); + +- stridemove (unstrided, strided, width*2, stride, height); ++ stridemove (unstrided, strided, width * 2, stride, height); + + return GST_FLOW_OK; + } ++ + static GstFlowReturn +-stridify_422i_422i (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_422i_422i (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->out_rowstride; + +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); + +- stridemove (strided, unstrided, stride, width*2, height); ++ stridemove (strided, unstrided, stride, width * 2, height); + + return GST_FLOW_OK; + } + + /** convert I420 unstrided to NV12 strided */ + static GstFlowReturn +-stridify_i420_nv12 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_i420_nv12 (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->out_rowstride; + + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + + /* XXX widths/heights/strides that are not multiple of four??: */ +- stridemove_zip2 ( +- strided + (height*stride), +- unstrided + (height*width), /* U */ +- unstrided + (int)(height*width*1.25), /* V */ +- stride, width/2, height/2); +- stridemove (strided, unstrided, stride, width, height); /* Y */ ++ stridemove_zip2 (strided + (height * stride), unstrided + (height * width), /* U */ ++ unstrided + (int) (height * width * 1.25), /* V */ ++ stride, width / 2, height / 2); ++ stridemove (strided, unstrided, stride, width, height); /* Y */ + + return GST_FLOW_OK; + } + + /** convert I420 unstrided to YUY2 strided */ + static GstFlowReturn +-stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_i420_yuy2 (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; ++ gint width = self->width; + gint height = self->height; + gint stride = self->out_rowstride; + + g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); + + /* XXX widths/heights/strides that are not multiple of four??: */ +- stridemove_zip3a ( +- strided, +- unstrided, /* Y */ +- unstrided + (height*width), /* U */ +- unstrided + (int)(height*width*1.25), /* V */ ++ stridemove_zip3a (strided, unstrided, /* Y */ ++ unstrided + (height * width), /* U */ ++ unstrided + (int) (height * width * 1.25), /* V */ + stride, width, height); + + return GST_FLOW_OK; +@@ -330,46 +327,51 @@ stridify_i420_yuy2 (GstStrideTransform *self, guchar *strided, guchar *unstrided + + /** convert RGB565 to RGB565 strided **/ + static GstFlowReturn +-stridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++stridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->out_rowstride; + +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); + +- stridemove (strided, unstrided, stride, width*2, height); ++ stridemove (strided, unstrided, stride, width * 2, height); + +- return GST_FLOW_OK; ++ return GST_FLOW_OK; + } + + /** convert RGB565 strided to RGB565 **/ + static GstFlowReturn +-unstridify_rgb565_rgb565 (GstStrideTransform *self, guchar *strided, guchar *unstrided) ++unstridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, ++ guchar * unstrided) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; ++ gint width = self->width; ++ gint height = self->height; ++ gint stride = self->in_rowstride; + +- g_return_val_if_fail (stride >= (width*2), GST_FLOW_ERROR); ++ g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); + +- stridemove (unstrided, strided, width*2, stride, height); +- return GST_FLOW_OK; ++ stridemove (unstrided, strided, width * 2, stride, height); ++ return GST_FLOW_OK; + } + ++#define CONVERT(tofmt, fromfmt, stridify, unstridify) \ ++ { \ ++ { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ ++ stridify, unstridify \ ++ } + + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ +-Conversion stride_conversions[] = { +- { { GST_VIDEO_FORMAT_NV12, GST_VIDEO_FORMAT_NV12 }, stridify_420sp_420sp, unstridify_420sp_420sp }, +- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_I420 }, stridify_420p_420p, unstridify_420p_420p }, +- { { GST_VIDEO_FORMAT_YV12, GST_VIDEO_FORMAT_YV12 }, stridify_420p_420p, unstridify_420p_420p }, +- { { GST_VIDEO_FORMAT_YUY2, GST_VIDEO_FORMAT_YUY2 }, stridify_422i_422i, unstridify_422i_422i }, +- { { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_UYVY }, stridify_422i_422i, unstridify_422i_422i }, +- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_NV12 }, stridify_i420_nv12, NULL }, +- { { GST_VIDEO_FORMAT_I420, GST_VIDEO_FORMAT_YUY2 }, stridify_i420_yuy2, NULL }, +- { { GST_VIDEO_FORMAT_RGB16, GST_VIDEO_FORMAT_RGB16 }, stridify_rgb565_rgb565, unstridify_rgb565_rgb565 }, ++const Conversion stride_conversions[] = { ++ CONVERT (NV12, NV12, stridify_420sp_420sp, unstridify_420sp_420sp), ++ CONVERT (I420, I420, stridify_420p_420p, unstridify_420p_420p), ++ CONVERT (YV12, YV12, stridify_420p_420p, unstridify_420p_420p), ++ CONVERT (YUY2, YUY2, stridify_422i_422i, unstridify_422i_422i), ++ CONVERT (UYVY, UYVY, stridify_422i_422i, unstridify_422i_422i), ++ CONVERT (I420, NV12, stridify_i420_nv12, NULL), ++ CONVERT (I420, YUY2, stridify_i420_yuy2, NULL), ++ CONVERT (RGB16, RGB16, stridify_rgb565_rgb565, unstridify_rgb565_rgb565), + /* add new entries before here */ +- { { GST_VIDEO_FORMAT_UNKNOWN } } ++ {{GST_VIDEO_FORMAT_UNKNOWN}} + }; +- +- +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index de07c11..4469e7f 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -146,7 +146,9 @@ static void + gst_stride_transform_init (GstStrideTransform * self, + GstStrideTransformClass * klass) + { +- GST_DEBUG_OBJECT (self, "not implemented"); ++ GST_DEBUG_OBJECT (self, "ENTER"); ++ self->cached_caps[0] = NULL; ++ self->cached_caps[1] = NULL; + } + + +@@ -154,7 +156,7 @@ static void + gst_stride_transform_dispose (GObject * object) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); +- GST_DEBUG_OBJECT (self, "not implemented"); ++ GST_DEBUG_OBJECT (self, "ENTER"); + G_OBJECT_CLASS (parent_class)->dispose (object); + } + +@@ -210,7 +212,30 @@ gst_stride_transform_transform_size (GstBaseTransform * base, + return TRUE; + } + ++/** ++ * helper to check possible @fourcc conversions to the list @formats ++ */ ++static void ++add_all_fourcc_conversions (GValue * formats, guint32 fourcc, ++ GstPadDirection direction) ++{ ++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; ++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; ++ GValue fourccval = { 0 }; ++ gint i; ++ GstVideoFormat format = gst_video_format_from_fourcc (fourcc); + ++ g_value_init (&fourccval, GST_TYPE_FOURCC); ++ ++ for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { ++ if (stride_conversions[i].format[from_format] == format) { ++ guint result_fourcc = ++ gst_video_format_to_fourcc (stride_conversions[i].format[to_format]); ++ gst_value_set_fourcc (&fourccval, result_fourcc); ++ gst_value_list_append_value (formats, &fourccval); ++ } ++ } ++} + + /** + * helper to add all fields, other than rowstride to @caps, copied from @s. +@@ -230,43 +255,44 @@ add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, + idx = gst_structure_n_fields (s) - 1; + while (idx >= 0) { + const gchar *name = gst_structure_nth_field_name (s, idx); ++ const GValue *val = gst_structure_get_value (s, name); ++ + idx--; + + /* for format field, check the stride_conversions table to see what + * we can support: + */ + if (!strcmp ("format", name)) { +- guint fourcc; ++ GValue formats = { 0 }; + +- /* XXX double check this: */ +- gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; +- gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; ++ g_value_init (&formats, GST_TYPE_LIST); + +- if (gst_structure_get_fourcc (s, "format", &fourcc)) { +- GValue formats = { 0 }; +- GValue fourccval = { 0 }; ++ if (GST_VALUE_HOLDS_FOURCC (val)) { ++ add_all_fourcc_conversions (&formats, ++ gst_value_get_fourcc (val), direction); ++ } else if (GST_VALUE_HOLDS_LIST (val)) { + gint i; +- GstVideoFormat format = gst_video_format_from_fourcc (fourcc); +- +- g_value_init (&formats, GST_TYPE_LIST); +- g_value_init (&fourccval, GST_TYPE_FOURCC); +- +- for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; +- i++) { +- if (stride_conversions[i].format[from_format] == format) { +- gst_value_set_fourcc (&fourccval, gst_video_format_to_fourcc +- (stride_conversions[i].format[to_format])); +- gst_value_list_append_value (&formats, &fourccval); ++ for (i = 0; i < gst_value_list_get_size (val); i++) { ++ const GValue *list_val = gst_value_list_get_value (val, i); ++ if (GST_VALUE_HOLDS_FOURCC (list_val)) { ++ add_all_fourcc_conversions (&formats, ++ gst_value_get_fourcc (list_val), direction); ++ } else { ++ GST_WARNING ("malformed caps!!"); ++ break; + } + } +- +- continue; ++ } else { ++ GST_WARNING ("malformed caps!!"); + } ++ ++ gst_structure_set_value (new_s, "format", &formats); ++ ++ continue; + } + + /* copy over all other non-rowstride fields: */ + if (strcmp ("rowstride", name)) { +- const GValue *val = gst_structure_get_value (s, name); + gst_structure_set_value (new_s, name, val); + } + } +@@ -347,6 +373,10 @@ gst_stride_transform_set_caps (GstBaseTransform * base, + } + } + ++ GST_DEBUG_OBJECT (self, ++ "conversion[%d]=%p, in_rowstride=%d, out_rowstride=%d", ++ i, self->conversion, self->in_rowstride, self->out_rowstride); ++ + g_return_val_if_fail (self->conversion, FALSE); + g_return_val_if_fail (self->conversion->unstridify + || !self->in_rowstride, FALSE); +@@ -355,6 +385,8 @@ gst_stride_transform_set_caps (GstBaseTransform * base, + g_return_val_if_fail (self->width == width, FALSE); + g_return_val_if_fail (self->height == height, FALSE); + ++ GST_DEBUG_OBJECT (self, "caps are ok"); ++ + return TRUE; + } + +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0016-modify-playbin-to-use-stridetransform.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0016-modify-playbin-to-use-stridetransform.patch new file mode 100644 index 0000000..168b5d1 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0016-modify-playbin-to-use-stridetransform.patch @@ -0,0 +1,62 @@ +From eb2753337944d24419dc13968137bf06a5e8f77c Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sat, 6 Feb 2010 22:10:16 -0600 +Subject: [PATCH 16/24] modify playbin to use stridetransform + +--- + gst/playback/gstplaysink.c | 29 ++++------------------------- + 1 files changed, 4 insertions(+), 25 deletions(-) + +diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c +index bb41a03..dedd3be 100644 +--- a/gst/playback/gstplaysink.c ++++ b/gst/playback/gstplaysink.c +@@ -1267,13 +1267,13 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) + } + + if (raw && !(playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO)) { +- GST_DEBUG_OBJECT (playsink, "creating ffmpegcolorspace"); +- chain->conv = gst_element_factory_make ("ffmpegcolorspace", "vconv"); ++ GST_DEBUG_OBJECT (playsink, "creating stridetransform"); ++ chain->conv = gst_element_factory_make ("stridetransform", "vconv"); + if (chain->conv == NULL) { +- post_missing_element_message (playsink, "ffmpegcolorspace"); ++ post_missing_element_message (playsink, "stridetransform"); + GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), +- "ffmpegcolorspace"), ("video rendering might fail")); ++ "stridetransform"), ("video rendering might fail")); + } else { + gst_bin_add (bin, chain->conv); + if (prev) { +@@ -1285,27 +1285,6 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) + } + prev = chain->conv; + } +- +- GST_DEBUG_OBJECT (playsink, "creating videoscale"); +- chain->scale = gst_element_factory_make ("videoscale", "vscale"); +- if (chain->scale == NULL) { +- post_missing_element_message (playsink, "videoscale"); +- GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, +- (_("Missing element '%s' - check your GStreamer installation."), +- "videoscale"), ("possibly a liboil version mismatch?")); +- } else { +- /* Add black borders if necessary to keep the DAR */ +- g_object_set (chain->scale, "add-borders", TRUE, NULL); +- gst_bin_add (bin, chain->scale); +- if (prev) { +- if (!gst_element_link_pads_full (prev, "src", chain->scale, "sink", +- GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) +- goto link_failed; +- } else { +- head = chain->scale; +- } +- prev = chain->scale; +- } + } + + if (prev) { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0017-playbin-disable-interlaced-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0017-playbin-disable-interlaced-support.patch new file mode 100644 index 0000000..82a4ada --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0017-playbin-disable-interlaced-support.patch @@ -0,0 +1,33 @@ +From 82d8f741f626ed449c84e0ae4c8e27219557149e Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 19 Aug 2010 10:32:52 -0500 +Subject: [PATCH 17/24] playbin: disable interlaced support + +Latest totem is enabling interlaced support, which causes similar issues +to when native-video is not used.. for now, since none of the codecs +support it, disable interlaced support. +--- + gst/playback/gstplaysink.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c +index dedd3be..957f288 100644 +--- a/gst/playback/gstplaysink.c ++++ b/gst/playback/gstplaysink.c +@@ -2118,11 +2118,13 @@ gst_play_sink_reconfigure (GstPlaySink * playsink) + /* we have video and we are requested to show it */ + need_video = TRUE; + ++#if 0 + /* we only deinterlace if native video is not requested and + * we have raw video */ + if ((flags & GST_PLAY_FLAG_DEINTERLACE) + && !(flags & GST_PLAY_FLAG_NATIVE_VIDEO) && playsink->video_pad_raw) + need_deinterlace = TRUE; ++#endif + } + + if (playsink->audio_pad) { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0018-textoverlay-add-stride-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0018-textoverlay-add-stride-support.patch new file mode 100644 index 0000000..3eb146e --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0018-textoverlay-add-stride-support.patch @@ -0,0 +1,132 @@ +From 8cd575c6c2f46464d7704e07102a648bba08a6c6 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 23 Aug 2010 14:01:14 -0500 +Subject: [PATCH 18/24] textoverlay: add stride support + +--- + ext/pango/gsttextoverlay.c | 37 +++++++++++++++++++++++++------------ + ext/pango/gsttextoverlay.h | 1 + + 2 files changed, 26 insertions(+), 12 deletions(-) + +diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c +index 915a59c..1bf3638 100644 +--- a/ext/pango/gsttextoverlay.c ++++ b/ext/pango/gsttextoverlay.c +@@ -187,7 +187,7 @@ static GstStaticPadTemplate src_template_factory = + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xRGB ";" +- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}")) ++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]")) + ); + + static GstStaticPadTemplate video_sink_template_factory = +@@ -196,7 +196,7 @@ static GstStaticPadTemplate video_sink_template_factory = + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xRGB ";" +- GST_VIDEO_CAPS_YUV ("{AYUV, I420, UYVY, NV12, NV21}")) ++ GST_VIDEO_CAPS_YUV_STRIDED ("{AYUV, I420, UYVY, NV12, NV21}", "[0, max]")) + ); + + static GstStaticPadTemplate text_sink_template_factory = +@@ -724,12 +724,13 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) + + overlay->width = 0; + overlay->height = 0; ++ overlay->rowstride = 0; + structure = gst_caps_get_structure (caps, 0); + fps = gst_structure_get_value (structure, "framerate"); + + if (fps +- && gst_video_format_parse_caps (caps, &overlay->format, &overlay->width, +- &overlay->height)) { ++ && gst_video_format_parse_caps_strided (caps, &overlay->format, &overlay->width, ++ &overlay->height, &overlay->rowstride)) { + ret = gst_pad_set_caps (overlay->srcpad, caps); + } + +@@ -1364,14 +1365,21 @@ gst_text_overlay_render_pangocairo (GstTextOverlay * overlay, + #define BOX_XPAD 6 + #define BOX_YPAD 6 + ++static gint ++gst_text_overlay_get_stride (GstTextOverlay * overlay, gint component) ++{ ++ if (overlay->rowstride) ++ return overlay->rowstride; ++ return gst_video_format_get_row_stride (overlay->format, 0, overlay->width); ++} ++ + static inline void + gst_text_overlay_shade_planar_Y (GstTextOverlay * overlay, guchar * dest, + gint x0, gint x1, gint y0, gint y1) + { + gint i, j, dest_stride; + +- dest_stride = gst_video_format_get_row_stride (overlay->format, 0, +- overlay->width); ++ dest_stride = gst_text_overlay_get_stride (overlay, 0); + + x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width); + x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width); +@@ -1436,7 +1444,9 @@ static inline void + gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest, + gint x0, gint x1, gint y0, gint y1) + { +- gint i, j; ++ gint i, j, dest_stride; ++ ++ dest_stride = gst_text_overlay_get_stride (overlay, 0); + + x0 = CLAMP (x0 - BOX_XPAD, 0, overlay->width); + x1 = CLAMP (x1 + BOX_XPAD, 0, overlay->width); +@@ -1448,7 +1458,7 @@ gst_text_overlay_shade_xRGB (GstTextOverlay * overlay, guchar * dest, + for (j = x0; j < x1; j++) { + gint y, y_pos, k; + +- y_pos = (i * 4 * overlay->width) + j * 4; ++ y_pos = (i * dest_stride) + j * 4; + for (k = 0; k < 4; k++) { + y = dest[y_pos + k] + overlay->shading_value; + dest[y_pos + k] = CLAMP (y, 0, 255); +@@ -1480,10 +1490,10 @@ gst_text_overlay_blit_NV12_NV21 (GstTextOverlay * overlay, + w = overlay->width; + h = overlay->height; + +- y_stride = gst_video_format_get_row_stride (overlay->format, 0, w); +- uv_stride = gst_video_format_get_row_stride (overlay->format, 1, w); +- u_offset = gst_video_format_get_component_offset (overlay->format, 1, w, h); +- v_offset = gst_video_format_get_component_offset (overlay->format, 2, w, h); ++ y_stride = gst_text_overlay_get_stride (overlay, 0); ++ uv_stride = gst_text_overlay_get_stride (overlay, 1); ++ u_offset = gst_video_format_get_component_offset (overlay->format, 1, y_stride, h); ++ v_offset = gst_video_format_get_component_offset (overlay->format, 2, y_stride, h); + + gst_text_overlay_blit_1 (overlay, yuv_pixels, xpos, ypos, overlay->text_image, + y_stride); +@@ -1509,6 +1519,9 @@ gst_text_overlay_blit_I420 (GstTextOverlay * overlay, + w = overlay->width; + h = overlay->height; + ++ /* XXX this is not updated for rowstride.. but rowstride could be ++ * ambiguous for I420.. is the U and V plane rowstride or rowstride/2? ++ */ + y_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 0, w); + u_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 1, w); + v_stride = gst_video_format_get_row_stride (GST_VIDEO_FORMAT_I420, 2, w); +diff --git a/ext/pango/gsttextoverlay.h b/ext/pango/gsttextoverlay.h +index 5fddf3a..bc2940b 100644 +--- a/ext/pango/gsttextoverlay.h ++++ b/ext/pango/gsttextoverlay.h +@@ -112,6 +112,7 @@ struct _GstTextOverlay { + + gint width; + gint height; ++ gint rowstride; + gint fps_n; + gint fps_d; + GstVideoFormat format; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0019-video-more-flexible-video-caps-utility.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0019-video-more-flexible-video-caps-utility.patch new file mode 100644 index 0000000..a3593b0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0019-video-more-flexible-video-caps-utility.patch @@ -0,0 +1,228 @@ +From ecac5f6e2cab295e742784f6d4d11800b1f37c6d Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 13 Sep 2010 19:04:47 -0500 +Subject: [PATCH 19/24] video: more flexible video caps utility + +Add gst_video_format_new_caps_simple() to allow for more flexible video +caps builder, which could be used for template caps and non-fixed caps. +--- + gst-libs/gst/video/video.c | 129 ++++++++++++++++++++++++++------------------ + gst-libs/gst/video/video.h | 2 + + 2 files changed, 78 insertions(+), 53 deletions(-) + +diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c +index ff9c4fb..ef8edcc 100644 +--- a/gst-libs/gst/video/video.c ++++ b/gst-libs/gst/video/video.c +@@ -590,15 +590,12 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + } + + /** +- * gst_video_format_new_caps_strided: ++ * gst_video_format_new_caps_simple: + * @format: the #GstVideoFormat describing the raw video format +- * @width: width of video +- * @height: height of video +- * @rowstride: the rowstride (in bytes), or 0 if no rowstride +- * @framerate_n: numerator of frame rate +- * @framerate_d: denominator of frame rate +- * @par_n: numerator of pixel aspect ratio +- * @par_d: denominator of pixel aspect ratio ++ * @rowstride: 0 for unstrided, -1 for any stride (unfixed), or other ++ * for fixed stride ++ * @fieldname: first field to set ++ * @...: additional arguments + * + * Creates a new #GstCaps object based on the parameters provided. + * +@@ -607,25 +604,20 @@ gst_video_format_new_caps_interlaced (GstVideoFormat format, + * Returns: a new #GstCaps object, or NULL if there was an error + */ + GstCaps * +-gst_video_format_new_caps_strided (GstVideoFormat format, +- int width, int height, int rowstride, +- int framerate_n, int framerate_d, int par_n, int par_d) ++gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, ++ const char *fieldname, ...) + { +- GstCaps *caps = NULL; ++ va_list varargs; ++ GstStructure *s; + + g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); +- g_return_val_if_fail (width > 0 && height > 0, NULL); + + if (gst_video_format_is_yuv (format)) { +- caps = gst_caps_new_simple ( +- rowstride ? "video/x-raw-yuv-strided" : "video/x-raw-yuv", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-yuv-strided" : "video/x-raw-yuv", + "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format), +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } else if (gst_video_format_is_rgb (format)) { +- GstCaps *caps; + int red_mask = 0; + int blue_mask = 0; + int green_mask = 0; +@@ -684,15 +676,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } else { + mask = 0xff0000; + } +- red_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 0, +- width, height)); +- green_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 1, +- width, height)); +- blue_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 2, +- width, height)); ++ red_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 0, 1, 1)); ++ green_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 1, 1, 1)); ++ blue_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 2, 1, 1)); + } else if (bpp == 16) { + switch (format) { + case GST_VIDEO_FORMAT_RGB16: +@@ -723,17 +712,13 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + return NULL; + } + +- caps = gst_caps_new_simple ( ++ s = gst_structure_new ( + rowstride ? "video/x-raw-rgb-strided" : "video/x-raw-rgb", + "bpp", G_TYPE_INT, bpp, +- "depth", G_TYPE_INT, depth, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ "depth", G_TYPE_INT, depth, NULL); + + if (bpp != 8) { +- gst_caps_set_simple (caps, ++ gst_structure_set (s, + "endianness", G_TYPE_INT, G_BIG_ENDIAN, + "red_mask", G_TYPE_INT, red_mask, + "green_mask", G_TYPE_INT, green_mask, +@@ -741,10 +726,12 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } + + if (have_alpha) { +- alpha_mask = +- mask >> (8 * gst_video_format_get_component_offset (format, 3, +- width, height)); +- gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); ++ /* note: we are passing a bogus width/height to get_component_offset(), ++ * but those parameters are ignored for the packed formats so it is ok ++ */ ++ alpha_mask = mask >> ++ (8 * gst_video_format_get_component_offset (format, 3, 1, 1)); ++ gst_structure_set (s, "alpha_mask", G_TYPE_INT, alpha_mask, NULL); + } + } else if (gst_video_format_is_gray (format)) { + int bpp; +@@ -770,32 +757,68 @@ gst_video_format_new_caps_strided (GstVideoFormat format, + } + + if (bpp > 8) { +- caps = gst_caps_new_simple ("video/x-raw-gray", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-gray-strided" : "video/x-raw-gray", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } else { +- caps = gst_caps_new_simple ("video/x-raw-gray", ++ s = gst_structure_new (rowstride ? ++ "video/x-raw-gray-strided" : "video/x-raw-gray", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "endianness", G_TYPE_INT, G_BIG_ENDIAN, +- "width", G_TYPE_INT, width, +- "height", G_TYPE_INT, height, +- "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, +- "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); ++ NULL); + } + } else { + return NULL; + } + +- if (rowstride) { +- gst_caps_set_simple (caps, "rowstride", G_TYPE_INT, rowstride, NULL); ++ if (rowstride > 0) { ++ gst_structure_set (s, "rowstride", ++ G_TYPE_INT, rowstride, NULL); ++ } else if (rowstride < 0) { ++ gst_structure_set (s, "rowstride", ++ GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + } + +- return caps; ++ va_start (varargs, fieldname); ++ gst_structure_set_valist (s, fieldname, varargs); ++ va_end (varargs); ++ ++ return gst_caps_new_full (s, NULL); ++} ++ ++/** ++ * gst_video_format_new_caps_strided: ++ * @format: the #GstVideoFormat describing the raw video format ++ * @width: width of video ++ * @height: height of video ++ * @rowstride: the rowstride (in bytes), or 0 if no rowstride ++ * @framerate_n: numerator of frame rate ++ * @framerate_d: denominator of frame rate ++ * @par_n: numerator of pixel aspect ratio ++ * @par_d: denominator of pixel aspect ratio ++ * ++ * Creates a new #GstCaps object based on the parameters provided. ++ * ++ * Since: ??? ++ * ++ * Returns: a new #GstCaps object, or NULL if there was an error ++ */ ++GstCaps * ++gst_video_format_new_caps_strided (GstVideoFormat format, ++ int width, int height, int rowstride, ++ int framerate_n, int framerate_d, int par_n, int par_d) ++{ ++ g_return_val_if_fail (width > 0 && height > 0, NULL); ++ ++ return gst_video_format_new_caps_simple (format, rowstride, ++ "width", G_TYPE_INT, width, ++ "height", G_TYPE_INT, height, ++ "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d, ++ "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, ++ NULL); + } + + /** +diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h +index 5bac21f..bbd33f7 100644 +--- a/gst-libs/gst/video/video.h ++++ b/gst-libs/gst/video/video.h +@@ -430,6 +430,8 @@ GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format, + GstCaps * gst_video_format_new_caps_strided (GstVideoFormat format, + int width, int height, int rowstride, + int framerate_n, int framerate_d, int par_n, int par_d); ++GstCaps * gst_video_format_new_caps_simple (GstVideoFormat format, ++ int rowstride, const char *fieldname, ...); + GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc); + guint32 gst_video_format_to_fourcc (GstVideoFormat format); + gboolean gst_video_format_is_rgb (GstVideoFormat format); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch new file mode 100644 index 0000000..26910a9 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0020-video-fix-endianess-issue-for-16bit-RGB-formats.patch @@ -0,0 +1,41 @@ +From 569f9ca7a8ce923d43956771e8a142a9b31114f1 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 13 Sep 2010 19:05:56 -0500 +Subject: [PATCH 20/24] video: fix endianess issue for 16bit RGB formats + +--- + gst-libs/gst/video/video.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c +index ef8edcc..a5ec6b7 100644 +--- a/gst-libs/gst/video/video.c ++++ b/gst-libs/gst/video/video.c +@@ -625,6 +625,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, + int depth; + int bpp; + gboolean have_alpha; ++ int endianness = G_BIG_ENDIAN; + unsigned int mask = 0; + + switch (format) { +@@ -708,6 +709,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, + default: + return NULL; + } ++ endianness = G_BYTE_ORDER; + } else if (bpp != 8) { + return NULL; + } +@@ -719,7 +721,7 @@ gst_video_format_new_caps_simple (GstVideoFormat format, int rowstride, + + if (bpp != 8) { + gst_structure_set (s, +- "endianness", G_TYPE_INT, G_BIG_ENDIAN, ++ "endianness", G_TYPE_INT, endianness, + "red_mask", G_TYPE_INT, red_mask, + "green_mask", G_TYPE_INT, green_mask, + "blue_mask", G_TYPE_INT, blue_mask, NULL); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0021-stride-more-flexible-stride-color-conversion.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0021-stride-more-flexible-stride-color-conversion.patch new file mode 100644 index 0000000..51ed9e4 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0021-stride-more-flexible-stride-color-conversion.patch @@ -0,0 +1,1131 @@ +From e8e3c9ae037daa4abd60f08bc49f370dd5f7b3c6 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 13 Sep 2010 19:10:36 -0500 +Subject: [PATCH 21/24] stride: more flexible stride/color conversion + +Refactor stride transform element to address a number of limitations: +1) support converting buffers from one rowstride to another, in addition to +just handling conversion from strided <-> unstrided. +2) refactor convert code to make it easier to add new formats +3) refactor caps handling code to build template caps based upon color +formats listed in convert (stride_conversions table). +4) refactor caps parsing/building to correctly handle RGB formats +5) add support for crop.. currently we optimize by just only copying the +uncropped part of the frame, but this is the first step to true handling of +cropping, so that we can crop out padding for the benefit of sink elements +that don't understand crop or stride. (The convert code handles it fine.. +the caps parsing/building in gststridetransform.c would need to handle caps +re-negotiation when the crop changes for this to be complete.) +--- + gst/stride/armv7.s | 8 +- + gst/stride/convert.c | 400 ++++++++++++++++++++------------------- + gst/stride/gststridetransform.c | 375 +++++++++++++++++++++++++------------ + gst/stride/gststridetransform.h | 25 +++- + 4 files changed, 490 insertions(+), 318 deletions(-) + +diff --git a/gst/stride/armv7.s b/gst/stride/armv7.s +index 2697a14..5f4200d 100644 +--- a/gst/stride/armv7.s ++++ b/gst/stride/armv7.s +@@ -28,7 +28,7 @@ + .global stride_copy_zip2 + .type stride_copy_zip2, %function + @void +-@stride_copy_zip2 (guchar *new_buf, guchar *orig_buf1, guchar *orig_buf2, gint sz) ++@stride_copy_zip2 (guchar * out, guchar * in1, guchar * in2, gint sz) + @{ + @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved + stride_copy_zip2: +@@ -74,8 +74,8 @@ stride_copy_zip2_3: + .global stride_copy_zip3a + .type stride_copy_zip3a, %function + @void +-@stride_copy_zip3a (guchar *new_buf, +-@ guchar *orig_buf1, guchar *orig_buf2, guchar *orig_buf3, gint sz) ++@stride_copy_zip3a (guchar * out, ++@ guchar * in1, guchar * in2, guchar * in3, gint sz) + @{ + @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved + stride_copy_zip3a: +@@ -136,7 +136,7 @@ stride_copy_zip3a_3: + .global stride_copy + .type stride_copy, %function + @void +-@stride_copy (guchar *new_buf, guchar *orig_buf, gint sz) ++@stride_copy (guchar *out, guchar *in, gint sz) + @{ + @@@@ note: r0-r3, q0-3, and q8-q15 do not need to be preserved + stride_copy: +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index 17f9e2a..5d392ac 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -55,32 +55,31 @@ void stride_copy_zip3a (guchar * new_buf, guchar * orig_buf1, + void stride_copy (guchar * new_buf, guchar * orig_buf, gint sz); + + WEAK void +-stride_copy_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, +- gint sz) ++stride_copy_zip2 (guchar * out, guchar * in1, guchar * in2, gint sz) + { + while (sz--) { +- *new_buf++ = *orig_buf1++; +- *new_buf++ = *orig_buf2++; ++ *out++ = *in1++; ++ *out++ = *in2++; + } + } + + WEAK void +-stride_copy_zip3a (guchar * new_buf, +- guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, gint sz) ++stride_copy_zip3a (guchar * out, ++ guchar * in1, guchar * in2, guchar * in3, gint sz) + { + while (sz > 1) { +- *new_buf++ = *orig_buf1++; +- *new_buf++ = *orig_buf2++; +- *new_buf++ = *orig_buf1++; +- *new_buf++ = *orig_buf3++; ++ *out++ = *in1++; ++ *out++ = *in2++; ++ *out++ = *in1++; ++ *out++ = *in3++; + sz -= 2; + } + } + + WEAK void +-stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) ++stride_copy (guchar * out, guchar * in, gint sz) + { +- memcpy (new_buf, orig_buf, sz); ++ memcpy (out, in, sz); + } + + +@@ -88,31 +87,19 @@ stride_copy (guchar * new_buf, guchar * orig_buf, gint sz) + * move to strided buffer, interleaving two planes of identical dimensions + */ + static void +-stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, +- gint new_width, gint orig_width, gint height) ++stridemove_zip2 (guchar * out, guchar * in1, guchar * in2, ++ gint out_bpl, gint in_bpl, gint width, gint height) + { + int row; + + GST_DEBUG +- ("new_buf=%p, orig_buf1=%p, orig_buf2=%p, new_width=%d, orig_width=%d, height=%d", +- new_buf, orig_buf1, orig_buf2, new_width, orig_width, height); +- +- /* if increasing the stride, work from bottom-up to avoid overwriting data +- * that has not been moved yet.. otherwise, work in the opposite order, +- * for the same reason. +- */ +- if (new_width > orig_width) { +- for (row = height - 1; row >= 0; row--) { +- stride_copy_zip2 (new_buf + (new_width * row), +- orig_buf1 + (orig_width * row), +- orig_buf2 + (orig_width * row), orig_width); +- } +- } else { +- for (row = 0; row < height; row++) { +- stride_copy_zip2 (new_buf + (new_width * row), +- orig_buf1 + (orig_width * row), +- orig_buf2 + (orig_width * row), new_width); +- } ++ ("out=%p, in1=%p, in2=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", ++ out, in1, in2, out_bpl, in_bpl, width, height); ++ ++ for (row = 0; row < height; row++) { ++ stride_copy_zip2 (out + (out_bpl * row), ++ in1 + (in_bpl * row), ++ in2 + (in_bpl * row), width); + } + } + +@@ -121,26 +108,28 @@ stridemove_zip2 (guchar * new_buf, guchar * orig_buf1, guchar * orig_buf2, + * (orig_buf1) has 2x as many samples.. Ie. ABACABAC.. + */ + static void +-stridemove_zip3a (guchar * new_buf, +- guchar * orig_buf1, guchar * orig_buf2, guchar * orig_buf3, +- guint new_width, gint orig_width, gint height) ++stridemove_zip3a (guchar * out, ++ guchar * in1, guchar * in2, guchar * in3, ++ guint out_bpl, gint in_bpl, gint width, gint height) + { +- gint copy_width = (new_width < orig_width) ? new_width : orig_width; ++ GST_DEBUG ++ ("out=%p, in1=%p, in2=%p, in3=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", ++ out, in1, in2, in3, out_bpl, in_bpl, width, height); + + while (height > 0) { + + /* even row */ +- stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); +- new_buf += new_width; +- orig_buf1 += orig_width; ++ stride_copy_zip3a (out, in1, in2, in3, width); ++ out += out_bpl; ++ in1 += in_bpl; + + /* odd row, recycles same U & V */ +- stride_copy_zip3a (new_buf, orig_buf1, orig_buf2, orig_buf3, copy_width); +- new_buf += new_width; +- orig_buf1 += orig_width; ++ stride_copy_zip3a (out, in1, in2, in3, width); ++ out += out_bpl; ++ in1 += in_bpl; + +- orig_buf2 += orig_width / 2; +- orig_buf3 += orig_width / 2; ++ in2 += in_bpl / 2; ++ in3 += in_bpl / 2; + + height -= 2; + } +@@ -154,28 +143,18 @@ stridemove_zip3a (guchar * new_buf, + * enough. + */ + static void +-stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, +- gint orig_width, gint height) ++stridemove (guchar * out, guchar * in, gint out_bpl, gint in_bpl, ++ gint width, gint height) + { + int row; + +- GST_DEBUG ("new_buf=%p, orig_buf=%p, new_width=%d, orig_width=%d, height=%d", +- new_buf, orig_buf, new_width, orig_width, height); +- +- /* if increasing the stride, work from bottom-up to avoid overwriting data +- * that has not been moved yet.. otherwise, work in the opposite order, +- * for the same reason. +- */ +- if (new_width > orig_width) { +- for (row = height - 1; row >= 0; row--) { +- stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), +- orig_width); +- } +- } else { +- for (row = 0; row < height; row++) { +- stride_copy (new_buf + (new_width * row), orig_buf + (orig_width * row), +- new_width); +- } ++ GST_DEBUG ("out=%p, in=%p, out_bpl=%d, in_bpl=%d, width=%d, height=%d", ++ out, in, out_bpl, in_bpl, width, height); ++ ++ for (row = 0; row < height; row++) { ++ stride_copy (out, in, width); ++ out += out_bpl; ++ in += in_bpl; + } + } + +@@ -183,195 +162,232 @@ stridemove (guchar * new_buf, guchar * orig_buf, gint new_width, + * Conversion Functions: + */ + +-/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ +-static GstFlowReturn +-unstridify_420sp_420sp (GstStrideTransform * self, guchar * unstrided, +- guchar * strided) ++/** ++ * helper to calculate offsets/sizes that are re-used for each frame (until ++ * caps or crop changes) ++ * @isx: input sub-sampling in x direction ++ * @osx: output sub-sampling in x direction ++ * @isy: input sub-sampling in y direction ++ * @isx: input sub-sampling in y direction ++ */ ++static inline gboolean refresh_cache(GstStrideTransform * self, ++ gint nplanes, gint bpp, gint * isx, gint * osx, gint * isy, gint * osy) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; ++ gint in_off, out_off; ++ int i; + +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ if (((self->crop_top + self->crop_height) > self->height) || ++ ((self->crop_left + self->crop_width) > self->width)) { ++ GST_ERROR_OBJECT (self, "invalid crop parameter"); ++ return GST_FLOW_ERROR; ++ } + +- stridemove (unstrided, strided, width, stride, +- (GST_ROUND_UP_2 (height) * 3) / 2); ++ in_off = out_off = 0; + +- return GST_FLOW_OK; +-} ++ for (i = 0; i < nplanes; i++) { ++ Cache * cache = &self->cache[i]; + +-static GstFlowReturn +-stridify_420sp_420sp (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) +-{ +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; ++ cache->in_bpl = self->in_rowstride ? ++ self->in_rowstride : bpp * self->width; + +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ cache->out_bpl = self->out_rowstride ? ++ self->out_rowstride : bpp * self->width; + +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- stridemove (strided, unstrided, stride, width, +- (GST_ROUND_UP_2 (height) * 3) / 2); ++ if ((cache->in_bpl < (self->width * bpp)) || ++ (cache->out_bpl < (self->width * bpp))) { ++ GST_ERROR_OBJECT (self, "invalid stride parameter"); ++ return GST_FLOW_ERROR; ++ } + +- return GST_FLOW_OK; +-} ++ cache->width = self->crop_width ? ++ self->crop_width : self->width; + +-/** convert 4:2:0 planar to same 4:2:0 planar */ +-static GstFlowReturn +-unstridify_420p_420p (GstStrideTransform * self, guchar * unstrided, +- guchar * strided) +-{ +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; ++ cache->height = self->crop_height ? ++ self->crop_height : self->height; + +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ if ((cache->width > self->width) || ++ (cache->height > self->height)) { ++ GST_ERROR_OBJECT (self, "invalid crop width/height parameter"); ++ return GST_FLOW_ERROR; ++ } + +- stridemove (unstrided, strided, width, stride, height); /* move Y */ +- stridemove (unstrided + (height * width), strided + (height * stride), width / 2, stride, height); /* move V/U */ +- /* XXX odd widths/heights/strides: */ +- stridemove (unstrided + (int) (height * width * 1.5), strided + (int) (height * stride * 1.5), width / 2, stride, height); /* move U/V */ ++ /* note: everything above here is same for each plane, so in theory we ++ * could only calculate on first plane, and copy on subsequent planes ++ */ ++ ++ /* adjust for sub-sampling and bytes per pixel (bpp): */ ++ cache->in_bpl /= *isx; ++ cache->out_bpl /= *osx; ++ cache->width *= bpp; ++ cache->width /= *isx; ++ cache->height /= *isy; ++ ++ /* calculate offset to beginning of data to copy/transform: */ ++ cache->in_off = in_off; ++ cache->in_off += (bpp * self->crop_left / *isx) + ++ (cache->in_bpl * self->crop_top / *isy); ++ ++ cache->out_off = out_off; ++ cache->out_off += (bpp * self->crop_left / *osx) + ++ (cache->out_bpl * self->crop_top / *osy); ++ ++ in_off += (self->height / *isy) * cache->in_bpl; ++ out_off += (self->height / *osy) * cache->out_bpl; ++ ++ osx++; ++ isx++; ++ osy++; ++ isy++; ++ } + + return GST_FLOW_OK; + } + +-static GstFlowReturn +-stridify_420p_420p (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++/** perform simple convert between buffers of same format */ ++static inline GstFlowReturn convert_n_n (GstStrideTransform *self, ++ guchar * out, guchar * in, gint nplanes) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; +- +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ int i; + +- /* XXX odd widths/heights/strides: */ +- stridemove (strided + (int) (height * stride * 1.5), unstrided + (int) (height * width * 1.5), stride, width / 2, height); /* move U/V */ +- stridemove (strided + (height * stride), unstrided + (height * width), stride, width / 2, height); /* move V/U */ +- stridemove (strided, unstrided, stride, width, height); /* move Y */ ++ for (i = 0; i < nplanes; i++) { ++ stridemove (out + self->cache[i].out_off, in + self->cache[i].in_off, ++ self->cache[i].out_bpl, self->cache[i].in_bpl, ++ self->cache[i].width, self->cache[i].height); ++ } + + return GST_FLOW_OK; + } + +-/** convert 4:2:2 packed to same 4:2:2 packed */ ++/** convert 4:2:0 semiplanar to same 4:2:0 semiplanar */ + static GstFlowReturn +-unstridify_422i_422i (GstStrideTransform * self, guchar * unstrided, +- guchar * strided) ++convert_420sp_420sp (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; +- +- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); +- +- stridemove (unstrided, strided, width * 2, stride, height); ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint sx[] = {1, 1}; ++ gint sy[] = {1, 2}; ++ if (refresh_cache (self, 2, 1, sx, sx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } + +- return GST_FLOW_OK; ++ return convert_n_n (self, out, in, 2); + } + ++/** convert 4:2:0 planar to same 4:2:0 planar */ + static GstFlowReturn +-stridify_422i_422i (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++convert_420p_420p (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; +- +- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); +- +- stridemove (strided, unstrided, stride, width * 2, height); ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint sx[] = {1, 2, 2}; ++ gint sy[] = {1, 2, 2}; ++ if (refresh_cache (self, 3, 1, sx, sx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } + +- return GST_FLOW_OK; ++ return convert_n_n (self, out, in, 3); + } + +-/** convert I420 unstrided to NV12 strided */ ++/** convert 4:2:2 packed to same 4:2:2 packed */ ++ + static GstFlowReturn +-stridify_i420_nv12 (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++convert_422i_422i (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; +- +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); +- +- /* XXX widths/heights/strides that are not multiple of four??: */ +- stridemove_zip2 (strided + (height * stride), unstrided + (height * width), /* U */ +- unstrided + (int) (height * width * 1.25), /* V */ +- stride, width / 2, height / 2); +- stridemove (strided, unstrided, stride, width, height); /* Y */ ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint sx[] = {1}; ++ gint sy[] = {1}; ++ if (refresh_cache (self, 1, 2, sx, sx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } + +- return GST_FLOW_OK; ++ return convert_n_n (self, out, in, 1); + } + +-/** convert I420 unstrided to YUY2 strided */ ++/** convert I420 unstrided to NV12 strided */ + static GstFlowReturn +-stridify_i420_yuy2 (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++convert_i420_nv12 (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; ++ GstFlowReturn ret; ++ ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint isx[] = {1, 2, 2}; ++ gint osx[] = {1, 1, 1}; ++ gint sy[] = {1, 2, 2}; ++ if (refresh_cache (self, 3, 1, isx, osx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } + +- g_return_val_if_fail (stride >= width, GST_FLOW_ERROR); ++ ret = convert_n_n (self, out, in, 1); ++ if (ret != GST_FLOW_OK) ++ return ret; + +- /* XXX widths/heights/strides that are not multiple of four??: */ +- stridemove_zip3a (strided, unstrided, /* Y */ +- unstrided + (height * width), /* U */ +- unstrided + (int) (height * width * 1.25), /* V */ +- stride, width, height); ++ stridemove_zip2 (out + self->cache[1].out_off, ++ in + self->cache[1].in_off, /* U */ ++ in + self->cache[2].in_off, /* V */ ++ self->cache[2].out_bpl, ++ self->cache[1].in_bpl, ++ self->cache[1].width, ++ self->cache[1].height); + + return GST_FLOW_OK; + } + +-/** convert RGB565 to RGB565 strided **/ ++/** convert I420 unstrided to YUY2 strided */ + static GstFlowReturn +-stridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++convert_i420_yuy2 (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->out_rowstride; +- +- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint sx[] = {1, 2, 2}; ++ gint sy[] = {1, 2, 2}; ++ if (refresh_cache (self, 3, 1, sx, sx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } + +- stridemove (strided, unstrided, stride, width * 2, height); ++ stridemove_zip3a (out, ++ in + self->cache[0].in_off, /* Y */ ++ in + self->cache[1].in_off, /* U */ ++ in + self->cache[2].in_off, /* V */ ++ self->cache[0].out_bpl, ++ self->cache[0].in_bpl, ++ self->cache[0].width, ++ self->cache[0].height); + + return GST_FLOW_OK; + } + +-/** convert RGB565 strided to RGB565 **/ ++/** convert 16bpp rgb formats */ + static GstFlowReturn +-unstridify_rgb565_rgb565 (GstStrideTransform * self, guchar * strided, +- guchar * unstrided) ++convert_rgb16_rgb16 (GstStrideTransform * self, ++ guchar * out, guchar * in) + { +- gint width = self->width; +- gint height = self->height; +- gint stride = self->in_rowstride; +- +- g_return_val_if_fail (stride >= (width * 2), GST_FLOW_ERROR); +- +- stridemove (unstrided, strided, width * 2, stride, height); +- return GST_FLOW_OK; ++ /* format is same 2-bytes per pixel */ ++ return convert_422i_422i (self, out, in); + } + +-#define CONVERT(tofmt, fromfmt, stridify, unstridify) \ ++#define CONVERT(tofmt, fromfmt, convert) \ + { \ + { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ +- stridify, unstridify \ ++ convert \ + } + + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ + const Conversion stride_conversions[] = { +- CONVERT (NV12, NV12, stridify_420sp_420sp, unstridify_420sp_420sp), +- CONVERT (I420, I420, stridify_420p_420p, unstridify_420p_420p), +- CONVERT (YV12, YV12, stridify_420p_420p, unstridify_420p_420p), +- CONVERT (YUY2, YUY2, stridify_422i_422i, unstridify_422i_422i), +- CONVERT (UYVY, UYVY, stridify_422i_422i, unstridify_422i_422i), +- CONVERT (I420, NV12, stridify_i420_nv12, NULL), +- CONVERT (I420, YUY2, stridify_i420_yuy2, NULL), +- CONVERT (RGB16, RGB16, stridify_rgb565_rgb565, unstridify_rgb565_rgb565), ++ CONVERT (NV12, NV12, convert_420sp_420sp), ++ CONVERT (I420, I420, convert_420p_420p), ++ CONVERT (YV12, YV12, convert_420p_420p), ++ CONVERT (YUY2, YUY2, convert_422i_422i), ++ CONVERT (UYVY, UYVY, convert_422i_422i), ++ CONVERT (I420, NV12, convert_i420_nv12), ++ CONVERT (I420, YUY2, convert_i420_yuy2), ++ CONVERT (RGB16, RGB16, convert_rgb16_rgb16), + /* add new entries before here */ + {{GST_VIDEO_FORMAT_UNKNOWN}} + }; +diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c +index 4469e7f..7874ed4 100644 +--- a/gst/stride/gststridetransform.c ++++ b/gst/stride/gststridetransform.c +@@ -57,27 +57,6 @@ + /* last entry has GST_VIDEO_FORMAT_UNKNOWN for in/out formats */ + extern const Conversion stride_conversions[]; + +-/* TODO: add rgb formats too! */ +-#define YUV_SUPPORTED_CAPS \ +- GST_VIDEO_CAPS_YUV_STRIDED ("{I420, YV12, YUY2, UYVY, NV12 }", "[ 0, max ]") +- +-#define RGB_SUPPORTED_CAPS \ +- GST_VIDEO_CAPS_RGB_16_STRIDED ("[ 0, max ]") +- +- +-static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", +- GST_PAD_SRC, +- GST_PAD_ALWAYS, +- GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) +- ); +- +-static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", +- GST_PAD_SINK, +- GST_PAD_ALWAYS, +- GST_STATIC_CAPS (YUV_SUPPORTED_CAPS ";" RGB_SUPPORTED_CAPS) +- ); +- +- + GST_DEBUG_CATEGORY (stridetransform_debug); + #define GST_CAT_DEFAULT stridetransform_debug + +@@ -85,6 +64,8 @@ GST_DEBUG_CATEGORY (stridetransform_debug); + static void gst_stride_transform_dispose (GObject * obj); + + /* GstBaseTransform functions */ ++static gboolean gst_stride_transform_event (GstBaseTransform * trans, ++ GstEvent * event); + static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, + GstCaps * caps, guint * size); + static gboolean gst_stride_transform_transform_size (GstBaseTransform * base, +@@ -96,6 +77,7 @@ static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, + GstCaps * incaps, GstCaps * outcaps); + static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, + GstBuffer * inbuf, GstBuffer * outbuf); ++static GstCaps * get_all_templ_caps (GstPadDirection direction); + + GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, + GST_TYPE_VIDEO_FILTER); +@@ -115,9 +97,11 @@ gst_stride_transform_base_init (gpointer g_class) + "Rob Clark <rob@ti.com>,"); + + gst_element_class_add_pad_template (gstelement_class, +- gst_static_pad_template_get (&sink_template)); ++ gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, ++ get_all_templ_caps (GST_PAD_SINK))); + gst_element_class_add_pad_template (gstelement_class, +- gst_static_pad_template_get (&src_template)); ++ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, ++ get_all_templ_caps (GST_PAD_SRC))); + } + + static void +@@ -128,6 +112,8 @@ gst_stride_transform_class_init (GstStrideTransformClass * klass) + + gobject_class->dispose = gst_stride_transform_dispose; + ++ basetransform_class->event = ++ GST_DEBUG_FUNCPTR (gst_stride_transform_event); + basetransform_class->get_unit_size = + GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); + basetransform_class->transform_size = +@@ -160,6 +146,35 @@ gst_stride_transform_dispose (GObject * object) + G_OBJECT_CLASS (parent_class)->dispose (object); + } + ++static gboolean ++gst_stride_transform_event (GstBaseTransform * trans, GstEvent * event) ++{ ++ GstStrideTransform *self = GST_STRIDE_TRANSFORM (trans); ++ ++ GST_DEBUG_OBJECT (self, "event %" GST_PTR_FORMAT, event); ++ ++ switch (GST_EVENT_TYPE (event)) { ++ /* if we get a crop, we don't change output size (yet, although it ++ * would be nice to be able to figure out if the sink supported ++ * cropping and if it does not perform the crop ourselves.. which ++ * would involve adjusting output caps appropriately). For now ++ * we just treat it as an optimization and avoid copying the data ++ * that will be later cropped out by the sink. ++ */ ++ case GST_EVENT_CROP: ++ gst_event_parse_crop (event, &self->crop_top, &self->crop_left, ++ &self->crop_width, &self->crop_height); ++ self->needs_refresh = TRUE; ++ GST_DEBUG_OBJECT (self, "cropping at %d,%d %dx%d", self->crop_top, ++ self->crop_left, self->crop_width, self->crop_height); ++ default: ++ break; ++ } ++ ++ /* forward all events */ ++ return TRUE; ++} ++ + /** + * figure out the required buffer size based on @caps + */ +@@ -212,95 +227,205 @@ gst_stride_transform_transform_size (GstBaseTransform * base, + return TRUE; + } + ++static inline GstCaps * ++get_templ_caps (GstVideoFormat fmt, gboolean strided) ++{ ++ return gst_video_format_new_caps_simple (fmt, ++ strided ? -1 : 0, ++ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, ++ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, ++ NULL); ++} ++ + /** +- * helper to check possible @fourcc conversions to the list @formats ++ * Utility to get all possible template caps for given direction + */ +-static void +-add_all_fourcc_conversions (GValue * formats, guint32 fourcc, +- GstPadDirection direction) ++static GstCaps * ++get_all_templ_caps (GstPadDirection direction) + { ++ int i; + gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; +- gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; +- GValue fourccval = { 0 }; +- gint i; +- GstVideoFormat format = gst_video_format_from_fourcc (fourcc); +- +- g_value_init (&fourccval, GST_TYPE_FOURCC); ++ GstCaps *templ = gst_caps_new_empty (); + +- for (i = 0; stride_conversions[i].format[0] != GST_VIDEO_FORMAT_UNKNOWN; i++) { +- if (stride_conversions[i].format[from_format] == format) { +- guint result_fourcc = +- gst_video_format_to_fourcc (stride_conversions[i].format[to_format]); +- gst_value_set_fourcc (&fourccval, result_fourcc); +- gst_value_list_append_value (formats, &fourccval); +- } ++ for (i = 0; stride_conversions[i].format[0]; i++) { ++ const Conversion *c = &stride_conversions[i]; ++ gst_caps_append (templ, get_templ_caps (c->format[to_format], TRUE)); ++ gst_caps_append (templ, get_templ_caps (c->format[to_format], FALSE)); + } ++ ++ gst_caps_do_simplify (templ); ++ ++ GST_DEBUG ("template %s caps: %"GST_PTR_FORMAT, ++ (direction == GST_PAD_SINK) ? "sink" : "src", templ); ++ ++ return templ; + } + +-/** +- * helper to add all fields, other than rowstride to @caps, copied from @s. +- */ +-static void +-add_all_fields (GstCaps * caps, const gchar * name, GstStructure * s, +- gboolean rowstride, GstPadDirection direction) ++static inline gboolean ++is_filtered_field (const gchar *name) + { +- gint idx; +- GstStructure *new_s = gst_structure_new (name, NULL); ++ static const gchar * filtered_fields[] = { ++ "rowstride", "format", "bpp", "depth", "endianness", ++ "red_mask", "green_mask", "blue_mask" ++ }; ++ gint i; ++ for (i = 0; i < G_N_ELEMENTS (filtered_fields); i++) ++ if (!strcmp (filtered_fields[i], name)) ++ return TRUE; ++ return FALSE; ++} + +- if (rowstride) { +- gst_structure_set (new_s, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, +- NULL); +- } ++static inline GstCaps * ++get_caps (GstVideoFormat fmt, gboolean strided, GstStructure *s) ++{ ++ gint idx; ++ GstCaps *ret = ++ gst_video_format_new_caps_simple (fmt, strided ? -1 : 0, NULL); + + idx = gst_structure_n_fields (s) - 1; + while (idx >= 0) { + const gchar *name = gst_structure_nth_field_name (s, idx); +- const GValue *val = gst_structure_get_value (s, name); + + idx--; + +- /* for format field, check the stride_conversions table to see what +- * we can support: ++ /* filter out certain format specific fields.. copy everything else ++ * from the original struct + */ +- if (!strcmp ("format", name)) { +- GValue formats = { 0 }; +- +- g_value_init (&formats, GST_TYPE_LIST); ++ if (!is_filtered_field (name)) { ++ const GValue *val = gst_structure_get_value (s, name); ++ gst_caps_set_value (ret, name, val); ++ } ++ } + +- if (GST_VALUE_HOLDS_FOURCC (val)) { +- add_all_fourcc_conversions (&formats, +- gst_value_get_fourcc (val), direction); +- } else if (GST_VALUE_HOLDS_LIST (val)) { +- gint i; +- for (i = 0; i < gst_value_list_get_size (val); i++) { +- const GValue *list_val = gst_value_list_get_value (val, i); +- if (GST_VALUE_HOLDS_FOURCC (list_val)) { +- add_all_fourcc_conversions (&formats, +- gst_value_get_fourcc (list_val), direction); +- } else { +- GST_WARNING ("malformed caps!!"); +- break; +- } +- } +- } else { +- GST_WARNING ("malformed caps!!"); +- } ++ return ret; ++} + +- gst_structure_set_value (new_s, "format", &formats); ++/** ++ * Utility to get all possible caps that can be converted to/from (depending ++ * on 'direction') the specified 'fmt'. The rest of the fields are populated ++ * from 's' ++ */ ++static GstCaps * ++get_all_caps (GstPadDirection direction, GstVideoFormat fmt, GstStructure *s) ++{ ++ GstCaps *ret = gst_caps_new_empty (); ++ gint to_format = (direction == GST_PAD_SINK) ? 1 : 0; ++ gint from_format = (direction == GST_PAD_SRC) ? 1 : 0; ++ gint i; + +- continue; ++ for (i = 0; stride_conversions[i].format[0]; i++) { ++ const Conversion *c = &stride_conversions[i]; ++ if (c->format[from_format] == fmt) { ++ gst_caps_append (ret, get_caps (c->format[to_format], TRUE, s)); ++ gst_caps_append (ret, get_caps (c->format[to_format], FALSE, s)); + } ++ } ++ ++ return ret; ++} + +- /* copy over all other non-rowstride fields: */ +- if (strcmp ("rowstride", name)) { +- gst_structure_set_value (new_s, name, val); ++/** convert GValue holding fourcc to GstVideoFormat (for YUV) */ ++static inline GstVideoFormat ++fmt_from_val (const GValue *val) ++{ ++ return gst_video_format_from_fourcc (gst_value_get_fourcc (val)); ++} ++ ++/** convert structure to GstVideoFormat (for RGB) */ ++static inline GstVideoFormat ++fmt_from_struct (const GstStructure *s) ++{ ++ /* hmm.. this is not supporting any case where ranges/lists are used ++ * for any of the rgb related fields in the caps. But I'm not quite ++ * sure a sane way to handle that.. rgb caps suck ++ */ ++ gint depth, bpp, endianness; ++ gint red_mask, green_mask, blue_mask, alpha_mask; ++ gboolean have_alpha, ok = TRUE; ++ ++ ok &= gst_structure_get_int (s, "depth", &depth); ++ ok &= gst_structure_get_int (s, "bpp", &bpp); ++ ok &= gst_structure_get_int (s, "endianness", &endianness); ++ ok &= gst_structure_get_int (s, "red_mask", &red_mask); ++ ok &= gst_structure_get_int (s, "green_mask", &green_mask); ++ ok &= gst_structure_get_int (s, "blue_mask", &blue_mask); ++ have_alpha = gst_structure_get_int (s, "alpha_mask", &alpha_mask); ++ ++ if (!ok) ++ return GST_VIDEO_FORMAT_UNKNOWN; ++ ++ if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) { ++ if (red_mask == 0xff000000 && green_mask == 0x00ff0000 && ++ blue_mask == 0x0000ff00) { ++ return GST_VIDEO_FORMAT_RGBx; ++ } ++ if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 && ++ blue_mask == 0xff000000) { ++ return GST_VIDEO_FORMAT_BGRx; ++ } ++ if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 && ++ blue_mask == 0x000000ff) { ++ return GST_VIDEO_FORMAT_xRGB; ++ } ++ if (red_mask == 0x000000ff && green_mask == 0x0000ff00 && ++ blue_mask == 0x00ff0000) { ++ return GST_VIDEO_FORMAT_xBGR; ++ } ++ } else if (depth == 32 && bpp == 32 && endianness == G_BIG_ENDIAN && ++ have_alpha) { ++ if (red_mask == 0xff000000 && green_mask == 0x00ff0000 && ++ blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) { ++ return GST_VIDEO_FORMAT_RGBA; ++ } ++ if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 && ++ blue_mask == 0xff000000 && alpha_mask == 0x000000ff) { ++ return GST_VIDEO_FORMAT_BGRA; ++ } ++ if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 && ++ blue_mask == 0x000000ff && alpha_mask == 0xff000000) { ++ return GST_VIDEO_FORMAT_ARGB; ++ } ++ if (red_mask == 0x000000ff && green_mask == 0x0000ff00 && ++ blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) { ++ return GST_VIDEO_FORMAT_ABGR; ++ } ++ } else if (depth == 24 && bpp == 24 && endianness == G_BIG_ENDIAN) { ++ if (red_mask == 0xff0000 && green_mask == 0x00ff00 && ++ blue_mask == 0x0000ff) { ++ return GST_VIDEO_FORMAT_RGB; ++ } ++ if (red_mask == 0x0000ff && green_mask == 0x00ff00 && ++ blue_mask == 0xff0000) { ++ return GST_VIDEO_FORMAT_BGR; ++ } ++ } else if ((depth == 15 || depth == 16) && bpp == 16 && ++ endianness == G_BYTE_ORDER) { ++ if (red_mask == GST_VIDEO_COMP1_MASK_16_INT ++ && green_mask == GST_VIDEO_COMP2_MASK_16_INT ++ && blue_mask == GST_VIDEO_COMP3_MASK_16_INT) { ++ return GST_VIDEO_FORMAT_RGB16; ++ } ++ if (red_mask == GST_VIDEO_COMP3_MASK_16_INT ++ && green_mask == GST_VIDEO_COMP2_MASK_16_INT ++ && blue_mask == GST_VIDEO_COMP1_MASK_16_INT) { ++ return GST_VIDEO_FORMAT_BGR16; ++ } ++ if (red_mask == GST_VIDEO_COMP1_MASK_15_INT ++ && green_mask == GST_VIDEO_COMP2_MASK_15_INT ++ && blue_mask == GST_VIDEO_COMP3_MASK_15_INT) { ++ return GST_VIDEO_FORMAT_RGB15; ++ } ++ if (red_mask == GST_VIDEO_COMP3_MASK_15_INT ++ && green_mask == GST_VIDEO_COMP2_MASK_15_INT ++ && blue_mask == GST_VIDEO_COMP1_MASK_15_INT) { ++ return GST_VIDEO_FORMAT_BGR15; + } + } + +- gst_caps_merge_structure (caps, new_s); ++ return GST_VIDEO_FORMAT_UNKNOWN; + } + +- + /** + * we can transform @caps to strided or non-strided caps with otherwise + * identical parameters +@@ -310,31 +435,50 @@ gst_stride_transform_transform_caps (GstBaseTransform * base, + GstPadDirection direction, GstCaps * caps) + { + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); +- GstCaps *ret; +- GstStructure *s; +- +- g_return_val_if_fail (GST_CAPS_IS_SIMPLE (caps), NULL); +- +- GST_DEBUG_OBJECT (self, "direction=%d, caps=%p", direction, caps); +- LOG_CAPS (self, caps); +- +- ret = gst_caps_new_empty (); +- s = gst_caps_get_structure (caps, 0); +- +- if (gst_structure_has_name (s, "video/x-raw-yuv") || +- gst_structure_has_name (s, "video/x-raw-yuv-strided")) { +- +- add_all_fields (ret, "video/x-raw-yuv", s, FALSE, direction); +- add_all_fields (ret, "video/x-raw-yuv-strided", s, TRUE, direction); +- +- } else if (gst_structure_has_name (s, "video/x-raw-rgb") || +- gst_structure_has_name (s, "video/x-raw-rgb-strided")) { +- +- add_all_fields (ret, "video/x-raw-rgb", s, FALSE, direction); +- add_all_fields (ret, "video/x-raw-rgb-strided", s, TRUE, direction); ++ GstCaps *ret = gst_caps_new_empty (); ++ int i; ++ ++ for (i = 0; i < gst_caps_get_size (caps); i++) { ++ GstStructure *s = gst_caps_get_structure (caps, i); ++ const char *name = gst_structure_get_name (s); ++ ++ /* this is a bit ugly.. ideally it would be easier to parse caps ++ * a bit more generically without having to care so much about ++ * difference between RGB and YUV.. but YUV can be specified as ++ * a list of format params, whereas RGB is a combination of many ++ * fields.. ++ */ ++ if (g_str_has_prefix (name, "video/x-raw-yuv")) { ++ const GValue *val = gst_structure_get_value (s, "format"); + ++ if (GST_VALUE_HOLDS_FOURCC (val)) { ++ gst_caps_append (ret, ++ get_all_caps (direction, fmt_from_val (val), s)); ++ } else if (GST_VALUE_HOLDS_LIST (val)) { ++ gint j; ++ for (j = 0; j < gst_value_list_get_size (val); j++) { ++ const GValue *list_val = gst_value_list_get_value (val, j); ++ if (GST_VALUE_HOLDS_FOURCC (list_val)) { ++ gst_caps_append (ret, ++ get_all_caps (direction, fmt_from_val (list_val), s)); ++ } else { ++ GST_WARNING_OBJECT (self, ++ "malformed format in caps: %"GST_PTR_FORMAT, s); ++ break; ++ } ++ } ++ } else { ++ GST_WARNING_OBJECT (self, "malformed yuv caps: %"GST_PTR_FORMAT, s); ++ } ++ } else if (g_str_has_prefix (name, "video/x-raw-rgb")) { ++ gst_caps_append (ret, get_all_caps (direction, fmt_from_struct (s), s)); ++ } else { ++ GST_WARNING_OBJECT (self, "ignoring: %"GST_PTR_FORMAT, s); ++ } + } + ++ gst_caps_do_simplify (ret); ++ + LOG_CAPS (self, ret); + + return ret; +@@ -369,6 +513,7 @@ gst_stride_transform_set_caps (GstBaseTransform * base, + (stride_conversions[i].format[1] == out_format)) { + GST_DEBUG_OBJECT (self, "found stride_conversion: %d", i); + self->conversion = &stride_conversions[i]; ++ self->needs_refresh = TRUE; + break; + } + } +@@ -378,10 +523,6 @@ gst_stride_transform_set_caps (GstBaseTransform * base, + i, self->conversion, self->in_rowstride, self->out_rowstride); + + g_return_val_if_fail (self->conversion, FALSE); +- g_return_val_if_fail (self->conversion->unstridify +- || !self->in_rowstride, FALSE); +- g_return_val_if_fail (self->conversion->stridify +- || !self->out_rowstride, FALSE); + g_return_val_if_fail (self->width == width, FALSE); + g_return_val_if_fail (self->height == height, FALSE); + +@@ -399,20 +540,14 @@ gst_stride_transform_transform (GstBaseTransform * base, + GST_DEBUG_OBJECT (self, "inbuf=%p (size=%d), outbuf=%p (size=%d)", + inbuf, GST_BUFFER_SIZE (inbuf), outbuf, GST_BUFFER_SIZE (outbuf)); + +- if (self->in_rowstride && self->out_rowstride) { +- GST_DEBUG_OBJECT (self, "not implemented"); // TODO +- return GST_FLOW_ERROR; +- } else if (self->in_rowstride) { +- return self->conversion->unstridify (self, +- GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); +- } else if (self->out_rowstride) { +- return self->conversion->stridify (self, ++ if (self->conversion) { ++ return self->conversion->convert (self, + GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf)); + } + + GST_DEBUG_OBJECT (self, +- "this shouldn't happen! in_rowstride=%d, out_rowstride=%d", +- self->in_rowstride, self->out_rowstride); ++ "this shouldn't happen! in_rowstride=%d, out_rowstride=%d, conversion=%p", ++ self->in_rowstride, self->out_rowstride, self->conversion); + + return GST_FLOW_ERROR; + } +diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h +index bce2526..34733cd 100644 +--- a/gst/stride/gststridetransform.h ++++ b/gst/stride/gststridetransform.h +@@ -52,11 +52,18 @@ typedef struct { + + GstVideoFormat format[2]; /* in_format, out_format */ + +- GstFlowReturn (*stridify) (GstStrideTransform *self, guchar *strided, guchar *unstrided); +- GstFlowReturn (*unstridify) (GstStrideTransform *self, guchar *unstrided, guchar *strided); ++ GstFlowReturn (*convert) (GstStrideTransform *self, guchar *out, guchar *in); + + } Conversion; + ++typedef struct { ++ gint in_bpl; /* bytes per line in input */ ++ gint out_bpl; /* bytes per line in output */ ++ gint in_off; ++ gint out_off; ++ gint width; ++ gint height; ++} Cache; + + /** + * GstStrideTransform: +@@ -67,9 +74,23 @@ struct _GstStrideTransform { + GstVideoFilter videofilter; + + /*< private >*/ ++ ++ /* values set from caps: */ + gint width, height; + gint in_rowstride; + gint out_rowstride; ++ ++ /* values set from set from crop event: */ ++ gint crop_width, crop_height, crop_top, crop_left; ++ ++ /* cached values used for each conversion, indexed by plane in case of ++ * multi-planar formats. These won't have zero values meaning not-used ++ * (as long as !needs_refresh), but will be set to whatever byte width/ ++ * offset is appropriate for the format. ++ */ ++ Cache cache[3]; ++ gboolean needs_refresh; ++ + const Conversion *conversion; + + /* for caching the tranform_size() results.. */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0022-stride-support-for-32bit-RGB-formats.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0022-stride-support-for-32bit-RGB-formats.patch new file mode 100644 index 0000000..04c5ade --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0022-stride-support-for-32bit-RGB-formats.patch @@ -0,0 +1,54 @@ +From 30b32e864e9a77b66a36d27d3b071f59633d08b7 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 13 Sep 2010 19:16:02 -0500 +Subject: [PATCH 22/24] stride: support for 32bit RGB formats + +--- + gst/stride/convert.c | 24 ++++++++++++++++++++++++ + 1 files changed, 24 insertions(+), 0 deletions(-) + +diff --git a/gst/stride/convert.c b/gst/stride/convert.c +index 5d392ac..7f976a5 100644 +--- a/gst/stride/convert.c ++++ b/gst/stride/convert.c +@@ -372,6 +372,22 @@ convert_rgb16_rgb16 (GstStrideTransform * self, + return convert_422i_422i (self, out, in); + } + ++/** convert 32bbp rgb formats */ ++static GstFlowReturn ++convert_rgb32_rgb32 (GstStrideTransform * self, ++ guchar * out, guchar * in) ++{ ++ if (G_UNLIKELY (self->needs_refresh)) { ++ gint sx[] = {1}; ++ gint sy[] = {1}; ++ if (refresh_cache (self, 1, 4, sx, sx, sy, sy)) ++ return GST_FLOW_ERROR; ++ self->needs_refresh = FALSE; ++ } ++ ++ return convert_n_n (self, out, in, 1); ++} ++ + #define CONVERT(tofmt, fromfmt, convert) \ + { \ + { GST_VIDEO_FORMAT_##tofmt, GST_VIDEO_FORMAT_##fromfmt }, \ +@@ -388,6 +404,14 @@ const Conversion stride_conversions[] = { + CONVERT (I420, NV12, convert_i420_nv12), + CONVERT (I420, YUY2, convert_i420_yuy2), + CONVERT (RGB16, RGB16, convert_rgb16_rgb16), ++ CONVERT (RGBx, RGBx, convert_rgb32_rgb32), ++ CONVERT (BGRx, BGRx, convert_rgb32_rgb32), ++ CONVERT (xRGB, xRGB, convert_rgb32_rgb32), ++ CONVERT (xBGR, xBGR, convert_rgb32_rgb32), ++ CONVERT (RGBA, RGBA, convert_rgb32_rgb32), ++ CONVERT (BGRA, BGRA, convert_rgb32_rgb32), ++ CONVERT (ARGB, ARGB, convert_rgb32_rgb32), ++ CONVERT (ABGR, ABGR, convert_rgb32_rgb32), + /* add new entries before here */ + {{GST_VIDEO_FORMAT_UNKNOWN}} + }; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0023-ffmpegcolorspace-support-for-rowstride.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0023-ffmpegcolorspace-support-for-rowstride.patch new file mode 100644 index 0000000..5246931 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0023-ffmpegcolorspace-support-for-rowstride.patch @@ -0,0 +1,410 @@ +From 379447918aafc7f38a79219511764f6c04a2cbf9 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 24 Dec 2010 20:55:43 -0600 +Subject: [PATCH 23/24] ffmpegcolorspace: support for rowstride + +--- + gst/ffmpegcolorspace/avcodec.h | 2 +- + gst/ffmpegcolorspace/gstffmpegcodecmap.c | 85 +++++++++++++++++++-------- + gst/ffmpegcolorspace/gstffmpegcodecmap.h | 1 + + gst/ffmpegcolorspace/gstffmpegcolorspace.c | 30 ++++++++-- + gst/ffmpegcolorspace/gstffmpegcolorspace.h | 1 + + gst/ffmpegcolorspace/imgconvert.c | 12 ++-- + 6 files changed, 93 insertions(+), 38 deletions(-) + +diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h +index 57f551c..a4928ee 100644 +--- a/gst/ffmpegcolorspace/avcodec.h ++++ b/gst/ffmpegcolorspace/avcodec.h +@@ -217,7 +217,7 @@ typedef struct AVPaletteControl { + + } AVPaletteControl; + +-int avpicture_get_size(int pix_fmt, int width, int height); ++int avpicture_get_size(int pix_fmt, int width, int height, int stride); + + void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); + const char *avcodec_get_pix_fmt_name(int pix_fmt); +diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c +index 318a90e..9c6a123 100644 +--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c ++++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c +@@ -619,7 +619,8 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, + if (!raw) + return; + +- if (gst_structure_has_name (structure, "video/x-raw-yuv")) { ++ if (gst_structure_has_name (structure, "video/x-raw-yuv") || ++ gst_structure_has_name (structure, "video/x-raw-yuv-strided")) { + guint32 fourcc; + + if (gst_structure_get_fourcc (structure, "format", &fourcc)) { +@@ -828,10 +829,10 @@ gst_ffmpegcsp_caps_with_codectype (enum CodecType type, + int + gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height, +- int interlaced) ++ int stride, int interlaced) + { + int size, w2, h2, size2; +- int stride, stride2; ++ int stride2; + PixFmtInfo *pinfo; + + pinfo = get_pix_fmt_info (pix_fmt); +@@ -847,11 +848,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + case PIX_FMT_YUVJ420P: + case PIX_FMT_YUVJ422P: + case PIX_FMT_YUVJ444P: +- stride = GST_ROUND_UP_4 (width); + h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); +- size = stride * h2; + w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); +- stride2 = GST_ROUND_UP_4 (w2); ++ if (stride) { ++ stride2 = stride; ++ } else { ++ stride = GST_ROUND_UP_4 (width); ++ stride2 = GST_ROUND_UP_4 (w2); ++ } ++ size = stride * h2; + h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); + size2 = stride2 * h2; + picture->data[0] = ptr; +@@ -864,11 +869,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + /* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but + * with U and V plane swapped. Strides as in videotestsrc */ + case PIX_FMT_YUVA420P: +- stride = GST_ROUND_UP_4 (width); + h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); +- size = stride * h2; + w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); +- stride2 = GST_ROUND_UP_4 (w2); ++ if (stride) { ++ stride2 = stride; ++ } else { ++ stride = GST_ROUND_UP_4 (width); ++ stride2 = GST_ROUND_UP_4 (w2); ++ } ++ size = stride * h2; + h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); + size2 = stride2 * h2; + picture->data[0] = ptr; +@@ -882,11 +891,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return 2 * size + 2 * size2; + case PIX_FMT_YVU410P: + case PIX_FMT_YVU420P: +- stride = GST_ROUND_UP_4 (width); + h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); +- size = stride * h2; + w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); +- stride2 = GST_ROUND_UP_4 (w2); ++ if (stride) { ++ stride2 = stride; ++ } else { ++ stride = GST_ROUND_UP_4 (width); ++ stride2 = GST_ROUND_UP_4 (w2); ++ } ++ size = stride * h2; + h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); + size2 = stride2 * h2; + picture->data[0] = ptr; +@@ -898,11 +911,15 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return size + 2 * size2; + case PIX_FMT_NV12: + case PIX_FMT_NV21: +- stride = GST_ROUND_UP_4 (width); + h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); +- size = stride * h2; + w2 = 2 * DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); +- stride2 = GST_ROUND_UP_4 (w2); ++ if (stride) { ++ stride2 = stride; ++ } else { ++ stride = GST_ROUND_UP_4 (width); ++ stride2 = GST_ROUND_UP_4 (w2); ++ } ++ size = stride * h2; + h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); + size2 = stride2 * h2; + picture->data[0] = ptr; +@@ -914,7 +931,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return size + size2; + case PIX_FMT_RGB24: + case PIX_FMT_BGR24: +- stride = GST_ROUND_UP_4 (width * 3); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width * 3); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -930,7 +949,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + case PIX_FMT_ABGR32: + case PIX_FMT_xRGB32: + case PIX_FMT_BGRx32: +- stride = width * 4; ++ if (!stride) { ++ stride = width * 4; ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -942,7 +963,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + case PIX_FMT_YUV422: + case PIX_FMT_UYVY422: + case PIX_FMT_YVYU422: +- stride = GST_ROUND_UP_4 (width * 2); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width * 2); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -950,7 +973,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + picture->linesize[0] = stride; + return size; + case PIX_FMT_V308: +- stride = GST_ROUND_UP_4 (width * 3); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width * 3); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -958,8 +983,10 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + picture->linesize[0] = stride; + return size; + case PIX_FMT_UYVY411: +- stride = +- GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + GST_ROUND_UP_4 (width) / 2); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) + ++ GST_ROUND_UP_4 (width) / 2); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -968,7 +995,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return size; + case PIX_FMT_Y800: + case PIX_FMT_GRAY8: +- stride = GST_ROUND_UP_4 (width); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -978,7 +1007,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + case PIX_FMT_Y16: + case PIX_FMT_GRAY16_L: + case PIX_FMT_GRAY16_B: +- stride = GST_ROUND_UP_4 (width * 2); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width * 2); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -987,7 +1018,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return size; + case PIX_FMT_MONOWHITE: + case PIX_FMT_MONOBLACK: +- stride = GST_ROUND_UP_4 ((width + 7) >> 3); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 ((width + 7) >> 3); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = NULL; +@@ -996,7 +1029,9 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + return size; + case PIX_FMT_PAL8: + /* already forced to be with stride, so same result as other function */ +- stride = GST_ROUND_UP_4 (width); ++ if (!stride) { ++ stride = GST_ROUND_UP_4 (width); ++ } + size = stride * height; + picture->data[0] = ptr; + picture->data[1] = ptr + size; /* palette is stored here as 256 32 bit words */ +diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.h b/gst/ffmpegcolorspace/gstffmpegcodecmap.h +index 515f530..bcd212a 100644 +--- a/gst/ffmpegcolorspace/gstffmpegcodecmap.h ++++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.h +@@ -52,6 +52,7 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, + enum PixelFormat pix_fmt, + int width, + int height, ++ int stride, + int interlaced); + + #endif /* __GST_FFMPEG_CODECMAP_H__ */ +diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c +index 4ba0204..63430a0 100644 +--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c ++++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c +@@ -48,6 +48,10 @@ GST_DEBUG_CATEGORY (ffmpegcolorspace_performance); + "video/x-raw-yuv, width = "GST_VIDEO_SIZE_RANGE" , " \ + "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ + "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \ ++ "video/x-raw-yuv-strided, width = "GST_VIDEO_SIZE_RANGE" , " \ ++ "height="GST_VIDEO_SIZE_RANGE",framerate="GST_VIDEO_FPS_RANGE"," \ ++ "rowstride="GST_VIDEO_SIZE_RANGE"," \ ++ "format= (fourcc) { I420 , NV12 , NV21 , YV12 , YUY2 , Y42B , Y444 , YUV9 , YVU9 , Y41B , Y800 , Y8 , GREY , Y16 , UYVY , YVYU , IYU1 , v308 , AYUV, A420} ;" \ + GST_VIDEO_CAPS_RGB";" \ + GST_VIDEO_CAPS_BGR";" \ + GST_VIDEO_CAPS_RGBx";" \ +@@ -205,8 +209,8 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, + { + GstFFMpegCsp *space; + GstStructure *structure; +- gint in_height, in_width; +- gint out_height, out_width; ++ gint in_height, in_width, in_stride = 0; ++ gint out_height, out_width, out_stride = 0; + const GValue *in_framerate = NULL; + const GValue *out_framerate = NULL; + const GValue *in_par = NULL; +@@ -225,6 +229,10 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, + if (!res) + goto no_width_height; + ++ /* stride is optional: */ ++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) ++ gst_structure_get_int (structure, "rowstride", &in_stride); ++ + /* and framerate */ + in_framerate = gst_structure_get_value (structure, "framerate"); + if (in_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (in_framerate)) +@@ -241,6 +249,10 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, + if (!res) + goto no_width_height; + ++ /* stride is optional: */ ++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) ++ gst_structure_get_int (structure, "rowstride", &out_stride); ++ + /* and framerate */ + out_framerate = gst_structure_get_value (structure, "framerate"); + if (out_framerate == NULL || !GST_VALUE_HOLDS_FRACTION (out_framerate)) +@@ -263,6 +275,8 @@ gst_ffmpegcsp_set_caps (GstBaseTransform * btrans, GstCaps * incaps, + + space->width = ctx->width = in_width; + space->height = ctx->height = in_height; ++ space->in_stride = in_stride; ++ space->out_stride = out_stride; + + space->interlaced = FALSE; + gst_structure_get_boolean (structure, "interlaced", &space->interlaced); +@@ -401,7 +415,7 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, + GstStructure *structure = NULL; + AVCodecContext *ctx = NULL; + gboolean ret = TRUE; +- gint width, height; ++ gint width, height, stride = 0; + + g_assert (size); + +@@ -409,6 +423,10 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + ++ /* stride is optional: */ ++ if (gst_structure_has_name (structure, "video/x-raw-yuv-strided")) ++ gst_structure_get_int (structure, "rowstride", &stride); ++ + ctx = avcodec_alloc_context (); + + g_assert (ctx != NULL); +@@ -422,7 +440,7 @@ gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps, + goto beach; + } + +- *size = avpicture_get_size (ctx->pix_fmt, width, height); ++ *size = avpicture_get_size (ctx->pix_fmt, width, height, stride); + + /* ffmpeg frames have the palette after the frame data, whereas + * GStreamer currently puts it into the caps as 'palette_data' field, +@@ -460,7 +478,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, + /* fill from with source data */ + gst_ffmpegcsp_avpicture_fill (&space->from_frame, + GST_BUFFER_DATA (inbuf), space->from_pixfmt, space->width, space->height, +- space->interlaced); ++ space->in_stride, space->interlaced); + + /* fill optional palette */ + if (space->palette) +@@ -469,7 +487,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf, + /* fill target frame */ + gst_ffmpegcsp_avpicture_fill (&space->to_frame, + GST_BUFFER_DATA (outbuf), space->to_pixfmt, space->width, space->height, +- space->interlaced); ++ space->out_stride, space->interlaced); + + /* and convert */ + result = img_convert (&space->to_frame, space->to_pixfmt, +diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.h b/gst/ffmpegcolorspace/gstffmpegcolorspace.h +index 198ab8a..bd5e01c 100644 +--- a/gst/ffmpegcolorspace/gstffmpegcolorspace.h ++++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.h +@@ -46,6 +46,7 @@ struct _GstFFMpegCsp { + GstVideoFilter element; + + gint width, height; ++ gint in_stride, out_stride; + gboolean interlaced; + gfloat fps; + enum PixelFormat from_pixfmt, to_pixfmt; +diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c +index cb145bb..414c4a0 100644 +--- a/gst/ffmpegcolorspace/imgconvert.c ++++ b/gst/ffmpegcolorspace/imgconvert.c +@@ -594,12 +594,12 @@ avpicture_layout (const AVPicture * src, int pix_fmt, int width, int height, + #endif + + int +-avpicture_get_size (int pix_fmt, int width, int height) ++avpicture_get_size (int pix_fmt, int width, int height, int stride) + { + AVPicture dummy_pict; + + return gst_ffmpegcsp_avpicture_fill (&dummy_pict, NULL, pix_fmt, width, +- height, FALSE); ++ height, stride, FALSE); + } + + /** +@@ -3518,16 +3518,16 @@ get_convert_table_entry (int src_pix_fmt, int dst_pix_fmt) + + static int + avpicture_alloc (AVPicture * picture, int pix_fmt, int width, int height, +- int interlaced) ++ int stride, int interlaced) + { + unsigned int size; + void *ptr; + +- size = avpicture_get_size (pix_fmt, width, height); ++ size = avpicture_get_size (pix_fmt, width, height, stride); + ptr = av_malloc (size); + if (!ptr) + goto fail; +- gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height, ++ gst_ffmpegcsp_avpicture_fill (picture, ptr, pix_fmt, width, height, stride, + interlaced); + return 0; + fail: +@@ -3775,7 +3775,7 @@ no_chroma_filter: + else + int_pix_fmt = PIX_FMT_RGB24; + } +- if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height, ++ if (avpicture_alloc (tmp, int_pix_fmt, dst_width, dst_height, 0, + dst->interlaced) < 0) + return -1; + ret = -1; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0024-discoverer-rowstride-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0024-discoverer-rowstride-support.patch new file mode 100644 index 0000000..a24a1a0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0024-discoverer-rowstride-support.patch @@ -0,0 +1,45 @@ +From 3bb025f5ba20aeb5d2fa575e4a78ea61e3bf5c1b Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 5 Jan 2011 11:40:03 -0600 +Subject: [PATCH 24/24] discoverer: rowstride support + +--- + gst-libs/gst/pbutils/gstdiscoverer.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c +index 8422d8f..2176196 100644 +--- a/gst-libs/gst/pbutils/gstdiscoverer.c ++++ b/gst-libs/gst/pbutils/gstdiscoverer.c +@@ -558,7 +558,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, + GstCaps *caps; + GstStructure *caps_st, *tags_st; + const gchar *name; +- int tmp, tmp2; ++ int tmp, tmp2, tmp3; + guint utmp; + gboolean btmp; + +@@ -626,7 +626,7 @@ collect_information (GstDiscoverer * dc, const GstStructure * st, + info->parent.caps = caps; + } + +- if (gst_video_format_parse_caps (caps, &format, &tmp, &tmp2)) { ++ if (gst_video_format_parse_caps_strided (caps, &format, &tmp, &tmp2, &tmp3)) { + info->width = (guint) tmp; + info->height = (guint) tmp2; + } +@@ -930,8 +930,8 @@ discoverer_collect (GstDiscoverer * dc) + gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0); + + if (g_str_has_prefix (gst_structure_get_name (st), "image/")) +- ((GstDiscovererVideoInfo *) dc->priv->current_info-> +- stream_info)->is_image = TRUE; ++ ((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)-> ++ is_image = TRUE; + } + } + +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0025-playsink-link-omx_colorconv-to-do-HW-accel-color-con.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0025-playsink-link-omx_colorconv-to-do-HW-accel-color-con.patch new file mode 100644 index 0000000..d35dd6e --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-base-0.10.32/0025-playsink-link-omx_colorconv-to-do-HW-accel-color-con.patch @@ -0,0 +1,66 @@ +From 2bd13191434843c675318aa4fd300f609ee7580c Mon Sep 17 00:00:00 2001 +From: Brijesh Singh <bksingh@ti.com> +Date: Thu, 16 Jun 2011 15:06:52 -0500 +Subject: [PATCH 25/25] playsink: link omx_colorconv to do HW accel color conversion and link omx_ctrl to set the video display mode to 1080P@60 + +--- + gst/playback/gstplaysink.c | 32 ++++++++++++++++++++++++++++---- + 1 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c +index 957f288..7279ca0 100644 +--- a/gst/playback/gstplaysink.c ++++ b/gst/playback/gstplaysink.c +@@ -81,6 +81,7 @@ typedef struct + GstElement *queue; + GstElement *conv; + GstElement *scale; ++ GstElement *ctrl; + GstElement *sink; + gboolean async; + GstElement *ts_offset; +@@ -1266,14 +1267,37 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) + head = prev = chain->queue; + } + ++ { ++ GST_DEBUG_OBJECT (playsink, "creating omx_ctrl"); ++ chain->ctrl = gst_element_factory_make ("omx_ctrl", "omxctrl"); ++ ++ if (chain->ctrl == NULL) { ++ post_missing_element_message (playsink, "omx_ctrl"); ++ GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, ++ (_("Missing element '%s' - check your GStreamer installation."), ++ "omx_ctrl"), ("video rendering might fail")); ++ } else { ++ gst_bin_add (bin, chain->ctrl); ++ g_object_set(G_OBJECT(chain->ctrl), "display-mode", "OMX_DC_MODE_1080P_60" ,NULL); ++ if (prev) { ++ if (!gst_element_link_pads_full (prev, "src", chain->ctrl, "sink", ++ GST_PAD_LINK_CHECK_TEMPLATE_CAPS)) ++ goto link_failed; ++ } else { ++ head = chain->ctrl; ++ } ++ prev = chain->ctrl; ++ } ++ } ++ + if (raw && !(playsink->flags & GST_PLAY_FLAG_NATIVE_VIDEO)) { +- GST_DEBUG_OBJECT (playsink, "creating stridetransform"); +- chain->conv = gst_element_factory_make ("stridetransform", "vconv"); ++ GST_DEBUG_OBJECT (playsink, "creating omx_scaler"); ++ chain->conv = gst_element_factory_make ("omx_scaler", "vconv"); + if (chain->conv == NULL) { +- post_missing_element_message (playsink, "stridetransform"); ++ post_missing_element_message (playsink, "omx_scaler"); + GST_ELEMENT_WARNING (playsink, CORE, MISSING_PLUGIN, + (_("Missing element '%s' - check your GStreamer installation."), +- "stridetransform"), ("video rendering might fail")); ++ "omx_scaler"), ("video rendering might fail")); + } else { + gst_bin_add (bin, chain->conv); + if (prev) { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0001-v4l2src-add-input-src-property-to-specify-capture-in.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0001-v4l2src-add-input-src-property-to-specify-capture-in.patch new file mode 100644 index 0000000..44a5c45 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0001-v4l2src-add-input-src-property-to-specify-capture-in.patch @@ -0,0 +1,155 @@ +From 07376e57f6e9266e18fa944136794a3c843d0733 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:23:11 -0500 +Subject: [PATCH 01/17] v4l2src: add input-src property to specify capture input + +This property specifies which capture input to use when multiple inputs +are present on a capture device. +--- + sys/v4l2/gstv4l2object.c | 4 ++++ + sys/v4l2/gstv4l2object.h | 1 + + sys/v4l2/gstv4l2src.c | 14 +++++++++++++- + sys/v4l2/v4l2_calls.c | 26 ++++++++++++++++++++++++++ + 4 files changed, 44 insertions(+), 1 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 84f2281..9ad0803 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -391,6 +391,10 @@ gst_v4l2_object_destroy (GstV4l2Object * v4l2object) + gst_v4l2_object_clear_format_list (v4l2object); + } + ++ if (v4l2object->input_src) { ++ g_free (v4l2object->input_src); ++ } ++ + g_free (v4l2object); + } + +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index 8660924..3a9c135 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -110,6 +110,7 @@ struct _GstV4l2Object { + gchar *norm; + gchar *channel; + gulong frequency; ++ gchar *input_src; + + /* X-overlay */ + GstV4l2Xv *xv; +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index 7f2139a..48cfb23 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -71,7 +71,8 @@ enum + PROP_0, + V4L2_STD_OBJECT_PROPS, + PROP_QUEUE_SIZE, +- PROP_ALWAYS_COPY ++ PROP_ALWAYS_COPY, ++ PROP_INPUT_SRC + }; + + GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src); +@@ -264,6 +265,9 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass) + g_param_spec_boolean ("always-copy", "Always Copy", + "If the buffer will or not be used directly from mmap", + PROP_DEF_ALWAYS_COPY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ g_object_class_install_property (gobject_class, PROP_INPUT_SRC, ++ g_param_spec_string ("input-src", "Select the input source", ++ "Select the input source)", NULL, G_PARAM_READWRITE)); + + basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); + basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); +@@ -292,6 +296,7 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass) + v4l2src->always_copy = PROP_DEF_ALWAYS_COPY; + + v4l2src->is_capturing = FALSE; ++ v4l2src->v4l2object->input_src = NULL; + + gst_base_src_set_format (GST_BASE_SRC (v4l2src), GST_FORMAT_TIME); + gst_base_src_set_live (GST_BASE_SRC (v4l2src), TRUE); +@@ -338,6 +343,10 @@ gst_v4l2src_set_property (GObject * object, + case PROP_ALWAYS_COPY: + v4l2src->always_copy = g_value_get_boolean (value); + break; ++ case PROP_INPUT_SRC: ++ v4l2src->v4l2object->input_src = ++ g_ascii_strup(g_value_get_string(value), -1); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -361,6 +370,9 @@ gst_v4l2src_get_property (GObject * object, + case PROP_ALWAYS_COPY: + g_value_set_boolean (value, v4l2src->always_copy); + break; ++ case PROP_INPUT_SRC: ++ g_value_set_string(value, v4l2src->v4l2object->input_src); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index f2c2c08..b88b07b 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -111,6 +111,8 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + { + gint n; + ++ gboolean input_src_found = FALSE; ++ + GstElement *e; + + e = v4l2object->element; +@@ -125,6 +127,9 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + GstV4l2TunerChannel *v4l2channel; + GstTunerChannel *channel; + ++ if (input_src_found) ++ break; ++ + memset (&input, 0, sizeof (input)); + + input.index = n; +@@ -141,6 +146,21 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + } + } + ++ /* If the input-src property was used, record the corresponding input */ ++ if (v4l2object->input_src) { ++ gchar *input_name = g_ascii_strup((gchar*)input.name, -1); ++ gboolean input_match; ++ ++ input_match = (strcmp(input_name, v4l2object->input_src) == 0); ++ ++ g_free(input_name); ++ ++ if (input_match) ++ input_src_found = TRUE; ++ else ++ continue; ++ } ++ + GST_LOG_OBJECT (e, " index: %d", input.index); + GST_LOG_OBJECT (e, " name: '%s'", input.name); + GST_LOG_OBJECT (e, " type: %08x", input.type); +@@ -381,6 +401,12 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + } + v4l2object->colors = g_list_reverse (v4l2object->colors); + ++ if (v4l2object->input_src && !input_src_found) { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND, ++ (_("Specified input-src '%s' was not found."), ++ v4l2object->input_src), NULL); ++ } ++ + GST_DEBUG_OBJECT (e, "done"); + return TRUE; + } +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0002-v4l2src-keep-track-of-the-input-ID-that-will-be-used.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0002-v4l2src-keep-track-of-the-input-ID-that-will-be-used.patch new file mode 100644 index 0000000..668bd9c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0002-v4l2src-keep-track-of-the-input-ID-that-will-be-used.patch @@ -0,0 +1,72 @@ +From 3c93b831cbddefac77aebc8daa69f80df2394b2b Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Mon, 17 May 2010 11:12:21 -0500 +Subject: [PATCH 02/17] v4l2src: keep track of the input ID that will be used for capture + +The default ID is set on a per-target basis to one that is reasonable. This +will typically be the same default as the DVSDK encode demo. +--- + sys/v4l2/gstv4l2object.h | 1 + + sys/v4l2/gstv4l2src.c | 9 +++++++++ + sys/v4l2/v4l2_calls.c | 10 ++++++++-- + 3 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index 3a9c135..08ea936 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -111,6 +111,7 @@ struct _GstV4l2Object { + gchar *channel; + gulong frequency; + gchar *input_src; ++ gint input_id; + + /* X-overlay */ + GstV4l2Xv *xv; +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index 48cfb23..a833bab 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -298,6 +298,15 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass) + v4l2src->is_capturing = FALSE; + v4l2src->v4l2object->input_src = NULL; + ++ /* Set the default input ID on a per-target basis */ ++ #if defined (Platform_dm365) ++ v4l2src->v4l2object->input_id = 2; /* Component */ ++ #elif defined (Platform_dm6467t) || defined (Platform_dm6467) ++ v4l2src->v4l2object->input_id = 1; /* Component */ ++ #else ++ v4l2src->v4l2object->input_id = 0; /* Default to first input */ ++ #endif ++ + gst_base_src_set_format (GST_BASE_SRC (v4l2src), GST_FORMAT_TIME); + gst_base_src_set_live (GST_BASE_SRC (v4l2src), TRUE); + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index b88b07b..eb67fd3 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -155,11 +155,17 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + + g_free(input_name); + +- if (input_match) +- input_src_found = TRUE; ++ if (input_match) { ++ input_src_found = TRUE; ++ v4l2object->input_id = input.index; ++ } + else + continue; + } ++ else { ++ if (input.index != v4l2object->input_id) ++ continue; ++ } + + GST_LOG_OBJECT (e, " index: %d", input.index); + GST_LOG_OBJECT (e, " name: '%s'", input.name); +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0003-v4l2src-make-sure-capture-buffer-size-is-aligned-on-.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0003-v4l2src-make-sure-capture-buffer-size-is-aligned-on-.patch new file mode 100644 index 0000000..8abe1ee --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0003-v4l2src-make-sure-capture-buffer-size-is-aligned-on-.patch @@ -0,0 +1,33 @@ +From a5a6650a10d44e3c83428fcf6ac7aa6d6374f91d Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Tue, 13 Jul 2010 19:30:51 -0500 +Subject: [PATCH 03/17] v4l2src: make sure capture buffer size is aligned on DM365. + +On DM365, capture buffers use a pitch that is aligned to a 32-byte boundary. +We need to comprehend this when calculated the expected capture buffer size. +--- + sys/v4l2/gstv4l2object.c | 6 ++++++ + 1 files changed, 6 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 9ad0803..34bc103 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1277,8 +1277,14 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + break; + case GST_MAKE_FOURCC ('N', 'V', '1', '2'): + fourcc = V4L2_PIX_FMT_NV12; ++#if defined(Platform_dm365) ++ /* NV12 buffer on dm365 is 32-byte aligned */ ++ outsize = GST_ROUND_UP_32 (*w) * GST_ROUND_UP_2 (*h); ++ outsize += (GST_ROUND_UP_32 (*w) * *h) / 2; ++#else + outsize = GST_ROUND_UP_4 (*w) * GST_ROUND_UP_2 (*h); + outsize += (GST_ROUND_UP_4 (*w) * *h) / 2; ++#endif + break; + case GST_MAKE_FOURCC ('N', 'V', '2', '1'): + fourcc = V4L2_PIX_FMT_NV21; +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0004-osssink-handle-all-supported-sample-rates.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0004-osssink-handle-all-supported-sample-rates.patch new file mode 100644 index 0000000..862d99b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0004-osssink-handle-all-supported-sample-rates.patch @@ -0,0 +1,34 @@ +From 0113cb897b1ac19ac84f59975a4a07487efa39a3 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Thu, 11 Mar 2010 13:07:19 -0600 +Subject: [PATCH 04/17] osssink: handle all supported sample rates + +Converted from plugins_good1_0_10_16.patch +--- + sys/oss/gstosshelper.c | 10 ++++++++++ + 1 files changed, 10 insertions(+), 0 deletions(-) + +diff --git a/sys/oss/gstosshelper.c b/sys/oss/gstosshelper.c +index 6d7e6bd..7f78236 100644 +--- a/sys/oss/gstosshelper.c ++++ b/sys/oss/gstosshelper.c +@@ -237,6 +237,16 @@ gst_oss_helper_rate_probe_check (GstOssProbe * probe) + probe->min = gst_oss_helper_rate_check_rate (probe, 1000); + n_checks++; + probe->max = gst_oss_helper_rate_check_rate (probe, 100000); ++ ++ /* Probing is not proper -- check additional sample rates */ ++ gst_oss_helper_rate_check_rate(probe, 22050); ++ gst_oss_helper_rate_check_rate(probe, 11025); ++ gst_oss_helper_rate_check_rate(probe, 24000); ++ gst_oss_helper_rate_check_rate(probe, 32000); ++ gst_oss_helper_rate_check_rate(probe, 44100); ++ gst_oss_helper_rate_check_rate(probe, 48000); ++ gst_oss_helper_rate_check_rate(probe, 8000); ++ + /* a little bug workaround */ + { + int max; +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0005-v4l2src-add-support-for-DaVinci-platforms-using-MVL-.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0005-v4l2src-add-support-for-DaVinci-platforms-using-MVL-.patch new file mode 100644 index 0000000..1e6bcda --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0005-v4l2src-add-support-for-DaVinci-platforms-using-MVL-.patch @@ -0,0 +1,689 @@ +From 60697e185f4076713914eb268dbadd72ba8be332 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:33:30 -0500 +Subject: [PATCH 05/17] v4l2src: add support for DaVinci platforms using MVL-based kernels + +The following files add support for device-specific hand-shaking with the +capture drivers for DaVinci platforms that use MontaVista-based Linux kernels: + + v4l2src_mvl_lsp.h + v4l2src_mvl_lsp.c + +Since these capture drivers use some custom ioctls that would never be pushed +to the upstream Linux kernel tree, it follows that changes to the v4l2src +element to support these ioctls would never be pushed either. That said, +our goal here is to isolate these changes into their own file and change the +upstream code base as little as possible. Since we may need to carry these +patches for several revisions of v4l2src, this will make re-basing easier. + +All changes to the upstream code are guarded by "#if defined(MVL_LSP)", which +is defined by the TI GStreamer build system where appropriate. +--- + sys/v4l2/Makefile.am | 4 +- + sys/v4l2/Makefile.in | 10 ++ + sys/v4l2/gstv4l2bufferpool.c | 4 + + sys/v4l2/gstv4l2bufferpool.h | 3 + + sys/v4l2/gstv4l2object.c | 33 ++++++- + sys/v4l2/gstv4l2object.h | 8 ++ + sys/v4l2/gstv4l2src.c | 26 +++++ + sys/v4l2/v4l2_calls.c | 4 + + sys/v4l2/v4l2src_calls.c | 14 +++ + sys/v4l2/v4l2src_mvl_lsp.c | 234 ++++++++++++++++++++++++++++++++++++++++++ + sys/v4l2/v4l2src_mvl_lsp.h | 52 +++++++++ + 11 files changed, 390 insertions(+), 2 deletions(-) + create mode 100644 sys/v4l2/v4l2src_mvl_lsp.c + create mode 100644 sys/v4l2/v4l2src_mvl_lsp.h + +diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am +index e655bcb..0c0e086 100644 +--- a/sys/v4l2/Makefile.am ++++ b/sys/v4l2/Makefile.am +@@ -19,6 +19,7 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \ + gstv4l2vidorient.c \ + v4l2_calls.c \ + v4l2src_calls.c \ ++ v4l2src_mvl_lsp.c \ + $(xv_source) + + libgstvideo4linux2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ +@@ -50,4 +51,5 @@ noinst_HEADERS = \ + gstv4l2vidorient.h \ + gstv4l2xoverlay.h \ + v4l2_calls.h \ +- v4l2src_calls.h ++ v4l2src_calls.h \ ++ v4l2src_mvl_lsp.h +diff --git a/sys/v4l2/Makefile.in b/sys/v4l2/Makefile.in +index 34d4da7..7206cae 100644 +--- a/sys/v4l2/Makefile.in ++++ b/sys/v4l2/Makefile.in +@@ -117,6 +117,7 @@ am_libgstvideo4linux2_la_OBJECTS = libgstvideo4linux2_la-gstv4l2.lo \ + libgstvideo4linux2_la-gstv4l2tuner.lo \ + libgstvideo4linux2_la-gstv4l2vidorient.lo \ + libgstvideo4linux2_la-v4l2_calls.lo \ ++ libgstvideo4linux2_la-v4l2src_mvl_lsp.lo \ + libgstvideo4linux2_la-v4l2src_calls.lo + libgstvideo4linux2_la_OBJECTS = $(am_libgstvideo4linux2_la_OBJECTS) + AM_V_lt = $(am__v_lt_$(V)) +@@ -492,6 +493,7 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \ + gstv4l2tuner.c \ + gstv4l2vidorient.c \ + v4l2_calls.c \ ++ v4l2src_mvl_lsp.c \ + v4l2src_calls.c \ + $(xv_source) + +@@ -523,6 +525,7 @@ noinst_HEADERS = \ + gstv4l2vidorient.h \ + gstv4l2xoverlay.h \ + v4l2_calls.h \ ++ v4l2src_mvl_lsp.h \ + v4l2src_calls.h + + all: all-am +@@ -706,6 +709,13 @@ libgstvideo4linux2_la-v4l2_calls.lo: v4l2_calls.c + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-v4l2_calls.lo `test -f 'v4l2_calls.c' || echo '$(srcdir)/'`v4l2_calls.c + ++libgstvideo4linux2_la-v4l2src_mvl_lsp.lo: v4l2src_mvl_lsp.c ++@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -MT libgstvideo4linux2_la-v4l2src_mvl_lsp.lo -MD -MP -MF $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Tpo -c -o libgstvideo4linux2_la-v4l2src_mvl_lsp.lo `test -f 'v4l2src_mvl_lsp.c' || echo '$(srcdir)/'`v4l2src_mvl_lsp.c ++@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Tpo $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Plo ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='v4l2src_mvl_lsp.c' object='libgstvideo4linux2_la-v4l2src_mvl_lsp.lo' libtool=yes @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-v4l2src_mvl_lsp.lo `test -f 'v4l2src_mvl_lsp.c' || echo '$(srcdir)/'`v4l2src_mvl_lsp.c ++ + libgstvideo4linux2_la-v4l2src_calls.lo: v4l2src_calls.c + @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -MT libgstvideo4linux2_la-v4l2src_calls.lo -MD -MP -MF $(DEPDIR)/libgstvideo4linux2_la-v4l2src_calls.Tpo -c -o libgstvideo4linux2_la-v4l2src_calls.lo `test -f 'v4l2src_calls.c' || echo '$(srcdir)/'`v4l2src_calls.c + @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstvideo4linux2_la-v4l2src_calls.Tpo $(DEPDIR)/libgstvideo4linux2_la-v4l2src_calls.Plo +diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c +index c13bb1e..e28985e 100644 +--- a/sys/v4l2/gstv4l2bufferpool.c ++++ b/sys/v4l2/gstv4l2bufferpool.c +@@ -546,7 +546,11 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool) + GST_V4L2_BUFFER_POOL_UNLOCK (pool); + + /* this can change at every frame, esp. with jpeg */ ++#if defined(MVL_LSP) && ( defined(Platform_dm6467) || defined(Platform_dm357)) ++ GST_BUFFER_SIZE (pool_buffer) = pool->bytesused; ++#else + GST_BUFFER_SIZE (pool_buffer) = buffer.bytesused; ++#endif + + return pool_buffer; + } +diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h +index 70ab082..ee16484 100644 +--- a/sys/v4l2/gstv4l2bufferpool.h ++++ b/sys/v4l2/gstv4l2bufferpool.h +@@ -64,6 +64,9 @@ struct _GstV4l2BufferPool + gint video_fd; /* a dup(2) of the v4l2object's video_fd */ + guint buffer_count; + GstV4l2Buffer **buffers; ++ #if defined(MVL_LSP) ++ guint32 bytesused; ++ #endif + }; + + struct _GstV4l2Buffer { +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 34bc103..b00bfdf 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -41,6 +41,9 @@ + + #include "gst/gst-i18n-plugin.h" + ++#if defined(MVL_LSP) ++#include "v4l2src_mvl_lsp.h" ++#endif + + GST_DEBUG_CATEGORY_EXTERN (v4l2_debug); + #define GST_CAT_DEFAULT v4l2_debug +@@ -683,6 +686,9 @@ static const GstV4L2FormatDesc gst_v4l2_formats[] = { + #ifdef V4L2_PIX_FMT_YVYU + {V4L2_PIX_FMT_YVYU, TRUE}, + #endif ++#ifdef V4L2_PIX_FMT_YUV422UVP ++ {V4L2_PIX_FMT_YUV422UVP, TRUE}, ++#endif + }; + + #define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats)) +@@ -1070,6 +1076,9 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + #ifdef V4L2_PIX_FMT_YVYU + case V4L2_PIX_FMT_YVYU: + #endif ++#ifdef V4L2_PIX_FMT_YUV422UVP ++ case V4L2_PIX_FMT_YUV422UVP: ++#endif + case V4L2_PIX_FMT_YUV411P:{ + guint32 fcc = 0; + +@@ -1112,6 +1121,11 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + fcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'); + break; + #endif ++#ifdef V4L2_PIX_FMT_YUV422UVP ++ case V4L2_PIX_FMT_YUV422UVP: ++ fcc = GST_MAKE_FOURCC ('Y', '8', 'C', '8'); ++ break; ++#endif + default: + g_assert_not_reached (); + break; +@@ -1577,9 +1591,11 @@ sort_by_frame_size (GstStructure * s1, GstStructure * s2) + } + #endif + ++#if !defined(MVL_LSP) + static gboolean + gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + guint32 pixelformat, gint * width, gint * height); ++#endif + + GstCaps * + gst_v4l2_object_probe_caps_for_format (GstV4l2Object * v4l2object, +@@ -1738,6 +1754,12 @@ default_frame_sizes: + gint min_w, max_w, min_h, max_h, fix_num = 0, fix_denom = 0; + + /* This code is for Linux < 2.6.19 */ ++#if defined(MVL_LSP) ++ gst_v4l2src_get_resolution(v4l2object, &min_w, &min_h, &fix_num, ++ &fix_denom); ++ gst_v4l2src_get_resolution(v4l2object, &max_w, &max_h, &fix_num, ++ &fix_denom); ++#else + min_w = min_h = 1; + max_w = max_h = GST_V4L2_MAX_SIZE; + if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat, &min_w, +@@ -1752,7 +1774,8 @@ default_frame_sizes: + "Could not probe maximum capture size for pixelformat %" + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (pixelformat)); + } +- ++#endif ++ + /* Since we can't get framerate directly, try to use the current norm */ + if (v4l2object->norm && v4l2object->norms) { + GList *norms; +@@ -1765,8 +1788,10 @@ default_frame_sizes: + } + /* If it's possible, set framerate to that (discrete) value */ + if (norm) { ++#if !defined(MVL_LSP) + fix_num = gst_value_get_fraction_numerator (&norm->framerate); + fix_denom = gst_value_get_fraction_denominator (&norm->framerate); ++#endif + } + } + +@@ -1796,6 +1821,7 @@ default_frame_sizes: + } + } + ++#if !defined(MVL_LSP) + static gboolean + gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + guint32 pixelformat, gint * width, gint * height) +@@ -1870,6 +1896,7 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + + return TRUE; + } ++#endif + + + gboolean +@@ -1919,6 +1946,10 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, + * combined, there are other modes for requesting fields individually) */ + format.fmt.pix.field = V4L2_FIELD_INTERLACED; + ++ #if defined(MVL_LSP) ++ v4l2object->bytesused = format.fmt.pix.sizeimage; ++ #endif ++ + if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) { + /* we might also get EBUSY here */ + if (errno != EINVAL) +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index 08ea936..ddeaa7c 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -121,6 +121,14 @@ struct _GstV4l2Object { + GstV4l2GetInOutFunction get_in_out_func; + GstV4l2SetInOutFunction set_in_out_func; + GstV4l2UpdateFpsFunction update_fps_func; ++ ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ gboolean force_720p_30; ++#endif ++#if defined(MVL_LSP) ++ guint32 bytesused; ++#endif ++ + }; + + struct _GstV4l2ObjectClassHelper { +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index a833bab..9c4c5c3 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -72,6 +72,9 @@ enum + V4L2_STD_OBJECT_PROPS, + PROP_QUEUE_SIZE, + PROP_ALWAYS_COPY, ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ PROP_FORCE_720P_30, ++#endif + PROP_INPUT_SRC + }; + +@@ -268,6 +271,12 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass) + g_object_class_install_property (gobject_class, PROP_INPUT_SRC, + g_param_spec_string ("input-src", "Select the input source", + "Select the input source)", NULL, G_PARAM_READWRITE)); ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ g_object_class_install_property (gobject_class, PROP_FORCE_720P_30, ++ g_param_spec_boolean ("force-720p-30", "Configure 720P @ 30fps", ++ "Force driver to work on 720P @ 30fps", ++ FALSE, G_PARAM_READWRITE)); ++#endif + + basesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_get_caps); + basesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2src_set_caps); +@@ -297,10 +306,17 @@ gst_v4l2src_init (GstV4l2Src * v4l2src, GstV4l2SrcClass * klass) + + v4l2src->is_capturing = FALSE; + v4l2src->v4l2object->input_src = NULL; ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ v4l2src->v4l2object->force_720p_30 = FALSE; ++#endif + + /* Set the default input ID on a per-target basis */ + #if defined (Platform_dm365) ++ #if defined(MVL_LSP) ++ v4l2src->v4l2object->input_id = 4; /* Component (MVL) */ ++ #else + v4l2src->v4l2object->input_id = 2; /* Component */ ++ #endif + #elif defined (Platform_dm6467t) || defined (Platform_dm6467) + v4l2src->v4l2object->input_id = 1; /* Component */ + #else +@@ -356,6 +372,11 @@ gst_v4l2src_set_property (GObject * object, + v4l2src->v4l2object->input_src = + g_ascii_strup(g_value_get_string(value), -1); + break; ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ case PROP_FORCE_720P_30: ++ v4l2src->v4l2object->force_720p_30 = g_value_get_boolean (value); ++ break; ++#endif + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -382,6 +403,11 @@ gst_v4l2src_get_property (GObject * object, + case PROP_INPUT_SRC: + g_value_set_string(value, v4l2src->v4l2object->input_src); + break; ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ case PROP_FORCE_720P_30: ++ g_value_set_boolean (value, v4l2src->v4l2object->force_720p_30); ++ break; ++#endif + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index eb67fd3..b932aba 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -50,6 +50,10 @@ + + #include "gst/gst-i18n-plugin.h" + ++#if defined(MVL_LSP) && defined(Platform_dm365) ++#include "v4l2src_mvl_lsp.h" ++#endif ++ + /* Those are ioctl calls */ + #ifndef V4L2_CID_HCENTER + #define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED +diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c +index ebdb0b3..b069920 100644 +--- a/sys/v4l2/v4l2src_calls.c ++++ b/sys/v4l2/v4l2src_calls.c +@@ -47,6 +47,10 @@ + + #include "gst/gst-i18n-plugin.h" + ++#if defined(MVL_LSP) && defined(Platform_dm365) ++#include "v4l2src_mvl_lsp.h" ++#endif ++ + #define GST_CAT_DEFAULT v4l2src_debug + GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); + +@@ -107,6 +111,10 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src, GstBuffer ** buf) + if (!pool) + goto no_buffer_pool; + ++ #if defined(MVL_LSP) ++ pool->bytesused = v4l2src->v4l2object->bytesused; ++ #endif ++ + GST_DEBUG_OBJECT (v4l2src, "grab frame"); + + for (;;) { +@@ -367,6 +375,12 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) + v4l2src->quit = FALSE; + + if (v4l2src->use_mmap) { ++#if defined(MVL_LSP) && defined(Platform_dm365) ++ if (v4l2src->v4l2object->force_720p_30) { ++ if (!gst_v4l2_force_720p_30(v4l2src)) ++ return FALSE; ++ } ++#endif + if (!gst_v4l2src_buffer_pool_activate (v4l2src->pool, v4l2src)) { + return FALSE; + } +diff --git a/sys/v4l2/v4l2src_mvl_lsp.c b/sys/v4l2/v4l2src_mvl_lsp.c +new file mode 100644 +index 0000000..d06d339 +--- /dev/null ++++ b/sys/v4l2/v4l2src_mvl_lsp.c +@@ -0,0 +1,234 @@ ++/* ++ * v4l2src_mvl_lsp.c ++ * ++ * This file defines functions needed to get v4l2src on dm6446, dm355, dm6467 ++ * , dm357 and dm365 LSP's. ++ * ++ * ++ * Most the code is copied from DMAI capture routines with following license: ++ * ++ * --COPYRIGHT--,BSD ++ * Copyright (c) 2009, Texas Instruments Incorporated ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Texas Instruments Incorporated nor the names of ++ * its contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ++ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * --/COPYRIGHT--*/ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++#include <sys/ioctl.h> ++#include <sys/mman.h> ++#include <string.h> ++#include <errno.h> ++#include <unistd.h> ++#include <ctype.h> ++#ifdef __sun ++/* Needed on older Solaris Nevada builds (72 at least) */ ++#include <stropts.h> ++#include <sys/ioccom.h> ++#endif ++ ++#include "v4l2src_mvl_lsp.h" ++ ++#if defined(MVL_LSP) ++/****************************************************** ++ * gst_v4l2src_get_resolution ++ * get the video resolution ++ *****************************************************/ ++void gst_v4l2src_get_resolution (GstV4l2Object *v4l2object, gint *width, gint *height, gint *fps_num, gint *fps_denom) ++{ ++ gint fd = v4l2object->video_fd; ++ v4l2_std_id std; ++ gint failCount = 0, ret; ++ ++ do { ++ ret = ioctl(fd, VIDIOC_QUERYSTD, &std); ++ if (ret == -1 && errno == EAGAIN) { ++ usleep(1); ++ failCount++; ++ } ++ }while(ret == -1 && errno == EAGAIN && failCount < 5); ++ ++ if (ret == -1) { ++ GST_ERROR("failed to query standard, Video input connected ?\n"); ++ } ++ ++ /* It might take a few tries to detect the signal */ ++ if (std & V4L2_STD_NTSC) { ++ GST_LOG("found ntsc standard\n"); ++ *width = 720; ++ *height = 480; ++ *fps_num = 30000; ++ *fps_denom = 1001; ++ } ++ else if (std & V4L2_STD_PAL) { ++ GST_LOG("found pal standard\n"); ++ *width = 720; ++ *height = 576; ++ *fps_num = 25; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_525P_60) { ++ GST_LOG("found 525p standard\n"); ++ *width = 720; ++ *height = 480; ++ *fps_num = 30000; ++ *fps_denom = 1001; ++ } ++ else if (std & V4L2_STD_625P_50) { ++ GST_LOG("found 625p standard\n"); ++ *width = 720; ++ *height = 576; ++ *fps_num = 25; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_720P_60) { ++ GST_LOG("found 720p @60fps standard\n"); ++ *width = 1280; ++ *height = 720; ++ *fps_num = 60; ++ *fps_denom = 1; ++ #if defined(Platform_dm365) ++ if (v4l2object->force_720p_30) { ++ *fps_num = 30000; ++ *fps_denom = 1001; ++ } ++ #endif ++ } ++ else if (std & V4L2_STD_720P_50) { ++ GST_LOG("found 720p @50fps standard\n"); ++ *width = 1280; ++ *height = 720; ++ *fps_num = 50; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_1080I_60) { ++ GST_LOG("found 1080i @60fps standard\n"); ++ *width = 1920; ++ *height = 1080; ++ *fps_num = 60; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_1080I_50) { ++ GST_LOG("found 1080i @50fps standard\n"); ++ *width = 1920; ++ *height = 1080; ++ *fps_num = 50; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_1080P_30) { ++ GST_LOG("found 1080p @30fps standard\n"); ++ *width = 1920; ++ *height = 1080; ++ *fps_num = 30; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_1080P_25) { ++ GST_LOG("found 1080p @25fps standard\n"); ++ *width = 1920; ++ *height = 1080; ++ *fps_num = 25; ++ *fps_denom = 1; ++ } ++ else if (std & V4L2_STD_1080P_24) { ++ GST_LOG("found 1080p @24fps standard\n"); ++ *width = 1920; ++ *height = 1080; ++ *fps_num = 24; ++ *fps_denom = 1; ++ } ++ else { ++ GST_WARNING("failed to detect video standard\n"); ++ *width = 1; ++ *height = 1; ++ *fps_num = 1; ++ *fps_denom = 1; ++ } ++} ++ ++#if defined(Platform_dm365) ++/****************************************************** ++ * gst_v4l2src_force_720p_30 ++ *****************************************************/ ++gboolean gst_v4l2_force_720p_30 (GstV4l2Src * v4l2src) ++{ ++ gint fd = v4l2src->v4l2object->video_fd; ++ struct v4l2_standard stdinfo; ++ struct v4l2_streamparm streamparam, streamparam_s; ++ gboolean found; ++ ++ stdinfo.index = 0; ++ found = 0; ++ while ( 0 == ioctl(fd, VIDIOC_ENUMSTD, &stdinfo)) { ++ if (stdinfo.id == V4L2_STD_720P_60) { ++ found = 1; ++ break; ++ } ++ stdinfo.index++; ++ } ++ ++ if (found) { ++ /* set the streaming parameter to reduce the capture frequency to half */ ++ streamparam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ streamparam.parm.capture.timeperframe.numerator = ++ stdinfo.frameperiod.numerator; ++ streamparam.parm.capture.timeperframe.denominator = ++ stdinfo.frameperiod.denominator / 2; ++ streamparam_s = streamparam; ++ if (ioctl(fd, VIDIOC_S_PARM , &streamparam) < 0 ) { ++ GST_ERROR("failed to VIDIOC_S_PARM\n"); ++ return FALSE; ++ } ++ ++ /* verify the params */ ++ if (ioctl(fd, VIDIOC_G_PARM, &streamparam) < 0) { ++ GST_ERROR("VIDIOC_G_PARM failed\n"); ++ return FALSE; ++ } ++ ++ if ((streamparam.parm.capture.timeperframe.numerator != ++ streamparam_s.parm.capture.timeperframe.numerator) || ++ (streamparam.parm.capture.timeperframe.denominator != ++ streamparam_s.parm.capture.timeperframe.denominator)) { ++ GST_ERROR("Could not set capture driver for 30fps\n"); ++ return FALSE; ++ } ++ } ++ ++ GST_ELEMENT_WARNING(v4l2src, RESOURCE, WRITE, ("forcing from 720P @60fps to " ++ "720P @30fps\n"), (NULL)); ++ return TRUE; ++} ++#endif /* Platform_dm365 */ ++ ++#endif /* MVL_LSP */ +diff --git a/sys/v4l2/v4l2src_mvl_lsp.h b/sys/v4l2/v4l2src_mvl_lsp.h +new file mode 100644 +index 0000000..5f1ae7c +--- /dev/null ++++ b/sys/v4l2/v4l2src_mvl_lsp.h +@@ -0,0 +1,52 @@ ++/* ++ * v4l2src_mvl_lsp.h ++ * ++ * This file defines functions needed to get v4l2src on dm6446, dm355, dm6467 ++ * , dm357 and dm365 LSP's. ++ * ++ * Most the code is copied from DMAI capture routines with following license: ++ * ++ * --COPYRIGHT--,BSD ++ * Copyright (c) 2009, Texas Instruments Incorporated ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Texas Instruments Incorporated nor the names of ++ * its contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ++ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * --/COPYRIGHT--*/ ++ ++#ifndef __GST_DM365_RESIZER_H__ ++#define __GST_DM365_RESIZER_H__ ++ ++#include <gstv4l2object.h> ++#include "v4l2src_calls.h" ++ ++void gst_v4l2src_get_resolution (GstV4l2Object *v4l2object, gint *width, ++ gint *height, gint *fps_num, gint *fps_denom); ++gboolean gst_v4l2_force_720p_30 (GstV4l2Src * v4l2src); ++ ++#endif /* __GST_DM365_RESIZER_H__ */ ++ +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0006-v4l2src-support-NV12-capture-on-DM365-using-the-IPIP.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0006-v4l2src-support-NV12-capture-on-DM365-using-the-IPIP.patch new file mode 100644 index 0000000..b27aea0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0006-v4l2src-support-NV12-capture-on-DM365-using-the-IPIP.patch @@ -0,0 +1,843 @@ +From b6e9b0ae1351aedbad1e3b3ec65d0b25a4ced9f6 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:36:01 -0500 +Subject: [PATCH 06/17] v4l2src: support NV12 capture on DM365 using the IPIPE in on-the-fly mode + +--- + sys/v4l2/Makefile.am | 2 + + sys/v4l2/Makefile.in | 10 + + sys/v4l2/gstv4l2object.c | 20 ++ + sys/v4l2/gstv4l2object.h | 13 + + sys/v4l2/v4l2_calls.c | 15 ++ + sys/v4l2/v4l2_dm365_ipipe.c | 548 +++++++++++++++++++++++++++++++++++++++++++ + sys/v4l2/v4l2_dm365_ipipe.h | 63 +++++ + sys/v4l2/v4l2src_mvl_lsp.h | 6 +- + 8 files changed, 674 insertions(+), 3 deletions(-) + create mode 100644 sys/v4l2/v4l2_dm365_ipipe.c + create mode 100644 sys/v4l2/v4l2_dm365_ipipe.h + +diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am +index 0c0e086..92f289c 100644 +--- a/sys/v4l2/Makefile.am ++++ b/sys/v4l2/Makefile.am +@@ -18,6 +18,7 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \ + gstv4l2tuner.c \ + gstv4l2vidorient.c \ + v4l2_calls.c \ ++ v4l2_dm365_ipipe.c\ + v4l2src_calls.c \ + v4l2src_mvl_lsp.c \ + $(xv_source) +@@ -51,5 +52,6 @@ noinst_HEADERS = \ + gstv4l2vidorient.h \ + gstv4l2xoverlay.h \ + v4l2_calls.h \ ++ v4l2_dm365_ipipe.h \ + v4l2src_calls.h \ + v4l2src_mvl_lsp.h +diff --git a/sys/v4l2/Makefile.in b/sys/v4l2/Makefile.in +index 7206cae..4ba24a7 100644 +--- a/sys/v4l2/Makefile.in ++++ b/sys/v4l2/Makefile.in +@@ -117,6 +117,7 @@ am_libgstvideo4linux2_la_OBJECTS = libgstvideo4linux2_la-gstv4l2.lo \ + libgstvideo4linux2_la-gstv4l2tuner.lo \ + libgstvideo4linux2_la-gstv4l2vidorient.lo \ + libgstvideo4linux2_la-v4l2_calls.lo \ ++ libgstvideo4linux2_la-v4l2_dm365_ipipe.lo \ + libgstvideo4linux2_la-v4l2src_mvl_lsp.lo \ + libgstvideo4linux2_la-v4l2src_calls.lo + libgstvideo4linux2_la_OBJECTS = $(am_libgstvideo4linux2_la_OBJECTS) +@@ -493,6 +494,7 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \ + gstv4l2tuner.c \ + gstv4l2vidorient.c \ + v4l2_calls.c \ ++ v4l2_dm365_ipipe.c \ + v4l2src_mvl_lsp.c \ + v4l2src_calls.c \ + $(xv_source) +@@ -525,6 +527,7 @@ noinst_HEADERS = \ + gstv4l2vidorient.h \ + gstv4l2xoverlay.h \ + v4l2_calls.h \ ++ v4l2_dm365_ipipe.h \ + v4l2src_mvl_lsp.h \ + v4l2src_calls.h + +@@ -709,6 +712,13 @@ libgstvideo4linux2_la-v4l2_calls.lo: v4l2_calls.c + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-v4l2_calls.lo `test -f 'v4l2_calls.c' || echo '$(srcdir)/'`v4l2_calls.c + ++libgstvideo4linux2_la-v4l2_dm365_ipipe.lo: v4l2_dm365_ipipe.c ++@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -MT libgstvideo4linux2_la-v4l2_dm365_ipipe.lo -MD -MP -MF $(DEPDIR)/libgstvideo4linux2_la-v4l2_dm365_ipipe.Tpo -c -o libgstvideo4linux2_la-v4l2_dm365_ipipe.lo `test -f 'v4l2_dm365_ipipe.c' || echo '$(srcdir)/'`v4l2_dm365_ipipe.c ++@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgstvideo4linux2_la-v4l2_dm365_ipipe.Tpo $(DEPDIR)/libgstvideo4linux2_la-v4l2_dm365_ipipe.Plo ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='v4l2_dm365_ipipe.c' object='libgstvideo4linux2_la-v4l2_dm365_ipipe.lo' libtool=yes @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-v4l2_dm365_ipipe.lo `test -f 'v4l2_dm365_ipipe.c' || echo '$(srcdir)/'`v4l2_dm365_ipipe.c ++ + libgstvideo4linux2_la-v4l2src_mvl_lsp.lo: v4l2src_mvl_lsp.c + @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -MT libgstvideo4linux2_la-v4l2src_mvl_lsp.lo -MD -MP -MF $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Tpo -c -o libgstvideo4linux2_la-v4l2src_mvl_lsp.lo `test -f 'v4l2src_mvl_lsp.c' || echo '$(srcdir)/'`v4l2src_mvl_lsp.c + @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Tpo $(DEPDIR)/libgstvideo4linux2_la-v4l2src_mvl_lsp.Plo +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index b00bfdf..4b50009 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -45,6 +45,8 @@ + #include "v4l2src_mvl_lsp.h" + #endif + ++#include "v4l2_dm365_ipipe.h" ++ + GST_DEBUG_CATEGORY_EXTERN (v4l2_debug); + #define GST_CAT_DEFAULT v4l2_debug + +@@ -367,6 +369,14 @@ gst_v4l2_object_new (GstElement * element, + + v4l2object->xwindow_id = 0; + ++ #if defined(USE_DM365_IPIPE) ++ v4l2object->davinci_resizer_dev = NULL; ++ v4l2object->davinci_resizer_fd = -1; ++ ++ v4l2object->davinci_previewer_dev = NULL; ++ v4l2object->davinci_previewer_fd = -1; ++ #endif ++ + return v4l2object; + } + +@@ -398,6 +408,16 @@ gst_v4l2_object_destroy (GstV4l2Object * v4l2object) + g_free (v4l2object->input_src); + } + ++ #if defined(USE_DM365_IPIPE) ++ if (v4l2object->davinci_resizer_dev) { ++ g_free (v4l2object->davinci_resizer_dev); ++ } ++ ++ if (v4l2object->davinci_previewer_dev) { ++ g_free (v4l2object->davinci_previewer_dev); ++ } ++ #endif ++ + g_free (v4l2object); + } + +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index ddeaa7c..640f948 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -52,6 +52,9 @@ + + #include <gst/interfaces/propertyprobe.h> + ++#if defined(Platform_dm365) ++ #define USE_DM365_IPIPE ++#endif + + /* size of v4l2 buffer pool in streaming case */ + #define GST_V4L2_MAX_BUFFERS 16 +@@ -85,6 +88,16 @@ struct _GstV4l2Object { + GstPoll * poll; + gboolean can_poll_device; + ++ #if defined(USE_DM365_IPIPE) ++ /* the resizer device and file descriptor */ ++ char *davinci_resizer_dev; ++ gint davinci_resizer_fd; ++ ++ /* the previewer device and file descriptor */ ++ char *davinci_previewer_dev; ++ gint davinci_previewer_fd; ++ #endif ++ + /* the video buffer (mmap()'ed) */ + guint8 **buffer; + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index b932aba..30ebf9e 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -54,6 +54,9 @@ + #include "v4l2src_mvl_lsp.h" + #endif + ++#include "v4l2_dm365_ipipe.h" ++ ++ + /* Those are ioctl calls */ + #ifndef V4L2_CID_HCENTER + #define V4L2_CID_HCENTER V4L2_CID_HCENTER_DEPRECATED +@@ -452,6 +455,13 @@ gst_v4l2_open (GstV4l2Object * v4l2object) + int libv4l2_fd; + GstPollFD pollfd = GST_POLL_FD_INIT; + ++ #if defined (USE_DM365_IPIPE) ++ if (gst_v4l2_dm365_ipipe_open(v4l2object) < 0) ++ GST_ERROR("failed to open IPIPE\n"); ++ if (gst_v4l2_dm365_ipipe_init(v4l2object) < 0) ++ GST_ERROR("failed to initialize IPIPE\n"); ++ #endif ++ + GST_DEBUG_OBJECT (v4l2object->element, "Trying to open device %s", + v4l2object->videodev); + +@@ -590,6 +600,11 @@ gst_v4l2_close (GstV4l2Object * v4l2object) + gst_poll_remove_fd (v4l2object->poll, &pollfd); + v4l2object->video_fd = -1; + ++ #if defined (USE_DM365_IPIPE) ++ if (gst_v4l2_dm365_ipipe_close(v4l2object) < 0) ++ GST_ERROR("failed to close IPIPE\n"); ++ #endif ++ + /* empty lists */ + gst_v4l2_empty_lists (v4l2object); + +diff --git a/sys/v4l2/v4l2_dm365_ipipe.c b/sys/v4l2/v4l2_dm365_ipipe.c +new file mode 100644 +index 0000000..3fe9f82 +--- /dev/null ++++ b/sys/v4l2/v4l2_dm365_ipipe.c +@@ -0,0 +1,548 @@ ++/* ++ * v4l2_dm365_ipipe.c ++ * ++ * This file defines functions needed to configure the DM365 IPIPE in ++ * on-the-fly mode with the capture driver. The capture driver by itself ++ * only supports UYVY, but using the IPIPE we can convert to NV12 on the ++ * fly during capture, which is the color format expected by some codecs. ++ * ++ * Original Author: ++ * Don Darling, Texas Instruments, Inc. ++ * ++ * DMAI's capture code was heavily referenced for this implementation. ++ * DMAI uses the following license: ++ * ++ * --COPYRIGHT--,BSD ++ * Copyright (c) 2010, Texas Instruments Incorporated ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Texas Instruments Incorporated nor the names of ++ * its contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ++ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * --/COPYRIGHT-- ++ */ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include <sys/types.h> ++#include <sys/stat.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <sys/ioctl.h> ++ ++#include <string.h> ++ ++#include <gst/gst.h> ++#include <gst/gst-i18n-plugin.h> ++#include "v4l2_dm365_ipipe.h" ++ ++#ifdef USE_DM365_IPIPE ++ ++#if defined(MVL_LSP) ++#include <asm/arch/imp_resizer.h> ++#include <asm/arch/imp_previewer.h> ++#include <asm/arch/dm365_ipipe.h> ++#else ++#include <media/davinci/imp_previewer.h> ++#include <media/davinci/imp_resizer.h> ++#include <media/davinci/dm365_ipipe.h> ++#endif ++ ++/* Constants */ ++static const char * davinci_resizer_dev = "/dev/davinci_resizer"; ++static const char * davinci_previewer_dev = "/dev/davinci_previewer"; ++ ++/* Static Functions */ ++static gboolean ++gst_v4l2_dm365_resizer_open(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dm365_resizer_init(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dm365_resizer_close(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dm365_previewer_open(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dm365_previewer_init(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dm365_previewer_close(GstV4l2Object * v4l2object); ++ ++static gboolean ++gst_v4l2_dev_char_open(GstV4l2Object * v4l2object, const char *filename, ++ int *fd); ++ ++static gboolean ++gst_v4l2_dev_char_close(GstV4l2Object * v4l2object, const char *filename, ++ int *fd); ++ ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_ipipe_open(): ++ * Open the IPIPE devices ++ * return value: TRUE on success, FALSE on error ++ *****************************************************************************/ ++gboolean ++gst_v4l2_dm365_ipipe_open (GstV4l2Object * v4l2object) ++{ ++ if (!gst_v4l2_dm365_resizer_open(v4l2object)) ++ return FALSE; ++ if (!gst_v4l2_dm365_previewer_open(v4l2object)) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_ipipe_init(): ++ * Initialize the IPIPE devices ++ * return value: TRUE on success, FALSE on error ++ *****************************************************************************/ ++gboolean ++gst_v4l2_dm365_ipipe_init (GstV4l2Object * v4l2object) ++{ ++ if (!gst_v4l2_dm365_resizer_init(v4l2object)) ++ return FALSE; ++ if (!gst_v4l2_dm365_previewer_init(v4l2object)) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_ipipe_close(): ++ * Close the IPIPE devices ++ * return value: TRUE on success, FALSE on error ++ *****************************************************************************/ ++gboolean ++gst_v4l2_dm365_ipipe_close (GstV4l2Object * v4l2object) ++{ ++ if (!gst_v4l2_dm365_resizer_close(v4l2object)) ++ return FALSE; ++ if (!gst_v4l2_dm365_previewer_close(v4l2object)) ++ return FALSE; ++ ++ return TRUE; ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_resizer_open(): ++ * Open the resizer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_resizer_open (GstV4l2Object * v4l2object) ++{ ++ /* make sure we have a device to open */ ++ if (!v4l2object->davinci_resizer_dev) ++ v4l2object->davinci_resizer_dev = g_strdup (davinci_resizer_dev); ++ ++ return gst_v4l2_dev_char_open(v4l2object, v4l2object->davinci_resizer_dev, ++ &v4l2object->davinci_resizer_fd); ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_resizer_init(): ++ * Initialize the resizer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_resizer_init (GstV4l2Object * v4l2object) ++{ ++ gint *rsz_fd = &v4l2object->davinci_resizer_fd; ++ unsigned int user_mode = IMP_MODE_CONTINUOUS; ++ unsigned int oper_mode; ++ ++ struct rsz_channel_config rsz_chan_config; ++ struct rsz_continuous_config rsz_cont_config; ++ ++ /* make sure the resizer has been opened */ ++ if (!GST_V4L2_RESIZER_IS_OPEN(v4l2object)) ++ goto not_open; ++ ++ /* set the operation mode to confinuous */ ++ if (ioctl(*rsz_fd, RSZ_S_OPER_MODE, &user_mode) < 0) ++ goto cant_set_oper_mode; ++ if (ioctl(*rsz_fd, RSZ_G_OPER_MODE, &oper_mode) < 0) ++ goto cant_get_oper_mode; ++ if (oper_mode != user_mode) ++ goto set_mode_failed; ++ ++ /* initialize resizer driver with default configuration */ ++ memset(&rsz_chan_config, 0, sizeof(rsz_chan_config)); ++ rsz_chan_config.oper_mode = oper_mode; ++ rsz_chan_config.chain = 1; ++ rsz_chan_config.len = 0; ++ rsz_chan_config.config = NULL; ++ ++ if (ioctl(*rsz_fd, RSZ_S_CONFIG, &rsz_chan_config) < 0) ++ goto init_resizer_failed; ++ ++ /* retrieve all of the default configuration settings from the driver */ ++ memset(&rsz_cont_config, 0, sizeof(rsz_cont_config)); ++ rsz_chan_config.oper_mode = oper_mode; ++ rsz_chan_config.chain = 1; ++ rsz_chan_config.len = sizeof(rsz_cont_config); ++ rsz_chan_config.config = &rsz_cont_config; ++ ++ if (ioctl(*rsz_fd, RSZ_G_CONFIG, &rsz_chan_config) < 0) ++ goto get_config_failed; ++ ++ /* modify the default settings for chaining and send the updated ++ * configuration back to the driver. ++ */ ++ rsz_cont_config.output1.enable = 1; ++ rsz_cont_config.output2.enable = 0; ++ rsz_chan_config.len = sizeof(rsz_cont_config); ++ rsz_chan_config.config = &rsz_cont_config; ++ if (ioctl(*rsz_fd, RSZ_S_CONFIG, &rsz_chan_config) < 0) ++ goto set_config_failed; ++ ++ return TRUE; ++ ++ /* Errors */ ++not_open: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Device '%s' is not open."), v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++cant_set_oper_mode: ++ { ++ /* Don't error out on this one -- this is just an indication that the ++ * hardware configuration cannot handle continuous mode. The kernel ++ * command line option d365_imp.oper_mode needs to be set to 0. ++ */ ++ GST_ELEMENT_INFO (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Cannot set operation mode on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ NULL); ++ goto error; ++ } ++cant_get_oper_mode: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Cannot get operation mode on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++set_mode_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to set continuous mode on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++init_resizer_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to set default configuration on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++get_config_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to get configuration settings on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++set_config_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to set configuration on '%s'."), ++ v4l2object->davinci_resizer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++error: ++ { ++ close (*rsz_fd); ++ *rsz_fd = -1; ++ return FALSE; ++ } ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_resizer_close(): ++ * Close the resizer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_resizer_close (GstV4l2Object * v4l2object) ++{ ++ return gst_v4l2_dev_char_close(v4l2object, v4l2object->davinci_resizer_dev, ++ &v4l2object->davinci_resizer_fd); ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_previewer_open(): ++ * Open the previewer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_previewer_open (GstV4l2Object * v4l2object) ++{ ++ /* make sure we have a device to open */ ++ if (!v4l2object->davinci_previewer_dev) ++ v4l2object->davinci_previewer_dev = g_strdup (davinci_previewer_dev); ++ ++ return gst_v4l2_dev_char_open(v4l2object, v4l2object->davinci_previewer_dev, ++ &v4l2object->davinci_previewer_fd); ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_previewer_init(): ++ * Initialize the previewer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_previewer_init (GstV4l2Object * v4l2object) ++{ ++ gint *preview_fd = &v4l2object->davinci_previewer_fd; ++ unsigned int user_mode = IMP_MODE_CONTINUOUS; ++ unsigned int oper_mode; ++ ++ struct prev_channel_config prev_chan_config; ++ ++ /* make sure the previewer has been opened */ ++ if (!GST_V4L2_PREVIEWER_IS_OPEN(v4l2object)) ++ goto not_open; ++ ++ /* set the operation mode to confinuous */ ++ if (ioctl(*preview_fd, PREV_S_OPER_MODE, &user_mode) < 0) ++ goto cant_set_oper_mode; ++ if (ioctl(*preview_fd, PREV_G_OPER_MODE, &oper_mode) < 0) ++ goto cant_get_oper_mode; ++ if (oper_mode != user_mode) ++ goto set_mode_failed; ++ ++ /* initialize previewer driver with default configuration */ ++ memset(&prev_chan_config, 0, sizeof(prev_chan_config)); ++ prev_chan_config.oper_mode = oper_mode; ++ prev_chan_config.len = 0; ++ prev_chan_config.config = NULL; ++ ++ if (ioctl(*preview_fd, PREV_S_CONFIG, &prev_chan_config) < 0) ++ goto init_previewer_failed; ++ ++ /* default driver settings are adequate for the previewer -- no further ++ * modifications are needed. ++ */ ++ return TRUE; ++ ++ /* Errors */ ++not_open: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Device '%s' is not open."), v4l2object->davinci_previewer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++cant_set_oper_mode: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Cannot set operation mode on '%s'."), ++ v4l2object->davinci_previewer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++cant_get_oper_mode: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Cannot get operation mode on '%s'."), ++ v4l2object->davinci_previewer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++set_mode_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to set continuous mode on '%s'."), ++ v4l2object->davinci_previewer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++init_previewer_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, ++ (_("Failed to set default configuration on '%s'."), ++ v4l2object->davinci_previewer_dev), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++error: ++ { ++ close (*preview_fd); ++ *preview_fd = -1; ++ return FALSE; ++ } ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dm365_previewer_close(): ++ * Close the previewer device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dm365_previewer_close (GstV4l2Object * v4l2object) ++{ ++ return gst_v4l2_dev_char_close(v4l2object, v4l2object->davinci_previewer_dev, ++ &v4l2object->davinci_previewer_fd); ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dev_char_open(): ++ * Open a character device for reading and writing ++ * return value: ++ * TRUE on success, FALSE on error ++ * Device file descriptor is returned in "fd" ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dev_char_open (GstV4l2Object * v4l2object, const char *filename, ++ int *fd) ++{ ++ struct stat st; ++ ++ /* make sure we have a device to open */ ++ if (!filename) ++ goto no_file; ++ ++ /* make sure it is a device file */ ++ if (stat (filename, &st) == -1) ++ goto stat_failed; ++ ++ if (!S_ISCHR (st.st_mode)) ++ goto no_device; ++ ++ /* open the device */ ++ GST_DEBUG_OBJECT (v4l2object->element, "Trying to open device %s", ++ filename); ++ ++ *fd = open(filename, O_RDWR); ++ ++ if (*fd <= 0) ++ goto not_open; ++ ++ GST_INFO_OBJECT (v4l2object->element, "Opened device '%s' successfully", ++ filename); ++ ++ return TRUE; ++ ++ /* Errors */ ++no_file: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND, ++ (_("Device file not specified.")), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++stat_failed: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, READ, ++ (_("Cannot identify device '%s'."), filename), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++no_device: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, FAILED, ++ (_("This isn't a device '%s'."), filename), ++ GST_ERROR_SYSTEM); ++ goto error; ++ } ++not_open: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, OPEN_READ_WRITE, ++ (_("Could not open device '%s' for reading and writing."), ++ filename), GST_ERROR_SYSTEM); ++ goto error; ++ } ++error: ++ { ++ /* close the device if it was opened successfully */ ++ if (*fd > 0) { ++ close (*fd); ++ *fd = -1; ++ } ++ return FALSE; ++ } ++} ++ ++/***************************************************************************** ++ * gst_v4l2_dev_char_close(): ++ * Close a character device ++ * return value: ++ * TRUE on success, FALSE on error ++ *****************************************************************************/ ++static gboolean ++gst_v4l2_dev_char_close (GstV4l2Object * v4l2object, const char *filename, ++ int *fd) ++{ ++ GST_DEBUG_OBJECT (v4l2object->element, "Trying to close %s", ++ filename); ++ ++ if (*fd > 0) { ++ if (close (*fd) < 0) ++ goto fail_close; ++ *fd = -1; ++ } ++ ++ GST_INFO_OBJECT (v4l2object->element, "Closed device '%s' successfully", ++ filename); ++ ++ return TRUE; ++ ++ /* Errors */ ++fail_close: ++ { ++ GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, CLOSE, ++ (_("Failed to close device '%s'."), ++ filename), GST_ERROR_SYSTEM); ++ goto error; ++ } ++error: ++ { ++ return FALSE; ++ } ++} ++ ++#endif /* USE_DM365_IPIPE */ +diff --git a/sys/v4l2/v4l2_dm365_ipipe.h b/sys/v4l2/v4l2_dm365_ipipe.h +new file mode 100644 +index 0000000..78878a0 +--- /dev/null ++++ b/sys/v4l2/v4l2_dm365_ipipe.h +@@ -0,0 +1,63 @@ ++/* ++ * v4l2_dm365_ipipe.h ++ * ++ * This file defines functions needed to configure the DM365 IPIPE in ++ * on-the-fly mode with the capture driver. The capture driver by itself ++ * only supports UYVY, but using the IPIPE we can convert to NV12 on the ++ * fly during capture, which is the color format expected by some codecs. ++ * ++ * DMAI's capture code was heavily referenced for this implementation, and in ++ * some places copied verbatim. DMAI uses the following license: ++ * ++ * --COPYRIGHT--,BSD ++ * Copyright (c) 2010, Texas Instruments Incorporated ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Texas Instruments Incorporated nor the names of ++ * its contributors may be used to endorse or promote products derived ++ * from this software without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ++ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ * --/COPYRIGHT-- ++ */ ++#ifndef __V4L2_DM365_IPIPE_H__ ++#define __V4L2_DM365_IPIPE_H__ ++ ++#include <glib/gtypes.h> ++#include "gstv4l2object.h" ++ ++/* simple check whether the resizer is open */ ++#define GST_V4L2_RESIZER_IS_OPEN(v4l2object) \ ++ (v4l2object->davinci_resizer_fd > 0) ++ ++/* simple check whether the previewer is open */ ++#define GST_V4L2_PREVIEWER_IS_OPEN(v4l2object) \ ++ (v4l2object->davinci_previewer_fd > 0) ++ ++gboolean gst_v4l2_dm365_ipipe_open (GstV4l2Object * v4l2object); ++gboolean gst_v4l2_dm365_ipipe_init (GstV4l2Object * v4l2object); ++gboolean gst_v4l2_dm365_ipipe_close (GstV4l2Object * v4l2object); ++ ++#endif /* __V4L2_DM365_IPIPE_H__ */ ++ +diff --git a/sys/v4l2/v4l2src_mvl_lsp.h b/sys/v4l2/v4l2src_mvl_lsp.h +index 5f1ae7c..98c3281 100644 +--- a/sys/v4l2/v4l2src_mvl_lsp.h ++++ b/sys/v4l2/v4l2src_mvl_lsp.h +@@ -38,8 +38,8 @@ + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * --/COPYRIGHT--*/ + +-#ifndef __GST_DM365_RESIZER_H__ +-#define __GST_DM365_RESIZER_H__ ++#ifndef __V4L2SRC_MVL_LSP_H__ ++#define __V4L2SRC_MVL_LSP_H__ + + #include <gstv4l2object.h> + #include "v4l2src_calls.h" +@@ -48,5 +48,5 @@ void gst_v4l2src_get_resolution (GstV4l2Object *v4l2object, gint *width, + gint *height, gint *fps_num, gint *fps_denom); + gboolean gst_v4l2_force_720p_30 (GstV4l2Src * v4l2src); + +-#endif /* __GST_DM365_RESIZER_H__ */ ++#endif /* __V4L2SRC_MVL_LSP_H__ */ + +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0007-v4l2src-accept-EPERM-as-a-non-fatal-error-for-VIDIOC.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0007-v4l2src-accept-EPERM-as-a-non-fatal-error-for-VIDIOC.patch new file mode 100644 index 0000000..433a759 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0007-v4l2src-accept-EPERM-as-a-non-fatal-error-for-VIDIOC.patch @@ -0,0 +1,51 @@ +From bad1123a941b5859d11fea374b1fae4a2dbd5623 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:38:02 -0500 +Subject: [PATCH 07/17] v4l2src: accept EPERM as a non-fatal error for VIDIOC_TRY + +When setting the capture mode, the v4l2src will try interlaced mode first, and +if the driver returns EINVAL it will try progressive mode. Any other errno +value will result in failure. + +On TI device drivers, the driver may also return EPERM when trying to set +interlaced mode on a capture input that doesn't support it. This change +now treats EPERM the same was as EINVAL, and tries again with progressive +mode instead of failing. +--- + sys/v4l2/gstv4l2object.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 4b50009..4321a9e 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1868,7 +1868,7 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; + + r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt); +- if (r < 0 && errno == EINVAL) { ++ if (r < 0 && (errno == EINVAL || errno == EPERM)) { + /* try again with progressive video */ + fmt.fmt.pix.width = *width; + fmt.fmt.pix.height = *height; +@@ -1895,7 +1895,7 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + fmt.fmt.pix.height = *height; + + r = v4l2_ioctl (fd, VIDIOC_S_FMT, &fmt); +- if (r < 0 && errno == EINVAL) { ++ if (r < 0 && (errno == EINVAL || errno == EPERM)) { + /* try again with progressive video */ + fmt.fmt.pix.width = *width; + fmt.fmt.pix.height = *height; +@@ -1972,7 +1972,7 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, + + if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) { + /* we might also get EBUSY here */ +- if (errno != EINVAL) ++ if (errno != EINVAL && errno != EPERM) + goto set_fmt_failed; + + GST_DEBUG_OBJECT (v4l2object->element, "trying again..."); +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0008-v4l2src-try-progressive-mode-first-for-component-inp.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0008-v4l2src-try-progressive-mode-first-for-component-inp.patch new file mode 100644 index 0000000..2d95ea8 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0008-v4l2src-try-progressive-mode-first-for-component-inp.patch @@ -0,0 +1,82 @@ +From b89cf90ff8ddd7ee2659fc584a088e7443720475 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Fri, 30 Apr 2010 12:56:58 -0500 +Subject: [PATCH 08/17] v4l2src: try progressive mode first for component input on some platforms + +Normally, v4l2src tries INTERLACED mode first on a capture input, and if that +fails, it tries progressive. However, on DM6467 the component capture driver +will accept INTERLACED, but subsequent calls to dqbuf will fail. On DM6467 +component input, we must try NONE (Progressive) on the first try. +--- + sys/v4l2/gstv4l2object.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 48 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 4321a9e..e8879a6 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1867,6 +1867,30 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + fmt.fmt.pix.pixelformat = pixelformat; + fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; + ++ /* Normally, v4l2src tries INTERLACED mode first on a capture input, and if ++ * that fails, it tries progressive. However, on DM6467 the component ++ * capture driver will accept INTERLACED, but subsequent calls to dqbuf will ++ * fail. On DM6467 component input, we must try NONE (Progressive) on the ++ * first try. ++ */ ++ { ++ int component_input_id; ++ int current_input_id; ++ ++ #if defined(Platform_dm6467) || defined(Platform_dm6467t) ++ component_input_id = 1; ++ #else ++ component_input_id = -1; ++ #endif ++ ++ if (component_input_id > 0) { ++ gst_v4l2_get_input(v4l2object, ¤t_input_id); ++ if (current_input_id == component_input_id) { ++ fmt.fmt.pix.field = V4L2_FIELD_NONE; ++ } ++ } ++ } ++ + r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt); + if (r < 0 && (errno == EINVAL || errno == EPERM)) { + /* try again with progressive video */ +@@ -1966,6 +1990,30 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, + * combined, there are other modes for requesting fields individually) */ + format.fmt.pix.field = V4L2_FIELD_INTERLACED; + ++ /* Normally, v4l2src tries INTERLACED mode first on a capture input, and if ++ * that fails, it tries progressive. However, on DM6467 the component ++ * capture driver will accept INTERLACED, but subsequent calls to dqbuf will ++ * fail. On DM6467 component input, we must try NONE (Progressive) on the ++ * first try. ++ */ ++ { ++ int component_input_id; ++ int current_input_id; ++ ++ #if defined(Platform_dm6467) || defined(Platform_dm6467t) ++ component_input_id = 1; ++ #else ++ component_input_id = -1; ++ #endif ++ ++ if (component_input_id > 0) { ++ gst_v4l2_get_input(v4l2object, ¤t_input_id); ++ if (current_input_id == component_input_id) { ++ format.fmt.pix.field = V4L2_FIELD_NONE; ++ } ++ } ++ } ++ + #if defined(MVL_LSP) + v4l2object->bytesused = format.fmt.pix.sizeimage; + #endif +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0009-v4l2src-add-support-for-NV16-colorspace.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0009-v4l2src-add-support-for-NV16-colorspace.patch new file mode 100644 index 0000000..e74cc46 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0009-v4l2src-add-support-for-NV16-colorspace.patch @@ -0,0 +1,48 @@ +From 207faaba152cfbdfa74cf45202037eadd1828625 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:44:40 -0500 +Subject: [PATCH 09/17] v4l2src: add support for NV16 colorspace + +--- + sys/v4l2/gstv4l2object.c | 11 +++++++++++ + 1 files changed, 11 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index e8879a6..b03c86e 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -706,6 +706,9 @@ static const GstV4L2FormatDesc gst_v4l2_formats[] = { + #ifdef V4L2_PIX_FMT_YVYU + {V4L2_PIX_FMT_YVYU, TRUE}, + #endif ++#ifdef V4L2_PIX_FMT_NV16 ++ {V4L2_PIX_FMT_NV16, TRUE}, ++#endif + #ifdef V4L2_PIX_FMT_YUV422UVP + {V4L2_PIX_FMT_YUV422UVP, TRUE}, + #endif +@@ -1096,6 +1099,9 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + #ifdef V4L2_PIX_FMT_YVYU + case V4L2_PIX_FMT_YVYU: + #endif ++#ifdef V4L2_PIX_FMT_NV16 ++ case V4L2_PIX_FMT_NV16: ++#endif + #ifdef V4L2_PIX_FMT_YUV422UVP + case V4L2_PIX_FMT_YUV422UVP: + #endif +@@ -1141,6 +1147,11 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + fcc = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'); + break; + #endif ++#ifdef V4L2_PIX_FMT_NV16 ++ case V4L2_PIX_FMT_NV16: ++ fcc = GST_MAKE_FOURCC ('N', 'V', '1', '6'); ++ break; ++#endif + #ifdef V4L2_PIX_FMT_YUV422UVP + case V4L2_PIX_FMT_YUV422UVP: + fcc = GST_MAKE_FOURCC ('Y', '8', 'C', '8'); +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0010-v4l2src-set-bytesperline-and-sizeimage-before-callin.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0010-v4l2src-set-bytesperline-and-sizeimage-before-callin.patch new file mode 100644 index 0000000..df51e7d --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0010-v4l2src-set-bytesperline-and-sizeimage-before-callin.patch @@ -0,0 +1,62 @@ +From 2e483da277c5d1f595a966a43b06d94c2054dee0 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 15:45:55 -0500 +Subject: [PATCH 10/17] v4l2src: set bytesperline and sizeimage before calling the VIDIOC_S_FMT ioctl + +The V4L2 capture driver expects the application to set these fields prior +to calling VIDIOC_TRY_FMT or VIDIOC_S_FMT: + +fmt.fmt.pix.bytesperline +fmt.fmt.pix.sizeimage + +An inquiry has been sent to explain why this is needed, as other V4L2 catpure +drivers tend to provide this information, rather than expecting applications +to provide it. +--- + sys/v4l2/gstv4l2object.c | 23 +++++++++++++++++++++++ + 1 files changed, 23 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index b03c86e..2d79b0b 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1902,6 +1902,17 @@ gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, + } + } + ++#if defined(V4L2_PIX_FMT_NV16) ++ /* Set the bytesperline and sizeimage fields when using the NV16 colorspace. ++ * Some drivers, such as the DM6467T component capture driver expects these ++ * fields to be set. ++ */ ++ if (pixelformat == V4L2_PIX_FMT_NV16) { ++ fmt.fmt.pix.bytesperline = (*width); ++ fmt.fmt.pix.sizeimage = (fmt.fmt.pix.bytesperline * (*height)) << 1; ++ } ++#endif ++ + r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt); + if (r < 0 && (errno == EINVAL || errno == EPERM)) { + /* try again with progressive video */ +@@ -2029,6 +2040,18 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, + v4l2object->bytesused = format.fmt.pix.sizeimage; + #endif + ++ /* Set the bytesperline and sizeimage fields when using the NV16 colorspace. ++ * Some drivers, such as the DM6467T component capture driver expects these ++ * fields to be set. ++ */ ++ #if defined(V4L2_PIX_FMT_NV16) ++ if (pixelformat == V4L2_PIX_FMT_NV16) { ++ format.fmt.pix.bytesperline = width; ++ format.fmt.pix.sizeimage = ++ (format.fmt.pix.bytesperline * height) << 1; ++ } ++ #endif ++ + if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) { + /* we might also get EBUSY here */ + if (errno != EINVAL && errno != EPERM) +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0011-v4l2src-update-gst_v4l2_get_norm-to-handle-DM6467T-a.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0011-v4l2src-update-gst_v4l2_get_norm-to-handle-DM6467T-a.patch new file mode 100644 index 0000000..b5ff29c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0011-v4l2src-update-gst_v4l2_get_norm-to-handle-DM6467T-a.patch @@ -0,0 +1,62 @@ +From c85de9dcbd3ae84239b1407275a16e7b2af5ee10 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Tue, 16 Mar 2010 15:16:00 -0500 +Subject: [PATCH 11/17] v4l2src: update gst_v4l2_get_norm to handle DM6467T and DM365 properly + +DM6467T and DM365 use the QUERYSTD ioctl to detect the standard in use by the +connected component. +--- + sys/v4l2/v4l2_calls.c | 35 +++++++++++++++++++++++++++++++++++ + 1 files changed, 35 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index 30ebf9e..e38754b 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -625,8 +625,43 @@ gst_v4l2_get_norm (GstV4l2Object * v4l2object, v4l2_std_id * norm) + if (!GST_V4L2_IS_OPEN (v4l2object)) + return FALSE; + ++ #if defined(Platform_dm6467t) || defined(Platform_dm365) ++ /* It might take a few tries to detect the signal -- try up to 300 times */ ++ { ++ int retries = 300; ++ ++ while (retries-- > 0) { ++ ++ /* Break-out of the retry loop on success, and abort if errno is not ++ * EAGAIN. ++ */ ++ if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYSTD, norm) >= 0) { ++ break; ++ } ++ else if (errno != EAGAIN) { ++ goto std_failed; ++ } ++ ++ /* Sleep for a microsecond before retrying */ ++ usleep(1); ++ } ++ ++ /* Abort if all 300 retry attempts failed */ ++ if (retries == 0) { ++ goto std_failed; ++ } ++ ++ /* On DM6467T, the convention is the set the norm after querying it, ++ * otherwise the driver won't initialize properly. ++ */ ++ if (!gst_v4l2_set_norm(v4l2object, *norm)) { ++ goto std_failed; ++ } ++ } ++ #else + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_STD, norm) < 0) + goto std_failed; ++ #endif + + return TRUE; + +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0012-v4l2src-add-V4L2-ioctl-calls-to-initialize-capture-d.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0012-v4l2src-add-V4L2-ioctl-calls-to-initialize-capture-d.patch new file mode 100644 index 0000000..feb4dbf --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0012-v4l2src-add-V4L2-ioctl-calls-to-initialize-capture-d.patch @@ -0,0 +1,47 @@ +From 7da74aa487fac1c60c4c271f9f9360dcf523fb4a Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Tue, 16 Mar 2010 16:31:51 -0500 +Subject: [PATCH 12/17] v4l2src: add V4L2 ioctl calls to initialize capture drivers properly + +After calling the ENUMINPUT on an input, call S_INPUT and G_INPUT on that +input. Otherwise, the video standards (norms) may not be detected properly, +and selecting a specific video input may not work. +--- + sys/v4l2/v4l2_calls.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index e38754b..b337d71 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -174,6 +174,27 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + continue; + } + ++ /* Try setting the input and see if we can retrieve it as a valid setting. ++ * This is also needed to ensure the driver gets initialized properly. ++ */ ++ if (gst_v4l2_set_input(v4l2object, input.index)) { ++ gint g_index; ++ ++ if (!gst_v4l2_get_input(v4l2object, &g_index)) { ++ return FALSE; ++ } ++ ++ if (input.index != g_index) { ++ GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS, ++ (_("Attempted to set video input to %d in device '%s', " ++ "but it still has an input setting of %d. Please make sure the " ++ "video input is connected properly."), ++ input.index, v4l2object->videodev, g_index), ++ NULL); ++ return FALSE; ++ } ++ } ++ + GST_LOG_OBJECT (e, " index: %d", input.index); + GST_LOG_OBJECT (e, " name: '%s'", input.name); + GST_LOG_OBJECT (e, " type: %08x", input.type); +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0013-v4l2src-disable-video-device-polling-by-default-on-D.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0013-v4l2src-disable-video-device-polling-by-default-on-D.patch new file mode 100644 index 0000000..87072c0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0013-v4l2src-disable-video-device-polling-by-default-on-D.patch @@ -0,0 +1,28 @@ +From 1dc5151796345bde8a5c29490e74c8f83ee003f3 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Wed, 24 Mar 2010 11:15:29 -0500 +Subject: [PATCH 13/17] v4l2src: disable video device polling by default on DM6467T + +It blocks forever if used. +--- + sys/v4l2/v4l2_calls.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index b337d71..1bf1e4e 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -520,6 +520,10 @@ gst_v4l2_open (GstV4l2Object * v4l2object) + + v4l2object->can_poll_device = TRUE; + ++ #if defined(Platform_dm6467t) ++ v4l2object->can_poll_device = FALSE; ++ #endif ++ + /* get capabilities, error will be posted */ + if (!gst_v4l2_get_capabilities (v4l2object)) + goto error; +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0014-v4l2src-Skip-detection-of-private-controls.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0014-v4l2src-Skip-detection-of-private-controls.patch new file mode 100644 index 0000000..97a333b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0014-v4l2src-Skip-detection-of-private-controls.patch @@ -0,0 +1,44 @@ +From f5e09e5a5d70442ac2c792f71e10387241ddc68d Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Wed, 13 Oct 2010 14:16:09 -0500 +Subject: [PATCH 14/17] v4l2src: Skip detection of private controls. + +Control information reported by the capture driver on DM365 (and possibly +others) reports a large number of controls outside the recognized ranges, +causing a very long delay while this code fails to detect any of them. At this +point, we haven't determined if the driver isn't V4L2 compliant here, reporting +garbage values, or if there is some other issue. + +Previous versions of gst-plugins-good didn't support handling private controls, +and for now we're re-instating that behavior until the issue can be +root-caused. +--- + sys/v4l2/v4l2_calls.c | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c +index 1bf1e4e..af64efe 100644 +--- a/sys/v4l2/v4l2_calls.c ++++ b/sys/v4l2/v4l2_calls.c +@@ -296,6 +296,18 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) + if (n == V4L2_CID_LASTP1) { + GST_DEBUG_OBJECT (e, "checking private CIDs"); + n = V4L2_CID_PRIVATE_BASE; ++ /* Skip detection of private controls. Control information reported by ++ * the capture driver on DM365 (and possibly others) reports a large ++ * number of controls outside the recognized ranges, causing a very long ++ * delay while this code fails to detect any of them. At this point, we ++ * haven't determined if the driver isn't V4L2 compliant here, reporting ++ * garbage values, or if there is some other issue. ++ * ++ * Previous versions of gst-plugins-good didn't support handling private ++ * controls, and for now we're re-instating that behavior here until the ++ * issue can be root-caused. ++ */ ++ break; + } + GST_DEBUG_OBJECT (e, "checking control %08x", n); + +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0015-v4l2src-Remove-short-circuit-of-VIDIOC_S_FMT-call.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0015-v4l2src-Remove-short-circuit-of-VIDIOC_S_FMT-call.patch new file mode 100644 index 0000000..b3f3048 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0015-v4l2src-Remove-short-circuit-of-VIDIOC_S_FMT-call.patch @@ -0,0 +1,44 @@ +From 0cdc91b6893834e24755554734d48512e27820cc Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Wed, 13 Oct 2010 18:20:08 -0500 +Subject: [PATCH 15/17] v4l2src: Remove short-circuit of VIDIOC_S_FMT call + +If VIDIOC_G_FMT returns the format we need, v4l2src will skip the call to +VIDIOC_S_FMT because it is not needed. However, on DM365 a call to +VIDIOC_G_FMT will return that it is set to 1280x720 UYVY when it really isn't +causing UYVY capture to behave incorrectly. This change removes that +optimization and always calls VIDIOC_S_FMT. +--- + sys/v4l2/gstv4l2object.c | 16 ---------------- + 1 files changed, 0 insertions(+), 16 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 2d79b0b..e63a762 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1987,22 +1987,6 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, guint32 pixelformat, + if (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) < 0) + goto get_fmt_failed; + +- if (format.type == v4l2object->type && +- format.fmt.pix.width == width && +- format.fmt.pix.height == height && +- format.fmt.pix.pixelformat == pixelformat) { +- /* Nothing to do. We want to succeed immediately +- * here because setting the same format back +- * can still fail due to EBUSY. By short-circuiting +- * here, we allow pausing and re-playing pipelines +- * with changed caps, as long as the changed caps +- * do not change the webcam's format. Otherwise, +- * any caps change would require us to go to NULL +- * state to close the device and set format. +- */ +- return TRUE; +- } +- + format.type = v4l2object->type; + format.fmt.pix.width = width; + format.fmt.pix.height = height; +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0016-v4l2src-add-feature-to-artifically-lower-framerate-b.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0016-v4l2src-add-feature-to-artifically-lower-framerate-b.patch new file mode 100644 index 0000000..767d8a7 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0016-v4l2src-add-feature-to-artifically-lower-framerate-b.patch @@ -0,0 +1,189 @@ +From fd3e16faa494e47b00cf1374bb4ac1f463b0fc48 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Thu, 14 Oct 2010 11:19:04 -0500 +Subject: [PATCH 16/17] v4l2src: add feature to artifically lower framerate by dropping frames. + +Some capture devices do not let you set the framerate. In these cases, even +if you specify a frame rate of 30/1, you may still get 60/1. With this change, +if you specify 30/1 and the framerate is really 60/1, every other capture +frame will be dropped and only half of them will be pushed downstream to +simulate 30fps. + +The implementation is generic enough to handle any framerate. It automatically +calculates how many and how often frames need to be dropped. + +Unfortuately, there is no way to query the "default" fps that will be used +on platforms that do not support setting the frame rate, and target-specific +code must be introduced to make this work. Initially, this feature will only +kick-in for DM6467 and DM6467T. +--- + sys/v4l2/gstv4l2object.c | 4 +++ + sys/v4l2/gstv4l2object.h | 5 +++ + sys/v4l2/gstv4l2src.c | 15 ++++++++++ + sys/v4l2/v4l2src_calls.c | 66 +++++++++++++++++++++++++++++++++++++++++++++- + 4 files changed, 89 insertions(+), 1 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index e63a762..fdcd0d1 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -377,6 +377,10 @@ gst_v4l2_object_new (GstElement * element, + v4l2object->davinci_previewer_fd = -1; + #endif + ++ v4l2object->pushed_frame_count_1000x = 0UL; ++ v4l2object->push_rate_1000x = 0UL; ++ v4l2object->next_pushed_frame_1000x = 0UL; ++ + return v4l2object; + } + +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index 640f948..d4eb8a8 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -98,6 +98,11 @@ struct _GstV4l2Object { + gint davinci_previewer_fd; + #endif + ++ /* how many capture frames to drop for each frame pushed */ ++ guint32 pushed_frame_count_1000x; ++ guint32 push_rate_1000x; ++ guint32 next_pushed_frame_1000x; ++ + /* the video buffer (mmap()'ed) */ + guint8 **buffer; + +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index 9c4c5c3..dd6c65c 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -919,6 +919,21 @@ again: + if (G_UNLIKELY (ret != GST_FLOW_OK)) + goto done; + ++ /* Skip frames if needed to artificially lower the frame rate */ ++ if (v4l2src->v4l2object->push_rate_1000x > 0) { ++ if (v4l2src->v4l2object->pushed_frame_count_1000x < ++ v4l2src->v4l2object->next_pushed_frame_1000x) { ++ gst_buffer_unref (temp); ++ goto again; ++ } else { ++ v4l2src->v4l2object->next_pushed_frame_1000x = ++ v4l2src->v4l2object->next_pushed_frame_1000x - ++ v4l2src->v4l2object->pushed_frame_count_1000x + ++ v4l2src->v4l2object->push_rate_1000x; ++ v4l2src->v4l2object->pushed_frame_count_1000x = 0; ++ } ++ } ++ + if (v4l2src->frame_byte_size > 0) { + size = GST_BUFFER_SIZE (temp); + +diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c +index b069920..a9853fd 100644 +--- a/sys/v4l2/v4l2src_calls.c ++++ b/sys/v4l2/v4l2src_calls.c +@@ -90,6 +90,25 @@ queue_failed: + } + } + ++/* Greatest common divisor */ ++static guint32 ++gst_v4l2src_gcd(guint32 a, guint32 b) ++{ ++ guint32 r; ++ ++ if (a < b) { ++ guint32 t = a; ++ a = b; ++ b = t; ++ } ++ while ((r = a % b) != 0) { ++ a = b; ++ b = r; ++ } ++ return b; ++} ++ ++ + /****************************************************** + * gst_v4l2src_grab_frame (): + * grab a frame for capturing +@@ -135,8 +154,10 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src, GstBuffer ** buf) + } + + pool_buffer = GST_BUFFER (gst_v4l2_buffer_pool_dqbuf (pool)); +- if (pool_buffer) ++ if (pool_buffer) { ++ v4l2src->v4l2object->pushed_frame_count_1000x += 1000; + break; ++ } + + GST_WARNING_OBJECT (pool->v4l2elem, "trials=%d", trials); + +@@ -248,6 +269,8 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, + goto done; + } + ++ /* We can't trust the frame rate reported by DM6467[T] driver */ ++ #if !defined(Platform_dm6467) && !defined(Platform_dm6467t) + /* Note: V4L2 provides the frame interval, we have the frame rate */ + if (fractions_are_equal (stream.parm.capture.timeperframe.numerator, + stream.parm.capture.timeperframe.denominator, fps_d, fps_n)) { +@@ -256,11 +279,52 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, + v4l2src->fps_d = fps_d; + goto done; + } ++ #endif + + /* We want to change the frame rate, so check whether we can. Some cheap USB + * cameras don't have the capability */ + if ((stream.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) == 0) { ++ guint default_n = 0; ++ guint default_d = 0; ++ + GST_DEBUG_OBJECT (v4l2src, "Not setting framerate (not supported)"); ++ ++ /* If we know the default framerate for this device, we can throw away ++ * frames to artifically lower the framerate to the one desired. */ ++ #if defined(Platform_dm6467) || defined(Platform_dm6467t) ++ { ++ const guint component_input_id = 1; ++ gint current_input_id; ++ ++ gst_v4l2_get_input(v4l2src->v4l2object, ¤t_input_id); ++ if (current_input_id == component_input_id) { ++ default_n = 60; ++ default_d = 1; ++ } ++ } ++ #endif ++ ++ if (default_n > 0) { ++ guint32 div_n = default_n * fps_d; ++ guint32 div_d = default_d * fps_n; ++ guint32 div_gcd = gst_v4l2src_gcd(div_n, div_d); ++ guint32 push_rate_1000x; ++ ++ div_n /= div_gcd; ++ div_d /= div_gcd; ++ ++ push_rate_1000x = (div_n * 1000) / div_d; ++ ++ /* For every push_rate frames captured, push 1 downstream */ ++ if (push_rate_1000x > 1000) { ++ GST_LOG_OBJECT (v4l2src, "A frame rate of %u/%u will be simulated " ++ "by only pushing 1 of every %2.4lf captured frames downstream", ++ fps_n, fps_d, push_rate_1000x / ((gdouble)1000)); ++ v4l2src->v4l2object->push_rate_1000x = push_rate_1000x; ++ v4l2src->v4l2object->next_pushed_frame_1000x = push_rate_1000x; ++ } ++ } ++ + goto done; + } + +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0017-v4l2src-always-set-the-desired-framerate-on-DM365.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0017-v4l2src-always-set-the-desired-framerate-on-DM365.patch new file mode 100644 index 0000000..1c6f9e2 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.25/0017-v4l2src-always-set-the-desired-framerate-on-DM365.patch @@ -0,0 +1,33 @@ +From 8dff438f5bc89868ae71d8adff519be9afbc114e Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Wed, 27 Oct 2010 18:51:31 -0500 +Subject: [PATCH 17/17] v4l2src: always set the desired framerate on DM365. + +By default, the frame rate is only set if the driver reports that it is +currently using a different value. The driver doesn't always report the +correct value -- it may report 30fps when it's actually running at 60fps. +This change forces the framerate to always be set, regardless of what the +driver reports. +--- + sys/v4l2/v4l2src_calls.c | 5 +++-- + 1 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c +index a9853fd..a2a8689 100644 +--- a/sys/v4l2/v4l2src_calls.c ++++ b/sys/v4l2/v4l2src_calls.c +@@ -269,8 +269,9 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, + goto done; + } + +- /* We can't trust the frame rate reported by DM6467[T] driver */ +- #if !defined(Platform_dm6467) && !defined(Platform_dm6467t) ++ /* We can't trust the frame rate reported by DM6467[T] / DM365 drivers */ ++ #if !defined(Platform_dm6467) && !defined(Platform_dm6467t) && \ ++ !defined(Platform_dm365) + /* Note: V4L2 provides the frame interval, we have the frame rate */ + if (fractions_are_equal (stream.parm.capture.timeperframe.numerator, + stream.parm.capture.timeperframe.denominator, fps_d, fps_n)) { +-- +1.7.1 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0001-v4l2-fix-handling-of-RGB32-BGR32-formats.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0001-v4l2-fix-handling-of-RGB32-BGR32-formats.patch new file mode 100644 index 0000000..623567d --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0001-v4l2-fix-handling-of-RGB32-BGR32-formats.patch @@ -0,0 +1,53 @@ +From 194aa8513c02fbfcabf04b45ff4c81bf8a94527f Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Tue, 14 Sep 2010 07:42:50 -0500 +Subject: [PATCH 01/11] v4l2: fix handling of RGB32/BGR32 formats + +bpp is 32, but depth is only 24.. +--- + sys/v4l2/gstv4l2object.c | 12 +++++++----- + 1 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 7e15489..f5672b5 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1132,14 +1132,16 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + b_mask = 0xff0000; + break; + case V4L2_PIX_FMT_RGB32: +- bpp = depth = 32; ++ depth = 24; ++ bpp = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0xff000000; + g_mask = 0x00ff0000; + b_mask = 0x0000ff00; + break; + case V4L2_PIX_FMT_BGR32: +- bpp = depth = 32; ++ depth = 24; ++ bpp = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0x000000ff; + g_mask = 0x0000ff00; +@@ -1404,13 +1406,13 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + #endif + } + } else if (!strcmp (mimetype, "video/x-raw-rgb")) { +- gint depth, endianness, r_mask; ++ gint bpp, endianness, r_mask; + +- gst_structure_get_int (structure, "depth", &depth); ++ gst_structure_get_int (structure, "bpp", &bpp); + gst_structure_get_int (structure, "endianness", &endianness); + gst_structure_get_int (structure, "red_mask", &r_mask); + +- switch (depth) { ++ switch (bpp) { + case 8: + fourcc = V4L2_PIX_FMT_RGB332; + break; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0002-v4l2sink-Add-rotation-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0002-v4l2sink-Add-rotation-support.patch new file mode 100644 index 0000000..b405ea0 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0002-v4l2sink-Add-rotation-support.patch @@ -0,0 +1,128 @@ +From d43a9444fc5f7655a8acd2978039667a04222ba0 Mon Sep 17 00:00:00 2001 +From: Kiran Nataraju <knataraju@ti.com> +Date: Fri, 27 Aug 2010 09:00:57 +0200 +Subject: [PATCH 02/11] v4l2sink: Add rotation support. + +Signed-off-by: Kiran Nataraju <knataraju@ti.com> +Signed-off-by: Daniel Diaz <ddiaz@ti.com> +--- + sys/v4l2/gstv4l2sink.c | 34 ++++++++++++++++++++++++++++++++++ + sys/v4l2/gstv4l2sink.h | 1 + + 2 files changed, 35 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index aa6785c..5abf915 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -72,6 +72,10 @@ GST_DEBUG_CATEGORY (v4l2sink_debug); + #define PROP_DEF_MIN_QUEUED_BUFS 1 + #define DEFAULT_PROP_DEVICE "/dev/video1" + ++#define MIN_ROTATION_ANGLE 0 ++#define MAX_ROTATION_ANGLE 360 ++#define DEFAULT_ROTATION_ANGLE 0 ++ + enum + { + PROP_0, +@@ -86,6 +90,7 @@ enum + PROP_CROP_LEFT, + PROP_CROP_WIDTH, + PROP_CROP_HEIGHT, ++ PROP_ROTATION, + }; + + +@@ -220,6 +225,7 @@ static GstFlowReturn gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); + static GstFlowReturn gst_v4l2sink_show_frame (GstBaseSink * bsink, + GstBuffer * buf); ++static void gst_v4l2sink_set_rotation (GstV4l2Sink * v4l2sink); + + static void + gst_v4l2sink_base_init (gpointer g_class) +@@ -306,6 +312,11 @@ gst_v4l2sink_class_init (GstV4l2SinkClass * klass) + "The height of the video crop; default is equal to negotiated image height", + 0, 0xffffffff, 0, G_PARAM_READWRITE)); + ++ g_object_class_install_property (gobject_class, PROP_ROTATION, ++ g_param_spec_int ("rotation", "Rotation angle", ++ "Rotation angle for the image", MIN_ROTATION_ANGLE, ++ MAX_ROTATION_ANGLE, DEFAULT_ROTATION_ANGLE, G_PARAM_READWRITE)); ++ + basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); + basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); + basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); +@@ -336,6 +347,7 @@ gst_v4l2sink_init (GstV4l2Sink * v4l2sink, GstV4l2SinkClass * klass) + v4l2sink->overlay_fields_set = 0; + v4l2sink->crop_fields_set = 0; + v4l2sink->state = 0; ++ v4l2sink->rotation = 0; + } + + +@@ -475,6 +487,20 @@ gst_v4l2sink_sync_crop_fields (GstV4l2Sink * v4l2sink) + } + } + ++static void ++gst_v4l2sink_set_rotation (GstV4l2Sink * v4l2sink) ++{ ++ if (GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) { ++ struct v4l2_control control; ++ gint fd = v4l2sink->v4l2object->video_fd; ++ ++ memset (&control, 0x00, sizeof (struct v4l2_control)); ++ control.id = V4L2_CID_ROTATE; ++ control.value = v4l2sink->rotation; ++ g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_CTRL, &control) >= 0); ++ } ++} ++ + + static void + gst_v4l2sink_set_property (GObject * object, +@@ -531,6 +557,10 @@ gst_v4l2sink_set_property (GObject * object, + v4l2sink->crop_fields_set |= RECT_HEIGHT_SET; + gst_v4l2sink_sync_crop_fields (v4l2sink); + break; ++ case PROP_ROTATION: ++ v4l2sink->rotation = g_value_get_int (value); ++ gst_v4l2sink_set_rotation (v4l2sink); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -578,6 +608,9 @@ gst_v4l2sink_get_property (GObject * object, + case PROP_CROP_HEIGHT: + g_value_set_uint (value, v4l2sink->crop.height); + break; ++ case PROP_ROTATION: ++ g_value_set_int (value, v4l2sink->rotation); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -600,6 +633,7 @@ gst_v4l2sink_change_state (GstElement * element, GstStateChange transition) + /* open the device */ + if (!gst_v4l2_object_start (v4l2sink->v4l2object)) + return GST_STATE_CHANGE_FAILURE; ++ gst_v4l2sink_set_rotation (v4l2sink); + break; + default: + break; +diff --git a/sys/v4l2/gstv4l2sink.h b/sys/v4l2/gstv4l2sink.h +index 8fe8222..1239621 100644 +--- a/sys/v4l2/gstv4l2sink.h ++++ b/sys/v4l2/gstv4l2sink.h +@@ -75,6 +75,7 @@ struct _GstV4l2Sink { + guint8 overlay_fields_set, crop_fields_set; + + guint8 state; ++ gint rotation; + }; + + struct _GstV4l2SinkClass { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0003-v4l2sink-Add-flip-property.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0003-v4l2sink-Add-flip-property.patch new file mode 100644 index 0000000..09839ad --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0003-v4l2sink-Add-flip-property.patch @@ -0,0 +1,187 @@ +From 1381c64fd606d8ab7169eef52386139a4848c439 Mon Sep 17 00:00:00 2001 +From: Kiran Nataraju <knataraju@ti.com> +Date: Tue, 21 Sep 2010 06:21:23 +0200 +Subject: [PATCH 03/11] v4l2sink: Add flip property. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Kiran Nataraju <knataraju@ti.com> +Signed-off-by: Daniel DÃaz <yosoy@danieldiaz.org> +--- + sys/v4l2/gstv4l2sink.c | 88 +++++++++++++++++++++++++++++++++++++++++++++-- + sys/v4l2/gstv4l2sink.h | 1 + + 2 files changed, 85 insertions(+), 4 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index 5abf915..6163747 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -91,6 +91,7 @@ enum + PROP_CROP_WIDTH, + PROP_CROP_HEIGHT, + PROP_ROTATION, ++ PROP_FLIP, + }; + + +@@ -129,6 +130,34 @@ gst_v4l2sink_iface_supported (GstImplementsInterface * iface, GType iface_type) + return TRUE; + } + ++/* ++ * Flip state ++ */ ++enum ++{ ++ FLIP_NONE = 0, ++ FLIP_HORIZONTAL = 1, ++ FLIP_VERTICAL = 2, ++}; ++ ++#define GST_TYPE_V4L2_FLIP (gst_v4l2_flip_get_type ()) ++static GType ++gst_v4l2_flip_get_type (void) ++{ ++ static GType type = 0; ++ ++ if (!type) { ++ static GEnumValue vals[] = { ++ {FLIP_NONE, "No Flip", "none"}, ++ {FLIP_HORIZONTAL, "Horizontal Flip", "horiz"}, ++ {FLIP_VERTICAL, "Vertical Flip", "vert"}, ++ {0, NULL, NULL}, ++ }; ++ type = g_enum_register_static ("GstV4l2SinkFlip", vals); ++ } ++ return type; ++} ++ + static void + gst_v4l2sink_interface_init (GstImplementsInterfaceClass * klass) + { +@@ -225,7 +254,7 @@ static GstFlowReturn gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); + static GstFlowReturn gst_v4l2sink_show_frame (GstBaseSink * bsink, + GstBuffer * buf); +-static void gst_v4l2sink_set_rotation (GstV4l2Sink * v4l2sink); ++static void gst_v4l2sink_sync_rotation (GstV4l2Sink * v4l2sink); + + static void + gst_v4l2sink_base_init (gpointer g_class) +@@ -317,6 +346,11 @@ gst_v4l2sink_class_init (GstV4l2SinkClass * klass) + "Rotation angle for the image", MIN_ROTATION_ANGLE, + MAX_ROTATION_ANGLE, DEFAULT_ROTATION_ANGLE, G_PARAM_READWRITE)); + ++ g_object_class_install_property (gobject_class, PROP_FLIP, ++ g_param_spec_enum ("flip", "Flip State", ++ "Flip horizontal/vertical", ++ GST_TYPE_V4L2_FLIP, FLIP_NONE, G_PARAM_READWRITE)); ++ + basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); + basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); + basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); +@@ -348,8 +382,46 @@ gst_v4l2sink_init (GstV4l2Sink * v4l2sink, GstV4l2SinkClass * klass) + v4l2sink->crop_fields_set = 0; + v4l2sink->state = 0; + v4l2sink->rotation = 0; ++ v4l2sink->flip = FLIP_NONE; + } + ++static void ++gst_v4l2sink_sync_flip (GstV4l2Sink * v4l2sink) ++{ ++ if (GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) { ++ struct v4l2_control control; ++ gint fd = v4l2sink->v4l2object->video_fd; ++ ++ memset (&control, 0x00, sizeof (struct v4l2_control)); ++ ++ switch (v4l2sink->flip) { ++ case FLIP_VERTICAL: ++ v4l2sink->rotation = 0; ++ control.value = 1; ++ break; ++ case FLIP_HORIZONTAL: ++ /* Horizontal Flip = Vertical Flip + 180 rotation */ ++ v4l2sink->rotation = 180; ++ control.value = 1; ++ break; ++ case FLIP_NONE: ++ /* In the below switch case logic we need to handle FLIP_NONE ++ * case since the v4l2 driver holds on to the last configured ++ * flip value even after the device file is closed. ++ */ ++ control.value = 0; ++ break; ++ default: ++ GST_WARNING_OBJECT (v4l2sink, "Invalid flip property"); ++ control.value = 0; ++ break; ++ } ++ ++ gst_v4l2sink_sync_rotation (v4l2sink); ++ control.id = V4L2_CID_VFLIP; ++ g_return_if_fail (v4l2_ioctl (fd, VIDIOC_S_CTRL, &control) >= 0); ++ } ++} + + static void + gst_v4l2sink_dispose (GObject * object) +@@ -488,7 +560,7 @@ gst_v4l2sink_sync_crop_fields (GstV4l2Sink * v4l2sink) + } + + static void +-gst_v4l2sink_set_rotation (GstV4l2Sink * v4l2sink) ++gst_v4l2sink_sync_rotation (GstV4l2Sink * v4l2sink) + { + if (GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) { + struct v4l2_control control; +@@ -559,7 +631,11 @@ gst_v4l2sink_set_property (GObject * object, + break; + case PROP_ROTATION: + v4l2sink->rotation = g_value_get_int (value); +- gst_v4l2sink_set_rotation (v4l2sink); ++ gst_v4l2sink_sync_rotation (v4l2sink); ++ break; ++ case PROP_FLIP: ++ v4l2sink->flip = g_value_get_enum (value); ++ gst_v4l2sink_sync_flip (v4l2sink); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +@@ -611,6 +687,9 @@ gst_v4l2sink_get_property (GObject * object, + case PROP_ROTATION: + g_value_set_int (value, v4l2sink->rotation); + break; ++ case PROP_FLIP: ++ g_value_set_enum (value, v4l2sink->flip); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -633,7 +712,8 @@ gst_v4l2sink_change_state (GstElement * element, GstStateChange transition) + /* open the device */ + if (!gst_v4l2_object_start (v4l2sink->v4l2object)) + return GST_STATE_CHANGE_FAILURE; +- gst_v4l2sink_set_rotation (v4l2sink); ++ gst_v4l2sink_sync_rotation (v4l2sink); ++ gst_v4l2sink_sync_flip (v4l2sink); + break; + default: + break; +diff --git a/sys/v4l2/gstv4l2sink.h b/sys/v4l2/gstv4l2sink.h +index 1239621..907973a 100644 +--- a/sys/v4l2/gstv4l2sink.h ++++ b/sys/v4l2/gstv4l2sink.h +@@ -76,6 +76,7 @@ struct _GstV4l2Sink { + + guint8 state; + gint rotation; ++ gint flip; + }; + + struct _GstV4l2SinkClass { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0004-v4l2sink-Add-support-for-omap24xxvout-driver.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0004-v4l2sink-Add-support-for-omap24xxvout-driver.patch new file mode 100644 index 0000000..528e9a6 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0004-v4l2sink-Add-support-for-omap24xxvout-driver.patch @@ -0,0 +1,59 @@ +From 39de525898eea073c1f2486b99b56ef25b6df289 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sun, 4 Apr 2010 06:46:21 -0500 +Subject: [PATCH 04/11] v4l2sink: Add support for omap24xxvout driver + +--- + sys/v4l2/gstv4l2sink.c | 22 +++++++++++++++++++++- + 1 files changed, 21 insertions(+), 1 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index 6163747..4408428 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -888,6 +888,18 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + /* initialize the buffer pool if not initialized yet (first buffer): */ + if (G_UNLIKELY (!v4l2sink->pool)) { + ++ gboolean no_pending_streamon = FALSE; ++ char *driver = (char *) v4l2sink->v4l2object->vcap.driver; ++ ++ /* the omap24xxvout driver wants us to start streaming before we ++ * queue the first buffer: ++ */ ++ if (!strcmp ("omap24xxvout", driver)) { ++ GST_DEBUG_OBJECT (v4l2sink, ++ "enabling no_pending_streamon hack for omap24xxvout driver"); ++ no_pending_streamon = TRUE; ++ } ++ + /* set_caps() might not be called yet.. so just to make sure: */ + if (!gst_v4l2sink_set_caps (bsink, caps)) { + return GST_FLOW_ERROR; +@@ -909,7 +921,14 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + gst_v4l2_xoverlay_prepare_xwindow_id (v4l2sink->v4l2object, TRUE); + #endif + +- v4l2sink->state = STATE_PENDING_STREAMON; ++ if (no_pending_streamon) { ++ if (!gst_v4l2_object_start_streaming (v4l2sink->v4l2object)) { ++ return GST_FLOW_ERROR; ++ } ++ v4l2sink->state = STATE_STREAMING; ++ } else { ++ v4l2sink->state = STATE_PENDING_STREAMON; ++ } + + GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()"); + +@@ -996,6 +1015,7 @@ gst_v4l2sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) + if (!gst_v4l2_buffer_pool_qbuf (v4l2sink->pool, GST_V4L2_BUFFER (buf))) { + return GST_FLOW_ERROR; + } ++ + if (v4l2sink->state == STATE_PENDING_STREAMON) { + if (!gst_v4l2_object_start_streaming (v4l2sink->v4l2object)) { + return GST_FLOW_ERROR; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0005-v4l2sink-Add-support-for-omap_vout-driver.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0005-v4l2sink-Add-support-for-omap_vout-driver.patch new file mode 100644 index 0000000..7ec58cd --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0005-v4l2sink-Add-support-for-omap_vout-driver.patch @@ -0,0 +1,34 @@ +From 1fabe36f40e872942c80041225bdbf41db561bea Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sun, 4 Apr 2010 06:47:55 -0500 +Subject: [PATCH 05/11] v4l2sink: Add support for omap_vout driver + +--- + sys/v4l2/gstv4l2sink.c | 11 +++++++++++ + 1 files changed, 11 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index 4408428..66dda8e 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -900,6 +900,17 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + no_pending_streamon = TRUE; + } + ++ /* workaround for bug in omap_vout driver, when we ask for more ++ * than four buffers: ++ */ ++ if (!strcmp ("omap_vout", driver)) { ++ if (v4l2sink->num_buffers > 4) { ++ v4l2sink->num_buffers = 4; ++ GST_DEBUG_OBJECT (v4l2sink, ++ "limiting to 4 buffers to work-around omap_vout driver bug"); ++ } ++ } ++ + /* set_caps() might not be called yet.. so just to make sure: */ + if (!gst_v4l2sink_set_caps (bsink, caps)) { + return GST_FLOW_ERROR; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0006-v4l2-increase-v4l2sink-element-rank.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0006-v4l2-increase-v4l2sink-element-rank.patch new file mode 100644 index 0000000..cd417e3 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0006-v4l2-increase-v4l2sink-element-rank.patch @@ -0,0 +1,26 @@ +From 14d6f0fac0875981c418ac6577d23eafb5ff3f01 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 14 Apr 2010 03:29:20 -0500 +Subject: [PATCH 06/11] v4l2: increase v4l2sink element rank + +Increase rank so that it is autoplugged. +--- + sys/v4l2/gstv4l2.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c +index 4a7056f..cba4157 100644 +--- a/sys/v4l2/gstv4l2.c ++++ b/sys/v4l2/gstv4l2.c +@@ -55,7 +55,7 @@ plugin_init (GstPlugin * plugin) + if (!gst_element_register (plugin, "v4l2src", GST_RANK_PRIMARY, + GST_TYPE_V4L2SRC) || + #ifdef HAVE_EXPERIMENTAL +- !gst_element_register (plugin, "v4l2sink", GST_RANK_NONE, ++ !gst_element_register (plugin, "v4l2sink", GST_RANK_PRIMARY, + GST_TYPE_V4L2SINK) || + #endif + /* !gst_element_register (plugin, "v4l2jpegsrc", */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0007-use-GstQueryBuffers-to-get-buffer-requirements.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0007-use-GstQueryBuffers-to-get-buffer-requirements.patch new file mode 100644 index 0000000..70ceae5 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0007-use-GstQueryBuffers-to-get-buffer-requirements.patch @@ -0,0 +1,97 @@ +From 15c17ea368079fd5de19868af6d9ffad1cb09f3a Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 19 May 2010 17:33:46 -0500 +Subject: [PATCH 07/11] use GstQueryBuffers to get buffer requirements + +--- + sys/v4l2/gstv4l2sink.c | 40 ++++++++++++++++++++++++++++++++++++++++ + sys/v4l2/gstv4l2sink.h | 1 + + 2 files changed, 41 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index 66dda8e..12323f7 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -373,6 +373,7 @@ gst_v4l2sink_init (GstV4l2Sink * v4l2sink, GstV4l2SinkClass * klass) + + /* number of buffers requested */ + v4l2sink->num_buffers = PROP_DEF_QUEUE_SIZE; ++ v4l2sink->num_buffers_can_change = TRUE; + v4l2sink->min_queued_bufs = PROP_DEF_MIN_QUEUED_BUFS; + + v4l2sink->probed_caps = NULL; +@@ -808,6 +809,7 @@ static gboolean + gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + { + GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink); ++ GstQuery *query; + gint w = 0, h = 0; + gboolean interlaced; + struct v4l2_fmtdesc *format; +@@ -855,6 +857,39 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + return FALSE; + } + ++ /* query to find if anyone upstream using these buffers has any ++ * minimum requirements: ++ */ ++ query = gst_query_new_buffers (caps); ++ if (gst_element_query (GST_ELEMENT (v4l2sink), query)) { ++ gint min_buffers, min_width, min_height; ++ ++ gst_query_parse_buffers_count (query, &min_buffers); ++ ++ /* XXX need to account for some buffers used by queue, etc.. probably ++ * queue should handle query, pass on to sink pad, and then add some ++ * number of buffers to the min, so this value is dynamic depending ++ * on the pipeline? ++ */ ++ if (min_buffers != -1) { ++ min_buffers += 3 + v4l2sink->min_queued_bufs; ++ } ++ ++ if (min_buffers > v4l2sink->num_buffers) { ++ v4l2sink->num_buffers_can_change = FALSE; ++ v4l2sink->num_buffers = min_buffers; ++ } ++ ++ gst_query_parse_buffers_dimensions (query, &min_width, &min_height); ++ if (min_width > w) { ++ w = min_width; ++ } ++ if (min_height > h) { ++ h = min_height; ++ } ++ } ++ gst_query_unref (query); ++ + if (!gst_v4l2_object_set_format (v4l2sink->v4l2object, format->pixelformat, + w, h, interlaced)) { + /* error already posted */ +@@ -944,6 +979,11 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + GST_INFO_OBJECT (v4l2sink, "outputting buffers via mmap()"); + + if (v4l2sink->num_buffers != v4l2sink->pool->buffer_count) { ++ if (!v4l2sink->num_buffers_can_change) { ++ GST_WARNING_OBJECT (v4l2sink, ++ "I can't handle a differing number of buffers!!!!"); ++ return GST_FLOW_ERROR; ++ } + v4l2sink->num_buffers = v4l2sink->pool->buffer_count; + g_object_notify (G_OBJECT (v4l2sink), "queue-size"); + } +diff --git a/sys/v4l2/gstv4l2sink.h b/sys/v4l2/gstv4l2sink.h +index 907973a..7649fa1 100644 +--- a/sys/v4l2/gstv4l2sink.h ++++ b/sys/v4l2/gstv4l2sink.h +@@ -58,6 +58,7 @@ struct _GstV4l2Sink { + GstCaps *current_caps; /* the current negotiated caps */ + GstV4l2BufferPool *pool; + guint32 num_buffers; ++ gboolean num_buffers_can_change; + guint32 min_queued_bufs; + + gint video_width, video_height; /* original (unscaled) video w/h */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0008-add-rowstride-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0008-add-rowstride-support.patch new file mode 100644 index 0000000..1075a89 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0008-add-rowstride-support.patch @@ -0,0 +1,572 @@ +From a86d0326df31103c2ee38ee1e0c62802a758ef13 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Fri, 21 May 2010 15:21:32 -0500 +Subject: [PATCH 08/11] add rowstride support + +--- + sys/v4l2/gstv4l2object.c | 141 +++++++++++++++++++++++++++++++++++++--------- + sys/v4l2/gstv4l2object.h | 6 +- + sys/v4l2/gstv4l2sink.c | 61 +++++++++++++------- + sys/v4l2/gstv4l2src.c | 28 +++++---- + 4 files changed, 174 insertions(+), 62 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index f5672b5..5e34456 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -1064,16 +1064,23 @@ gst_v4l2_object_get_format_list (GstV4l2Object * v4l2object) + return v4l2object->formats; + } + +- +-GstStructure * +-gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) ++/* ++ * gst_v4l2_object_v4l2fourcc_to_structures: ++ * @fourcc: requested format ++ * @structures: an array of at least MAX_STRUCTS_PER_FOURCC to return the ++ * results in ++ * ++ * Returns the number of structures returned via structures ++ */ ++gint ++gst_v4l2_object_v4l2fourcc_to_structures (guint32 fourcc, ++ GstStructure ** structures) + { +- GstStructure *structure = NULL; +- ++ gint count = 0; + switch (fourcc) { + case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */ + case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */ +- structure = gst_structure_new ("image/jpeg", NULL); ++ structures[count++] = gst_structure_new ("image/jpeg", NULL); + break; + case V4L2_PIX_FMT_RGB332: + case V4L2_PIX_FMT_RGB555: +@@ -1151,17 +1158,25 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + g_assert_not_reached (); + break; + } +- structure = gst_structure_new ("video/x-raw-rgb", ++ structures[count++] = gst_structure_new ("video/x-raw-rgb", + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "red_mask", G_TYPE_INT, r_mask, + "green_mask", G_TYPE_INT, g_mask, + "blue_mask", G_TYPE_INT, b_mask, + "endianness", G_TYPE_INT, endianness, NULL); ++ structures[count++] = gst_structure_new ("video/x-raw-rgb-strided", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "red_mask", G_TYPE_INT, r_mask, ++ "green_mask", G_TYPE_INT, g_mask, ++ "blue_mask", G_TYPE_INT, b_mask, ++ "endianness", G_TYPE_INT, endianness, ++ "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + break; + } + case V4L2_PIX_FMT_GREY: /* 8 Greyscale */ +- structure = gst_structure_new ("video/x-raw-gray", ++ structures[count++] = gst_structure_new ("video/x-raw-gray", + "bpp", G_TYPE_INT, 8, NULL); + break; + case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ +@@ -1227,38 +1242,41 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + g_assert_not_reached (); + break; + } +- structure = gst_structure_new ("video/x-raw-yuv", ++ structures[count++] = gst_structure_new ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, fcc, NULL); ++ structures[count++] = gst_structure_new ("video/x-raw-yuv-strided", ++ "format", GST_TYPE_FOURCC, fcc, ++ "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + break; + } + case V4L2_PIX_FMT_DV: +- structure = ++ structures[count++] = + gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE, + NULL); + break; + case V4L2_PIX_FMT_MPEG: /* MPEG */ +- structure = gst_structure_new ("video/mpegts", NULL); ++ structures[count++] = gst_structure_new ("video/mpegts", NULL); + break; + case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ + break; + #ifdef V4L2_PIX_FMT_SBGGR8 + case V4L2_PIX_FMT_SBGGR8: +- structure = gst_structure_new ("video/x-raw-bayer", NULL); ++ structures[count++] = gst_structure_new ("video/x-raw-bayer", NULL); + break; + #endif + #ifdef V4L2_PIX_FMT_SN9C10X + case V4L2_PIX_FMT_SN9C10X: +- structure = gst_structure_new ("video/x-sonix", NULL); ++ structures[count++] = gst_structure_new ("video/x-sonix", NULL); + break; + #endif + #ifdef V4L2_PIX_FMT_PWC1 + case V4L2_PIX_FMT_PWC1: +- structure = gst_structure_new ("video/x-pwc1", NULL); ++ structures[count++] = gst_structure_new ("video/x-pwc1", NULL); + break; + #endif + #ifdef V4L2_PIX_FMT_PWC2 + case V4L2_PIX_FMT_PWC2: +- structure = gst_structure_new ("video/x-pwc2", NULL); ++ structures[count++] = gst_structure_new ("video/x-pwc2", NULL); + break; + #endif + default: +@@ -1267,7 +1285,7 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc) + break; + } + +- return structure; ++ return count; + } + + +@@ -1278,22 +1296,23 @@ gst_v4l2_object_get_all_caps (void) + static GstCaps *caps = NULL; + + if (caps == NULL) { +- GstStructure *structure; +- + guint i; + + caps = gst_caps_new_empty (); + for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) { +- structure = +- gst_v4l2_object_v4l2fourcc_to_structure (gst_v4l2_formats[i].format); +- if (structure) { ++ GstStructure *structures[MAX_STRUCTS_PER_FOURCC]; ++ gint count, j; ++ count = ++ gst_v4l2_object_v4l2fourcc_to_structures (gst_v4l2_formats[i].format, ++ structures); ++ for (j = 0; j < count; j++) { + if (gst_v4l2_formats[i].dimensions) { +- gst_structure_set (structure, ++ gst_structure_set (structures[j], + "width", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, + "height", GST_TYPE_INT_RANGE, 1, GST_V4L2_MAX_SIZE, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL); + } +- gst_caps_append_structure (caps, structure); ++ gst_caps_append_structure (caps, structures[j]); + } + } + } +@@ -1306,12 +1325,14 @@ gst_v4l2_object_get_all_caps (void) + * @caps: given input caps + * @format: location for the v4l format + * @w/@h: location for width and height ++ * @rs: required rowstride in bytes, or 0 if natural stride (based on format ++ * and width) or not-applicable + * @fps_n/@fps_d: location for framerate + * @size: location for expected size of the frame or 0 if unknown + */ + gboolean + gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, +- struct v4l2_fmtdesc ** format, gint * w, gint * h, ++ struct v4l2_fmtdesc ** format, gint * w, gint * h, gint * rs, + gboolean * interlaced, guint * fps_n, guint * fps_d, guint * size) + { + GstStructure *structure; +@@ -1319,10 +1340,12 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + guint32 fourcc; + const gchar *mimetype; + guint outsize; ++ struct v4l2_format fmt = { 0, }; + + /* default unknown values */ + fourcc = 0; + outsize = 0; ++ *rs = 0; + + structure = gst_caps_get_structure (caps, 0); + +@@ -1351,61 +1374,73 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + *fps_n = gst_value_get_fraction_numerator (framerate); + *fps_d = gst_value_get_fraction_denominator (framerate); + +- if (!strcmp (mimetype, "video/x-raw-yuv")) { ++ if (!strcmp (mimetype, "video/x-raw-yuv") || ++ !strcmp (mimetype, "video/x-raw-yuv-strided")) { + gst_structure_get_fourcc (structure, "format", &fourcc); + + switch (fourcc) { + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + case GST_MAKE_FOURCC ('I', 'Y', 'U', 'V'): + fourcc = V4L2_PIX_FMT_YUV420; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * GST_ROUND_UP_2 (*h); + outsize += 2 * ((GST_ROUND_UP_8 (*w) / 2) * (GST_ROUND_UP_2 (*h) / 2)); + break; + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + fourcc = V4L2_PIX_FMT_YUYV; ++ *rs = GST_ROUND_UP_2 (*w) * 2; + outsize = (GST_ROUND_UP_2 (*w) * 2) * *h; + break; + case GST_MAKE_FOURCC ('Y', '4', '1', 'P'): + fourcc = V4L2_PIX_FMT_Y41P; ++ *rs = GST_ROUND_UP_2 (*w) * 2; + outsize = (GST_ROUND_UP_2 (*w) * 2) * *h; + break; + case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): + fourcc = V4L2_PIX_FMT_UYVY; ++ *rs = GST_ROUND_UP_2 (*w) * 2; + outsize = (GST_ROUND_UP_2 (*w) * 2) * *h; + break; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + fourcc = V4L2_PIX_FMT_YVU420; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * GST_ROUND_UP_2 (*h); + outsize += 2 * ((GST_ROUND_UP_8 (*w) / 2) * (GST_ROUND_UP_2 (*h) / 2)); + break; + case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): + fourcc = V4L2_PIX_FMT_YUV411P; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * *h; + outsize += 2 * ((GST_ROUND_UP_8 (*w) / 4) * *h); + break; + case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): + fourcc = V4L2_PIX_FMT_YUV422P; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * *h; + outsize += 2 * ((GST_ROUND_UP_8 (*w) / 2) * *h); + break; + case GST_MAKE_FOURCC ('N', 'V', '1', '2'): + fourcc = V4L2_PIX_FMT_NV12; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * GST_ROUND_UP_2 (*h); + outsize += (GST_ROUND_UP_4 (*w) * *h) / 2; + break; + case GST_MAKE_FOURCC ('N', 'V', '2', '1'): + fourcc = V4L2_PIX_FMT_NV21; ++ *rs = GST_ROUND_UP_4 (*w); + outsize = GST_ROUND_UP_4 (*w) * GST_ROUND_UP_2 (*h); + outsize += (GST_ROUND_UP_4 (*w) * *h) / 2; + break; + #ifdef V4L2_PIX_FMT_YVYU + case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'): + fourcc = V4L2_PIX_FMT_YVYU; ++ *rs = GST_ROUND_UP_2 (*w) * 2; + outsize = (GST_ROUND_UP_2 (*w) * 2) * *h; + break; + #endif + } +- } else if (!strcmp (mimetype, "video/x-raw-rgb")) { ++ } else if (!strcmp (mimetype, "video/x-raw-rgb") || ++ !strcmp (mimetype, "video/x-raw-rgb-strided")) { + gint bpp, endianness, r_mask; + + gst_structure_get_int (structure, "bpp", &bpp); +@@ -1415,20 +1450,25 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + switch (bpp) { + case 8: + fourcc = V4L2_PIX_FMT_RGB332; ++ *rs = *w; + break; + case 15: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X; ++ *rs = 2 * *w; + break; + case 16: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X; ++ *rs = 2 * *w; + break; + case 24: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24; ++ *rs = 3 * *w; + break; + case 32: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32; ++ *rs = 4 * *w; + break; + } + } else if (strcmp (mimetype, "video/x-dv") == 0) { +@@ -1458,6 +1498,25 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps, + if (fourcc == 0) + return FALSE; + ++ /* check what stride the driver supports */ ++ fmt.type = v4l2object->type; ++ fmt.fmt.pix.width = *w; ++ fmt.fmt.pix.height = *h; ++ fmt.fmt.pix.pixelformat = fourcc; ++ fmt.fmt.pix.field = V4L2_FIELD_ANY; ++ fmt.fmt.pix.bytesperline = *rs; ++ if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_TRY_FMT, &fmt) >= 0) { ++ if (fmt.fmt.pix.bytesperline == *rs) { ++ *rs = 0; ++ } else { ++ *rs = fmt.fmt.pix.bytesperline; ++ } ++ GST_INFO_OBJECT (v4l2object->element, "rowstride: %d", *rs); ++ } else { ++ GST_WARNING_OBJECT (v4l2object->element, ++ "VIDIOC_TRY_FMT should not fail.. driver problem?"); ++ } ++ + done: + *format = gst_v4l2_object_get_format_from_fourcc (v4l2object, fourcc); + *size = outsize; +@@ -1465,6 +1524,36 @@ done: + return TRUE; + } + ++/* Update caps to reflect rowstride that has been requested by the ++ * driver ++ */ ++GstCaps * ++gst_v4l2_object_update_rowstride (GstV4l2Object * v4l2object, ++ GstCaps * caps, gint rs) ++{ ++ GstStructure *structure; ++ const gchar *mimetype; ++ ++ caps = gst_caps_make_writable (caps); ++ ++ structure = gst_caps_get_structure (caps, 0); ++ mimetype = gst_structure_get_name (structure); ++ ++ if (!strcmp (mimetype, "video/x-raw-yuv")) { ++ mimetype = "video/x-raw-yuv-strided"; ++ gst_structure_set_name (structure, mimetype); ++ } else if (!strcmp (mimetype, "video/x-raw-rgb")) { ++ mimetype = "video/x-raw-rgb-strided"; ++ gst_structure_set_name (structure, mimetype); ++ } ++ ++ if (!strcmp (mimetype, "video/x-raw-yuv-strided") || ++ !strcmp (mimetype, "video/x-raw-rgb-strided")) { ++ gst_structure_set (structure, "rowstride", G_TYPE_INT, rs, NULL); ++ } ++ ++ return caps; ++} + + static gboolean + gst_v4l2_object_get_nearest_size (GstV4l2Object * v4l2object, +diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h +index a0dd41c..228e7c7 100644 +--- a/sys/v4l2/gstv4l2object.h ++++ b/sys/v4l2/gstv4l2object.h +@@ -179,15 +179,17 @@ GstCaps* gst_v4l2_object_probe_caps_for_format (GstV4l2Object *v4l2object, + const GstStructure * template); + + gboolean gst_v4l2_object_get_caps_info (GstV4l2Object *v4l2object, GstCaps *caps, +- struct v4l2_fmtdesc **format, gint *w, gint *h, ++ struct v4l2_fmtdesc **format, gint *w, gint *h, gint *rs, + gboolean * interlaced, guint *fps_n, guint *fps_d, guint *size); + ++GstCaps * gst_v4l2_object_update_rowstride (GstV4l2Object * v4l2object, GstCaps * caps, gint rs); + + GSList* gst_v4l2_object_get_format_list (GstV4l2Object *v4l2object); + + GstCaps* gst_v4l2_object_get_all_caps (void); + +-GstStructure* gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc); ++#define MAX_STRUCTS_PER_FOURCC 2 ++gint gst_v4l2_object_v4l2fourcc_to_structures (guint32 fourcc, GstStructure ** structures); + + gboolean gst_v4l2_object_set_format (GstV4l2Object *v4l2object, guint32 pixelformat, guint32 width, guint32 height, gboolean interlaced); + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index 12323f7..a1f78cf 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -776,24 +776,23 @@ gst_v4l2sink_get_caps (GstBaseSink * bsink) + for (walk = v4l2sink->v4l2object->formats; walk; walk = walk->next) { + struct v4l2_fmtdesc *format; + +- GstStructure *template; ++ GstStructure *templates[MAX_STRUCTS_PER_FOURCC]; ++ gint count, i; + + format = (struct v4l2_fmtdesc *) walk->data; + +- template = gst_v4l2_object_v4l2fourcc_to_structure (format->pixelformat); ++ count = gst_v4l2_object_v4l2fourcc_to_structures (format->pixelformat, ++ templates); + +- if (template) { ++ for (i = 0; i < count; i++) { + GstCaps *tmp; + +- tmp = +- gst_v4l2_object_probe_caps_for_format (v4l2sink->v4l2object, +- format->pixelformat, template); ++ tmp = gst_v4l2_object_probe_caps_for_format (v4l2sink->v4l2object, ++ format->pixelformat, templates[i]); + if (tmp) + gst_caps_append (ret, tmp); + +- gst_structure_free (template); +- } else { +- GST_DEBUG_OBJECT (v4l2sink, "unknown format %u", format->pixelformat); ++ gst_structure_free (templates[i]); + } + } + +@@ -810,7 +809,7 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + { + GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink); + GstQuery *query; +- gint w = 0, h = 0; ++ gint w = 0, h = 0, rs = 0; + gboolean interlaced; + struct v4l2_fmtdesc *format; + guint fps_n, fps_d; +@@ -823,11 +822,36 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + return FALSE; + } + ++ /* we want our own v4l2 type of fourcc codes */ ++ if (!gst_v4l2_object_get_caps_info (v4l2sink->v4l2object, caps, ++ &format, &w, &h, &rs, &interlaced, &fps_n, &fps_d, &size)) { ++ GST_DEBUG_OBJECT (v4l2sink, "can't get capture format from caps %p", caps); ++ return FALSE; ++ } ++ ++ if (!format) { ++ GST_DEBUG_OBJECT (v4l2sink, "unrecognized caps!!"); ++ return FALSE; ++ } ++ ++ /* we need to make our own ref before we potentially update the ++ * caps, to avoid that we release a ref that is not owned by us ++ * when we make the caps writable ++ */ ++ caps = gst_caps_ref (caps); ++ ++ /* if necessary, update caps for rowstride */ ++ if (rs) { ++ caps = gst_v4l2_object_update_rowstride (v4l2sink->v4l2object, caps, rs); ++ GST_DEBUG_OBJECT (v4l2sink, "updated caps: %" GST_PTR_FORMAT, caps); ++ } ++ + if (v4l2sink->current_caps) { + GST_DEBUG_OBJECT (v4l2sink, "already have caps set.. are they equal?"); + LOG_CAPS (v4l2sink, v4l2sink->current_caps); + if (gst_caps_is_equal (v4l2sink->current_caps, caps)) { + GST_DEBUG_OBJECT (v4l2sink, "yes they are!"); ++ gst_caps_unref (caps); + return TRUE; + } + GST_DEBUG_OBJECT (v4l2sink, "no they aren't!"); +@@ -842,18 +866,7 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + * + */ + GST_DEBUG_OBJECT (v4l2sink, "warning, changing caps not supported yet"); +- return FALSE; +- } +- +- /* we want our own v4l2 type of fourcc codes */ +- if (!gst_v4l2_object_get_caps_info (v4l2sink->v4l2object, caps, +- &format, &w, &h, &interlaced, &fps_n, &fps_d, &size)) { +- GST_DEBUG_OBJECT (v4l2sink, "can't get capture format from caps %p", caps); +- return FALSE; +- } +- +- if (!format) { +- GST_DEBUG_OBJECT (v4l2sink, "unrecognized caps!!"); ++ gst_caps_unref (caps); + return FALSE; + } + +@@ -893,6 +906,7 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + if (!gst_v4l2_object_set_format (v4l2sink->v4l2object, format->pixelformat, + w, h, interlaced)) { + /* error already posted */ ++ gst_caps_unref (caps); + return FALSE; + } + +@@ -951,6 +965,9 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + return GST_FLOW_ERROR; + } + ++ /* caps may have changed in _set_caps() if we need rowstride */ ++ caps = v4l2sink->current_caps; ++ + GST_V4L2_CHECK_OPEN (v4l2sink->v4l2object); + + if (!(v4l2sink->pool = gst_v4l2_buffer_pool_new (GST_ELEMENT (v4l2sink), +diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c +index 4a37d35..a9a7787 100644 +--- a/sys/v4l2/gstv4l2src.c ++++ b/sys/v4l2/gstv4l2src.c +@@ -581,24 +581,23 @@ gst_v4l2src_get_caps (GstBaseSrc * src) + for (walk = v4l2src->v4l2object->formats; walk; walk = walk->next) { + struct v4l2_fmtdesc *format; + +- GstStructure *template; ++ GstStructure *templates[MAX_STRUCTS_PER_FOURCC]; ++ gint count, i; + + format = (struct v4l2_fmtdesc *) walk->data; + +- template = gst_v4l2_object_v4l2fourcc_to_structure (format->pixelformat); ++ count = gst_v4l2_object_v4l2fourcc_to_structures (format->pixelformat, ++ templates); + +- if (template) { ++ for (i = 0; i < count; i++) { + GstCaps *tmp; + +- tmp = +- gst_v4l2_object_probe_caps_for_format (v4l2src->v4l2object, +- format->pixelformat, template); ++ tmp = gst_v4l2_object_probe_caps_for_format (v4l2src->v4l2object, ++ format->pixelformat, templates[i]); + if (tmp) + gst_caps_append (ret, tmp); + +- gst_structure_free (template); +- } else { +- GST_DEBUG_OBJECT (v4l2src, "unknown format %u", format->pixelformat); ++ gst_structure_free (templates[i]); + } + } + +@@ -613,7 +612,7 @@ static gboolean + gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps) + { + GstV4l2Src *v4l2src; +- gint w = 0, h = 0; ++ gint w = 0, h = 0, rs = 0; + gboolean interlaced; + struct v4l2_fmtdesc *format; + guint fps_n, fps_d; +@@ -635,13 +634,18 @@ gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps) + } + + /* we want our own v4l2 type of fourcc codes */ +- if (!gst_v4l2_object_get_caps_info (v4l2src->v4l2object, caps, &format, &w, +- &h, &interlaced, &fps_n, &fps_d, &size)) { ++ if (!gst_v4l2_object_get_caps_info (v4l2src->v4l2object, caps, &format, ++ &w, &h, &rs, &interlaced, &fps_n, &fps_d, &size)) { + GST_INFO_OBJECT (v4l2src, + "can't get capture format from caps %" GST_PTR_FORMAT, caps); + return FALSE; + } + ++ /* if necessary, update caps for rowstride */ ++ if (rs) { ++ caps = gst_v4l2_object_update_rowstride (v4l2src->v4l2object, caps, rs); ++ } ++ + GST_DEBUG_OBJECT (v4l2src, "trying to set_capture %dx%d at %d/%d fps, " + "format %s", w, h, fps_n, fps_d, format->description); + +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0009-use-GstEventCrop-to-get-crop-info.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0009-use-GstEventCrop-to-get-crop-info.patch new file mode 100644 index 0000000..8b8679e --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0009-use-GstEventCrop-to-get-crop-info.patch @@ -0,0 +1,119 @@ +From e7497b9f0c6c88b764d8f95e01197e2a2ea0dd95 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Tue, 25 May 2010 11:02:45 -0500 +Subject: [PATCH 09/11] use GstEventCrop to get crop info + +--- + sys/v4l2/gstv4l2sink.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 files changed, 62 insertions(+), 1 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index a1f78cf..feafe7a 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -252,6 +252,7 @@ static GstCaps *gst_v4l2sink_get_caps (GstBaseSink * bsink); + static gboolean gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps); + static GstFlowReturn gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, + guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); ++static gboolean gst_v4l2sink_event (GstBaseSink * bsink, GstEvent * event); + static GstFlowReturn gst_v4l2sink_show_frame (GstBaseSink * bsink, + GstBuffer * buf); + static void gst_v4l2sink_sync_rotation (GstV4l2Sink * v4l2sink); +@@ -354,6 +355,7 @@ gst_v4l2sink_class_init (GstV4l2SinkClass * klass) + basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); + basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); + basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); ++ basesink_class->event = GST_DEBUG_FUNCPTR (gst_v4l2sink_event); + basesink_class->render = GST_DEBUG_FUNCPTR (gst_v4l2sink_show_frame); + } + +@@ -895,11 +897,22 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + + gst_query_parse_buffers_dimensions (query, &min_width, &min_height); + if (min_width > w) { ++ v4l2sink->crop.width = w; ++ v4l2sink->crop_fields_set |= RECT_WIDTH_SET; + w = min_width; + } + if (min_height > h) { ++ v4l2sink->crop.height = h; ++ v4l2sink->crop_fields_set |= RECT_HEIGHT_SET; + h = min_height; + } ++ ++ /* clear top/left crop values.. otherwise by default display will try ++ * to center, rather than scale, the image if it is too big to fit on ++ * display ++ */ ++ v4l2sink->crop.top = v4l2sink->crop.left = 0; ++ v4l2sink->crop_fields_set |= RECT_TOP_SET | RECT_LEFT_SET; + } + gst_query_unref (query); + +@@ -919,7 +932,13 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + GST_VIDEO_SINK_WIDTH (v4l2sink) = w; + GST_VIDEO_SINK_HEIGHT (v4l2sink) = h; + +- v4l2sink->current_caps = gst_caps_ref (caps); ++ /* this needs to go after gst_v4l2_object_set_format() to ensure driver ++ * has proper width/height (so we don't confuse it's error checking by ++ * setting a crop larger than the picture size) ++ */ ++ gst_v4l2sink_sync_crop_fields (v4l2sink); ++ ++ v4l2sink->current_caps = caps; + + return TRUE; + } +@@ -1023,6 +1042,48 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + } + } + ++/* called to handle events */ ++static gboolean ++gst_v4l2sink_event (GstBaseSink * bsink, GstEvent * event) ++{ ++ GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink); ++ GstEventType type = GST_EVENT_TYPE (event); ++ ++ GST_DEBUG_OBJECT (v4l2sink, "event %" GST_PTR_FORMAT, event); ++ ++ switch (type) { ++ case GST_EVENT_CROP:{ ++ gint top, left, width, height; ++ gst_event_parse_crop (event, &top, &left, &width, &height); ++ if (top >= 0) { ++ v4l2sink->crop.top = top; ++ v4l2sink->crop_fields_set |= RECT_TOP_SET; ++ } ++ if (left >= 0) { ++ v4l2sink->crop.left = left; ++ v4l2sink->crop_fields_set |= RECT_LEFT_SET; ++ } ++ if (width >= 0) { ++ v4l2sink->crop.width = width; ++ v4l2sink->crop_fields_set |= RECT_WIDTH_SET; ++ } ++ if (height >= 0) { ++ v4l2sink->crop.height = height; ++ v4l2sink->crop_fields_set |= RECT_HEIGHT_SET; ++ } ++ gst_v4l2sink_sync_crop_fields (v4l2sink); ++ return TRUE; ++ } ++ default:{ ++ if (GST_BASE_SINK_CLASS (parent_class)->event) { ++ return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event); ++ } else { ++ return TRUE; ++ } ++ } ++ } ++} ++ + /* called after A/V sync to render frame */ + static GstFlowReturn + gst_v4l2sink_show_frame (GstBaseSink * bsink, GstBuffer * buf) +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0010-v4l2-prefer-NV12.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0010-v4l2-prefer-NV12.patch new file mode 100644 index 0000000..d47ef9a --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0010-v4l2-prefer-NV12.patch @@ -0,0 +1,28 @@ +From 107c18830342c69229857f968dff33071d07992d Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Tue, 14 Sep 2010 07:44:01 -0500 +Subject: [PATCH 10/11] v4l2: prefer NV12 + +All else being equal, the buffer sizes are smaller compared to a 422 format +like YUY2/UYVY.. although ideally rank would come from driver. +--- + sys/v4l2/gstv4l2object.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c +index 5e34456..644edcf 100644 +--- a/sys/v4l2/gstv4l2object.c ++++ b/sys/v4l2/gstv4l2object.c +@@ -886,6 +886,9 @@ gst_v4l2_object_format_get_rank (const struct v4l2_fmtdesc *fmt) + break; + + case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */ ++ rank = YUV_BASE_RANK + 11; ++ break; ++ + case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */ + case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ + case V4L2_PIX_FMT_HI240: /* 8 8-bit color */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0011-v4l2sink-fix-issue-seen-with-autoconvert.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0011-v4l2sink-fix-issue-seen-with-autoconvert.patch new file mode 100644 index 0000000..44c82af --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0011-v4l2sink-fix-issue-seen-with-autoconvert.patch @@ -0,0 +1,49 @@ +From 4e319948c62aafd5339c38d065fd8dbfa5a09ced Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Thu, 13 Jan 2011 09:43:08 -0600 +Subject: [PATCH 11/11] v4l2sink: fix issue seen with autoconvert + +In this scenario _set_caps() will get called earlier than _buffer_alloc() +so we need to not override the number of buffers in the case that the +upstream element answers the query about number of requested buffers. +--- + sys/v4l2/gstv4l2sink.c | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c +index feafe7a..ca6ae15 100644 +--- a/sys/v4l2/gstv4l2sink.c ++++ b/sys/v4l2/gstv4l2sink.c +@@ -881,6 +881,8 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + + gst_query_parse_buffers_count (query, &min_buffers); + ++ GST_DEBUG_OBJECT (v4l2sink, "min_buffers=%d", min_buffers); ++ + /* XXX need to account for some buffers used by queue, etc.. probably + * queue should handle query, pass on to sink pad, and then add some + * number of buffers to the min, so this value is dynamic depending +@@ -888,10 +890,10 @@ gst_v4l2sink_set_caps (GstBaseSink * bsink, GstCaps * caps) + */ + if (min_buffers != -1) { + min_buffers += 3 + v4l2sink->min_queued_bufs; ++ v4l2sink->num_buffers_can_change = FALSE; + } + + if (min_buffers > v4l2sink->num_buffers) { +- v4l2sink->num_buffers_can_change = FALSE; + v4l2sink->num_buffers = min_buffers; + } + +@@ -972,7 +974,7 @@ gst_v4l2sink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, + * than four buffers: + */ + if (!strcmp ("omap_vout", driver)) { +- if (v4l2sink->num_buffers > 4) { ++ if (v4l2sink->num_buffers_can_change && v4l2sink->num_buffers > 4) { + v4l2sink->num_buffers = 4; + GST_DEBUG_OBJECT (v4l2sink, + "limiting to 4 buffers to work-around omap_vout driver bug"); +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0012-v4l2sink-Add-Userptr-support.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0012-v4l2sink-Add-Userptr-support.patch new file mode 100755 index 0000000..be6d485 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-good-0.10.27/0012-v4l2sink-Add-Userptr-support.patch @@ -0,0 +1,461 @@ +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2sink.c gst-plugins-good-0.10.27/sys/v4l2/gstv4l2sink.c +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2sink.c 2011-10-01 16:54:14.317291000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/gstv4l2sink.c 2011-10-01 17:46:17.469290703 +0530 +@@ -62,6 +62,7 @@ + + #include "gstv4l2sink.h" + #include "gst/gst-i18n-plugin.h" ++#include "gstv4l2_userpointer.h" + + #include <string.h> + +@@ -92,6 +93,7 @@ enum + PROP_CROP_HEIGHT, + PROP_ROTATION, + PROP_FLIP, ++ PROP_USERPOINTER, + }; + + +@@ -352,6 +354,11 @@ gst_v4l2sink_class_init (GstV4l2SinkClas + "Flip horizontal/vertical", + GST_TYPE_V4L2_FLIP, FLIP_NONE, G_PARAM_READWRITE)); + ++ g_object_class_install_property (gobject_class, PROP_USERPOINTER, ++ g_param_spec_boolean("userpointer", "User Pointer", ++ "configures using user pointer for display without memcopy", ++ TRUE, G_PARAM_READWRITE)); ++ + basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_get_caps); + basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_v4l2sink_set_caps); + basesink_class->buffer_alloc = GST_DEBUG_FUNCPTR (gst_v4l2sink_buffer_alloc); +@@ -386,6 +393,8 @@ gst_v4l2sink_init (GstV4l2Sink * v4l2sin + v4l2sink->state = 0; + v4l2sink->rotation = 0; + v4l2sink->flip = FLIP_NONE; ++ v4l2sink->gst_buf_array = NULL; ++ v4l2sink->enableUserPtr = TRUE; + } + + static void +@@ -640,6 +649,9 @@ gst_v4l2sink_set_property (GObject * obj + v4l2sink->flip = g_value_get_enum (value); + gst_v4l2sink_sync_flip (v4l2sink); + break; ++ case PROP_USERPOINTER: ++ v4l2sink->enableUserPtr = g_value_get_boolean (value); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -693,6 +705,9 @@ gst_v4l2sink_get_property (GObject * obj + case PROP_FLIP: + g_value_set_enum (value, v4l2sink->flip); + break; ++ case PROP_USERPOINTER: ++ g_value_set_boolean (value, v4l2sink->enableUserPtr); ++ break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; +@@ -705,6 +720,7 @@ gst_v4l2sink_change_state (GstElement * + { + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstV4l2Sink *v4l2sink = GST_V4L2SINK (element); ++ gint i = 0; + + GST_DEBUG_OBJECT (v4l2sink, "%d -> %d", + GST_STATE_TRANSITION_CURRENT (transition), +@@ -718,11 +734,30 @@ gst_v4l2sink_change_state (GstElement * + gst_v4l2sink_sync_rotation (v4l2sink); + gst_v4l2sink_sync_flip (v4l2sink); + break; ++ case GST_STATE_CHANGE_PLAYING_TO_PAUSED: ++ break; + default: + break; + } +- +- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ if(transition == GST_STATE_CHANGE_PAUSED_TO_READY){ ++ if(v4l2sink->enableUserPtr) { ++ GST_DEBUG_OBJECT (v4l2sink, "!!!!!!!!!unreference all the remaining buffers!!!!!!!!!"); ++ printf("\n!!!!!!!!!unreference all the remaining buffers!!!!!!!!!"); ++ if(v4l2sink->gst_buf_array != NULL){ ++ for(i = 0;i<v4l2sink->num_buffers;i++) { ++ if(v4l2sink->gst_buf_array[i] != NULL) { ++ gst_buffer_unref(v4l2sink->gst_buf_array[i]); ++ v4l2sink->gst_buf_array[i] = NULL; ++ } ++ } ++ } ++ } ++ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ } ++ else{ ++ ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); ++ } ++ + + switch (transition) { + case GST_STATE_CHANGE_PAUSED_TO_READY: +@@ -734,9 +769,14 @@ gst_v4l2sink_change_state (GstElement * + } + break; + case GST_STATE_CHANGE_READY_TO_NULL: +- if (NULL != v4l2sink->pool) ++ if (NULL != v4l2sink->pool){ + gst_v4l2_buffer_pool_destroy (v4l2sink->pool); + v4l2sink->pool = NULL; ++ } ++ if(v4l2sink->gst_buf_array){ ++ gst_v4l2sink_userpointer_deinit(v4l2sink); ++ } ++ + /* close the device */ + if (!gst_v4l2_object_stop (v4l2sink->v4l2object)) + return GST_STATE_CHANGE_FAILURE; +@@ -871,6 +911,18 @@ gst_v4l2sink_set_caps (GstBaseSink * bsi + gst_caps_unref (caps); + return FALSE; + } ++ if (v4l2sink->gst_buf_array) { ++ /* TODO: if we've already allocated buffers, we probably need to ++ * do something here to free and reallocate.... ++ * ++ * gst_v4l2_object_stop_streaming() ++ * gst_v4l2_buffer_pool_destroy() ++ * ++ */ ++ GST_DEBUG_OBJECT (v4l2sink, "warning, changing caps not supported yet"); ++ gst_caps_unref (caps); ++ return FALSE; ++ } + + /* query to find if anyone upstream using these buffers has any + * minimum requirements: +@@ -1092,11 +1144,13 @@ gst_v4l2sink_show_frame (GstBaseSink * b + { + GstV4l2Sink *v4l2sink = GST_V4L2SINK (bsink); + GstBuffer *newbuf = NULL; ++ gint retval = 0; + + GST_DEBUG_OBJECT (v4l2sink, "render buffer: %p", buf); + +- if (!GST_IS_V4L2_BUFFER (buf)) { +- GstFlowReturn ret; ++ if(!v4l2sink->enableUserPtr){ ++ if (!GST_IS_V4L2_BUFFER (buf)) { ++ GstFlowReturn ret; + + /* special case check for sub-buffers: In certain cases, places like + * GstBaseTransform, which might check that the buffer is writable +@@ -1175,7 +1229,37 @@ gst_v4l2sink_show_frame (GstBaseSink * b + gst_buffer_unref (GST_BUFFER (v4l2buf)); + } + } ++ } ++ else { ++ /*configures the v4l2 to user pointer mode only once*/ ++ if(v4l2sink->gst_buf_array == NULL) { ++ v4l2sink->state = STATE_PENDING_STREAMON; ++ /*Initializes the driver to use userpointers*/ ++ retval = gst_v4l2sink_userpointer_init(bsink,v4l2sink); ++ if(retval > 0) { ++ GST_DEBUG_OBJECT (v4l2sink, "succeess fully initialized the driver for user pointer mode"); ++ } ++ else { ++ GST_DEBUG_OBJECT (v4l2sink, "failed to initialized the driver for user pointer mode"); ++ } ++ } ++ ++ /*Enqueues the buffer with v4l2*/ ++ gst_v4l2sink_enqueue_userpointer(v4l2sink,buf); ++ ++ if (v4l2sink->state == STATE_PENDING_STREAMON) { ++ GST_DEBUG_OBJECT (v4l2sink, "Start streaming"); ++ if (!gst_v4l2_object_start_streaming (v4l2sink->v4l2object)) { ++ GST_DEBUG_OBJECT (v4l2sink, "Failed to Start streaming"); ++ return GST_FLOW_ERROR; ++ } ++ v4l2sink->state = STATE_STREAMING; ++ } ++ ++ /*Dequeues the previous buffer from v4l2*/ ++ gst_v4l2sink_dequeue_userpointer(v4l2sink,1); + ++ } + return GST_FLOW_OK; + } + +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2sink.h gst-plugins-good-0.10.27/sys/v4l2/gstv4l2sink.h +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2sink.h 2011-10-01 16:53:07.057541000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/gstv4l2sink.h 2011-10-01 17:43:29.053291476 +0530 +@@ -78,6 +78,9 @@ struct _GstV4l2Sink { + guint8 state; + gint rotation; + gint flip; ++ GstBuffer **gst_buf_array; ++ gint queued_buff_count; ++ gboolean enableUserPtr; + }; + + struct _GstV4l2SinkClass { +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2_userpointer.c gst-plugins-good-0.10.27/sys/v4l2/gstv4l2_userpointer.c +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2_userpointer.c 1970-01-01 05:30:00.000000000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/gstv4l2_userpointer.c 2011-10-01 17:43:29.053291476 +0530 +@@ -0,0 +1,151 @@ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++ ++#include "gstv4l2colorbalance.h" ++#ifdef HAVE_XVIDEO ++#include "gstv4l2xoverlay.h" ++#endif ++#include "gstv4l2vidorient.h" ++ ++#include "gstv4l2sink.h" ++#include "gst/gst-i18n-plugin.h" ++ ++#include <string.h> ++#include "gstv4l2_userpointer.h" ++ ++gint ++gst_v4l2sink_userpointer_init(GstBaseSink * bsink,GstV4l2Sink * v4l2sink) ++{ ++ ++ gint retval = 0,i =0; ++ struct v4l2_requestbuffers reqbuf = {0}; ++ struct v4l2_format fmt = {0}; ++ ++ if(v4l2sink->gst_buf_array == NULL) { ++ fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ fmt.fmt.pix.width = v4l2sink->video_width; ++ fmt.fmt.pix.height = v4l2sink->video_height; ++ fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV; ++ retval = ioctl(v4l2sink->v4l2object->video_fd, VIDIOC_S_FMT, &fmt); ++ if(retval < 0) { ++ GST_DEBUG_OBJECT (v4l2sink, "ioctl for VIDIOC_S_FMT failed"); ++ return -1; ++ } ++ /* It is necessary for applications to know about the ++ * buffer chacteristics that are set by the driver for ++ * proper handling of buffers ++ * These are : width,height,pitch and image size */ ++ fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ retval = ioctl(v4l2sink->v4l2object->video_fd, VIDIOC_G_FMT, &fmt); ++ if(retval < 0) { ++ GST_DEBUG_OBJECT (v4l2sink, "ioctl for VIDIOC_G_FMT failed"); ++ return -2; ++ } ++ ++ memset (&reqbuf, 0, sizeof (struct v4l2_requestbuffers)); ++ reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ reqbuf.count = v4l2sink->num_buffers; ++ reqbuf.memory = V4L2_MEMORY_USERPTR; ++ ++ if ((retval = v4l2_ioctl(v4l2sink->v4l2object->video_fd, VIDIOC_REQBUFS, &reqbuf))) { ++ GST_DEBUG_OBJECT (v4l2sink, "ioctl for VIDIOC_REQBUFS FAILED"); ++ switch(errno) { ++ case EBUSY: ++ GST_DEBUG_OBJECT (v4l2sink, "Error : EBUSY"); ++ break; ++ case EINVAL: ++ GST_DEBUG_OBJECT (v4l2sink, "Error : EINVAL"); ++ break; ++ default: ++ GST_DEBUG_OBJECT (v4l2sink, "Error : unknown error"); ++ break; ++ }// switch ++ } // if ..ioctl.. ++ ++ v4l2sink->queued_buff_count = 0; ++ /* allocate a gst buffer array to hold the buffers given to v4l2 for display */ ++ v4l2sink->gst_buf_array = (GstBuffer **)malloc(sizeof(GstBuffer *)* (v4l2sink->num_buffers)); ++ for(i =0; i<v4l2sink->num_buffers;i++) { ++ v4l2sink->gst_buf_array[i] = NULL; ++ } ++ } ++ else { ++ GST_DEBUG_OBJECT (v4l2sink, "Driver is already initialized"); ++ } ++ return 1; ++} ++ ++void ++gst_v4l2sink_enqueue_userpointer(GstV4l2Sink * v4l2sink,GstBuffer * buf) ++{ ++ ++ gint i=0; ++ struct v4l2_buffer v4l2buffer = {0}; ++ ++ for(i =0; i<v4l2sink->num_buffers;i++) { ++ if(v4l2sink->gst_buf_array[i] == NULL) { ++ v4l2sink->gst_buf_array[i] = buf; ++ break; ++ } ++ } ++ ++ v4l2buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ v4l2buffer.memory = V4L2_MEMORY_USERPTR; ++ v4l2buffer.m.userptr = (unsigned long)GST_BUFFER_DATA(buf); ++ v4l2buffer.length = GST_BUFFER_SIZE(buf); ++ v4l2buffer.index = i; ++ ++ if (v4l2_ioctl (v4l2sink->v4l2object->video_fd, VIDIOC_QBUF, &v4l2buffer) < 0) { ++ GST_DEBUG_OBJECT (v4l2sink, "Queuing user buffer %p with v4l2 driver failed",buf); ++ v4l2sink->gst_buf_array[i] = NULL; ++ } ++ else { ++ GST_DEBUG_OBJECT (v4l2sink, "Queued user buffer %p with v4l2 driver",buf); ++ v4l2sink->queued_buff_count++; ++ /* add reference to the corresponding gst buffer so that upstream plugin ++ does not overwrites it while displaying */ ++ gst_buffer_ref (buf); ++ } ++} ++ ++void ++gst_v4l2sink_dequeue_userpointer(GstV4l2Sink * v4l2sink, int min_queue_count) ++{ ++ struct v4l2_buffer buffer = {0}; ++ memset (&buffer, 0x00, sizeof (buffer)); ++ buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ++ buffer.memory = V4L2_MEMORY_USERPTR; ++ ++ while(v4l2sink->queued_buff_count > min_queue_count) { ++ if(v4l2_ioctl (v4l2sink->v4l2object->video_fd, VIDIOC_DQBUF, &buffer) >= 0) { ++ GST_DEBUG_OBJECT (v4l2sink, "Dequeued the buffer: %p",v4l2sink->gst_buf_array[buffer.index]); ++ v4l2sink->queued_buff_count--; ++ /* unreference the corresponding gst buffer so that upstream plugin can access */ ++ if(v4l2sink->gst_buf_array[buffer.index]) ++ gst_buffer_unref(v4l2sink->gst_buf_array[buffer.index]); ++ ++ v4l2sink->gst_buf_array[buffer.index] = NULL; ++ } ++ else { ++ GST_DEBUG_OBJECT (v4l2sink, "Failed to dequeue the buffer"); ++ break; ++ } ++ } ++} ++ ++void ++gst_v4l2sink_userpointer_deinit(GstV4l2Sink * v4l2sink) ++{ ++ ++ if(v4l2sink->gst_buf_array) { ++ GST_DEBUG_OBJECT (v4l2sink, "Freeing the gst_buf_array"); ++ gst_v4l2sink_dequeue_userpointer(v4l2sink, 0); ++ free(v4l2sink->gst_buf_array); ++ v4l2sink->gst_buf_array = NULL; ++ } ++ ++} ++ ++ +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2_userpointer.h gst-plugins-good-0.10.27/sys/v4l2/gstv4l2_userpointer.h +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/gstv4l2_userpointer.h 1970-01-01 05:30:00.000000000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/gstv4l2_userpointer.h 2011-10-01 17:43:29.053291476 +0530 +@@ -0,0 +1,20 @@ ++#ifndef GSTV4L2SINK_USERPTR_H ++#define GSTV4L2SINK_USERPTR_H ++ ++#include <gst/video/gstvideosink.h> ++#include <gstv4l2object.h> ++#include <gstv4l2bufferpool.h> ++#include"gstv4l2sink.h" ++#include <stdlib.h> ++ ++ ++gint ++gst_v4l2sink_userpointer_init(GstBaseSink * ,GstV4l2Sink *); ++void ++gst_v4l2sink_enqueue_userpointer(GstV4l2Sink * ,GstBuffer * ); ++void ++gst_v4l2sink_dequeue_userpointer(GstV4l2Sink * , int ); ++void ++gst_v4l2sink_userpointer_deinit(GstV4l2Sink * ); ++ ++#endif +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/Makefile.am gst-plugins-good-0.10.27/sys/v4l2/Makefile.am +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/Makefile.am 2011-01-02 17:10:29.000000000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/Makefile.am 2011-10-01 17:43:29.053291476 +0530 +@@ -20,7 +20,8 @@ libgstvideo4linux2_la_SOURCES = gstv4l2. + $(xv_source) + + if BUILD_EXPERIMENTAL +-libgstvideo4linux2_la_SOURCES += gstv4l2sink.c ++libgstvideo4linux2_la_SOURCES += gstv4l2sink.c \ ++ gstv4l2_userpointer.c + endif + + libgstvideo4linux2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ +@@ -49,6 +50,7 @@ noinst_HEADERS = \ + gstv4l2bufferpool.h \ + gstv4l2colorbalance.h \ + gstv4l2object.h \ ++ gstv4l2_userpointer.h \ + gstv4l2sink.h \ + gstv4l2src.h \ + gstv4l2tuner.h \ +diff -Npru gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/Makefile.in gst-plugins-good-0.10.27/sys/v4l2/Makefile.in +--- gst-plugins-good-0.10.27_11_patch_applied/sys/v4l2/Makefile.in 2011-01-21 15:59:42.000000000 +0530 ++++ gst-plugins-good-0.10.27/sys/v4l2/Makefile.in 2011-10-01 17:43:29.053291476 +0530 +@@ -35,7 +35,7 @@ PRE_UNINSTALL = : + POST_UNINSTALL = : + build_triplet = @build@ + host_triplet = @host@ +-@BUILD_EXPERIMENTAL_TRUE@am__append_1 = gstv4l2sink.c ++@BUILD_EXPERIMENTAL_TRUE@am__append_1 = gstv4l2sink.c gstv4l2_userpointer.c + subdir = sys/v4l2 + DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +@@ -116,11 +116,11 @@ libgstvideo4linux2_la_DEPENDENCIES = $(a + am__libgstvideo4linux2_la_SOURCES_DIST = gstv4l2.c \ + gstv4l2colorbalance.c gstv4l2object.c gstv4l2bufferpool.c \ + gstv4l2src.c gstv4l2tuner.c gstv4l2vidorient.c v4l2_calls.c \ +- v4l2src_calls.c gstv4l2xoverlay.c gstv4l2sink.c ++ v4l2src_calls.c gstv4l2xoverlay.c gstv4l2sink.c gstv4l2_userpointer.c + @USE_XVIDEO_TRUE@am__objects_1 = \ + @USE_XVIDEO_TRUE@ libgstvideo4linux2_la-gstv4l2xoverlay.lo + @BUILD_EXPERIMENTAL_TRUE@am__objects_2 = \ +-@BUILD_EXPERIMENTAL_TRUE@ libgstvideo4linux2_la-gstv4l2sink.lo ++@BUILD_EXPERIMENTAL_TRUE@ libgstvideo4linux2_la-gstv4l2sink.lo libgstvideo4linux2_la-gstv4l2_userpointer.lo + am_libgstvideo4linux2_la_OBJECTS = libgstvideo4linux2_la-gstv4l2.lo \ + libgstvideo4linux2_la-gstv4l2colorbalance.lo \ + libgstvideo4linux2_la-gstv4l2object.lo \ +@@ -524,6 +524,7 @@ noinst_HEADERS = \ + gstv4l2bufferpool.h \ + gstv4l2colorbalance.h \ + gstv4l2object.h \ ++ gstv4l2_userpointer.h \ + gstv4l2sink.h \ + gstv4l2src.h \ + gstv4l2tuner.h \ +@@ -617,6 +618,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstvideo4linux2_la-gstv4l2xoverlay.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstvideo4linux2_la-v4l2_calls.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstvideo4linux2_la-v4l2src_calls.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstvideo4linux2_la-gstv4l2_userpointer.Plo@am__quote@ + + .c.o: + @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@@ -730,6 +732,15 @@ libgstvideo4linux2_la-gstv4l2sink.lo: gs + @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-gstv4l2sink.lo `test -f 'gstv4l2sink.c' || echo '$(srcdir)/'`gstv4l2sink.c + ++libgstvideo4linux2_la-gstv4l2_userpointer.lo: gstv4l2_userpointer.c ++@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -MT libgstvideo4linux2_la-gstv4l2_userpointer.lo -MD -MP -MF $(DEPDIR)/libgstvideo4linux2_la-gstv4l2_userpointer.Tpo -c -o libgstvideo4linux2_la-gstv4l2_userpointer.lo `test -f 'gstv4l2_userpointer.c' || echo '$(srcdir)/'`gstv4l2_userpointer.c ++@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libgstvideo4linux2_la-gstv4l2_userpointer.Tpo $(DEPDIR)/libgstvideo4linux2_la-gstv4l2_userpointer.Plo ++@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gstv4l2_userpointer.c' object='libgstvideo4linux2_la-gstv4l2_userpointer.lo' libtool=yes @AMDEPBACKSLASH@ ++@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(libgstvideo4linux2_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstvideo4linux2_la_CFLAGS) $(CFLAGS) -c -o libgstvideo4linux2_la-gstv4l2_userpointer.lo `test -f 'gstv4l2_userpointer.c' || echo '$(srcdir)/'`gstv4l2_userpointer.c ++ ++ + mostlyclean-libtool: + -rm -f *.lo + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-ugly-0.10.16/0001-Optimize-the-mad-element-to-output-16-bit-samples-in.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-ugly-0.10.16/0001-Optimize-the-mad-element-to-output-16-bit-samples-in.patch new file mode 100644 index 0000000..212b52d --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gst-plugins-ugly-0.10.16/0001-Optimize-the-mad-element-to-output-16-bit-samples-in.patch @@ -0,0 +1,164 @@ +From 5a59f493be6ada7d7ef1bff54b30c9272d4635ba Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Tue, 12 Oct 2010 18:51:05 -0500 +Subject: [PATCH] Optimize the mad element to output 16-bit samples instead of 32. + +Doing this with audiocovert causes too much overhead, so we're doing this +in the mad plugin itself. This patch is only needed when the driver doesn't +support 32-bit audio (oss), and it is only applied by the build when ALSA +support is disabled. +--- + ext/mad/gstmad.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 files changed, 54 insertions(+), 1 deletions(-) + +diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c +index ec41369..c7ba2b4 100644 +--- a/ext/mad/gstmad.c ++++ b/ext/mad/gstmad.c +@@ -40,6 +40,8 @@ + #include "gstmad.h" + #include <gst/audio/audio.h> + ++#define ENABLE_16BIT_SUPPORT ++ + enum + { + ARG_0, +@@ -57,8 +59,13 @@ GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_CAPS ("audio/x-raw-int, " + "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", " + "signed = (boolean) true, " ++#ifdef ENABLE_16BIT_SUPPORT ++ "width = (int) 16, " ++ "depth = (int) 16, " ++#else + "width = (int) 32, " + "depth = (int) 32, " ++#endif + "rate = (int) { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }, " + "channels = (int) [ 1, 2 ]") + ); +@@ -394,7 +401,11 @@ gst_mad_convert_src (GstPad * pad, GstFormat src_format, gint64 src_value, + + mad = GST_MAD (GST_PAD_PARENT (pad)); + ++#ifdef ENABLE_16BIT_SUPPORT ++ bytes_per_sample = mad->channels * 2; ++#else + bytes_per_sample = mad->channels * 4; ++#endif + + switch (src_format) { + case GST_FORMAT_BYTES: +@@ -819,6 +830,19 @@ gst_mad_src_event (GstPad * pad, GstEvent * event) + static inline gint32 + scale (mad_fixed_t sample) + { ++#ifdef ENABLE_16BIT_SUPPORT ++ /* round */ ++ sample += (1L << (MAD_F_FRACBITS - 16)); ++ ++ /* clip */ ++ if (sample >= MAD_F_ONE) ++ sample = MAD_F_ONE - 1; ++ else if (sample < -MAD_F_ONE) ++ sample = -MAD_F_ONE; ++ ++ /* quantize */ ++ return sample >> (MAD_F_FRACBITS + 1 - 16); ++#else + #if MAD_F_FRACBITS < 28 + /* round */ + sample += (1L << (28 - MAD_F_FRACBITS - 1)); +@@ -837,6 +861,7 @@ scale (mad_fixed_t sample) + + /* convert from 29 bits to 32 bits */ + return (gint32) (sample << 3); ++#endif + } + + /* do we need this function? */ +@@ -1243,8 +1268,13 @@ gst_mad_check_caps_reset (GstMad * mad) + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "signed", G_TYPE_BOOLEAN, TRUE, ++#ifdef ENABLE_16BIT_SUPPORT ++ "width", G_TYPE_INT, 16, ++ "depth", G_TYPE_INT, 16, ++#else + "width", G_TYPE_INT, 32, + "depth", G_TYPE_INT, 32, ++#endif + "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, nchannels, NULL); + + gst_pad_set_caps (mad->srcpad, caps); +@@ -1565,7 +1595,11 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) + to skip and send the remaining pcm samples */ + + GstBuffer *outbuffer = NULL; ++#ifdef ENABLE_16BIT_SUPPORT ++ gint16 *outdata; ++#else + gint32 *outdata; ++#endif + mad_fixed_t const *left_ch, *right_ch; + + if (mad->need_newsegment) { +@@ -1594,10 +1628,17 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) + } + + /* will attach the caps to the buffer */ ++#ifdef ENABLE_16BIT_SUPPORT ++ result = ++ gst_pad_alloc_buffer_and_set_caps (mad->srcpad, 0, ++ nsamples * mad->channels * 2, GST_PAD_CAPS (mad->srcpad), ++ &outbuffer); ++#else + result = + gst_pad_alloc_buffer_and_set_caps (mad->srcpad, 0, + nsamples * mad->channels * 4, GST_PAD_CAPS (mad->srcpad), + &outbuffer); ++#endif + if (result != GST_FLOW_OK) { + /* Head for the exit, dropping samples as we go */ + GST_LOG ("Skipping frame synthesis due to pad_alloc return value"); +@@ -1608,8 +1649,11 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) + mad_synth_frame (&mad->synth, &mad->frame); + left_ch = mad->synth.pcm.samples[0]; + right_ch = mad->synth.pcm.samples[1]; +- ++#ifdef ENABLE_16BIT_SUPPORT ++ outdata = (gint16 *) GST_BUFFER_DATA (outbuffer); ++#else + outdata = (gint32 *) GST_BUFFER_DATA (outbuffer); ++#endif + + GST_DEBUG ("mad out timestamp %" GST_TIME_FORMAT " dur: %" + GST_TIME_FORMAT, GST_TIME_ARGS (time_offset), +@@ -1625,14 +1669,23 @@ gst_mad_chain (GstPad * pad, GstBuffer * buffer) + gint count = nsamples; + + while (count--) { ++#ifdef ENABLE_16BIT_SUPPORT ++ *outdata++ = scale (*left_ch++) & 0xffff; ++#else + *outdata++ = scale (*left_ch++) & 0xffffffff; ++#endif + } + } else { + gint count = nsamples; + + while (count--) { ++#ifdef ENABLE_16BIT_SUPPORT ++ *outdata++ = scale (*left_ch++) & 0xffff; ++ *outdata++ = scale (*right_ch++) & 0xffff; ++#else + *outdata++ = scale (*left_ch++) & 0xffffffff; + *outdata++ = scale (*right_ch++) & 0xffffffff; ++#endif + } + } + +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.30/0001-Disable-last-buffer-feature-by-default.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.30/0001-Disable-last-buffer-feature-by-default.patch new file mode 100644 index 0000000..8c50b8c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.30/0001-Disable-last-buffer-feature-by-default.patch @@ -0,0 +1,31 @@ +From 5181d86f3c199c9aa79700868b39bcb0f5589214 Mon Sep 17 00:00:00 2001 +From: Don Darling <ddarling@ti.com> +Date: Thu, 16 Sep 2010 17:47:48 -0500 +Subject: [PATCH] Disable last buffer feature by default. + +We need CMEM buffers to be released as soon as possible. + +We probably don't need to patch the gstreamer library anymore to disable this +feature. We should look to see if there is a way to override the default +behavior in the derived class (TIDmaiVideoSink). In previous releases, this +feature couldn't be disabled with a property, so we needed to patch the code. +--- + libs/gst/base/gstbasesink.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c +index 13e4944..27ee474 100644 +--- a/libs/gst/base/gstbasesink.c ++++ b/libs/gst/base/gstbasesink.c +@@ -282,7 +282,7 @@ struct _GstBaseSinkPrivate + #define DEFAULT_TS_OFFSET 0 + #define DEFAULT_BLOCKSIZE 4096 + #define DEFAULT_RENDER_DELAY 0 +-#define DEFAULT_ENABLE_LAST_BUFFER TRUE ++#define DEFAULT_ENABLE_LAST_BUFFER FALSE + + enum + { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0001-gst-launch-add-loop-argument.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0001-gst-launch-add-loop-argument.patch new file mode 100644 index 0000000..4e729f8 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0001-gst-launch-add-loop-argument.patch @@ -0,0 +1,54 @@ +From 23dbd4ce2e492152a4d21b8043f353d224dfe355 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sat, 13 Feb 2010 15:29:13 -0600 +Subject: [PATCH 1/5] gst-launch: add --loop argument + +if --loop is specified, automatically seek to beginning of clip when EOS is received +--- + tools/gst-launch.c | 16 +++++++++++++++- + 1 files changed, 15 insertions(+), 1 deletions(-) + +diff --git a/tools/gst-launch.c b/tools/gst-launch.c +index 10b7fae..d5b17f8 100644 +--- a/tools/gst-launch.c ++++ b/tools/gst-launch.c +@@ -716,6 +716,7 @@ main (int argc, char *argv[]) + gboolean no_sigusr_handler = FALSE; + gboolean trace = FALSE; + gboolean eos_on_shutdown = FALSE; ++ gboolean loop = FALSE; + gchar *savefile = NULL; + gchar *exclude_args = NULL; + #ifndef GST_DISABLE_OPTION_PARSING +@@ -742,6 +743,8 @@ main (int argc, char *argv[]) + N_("Print alloc trace (if enabled at compile time)"), NULL}, + {"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown, + N_("Force EOS on sources before shutting the pipeline down"), NULL}, ++ {"loop", 'l', 0, G_OPTION_ARG_NONE, &loop, ++ N_("Repeat clip in loop without rebuilding pipeline"), NULL}, + GST_TOOLS_GOPTION_VERSION, + {NULL} + }; +@@ -926,7 +929,18 @@ main (int argc, char *argv[]) + } + + tfthen = gst_util_get_timestamp (); +- caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); ++ do { ++ caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); ++ if (loop && (caught_error == ELR_NO_ERROR)) { ++ PRINT (_("Looping ...\n")); ++ gst_element_seek (pipeline, 1.0, ++ GST_FORMAT_TIME, ++ GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, ++ GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); ++ } else { ++ break; ++ } ++ } while (TRUE); + if (eos_on_shutdown && caught_error == ELR_INTERRUPT) { + PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n")); + waiting_eos = TRUE; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch new file mode 100644 index 0000000..817eae2 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch @@ -0,0 +1,262 @@ +From ac55210758bdd06fe0dec6ef67a60a96a86b39f4 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Sun, 4 Apr 2010 09:14:34 -0500 +Subject: [PATCH 2/5] Changes to make it possible to LD_PRELOAD libttif + +1) if GST_USING_PRINTF_EXTENSION, then prepend the fmt string with "<%P> " and +pass object as a normal arg. When using TTIF, you want the whole fmt string, +including the object name prefix, to be constant. This way, only the fmt +string pointer needs to be logged. +2) GstDebugTraceLocation: small optimization to stash __FILE__, __LINE__, and +GST_FUNCTION together and pass as a single ptr.. the optimization is probably +lost in the noise with the default printf() based traces, but makes more of a +difference with faster trace systems +--- + gst/gstinfo.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++----- + gst/gstinfo.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 123 insertions(+), 11 deletions(-) + +diff --git a/gst/gstinfo.c b/gst/gstinfo.c +index 3688120..dfa8650 100644 +--- a/gst/gstinfo.c ++++ b/gst/gstinfo.c +@@ -494,6 +494,31 @@ gst_path_basename (const gchar * file_name) + #endif + + /** ++ * gst_debug_log2: ++ * @category: category to log ++ * @level: level of the message is in ++ * @location: the file, function name, and line number of the location that ++ * emitted the message ++ * @object: the object this message relates to or NULL if none ++ * @format: a printf style format string ++ * @...: optional arguments for the format ++ * ++ * Logs the given message using the currently registered debugging handlers. ++ */ ++void ++gst_debug_log2 (GstDebugCategory * category, GstDebugLevel level, ++ const GstDebugTraceLocation * location, ++ GObject * object, const gchar * format, ...) ++{ ++ va_list var_args; ++ ++ va_start (var_args, format); ++ gst_debug_log_valist2 (category, level, location, object, format, var_args); ++ va_end (var_args); ++} ++ ++ ++/** + * gst_debug_log_valist: + * @category: category to log + * @level: level of the message is in +@@ -512,13 +537,39 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level, + const gchar * file, const gchar * function, gint line, + GObject * object, const gchar * format, va_list args) + { ++ GstDebugTraceLocation location = { ++ .file = file, ++ .function = function, ++ .line = line ++ }; ++ gst_debug_log_valist2 (category, level, &location, object, format, args); ++} ++ ++/** ++ * gst_debug_log_valist2: ++ * @category: category to log ++ * @level: level of the message is in ++ * @location: the file, function name, and line number of the location that ++ * emitted the message ++ * @object: the object this message relates to or NULL if none ++ * @format: a printf style format string ++ * @args: optional arguments for the format ++ * ++ * Logs the given message using the currently registered debugging handlers. ++ */ ++void ++gst_debug_log_valist2 (GstDebugCategory * category, GstDebugLevel level, ++ const GstDebugTraceLocation * location, ++ GObject * object, const gchar * format, va_list args) ++{ + GstDebugMessage message; + LogFuncEntry *entry; + GSList *handler; + + g_return_if_fail (category != NULL); +- g_return_if_fail (file != NULL); +- g_return_if_fail (function != NULL); ++ g_return_if_fail (location != NULL); ++ g_return_if_fail (location->file != NULL); ++ g_return_if_fail (location->function != NULL); + g_return_if_fail (format != NULL); + + /* The predefined macro __FILE__ is always the exact path given to the +@@ -536,8 +587,9 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level, + while (handler) { + entry = handler->data; + handler = g_slist_next (handler); +- entry->func (category, level, file, function, line, object, &message, +- entry->user_data); ++ // TODO: change GstLogFunction and pass GstDebugTraceLocation ptr instead.. ++ entry->func (category, level, location->file, location->function, ++ location->line, object, &message, entry->user_data); + } + g_free (message.message); + va_end (message.arguments); +@@ -610,7 +662,7 @@ gst_info_structure_to_string (GstStructure * s) + return gst_structure_to_string (s); + } + +-static gchar * ++gchar * + gst_debug_print_object (gpointer ptr) + { + GObject *object = (GObject *) ptr; +@@ -708,7 +760,7 @@ gst_debug_print_object (gpointer ptr) + + #ifdef HAVE_PRINTF_EXTENSION + +-static gchar * ++gchar * + gst_debug_print_segment (gpointer ptr) + { + GstSegment *segment = (GstSegment *) ptr; +diff --git a/gst/gstinfo.h b/gst/gstinfo.h +index 7c2d86f..24ca706 100644 +--- a/gst/gstinfo.h ++++ b/gst/gstinfo.h +@@ -177,6 +177,8 @@ struct _GstDebugCategory { + + const gchar * name; + const gchar * description; ++ ++ void *ext; /**< for use by LD_PRELOADED trace extension */ + }; + + /********** some convenience macros for debugging **********/ +@@ -260,6 +262,14 @@ typedef void (*GstLogFunction) (GstDebugCategory * category, + /* FIXME 0.11: move this into private headers */ + void _gst_debug_init (void); + ++typedef struct { ++ const gchar *file; ++ const gchar *function; ++ const gint line; ++} GstDebugTraceLocation; ++ ++#define GST_DEBUG_TRACE_LOCATION() \ ++ { __FILE__, GST_FUNCTION, __LINE__ } + + #ifdef GST_USING_PRINTF_EXTENSION + +@@ -273,6 +283,13 @@ void gst_debug_log (GstDebugCategory * category, + const gchar * format, + ...) G_GNUC_NO_INSTRUMENT; + ++void gst_debug_log2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ ...) G_GNUC_NO_INSTRUMENT; ++ + #else /* GST_USING_PRINTF_EXTENSION */ + + void gst_debug_log (GstDebugCategory * category, +@@ -284,6 +301,13 @@ void gst_debug_log (GstDebugCategory * category, + const gchar * format, + ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT; + ++void gst_debug_log2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ ...) G_GNUC_PRINTF (5, 6) G_GNUC_NO_INSTRUMENT; ++ + #endif /* GST_USING_PRINTF_EXTENSION */ + + void gst_debug_log_valist (GstDebugCategory * category, +@@ -321,8 +345,21 @@ G_CONST_RETURN gchar * + _gst_debug_nameof_funcptr (GstDebugFuncPtr func) G_GNUC_NO_INSTRUMENT; + + ++void gst_debug_log_valist2 (GstDebugCategory * category, ++ GstDebugLevel level, ++ const GstDebugTraceLocation *location, ++ GObject * object, ++ const gchar * format, ++ va_list args) G_GNUC_NO_INSTRUMENT; ++ + const gchar * gst_debug_message_get (GstDebugMessage * message); + ++gchar * gst_debug_print_object (gpointer ptr); ++ ++#ifdef HAVE_PRINTF_EXTENSION ++gchar * gst_debug_print_segment (gpointer ptr); ++#endif ++ + void gst_debug_log_default (GstDebugCategory * category, + GstDebugLevel level, + const gchar * file, +@@ -495,19 +532,41 @@ GST_EXPORT GstDebugLevel __gst_debug_min; + * debugging messages. You will probably want to use one of the ones described + * below. + */ ++#if defined(GST_USING_PRINTF_EXTENSION) && defined(G_HAVE_GNUC_VARARGS) ++#define GST_CAT_LEVEL_LOG_obj(cat,level,object,str,args...) G_STMT_START{ \ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, NULL, "%"GST_PTR_FORMAT" "str, \ ++ (object), ##args ); \ ++ } \ ++}G_STMT_END ++#define GST_CAT_LEVEL_LOG_noobj(cat,level,object,str,args...) G_STMT_START{\ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, NULL, (str), ##args ); \ ++ } \ ++}G_STMT_END ++#else ++# define GST_CAT_LEVEL_LOG_obj GST_CAT_LEVEL_LOG ++# define GST_CAT_LEVEL_LOG_noobj GST_CAT_LEVEL_LOG ++#endif ++ ++ + #ifdef G_HAVE_ISO_VARARGS + #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{ \ +- if (G_UNLIKELY (level <= __gst_debug_min)) { \ +- gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ +- (GObject *) (object), __VA_ARGS__); \ ++ if (G_UNLIKELY (level <= __gst_debug_min)) { \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, (GObject *) (object), \ ++ __VA_ARGS__); \ + } \ + }G_STMT_END + #else /* G_HAVE_GNUC_VARARGS */ + #ifdef G_HAVE_GNUC_VARARGS + #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{ \ + if (G_UNLIKELY (level <= __gst_debug_min)) { \ +- gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__, \ +- (GObject *) (object), ##args ); \ ++ const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION(); \ ++ gst_debug_log2 ((cat), (level), &loc, (GObject *) (object), \ ++ ##args ); \ + } \ + }G_STMT_END + #else /* no variadic macros, use inline */ +@@ -1244,6 +1303,7 @@ GST_TRACE (const char *format, ...) + + #if defined(__GNUC__) && __GNUC__ >= 3 + # pragma GCC poison gst_debug_log ++# pragma GCC poison gst_debug_log2 + # pragma GCC poison gst_debug_log_valist + # pragma GCC poison _gst_debug_category_new + #endif +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0003-add-GstQueryBuffers-query.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0003-add-GstQueryBuffers-query.patch new file mode 100644 index 0000000..d36a1b5 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0003-add-GstQueryBuffers-query.patch @@ -0,0 +1,258 @@ +From 7f071cf72491a9f60c886f4779c7d14d924bc43d Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 19 May 2010 15:48:09 -0500 +Subject: [PATCH 3/5] add GstQueryBuffers query + +This query is used by buffer allocator, for example a video sink element, +to find out any minimum buffer requirements of upstream elements that uses +pad_alloc() to allocate buffers. For example, some cameras may have need +for additional padding/boarder around the frame (for vstab), or some video +decoders may have requirements for a certain minimum number of buffers (so +they can hold refs to reference-frames) +--- + gst/gstquark.c | 3 +- + gst/gstquark.h | 7 ++- + gst/gstquery.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + gst/gstquery.h | 16 ++++++- + 4 files changed, 164 insertions(+), 3 deletions(-) + +diff --git a/gst/gstquark.c b/gst/gstquark.c +index 4073eb4..58badca 100644 +--- a/gst/gstquark.c ++++ b/gst/gstquark.c +@@ -49,7 +49,8 @@ static const gchar *_quark_strings[] = { + "GstQueryURI", "GstEventStep", "GstMessageStepDone", "amount", "flush", + "intermediate", "GstMessageStepStart", "active", "eos", "sink-message", + "message", "GstMessageQOS", "running-time", "stream-time", "jitter", +- "quality", "processed", "dropped", "buffering-ranges" ++ "quality", "processed", "dropped", "buffering-ranges", "GstQueryBuffers", ++ "caps", "count", "width", "height" + }; + + GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +diff --git a/gst/gstquark.h b/gst/gstquark.h +index c95d9cd..f4c8e0f 100644 +--- a/gst/gstquark.h ++++ b/gst/gstquark.h +@@ -127,8 +127,13 @@ typedef enum _GstQuarkId + GST_QUARK_PROCESSED = 98, + GST_QUARK_DROPPED = 99, + GST_QUARK_BUFFERING_RANGES = 100, ++ GST_QUARK_QUERY_BUFFERS = 101, ++ GST_QUARK_CAPS = 102, ++ GST_QUARK_COUNT = 103, ++ GST_QUARK_WIDTH = 104, ++ GST_QUARK_HEIGHT = 105, + +- GST_QUARK_MAX = 101 ++ GST_QUARK_MAX = 106 + } GstQuarkId; + + extern GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +diff --git a/gst/gstquery.c b/gst/gstquery.c +index 9373175..4823ff0 100644 +--- a/gst/gstquery.c ++++ b/gst/gstquery.c +@@ -96,6 +96,7 @@ static GstQueryTypeDefinition standard_definitions[] = { + {GST_QUERY_BUFFERING, "buffering", "Buffering status", 0}, + {GST_QUERY_CUSTOM, "custom", "Custom query", 0}, + {GST_QUERY_URI, "uri", "URI of the source or sink", 0}, ++ {GST_QUERY_BUFFERS, "buffers", "Minimum buffer requirements", 0}, + {0, NULL, NULL, 0} + }; + +@@ -1480,3 +1481,143 @@ gst_query_parse_uri (GstQuery * query, gchar ** uri) + *uri = g_value_dup_string (gst_structure_id_get_value (query->structure, + GST_QUARK (URI))); + } ++ ++/** ++ * gst_query_new_buffers: ++ * @caps: the #GstCaps for the buffers that are going to be allocated ++ * ++ * Constructs a new buffer requirements query object to query buffer ++ * requirements for a particular caps. Use gst_query_unref() when done ++ * with it. ++ * ++ * Returns: A #GstQuery ++ */ ++GstQuery * ++gst_query_new_buffers (GstCaps * caps) ++{ ++ GstQuery *query; ++ GstStructure *structure; ++ ++ /* XXX could add size here, for linear (non YUV/RGB) buffers? But I'm not ++ * entirely sure what is the use-case for that.. it should be easy enough ++ * to add more optional reply fields later ++ */ ++ structure = gst_structure_id_new (GST_QUARK (QUERY_BUFFERS), ++ GST_QUARK (CAPS), GST_TYPE_CAPS, caps, ++ GST_QUARK (COUNT), G_TYPE_INT, -1, ++ GST_QUARK (WIDTH), G_TYPE_INT, -1, ++ GST_QUARK (HEIGHT), G_TYPE_INT, -1, NULL); ++ ++ query = gst_query_new (GST_QUERY_BUFFERS, structure); ++ ++ return query; ++} ++ ++/** ++ * gst_query_set_buffers_count: ++ * @count: minimum number of buffers required ++ * ++ * Answer a buffers query by setting the minimum number of buffers required. ++ * If there is no minimum buffer count requirement, don't set this field in ++ * the query. ++ */ ++void ++gst_query_set_buffers_count (GstQuery * query, gint count) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ gst_structure_id_set (structure, GST_QUARK (COUNT), G_TYPE_INT, count, NULL); ++} ++ ++/** ++ * gst_query_set_buffers_dimensions: ++ * @width: minimum buffer width ++ * @height: minimum buffer height ++ * ++ * Answer a buffers query by setting the minimum buffer dimensions required. ++ * If there is no minimum buffer dimensions (beyond the width/height specified ++ * in the #GstCaps), don't set this field in the query. ++ */ ++void ++gst_query_set_buffers_dimensions (GstQuery * query, gint width, gint height) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ gst_structure_id_set (structure, ++ GST_QUARK (WIDTH), G_TYPE_INT, width, ++ GST_QUARK (HEIGHT), G_TYPE_INT, height, NULL); ++} ++ ++/** ++ * gst_query_parse_buffers_caps: ++ * @query: a #GstQuery ++ * @caps: the storage for the #GstCaps pointer, or NULL ++ * ++ * Parse a buffers query. ++ */ ++void ++gst_query_parse_buffers_caps (GstQuery * query, const GstCaps ** caps) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ if (caps) ++ *caps = gst_value_get_caps (gst_structure_id_get_value (structure, ++ GST_QUARK (CAPS))); ++} ++ ++/** ++ * gst_query_parse_buffers_count: ++ * @query: a #GstQuery ++ * @count: the storage for minimum number of buffers, or NULL ++ * ++ * Parse a buffers query answer to see the minimum number of buffers ++ * required. A returned value of -1 means there is no minimum requirement ++ */ ++void ++gst_query_parse_buffers_count (GstQuery * query, gint * count) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ if (count) ++ *count = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (COUNT))); ++} ++ ++/** ++ * gst_query_parse_buffers_dimensions: ++ * @query: a #GstQuery ++ * @width: the storage for minimum width, or NULL ++ * @height: the storage for minimum height, or NULL ++ * ++ * Parse a buffers query answer to see the minimum buffer dimensions required. ++ * A returned value of -1 for either dimension means there is no minimum ++ * requirement in that axis ++ */ ++void ++gst_query_parse_buffers_dimensions (GstQuery * query, gint * width, ++ gint * height) ++{ ++ GstStructure *structure; ++ ++ g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS); ++ ++ structure = gst_query_get_structure (query); ++ if (width) ++ *width = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (WIDTH))); ++ if (height) ++ *height = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (HEIGHT))); ++} +diff --git a/gst/gstquery.h b/gst/gstquery.h +index 09d0225..ae1f5cd 100644 +--- a/gst/gstquery.h ++++ b/gst/gstquery.h +@@ -31,6 +31,7 @@ + #include <gst/gstminiobject.h> + #include <gst/gststructure.h> + #include <gst/gstformat.h> ++#include <gst/gstcaps.h> + + G_BEGIN_DECLS + +@@ -51,6 +52,9 @@ G_BEGIN_DECLS + * @GST_QUERY_CUSTOM: a custom application or element defined query. Since + * 0.10.22. + * @GST_QUERY_URI: query the URI of the source or sink. Since 0.10.22. ++ * @GST_QUERY_BUFFERS: query the upstream users of pad_alloc()'d buffers to ++ * find any particular requirements about buffer size (padding) or numbers of ++ * buffers. Since ?.?.?. + * + * Standard predefined Query types + */ +@@ -69,7 +73,8 @@ typedef enum { + GST_QUERY_FORMATS, + GST_QUERY_BUFFERING, + GST_QUERY_CUSTOM, +- GST_QUERY_URI ++ GST_QUERY_URI, ++ GST_QUERY_BUFFERS + } GstQueryType; + + /** +@@ -336,6 +341,15 @@ GstQuery * gst_query_new_uri (void); + void gst_query_parse_uri (GstQuery *query, gchar **uri); + void gst_query_set_uri (GstQuery *query, const gchar *uri); + ++/* buffer requirements query */ ++GstQuery * gst_query_new_buffers (GstCaps * caps); ++void gst_query_set_buffers_count (GstQuery * query, gint count); ++void gst_query_set_buffers_dimensions (GstQuery * query, gint width, gint height); ++void gst_query_parse_buffers_caps (GstQuery * query, const GstCaps ** caps); ++void gst_query_parse_buffers_count (GstQuery * query, gint * count); ++void gst_query_parse_buffers_dimensions (GstQuery * query, gint * width, gint * height); ++ ++ + G_END_DECLS + + #endif /* __GST_QUERY_H__ */ +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0004-Add-GstEventCrop-event.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0004-Add-GstEventCrop-event.patch new file mode 100644 index 0000000..4a1986b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0004-Add-GstEventCrop-event.patch @@ -0,0 +1,161 @@ +From 20378daaef4f4adb36d879879d6ab6d007a82636 Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Mon, 24 May 2010 16:49:20 -0500 +Subject: [PATCH 4/5] Add GstEventCrop event + +This event can be used to set cropping / region-of-interest to take effect +on the following buffer. +--- + gst/gstevent.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + gst/gstevent.h | 11 +++++++++ + gst/gstquark.c | 2 +- + gst/gstquark.h | 5 +++- + 4 files changed, 79 insertions(+), 2 deletions(-) + +diff --git a/gst/gstevent.c b/gst/gstevent.c +index 6d2cc8b..d04df79 100644 +--- a/gst/gstevent.c ++++ b/gst/gstevent.c +@@ -116,6 +116,7 @@ static GstEventQuarks event_quarks[] = { + {GST_EVENT_TAG, "tag", 0}, + {GST_EVENT_BUFFERSIZE, "buffersize", 0}, + {GST_EVENT_SINK_MESSAGE, "sink-message", 0}, ++ {GST_EVENT_CROP, "crop", 0}, + {GST_EVENT_QOS, "qos", 0}, + {GST_EVENT_SEEK, "seek", 0}, + {GST_EVENT_NAVIGATION, "navigation", 0}, +@@ -1231,3 +1232,65 @@ gst_event_parse_sink_message (GstEvent * event, GstMessage ** msg) + GST_MESSAGE (gst_value_dup_mini_object (gst_structure_id_get_value + (event->structure, GST_QUARK (MESSAGE)))); + } ++ ++/** ++ * gst_event_new_crop: ++ * @top: the new offset to top of sub-image ++ * @left: the new offset to left of sub-image ++ * @width: the new width ++ * @height: the new height ++ * ++ * Create a new crop event. ++ */ ++GstEvent * ++gst_event_new_crop (gint top, gint left, gint width, gint height) ++{ ++ GstEvent *event; ++ GstStructure *structure; ++ ++ GST_CAT_INFO (GST_CAT_EVENT, "creating crop event: %d,%d %dx%d", ++ top, left, width, height); ++ ++ structure = gst_structure_id_new (GST_QUARK (EVENT_CROP), ++ GST_QUARK (TOP), G_TYPE_INT, top, ++ GST_QUARK (LEFT), G_TYPE_INT, left, ++ GST_QUARK (WIDTH), G_TYPE_INT, width, ++ GST_QUARK (HEIGHT), G_TYPE_INT, height, NULL); ++ event = gst_event_new_custom (GST_EVENT_CROP, structure); ++ ++ return event; ++} ++ ++/** ++ * gst_event_parse_crop: ++ * @event: The event to query ++ * @top: A pointer to store top offset in ++ * @left: A pointer to store left offset in ++ * @width: A pointer to store width in ++ * @height: A pointer to store height in ++ * ++ * Parse the crop event. ++ */ ++void ++gst_event_parse_crop (GstEvent * event, gint * top, gint * left, ++ gint * width, gint * height) ++{ ++ const GstStructure *structure; ++ ++ g_return_if_fail (GST_IS_EVENT (event)); ++ g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_CROP); ++ ++ structure = gst_event_get_structure (event); ++ if (top) ++ *top = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (TOP))); ++ if (left) ++ *left = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (LEFT))); ++ if (width) ++ *width = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (WIDTH))); ++ if (height) ++ *height = g_value_get_int (gst_structure_id_get_value (structure, ++ GST_QUARK (HEIGHT))); ++} +diff --git a/gst/gstevent.h b/gst/gstevent.h +index 9568514..ae08829 100644 +--- a/gst/gstevent.h ++++ b/gst/gstevent.h +@@ -93,6 +93,10 @@ typedef enum { + * @GST_EVENT_SINK_MESSAGE: An event that sinks turn into a message. Used to + * send messages that should be emitted in sync with + * rendering. ++ * @GST_EVENT_CROP: An event that can set horizontal (pan/scan) and vertical ++ * (tilt/scan) offset and width/height within a larger ++ * image. This event precedes the buffer to which it ++ * applies. + * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements + * that the downstream elements are being starved of or + * flooded with data. +@@ -133,6 +137,7 @@ typedef enum { + GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (7, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)), + GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (8, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)), + GST_EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (9, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)), ++ GST_EVENT_CROP = GST_EVENT_MAKE_TYPE (10, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)), + /* upstream events */ + GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (15, FLAG(UPSTREAM)), + GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (16, FLAG(UPSTREAM)), +@@ -484,6 +489,12 @@ GstEvent* gst_event_new_step (GstFormat format, guint64 amoun + void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount, + gdouble *rate, gboolean *flush, gboolean *intermediate); + ++/* crop event */ ++GstEvent * gst_event_new_crop (gint top, gint left, gint width, gint height); ++void gst_event_parse_crop (GstEvent * event, gint * top, gint * left, ++ gint * width, gint * height); ++ ++ + G_END_DECLS + + #endif /* __GST_EVENT_H__ */ +diff --git a/gst/gstquark.c b/gst/gstquark.c +index 58badca..f8716cc 100644 +--- a/gst/gstquark.c ++++ b/gst/gstquark.c +@@ -50,7 +50,7 @@ static const gchar *_quark_strings[] = { + "intermediate", "GstMessageStepStart", "active", "eos", "sink-message", + "message", "GstMessageQOS", "running-time", "stream-time", "jitter", + "quality", "processed", "dropped", "buffering-ranges", "GstQueryBuffers", +- "caps", "count", "width", "height" ++ "caps", "count", "width", "height", "GstEventCrop", "top", "left" + }; + + GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +diff --git a/gst/gstquark.h b/gst/gstquark.h +index f4c8e0f..6eeb77f 100644 +--- a/gst/gstquark.h ++++ b/gst/gstquark.h +@@ -132,8 +132,11 @@ typedef enum _GstQuarkId + GST_QUARK_COUNT = 103, + GST_QUARK_WIDTH = 104, + GST_QUARK_HEIGHT = 105, ++ GST_QUARK_EVENT_CROP = 106, ++ GST_QUARK_TOP = 107, ++ GST_QUARK_LEFT = 108, + +- GST_QUARK_MAX = 106 ++ GST_QUARK_MAX = 109 + } GstQuarkId; + + extern GQuark _priv_gst_quark_table[GST_QUARK_MAX]; +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0005-basetransform-don-t-do-unnecessary-pad_alloc.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0005-basetransform-don-t-do-unnecessary-pad_alloc.patch new file mode 100644 index 0000000..cc2b14c --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/gstreamer-0.10.32/0005-basetransform-don-t-do-unnecessary-pad_alloc.patch @@ -0,0 +1,52 @@ +From 45650b7b1dfcaaa2b165a6d263b6dc74449c501c Mon Sep 17 00:00:00 2001 +From: Rob Clark <rob@ti.com> +Date: Wed, 26 May 2010 14:42:40 -0500 +Subject: [PATCH 5/5] basetransform: don't do unnecessary pad_alloc() + +Don't allocate a buffer in passthrough mode. +--- + libs/gst/base/gstbasetransform.c | 28 ++++++++++++++++++++-------- + 1 files changed, 20 insertions(+), 8 deletions(-) + +diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c +index 57192ab..1416b8e 100644 +--- a/libs/gst/base/gstbasetransform.c ++++ b/libs/gst/base/gstbasetransform.c +@@ -2188,14 +2188,26 @@ gst_base_transform_handle_buffer (GstBaseTransform * trans, GstBuffer * inbuf, + + no_qos: + +- /* first try to allocate an output buffer based on the currently negotiated +- * format. While we call pad-alloc we could renegotiate the srcpad format or +- * have a new suggestion for upstream buffer-alloc. +- * In any case, outbuf will contain a buffer suitable for doing the configured +- * transform after this function. */ +- ret = gst_base_transform_prepare_output_buffer (trans, inbuf, outbuf); +- if (G_UNLIKELY (ret != GST_FLOW_OK)) +- goto no_buffer; ++ if (trans->passthrough) { ++ /* I'm not yet sure if we should bypass allocating output buffer in case of ++ * passthrough, or if I should override the prepare_output_buffer vmethod.. ++ * I think the argument for always doing buffer allocation is to give a ++ * chance for upstream caps-renegotiation.. except I think the existing ++ * gst_base_transform_buffer_alloc() which itself does a pad_alloc() should ++ * be sufficient.. ++ */ ++ GST_DEBUG_OBJECT (trans, "reuse input buffer"); ++ *outbuf = inbuf; ++ } else { ++ /* first try to allocate an output buffer based on the currently negotiated ++ * format. While we call pad-alloc we could renegotiate the srcpad format or ++ * have a new suggestion for upstream buffer-alloc. ++ * In any case, outbuf will contain a buffer suitable for doing the configured ++ * transform after this function. */ ++ ret = gst_base_transform_prepare_output_buffer (trans, inbuf, outbuf); ++ if (G_UNLIKELY (ret != GST_FLOW_OK)) ++ goto no_buffer; ++ } + + /* now perform the needed transform */ + if (trans->passthrough) { +-- +1.7.0.4 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/libid3tag-0.15.1b/0001-Converted-from-libid3tag1_0_15_1b.patch.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libid3tag-0.15.1b/0001-Converted-from-libid3tag1_0_15_1b.patch.patch new file mode 100644 index 0000000..550086f --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libid3tag-0.15.1b/0001-Converted-from-libid3tag1_0_15_1b.patch.patch @@ -0,0 +1,124 @@ +From e606005c8192059eb8a61650826e00a2633cb85d Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Thu, 11 Mar 2010 13:49:13 -0600 +Subject: [PATCH] Converted from libid3tag1_0_15_1b.patch + +--- + Makefile.am | 5 ++++- + Makefile.in | 34 ++++++++++++++++++++++++++++++---- + id3tag.pc.in | 10 ++++++++++ + 3 files changed, 44 insertions(+), 5 deletions(-) + create mode 100644 id3tag.pc.in + +diff --git a/Makefile.am b/Makefile.am +index 3ee9aa6..e884c9e 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -69,9 +69,12 @@ version_age = 3 + + version_info = $(version_current):$(version_revision):$(version_age) + +-EXTRA_DIST = genre.dat.sed \ ++EXTRA_DIST = genre.dat.sed id3tag.pc.in \ + CHANGES COPYRIGHT CREDITS README TODO VERSION + ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA= id3tag.pc ++ + if DEBUG + debug = debug.c debug.h + else +diff --git a/Makefile.in b/Makefile.in +index aeec8f7..71b7c24 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -42,7 +42,8 @@ DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(srcdir)/libid3tag.list.in \ + $(top_srcdir)/configure COPYING INSTALL TODO config.guess \ +- config.sub depcomp install-sh ltmain.sh missing mkinstalldirs ++ config.sub depcomp install-sh ltmain.sh missing mkinstalldirs \ ++ id3tag.pc.in + subdir = . + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/configure.ac +@@ -218,9 +219,12 @@ version_current = 3 + version_revision = 0 + version_age = 3 + version_info = $(version_current):$(version_revision):$(version_age) +-EXTRA_DIST = genre.dat.sed \ ++EXTRA_DIST = genre.dat.sed id3tag.pc.in\ + CHANGES COPYRIGHT CREDITS README TODO VERSION + ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA = id3tag.pc ++ + @DEBUG_FALSE@debug = + @DEBUG_TRUE@debug = debug.c debug.h + libid3tag_la_SOURCES = version.c ucs4.c latin1.c utf16.c utf8.c \ +@@ -290,6 +294,28 @@ $(srcdir)/config.h.in: $(am__configure_deps) + rm -f stamp-h1 + touch $@ + ++id3tag.pc: $(top_builddir)/config.status id3tag.pc.in ++ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++install-pkgconfigDATA: $(pkgconfig_DATA) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) ++ @list='$(pkgconfig_DATA)'; for p in $$list; do \ ++ if test -f $(srcdir)/$$p; then \ ++ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \ ++ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ else if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ fi; fi; \ ++ done ++ ++uninstall-pkgconfigDATA: ++ @$(NORMAL_UNINSTALL) ++ list='$(pkgconfig_DATA)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ done ++ + distclean-hdr: + -rm -f config.h stamp-h1 + libid3tag.list: $(top_builddir)/config.status $(srcdir)/libid3tag.list.in +@@ -710,7 +736,7 @@ info: info-recursive + + info-am: + +-install-data-am: install-includeHEADERS ++install-data-am: install-includeHEADERS install-pkgconfigDATA + + install-exec-am: install-libLTLIBRARIES + +@@ -741,7 +767,7 @@ ps: ps-recursive + ps-am: + + uninstall-am: uninstall-includeHEADERS uninstall-info-am \ +- uninstall-libLTLIBRARIES ++ uninstall-libLTLIBRARIES install-pkgconfigDATA + + uninstall-info: uninstall-info-recursive + +diff --git a/id3tag.pc.in b/id3tag.pc.in +new file mode 100644 +index 0000000..e00536d +--- /dev/null ++++ b/id3tag.pc.in +@@ -0,0 +1,10 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: ID3TAG ++Description: libid3tag - ID3 tag manipulation library ++Version: @VERSION@ ++Libs: -L${libdir} -lid3tag -lz ++Cflags: +-- +1.6.3.3 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0001-Converted-from-libmad1_0_15_1b.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0001-Converted-from-libmad1_0_15_1b.patch new file mode 100644 index 0000000..e112fb2 --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0001-Converted-from-libmad1_0_15_1b.patch @@ -0,0 +1,143 @@ +From 40cd52241d2a4a27c0a042b9a3fafb97f838fe89 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Thu, 11 Mar 2010 13:51:31 -0600 +Subject: [PATCH 1/2] Converted from libmad1_0_15_1b + +--- + Makefile.am | 6 +++++- + Makefile.in | 32 ++++++++++++++++++++++++++++---- + configure.ac | 2 +- + mad.pc.in | 14 ++++++++++++++ + 4 files changed, 48 insertions(+), 6 deletions(-) + create mode 100644 mad.pc.in + +diff --git a/Makefile.am b/Makefile.am +index ad5c596..4489c84 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -24,6 +24,9 @@ + SUBDIRS = + DIST_SUBDIRS = msvc++ + ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA = mad.pc ++ + lib_LTLIBRARIES = libmad.la + include_HEADERS = mad.h + +@@ -34,7 +37,8 @@ minimad_INCLUDES = + minimad_LDADD = libmad.la + + EXTRA_DIST = mad.h.sed \ +- CHANGES COPYRIGHT CREDITS README TODO VERSION ++ CHANGES COPYRIGHT CREDITS README TODO VERSION \ ++ mad.pc.in + + exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \ + synth.h decoder.h +diff --git a/Makefile.in b/Makefile.in +index 723070a..4276e74 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -43,7 +43,8 @@ DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(srcdir)/libmad.list.in \ + $(top_srcdir)/configure COPYING INSTALL TODO config.guess \ +- config.sub depcomp install-sh ltmain.sh missing mkinstalldirs ++ config.sub depcomp install-sh ltmain.sh missing mkinstalldirs \ ++ mad.pc.in + subdir = . + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/configure.ac +@@ -218,8 +219,10 @@ include_HEADERS = mad.h + minimad_SOURCES = minimad.c + minimad_INCLUDES = + minimad_LDADD = libmad.la +-EXTRA_DIST = mad.h.sed \ ++EXTRA_DIST = mad.h.sed mad.pc.in\ + CHANGES COPYRIGHT CREDITS README TODO VERSION ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA = mad.pc + + exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \ + synth.h decoder.h +@@ -297,6 +300,27 @@ $(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ ++mad.pc: $(top_builddir)/config.status mad.pc.in ++ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++install-pkgconfigDATA: $(pkgconfig_DATA) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) ++ @list='$(pkgconfig_DATA)'; for p in $$list; do \ ++ if test -f $(srcdir)/$$p; then \ ++ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p"; \ ++ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ else if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ fi; fi; \ ++ done ++ ++uninstall-pkgconfigDATA: ++ @$(NORMAL_UNINSTALL) ++ list='$(pkgconfig_DATA)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(pkgconfigdir)/$$p; \ ++ done + + distclean-hdr: + -rm -f config.h stamp-h1 +@@ -726,7 +750,7 @@ info: info-recursive + + info-am: + +-install-data-am: install-includeHEADERS ++install-data-am: install-includeHEADERS install-pkgconfigDATA + + install-exec-am: install-libLTLIBRARIES + +@@ -757,7 +781,7 @@ ps: ps-recursive + ps-am: + + uninstall-am: uninstall-includeHEADERS uninstall-info-am \ +- uninstall-libLTLIBRARIES ++ uninstall-libLTLIBRARIES install-pkgconfigDATA + + uninstall-info: uninstall-info-recursive + +diff --git a/configure.ac b/configure.ac +index 9b79399..bbb8502 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -429,5 +429,5 @@ dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'` + dnl AC_SUBST(LTLIBOBJS) + + AC_CONFIG_FILES([Makefile msvc++/Makefile \ +- libmad.list]) ++ libmad.list mad.pc]) + AC_OUTPUT +diff --git a/mad.pc.in b/mad.pc.in +new file mode 100644 +index 0000000..8c3b2d8 +--- /dev/null ++++ b/mad.pc.in +@@ -0,0 +1,14 @@ ++# libmad pkg-config source file ++ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: mad ++Description: MPEG Audio Decoder ++Version: @VERSION@ ++Requires: ++Conflicts: ++Libs: -L${libdir} -lmad -lm ++Cflags: -I${includedir} +-- +1.6.3.3 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0002-Remove-fforce-mem-option-when-building-with-O2.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0002-Remove-fforce-mem-option-when-building-with-O2.patch new file mode 100644 index 0000000..8dc1bbd --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/libmad-0.15.1b/0002-Remove-fforce-mem-option-when-building-with-O2.patch @@ -0,0 +1,40 @@ +From d17d5b0a32d10ded89617a23a015a53d1ead03b6 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Mon, 17 May 2010 17:41:27 -0500 +Subject: [PATCH 2/2] Remove -fforce-mem option when building with -O2. + +This option has been removed in CodeSourcery 2009q1. +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index ee421cc..2a2f123 100755 +--- a/configure ++++ b/configure +@@ -19099,7 +19099,7 @@ then + case "$optimize" in + -O|"-O "*) + optimize="-O" +- optimize="$optimize -fforce-mem" ++ : #x optimize="$optimize -fforce-mem" + optimize="$optimize -fforce-addr" + : #x optimize="$optimize -finline-functions" + : #- optimize="$optimize -fstrength-reduce" +diff --git a/configure.ac b/configure.ac +index bbb8502..8c4a47d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -140,7 +140,7 @@ then + case "$optimize" in + -O|"-O "*) + optimize="-O" +- optimize="$optimize -fforce-mem" ++ : #x optimize="$optimize -fforce-mem" + optimize="$optimize -fforce-addr" + : #x optimize="$optimize -finline-functions" + : #- optimize="$optimize -fstrength-reduce" +-- +1.6.3.3 + diff --git a/gstreamer_ti_dm81xx/opensource_build/patchfiles/liboil-0.3.16/0001-Fix-liboil-preprocessor-checks.patch b/gstreamer_ti_dm81xx/opensource_build/patchfiles/liboil-0.3.16/0001-Fix-liboil-preprocessor-checks.patch new file mode 100644 index 0000000..efd791b --- /dev/null +++ b/gstreamer_ti_dm81xx/opensource_build/patchfiles/liboil-0.3.16/0001-Fix-liboil-preprocessor-checks.patch @@ -0,0 +1,44 @@ +From 6c7002544c4e600d70b6872b68028e36682cb355 Mon Sep 17 00:00:00 2001 +From: Don Darling <don.osc2@gmail.com> +Date: Thu, 11 Mar 2010 13:53:52 -0600 +Subject: [PATCH] Fix liboil preprocessor checks. + +Liboil was building hand-coded VFP assembly, but the check for VFP support +was not correct. This change fixes the check for VFP. + +Suggestion taken from: +https://gstreamer.ti.com/gf/project/gstreamer_ti/forum/?_forum_action=MessageReply&message_id=6188&action=ForumBrowse +--- + liboil/arm/math_vfp.c | 2 +- + liboil/arm/math_vfp_asm.S | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/liboil/arm/math_vfp.c b/liboil/arm/math_vfp.c +index ffd3981..0bed96e 100644 +--- a/liboil/arm/math_vfp.c ++++ b/liboil/arm/math_vfp.c +@@ -30,7 +30,7 @@ + #include <liboil/liboilclasses.h> + #include <liboil/liboilfunction.h> + +-#if __VFP_FP__ ++#if defined(__VFP_FP__) && !defined(__SOFTFP__) + + extern void vfp_add_f32 (float *d, const float *s1, const float *s2, int n); + extern void vfp_add_f64 (double *d, const double *s1, const double *s2, int n); +diff --git a/liboil/arm/math_vfp_asm.S b/liboil/arm/math_vfp_asm.S +index ea68dba..ae5c803 100644 +--- a/liboil/arm/math_vfp_asm.S ++++ b/liboil/arm/math_vfp_asm.S +@@ -24,7 +24,7 @@ + * SUCH DAMAGE. + */ + +-#if __VFP_FP__ ++#if defined(__VFP_FP__) && !defined(__SOFTFP__) + /* + ** compile with -mcpu=arm1136j-s -mfpu=vfp -mfloat-abi=softfp + ** +-- +1.6.3.3 + diff --git a/gstreamer_ti_dm81xx/ti_build/Makefile b/gstreamer_ti_dm81xx/ti_build/Makefile new file mode 100644 index 0000000..c1a79f2 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/Makefile @@ -0,0 +1,82 @@ +# Makefile +# +# Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/ +# +# This program 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 version 2.1 of the License. +# +# This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, +# whether express or implied; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +#------------------------------------------------------------------------------ +# Include common build settings. +#------------------------------------------------------------------------------ +include ../Makefile.common + +#------------------------------------------------------------------------------ +# Check if we need to enable C6Accel elements +#------------------------------------------------------------------------------ +ifeq ($(ENABLE_C6ACCEL), true) + EXTRA_CONFIGURE_OPTS="--enable-c6accel" +endif + +#------------------------------------------------------------------------------ +# Check if we need to enable tidisplaysink2 element +#------------------------------------------------------------------------------ +ifeq ($(ENABLE_TIDISPLAYSINK2), true) + EXTRA_CONFIGURE_OPTS +="--enable-tidisplaysink2" +endif + +#------------------------------------------------------------------------------ +# TI_PLUGINS +# list of subdirectories containing TI plugins +#------------------------------------------------------------------------------ +ifeq ($(GST_TI_PLATFORM), dm816x) + TI_PLUGINS = gst-openmax + CFLAGS_dm816x += -DUSE_OMXTICORE +endif +ifeq ($(GST_TI_PLATFORM), dm814x) + TI_PLUGINS = gst-openmax + CFLAGS_dm814x += -DUSE_OMXTICORE +endif + +#------------------------------------------------------------------------------ +# Build targets +#------------------------------------------------------------------------------ +.PHONY: $(TI_PLUGINS) default help +default: help + +all: $(TI_PLUGINS) + +$(TI_PLUGINS): + @echo Building $@ + $(CMD_PREFIX) cd $@; ./autogen.sh --noconfigure + $(CMD_PREFIX) cd $@; ./configure $(CONFIGURE_VERBOSE) $(CC_CONFIGURE_OPTS) $(EXTRA_CONFIGURE_OPTS) + $(CMD_PREFIX) $(MAKE) $(MAKE_VERBOSE) -C $@ $(BUILD_INSTALL) + +install: + +clean: + for dir in $(TI_PLUGINS); do \ + if [ -r $${dir}/Makefile ] ; then \ + cd $${dir}; $(MAKE) distclean; \ + fi ; \ + done + +#------------------------------------------------------------------------------ +# help: build target for help screen +#------------------------------------------------------------------------------ +.PHONY: help +help: + @echo + @echo "Make usage for building TI plugins:" + @echo + @echo " Build only:" + @echo " make all" + @echo " Build and install:" + @echo " make all install" + @echo + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/.gitignore b/gstreamer_ti_dm81xx/ti_build/gst-openmax/.gitignore new file mode 100644 index 0000000..dc154e8 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/.gitignore @@ -0,0 +1,24 @@ +*.[oa] +*.l[oa] +.deps +.libs +Makefile.in + +INSTALL +Makefile +aclocal.m4 +autom4te.cache +autoregen.sh +config.* +configure +libtool +stamp-h1 +stamp-h.in +shave +shave-libtool + +build-aux/compile +build-aux/depcomp +build-aux/install-sh +build-aux/ltmain.sh +build-aux/missing diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/AUTHORS b/gstreamer_ti_dm81xx/ti_build/gst-openmax/AUTHORS new file mode 100644 index 0000000..2fd887b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/AUTHORS @@ -0,0 +1 @@ +Felipe Contreras <felipe.contreras@nokia.com> diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/COPYING b/gstreamer_ti_dm81xx/ti_build/gst-openmax/COPYING new file mode 100644 index 0000000..5ab7695 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library 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. + + This library 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 this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/ChangeLog b/gstreamer_ti_dm81xx/ti_build/gst-openmax/ChangeLog new file mode 100644 index 0000000..5d7d986 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/ChangeLog @@ -0,0 +1,279 @@ +== Release 0.10.0.4 == + +2008-06-19 Felipe Contreras <felipe.contreras@gmail.com> + * Build system updates. + * Remove unused files. + * Remove unused header inclusions. + * Update FSF address. + * Update copyright. + * Reorganize header requirements. + * Cleanup gstomx_util. + * Fix more warnings. + * Fix warnings. + +2008-05-22 Felipe Contreras <felipe.contreras@gmail.com> + * Add iLBC encoder/decoder. + +2008-06-05 Felipe Contreras <felipe.contreras@gmail.com> + * Add install target in manual Makefile. + * Update base src for async changes. + * Update base sink for async changes. + * Use flush command completed event. + * Fix flushing. + * More warnings and cleanups. + * Skip the normal checks when flushing the queues. + * Add flush unit test. + * Output omx_buffer from the chain function. + * Build util first. + * Cleanups in dummy libomxil. + +2008-06-04 Felipe Contreras <felipe.contreras@gmail.com> + * Add flush commands. + +2008-06-03 Felipe Contreras <felipe.contreras@gmail.com> + * Initial async_queue changes. + * Increase timeout for gstomx tests. + * Add simple gstomx unit test. + * Cleanup tests. + +2008-05-30 Felipe Contreras <felipe.contreras@gmail.com> + * Add unit tests for dummy libomxil. + * Add simple unit tests. + * Move async_queue to new util library. + +2008-05-29 Felipe Contreras <felipe.contreras@gmail.com> + * GThread is more proper since we are using mutexes and conditions. + * Cleanup async_queue. + +2008-05-26 Felipe Contreras <felipe.contreras@gmail.com> + * Save codec data information from the container. + +2008-05-23 Felipe Contreras <felipe.contreras@gmail.com> + * Fix g711dec caps. + +2008-05-19 Felipe Contreras <felipe.contreras@gmail.com> + * Proper description. + * Add new G.729 encoder and decoder. + * Proper description. + * Add G.711 encoder and decoder. + * Add mpegversion 2 in AAC elements. + * Use fixed number of channels for ADPCM. + +2008-05-17 Stefan Kost <ensonic@users.sf.net> + * Fix the warnings gcc complains about. + * Build cvs versions with -Werror. + +2008-05-16 Felipe Contreras <felipe.contreras@gmail.com> + * Misc cleanups. + * Fix racing condition. + * Add comment regarding non-standard usage. + * Upate max framerate for wmvdec. + * Use minimun buffer count. + +2008-05-07 Felipe Contreras <felipe.contreras@gmail.com> + * Add initial unit tests. + +2008-04-07 Felipe Contreras <felipe.contreras@gmail.com> + * New ADPCM encoder/decoder. + +2008-04-03 Felipe Contreras <felipe.contreras@gmail.com> + * Fix copyright notice. + +2008-04-02 Felipe Contreras <felipe.contreras@gmail.com> + * Cleanup the AMR encoders. + * Add bitrate property to aacenc. + +2008-03-18 Felipe Contreras <felipe.contreras@gmail.com> + * Add new amrwbenc wrapper. + * Add bitrate parameter for amrnbenc. + +2008-03-10 Felipe Contreras <felipe.contreras@gmail.com> + * Cleanup audio elements. + * New amrnbenc wrapper. + +2008-03-05 Felipe Contreras <felipe.contreras@gmail.com> + * Random cleanup and fixes for AAC encoder. + * New AAC encoder wrapper. + +2008-02-28 Felipe Contreras <felipe.contreras@gmail.com> + * New pause util function that properly waits for the state change. + * Add bitrate property to base videoenc. + * Properly pause/resume the omx component in basesink when flushing. + * Remember to fetch colorformat properly. + +2008-02-25 Felipe Contreras <felipe.contreras@gmail.com> + * Cleanup videodecoders. + +2008-02-22 Felipe Contreras <felipe.contreras@gmail.com> + * Random fixes and cleanups. + * Fix seeking. + * Propagate gst_pad_push return value. + * Fix stupid segmentation fault when doing play->stop->play. + +2008-02-20 Felipe Contreras <felipe.contreras@gmail.com> + * New H.264/AVC encoder wrapper. + * Random cleanups for base video stuff. + * Properly set the coloformat in the base videoenc. + * Destroy ports when finishing decoding. + +2008-02-12 Felipe Contreras <felipe.contreras@gmail.com> + * New WMV decoder wrapper. + * New H.263 encoder. + * Handle video encoder's real codec. + +2008-02-04 Felipe Contreras <felipe.contreras@gmail.com> + * Add new AMR-WB decoder element. + * Use right caps for amrnbdec (not contained). + * Bump version number, we are in development again. + +== Release 0.10.0.3 == + +2008-02-04 Felipe Contreras <felipe.contreras@gmail.com> + * Update ChangeLog. + * Add Khronos headers to the distribution. + * Update README. + +2008-02-01 Felipe Contreras <felipe.contreras@gmail.com> + * Update ChangeLog. + * Fix amrnbdec default component name. + +2008-01-30 Felipe Contreras <felipe.contreras@gmail.com> + * Update audiosink and other cleanups. + * Allow fake settings changed notification for now. + * Properly allocate memory that would eventually be freed. + * Free pBuffer data. + +2008-01-25 Felipe Contreras <felipe.contreras@gmail.com> + * New base videoenc class. + * Set OpenMAX parameters more properly for video elements. + * Whitespace fixes. + +2008-01-24 Felipe Contreras <felipe.contreras@gmail.com> + * Use "libomx.so.0" by default. + * Improve timestamp handling on base filter. + * Fix vorbisdec. + +2008-01-23 Felipe Contreras <felipe.contreras@gmail.com> + * Use proper inline keywords. + * Remove unneeded stuff on util, and use inline. + * Enforce OpenMAX components to call the settings changed event. + * Add GLib misc macros for base filter. + * More zero-copy flexibility and fixes on base filter. + * Don't try to set wrong color format on base videodec. + +2008-01-22 Felipe Contreras <felipe.contreras@gmail.com> + * Dumb fixes. + * Rename alsasink to audiosink. + * Don't use reserved prefix on header definitions. + * Update copyright. + * New videodec base element. + * Reorganize parameters's setup for H.263 decoder. + * Update ChangeLog. + +2008-01-21 Felipe Contreras <felipe.contreras@gmail.com> + * Whitespace fixes for video decoders. + * More verbose debugging. + * Reorganize parameters' setup. + * Copy H.264 decoder changes to MPEG-4. + * Fix MPEG-4 video encoder, and cleanups. + * Add videosink rotation. + +2008-01-14 Felipe Contreras <felipe.contreras@gmail.com> + * Remove unneeded forward declaration in aacdec. + * Fix wrong H.264 decoder and MPEG-4 encoder element initialization. + +2007-12-12 Felipe Contreras <felipe.contreras@gmail.com> + * Fixes for non-zero-copy behavior. + * Upgrade the rank of AAC and AMR-NB decoders. + * Modify the MP3 decoder to use parsed input stream. + * Don't crash if the GStreamer input buffer are owned by the previous element. + * Modify AAC decoder temporarily to allow decoding without a parser. + * Add omx_setup to set some component configurations early. + +2007-12-07 Felipe Contreras <felipe.contreras@gmail.com> + * Small cleanups for AAC decoder. + * Add compilation time flag for zero-copy. + * Add AMR-NB decoder wrapper. + +2007-11-23 Felipe Contreras <felipe.contreras@gmail.com> + * Add multiple new component wrappers. + * Add comment about wring to a read-only parameter. + * Make logging level 4(DEBUG) more verbose. + +2007-11-09 Felipe Contreras <felipe.contreras@gmail.com> + * Generate ChangeLog. + +2007-10-31 Felipe Contreras <felipe.contreras@gmail.com> + * Add more missing files. + * Bump version. + +== Release 0.10.0.2 == + +2007-10-31 Felipe Contreras <felipe.contreras@gmail.com> + * Add more missing files. + +2007-10-30 Felipe Contreras <felipe.contreras@gmail.com> + * Add missing files to the tarball. + +2007-10-29 Felipe Contreras <felipe.contreras@gmail.com> + * Update to first pre-release version. + * Include common release make commands. + * Update the README. + * Make some elements primary by default. + * Update README. + +2007-10-22 Felipe Contreras <felipe.contreras@gmail.com> + * Allow multiple OpenMAX IL implementations at the same time. + +2007-10-16 Felipe Contreras <felipe.contreras@gmail.com> + * Whitespace fixes + * Fix description for video decoder elements + * New H.263 video decoder + * Fixes for new Bellagio versions + * Add more debugging stuff to the base filter + * Add flush support for seeking on the base filter + * Use timestamps by default on the base filter + * Specify the srcpad capabilities of the videosink. + * Don't hang if not properly initialized. + * More proper autoconf. + +2007-08-28 Felipe Contreras <felipe.contreras@gmail.com> + * Add video sink. + * Add property for the OpenMAX component name. + * Add use-timestamps property. + * Add more capabilities for MPEG-4 video dec. + * Whitespace fixes. + * Add timestamp information. + * More readable. + * This looks better. + * Implement zerocopy on the base sink. + * Fix zerocopy. + * Fix a small memory leak. + * Improve logging. + +2007-07-10 Felipe Contreras <felipe.contreras@gmail.com> + * Add ALSA sink. + * Add missing files. + * Rename Base to BaseFilter. + * Set omx parameters from gst caps. + +2007-07-06 Felipe Contreras <felipe.contreras@gmail.com> + * Now the ports are extensible. + +2007-07-03 Felipe Contreras <felipe.contreras@gmail.com> + * New MPEG4v decoder. + * Remove base "set_caps" and use "settings_changed_cb". + +2007-07-02 Felipe Contreras <felipe.contreras@gmail.com> + * Set version to 1.1 for now. + +2007-06-29 Felipe Contreras <felipe.contreras@gmail.com> + * Add some sample gst-launch pipelines. + * Generate proper capabilities for the output buffer in the vorbis decoder. + * Add some error handling. + * Add GNU standard files. + * Use GStreamer's common autotools macros. + +2007-06-15 Felipe Contreras <felipe.contreras@gmail.com> + * Initial commit. + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/Makefile.am b/gstreamer_ti_dm81xx/ti_build/gst-openmax/Makefile.am new file mode 100644 index 0000000..545284e --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/Makefile.am @@ -0,0 +1,9 @@ +SUBDIRS = ext util omx m4 + +include $(top_srcdir)/build-aux/release.mak + +EXTRA_DIST = autogen.sh \ + build-aux/gst-autogen.sh \ + build-aux/release.mak + +ACLOCAL_AMFLAGS = -I m4 diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/NEWS b/gstreamer_ti_dm81xx/ti_build/gst-openmax/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/NEWS diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/README b/gstreamer_ti_dm81xx/ti_build/gst-openmax/README new file mode 100644 index 0000000..e9d2096 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/README @@ -0,0 +1,125 @@ += GstOpenMAX = + +GstOpenMAX is a GStreamer plug-in that allows communication with OpenMAX IL +components. + +OpenMAX IL is an industry standard that provides an abstraction layer for +computer graphics, video, and sound routines. + +You'll need an OpenMAX IL implementation. Luckily STMicroelectronics has +provided an useful sample implementation in the Bellagio project which is Open +Source. + +For more information check: +http://freedesktop.org/wiki/GstOpenMAX + +== Why is it good? == + +The easiest way to see OpenMAX IL is to think about OpenGL. both standards are +controlled by the Khronos Group, both standards are open and royalty free. + +In a similar way you can think of Bellagio/OpenMAX IL as Mesa/Open GL. They are +not official implementations, but they follow the standard. + +There are many Open Source encoders/decoders, but they all have different +API's, so in order to use it you need to learn the API. In fact some projects +as FFmpeg constantly change their API, so it makes things difficult. + +If you use Bellagio's omxil you don't have to worry about FFmpeg's API changes, +those are wrapped inside a standard API. + +The standard has been reviewed by several parties including: Texas Instruments, +ARM, ATI Technologies, Beatnik, Broadcom, Emuzed, Fraunhofer, Freescale, +Infineon, Intel, Motorola, Nokia, NVIDIA, Philips, SKY MobileMedia, Samsung, +Sasken, Siemens, ST Microelectronics, and Symbian. + +The gst-openmax project is a collaboration between Fluendo, Nokia, +STMicroelectronics, Texas Instruments and the Open Source community. + +== What's bad? == + +Not all of the codecs are defined. For example Vorbis is defined, but not +Theora. Of course it could be added as an extension, but that API wouldn't be +set in stone + +== How to build omxil == + +Download the source code from: + + * http://omxil.sourceforge.net/ + +Or directly from: + + * http://dl.sourceforge.net/sourceforge/omxil/libomxil-B-0.3.3.tar.gz + +Install as usual: + + ./configure --prefix="$HOME/omx" + make + make install + +Register the components: + + $HOME/omx/bin/omxregister -v + +You'll get an output like this: + + Component OMX.st.volume.component registered + Specific role OMX.st.volume.component registered + Component OMX.st.audio_decoder.ogg.single registered + Specific role OMX.st.audio_decoder.ogg.single registered + Component OMX.st.alsa.alsasink registered + Specific role OMX.st.alsa.alsasink registered + Component OMX.st.audio_filereader registered + Component OMX.st.audio_decoder registered + Specific role OMX.st.audio_decoder.mp3 registered + Specific role OMX.st.audio_decoder.ogg registered + Specific role OMX.st.audio_decoder.aac registered + Component OMX.st.video_decoder registered + Specific role OMX.st.video_decoder.mpeg4 registered + Specific role OMX.st.video_decoder.avc registered + Component OMX.st.video_colorconv.ffmpeg registered + Specific role OMX.st.video_colorconv.ffmpeg registered + Component OMX.st.audio_decoder.mp3.mad registered + Specific role OMX.st.audio_decoder.mp3.mad registered + + 8 OpenMAX IL ST static components with 11 roles succesfully scanned + +Make sure you have: + + * "OMX.st.audio_decoder.mp3.mad" for MP3 decoding + * "OMX.st.audio_decoder.ogg.single" for Vorbis decoding + * "OMX.st.video_decoder.mpeg4" for MPEG4 video decoding + * "OMX.st.alsa.alsasink" for ALSA sound output + +== How to build gst-openmax == + +If you are fetching it from CVS: + + ./autogen.sh --noconfigure + +If you want to install it into your home directory: + + ./configure --prefix="$HOME/omx" + + make + +Then as root (depending on your prefix): + + make install + +== How to try it == + + export GST_PLUGIN_PATH=$HOME/omx/lib/gstreamer-0.10 + export LD_LIBRARY_PATH=$HOME/omx/lib + +You'll be able to play videos with MP3, Vorbis, MPEG-4, H.264 or H.263 content using Bellagio's components. + +If you want to see what's happening: + + export GST_DEBUG=omx:4 + +== Links == + + * http://omxil.sourceforge.net/ + * http://freedesktop.org/wiki/GstOpenMAX diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/autogen.sh b/gstreamer_ti_dm81xx/ti_build/gst-openmax/autogen.sh new file mode 100755 index 0000000..6b6ddd3 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/autogen.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +package=gst-openmax + +. build-aux/gst-autogen.sh + +mkdir -p config + +CONFIGURE_DEF_OPT='--enable-maintainer-mode' + +autogen_options $@ + +echo -n "+ check for build tools" +if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi +version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53 autoconf-2.52" \ +"ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1 +version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.7 automake-1.6 automake-1.5" \ +"ftp://ftp.gnu.org/pub/gnu/automake/" 1 7 || DIE=1 +version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \ +"ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1 +version_check "pkg-config" "" \ +"http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1 + +die_check $DIE + +autoconf_2_52d_check || DIE=1 +aclocal_check || DIE=1 +autoheader_check || DIE=1 + +die_check $DIE + +# if no arguments specified then this will be printed +if test -z "$*"; then + echo "+ checking for autogen.sh options" + echo " This autogen script will automatically run ./configure as:" + echo " ./configure $CONFIGURE_DEF_OPT" + echo " To pass any additional options, please specify them on the $0" + echo " command line." +fi + +toplevel_check $srcfile + +tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS" +tool_run "$libtoolize" "--copy --force" +tool_run "$autoheader" + +# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo +echo timestamp > stamp-h.in 2> /dev/null + +tool_run "$autoconf" +tool_run "$automake" "-a -c" + +# if enable exists, add an -enable option for each of the lines in that file +if test -f enable; then + for a in `cat enable`; do + CONFIGURE_FILE_OPT="--enable-$a" + done +fi + +# if disable exists, add an -disable option for each of the lines in that file +if test -f disable; then + for a in `cat disable`; do + CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a" + done +fi + +test -n "$NOCONFIGURE" && { + echo "+ skipping configure stage for package $package, as requested." + echo "+ autogen.sh done." + exit 0 +} + +echo "+ running configure ... " +test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT" +test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT" +test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT" +echo + +./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || { + echo " configure failed" + exit 1 +} + +echo "Now type 'make' to compile $package." diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/git-version-gen b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/git-version-gen new file mode 100755 index 0000000..8f9333d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/git-version-gen @@ -0,0 +1,11 @@ +#!/bin/sh + +if test -f .version; then + v=`cat .version` +else + desc=`git describe --tags 2>/dev/null` + [ $? -eq 0 ] && v=`echo ${desc} | sed 's/^v//'` || v=`git log --pretty=raw | head -n1 | cut -c 8-` +fi + +# for m4_esyscmd +echo "$v" | tr -d '\012' diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/gst-autogen.sh b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/gst-autogen.sh new file mode 100644 index 0000000..c22108f --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/gst-autogen.sh @@ -0,0 +1,294 @@ +# a silly hack that generates autoregen.sh but it's handy +# Remove the old autoregen.sh first to create a new file, +# as the current one may be being read by the shell executing +# this script. +if [ -f "autoregen.sh" ]; then + rm autoregen.sh +fi +echo "#!/bin/sh" > autoregen.sh +echo "./autogen.sh $@ \$@" >> autoregen.sh +chmod +x autoregen.sh + +# helper functions for autogen.sh + +debug () +# print out a debug message if DEBUG is a defined variable +{ + if test ! -z "$DEBUG" + then + echo "DEBUG: $1" + fi +} + +version_check () +# check the version of a package +# first argument : package name (executable) +# second argument : optional path where to look for it instead +# third argument : source download url +# rest of arguments : major, minor, micro version +# all consecutive ones : suggestions for binaries to use +# (if not specified in second argument) +{ + PACKAGE=$1 + PKG_PATH=$2 + URL=$3 + MAJOR=$4 + MINOR=$5 + MICRO=$6 + + # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null + if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi + debug "major $MAJOR minor $MINOR micro $MICRO" + VERSION=$MAJOR + if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi + if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi + + debug "major $MAJOR minor $MINOR micro $MICRO" + + for SUGGESTION in $PKG_PATH; do + COMMAND="$SUGGESTION" + + # don't check if asked not to + test -z "$NOCHECK" && { + echo -n " checking for $COMMAND >= $VERSION ... " + } || { + # we set a var with the same name as the package, but stripped of + # unwanted chars + VAR=`echo $PACKAGE | sed 's/-//g'` + debug "setting $VAR" + eval $VAR="$COMMAND" + return 0 + } + + debug "checking version with $COMMAND" + ($COMMAND --version) < /dev/null > /dev/null 2>&1 || + { + echo "not found." + continue + } + # strip everything that's not a digit, then use cut to get the first field + pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*)[^0-9]*//'|cut -d' ' -f1` + debug "pkg_version $pkg_version" + # remove any non-digit characters from the version numbers to permit numeric + # comparison + pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g` + pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g` + pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g` + test -z "$pkg_major" && pkg_major=0 + test -z "$pkg_minor" && pkg_minor=0 + test -z "$pkg_micro" && pkg_micro=0 + debug "found major $pkg_major minor $pkg_minor micro $pkg_micro" + + #start checking the version + debug "version check" + + # reset check + WRONG= + + if [ ! "$pkg_major" -gt "$MAJOR" ]; then + debug "major: $pkg_major <= $MAJOR" + if [ "$pkg_major" -lt "$MAJOR" ]; then + debug "major: $pkg_major < $MAJOR" + WRONG=1 + elif [ ! "$pkg_minor" -gt "$MINOR" ]; then + debug "minor: $pkg_minor <= $MINOR" + if [ "$pkg_minor" -lt "$MINOR" ]; then + debug "minor: $pkg_minor < $MINOR" + WRONG=1 + elif [ "$pkg_micro" -lt "$MICRO" ]; then + debug "micro: $pkg_micro < $MICRO" + WRONG=1 + fi + fi + fi + + if test ! -z "$WRONG"; then + echo "found $pkg_version, not ok !" + continue + else + echo "found $pkg_version, ok." + # we set a var with the same name as the package, but stripped of + # unwanted chars + VAR=`echo $PACKAGE | sed 's/-//g'` + debug "setting $VAR" + eval $VAR="$COMMAND" + return 0 + fi + done + + echo "not found !" + echo "You must have $PACKAGE installed to compile $package." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at $URL" + return 1; +} + +aclocal_check () +{ + # normally aclocal is part of automake + # so we expect it to be in the same place as automake + # so if a different automake is supplied, we need to adapt as well + # so how's about replacing automake with aclocal in the set var, + # and saving that in $aclocal ? + # note, this will fail if the actual automake isn't called automake* + # or if part of the path before it contains it + if [ -z "$automake" ]; then + echo "Error: no automake variable set !" + return 1 + else + aclocal=`echo $automake | sed s/automake/aclocal/` + debug "aclocal: $aclocal" + if [ "$aclocal" != "aclocal" ]; + then + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal" + fi + if [ ! -x `which $aclocal` ]; then + echo "Error: cannot execute $aclocal !" + return 1 + fi + fi +} + +autoheader_check () +{ + # same here - autoheader is part of autoconf + # use the same voodoo + if [ -z "$autoconf" ]; then + echo "Error: no autoconf variable set !" + return 1 + else + autoheader=`echo $autoconf | sed s/autoconf/autoheader/` + debug "autoheader: $autoheader" + if [ "$autoheader" != "autoheader" ]; + then + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader" + fi + if [ ! -x `which $autoheader` ]; then + echo "Error: cannot execute $autoheader !" + return 1 + fi + fi + +} + +autoconf_2_52d_check () +{ + # autoconf 2.52d has a weird issue involving a yes:no error + # so don't allow it's use + test -z "$NOCHECK" && { + ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'` + if test "$ac_version" = "2.52d"; then + echo "autoconf 2.52d has an issue with our current build." + echo "We don't know who's to blame however. So until we do, get a" + echo "regular version. RPM's of a working version are on the gstreamer site." + exit 1 + fi + } + return 0 +} + +die_check () +{ + # call with $DIE + # if set to 1, we need to print something helpful then die + DIE=$1 + if test "x$DIE" = "x1"; + then + echo + echo "- Please get the right tools before proceeding." + echo "- Alternatively, if you're sure we're wrong, run with --nocheck." + exit 1 + fi +} + +autogen_options () +{ + if test "x$1" = "x"; then + return 0 + fi + + while test "x$1" != "x" ; do + optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + case "$1" in + --noconfigure) + NOCONFIGURE=defined + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure" + echo "+ configure run disabled" + shift + ;; + --nocheck) + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck" + NOCHECK=defined + echo "+ autotools version check disabled" + shift + ;; + --debug) + DEBUG=defined + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug" + echo "+ debug output enabled" + shift + ;; + -h|--help) + echo "autogen.sh (autogen options) -- (configure options)" + echo "autogen.sh help options: " + echo " --noconfigure don't run the configure script" + echo " --nocheck don't do version checks" + echo " --debug debug the autogen process" + echo + echo " --with-autoconf PATH use autoconf in PATH" + echo " --with-automake PATH use automake in PATH" + echo + echo "Any argument either not in the above list or after a '--' will be " + echo "passed to ./configure." + exit 1 + ;; + --with-automake=*) + AUTOMAKE=$optarg + echo "+ using alternate automake in $optarg" + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE" + shift + ;; + --with-autoconf=*) + AUTOCONF=$optarg + echo "+ using alternate autoconf in $optarg" + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF" + shift + ;; + --) shift ; break ;; + *) + echo "+ passing argument $1 to configure" + CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1" + shift + ;; + esac + done + + for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done + if test ! -z "$CONFIGURE_EXT_OPT" + then + echo "+ options passed to configure: $CONFIGURE_EXT_OPT" + fi +} + +toplevel_check () +{ + srcfile=$1 + test -f $srcfile || { + echo "You must run this script in the top-level $package directory" + exit 1 + } +} + +tool_run () +{ + tool=$1 + options=$2 + run_if_fail=$3 + echo "+ running $tool $options..." + $tool $options || { + echo + echo $tool failed + eval $run_if_fail + exit 1 + } +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/release.mak b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/release.mak new file mode 100644 index 0000000..d22331e --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/release.mak @@ -0,0 +1,28 @@ +# include this snippet to add a common release: target by using +# include $(top_srcdir)/build-aux/release.mak + +# make bz2 as well +AUTOMAKE_OPTIONS = dist-bzip2 + +release: dist + $(MAKE) $(PACKAGE)-$(VERSION).tar.gz.md5 + $(MAKE) $(PACKAGE)-$(VERSION).tar.bz2.md5 + +# generate md5 sum files +%.md5: % + md5sum $< > $@ + +# check that no marshal or enumtypes files are included +# this in turn ensures that distcheck fails for missing .list files which is currently +# shadowed when the corresponding .c and .h files are included. +distcheck-hook: + @test "x" = "x`find $(distdir) -name \*-enumtypes.[ch] | grep -v win32`" && \ + test "x" = "x`find $(distdir) -name \*-marshal.[ch]`" || \ + ( $(ECHO) "*** Leftover enumtypes or marshal files in the tarball." && \ + $(ECHO) "*** Make sure the following files are not disted:" && \ + find $(distdir) -name \*-enumtypes.[ch] | grep -v win32 && \ + find $(distdir) -name \*-marshal.[ch] && \ + false ) + +dist-hook: + echo $(VERSION) > $(distdir)/.version diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/update-common b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/update-common new file mode 100755 index 0000000..015c9b1 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/build-aux/update-common @@ -0,0 +1,19 @@ +#!/bin/sh + +# Don't rely blindly on this command, further cleanup is needed after running +# this script. + +orig=${1:-"../common"} + +cp $orig/gst-autogen.sh build-aux/gst-autogen.sh +cp $orig/release.mak build-aux/release.mak +cp $orig/m4/as-ac-expand.m4 m4/as-ac-expand.m4 +cp $orig/m4/as-compiler-flag.m4 m4/as-compiler-flag.m4 +cp $orig/m4/gst-args.m4 m4/gst-args.m4 +cp $orig/m4/gst-check.m4 m4/gst-check.m4 +cp $orig/m4/gst-error.m4 m4/gst-error.m4 +cp $orig/m4/gst-plugindir.m4 m4/gst-plugindir.m4 +cp $orig/m4/gst.m4 m4/gst.m4 +cp $orig/m4/shave.m4 m4/shave.m4 +cp $orig/shave-libtool.in shave-libtool.in +cp $orig/shave.in shave.in diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/configure.ac b/gstreamer_ti_dm81xx/ti_build/gst-openmax/configure.ac new file mode 100644 index 0000000..1ec65d0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/configure.ac @@ -0,0 +1,109 @@ +AC_PREREQ([2.52]) + +dnl AC_INIT([gst-openmax], m4_esyscmd([build-aux/git-version-gen]), +AC_INIT([gst-openmax], + [http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer&component=gst-openmax]) + +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Wno-portability]) +AC_CONFIG_HEADERS([config.h]) + +dnl versions of GStreamer +GST_MAJORMINOR=0.10 +GST_REQUIRED=0.10.0 + +dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode +AM_MAINTAINER_MODE + +dnl check for tools +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL +AC_PROG_LIBTOOL + +PKG_CHECK_MODULES([CHECK], [check], HAVE_CHECK=yes, HAVE_CHECK=no) + +dnl Keep correct libtool macros in-tree. +AC_CONFIG_MACRO_DIR([m4]) + +dnl initialize GStreamer macros +AG_GST_INIT + +dnl define an ERROR_CFLAGS Makefile variable +dnl AG_GST_SET_ERROR_CFLAGS($GST_CVS) + +dnl add GStreamer arguments +AG_GST_ARG_DEBUG +AG_GST_ARG_PROFILING +AG_GST_ARG_VALGRIND +AG_GST_ARG_GCOV + +AG_GST_ARG_WITH_PKG_CONFIG_PATH +AG_GST_ARG_WITH_PACKAGE_NAME +AG_GST_ARG_WITH_PACKAGE_ORIGIN + +dnl ** checks ** + +dnl Check for GLib +PKG_CHECK_MODULES([GTHREAD], [gthread-2.0]) + +dnl Check for GStreamer +AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQUIRED]) +AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQUIRED]) +AG_GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQUIRED], [no]) + +dnl ** finalize *** + +dnl set license and copyright notice +GST_LICENSE="LGPL" +AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license]) +AC_SUBST(GST_LICENSE) + +dnl set GStreamer plug-in dir +AG_GST_SET_PLUGINDIR + +dnl GST_OPTION_CFLAGS +if test "x$USE_DEBUG" = xyes; then + PROFILE_CFLAGS="-g" +fi +AC_SUBST(PROFILE_CFLAGS) + +dnl XXX temporarily disabled deprecated checks because gst_element_class_set_details() +dnl was deprecated.. this is only a temporary solution +dnl DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED" +dnl AC_SUBST(DEPRECATED_CFLAGS) + +dnl every flag in GST_OPTION_CFLAGS can be overridden at make time +GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)" +AC_SUBST(GST_OPTION_CFLAGS) + +dnl our libraries need to be versioned correctly +AC_SUBST(GST_LT_LDFLAGS) + +dnl FIXME: do we want to rename to GST_ALL_* ? +dnl prefer internal headers to already installed ones +dnl also add builddir include for enumtypes and marshal +dnl add GST_OPTION_CFLAGS, but overridable +GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(GST_OPTION_CFLAGS)" +AC_SUBST(GST_CFLAGS) +AC_SUBST(GST_LIBS) + +dnl LDFLAGS really should only contain flags, not libs - they get added before +dnl whatevertarget_LIBS and -L flags here affect the rest of the linking +GST_ALL_LDFLAGS="-no-undefined" +AC_SUBST(GST_ALL_LDFLAGS) + +dnl this really should only contain flags, not libs - they get added before +dnl whatevertarget_LIBS and -L flags here affect the rest of the linking +GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS" +AC_SUBST(GST_PLUGIN_LDFLAGS) + +SHAVE_INIT +AC_CONFIG_FILES([shave shave-libtool]) + +AC_CONFIG_FILES([Makefile \ + omx/Makefile \ + util/Makefile \ + m4/Makefile]) + +AC_OUTPUT diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/ext/Makefile b/gstreamer_ti_dm81xx/ti_build/gst-openmax/ext/Makefile new file mode 100755 index 0000000..45953cb --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/ext/Makefile @@ -0,0 +1,32 @@ +# makefile to build shared lib +all: + @mkdir -p lib + @echo " CCLD lib/libOMX_Core.so" + @$(CROSS_COMPILE)gcc -Wl,-soname,libOMX_Core -shared \ + $(OMX_INSTALL_DIR)/lib/omxcore.av5T \ + $(OMX_INSTALL_DIR)/lib/ti/omx/domx/lib/a8host/debug/domx.av5T \ + $(OSAL_INSTALL_DIR)/packages/linuxdist/build/lib/osal.a \ + $(OMX_INSTALL_DIR)/lib/omxobjs/obj/$(OMX_PLATFORM)/a8host/debug/omxcore_cfg.ov5T \ + $(OMX_INSTALL_DIR)/lib/omxobjs/obj/$(OMX_PLATFORM)/a8host/debug/domx_cfg.ov5T \ + $(OMX_INSTALL_DIR)/lib/memcfg.av5T \ + $(OMX_INSTALL_DIR)/lib/omxobjs/obj/$(OMX_PLATFORM)/a8host/debug/memtbl_cfg.ov5T \ + $(OMX_INSTALL_DIR)/lib/timmosal.av5T \ + $(SYSLINK_INSTALL_DIR)/packages/ti/syslink/lib/syslink.a_release \ + $(FC_INSTALL_DIR)/packages/ti/sdo/rcm/lib/debug/rcm_syslink.av5T \ + $(OMX_INSTALL_DIR)/lib/domx_delegates_shmem.av5T \ + $(FC_INSTALL_DIR)/packages/ti/sdo/fc/memutils/lib/release/memutils.av5T \ + $(OSAL_INSTALL_DIR)/packages/linuxdist/cstubs/lib/cstubs.a \ + $(OMX_INSTALL_DIR)/lib/omxobjs/obj/$(OMX_PLATFORM)/a8host/debug/domxProxyWrappers.ov5T \ + $(FC_INSTALL_DIR)/packages/ti/sdo/fc/global/lib/debug/fcsettings.av5T \ + $(LINUXUTILS_INSTALL_DIR)/packages/ti/sdo/linuxutils/cmem/lib/cmem.a470MV \ + $(OMX_INSTALL_DIR)/lib/ti/omx/domx/obj/a8host/debug/OmxRpcCbSkel.ov5T \ + $(OMX_INSTALL_DIR)/lib/omxobjs/obj/$(OMX_PLATFORM)/a8host/debug/domx_delegates_shmem_cfg.ov5T \ + $(UIA_INSTALL_DIR)/packages/ti/uia/linux/lib/servicemgr.a \ + -lc -lstdc++ -lm -pthread -lrt -o lib/libOMX_Core.so -Wl,--fix-cortex-a8 -Wl,--no-undefined \ + -Wl,-u,OMX_Init -Wl,-u,OMX_Deinit -Wl,-u,OMX_ComponentNameEnum -Wl,-u,OMX_GetHandle -Wl,-u,OMX_FreeHandle \ + -Wl,-u,OMX_GetRolesOfComponent + +clean: + rm -rf lib + +install: all diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/Makefile.am b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/Makefile.am new file mode 100644 index 0000000..93e9eb5 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/Makefile.am @@ -0,0 +1,7 @@ +EXTRA_DIST = as-ac-expand.m4 \ + as-compiler-flag.m4 \ + gst.m4 \ + gst-args.m4 \ + gst-check.m4 \ + gst-error.m4 \ + gst-plugindir.m4 diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-ac-expand.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-ac-expand.m4 new file mode 100644 index 0000000..d6c9e33 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-ac-expand.m4 @@ -0,0 +1,43 @@ +dnl as-ac-expand.m4 0.2.0 +dnl autostars m4 macro for expanding directories using configure's prefix +dnl thomas@apestaart.org + +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) +dnl example +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local + +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix="$ac_default_prefix" + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var" = "x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-compiler-flag.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-compiler-flag.m4 new file mode 100644 index 0000000..f6287d3 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/as-compiler-flag.m4 @@ -0,0 +1,31 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef <ds@schleef.org> +dnl Tim-Philipp Müller <tim centricular net> + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-args.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-args.m4 new file mode 100644 index 0000000..004363c --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-args.m4 @@ -0,0 +1,327 @@ +dnl configure-time options shared among gstreamer modules + +dnl AG_GST_ARG_DEBUG +dnl AG_GST_ARG_PROFILING +dnl AG_GST_ARG_VALGRIND +dnl AG_GST_ARG_GCOV + +dnl AG_GST_ARG_EXAMPLES + +dnl AG_GST_ARG_WITH_PKG_CONFIG_PATH +dnl AG_GST_ARG_WITH_PACKAGE_NAME +dnl AG_GST_ARG_WITH_PACKAGE_ORIGIN + +dnl AG_GST_ARG_WITH_PLUGINS +dnl AG_GST_CHECK_PLUGIN +dnl AG_GST_DISABLE_PLUGIN + +dnl AG_GST_ARG_ENABLE_EXTERNAL +dnl AG_GST_ARG_ENABLE_EXPERIMENTAL +dnl AG_GST_ARG_ENABLE_BROKEN + +AC_DEFUN([AG_GST_ARG_DEBUG], +[ + dnl debugging stuff + AC_ARG_ENABLE(debug, + AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]), + [ + case "${enableval}" in + yes) USE_DEBUG=yes ;; + no) USE_DEBUG=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; + esac + ], + [USE_DEBUG=yes]) dnl Default value +]) + +AC_DEFUN([AG_GST_ARG_PROFILING], +[ + AC_ARG_ENABLE(profiling, + AC_HELP_STRING([--enable-profiling], + [adds -pg to compiler commandline, for profiling]), + [ + case "${enableval}" in + yes) USE_PROFILING=yes ;; + no) USE_PROFILING=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;; + esac + ], + [USE_PROFILING=no]) dnl Default value +]) + +AC_DEFUN([AG_GST_ARG_VALGRIND], +[ + dnl valgrind inclusion + AC_ARG_ENABLE(valgrind, + AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]), + [ + case "${enableval}" in + yes) USE_VALGRIND="$USE_DEBUG" ;; + no) USE_VALGRIND=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;; + esac + ], + [USE_VALGRIND="$USE_DEBUG"]) dnl Default value + VALGRIND_REQ="3.0" + if test "x$USE_VALGRIND" = xyes; then + PKG_CHECK_MODULES(VALGRIND, valgrind >= $VALGRIND_REQ, + USE_VALGRIND="yes", + [ + USE_VALGRIND="no" + AC_MSG_RESULT([no]) + ]) + fi + if test "x$USE_VALGRIND" = xyes; then + AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used]) + AC_MSG_NOTICE(Using extra code paths for valgrind) + fi +]) + +AC_DEFUN([AG_GST_ARG_GCOV], +[ + AC_ARG_ENABLE(gcov, + AC_HELP_STRING([--enable-gcov], + [compile with coverage profiling instrumentation (gcc only)]), + enable_gcov=$enableval, + enable_gcov=no) + if test x$enable_gcov = xyes ; then + if test "x$GCC" != "xyes" + then + AC_MSG_ERROR([gcov only works if gcc is used]) + fi + + AS_COMPILER_FLAG(["-fprofile-arcs"], + [GCOV_CFLAGS="$GCOV_CFLAGS -fprofile-arcs"], + true) + AS_COMPILER_FLAG(["-ftest-coverage"], + [GCOV_CFLAGS="$GCOV_CFLAGS -ftest-coverage"], + true) + dnl remove any -O flags - FIXME: is this needed ? + GCOV_CFLAGS=`echo "$GCOV_CFLAGS" | sed -e 's/-O[[0-9]]*//g'` + dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags + dnl passed to the linker, which is a bug; -fprofile-arcs implicitly + dnl links in -lgcov, so we do it explicitly here for the same effect + GCOV_LIBS=-lgcov + AC_SUBST(GCOV_CFLAGS) + AC_SUBST(GCOV_LIBS) + GCOV=`echo $CC | sed s/gcc/gcov/g` + AC_SUBST(GCOV) + + GST_GCOV_ENABLED=yes + AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1, + [Defined if gcov is enabled to force a rebuild due to config.h changing]) + dnl if gcov is used, we do not want default -O2 CFLAGS + if test "x$GST_GCOV_ENABLED" = "xyes" + then + CFLAGS="-O0" + AC_SUBST(CFLAGS) + CXXFLAGS="-O0" + AC_SUBST(CXXFLAGS) + FFLAGS="-O0" + AC_SUBST(FFLAGS) + CCASFLAGS="-O0" + AC_SUBST(CCASFLAGS) + AC_MSG_NOTICE([gcov enabled, setting CFLAGS and friends to $CFLAGS]) + fi + fi + AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes) +]) + +AC_DEFUN([AG_GST_ARG_EXAMPLES], +[ + AC_ARG_ENABLE(examples, + AC_HELP_STRING([--disable-examples], [disable building examples]), + [ + case "${enableval}" in + yes) BUILD_EXAMPLES=yes ;; + no) BUILD_EXAMPLES=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;; + esac + ], + [BUILD_EXAMPLES=yes]) dnl Default value + AM_CONDITIONAL(BUILD_EXAMPLES, test "x$BUILD_EXAMPLES" = "xyes") +]) + +AC_DEFUN([AG_GST_ARG_WITH_PKG_CONFIG_PATH], +[ + dnl possibly modify pkg-config path + AC_ARG_WITH(pkg-config-path, + AC_HELP_STRING([--with-pkg-config-path], + [colon-separated list of pkg-config(1) dirs]), + [ + export PKG_CONFIG_PATH=${withval} + AC_MSG_NOTICE(Set PKG_CONFIG_PATH to $PKG_CONFIG_PATH) + ]) +]) + + +dnl This macro requires that GST_CVS is set to yes or no (release) +AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_NAME], +[ + dnl package name in plugins + AC_ARG_WITH(package-name, + AC_HELP_STRING([--with-package-name], + [specify package name to use in plugins]), + [ + case "${withval}" in + yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;; + no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;; + *) GST_PACKAGE_NAME="${withval}" ;; + esac + ], + [ + P=$1 + if test "x$P" = "x" + then + P=$PACKAGE_NAME + fi + + dnl default value + if test "x$GST_CVS" = "xyes" + then + dnl nano >= 1 + GST_PACKAGE_NAME="$P CVS/prerelease" + else + GST_PACKAGE_NAME="$P source release" + fi + ] + ) + AC_MSG_NOTICE(Using $GST_PACKAGE_NAME as package name) + AC_DEFINE_UNQUOTED(GST_PACKAGE_NAME, "$GST_PACKAGE_NAME", + [package name in plugins]) + AC_SUBST(GST_PACKAGE_NAME) +]) + +AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_ORIGIN], +[ + dnl package origin URL + AC_ARG_WITH(package-origin, + AC_HELP_STRING([--with-package-origin], + [specify package origin URL to use in plugins]), + [ + case "${withval}" in + yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;; + no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;; + *) GST_PACKAGE_ORIGIN="${withval}" ;; + esac + ], + [GST_PACKAGE_ORIGIN="[Unknown package origin]"] dnl Default value + ) + AC_MSG_NOTICE(Using $GST_PACKAGE_ORIGIN as package origin) + AC_DEFINE_UNQUOTED(GST_PACKAGE_ORIGIN, "$GST_PACKAGE_ORIGIN", + [package origin]) + AC_SUBST(GST_PACKAGE_ORIGIN) +]) + +dnl sets WITH_PLUGINS to the list of plug-ins given as an argument +dnl also clears GST_PLUGINS_ALL and GST_PLUGINS_SELECTED +AC_DEFUN([AG_GST_ARG_WITH_PLUGINS], +[ + AC_ARG_WITH(plugins, + AC_HELP_STRING([--with-plugins], + [comma-separated list of dependencyless plug-ins to compile]), + [WITH_PLUGINS=$withval], + [WITH_PLUGINS=]) + + GST_PLUGINS_ALL="" + GST_PLUGINS_SELECTED="" + + AC_SUBST(GST_PLUGINS_ALL) + AC_SUBST(GST_PLUGINS_SELECTED) +]) + +dnl AG_GST_CHECK_PLUGIN(PLUGIN-NAME) +dnl +dnl This macro adds the plug-in <PLUGIN-NAME> to GST_PLUGINS_ALL. Then it +dnl checks if WITH_PLUGINS is empty or the plugin is present in WITH_PLUGINS, +dnl and if so adds it to GST_PLUGINS_SELECTED. Then it checks if the plugin +dnl is present in WITHOUT_PLUGINS (ie. was disabled specifically) and if so +dnl removes it from GST_PLUGINS_SELECTED. +dnl +dnl The macro will call AM_CONDITIONAL(USE_PLUGIN_<PLUGIN-NAME>, ...) to allow +dnl control of what is built in Makefile.ams. +AC_DEFUN([AG_GST_CHECK_PLUGIN], +[ + GST_PLUGINS_ALL="$GST_PLUGINS_ALL [$1]" + + define([pname_def],translit([$1], -a-z, _a-z)) + + AC_ARG_ENABLE([$1], + AC_HELP_STRING([--disable-[$1]], [disable dependency-less $1 plugin]), + [ + case "${enableval}" in + yes) [gst_use_]pname_def=yes ;; + no) [gst_use_]pname_def=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;; + esac + ], + [[gst_use_]pname_def=yes]) dnl Default value + + if test x$[gst_use_]pname_def = xno; then + AC_MSG_NOTICE(disabling dependency-less plugin $1) + WITHOUT_PLUGINS="$WITHOUT_PLUGINS [$1]" + fi + undefine([pname_def]) + + if [[ -z "$WITH_PLUGINS" ]] || echo " [$WITH_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then + GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED [$1]" + fi + if echo " [$WITHOUT_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then + GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'` + fi + AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), echo " $GST_PLUGINS_SELECTED " | grep -i " [$1] " > /dev/null) +]) + +dnl AG_GST_DISABLE_PLUGIN(PLUGIN-NAME) +dnl +dnl This macro disables the plug-in <PLUGIN-NAME> by removing it from +dnl GST_PLUGINS_SELECTED. +AC_DEFUN([AG_GST_DISABLE_PLUGIN], +[ + GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'` + AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), false) +]) + +AC_DEFUN([AG_GST_ARG_ENABLE_EXTERNAL], +[ + AG_GST_CHECK_FEATURE(EXTERNAL, [building of plug-ins with external deps],, + HAVE_EXTERNAL=yes, enabled, + [ + AC_MSG_NOTICE(building external plug-ins) + BUILD_EXTERNAL="yes" + ],[ + AC_MSG_WARN(all plug-ins with external dependencies will not be built) + BUILD_EXTERNAL="no" + ]) + # make BUILD_EXTERNAL available to Makefile.am + AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes") +]) + +dnl experimental plug-ins; stuff that hasn't had the dust settle yet +dnl read 'builds, but might not work' +AC_DEFUN([AG_GST_ARG_ENABLE_EXPERIMENTAL], +[ + AG_GST_CHECK_FEATURE(EXPERIMENTAL, [building of experimental plug-ins],, + HAVE_EXPERIMENTAL=yes, disabled, + [ + AC_MSG_WARN(building experimental plug-ins) + BUILD_EXPERIMENTAL="yes" + ],[ + AC_MSG_NOTICE(not building experimental plug-ins) + BUILD_EXPERIMENTAL="no" + ]) + # make BUILD_EXPERIMENTAL available to Makefile.am + AM_CONDITIONAL(BUILD_EXPERIMENTAL, test "x$BUILD_EXPERIMENTAL" = "xyes") +]) + +dnl broken plug-ins; stuff that doesn't seem to build at the moment +AC_DEFUN([AG_GST_ARG_ENABLE_BROKEN], +[ + AG_GST_CHECK_FEATURE(BROKEN, [building of broken plug-ins],, + HAVE_BROKEN=yes, disabled, + [ + AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches ...]) + ],[ + AC_MSG_NOTICE([not building broken plug-ins]) + ]) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-check.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-check.m4 new file mode 100644 index 0000000..a52a184 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-check.m4 @@ -0,0 +1,138 @@ +dnl pkg-config-based checks for GStreamer modules and dependency modules + +dnl generic: +dnl AG_GST_PKG_CHECK_MODULES([PREFIX], [WHICH], [REQUIRED]) +dnl sets HAVE_[$PREFIX], [$PREFIX]_* +dnl AG_GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED]) +dnl sets HAVE_[$PREFIX], [$PREFIX]_* + +dnl specific: +dnl AG_GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED]) +dnl also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR +dnl AG_GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED]) +dnl AG_GST_CHECK_GST_GDP([MAJMIN], [MINVER], [REQUIRED]) +dnl AG_GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED]) +dnl AG_GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED]) +dnl AG_GST_CHECK_GST_PLUGINS_BASE([MAJMIN], [MINVER], [REQUIRED]) +dnl also sets/ACSUBSTs GSTPB_PLUGINS_DIR + +AC_DEFUN([AG_GST_PKG_CHECK_MODULES], +[ + which="[$2]" + dnl not required by default, since we use this mostly for plugin deps + required=ifelse([$3], , "no", [$3]) + + PKG_CHECK_MODULES([$1], $which, + [ + HAVE_[$1]="yes" + ], + [ + HAVE_[$1]="no" + AC_MSG_RESULT(no) + if test "x$required" = "xyes"; then + AC_MSG_ERROR($[$1]_PKG_ERRORS) + else + AC_MSG_NOTICE($[$1]_PKG_ERRORS) + fi + ]) + + dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7 + dnl It gets done automatically in automake >= 1.7, which we now require +])) + +AC_DEFUN([AG_GST_CHECK_MODULES], +[ + module=[$2] + minver=[$3] + name="[$4]" + required=ifelse([$5], , "yes", [$5]) dnl required by default + + PKG_CHECK_MODULES([$1], $module >= $minver, + [ + HAVE_[$1]="yes" + ], + [ + HAVE_[$1]="no" + AC_MSG_RESULT(no) + AC_MSG_NOTICE($[$1]_PKG_ERRORS) + if test "x$required" = "xyes"; then + AC_MSG_ERROR([no $module >= $minver ($name) found]) + else + AC_MSG_NOTICE([no $module >= $minver ($name) found]) + fi + ]) + + dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7 + dnl It gets done automatically in automake >= 1.7, which we now require +])) + +AC_DEFUN([AG_GST_CHECK_GST], +[ + AG_GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3]) + dnl allow setting before calling this macro to override + if test -z $GST_TOOLS_DIR; then + GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-[$1]` + if test -z $GST_TOOLS_DIR; then + AC_MSG_ERROR( + [no tools dir set in GStreamer pkg-config file, core upgrade needed.]) + fi + fi + AC_MSG_NOTICE([using GStreamer tools in $GST_TOOLS_DIR]) + AC_SUBST(GST_TOOLS_DIR) + + dnl check for where core plug-ins got installed + dnl this is used for unit tests + dnl allow setting before calling this macro to override + if test -z $GST_PLUGINS_DIR; then + GST_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-[$1]` + if test -z $GST_PLUGINS_DIR; then + AC_MSG_ERROR( + [no pluginsdir set in GStreamer pkg-config file, core upgrade needed.]) + fi + fi + AC_MSG_NOTICE([using GStreamer plug-ins in $GST_PLUGINS_DIR]) + AC_SUBST(GST_PLUGINS_DIR) +]) + +AC_DEFUN([AG_GST_CHECK_GST_BASE], +[ + AG_GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2], + [GStreamer Base Libraries], [$3]) +]) + +AC_DEFUN([AG_GST_CHECK_GST_GDP], +[ + AG_GST_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-[$1], [$2], + [GStreamer Data Protocol Library], [$3]) +]) + +AC_DEFUN([AG_GST_CHECK_GST_CONTROLLER], +[ + AG_GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2], + [GStreamer Controller Library], [$3]) +]) + +AC_DEFUN([AG_GST_CHECK_GST_CHECK], +[ + AG_GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2], + [GStreamer Check unittest Library], [$3]) +]) + +AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BASE], +[ + AG_GST_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-[$1], [$2], + [GStreamer Base Plug-ins Library], [$3]) + + dnl check for where base plug-ins got installed + dnl this is used for unit tests + dnl allow setting before calling this macro to override + if test -z $GSTPB_PLUGINS_DIR; then + GSTPB_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-base-[$1]` + if test -z $GSTPB_PLUGINS_DIR; then + AC_MSG_ERROR( + [no pluginsdir set in GStreamer Base Plug-ins pkg-config file]) + fi + fi + AC_MSG_NOTICE([using GStreamer Base Plug-ins in $GSTPB_PLUGINS_DIR]) + AC_SUBST(GSTPB_PLUGINS_DIR) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-error.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-error.m4 new file mode 100644 index 0000000..e5cab79 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-error.m4 @@ -0,0 +1,85 @@ +Dnl handle various error-related things + +dnl Thomas Vander Stichele <thomas@apestaart.org> +dnl Tim-Philipp Müller <tim centricular net> + +dnl Last modification: 2008-02-18 + +dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR]) +dnl AG_GST_SET_ERROR_CXXFLAGS([ADD-WERROR]) +dnl AG_GST_SET_LEVEL_DEFAULT([IS-CVS-VERSION]) + + +dnl Sets ERROR_CFLAGS to something the compiler will accept. +dnl AC_SUBST them so they are available in Makefile + +dnl -Wall is added if it is supported +dnl -Werror is added if ADD-WERROR is not "no" + +dnl These flags can be overridden at make time: +dnl make ERROR_CFLAGS= +AC_DEFUN([AG_GST_SET_ERROR_CFLAGS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AS_COMPILER_FLAG]) + + + dnl if we support -Wall, set it unconditionally + AS_COMPILER_FLAG(-Wall, + ERROR_CFLAGS="-Wall", + ERROR_CFLAGS="") + + dnl Warn if declarations after statements are used (C99 extension) + AS_COMPILER_FLAG(-Wdeclaration-after-statement, + ERROR_CFLAGS="$ERROR_CFLAGS -Wdeclaration-after-statement") + + dnl Warn if variable length arrays are used (C99 extension) + AS_COMPILER_FLAG(-Wvla, + ERROR_CFLAGS="$ERROR_CFLAGS -Wvla") + + dnl Warn for invalid pointer arithmetic + AS_COMPILER_FLAG(-Wpointer-arith, + ERROR_CFLAGS="$ERROR_CFLAGS -Wpointer-arith") + + dnl if asked for, add -Werror if supported + if test "x$1" != "xno" + then + AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror") + + dnl if -Werror isn't suported, try -errwarn=%all (Sun Forte case) + if test "x$ERROR_CFLAGS" == "x" + then + AS_COMPILER_FLAG([-errwarn=%all], [ + ERROR_CFLAGS="-errwarn=%all" + dnl try -errwarn=%all,no%E_EMPTY_DECLARATION, + dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH, + dnl no%E_MACRO_REDEFINED (Sun Forte case) + dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon + dnl "statement not reached" disabled because there is g_assert_not_reached () in some places + dnl "macro redefined" because of gst/gettext.h + dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'? + for f in 'no%E_EMPTY_DECLARATION' \ + 'no%E_STATEMENT_NOT_REACHED' \ + 'no%E_ARGUEMENT_MISMATCH' \ + 'no%E_MACRO_REDEFINED' \ + 'no%E_LOOP_NOT_ENTERED_AT_TOP' + do + AS_COMPILER_FLAG([-errwarn=%all,$f], [ + ERROR_CFLAGS="$ERROR_CFLAGS,$f" + ]) + done + ]) + else + dnl Add -fno-strict-aliasing for GLib versions before 2.19.8 + dnl as before G_LOCK and friends caused strict aliasing compiler + dnl warnings. + PKG_CHECK_EXISTS([glib-2.0 < 2.19.8], [ + AS_COMPILER_FLAG(-fno-strict-aliasing, + ERROR_CFLAGS="$ERROR_CFLAGS -fno-strict-aliasing") + ]) + fi + fi + + AC_SUBST(ERROR_CFLAGS) + AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS]) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-plugindir.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-plugindir.m4 new file mode 100644 index 0000000..09989d0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst-plugindir.m4 @@ -0,0 +1,17 @@ +dnl AG_GST_SET_PLUGINDIR + +dnl AC_DEFINE PLUGINDIR to the full location where plug-ins will be installed +dnl AC_SUBST plugindir, to be used in Makefile.am's + +AC_DEFUN([AG_GST_SET_PLUGINDIR], +[ + dnl define location of plugin directory + AS_AC_EXPAND(PLUGINDIR, ${libdir}/gstreamer-$GST_MAJORMINOR) + AC_DEFINE_UNQUOTED(PLUGINDIR, "$PLUGINDIR", + [directory where plugins are located]) + AC_MSG_NOTICE([Using $PLUGINDIR as the plugin install location]) + + dnl plugin directory configure-time variable for use in Makefile.am + plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" + AC_SUBST(plugindir) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst.m4 new file mode 100644 index 0000000..04b466f --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/gst.m4 @@ -0,0 +1,10 @@ +dnl AG_GST_INIT +dnl sets up use of GStreamer configure.ac macros +dnl all GStreamer autoconf macros are prefixed +dnl with AG_GST_ for public macros +dnl with _AG_GST_ for private macros + +AC_DEFUN([AG_GST_INIT], +[ + m4_pattern_forbid(^_?AG_GST_) +]) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/shave.m4 b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/shave.m4 new file mode 100644 index 0000000..01cb5c7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/m4/shave.m4 @@ -0,0 +1,76 @@ +dnl Make automake/libtool output more friendly to humans +dnl +dnl SHAVE_INIT([shavedir],[default_mode]) +dnl +dnl shavedir: the directory where the shave scripts are, it defaults to +dnl $(top_builddir) +dnl default_mode: (enable|disable) default shave mode. This parameter +dnl controls shave's behaviour when no option has been +dnl given to configure. It defaults to disable. +dnl +dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just +dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and +dnl LIBTOOL, you don't want the configure tests to have these variables +dnl re-defined. +dnl * This macro requires GNU make's -s option. + +AC_DEFUN([_SHAVE_ARG_ENABLE], +[ + AC_ARG_ENABLE([shave], + AS_HELP_STRING( + [--enable-shave], + [use shave to make the build pretty [[default=$1]]]),, + [enable_shave=$1] + ) +]) + +AC_DEFUN([SHAVE_INIT], +[ + dnl you can tweak the default value of enable_shave + m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) + + if test x"$enable_shave" = xyes; then + dnl where can we find the shave scripts? + m4_if([$1],, + [shavedir="$ac_pwd"], + [shavedir="$ac_pwd/$1"]) + AC_SUBST(shavedir) + + dnl make is now quiet + AC_SUBST([MAKEFLAGS], [-s]) + AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) + + dnl we need sed + AC_CHECK_PROG(SED,sed,sed,false) + + dnl substitute libtool + SHAVE_SAVED_LIBTOOL=$LIBTOOL + LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" + AC_SUBST(LIBTOOL) + + dnl substitute cc/cxx + SHAVE_SAVED_CC=$CC + SHAVE_SAVED_CXX=$CXX + SHAVE_SAVED_FC=$FC + SHAVE_SAVED_F77=$F77 + SHAVE_SAVED_OBJC=$OBJC + CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}" + CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}" + FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}" + F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}" + OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}" + AC_SUBST(CC) + AC_SUBST(CXX) + AC_SUBST(FC) + AC_SUBST(F77) + AC_SUBST(OBJC) + + V=@ + else + V=1 + fi + Q='$(V:1=)' + AC_SUBST(V) + AC_SUBST(Q) +]) + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/Makefile.am b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/Makefile.am new file mode 100755 index 0000000..00ea054 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/Makefile.am @@ -0,0 +1,71 @@ +plugin_LTLIBRARIES = libgstomx.la + +libgstomx_la_SOURCES = gstomx.c gstomx.h \ + gstomx_interface.c gstomx_interface.h \ + gstomx_base_filter.c gstomx_base_filter.h \ + gstomx_base_videodec.c gstomx_base_videodec.h \ + gstomx_base_videoenc.c gstomx_base_videoenc.h \ + gstomx_base_audiodec.c gstomx_base_audiodec.h \ + gstomx_util.c gstomx_util.h \ + gstomx_core.c gstomx_core.h \ + gstomx_port.c gstomx_port.h \ + gstomx_dummy.c gstomx_dummy.h \ + gstomx_volume.c gstomx_volume.h \ + gstomx_mpeg4dec.c gstomx_mpeg4dec.h \ + gstomx_mpeg2dec.c gstomx_mpeg2dec.h \ + gstomx_h263dec.c gstomx_h263dec.h \ + gstomx_h264dec.c gstomx_h264dec.h \ + gstomx_vc1dec.c gstomx_vc1dec.h \ + gstomx_wmvdec.c gstomx_wmvdec.h \ + gstomx_mpeg4enc.c gstomx_mpeg4enc.h \ + gstomx_h264enc.c gstomx_h264enc.h \ + gstomx_h263enc.c gstomx_h263enc.h \ + gstomx_vorbisdec.c gstomx_vorbisdec.h \ + gstomx_amrnbdec.c gstomx_amrnbdec.h \ + gstomx_amrnbenc.c gstomx_amrnbenc.h \ + gstomx_amrwbdec.c gstomx_amrwbdec.h \ + gstomx_amrwbenc.c gstomx_amrwbenc.h \ + gstomx_aacdec.c gstomx_aacdec.h \ + gstomx_aacenc.c gstomx_aacenc.h \ + gstomx_mp3dec.c gstomx_mp3dec.h \ + gstomx_mp2dec.c gstomx_mp2dec.h \ + gstomx_adpcmdec.c gstomx_adpcmdec.h \ + gstomx_adpcmenc.c gstomx_adpcmenc.h \ + gstomx_g711dec.c gstomx_g711dec.h \ + gstomx_g711enc.c gstomx_g711enc.h \ + gstomx_g729dec.c gstomx_g729dec.h \ + gstomx_g729enc.c gstomx_g729enc.h \ + gstomx_ilbcdec.c gstomx_ilbcdec.h \ + gstomx_ilbcenc.c gstomx_ilbcenc.h \ + gstomx_jpegenc.c gstomx_jpegenc.h \ + gstomx_jpegdec.c gstomx_jpegdec.h \ + gstomx_base_sink.c gstomx_base_sink.h \ + gstomx_audiosink.c gstomx_audiosink.h \ + gstomx_videosink.c gstomx_videosink.h \ + gstomx_base_src.c gstomx_base_src.h \ + gstomx_filereadersrc.c gstomx_filereadersrc.h \ + swcsc.c swcsc.h \ + gstperf.c gstperf.h \ + gstomx_buffertransport.c gstomx_buffertransport.h \ + gstomx_base_vfpc.c gstomx_base_vfpc.h \ + gstomx_base_ctrl.c gstomx_base_ctrl.h \ + gstomx_scaler.c gstomx_scaler.h \ + gstomx_noisefilter.c gstomx_noisefilter.h \ + gstomx_videomixer.c gstomx_videomixer.h + +libgstomx_la_LIBADD = $(OMXCORE_LIBS) $(GST_LIBS) $(GST_BASE_LIBS) -lgstvideo-0.10 $(top_builddir)/util/libutil.la +libgstomx_la_CFLAGS = $(OMXCORE_CFLAGS) $(OMXTIAUDIODEC_CFLAGS) $(USE_OMXTIAUDIODEC) $(GST_CFLAGS) $(GST_BASE_CFLAGS) -I$(top_srcdir)/util \ + -Dxdc_target_name__=GCArmv5T -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc__RESTRICT__ \ + -I$(OMX_INSTALL_DIR)/include/openMaxv11 \ + -I$(OMX_INSTALL_DIR)/packages \ + -I$(XDC_INSTALL_DIR)/packages \ + -I$(OMX_INSTALL_DIR)/include \ + -I$(OMX_INSTALL_DIR)/packages/ti/omx/comp/ctrl \ + -I$(KERNEL_INSTALL_DIR)/include -I$(KERNEL_INSTALL_DIR)/arch/arm/include \ + -I$(OMX_INSTALL_DIR)/packages/ti/omx/interfaces/openMaxv11 \ + -I$(OMX_INSTALL_DIR)/packages/ti/omx/comp/vfpc \ + -I$(OMX_INSTALL_DIR)/packages/ti/omx/comp/vfdc \ + -I$(OMX_INSTALL_DIR)/packages/ti/omx/comp/ctrl + +libgstomx_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -L../ext/lib -lOMX_Core -pthread + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.c new file mode 100755 index 0000000..9dc840f --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx.h" +#include "gstomx_dummy.h" +#include "gstomx_mpeg4dec.h" +#include "gstomx_mpeg2dec.h" +#include "gstomx_h263dec.h" +#include "gstomx_h264dec.h" +#include "gstomx_vp6dec.h" +#include "gstomx_wmvdec.h" +#include "gstomx_mpeg4enc.h" +#include "gstomx_h264enc.h" +#include "gstomx_h263enc.h" +#include "gstomx_vorbisdec.h" +#include "gstomx_mp3dec.h" +#include "gstomx_mp2dec.h" +#include "gstomx_aacdec.h" +#include "gstomx_aacenc.h" +#include "gstomx_amrnbdec.h" +#include "gstomx_amrnbenc.h" +#include "gstomx_amrwbdec.h" +#include "gstomx_amrwbenc.h" +#include "gstomx_adpcmdec.h" +#include "gstomx_adpcmenc.h" +#include "gstomx_g711dec.h" +#include "gstomx_g711enc.h" +#include "gstomx_g729dec.h" +#include "gstomx_g729enc.h" +#include "gstomx_ilbcdec.h" +#include "gstomx_ilbcenc.h" +#include "gstomx_jpegenc.h" +#include "gstomx_jpegdec.h" +#include "gstomx_audiosink.h" +#include "gstomx_videosink.h" +#include "gstomx_filereadersrc.h" +#include "gstomx_volume.h" +#include "gstomx_camera.h" +#include "swcsc.h" +#include "gstperf.h" +#include "gstomx_scaler.h" +#include "gstomx_noisefilter.h" +#include "gstomx_base_ctrl.h" +#include "gstomx_vc1dec.h" + +#include "gstomx_videomixer.h" +#include "config.h" + +GST_DEBUG_CATEGORY (gstomx_debug); +GST_DEBUG_CATEGORY (gstomx_ppm); + +typedef struct TableItem +{ + const gchar *name; + const gchar *library_name; + const gchar *component_name; + const gchar *component_role; + guint rank; + GType (*get_type) (void); +} TableItem; + +static TableItem element_table[] = +{ +// { "omx_dummy", "libOMX_Core.so", "OMX.TI.DUCATI1.MISC.SAMPLE", NULL, GST_RANK_NONE, gst_omx_dummy_get_type }, + { "omx_mpeg4dec", "libOMX_Core.so", "OMX.TI.DUCATI.VIDDEC", "", GST_RANK_PRIMARY, gst_omx_mpeg4dec_get_type }, + { "omx_h264dec", "libOMX_Core.so", "OMX.TI.DUCATI.VIDDEC", "", GST_RANK_PRIMARY, gst_omx_h264dec_get_type }, + { "omx_mpeg2dec", "libOMX_Core.so", "OMX.TI.DUCATI.VIDDEC", "", GST_RANK_PRIMARY, gst_omx_mpeg2dec_get_type }, +// { "omx_h263dec", "libOMX_Core.so", "OMX.TI.DUCATI.VIDDEC", "", GST_RANK_PRIMARY, gst_omx_h263dec_get_type }, +// { "omx_vp6dec", "libOMX_Core.so", "OMX.TI.DUCATI1.VIDEO.DECODER", "video_decoder.vp6", GST_RANK_PRIMARY, gst_omx_vp6dec_get_type }, +// { "omx_wmvdec", "libOMX_Core.so", "OMX.TI.Video.Decoder", NULL, GST_RANK_NONE, gst_omx_wmvdec_get_type }, +// { "omx_mpeg4enc", "libOMX_Core.so", "OMX.TI.DUCATI.VIDENC", NULL, GST_RANK_PRIMARY, gst_omx_mpeg4enc_get_type }, + { "omx_h264enc", "libOMX_Core.so", "OMX.TI.DUCATI.VIDENC", "", GST_RANK_PRIMARY, gst_omx_h264enc_get_type }, + { "omx_vc1dec", "libOMX_Core.so", "OMX.TI.DUCATI.VIDDEC", "", GST_RANK_PRIMARY, gst_omx_vc1dec_get_type }, +// { "omx_h263enc", "libOMX_Core.so", "OMX.TI.DUCATI.VIDENC", NULL, GST_RANK_PRIMARY, gst_omx_h263enc_get_type }, +// { "omx_vorbisdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ogg.single", NULL, GST_RANK_NONE, gst_omx_vorbisdec_get_type }, +// { "omx_mp3dec", "libOMX_Core.so", "OMX.TI.AUDIO.DECODE", "audio_decode.dsp.mp3", GST_RANK_NONE, gst_omx_mp3dec_get_type }, +// { "omx_mp2dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.mp3.mad", NULL, GST_RANK_NONE, gst_omx_mp2dec_get_type }, +// { "omx_amrnbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrnb", NULL, GST_RANK_NONE, gst_omx_amrnbdec_get_type }, +// { "omx_amrnbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrnb", NULL, GST_RANK_NONE, gst_omx_amrnbenc_get_type }, +// { "omx_amrwbdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.amrwb", NULL, GST_RANK_NONE, gst_omx_amrwbdec_get_type }, +// { "omx_amrwbenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.amrwb", NULL, GST_RANK_NONE, gst_omx_amrwbenc_get_type }, +// { "omx_aacdec", "libOMX_Core.so", "OMX.TI.AUDIO.DECODE", "audio_decode.dsp.aac", GST_RANK_NONE, gst_omx_aacdec_get_type }, +// { "omx_aacenc", "libOMX_Core.so", "OMX.TI.AUDIO.ENCODE", "audio_encode.dsp.aac", GST_RANK_NONE, gst_omx_aacenc_get_type }, +// { "omx_adpcmdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.adpcm", NULL, GST_RANK_NONE, gst_omx_adpcmdec_get_type }, +// { "omx_adpcmenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.adpcm", NULL, GST_RANK_NONE, gst_omx_adpcmenc_get_type }, +// { "omx_g711dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g711", NULL, GST_RANK_NONE, gst_omx_g711dec_get_type }, +// { "omx_g711enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g711", NULL, GST_RANK_NONE, gst_omx_g711enc_get_type }, +// { "omx_g729dec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.g729", NULL, GST_RANK_NONE, gst_omx_g729dec_get_type }, +// { "omx_g729enc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.g729", NULL, GST_RANK_NONE, gst_omx_g729enc_get_type }, +// { "omx_ilbcdec", "libomxil-bellagio.so.0", "OMX.st.audio_decoder.ilbc", NULL, GST_RANK_NONE, gst_omx_ilbcdec_get_type }, +// { "omx_ilbcenc", "libomxil-bellagio.so.0", "OMX.st.audio_encoder.ilbc", NULL, GST_RANK_NONE, gst_omx_ilbcenc_get_type }, +// { "omx_jpegenc", "libOMX_Core.so", "OMX.TI.JPEG.encoder", NULL, GST_RANK_NONE, gst_omx_jpegenc_get_type }, +// { "omx_jpegdec", "libOMX_Core.so", "OMX.TI.DUCATI1.IMAGE.JPEGD", NULL, GST_RANK_NONE, gst_omx_jpegdec_get_type }, +// { "omx_audiosink", "libomxil-bellagio.so.0", "OMX.st.alsa.alsasink", NULL, GST_RANK_NONE, gst_omx_audiosink_get_type }, + { "omx_videosink", "libOMX_Core.so", "OMX.TI.VPSSM3.VFDC", NULL, GST_RANK_PRIMARY, gst_omx_videosink_get_type }, +// { "omx_filereadersrc", "libomxil-bellagio.so.0", "OMX.st.audio_filereader", NULL, GST_RANK_NONE, gst_omx_filereadersrc_get_type }, +// { "omx_volume", "libomxil-bellagio.so.0", "OMX.st.volume.component", NULL, GST_RANK_NONE, gst_omx_volume_get_type }, + { "swcsc", "libOMX_Core.so", NULL, NULL, GST_RANK_PRIMARY, gst_swcsc_get_type }, + { "gstperf", "libOMX_Core.so", NULL, NULL, GST_RANK_PRIMARY, gst_perf_get_type }, + { "omx_scaler", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.INDTXSCWB", "", GST_RANK_PRIMARY, gst_omx_scaler_get_type }, + { "omx_noisefilter", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.NF", "", GST_RANK_PRIMARY, gst_omx_noisefilter_get_type }, + { "omx_ctrl", "libOMX_Core.so", "OMX.TI.VPSSM3.CTRL.DC", "", GST_RANK_PRIMARY, gst_omx_base_ctrl_get_type }, +// { "omx_camera", "libOMX_Core.so", "OMX.TI.DUCATI1.VIDEO.CAMERA", NULL, GST_RANK_PRIMARY, gst_omx_camera_get_type }, + { "omx_videomixer", "libOMX_Core.so", "OMX.TI.VPSSM3.VFPC.INDTXSCWB", "", GST_RANK_PRIMARY, gst_omx_video_mixer_get_type }, + { NULL, NULL, NULL, NULL, 0, NULL }, +}; + +static gboolean +plugin_init (GstPlugin *plugin) +{ + GQuark library_name_quark; + GQuark component_name_quark; + GQuark component_role_quark; + GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax"); + GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility"); + GST_DEBUG_CATEGORY_INIT (gstomx_ppm, "omx_ppm", 0, + "gst-openmax performance"); + + library_name_quark = g_quark_from_static_string ("library-name"); + component_name_quark = g_quark_from_static_string ("component-name"); + component_role_quark = g_quark_from_static_string ("component-role"); + + g_omx_init (); + + { + guint i; + for (i = 0; element_table[i].name; i++) + { + TableItem *element; + GType type; + + element = &element_table[i]; + type = element->get_type (); + g_type_set_qdata (type, library_name_quark, (gpointer) element->library_name); + g_type_set_qdata (type, component_name_quark, (gpointer) element->component_name); + g_type_set_qdata (type, component_role_quark, (gpointer) element->component_role); + + if (!gst_element_register (plugin, element->name, element->rank, type)) + { + g_warning ("failed registering '%s'", element->name); + return FALSE; + } + } + } + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "omx", + "OpenMAX IL", + plugin_init, + PACKAGE_VERSION, + GST_LICENSE, + GST_PACKAGE_NAME, + GST_PACKAGE_ORIGIN) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.h new file mode 100644 index 0000000..7859090 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_H +#define GSTOMX_H + +#include <gst/gst.h> +#include <stdio.h> + +G_BEGIN_DECLS + +GST_DEBUG_CATEGORY_EXTERN (gstomx_debug); +GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug); +GST_DEBUG_CATEGORY_EXTERN (gstomx_ppm); +#define GST_CAT_DEFAULT gstomx_debug + +G_END_DECLS + +#endif /* GSTOMX_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.c new file mode 100644 index 0000000..09b0cc7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.c @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_aacdec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ +#ifdef USE_OMXTIAUDIODEC +# include <audio_decode/TIDspOmx.h> +#endif + +enum +{ + ARG_0, + ARG_FRAMEMODE, +}; + +#define FRAMEMODE_DEFAULT FALSE + +GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +typedef enum +{ + AAC_PROFILE_LC = 2, + AAC_PROFILE_LC_SBR = 5, + AAC_PROFILE_LC_SBR_PS = 6, +} AacVersion; + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 8, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + "channels", GST_TYPE_INT_RANGE, 1, 8, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "object_type", GST_TYPE_INT_RANGE, 1, 6, + "parsed", G_TYPE_BOOLEAN, TRUE, + NULL); + + { + GValue list; + GValue val; + + list.g_type = val.g_type = 0; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_INT); + + g_value_set_int (&val, 2); + gst_value_list_append_value (&list, &val); + + g_value_set_int (&val, 4); + gst_value_list_append_value (&list, &val); + + gst_structure_set_value (struc, "mpegversion", &list); + + g_value_unset (&val); + g_value_unset (&list); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AAC audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in AAC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxAacDec *self; + + self = GST_OMX_AACDEC (obj); + + switch (prop_id) + { + case ARG_FRAMEMODE: + self->framemode = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxAacDec *self; + + self = GST_OMX_AACDEC (obj); + + switch (prop_id) + { + case ARG_FRAMEMODE: + g_value_set_boolean (value, self->framemode); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_FRAMEMODE, + g_param_spec_boolean ("framemode", "Frame Mode", + "Frame Mode", FRAMEMODE_DEFAULT, G_PARAM_READWRITE)); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GstOmxBaseAudioDec *base_audiodec; + GstOmxAacDec* self; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + base_audiodec = GST_OMX_BASE_AUDIODEC (omx_base); + self = GST_OMX_AACDEC (omx_base); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + structure = gst_caps_get_structure (caps, 0); + + base_audiodec->rate = 44100; + gst_structure_get_int (structure, "rate", &base_audiodec->rate); + + base_audiodec->channels = 2; + gst_structure_get_int (structure, "channels", &base_audiodec->channels); + + self->aacversion = 2; + gst_structure_get_int (structure, "object_type", &self->aacversion); + + self->framed = gst_structure_has_field (structure, "framed"); + +#if 0 + { + const GValue *codec_data; + GstBuffer *buffer; + + codec_data = gst_structure_get_value (structure, "codec_data"); + if (codec_data) + { + buffer = gst_value_get_buffer (codec_data); + omx_base->codec_data = buffer; + gst_buffer_ref (buffer); + } + } +#endif + + return gst_pad_set_caps (pad, caps); +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseAudioDec *base_audiodec = GST_OMX_BASE_AUDIODEC (omx_base); + GstOmxAacDec *self = GST_OMX_AACDEC (omx_base); + + OMX_U32 streamFormat; + gint profile; + + GST_DEBUG_OBJECT (omx_base, "Begin Set-Up"); + + switch (self->aacversion) + { + case AAC_PROFILE_LC_SBR_PS: + profile = OMX_AUDIO_AACObjectHE_PS; + break; + case AAC_PROFILE_LC_SBR: + profile = OMX_AUDIO_AACObjectHE; + break; + case AAC_PROFILE_LC: + default: + profile = OMX_AUDIO_AACObjectLC; + break; + } + + // Does it come from a demuxer? + if(self->framed) + { + streamFormat = OMX_AUDIO_AACStreamFormatRAW; + GST_DEBUG_OBJECT (omx_base, "Format: Raw"); + } + else + { + streamFormat = OMX_AUDIO_AACStreamFormatMax; + GST_DEBUG_OBJECT (omx_base, "Format: Max"); + } + + { + OMX_AUDIO_PARAM_AACPROFILETYPE param; + G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioAac, ¶m); + param.eAACProfile = profile; + param.eAACStreamFormat = streamFormat; + G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioAac, ¶m); + } + + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m); + param.nSamplingRate = base_audiodec->rate; + GST_DEBUG_OBJECT (omx_base, "PCM Sample Rate: %ld", param.nSamplingRate); + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m); + } + + +#ifdef USE_OMXTIAUDIODEC + // This is specific for TI. + { + OMX_INDEXTYPE index; + TI_OMX_DSP_DEFINITION audioinfo; + + GOmxCore *gomx = omx_base->gomx; + + memset (&audioinfo, 0, sizeof (audioinfo)); + + audioinfo.framemode = self->framemode; + GST_DEBUG_OBJECT (omx_base, "Frame Mode: %d", audioinfo.framemode); + + g_assert( + OMX_GetExtensionIndex ( + gomx->omx_handle, "OMX.TI.index.config.aacdecHeaderInfo", + &index) == OMX_ErrorNone); + + g_assert( + OMX_SetConfig ( + gomx->omx_handle, index, + &audioinfo) == OMX_ErrorNone); + + GST_DEBUG_OBJECT (omx_base, "End Set-Up"); + } +#endif +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxAacDec *self; + + self = GST_OMX_AACDEC (instance); + omx_base = GST_OMX_BASE_FILTER (instance); + GST_DEBUG_OBJECT (omx_base, "start"); + + omx_base->omx_setup = omx_setup; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + g_object_set (instance, + "input-buffers", 3, + "output-buffers", 3, + NULL); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.h new file mode 100644 index 0000000..45ec11b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacdec.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AACDEC_H +#define GSTOMX_AACDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AACDEC(obj) (GstOmxAacDec *) (obj) +#define GST_OMX_AACDEC_TYPE (gst_omx_aacdec_get_type ()) + +typedef struct GstOmxAacDec GstOmxAacDec; +typedef struct GstOmxAacDecClass GstOmxAacDecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxAacDec +{ + GstOmxBaseAudioDec omx_base; + gint aacversion; + gboolean framed; + gboolean framemode; +}; + +struct GstOmxAacDecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_aacdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AACDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.c new file mode 100644 index 0000000..7be7249 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.c @@ -0,0 +1,413 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_aacenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +enum +{ + ARG_0, + ARG_BITRATE, + ARG_PROFILE, + ARG_OUTPUT_FORMAT, +}; + +#define DEFAULT_BITRATE 64000 /* Guarantee that all the 3 formats will work using this default. */ +#define MAX_BITRATE 256000 /* Maximum value supported by the component */ +#define DEFAULT_PROFILE OMX_AUDIO_AACObjectLC +#define DEFAULT_OUTPUT_FORMAT OMX_AUDIO_AACStreamFormatRAW +#define DEFAULT_RATE 44100 +#define DEFAULT_CHANNELS 2 +#define IN_BUFFER_SIZE 1024*8 /* 1024*8 Recommended buffer size */ +#define OUT_BUFFER_SIZE 1024*8 /* 1024*8 Recommended buffer size */ + +GSTOMX_BOILERPLATE (GstOmxAacEnc, gst_omx_aacenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +#define GST_TYPE_OMX_AACENC_PROFILE (gst_omx_aacenc_profile_get_type ()) +static GType +gst_omx_aacenc_profile_get_type (void) +{ + static GType gst_omx_aacenc_profile_type = 0; + + if (!gst_omx_aacenc_profile_type) { + static GEnumValue gst_omx_aacenc_profile[] = { + {OMX_AUDIO_AACObjectLC, "Low Complexity", "LC"}, + {OMX_AUDIO_AACObjectMain, "Main", "Main"}, + {OMX_AUDIO_AACObjectSSR, "Scalable Sample Rate", "SSR"}, + {OMX_AUDIO_AACObjectLTP, "Long Term Prediction", "LTP"}, + {OMX_AUDIO_AACObjectHE, "High Efficiency with SBR (HE-AAC v1)", "HE"}, + {OMX_AUDIO_AACObjectScalable, "Scalable", "Scalable"}, + {OMX_AUDIO_AACObjectERLC, "ER AAC Low Complexity object (Error Resilient AAC-LC)", "ERLC"}, + {OMX_AUDIO_AACObjectLD, "AAC Low Delay object (Error Resilient)", "LD"}, + {OMX_AUDIO_AACObjectHE_PS, "High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS)", "HE_PS"}, + {0, NULL, NULL}, + }; + + gst_omx_aacenc_profile_type = g_enum_register_static ("GstOmxAacencProfile", + gst_omx_aacenc_profile); + } + + return gst_omx_aacenc_profile_type; +} + +#define GST_TYPE_OMX_AACENC_OUTPUT_FORMAT (gst_omx_aacenc_output_format_get_type ()) + + +static GType +gst_omx_aacenc_output_format_get_type (void) +{ + static GType gst_omx_aacenc_output_format_type = 0; + + if (!gst_omx_aacenc_output_format_type) { + static GEnumValue gst_omx_aacenc_output_format[] = { + {OMX_AUDIO_AACStreamFormatMP2ADTS, "Audio Data Transport Stream 2 format", "MP2ADTS"}, + {OMX_AUDIO_AACStreamFormatMP4ADTS, "Audio Data Transport Stream 4 format", "MP4ADTS"}, + {OMX_AUDIO_AACStreamFormatMP4LOAS, "Low Overhead Audio Stream format", "MP4LOAS"}, + {OMX_AUDIO_AACStreamFormatMP4LATM, "Low overhead Audio Transport Multiplex", "MP4LATM"}, + {OMX_AUDIO_AACStreamFormatADIF, "Audio Data Interchange Format", "ADIF"}, + {OMX_AUDIO_AACStreamFormatMP4FF, "AAC inside MPEG-4/ISO File Format", "MP4FF"}, + {OMX_AUDIO_AACStreamFormatRAW, "AAC Raw Format", "RAW"}, + {OMX_AUDIO_AACStreamFormatMax, "AAC Stream format MAX", "MAX"}, + {0, NULL, NULL}, + }; + + gst_omx_aacenc_output_format_type = g_enum_register_static ("GstOmxAacencOutputFormat", + gst_omx_aacenc_output_format); + } + + return gst_omx_aacenc_output_format_type; +} + + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); + + { + GValue list; + GValue val; + + list.g_type = val.g_type = 0; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_INT); + + g_value_set_int (&val, 2); + gst_value_list_append_value (&list, &val); + + g_value_set_int (&val, 4); + gst_value_list_append_value (&list, &val); + + gst_structure_set_value (struc, "mpegversion", &list); + + g_value_unset (&val); + g_value_unset (&list); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AAC audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in AAC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxAacEnc *self; + + self = GST_OMX_AACENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + self->bitrate = g_value_get_uint (value); + break; + case ARG_PROFILE: + self->profile = g_value_get_enum (value); + break; + case ARG_OUTPUT_FORMAT: + self->output_format = g_value_get_enum (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxAacEnc *self; + + self = GST_OMX_AACENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + /** @todo propagate this to OpenMAX when processing. */ + g_value_set_uint (value, self->bitrate); + break; + case ARG_PROFILE: + g_value_set_enum (value, self->profile); + break; + case ARG_OUTPUT_FORMAT: + g_value_set_enum (value, self->output_format); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_BITRATE, + g_param_spec_uint ("bitrate", "Bit-rate", + "Encoding bit-rate", + 0, MAX_BITRATE, DEFAULT_BITRATE, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_PROFILE, + g_param_spec_enum ("profile", "Encoding profile", + "OMX_AUDIO_AACPROFILETYPE of output", + GST_TYPE_OMX_AACENC_PROFILE, + DEFAULT_PROFILE, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_OUTPUT_FORMAT, + g_param_spec_enum ("output-format", "Output format", + "OMX_AUDIO_AACSTREAMFORMATTYPE of output", + GST_TYPE_OMX_AACENC_OUTPUT_FORMAT, + DEFAULT_OUTPUT_FORMAT, + G_PARAM_READWRITE)); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GstOmxAacEnc *self; + GOmxCore *gomx; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + self = GST_OMX_AACENC (omx_base); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &self->rate); + gst_structure_get_int (structure, "channels", &self->channels); + + { + GstCaps *src_caps; + + src_caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 4, + "rate", G_TYPE_INT, self->rate, + "channels", G_TYPE_INT, self->channels, + NULL); + GST_INFO_OBJECT (omx_base, "src caps are: %" GST_PTR_FORMAT, src_caps); + + gst_pad_set_caps (omx_base->srcpad, src_caps); + + gst_caps_unref (src_caps); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxAacEnc *self; + GOmxCore *gomx; + + self = GST_OMX_AACENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + /* Input port configuration. */ + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.nBufferSize = IN_BUFFER_SIZE; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + /* PCM configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = self->rate; + param.nChannels = self->channels; + + G_OMX_PORT_SET_PARAM (omx_base->in_port, OMX_IndexParamAudioPcm, ¶m); + } + + /* output port configuration. */ + { + OMX_PARAM_PORTDEFINITIONTYPE param; + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + param.nBufferSize = OUT_BUFFER_SIZE; + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + } + /* AAC configuration. */ + { + OMX_AUDIO_PARAM_AACPROFILETYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m); + + param.nSampleRate = self->rate; + param.nChannels = self->channels; + + GST_DEBUG_OBJECT (omx_base, "setting bitrate: %i", self->bitrate); + param.nBitRate = self->bitrate; + + GST_DEBUG_OBJECT (omx_base, "setting profile: %i", self->profile); + param.eAACProfile = self->profile; + + GST_DEBUG_OBJECT (omx_base, "output_format: %i", self->output_format); + param.eAACStreamFormat = self->output_format; + + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioAac, ¶m); + } + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxAacEnc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_AACENC (instance); + + omx_base->omx_setup = omx_setup; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->bitrate = DEFAULT_BITRATE; + self->profile = DEFAULT_PROFILE; + self->output_format = DEFAULT_OUTPUT_FORMAT; + self->rate = DEFAULT_RATE; + self->channels = DEFAULT_CHANNELS; + +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.h new file mode 100644 index 0000000..7a6ff0d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_aacenc.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AACENC_H +#define GSTOMX_AACENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AACENC(obj) (GstOmxAacEnc *) (obj) +#define GST_OMX_AACENC_TYPE (gst_omx_aacenc_get_type ()) + +typedef struct GstOmxAacEnc GstOmxAacEnc; +typedef struct GstOmxAacEncClass GstOmxAacEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxAacEnc +{ + GstOmxBaseFilter omx_base; + guint bitrate; + gint profile; + gint output_format; + gint rate; + gint channels; +}; + +struct GstOmxAacEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_aacenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AACENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.c new file mode 100644 index 0000000..716f047 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_adpcmdec.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +/* should this class extend GstOmxBaseAudioDec? */ +GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-adpcm", + "layout", G_TYPE_STRING, "dvi", + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL ADPCM audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in ADPCM format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + gint rate = 0; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &rate); + + /* Input port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = rate; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.h new file mode 100644 index 0000000..48246a9 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_ADPCMDEC_H +#define GSTOMX_ADPCMDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_ADPCMDEC(obj) (GstOmxAdpcmDec *) (obj) +#define GST_OMX_ADPCMDEC_TYPE (gst_omx_adpcmdec_get_type ()) + +typedef struct GstOmxAdpcmDec GstOmxAdpcmDec; +typedef struct GstOmxAdpcmDecClass GstOmxAdpcmDecClass; + +#include "gstomx_base_filter.h" + +struct GstOmxAdpcmDec +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxAdpcmDecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_adpcmdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_ADPCMDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.c new file mode 100644 index 0000000..ab5ce61 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.c @@ -0,0 +1,236 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_adpcmenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxAdpcmEnc, gst_omx_adpcmenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-adpcm", + "layout", G_TYPE_STRING, "dvi", + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL ADPCM audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in ADPCM format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + guint rate; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_AUDIO_PARAM_ADPCMTYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_ADPCMTYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m); + + rate = param.nSampleRate; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/x-adpcm", + "layout", G_TYPE_STRING, "dvi", + "rate", G_TYPE_INT, rate, + "channels", G_TYPE_INT, 1, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstCaps *peer_caps; + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + gint rate = 0; + gboolean ret = TRUE; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + peer_caps = gst_pad_peer_get_caps (omx_base->srcpad); + + g_return_val_if_fail (peer_caps, FALSE); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): peercaps: %" GST_PTR_FORMAT, peer_caps); + + if (gst_caps_get_size (peer_caps) >= 1) + { + structure = gst_caps_get_structure (peer_caps, 0); + + gst_structure_get_int (structure, "rate", &rate); + } + else + { + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &rate); + } + + /* Input port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 0; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = rate; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + GstStructure *tmp_structure; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + tmp_structure = gst_caps_get_structure (tmp_caps, 0); + gst_structure_fixate_field_nearest_int (tmp_structure, "rate", rate); + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + ret = gst_pad_set_caps (pad, caps); + + gst_caps_unref (peer_caps); + + return ret; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.h new file mode 100644 index 0000000..6262081 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_adpcmenc.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_ADPCMENC_H +#define GSTOMX_ADPCMENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_ADPCMENC(obj) (GstOmxAdpcmEnc *) (obj) +#define GST_OMX_ADPCMENC_TYPE (gst_omx_adpcmenc_get_type ()) + +typedef struct GstOmxAdpcmEnc GstOmxAdpcmEnc; +typedef struct GstOmxAdpcmEncClass GstOmxAdpcmEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxAdpcmEnc +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxAdpcmEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_adpcmenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_ADPCMENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.c new file mode 100644 index 0000000..27d5eef --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_amrnbdec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/AMR", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AMR-NB audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in AMR-NB format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.h new file mode 100644 index 0000000..781e4ed --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AMRNBDEC_H +#define GSTOMX_AMRNBDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AMRNBDEC(obj) (GstOmxAmrNbDec *) (obj) +#define GST_OMX_AMRNBDEC_TYPE (gst_omx_amrnbdec_get_type ()) + +typedef struct GstOmxAmrNbDec GstOmxAmrNbDec; +typedef struct GstOmxAmrNbDecClass GstOmxAmrNbDecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxAmrNbDec +{ + GstOmxBaseAudioDec omx_base; +}; + +struct GstOmxAmrNbDecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_amrnbdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AMRNBDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.c new file mode 100644 index 0000000..10f326c --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.c @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_amrnbenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +enum +{ + ARG_0, + ARG_BITRATE, +}; + +#define DEFAULT_BITRATE 64000 + +GSTOMX_BOILERPLATE (GstOmxAmrNbEnc, gst_omx_amrnbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/AMR", + "channels", G_TYPE_INT, 1, + "rate", G_TYPE_INT, 8000, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AMR-NB audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in AMR-NB format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxAmrNbEnc *self; + + self = GST_OMX_AMRNBENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + self->bitrate = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxAmrNbEnc *self; + + self = GST_OMX_AMRNBENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + /** @todo propagate this to OpenMAX when processing. */ + g_value_set_uint (value, self->bitrate); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_BITRATE, + g_param_spec_uint ("bitrate", "Bit-rate", + "Encoding bit-rate", + 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE)); + } +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + guint channels; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_AUDIO_PARAM_AMRTYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m); + + channels = param.nChannels; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/AMR", + "channels", G_TYPE_INT, channels, + "rate", G_TYPE_INT, 8000, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + gint rate = 0; + gint channels = 0; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_int (structure, "channels", &channels); + + /* Input port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 0; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = rate; + param.nChannels = channels; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxAmrNbEnc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_AMRNBENC (instance); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->bitrate = DEFAULT_BITRATE; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.h new file mode 100644 index 0000000..dff1318 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrnbenc.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AMRNBENC_H +#define GSTOMX_AMRNBENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AMRNBENC(obj) (GstOmxAmrNbEnc *) (obj) +#define GST_OMX_AMRNBENC_TYPE (gst_omx_amrnbenc_get_type ()) + +typedef struct GstOmxAmrNbEnc GstOmxAmrNbEnc; +typedef struct GstOmxAmrNbEncClass GstOmxAmrNbEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxAmrNbEnc +{ + GstOmxBaseFilter omx_base; + guint bitrate; +}; + +struct GstOmxAmrNbEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_amrnbenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AMRNBENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.c new file mode 100644 index 0000000..5ddd605 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.c @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_amrwbdec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 16000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/AMR-WB", + "rate", G_TYPE_INT, 16000, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AMR-WB audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in AMR-WB format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.h new file mode 100644 index 0000000..61870b8 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AMRWBDEC_H +#define GSTOMX_AMRWBDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AMRWBDEC(obj) (GstOmxAmrWbDec *) (obj) +#define GST_OMX_AMRWBDEC_TYPE (gst_omx_amrwbdec_get_type ()) + +typedef struct GstOmxAmrWbDec GstOmxAmrWbDec; +typedef struct GstOmxAmrWbDecClass GstOmxAmrWbDecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxAmrWbDec +{ + GstOmxBaseAudioDec omx_base; +}; + +struct GstOmxAmrWbDecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_amrwbdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AMRWBDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.c new file mode 100644 index 0000000..f693934 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.c @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_amrwbenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +enum +{ + ARG_0, + ARG_BITRATE, +}; + +#define DEFAULT_BITRATE 64000 + +GSTOMX_BOILERPLATE (GstOmxAmrWbEnc, gst_omx_amrwbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/AMR-WB", + "channels", G_TYPE_INT, 1, + "rate", G_TYPE_INT, 16000, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 16000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL AMR-WB audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in AMR-WB format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxAmrWbEnc *self; + + self = GST_OMX_AMRWBENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + self->bitrate = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxAmrWbEnc *self; + + self = GST_OMX_AMRWBENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + /** @todo propagate this to OpenMAX when processing. */ + g_value_set_uint (value, self->bitrate); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_BITRATE, + g_param_spec_uint ("bitrate", "Bit-rate", + "Encoding bit-rate", + 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE)); + } +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + guint channels; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_AUDIO_PARAM_AMRTYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m); + + channels = param.nChannels; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/AMR-WB", + "channels", G_TYPE_INT, channels, + "rate", G_TYPE_INT, 16000, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + gint rate = 0; + gint channels = 0; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_int (structure, "channels", &channels); + + /* Input port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 0; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = rate; + param.nChannels = channels; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxAmrWbEnc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_AMRWBENC (instance); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->bitrate = DEFAULT_BITRATE; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.h new file mode 100644 index 0000000..616998b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_amrwbenc.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AMRWBENC_H +#define GSTOMX_AMRWBENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AMRWBENC(obj) (GstOmxAmrWbEnc *) (obj) +#define GST_OMX_AMRWBENC_TYPE (gst_omx_amrwbenc_get_type ()) + +typedef struct GstOmxAmrWbEnc GstOmxAmrWbEnc; +typedef struct GstOmxAmrWbEncClass GstOmxAmrWbEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxAmrWbEnc +{ + GstOmxBaseFilter omx_base; + guint bitrate; +}; + +struct GstOmxAmrWbEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_amrwbenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AMRWBENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.c new file mode 100644 index 0000000..a05a7cd --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_audiosink.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxAudioSink, gst_omx_audiosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", GST_TYPE_INT_RANGE, 8, 32, + "depth", GST_TYPE_INT_RANGE, 8, 32, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 8, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL audiosink element"; + details.klass = "Sink/Audio"; + details.description = "Renders audio"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static gboolean +setcaps (GstBaseSink *gst_sink, + GstCaps *caps) +{ + GstOmxBaseSink *self; + GOmxCore *gomx; + + self = GST_OMX_BASE_SINK (gst_sink); + gomx = (GOmxCore *) self->gomx; + + GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + { + GstStructure *structure; + gint channels; + gint width; + gint rate; + gboolean is_signed; + gboolean is_bigendian; + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "channels", &channels); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "rate", &rate); + gst_structure_get_boolean (structure, "signed", &is_signed); + { + gint endianness; + gst_structure_get_int (structure, "endianness", &endianness); + is_bigendian = (endianness == 1234) ? FALSE : TRUE; + } + + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 0; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + param.nChannels = channels; + param.eNumData = is_signed ? OMX_NumericalDataSigned : OMX_NumericalDataUnsigned; + param.eEndian = is_bigendian ? OMX_EndianBig : OMX_EndianLittle; + param.nBitPerSample = width; + param.nSamplingRate = rate; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + } + + return TRUE; +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GstBaseSinkClass *gst_base_sink_class; + + gst_base_sink_class = GST_BASE_SINK_CLASS (g_class); + + gst_base_sink_class->set_caps = setcaps; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseSink *omx_base; + + omx_base = GST_OMX_BASE_SINK (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.h new file mode 100644 index 0000000..6b19b06 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_audiosink.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_AUDIOSINK_H +#define GSTOMX_AUDIOSINK_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_AUDIOSINK(obj) (GstOmxAudioSink *) (obj) +#define GST_OMX_AUDIOSINK_TYPE (gst_omx_audiosink_get_type ()) + +typedef struct GstOmxAudioSink GstOmxAudioSink; +typedef struct GstOmxAudioSinkClass GstOmxAudioSinkClass; + +#include "gstomx_base_sink.h" + +struct GstOmxAudioSink +{ + GstOmxBaseSink omx_base; +}; + +struct GstOmxAudioSinkClass +{ + GstOmxBaseSinkClass parent_class; +}; + +GType gst_omx_audiosink_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_AUDIOSINK_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.c new file mode 100644 index 0000000..d6a3a86 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.c @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: Base audio decoder element + * Created on: Aug 2, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gstomx_base_audiodec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ +#define CHANNELS_DEFAULT 2 +#define SAMPLERATE_DEFAULT 44100 + +GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static void +type_base_init (gpointer g_class) +{ +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GstOmxBaseAudioDec *self; + GOmxCore *gomx; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + self = GST_OMX_BASE_AUDIODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + GST_INFO_OBJECT (omx_base, "getcaps (sink): %" GST_PTR_FORMAT, caps); + + self->rate = SAMPLERATE_DEFAULT; + self->channels = CHANNELS_DEFAULT; + + { + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "rate", &self->rate); + gst_structure_get_int (structure, "channels", &self->channels); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + guint rate; + guint channels; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m); + + rate = param.nSamplingRate; + channels = param.nChannels; + + if (rate == 0) + { + /** @todo: this shouldn't happen. */ + GST_WARNING_OBJECT (omx_base, "Bad samplerate"); + rate = 44100; + } + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, rate, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "channels", G_TYPE_INT, channels, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + gst_pad_set_setcaps_function (omx_base->sinkpad, + (sink_setcaps)); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.h new file mode 100644 index 0000000..2ebf2ef --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_audiodec.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: Base audio decoder element + * Created on: Aug 2, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef GSTOMX_BASE_AUDIODEC_H +#define GSTOMX_BASE_AUDIODEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_AUDIODEC(obj) (GstOmxBaseAudioDec *) (obj) +#define GST_OMX_BASE_AUDIODEC_TYPE (gst_omx_base_audiodec_get_type ()) + +typedef struct GstOmxBaseAudioDec GstOmxBaseAudioDec; +typedef struct GstOmxBaseAudioDecClass GstOmxBaseAudioDecClass; + +#include "gstomx_base_filter.h" + +struct GstOmxBaseAudioDec +{ + GstOmxBaseFilter omx_base; + gint rate; + gint channels; +}; + +struct GstOmxBaseAudioDecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_base_audiodec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_AUDIODEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.c new file mode 100755 index 0000000..749886a --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.c @@ -0,0 +1,391 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_ctrl.h" +#include "gstomx.h" + +enum +{ + ARG_0, + ARG_COMPONENT_ROLE, + ARG_COMPONENT_NAME, + ARG_LIBRARY_NAME, + ARG_DISPLAY_MODE, + ARG_DISPLAY_DEVICE +}; + +GSTOMX_BOILERPLATE (GstOmxBaseCtrl, gst_omx_base_ctrl, GstBaseTransform, GST_TYPE_BASE_TRANSFORM); + +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL Client to control display/capture mode"; + details.klass = "Filter"; + details.description = "OpenMAX IL client to control display/capture modes"; + details.author = "Brijesh Singh"; + + gst_element_class_set_details (element_class, &details); + } + +} + +static int +gst_omx_display_string_to_mode (char *str) +{ + if (!strcmp (str, "OMX_DC_MODE_1080P_30")) + return OMX_DC_MODE_1080P_30; + + if (!strcmp (str, "OMX_DC_MODE_1080I_60")) + return OMX_DC_MODE_1080I_60; + + if (!strcmp (str, "OMX_DC_MODE_720P_60")) + return OMX_DC_MODE_720P_60; + + if (!strcmp (str, "OMX_DC_MODE_1080P_60")) + return OMX_DC_MODE_1080P_60; + + if (!strcmp (str, "OMX_DC_MODE_PAL")) + return OMX_DC_MODE_PAL; + + if (!strcmp (str, "OMX_DC_MODE_NTSC")) + return OMX_DC_MODE_NTSC; + + return -1; +} + +#define LCD_WIDTH (800) +#define LCD_HEIGHT (480) +#define LCD_PIXEL_CLOCK (33500) +#define LCD_H_FRONT_PORCH (164) +#define LCD_H_BACK_PORCH (89) +#define LCD_H_SYNC_LENGTH (10) +#define LCD_V_FRONT_PORCH (10) +#define LCD_V_BACK_PORCH (23) +#define LCD_V_SYNC_LENGTH (10) + +static gboolean +gst_omx_ctrl_set_display_mode (GstOmxBaseCtrl *self) +{ + OMX_PARAM_VFDC_DRIVERINSTID driverId; + OMX_ERRORTYPE err; + GOmxCore *gomx; + OMX_PARAM_DC_CUSTOM_MODE_INFO customModeInfo; + guint isLCD; + + gomx = (GOmxCore*) self->gomx; + + // printf ("******** installing kernel modules **************\n"); + // system ("insmod vpss.ko sbufaddr=0xbfb00000"); + // system ("insmod ti81xxhdmi.ko"); + // system ("echo 1080P-60 > /sys/devices/platform/vpss/display0/mode"); + + GST_LOG_OBJECT (self, "setting display mode to: %s", self->display_mode); + + _G_OMX_INIT_PARAM (&driverId); + + if(!strcmp(self->display_device,"LCD")) { + driverId.nDrvInstID = OMX_VIDEO_DISPLAY_ID_HD1; + driverId.eDispVencMode = OMX_DC_MODE_CUSTOM;//mode; + isLCD = 1; + } else { + driverId.nDrvInstID = 0; /* on chip HDMI */ + driverId.eDispVencMode = gst_omx_display_string_to_mode(self->display_mode);; + isLCD = 0; + } + + err = OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexParamVFDCDriverInstId, &driverId); + if(err != OMX_ErrorNone) + return FALSE; + +#if 1 + if(isLCD) { + _G_OMX_INIT_PARAM (&customModeInfo); + + customModeInfo.width = LCD_WIDTH; + customModeInfo.height = LCD_HEIGHT; + customModeInfo.scanFormat = OMX_SF_PROGRESSIVE; + customModeInfo.pixelClock = LCD_PIXEL_CLOCK; + customModeInfo.hFrontPorch = LCD_H_FRONT_PORCH; + customModeInfo.hBackPorch = LCD_H_BACK_PORCH; + customModeInfo.hSyncLen = LCD_H_SYNC_LENGTH; + customModeInfo.vFrontPorch = LCD_V_FRONT_PORCH; + customModeInfo.vBackPorch = LCD_V_BACK_PORCH; + customModeInfo.vSyncLen = LCD_V_SYNC_LENGTH; + /*Configure Display component and Display controller with these parameters*/ + + err = OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE) + OMX_TI_IndexParamVFDCCustomModeInfo, + &customModeInfo); + if(err != OMX_ErrorNone) + return FALSE; + } +#endif + g_omx_core_change_state (gomx, OMX_StateIdle); + g_omx_core_change_state (gomx, OMX_StateExecuting); + + self->mode_configured = TRUE; + + return TRUE; +} + +static gboolean +start (GstBaseTransform * trans) +{ + GstOmxBaseCtrl *self; + + self = GST_OMX_BASE_CTRL (trans); + + g_omx_core_init (self->gomx); + return TRUE; +} + +static gboolean +stop (GstBaseTransform * trans) +{ + GstOmxBaseCtrl *self; + + self = GST_OMX_BASE_CTRL (trans); + + g_omx_core_stop (self->gomx); + g_omx_core_unload (self->gomx); + + g_omx_core_free (self->gomx); + + return TRUE; +} + +static GstFlowReturn +transform_ip (GstBaseTransform * trans, GstBuffer * buf) +{ + GstOmxBaseCtrl *self; + GstFlowReturn ret = GST_FLOW_OK; + + self = GST_OMX_BASE_CTRL (trans); + + /* if mode is already configure then return */ + if (self->mode_configured) + return ret; + + if (!gst_omx_ctrl_set_display_mode (self)) + ret = GST_FLOW_ERROR; + + return ret; +} + +prepare_output_buffer (GstBaseTransform * trans, + GstBuffer * in_buf, gint out_size, GstCaps * out_caps, GstBuffer ** out_buf) +{ + *out_buf = gst_buffer_ref (in_buf); + return GST_FLOW_OK; +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseCtrl *self; + + self = GST_OMX_BASE_CTRL (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_free (self->omx_role); + self->omx_role = g_value_dup_string (value); + break; + case ARG_COMPONENT_NAME: + g_free (self->omx_component); + self->omx_component = g_value_dup_string (value); + break; + case ARG_LIBRARY_NAME: + g_free (self->omx_library); + self->omx_library = g_value_dup_string (value); + break; + case ARG_DISPLAY_MODE: + g_free (self->display_mode); + self->display_mode = g_value_dup_string (value); + break; + case ARG_DISPLAY_DEVICE: + g_free (self->display_device); + self->display_device = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseCtrl *self; + + self = GST_OMX_BASE_CTRL (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_value_set_string (value, self->omx_role); + break; + case ARG_COMPONENT_NAME: + g_value_set_string (value, self->omx_component); + break; + case ARG_LIBRARY_NAME: + g_value_set_string (value, self->omx_library); + break; + case ARG_DISPLAY_MODE: + g_value_set_string (value, self->display_mode); + break; + case ARG_DISPLAY_DEVICE: + g_value_set_string (value, self->display_device); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +finalize (GObject *obj) +{ + GstOmxBaseCtrl *self; + + self = GST_OMX_BASE_CTRL (obj); + + g_free (self->omx_role); + g_free (self->omx_component); + g_free (self->omx_library); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstOmxBaseCtrl *gst_base_ctrl_class; + GstOmxBaseCtrlClass *omx_base_class; + + gobject_class = G_OBJECT_CLASS (g_class); + gst_base_ctrl_class = GST_OMX_BASE_CTRL (g_class); + omx_base_class = GST_OMX_BASE_CTRL_CLASS (g_class); + + gobject_class->finalize = finalize; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE, + g_param_spec_string ("component-role", "Component role", + "Role of the OpenMAX IL component", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, + g_param_spec_string ("component-name", "Component name", + "Name of the OpenMAX IL component to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, + g_param_spec_string ("library-name", "Library name", + "Name of the OpenMAX IL implementation library to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_DISPLAY_MODE, + g_param_spec_string ("display-mode", "Display mode", + "Display driver configuration mode (see below)" + " \n\t\t\t OMX_DC_MODE_NTSC" + " \n\t\t\t OMX_DC_MODE_PAL" + " \n\t\t\t OMX_DC_MODE_1080P_60" + " \n\t\t\t OMX_DC_MODE_720P_60" + " \n\t\t\t OMX_DC_MODE_1080I_60" + " \n\t\t\t OMX_DC_MODE_1080P_30\n", "OMX_DC_MODE_1080P_60", G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_DISPLAY_DEVICE, + g_param_spec_string ("display-device", "Display Device", + "Display device to be used -" + "\n\t\t\t HDMI " + "\n\t\t\t LCD ", "HDMI",G_PARAM_READWRITE)); + + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + + GstOmxBaseCtrl *self; + GstOmxBaseCtrlClass *klass; + GstBaseTransformClass *trans_class; + + self = GST_OMX_BASE_CTRL (instance); + klass = GST_OMX_BASE_CTRL_CLASS (g_class); + trans_class = (GstBaseTransformClass *) klass; + + GST_LOG_OBJECT (self, "begin"); + + self->gomx = g_omx_core_new (self, g_class); + self->in_port = g_omx_core_get_port (self->gomx, "in", 0); + + trans_class->passthrough_on_same_caps = TRUE; + trans_class->transform_ip = GST_DEBUG_FUNCPTR (transform_ip); + trans_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (prepare_output_buffer); + trans_class->start = GST_DEBUG_FUNCPTR (start); + trans_class->stop = GST_DEBUG_FUNCPTR (stop); + + g_object_set (self, "display-mode", "OMX_DC_MODE_1080P_60", NULL); + g_object_set (self, "display-device", "HDMI", NULL); + + GST_LOG_OBJECT (self, "end"); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.h new file mode 100755 index 0000000..bcf23dc --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_ctrl.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010-2011 Texas Instrument Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_CTRL_H +#define GSTOMX_BASE_CTRL_H + +#include <gst/gst.h> +#include <gst/base/gstbasetransform.h> + +#include <xdc/std.h> +#include <OMX_TI_Index.h> +#include <OMX_TI_Common.h> +#include <omx_vfdc.h> +#include <omx_ctrl.h> + + +G_BEGIN_DECLS + +#define GST_OMX_BASE_CTRL(obj) (GstOmxBaseCtrl *) (obj) +#define GST_OMX_BASE_CTRL_TYPE (gst_omx_base_ctrl_get_type ()) +#define GST_OMX_BASE_CTRL_CLASS(obj) (GstOmxBaseCtrlClass *) (obj) + +typedef struct GstOmxBaseCtrl GstOmxBaseCtrl; +typedef struct GstOmxBaseCtrlClass GstOmxBaseCtrlClass; + +#include <gstomx_util.h> + +struct GstOmxBaseCtrl +{ + GstBaseTransform element; + GstPad *sinkpad; + GstPad *srcpad; + + GOmxCore *gomx; + GOmxPort *in_port; + + char *omx_role; + char *omx_component; + char *omx_library; + char *display_mode; + + gboolean mode_configured; + char *display_device; +}; + +struct GstOmxBaseCtrlClass +{ + GstBaseTransformClass parent_class; +}; + +GType gst_omx_base_ctrl_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_CTRL_H */ + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.c new file mode 100644 index 0000000..87770b5 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.c @@ -0,0 +1,924 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_filter.h" +#include "gstomx.h" +#include "gstomx_interface.h" +#include "gstomx_buffertransport.h" + +enum +{ + ARG_0, + ARG_COMPONENT_ROLE, + ARG_COMPONENT_NAME, + ARG_LIBRARY_NAME, + ARG_USE_TIMESTAMPS, + ARG_NUM_INPUT_BUFFERS, + ARG_NUM_OUTPUT_BUFFERS, + ARG_GEN_TIMESTAMPS +}; + +static void init_interfaces (GType type); +GSTOMX_BOILERPLATE_FULL (GstOmxBaseFilter, gst_omx_base_filter, GstElement, GST_TYPE_ELEMENT, init_interfaces); + + +static GstFlowReturn push_buffer (GstOmxBaseFilter *self, GstBuffer *buf); +static GstFlowReturn pad_chain (GstPad *pad, GstBuffer *buf); +static gboolean pad_event (GstPad *pad, GstEvent *event); + + +static void +setup_ports (GstOmxBaseFilter *self) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Input port configuration. */ + + G_OMX_PORT_GET_DEFINITION (self->in_port, ¶m); + g_omx_port_setup (self->in_port, ¶m); + gst_pad_set_element_private (self->sinkpad, self->in_port); + + /* Output port configuration. */ + + G_OMX_PORT_GET_DEFINITION (self->out_port, ¶m); + g_omx_port_setup (self->out_port, ¶m); + gst_pad_set_element_private (self->srcpad, self->out_port); + + if (g_getenv ("OMX_ALLOCATE_ON")) + { + GST_DEBUG_OBJECT (self, "OMX_ALLOCATE_ON"); + self->in_port->omx_allocate = TRUE; + self->out_port->omx_allocate = TRUE; + self->in_port->share_buffer = FALSE; + self->out_port->share_buffer = FALSE; + } + else if (g_getenv ("OMX_SHARE_HACK_ON")) + { + GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_ON"); + self->in_port->share_buffer = TRUE; + self->out_port->share_buffer = TRUE; + } + else if (g_getenv ("OMX_SHARE_HACK_OFF")) + { + GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_OFF"); + self->in_port->share_buffer = FALSE; + self->out_port->share_buffer = FALSE; + } + + GST_DEBUG_OBJECT (self, "in_port->omx_allocate=%d, out_port->omx_allocate=%d", + self->in_port->omx_allocate, self->out_port->omx_allocate); + GST_DEBUG_OBJECT (self, "in_port->share_buffer=%d, out_port->share_buffer=%d", + self->in_port->share_buffer, self->out_port->share_buffer); +} + +static void +setup_input_buffer (GstOmxBaseFilter *self, GstBuffer *buf) +{ + if (GST_IS_OMXBUFFERTRANSPORT (buf)) + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port, *in_port; + gint i; + + /* retrieve incoming buffer port information */ + port = GST_GET_OMXPORT (buf); + + /* configure input buffer size to match with upstream buffer */ + G_OMX_PORT_GET_DEFINITION (self->in_port, ¶m); + param.nBufferSize = GST_BUFFER_SIZE (buf); + param.nBufferCountActual = port->num_buffers; + G_OMX_PORT_SET_DEFINITION (self->in_port, ¶m); + + /* allocate resource to save the incoming buffer port pBuffer pointer in + * OmxBufferInfo structure. + */ + in_port = self->in_port; + in_port->share_buffer_info = malloc (sizeof(OmxBufferInfo)); + in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers); + for (i=0; i < port->num_buffers; i++) { + in_port->share_buffer_info->pBuffer[i] = port->buffers[i]->pBuffer; + } + + /* disable omx_allocate alloc flag, so that we can fall back to shared method */ + self->in_port->omx_allocate = FALSE; + self->in_port->always_copy = FALSE; + } + else + { + /* ask openmax to allocate input buffer */ + self->in_port->omx_allocate = TRUE; + self->in_port->always_copy = TRUE; + } +} + +static GstStateChangeReturn +change_state (GstElement *element, + GstStateChange transition) +{ + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstOmxBaseFilter *self; + GOmxCore *core; + + self = GST_OMX_BASE_FILTER (element); + core = self->gomx; + + GST_INFO_OBJECT (self, "begin: changing state %s -> %s", + gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)), + gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); + + switch (transition) + { + case GST_STATE_CHANGE_NULL_TO_READY: + g_omx_core_init (core); + if (core->omx_state != OMX_StateLoaded) + { + ret = GST_STATE_CHANGE_FAILURE; + goto leave; + } + break; + + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + if (ret == GST_STATE_CHANGE_FAILURE) + goto leave; + + switch (transition) + { + case GST_STATE_CHANGE_PAUSED_TO_READY: + g_mutex_lock (self->ready_lock); + if (self->ready) + { + /* unlock */ + g_omx_port_finish (self->in_port); + g_omx_port_finish (self->out_port); + + g_omx_core_stop (core); + g_omx_core_unload (core); + self->ready = FALSE; + } + g_mutex_unlock (self->ready_lock); + if (core->omx_state != OMX_StateLoaded && + core->omx_state != OMX_StateInvalid) + { + ret = GST_STATE_CHANGE_FAILURE; + goto leave; + } + break; + + case GST_STATE_CHANGE_READY_TO_NULL: + g_omx_core_deinit (core); + break; + + default: + break; + } + +leave: + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static void +finalize (GObject *obj) +{ + GstOmxBaseFilter *self; + + self = GST_OMX_BASE_FILTER (obj); + + if (self->codec_data) + { + gst_buffer_unref (self->codec_data); + self->codec_data = NULL; + } + + g_omx_core_free (self->gomx); + + g_free (self->omx_role); + g_free (self->omx_component); + g_free (self->omx_library); + + g_mutex_free (self->ready_lock); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *self; + + self = GST_OMX_BASE_FILTER (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_free (self->omx_role); + self->omx_role = g_value_dup_string (value); + break; + case ARG_COMPONENT_NAME: + g_free (self->omx_component); + self->omx_component = g_value_dup_string (value); + break; + case ARG_LIBRARY_NAME: + g_free (self->omx_library); + self->omx_library = g_value_dup_string (value); + break; + case ARG_USE_TIMESTAMPS: + self->gomx->use_timestamps = g_value_get_boolean (value); + break; + case ARG_GEN_TIMESTAMPS: + self->gomx->gen_timestamps = g_value_get_boolean (value); + break; + case ARG_NUM_INPUT_BUFFERS: + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + OMX_U32 nBufferCountActual = g_value_get_uint (value); + GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ? + self->in_port : self->out_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_return_if_fail (nBufferCountActual >= param.nBufferCountMin); + param.nBufferCountActual = nBufferCountActual; + + G_OMX_PORT_SET_DEFINITION (port, ¶m); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *self; + + self = GST_OMX_BASE_FILTER (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_value_set_string (value, self->omx_role); + break; + case ARG_COMPONENT_NAME: + g_value_set_string (value, self->omx_component); + break; + case ARG_LIBRARY_NAME: + g_value_set_string (value, self->omx_library); + break; + case ARG_USE_TIMESTAMPS: + g_value_set_boolean (value, self->gomx->use_timestamps); + break; + case ARG_GEN_TIMESTAMPS: + g_value_set_boolean (value, self->gomx->gen_timestamps); + break; + case ARG_NUM_INPUT_BUFFERS: + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ? + self->in_port : self->out_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_value_set_uint (value, param.nBufferCountActual); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_base_init (gpointer g_class) +{ +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstOmxBaseFilterClass *bclass; + + gobject_class = G_OBJECT_CLASS (g_class); + gstelement_class = GST_ELEMENT_CLASS (g_class); + bclass = GST_OMX_BASE_FILTER_CLASS (g_class); + + gobject_class->finalize = finalize; + gstelement_class->change_state = change_state; + bclass->push_buffer = push_buffer; + bclass->pad_chain = pad_chain; + bclass->pad_event = pad_event; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE, + g_param_spec_string ("component-role", "Component role", + "Role of the OpenMAX IL component", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, + g_param_spec_string ("component-name", "Component name", + "Name of the OpenMAX IL component to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, + g_param_spec_string ("library-name", "Library name", + "Name of the OpenMAX IL implementation library to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS, + g_param_spec_boolean ("use-timestamps", "Use timestamps", + "Whether or not to use timestamps", + TRUE, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_GEN_TIMESTAMPS, + g_param_spec_boolean ("gen-timestamps", "Generate timestamps", + "Whether or not to generate timestamps using interpolation/extrapolation", + TRUE, G_PARAM_READWRITE)); + + /* note: the default values for these are just a guess.. since we wouldn't know + * until the OMX component is constructed. But that is ok, these properties are + * only for debugging + */ + g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS, + g_param_spec_uint ("input-buffers", "Input buffers", + "The number of OMX input buffers", + 1, 10, 4, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS, + g_param_spec_uint ("output-buffers", "Output buffers", + "The number of OMX output buffers", + 1, 10, 4, G_PARAM_READWRITE)); + } +} + +static GstFlowReturn +push_buffer (GstOmxBaseFilter *self, + GstBuffer *buf) +{ + GstFlowReturn ret; + + GST_BUFFER_DURATION (buf) = self->duration; + + if (self->gomx->gen_timestamps == TRUE) { + if (GST_CLOCK_TIME_NONE == GST_BUFFER_TIMESTAMP(buf) && + GST_CLOCK_TIME_NONE != self->gomx->last_buf_timestamp && + GST_CLOCK_TIME_NONE != self->duration) { + GST_BUFFER_TIMESTAMP(buf) = self->gomx->last_buf_timestamp + self->duration; + } + self->gomx->last_buf_timestamp = GST_BUFFER_TIMESTAMP(buf); + } + + PRINT_BUFFER (self, buf); + + /** @todo check if tainted */ + GST_LOG_OBJECT (self, "begin"); + ret = gst_pad_push (self->srcpad, buf); + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static void +output_loop (gpointer data) +{ + GstPad *pad; + GOmxCore *gomx; + GOmxPort *out_port; + GstOmxBaseFilter *self; + GstFlowReturn ret = GST_FLOW_OK; + GstOmxBaseFilterClass *bclass; + + pad = data; + self = GST_OMX_BASE_FILTER (gst_pad_get_parent (pad)); + gomx = self->gomx; + + bclass = GST_OMX_BASE_FILTER_GET_CLASS (self); + + GST_LOG_OBJECT (self, "begin"); + + if (!self->ready) + { + g_error ("not ready"); + return; + } + + out_port = self->out_port; + + if (G_LIKELY (out_port->enabled)) + { + gpointer obj = g_omx_port_recv (out_port); + + if (G_UNLIKELY (!obj)) + { + GST_WARNING_OBJECT (self, "null buffer: leaving"); + ret = GST_FLOW_WRONG_STATE; + goto leave; + } + + if (G_LIKELY (GST_IS_BUFFER (obj))) + { + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (obj, GST_BUFFER_FLAG_IN_CAPS))) + { + GstCaps *caps = NULL; + GstStructure *structure; + GValue value = { 0 }; + + caps = gst_pad_get_negotiated_caps (self->srcpad); + caps = gst_caps_make_writable (caps); + structure = gst_caps_get_structure (caps, 0); + + g_value_init (&value, GST_TYPE_BUFFER); + gst_value_set_buffer (&value, obj); + gst_buffer_unref (obj); + gst_structure_set_value (structure, "codec_data", &value); + g_value_unset (&value); + + gst_pad_set_caps (self->srcpad, caps); + } + else + { + GstBuffer *buf = GST_BUFFER (obj); + ret = bclass->push_buffer (self, buf); + GST_DEBUG_OBJECT (self, "ret=%s", gst_flow_get_name (ret)); + } + } + else if (GST_IS_EVENT (obj)) + { + GST_DEBUG_OBJECT (self, "got eos"); + gst_pad_push_event (self->srcpad, obj); + ret = GST_FLOW_UNEXPECTED; + goto leave; + } + + } + +leave: + + self->last_pad_push_return = ret; + + if (gomx->omx_error != OMX_ErrorNone) + { + GST_DEBUG_OBJECT (self, "omx_error=%s", g_omx_error_to_str (gomx->omx_error)); + ret = GST_FLOW_ERROR; + } + + if (ret != GST_FLOW_OK) + { + GST_INFO_OBJECT (self, "pause task, reason: %s", + gst_flow_get_name (ret)); + gst_pad_pause_task (self->srcpad); + } + + GST_LOG_OBJECT (self, "end"); + + gst_object_unref (self); +} + +static GstFlowReturn +pad_chain (GstPad *pad, + GstBuffer *buf) +{ + GOmxCore *gomx; + GOmxPort *in_port; + GstOmxBaseFilter *self; + GstFlowReturn ret = GST_FLOW_OK; + + self = GST_OMX_BASE_FILTER (GST_OBJECT_PARENT (pad)); + + //printf("INput!!\n"); + PRINT_BUFFER (self, buf); + + gomx = self->gomx; + + GST_LOG_OBJECT (self, "begin: size=%u, state=%d", GST_BUFFER_SIZE (buf), gomx->omx_state); + + if (G_UNLIKELY (gomx->omx_state == OMX_StateLoaded)) + { + g_mutex_lock (self->ready_lock); + + GST_INFO_OBJECT (self, "omx: prepare"); + + /** @todo this should probably go after doing preparations. */ + if (self->omx_setup) + { + self->omx_setup (self); + } + + setup_input_buffer (self, buf); + + setup_ports (self); + + g_omx_core_prepare (self->gomx); + + if (gomx->omx_state == OMX_StateIdle) + { + self->ready = TRUE; + gst_pad_start_task (self->srcpad, output_loop, self->srcpad); + } + + g_mutex_unlock (self->ready_lock); + + if (gomx->omx_state != OMX_StateIdle) + goto out_flushing; + } + + in_port = self->in_port; + + if (G_LIKELY (in_port->enabled)) + { + if (G_UNLIKELY (gomx->omx_state == OMX_StateIdle)) + { + GST_INFO_OBJECT (self, "omx: play"); + g_omx_core_start (gomx); + + if (gomx->omx_state != OMX_StateExecuting) + goto out_flushing; + + /* send buffer with codec data flag */ + if (self->codec_data) + { + GST_BUFFER_FLAG_SET (self->codec_data, GST_BUFFER_FLAG_IN_CAPS); /* just in case */ + g_omx_port_send (in_port, self->codec_data); + } + + } + + if (G_UNLIKELY (gomx->omx_state != OMX_StateExecuting)) + { + GST_ERROR_OBJECT (self, "Whoa! very wrong"); + } + + while (TRUE) + { + gint sent; + + if (self->last_pad_push_return != GST_FLOW_OK || + !(gomx->omx_state == OMX_StateExecuting || + gomx->omx_state == OMX_StatePause)) + { + GST_DEBUG_OBJECT (self, "last_pad_push_return=%d", self->last_pad_push_return); + goto out_flushing; + } + + sent = g_omx_port_send (in_port, buf); + + if (G_UNLIKELY (sent < 0)) + { + ret = GST_FLOW_WRONG_STATE; + goto out_flushing; + } + else if (sent < GST_BUFFER_SIZE (buf)) + { + GstBuffer *subbuf = gst_buffer_create_sub (buf, sent, + GST_BUFFER_SIZE (buf) - sent); + gst_buffer_unref (buf); + buf = subbuf; + } + else + { + gst_buffer_unref (buf); + break; + } + } + } + else + { + GST_WARNING_OBJECT (self, "done"); + ret = GST_FLOW_UNEXPECTED; + } + +leave: + + GST_LOG_OBJECT (self, "end"); + + return ret; + + /* special conditions */ +out_flushing: + { + const gchar *error_msg = NULL; + + if (gomx->omx_error) + { + error_msg = "Error from OpenMAX component"; + } + else if (gomx->omx_state != OMX_StateExecuting && + gomx->omx_state != OMX_StatePause) + { + error_msg = "OpenMAX component in wrong state"; + } + + if (error_msg) + { + GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), (error_msg)); + ret = GST_FLOW_ERROR; + } + + gst_buffer_unref (buf); + + goto leave; + } +} + +static gboolean +pad_event (GstPad *pad, + GstEvent *event) +{ + GstOmxBaseFilter *self; + GOmxCore *gomx; + gboolean ret = TRUE; + + self = GST_OMX_BASE_FILTER (GST_OBJECT_PARENT (pad)); + gomx = self->gomx; + + GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_EOS: + printf ("Recieved EOS event, press <CTRL+C> to terminate pipeline.\n"); + /* if we are init'ed, and there is a running loop; then + * if we get a buffer to inform it of EOS, let it handle the rest + * in any other case, we send EOS */ + if (self->ready && self->last_pad_push_return == GST_FLOW_OK) + { + /***** FIXME: EZSDK OMX componet does not execute FBD callback for an + ETB call when nFlags is set to OMX_BUFFERFLAG_EOS. Because of this + we are not able to trigger EOS on srcpad task. For now disable sending this event + until we get OMX component fixed. */ + #if 0 + if (g_omx_port_send (self->in_port, event) >= 0) + { + gst_event_unref (event); + break; + } + #endif + } + + /* we tried, but it's up to us here */ + ret = gst_pad_push_event (self->srcpad, event); + break; + + case GST_EVENT_FLUSH_START: + gst_pad_push_event (self->srcpad, event); + self->last_pad_push_return = GST_FLOW_WRONG_STATE; + + g_omx_core_flush_start (gomx); + + gst_pad_pause_task (self->srcpad); + + ret = TRUE; + break; + + case GST_EVENT_FLUSH_STOP: + gst_pad_push_event (self->srcpad, event); + self->last_pad_push_return = GST_FLOW_OK; + + g_omx_core_flush_stop (gomx); + + if (self->ready) + gst_pad_start_task (self->srcpad, output_loop, self->srcpad); + + ret = TRUE; + break; + + case GST_EVENT_NEWSEGMENT: + self->gomx->last_buf_timestamp = GST_CLOCK_TIME_NONE; + ret = gst_pad_push_event (self->srcpad, event); + break; + + default: + ret = gst_pad_push_event (self->srcpad, event); + break; + } + + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static gboolean +activate_push (GstPad *pad, + gboolean active) +{ + gboolean result = TRUE; + GstOmxBaseFilter *self; + + self = GST_OMX_BASE_FILTER (gst_pad_get_parent (pad)); + + if (active) + { + GST_DEBUG_OBJECT (self, "activate"); + self->last_pad_push_return = GST_FLOW_OK; + + /* we do not start the task yet if the pad is not connected */ + if (gst_pad_is_linked (pad)) + { + if (self->ready) + { + /** @todo link callback function also needed */ + g_omx_port_resume (self->in_port); + g_omx_port_resume (self->out_port); + + result = gst_pad_start_task (pad, output_loop, pad); + } + } + } + else + { + GST_DEBUG_OBJECT (self, "deactivate"); + + if (self->ready) + { + /** @todo disable this until we properly reinitialize the buffers. */ +#if 0 + /* flush all buffers */ + OMX_SendCommand (self->gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); +#endif + + /* unlock loops */ + g_omx_port_pause (self->in_port); + g_omx_port_pause (self->out_port); + } + + /* make sure streaming finishes */ + result = gst_pad_stop_task (pad); + } + + gst_object_unref (self); + + return result; +} + +/** + * overrides the default buffer allocation for output port to allow + * pad_alloc'ing from the srcpad + */ +static GstBuffer * +buffer_alloc (GOmxPort *port, gint len) +{ + GstOmxBaseFilter *self = port->core->object; + GstBuffer *buf; + GstFlowReturn ret; + +#if 1 + /** @todo remove this check */ + if (G_LIKELY (self->in_port->enabled)) + { + GstCaps *caps = NULL; + + caps = gst_pad_get_negotiated_caps (self->srcpad); + + if (!caps) + { + /** @todo We shouldn't be doing this. */ + GOmxCore *gomx = self->gomx; + GST_WARNING_OBJECT (self, "faking settings changed notification"); + if (gomx->settings_changed_cb) + gomx->settings_changed_cb (gomx); + } + else + { + GST_LOG_OBJECT (self, "caps already fixed: %" GST_PTR_FORMAT, caps); + gst_caps_unref (caps); + } + } +#endif + + ret = gst_pad_alloc_buffer_and_set_caps ( + self->srcpad, GST_BUFFER_OFFSET_NONE, + len, GST_PAD_CAPS (self->srcpad), &buf); + + if (ret == GST_FLOW_OK) return buf; + + return NULL; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *self; + GstElementClass *element_class; + GstOmxBaseFilterClass *bclass; + + element_class = GST_ELEMENT_CLASS (g_class); + bclass = GST_OMX_BASE_FILTER_CLASS (g_class); + + self = GST_OMX_BASE_FILTER (instance); + + GST_LOG_OBJECT (self, "begin"); + + /* GOmx */ + self->gomx = g_omx_core_new (self, g_class); + self->in_port = g_omx_core_get_port (self->gomx, "in", 0); + self->out_port = g_omx_core_get_port (self->gomx, "out", 1); + + self->out_port->buffer_alloc = buffer_alloc; + + self->in_port->omx_allocate = TRUE; + self->out_port->omx_allocate = TRUE; + self->in_port->share_buffer = FALSE; + self->out_port->share_buffer = FALSE; + + self->ready_lock = g_mutex_new (); + + self->sinkpad = + gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "sink"), "sink"); + + gst_pad_set_chain_function (self->sinkpad, bclass->pad_chain); + gst_pad_set_event_function (self->sinkpad, bclass->pad_event); + + self->srcpad = + gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "src"), "src"); + + gst_pad_set_activatepush_function (self->srcpad, activate_push); + + gst_pad_use_fixed_caps (self->srcpad); + + gst_element_add_pad (GST_ELEMENT (self), self->sinkpad); + gst_element_add_pad (GST_ELEMENT (self), self->srcpad); + + self->duration = GST_CLOCK_TIME_NONE; + + GST_LOG_OBJECT (self, "end"); +} + +static void +omx_interface_init (GstImplementsInterfaceClass *klass) +{ +} + +static gboolean +interface_supported (GstImplementsInterface *iface, + GType type) +{ + g_assert (type == GST_TYPE_OMX); + return TRUE; +} + +static void +interface_init (GstImplementsInterfaceClass *klass) +{ + klass->supported = interface_supported; +} + +static void +init_interfaces (GType type) +{ + GInterfaceInfo *iface_info; + GInterfaceInfo *omx_info; + + + iface_info = g_new0 (GInterfaceInfo, 1); + iface_info->interface_init = (GInterfaceInitFunc) interface_init; + + g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info); + g_free (iface_info); + + omx_info = g_new0 (GInterfaceInfo, 1); + omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init; + + g_type_add_interface_static (type, GST_TYPE_OMX, omx_info); + g_free (omx_info); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.h new file mode 100644 index 0000000..be5b4e7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_filter.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_FILTER_H +#define GSTOMX_BASE_FILTER_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_FILTER(obj) ((GstOmxBaseFilter *) (obj)) +#define GST_OMX_BASE_FILTER_TYPE (gst_omx_base_filter_get_type ()) +#define GST_OMX_BASE_FILTER_CLASS(obj) ((GstOmxBaseFilterClass *) (obj)) +#define GST_OMX_BASE_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_OMX_BASE_FILTER_TYPE, GstOmxBaseFilterClass)) + +typedef struct GstOmxBaseFilter GstOmxBaseFilter; +typedef struct GstOmxBaseFilterClass GstOmxBaseFilterClass; +typedef void (*GstOmxBaseFilterCb) (GstOmxBaseFilter *self); + +#include "gstomx_util.h" +#include <async_queue.h> + +struct GstOmxBaseFilter +{ + GstElement element; + + GstPad *sinkpad; + GstPad *srcpad; + + GOmxCore *gomx; + GOmxPort *in_port; + GOmxPort *out_port; + + char *omx_role; + char *omx_component; + char *omx_library; + gboolean ready; + GMutex *ready_lock; + + GstOmxBaseFilterCb omx_setup; + GstFlowReturn last_pad_push_return; + GstBuffer *codec_data; + GstClockTime duration; + +}; + +struct GstOmxBaseFilterClass +{ + GstElementClass parent_class; + + GstFlowReturn (*push_buffer) (GstOmxBaseFilter *self, GstBuffer *buf); + GstFlowReturn (*pad_chain) (GstPad *pad, GstBuffer *buf); + gboolean (*pad_event) (GstPad *pad, GstEvent *event); +}; + +GType gst_omx_base_filter_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_FILTER_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.c new file mode 100644 index 0000000..42b8bf9 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.c @@ -0,0 +1,577 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * Copyright (C) 2008 NXP. + * + * Authors: + * Felipe Contreras <felipe.contreras@nokia.com> + * Frederik Vernelen <frederik.vernelen@tass.be> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_sink.h" +#include "gstomx.h" +#include "gstomx_interface.h" +#include "gstomx_buffertransport.h" + +#include <string.h> /* for memset, memcpy */ + +static inline gboolean omx_init (GstOmxBaseSink *self); + +enum +{ + ARG_0, + ARG_COMPONENT_ROLE, + ARG_COMPONENT_NAME, + ARG_LIBRARY_NAME, +}; + +static void init_interfaces (GType type); +GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYPE_BASE_SINK, init_interfaces); + +static void +setup_ports (GstOmxBaseSink *self) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Input port configuration. */ + self->in_port = g_omx_core_get_port (self->gomx, "in", 0); + G_OMX_PORT_GET_DEFINITION (self->in_port, ¶m); + g_omx_port_setup (self->in_port, ¶m); + gst_pad_set_element_private (self->sinkpad, self->in_port); +} + +static void +setup_input_buffer (GstOmxBaseSink *self, GstBuffer *buf) +{ + if (GST_IS_OMXBUFFERTRANSPORT (buf)) + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port, *in_port; + gint i; + + /* retrieve incoming buffer port information */ + port = GST_GET_OMXPORT (buf); + + /* configure input buffer size to match with upstream buffer */ + G_OMX_PORT_GET_DEFINITION (self->in_port, ¶m); + param.nBufferSize = GST_BUFFER_SIZE (buf); + param.nBufferCountActual = port->num_buffers; + G_OMX_PORT_SET_DEFINITION (self->in_port, ¶m); + + + /* allocate resource to save the incoming buffer port pBuffer pointer in + * OmxBufferInfo structure. + */ + in_port = self->in_port; + in_port->share_buffer_info = malloc (sizeof(OmxBufferInfo)); + in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers); + for (i=0; i < port->num_buffers; i++) { + in_port->share_buffer_info->pBuffer[i] = port->buffers[i]->pBuffer; + } + + /* disable omx_allocate alloc flag, so that we can fall back to shared method */ + self->in_port->omx_allocate = FALSE; + self->in_port->always_copy = FALSE; + self->in_port->share_buffer = FALSE; + } + else + { + /* ask openmax to allocate input buffer */ + self->in_port->omx_allocate = TRUE; + self->in_port->always_copy = TRUE; + self->in_port->share_buffer = FALSE; + } +} + +static GstStateChangeReturn +change_state (GstElement *element, + GstStateChange transition) +{ + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (element); + + GST_LOG_OBJECT (self, "begin"); + + GST_INFO_OBJECT (self, "changing state %s - %s", + gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)), + gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); + + switch (transition) + { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!self->initialized) + { + if (!omx_init (self)) + return GST_PAD_LINK_REFUSED; + + self->initialized = TRUE; + } + + if (self->port_initialized) + g_omx_core_prepare (self->gomx); + break; + + case GST_STATE_CHANGE_READY_TO_PAUSED: + if (self->port_initialized) + g_omx_core_start (self->gomx); + break; + + case GST_STATE_CHANGE_PAUSED_TO_READY: + g_omx_port_finish (self->in_port); + break; + + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + if (ret == GST_STATE_CHANGE_FAILURE) + goto leave; + + switch (transition) + { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + g_omx_port_pause (self->in_port); + break; + + case GST_STATE_CHANGE_PAUSED_TO_READY: + g_omx_core_stop (self->gomx); + break; + + case GST_STATE_CHANGE_READY_TO_NULL: + g_omx_core_unload (self->gomx); + break; + + default: + break; + } + +leave: + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static void +finalize (GObject *obj) +{ + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (obj); + + g_omx_core_free (self->gomx); + + g_free (self->omx_role); + g_free (self->omx_component); + g_free (self->omx_library); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static GstFlowReturn +render (GstBaseSink *gst_base, + GstBuffer *buf) +{ + GOmxCore *gomx; + GOmxPort *in_port; + GstOmxBaseSink *self; + GstFlowReturn ret = GST_FLOW_OK; + + self = GST_OMX_BASE_SINK (gst_base); + + gomx = self->gomx; + + GST_LOG_OBJECT (self, "begin"); + //PRINT_BUFFER (self, buf); + + GST_LOG_OBJECT (self, "state: %d", gomx->omx_state); + + if (G_UNLIKELY (gomx->omx_state == OMX_StateLoaded)) + { + setup_input_buffer (self, buf); + g_omx_core_prepare (self->gomx); + g_omx_core_start (self->gomx); + } + + in_port = self->in_port; + + if (G_LIKELY (in_port->enabled)) + { + while (TRUE) + { + gint sent = g_omx_port_send (in_port, buf); + + if (G_UNLIKELY (sent < 0)) + { + ret = GST_FLOW_UNEXPECTED; + break; + } + else if (sent < GST_BUFFER_SIZE (buf)) + { + GstBuffer *subbuf = gst_buffer_create_sub (buf, sent, + GST_BUFFER_SIZE (buf) - sent); + gst_buffer_unref (buf); + buf = subbuf; + } + else + { + break; + } + } + } + else + { + GST_WARNING_OBJECT (self, "done"); + ret = GST_FLOW_UNEXPECTED; + } + + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static gboolean +handle_event (GstBaseSink *gst_base, + GstEvent *event) +{ + GstOmxBaseSink *self; + GOmxCore *gomx; + GOmxPort *in_port; + + self = GST_OMX_BASE_SINK (gst_base); + gomx = self->gomx; + in_port = self->in_port; + + GST_LOG_OBJECT (self, "begin"); + + GST_DEBUG_OBJECT (self, "event: %s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_EOS: + /* Close the inpurt port. */ + g_omx_core_set_done (gomx); + break; + + case GST_EVENT_FLUSH_START: + /* unlock loops */ + g_omx_port_pause (in_port); + + /* flush all buffers */ + OMX_SendCommand (gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); + break; + + case GST_EVENT_FLUSH_STOP: + g_sem_down (gomx->flush_sem); + + g_omx_port_resume (in_port); + break; + + default: + break; + } + + GST_LOG_OBJECT (self, "end"); + + return TRUE; +} + +#if 0 +static GstFlowReturn +buffer_alloc(GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, + GstBuffer **buf) +{ + + GstOmxBaseSink *self; + OMX_BUFFERHEADERTYPE *omx_buffer; + int i; + static int count = 0; + + self = GST_OMX_BASE_SINK (base); + + if (!self->port_initialized) + { + self->omx_setup (base, caps); + } + + if (G_UNLIKELY (self->gomx->omx_state == OMX_StateLoaded)) + { + self->in_port->omx_allocate = TRUE; + self->in_port->always_copy = FALSE; + self->in_port->share_buffer = FALSE; + g_omx_core_prepare (self->gomx); + g_omx_core_start (self->gomx); + + /* queue all the buffers */ + for (i=0; i < self->in_port->num_buffers; i++) + g_omx_port_push_buffer (self->in_port, self->in_port->buffers[i]); + } + + omx_buffer = async_queue_pop (self->in_port->queue); + omx_buffer->nFilledLen = size; + *buf = gst_omxbuffertransport_new (self->in_port, omx_buffer); + + return GST_FLOW_OK; +} +#endif + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_free (self->omx_role); + self->omx_role = g_value_dup_string (value); + break; + case ARG_COMPONENT_NAME: + g_free (self->omx_component); + self->omx_component = g_value_dup_string (value); + break; + case ARG_LIBRARY_NAME: + g_free (self->omx_library); + self->omx_library = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_value_set_string (value, self->omx_role); + break; + case ARG_COMPONENT_NAME: + g_value_set_string (value, self->omx_component); + break; + case ARG_LIBRARY_NAME: + g_value_set_string (value, self->omx_library); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_base_init (gpointer g_class) +{ +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstBaseSinkClass *gst_base_sink_class; + GstElementClass *gstelement_class; + + gobject_class = G_OBJECT_CLASS (g_class); + gst_base_sink_class = GST_BASE_SINK_CLASS (g_class); + gstelement_class = GST_ELEMENT_CLASS (g_class); + + gobject_class->finalize = finalize; + + gstelement_class->change_state = change_state; + + gst_base_sink_class->event = handle_event; + gst_base_sink_class->preroll = NULL; + gst_base_sink_class->render = render; +// gst_base_sink_class->buffer_alloc = buffer_alloc; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE, + g_param_spec_string ("component-role", "Component role", + "Role of the OpenMAX IL component", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, + g_param_spec_string ("component-name", "Component name", + "Name of the OpenMAX IL component to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, + g_param_spec_string ("library-name", "Library name", + "Name of the OpenMAX IL implementation library to use", + NULL, G_PARAM_READWRITE)); + } +} + +static gboolean +activate_push (GstPad *pad, + gboolean active) +{ + gboolean result = TRUE; + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (gst_pad_get_parent (pad)); + + if (active) + { + GST_DEBUG_OBJECT (self, "activate"); + + /* we do not start the task yet if the pad is not connected */ + if (gst_pad_is_linked (pad)) + { + /** @todo link callback function also needed */ + g_omx_port_resume (self->in_port); + } + } + else + { + GST_DEBUG_OBJECT (self, "deactivate"); + + /** @todo disable this until we properly reinitialize the buffers. */ +#if 0 + /* flush all buffers */ + OMX_SendCommand (self->gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); +#endif + + /* unlock loops */ + g_omx_port_pause (self->in_port); + } + + gst_object_unref (self); + + if (result) + result = self->base_activatepush (pad, active); + + return result; +} + +static inline gboolean +omx_init (GstOmxBaseSink *self) +{ + g_omx_core_init (self->gomx); + + if (self->gomx->omx_error) + return FALSE; + + setup_ports (self); + + return TRUE; +} + +static GstPadLinkReturn +pad_sink_link (GstPad *pad, + GstPad *peer) +{ + GOmxCore *gomx; + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (GST_OBJECT_PARENT (pad)); + + GST_INFO_OBJECT (self, "link"); + + gomx = self->gomx; + + if (!self->initialized) + { + if (!omx_init (self)) + return GST_PAD_LINK_REFUSED; + self->initialized = TRUE; + } + + return GST_PAD_LINK_OK; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseSink *self; + + self = GST_OMX_BASE_SINK (instance); + + GST_LOG_OBJECT (self, "begin"); + + /* GOmx */ + self->gomx = g_omx_core_new (self, g_class); + + { + GstPad *sinkpad; + self->sinkpad = sinkpad = GST_BASE_SINK_PAD (self); + self->base_activatepush = GST_PAD_ACTIVATEPUSHFUNC (sinkpad); + gst_pad_set_activatepush_function (sinkpad, activate_push); + gst_pad_set_link_function (sinkpad, pad_sink_link); + } + + GST_LOG_OBJECT (self, "end"); +} + +static void +omx_interface_init (GstImplementsInterfaceClass *klass) +{ +} + +static gboolean +interface_supported (GstImplementsInterface *iface, + GType type) +{ + g_assert (type == GST_TYPE_OMX); + return TRUE; +} + +static void +interface_init (GstImplementsInterfaceClass *klass) +{ + klass->supported = interface_supported; +} +static void +init_interfaces (GType type) +{ + GInterfaceInfo *iface_info; + GInterfaceInfo *omx_info; + + iface_info = g_new0 (GInterfaceInfo, 1); + iface_info->interface_init = (GInterfaceInitFunc) interface_init; + + g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info); + g_free (iface_info); + + omx_info = g_new0 (GInterfaceInfo, 1); + omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init; + + g_type_add_interface_static (type, GST_TYPE_OMX, omx_info); + g_free (omx_info); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.h new file mode 100644 index 0000000..f6ca344 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_sink.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_SINK_H +#define GSTOMX_BASE_SINK_H + +#include <gst/gst.h> +#include <gst/base/gstbasesink.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_SINK(obj) (GstOmxBaseSink *) (obj) +#define GST_OMX_BASE_SINK_TYPE (gst_omx_base_sink_get_type ()) +#define GST_OMX_BASE_SINK_CLASS(obj) (GstOmxBaseSinkClass *) (obj) + +typedef struct GstOmxBaseSink GstOmxBaseSink; +typedef struct GstOmxBaseSinkClass GstOmxBaseSinkClass; +typedef void (*GstOmxSinkCb) (GstBaseSink *self, GstCaps *caps); + +#include <gstomx_util.h> + +struct GstOmxBaseSink +{ + GstBaseSink element; + + GstPad *sinkpad; + + GOmxCore *gomx; + GOmxPort *in_port; + + char *omx_role; + char *omx_component; + char *omx_library; + + gboolean ready; + GstPadActivateModeFunction base_activatepush; + gboolean initialized; + gboolean port_initialized; + GstOmxSinkCb omx_setup; +}; + +struct GstOmxBaseSinkClass +{ + GstBaseSinkClass parent_class; +}; + +GType gst_omx_base_sink_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_SINK_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.c new file mode 100644 index 0000000..dfd9c9e --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.c @@ -0,0 +1,439 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_src.h" +#include "gstomx.h" + +#include <string.h> /* for memset, memcpy */ + +enum +{ + ARG_0, + ARG_COMPONENT_ROLE, + ARG_COMPONENT_NAME, + ARG_LIBRARY_NAME, + ARG_NUM_OUTPUT_BUFFERS, +}; + +GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC); + +void +gst_omx_base_src_setup_ports (GstOmxBaseSrc *self) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Output port configuration. */ + G_OMX_PORT_GET_DEFINITION (self->out_port, ¶m); + g_omx_port_setup (self->out_port, ¶m); + + if (self->setup_ports) + { + self->setup_ports (self); + } +} + +static gboolean +start (GstBaseSrc *gst_base) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (gst_base); + + GST_LOG_OBJECT (self, "begin"); + + g_omx_core_init (self->gomx); + if (self->gomx->omx_error) + return GST_STATE_CHANGE_FAILURE; + + GST_LOG_OBJECT (self, "end"); + + return TRUE; +} + +static gboolean +stop (GstBaseSrc *gst_base) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (gst_base); + + GST_LOG_OBJECT (self, "begin"); + + g_omx_core_stop (self->gomx); + g_omx_core_unload (self->gomx); + g_omx_core_deinit (self->gomx); + + if (self->gomx->omx_error) + return GST_STATE_CHANGE_FAILURE; + + GST_LOG_OBJECT (self, "end"); + + return TRUE; +} + +static void +finalize (GObject *obj) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (obj); + + g_omx_core_free (self->gomx); + + g_free (self->omx_role); + g_free (self->omx_component); + g_free (self->omx_library); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +/* protected helper method which can be used by derived classes: + */ +GstFlowReturn +gst_omx_base_src_create_from_port (GstOmxBaseSrc *self, + GOmxPort *out_port, + GstBuffer **ret_buf) +{ + GOmxCore *gomx; + GstFlowReturn ret = GST_FLOW_OK; + + gomx = self->gomx; + + GST_LOG_OBJECT (self, "begin"); + + if (out_port->enabled) + { + if (G_UNLIKELY (gomx->omx_state == OMX_StateIdle)) + { + GST_INFO_OBJECT (self, "omx: play"); + g_omx_core_start (gomx); + } + + if (G_UNLIKELY (gomx->omx_state != OMX_StateExecuting)) + { + GST_ERROR_OBJECT (self, "Whoa! very wrong"); + ret = GST_FLOW_ERROR; + goto beach; + } + + while (out_port->enabled) + { + gpointer obj = g_omx_port_recv (out_port); + + if (G_UNLIKELY (!obj)) + { + ret = GST_FLOW_ERROR; + break; + } + + if (G_LIKELY (GST_IS_BUFFER (obj))) + { + GstBuffer *buf = GST_BUFFER (obj); + if (G_LIKELY (GST_BUFFER_SIZE (buf) > 0)) + { + PRINT_BUFFER (self, buf); + *ret_buf = buf; + break; + } + } + else if (GST_IS_EVENT (obj)) + { + GST_INFO_OBJECT (self, "got eos"); + g_omx_core_set_done (gomx); + break; + } + } + } + + if (!out_port->enabled) + { + GST_WARNING_OBJECT (self, "done"); + ret = GST_FLOW_UNEXPECTED; + } + +beach: + + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static GstFlowReturn +create (GstBaseSrc *gst_base, + guint64 offset, + guint length, + GstBuffer **ret_buf) +{ + GstOmxBaseSrc *self = GST_OMX_BASE_SRC (gst_base); + + GST_LOG_OBJECT (self, "state: %d", self->gomx->omx_state); + + if (self->gomx->omx_state == OMX_StateLoaded) + { + GST_INFO_OBJECT (self, "omx: prepare"); + + gst_omx_base_src_setup_ports (self); + g_omx_core_prepare (self->gomx); + } + + return gst_omx_base_src_create_from_port (self, self->out_port, ret_buf); +} + +static gboolean +handle_event (GstBaseSrc *gst_base, + GstEvent *event) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (gst_base); + + GST_LOG_OBJECT (self, "begin"); + + GST_DEBUG_OBJECT (self, "event: %s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_EOS: + /* Close the output port. */ + g_omx_core_set_done (self->gomx); + break; + + case GST_EVENT_NEWSEGMENT: + break; + + default: + break; + } + + GST_LOG_OBJECT (self, "end"); + + return TRUE; +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_free (self->omx_role); + self->omx_role = g_value_dup_string (value); + break; + case ARG_COMPONENT_NAME: + g_free (self->omx_component); + self->omx_component = g_value_dup_string (value); + break; + case ARG_LIBRARY_NAME: + g_free (self->omx_library); + self->omx_library = g_value_dup_string (value); + break; + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + OMX_U32 nBufferCountActual = g_value_get_uint (value); + + G_OMX_PORT_GET_DEFINITION (self->out_port, ¶m); + + g_return_if_fail (nBufferCountActual >= param.nBufferCountMin); + param.nBufferCountActual = nBufferCountActual; + + G_OMX_PORT_SET_DEFINITION (self->out_port, ¶m); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_value_set_string (value, self->omx_role); + break; + case ARG_COMPONENT_NAME: + g_value_set_string (value, self->omx_component); + break; + case ARG_LIBRARY_NAME: + g_value_set_string (value, self->omx_library); + break; + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + G_OMX_PORT_GET_DEFINITION (self->out_port, ¶m); + g_value_set_uint (value, param.nBufferCountActual); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_base_init (gpointer g_class) +{ +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstBaseSrcClass *gst_base_src_class; + GstOmxBaseSrcClass *omx_base_class; + + gobject_class = G_OBJECT_CLASS (g_class); + gst_base_src_class = GST_BASE_SRC_CLASS (g_class); + omx_base_class = GST_OMX_BASE_SRC_CLASS (g_class); + + gobject_class->finalize = finalize; + + gst_base_src_class->start = start; + gst_base_src_class->stop = stop; + gst_base_src_class->event = handle_event; + gst_base_src_class->create = create; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE, + g_param_spec_string ("component-role", "Component role", + "Role of the OpenMAX IL component", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, + g_param_spec_string ("component-name", "Component name", + "Name of the OpenMAX IL component to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, + g_param_spec_string ("library-name", "Library name", + "Name of the OpenMAX IL implementation library to use", + NULL, G_PARAM_READWRITE)); + + /* note: the default values for these are just a guess.. since we wouldn't know + * until the OMX component is constructed. But that is ok, these properties are + * only for debugging + */ + g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS, + g_param_spec_uint ("output-buffers", "Output buffers", + "The number of OMX output buffers", + 1, 10, 4, G_PARAM_READWRITE)); + } + + omx_base_class->out_port_index = 0; +} + +/* TODO make a util fxn out of this.. since this code is copied all over + * the place + */ +void check_settings (GOmxPort *port, GstPad *pad) +{ + /* note: specifically DO NOT check port->enabled! This can be called + * during buffer allocation in transition-to-enabled while + * port->enabled is still FALSE + */ + GOmxCore *gomx = port->core; + GstCaps *caps = NULL; + + caps = gst_pad_get_negotiated_caps (pad); + + if (!caps) + { + /** @todo We shouldn't be doing this. */ + GST_WARNING_OBJECT (gomx->object, "faking settings changed notification"); + if (gomx->settings_changed_cb) + gomx->settings_changed_cb (gomx); + } + else + { + GST_LOG_OBJECT (gomx->object, "caps already fixed: %" GST_PTR_FORMAT, caps); + gst_caps_unref (caps); + } +} + + +/** + * overrides the default buffer allocation for output port to allow + * pad_alloc'ing from the srcpad + */ +static GstBuffer * +buffer_alloc (GOmxPort *port, gint len) +{ + GstOmxBaseSrc *self = port->core->object; + GstBaseSrc *gst_base = GST_BASE_SRC (self); + GstBuffer *buf; + GstFlowReturn ret; + + check_settings (self->out_port, gst_base->srcpad); + + ret = gst_pad_alloc_buffer_and_set_caps ( + gst_base->srcpad, GST_BUFFER_OFFSET_NONE, + len, GST_PAD_CAPS (gst_base->srcpad), &buf); + + if (ret == GST_FLOW_OK) return buf; + + return NULL; +} + + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseSrc *self; + GstOmxBaseSrcClass *klass; + + self = GST_OMX_BASE_SRC (instance); + klass = GST_OMX_BASE_SRC_CLASS (g_class); + + GST_LOG_OBJECT (self, "begin"); + + /* GOmx */ + self->gomx = g_omx_core_new (self, g_class); + self->gomx->use_timestamps = FALSE; + self->gomx->gen_timestamps = FALSE; + self->gomx->last_buf_timestamp = GST_CLOCK_TIME_NONE; + self->out_port = g_omx_core_get_port (self->gomx, "out", klass->out_port_index); + self->out_port->buffer_alloc = buffer_alloc; + + GST_LOG_OBJECT (self, "end"); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.h new file mode 100644 index 0000000..a4b1061 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_src.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_SRC_H +#define GSTOMX_BASE_SRC_H + +#include <gst/gst.h> +#include <gst/base/gstbasesrc.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_SRC(obj) (GstOmxBaseSrc *) (obj) +#define GST_OMX_BASE_SRC_TYPE (gst_omx_base_src_get_type ()) +#define GST_OMX_BASE_SRC_CLASS(obj) (GstOmxBaseSrcClass *) (obj) + +typedef struct GstOmxBaseSrc GstOmxBaseSrc; +typedef struct GstOmxBaseSrcClass GstOmxBaseSrcClass; +typedef void (*GstOmxBaseSrcCb) (GstOmxBaseSrc *self); + +#include <gstomx_util.h> + +struct GstOmxBaseSrc +{ + GstBaseSrc element; + + GOmxCore *gomx; + GOmxPort *out_port; + + char *omx_role; + char *omx_component; + char *omx_library; + GstOmxBaseSrcCb setup_ports; +}; + +struct GstOmxBaseSrcClass +{ + GstBaseSrcClass parent_class; + gint out_port_index; +}; + +GType gst_omx_base_src_get_type (void); + +/* protected helper method which can be used by derived classes: + */ +void gst_omx_base_src_setup_ports (GstOmxBaseSrc *self); +GstFlowReturn gst_omx_base_src_create_from_port (GstOmxBaseSrc *self, + GOmxPort *out_port, + GstBuffer **ret_buf); + + +G_END_DECLS + +#endif /* GSTOMX_BASE_SRC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.c new file mode 100644 index 0000000..0adb1bd --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.c @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_vfpc.h" +#include "gstomx.h" +#include <gst/video/video.h> + +#include <OMX_TI_Index.h> + +#include <string.h> /* for memset */ + +enum +{ + ARG_0, + ARG_PORT_INDEX, +}; + +GSTOMX_BOILERPLATE (GstOmxBaseVfpc, gst_omx_base_vfpc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstFlowReturn push_buffer (GstOmxBaseFilter *self, GstBuffer *buf); + +static gboolean +pad_event (GstPad *pad, GstEvent *event) +{ + GstOmxBaseVfpc *self; + GstOmxBaseFilter *omx_base; + + self = GST_OMX_BASE_VFPC (GST_OBJECT_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_CROP: + { + gst_event_parse_crop (event, &self->top, &self->left, NULL, NULL); + return TRUE; + } + default: + { + return parent_class->pad_event (pad, event); + } + } +} + +static void +gstomx_vfpc_set_port_index (GObject *obj, int index) +{ + GstOmxBaseFilter *omx_base; + GstOmxBaseVfpc *self; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_BASE_VFPC (obj); + + self->input_port_index = OMX_VFPC_INPUT_PORT_START_INDEX + index; + self->output_port_index = OMX_VFPC_OUTPUT_PORT_START_INDEX + index; + + /* free the existing core and ports */ + g_omx_core_free (omx_base->gomx); + g_omx_port_free (omx_base->in_port); + g_omx_port_free (omx_base->out_port); + + /* create new core and ports */ + omx_base->gomx = g_omx_core_new (omx_base, self->g_class); + omx_base->in_port = g_omx_core_get_port (omx_base->gomx, "in", self->input_port_index); + omx_base->out_port = g_omx_core_get_port (omx_base->gomx, "out", self->output_port_index); + + omx_base->in_port->omx_allocate = TRUE; + omx_base->in_port->share_buffer = FALSE; + omx_base->in_port->always_copy = FALSE; + + omx_base->out_port->omx_allocate = TRUE; + omx_base->out_port->share_buffer = FALSE; + omx_base->out_port->always_copy = FALSE; + + omx_base->in_port->port_index = self->input_port_index; + omx_base->out_port->port_index = self->output_port_index; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + GstOmxBaseFilterClass *bfilter_class = GST_OMX_BASE_FILTER_CLASS (g_class); + + element_class = GST_ELEMENT_CLASS (g_class); + + bfilter_class->pad_event = pad_event; +} + +static GstFlowReturn +push_buffer (GstOmxBaseFilter *omx_base, GstBuffer *buf) +{ + return parent_class->push_buffer (omx_base, buf); +} + +static gint +gstomx_calculate_stride (int width, GstVideoFormat format) +{ + switch (format) + { + case GST_VIDEO_FORMAT_NV12: + return width; + case GST_VIDEO_FORMAT_YUY2: + return width * 2; + default: + GST_ERROR ("unsupported color format"); + } + return -1; +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseVfpc *self; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + GstVideoFormat format; + + self = GST_OMX_BASE_VFPC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + structure = gst_caps_get_structure (caps, 0); + + g_return_val_if_fail (structure, FALSE); + + if (!gst_video_format_parse_caps_strided (caps, + &format, &self->in_width, &self->in_height, &self->in_stride)) + { + GST_WARNING_OBJECT (self, "width and/or height is not set in caps"); + return FALSE; + } + + if (!self->in_stride) + { + self->in_stride = gstomx_calculate_stride (self->in_width, format); + } + + { + const GValue *framerate = NULL; + framerate = gst_structure_get_value (structure, "framerate"); + if (framerate) + { + self->framerate_num = gst_value_get_fraction_numerator (framerate); + self->framerate_denom = gst_value_get_fraction_denominator (framerate); + + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND, + gst_value_get_fraction_denominator (framerate), + gst_value_get_fraction_numerator (framerate)); + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + } + /* check for pixel-aspect-ratio, to set to src caps */ + { + const GValue *v = NULL; + v = gst_structure_get_value (structure, "pixel-aspect-ratio"); + if (v) { + self->pixel_aspect_ratio_num = gst_value_get_fraction_numerator (v); + self->pixel_aspect_ratio_denom = gst_value_get_fraction_denominator (v); + } else self->pixel_aspect_ratio_denom = 0; + } + + if (!gst_structure_get_boolean (structure, "interlaced", &self->interlaced)) + self->interlaced = FALSE; + + if (self->sink_setcaps) + self->sink_setcaps (pad, caps); + + return gst_pad_set_caps (pad, caps); +} + +static gboolean +src_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxBaseVfpc *self; + GstOmxBaseFilter *omx_base; + GstVideoFormat format; + GstStructure *structure; + + self = GST_OMX_BASE_VFPC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + structure = gst_caps_get_structure (caps, 0); + + GST_INFO_OBJECT (omx_base, "setcaps (src): %" GST_PTR_FORMAT, caps); + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (!gst_video_format_parse_caps_strided (caps, + &format, &self->out_width, &self->out_height, &self->out_stride)) + { + GST_WARNING_OBJECT (self, "width and/or height is not set in caps"); + return FALSE; + } + + if (!self->out_stride) + { + self->out_stride = gstomx_calculate_stride (self->out_width, format); + } + + /* save the src caps later needed by omx transport buffer */ + if (omx_base->out_port->caps) + gst_caps_unref (omx_base->out_port->caps); + + omx_base->out_port->caps = gst_caps_copy (caps); + + return TRUE; +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseVfpc *self; + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_BASE_VFPC (obj); + + switch (prop_id) + { + case ARG_PORT_INDEX: + self->port_index = g_value_get_uint (value); + if (!self->port_configured) + gstomx_vfpc_set_port_index (obj, self->port_index); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseVfpc *self; + + self = GST_OMX_BASE_VFPC (obj); + + switch (prop_id) + { + case ARG_PORT_INDEX: + g_value_set_uint (value, self->port_index); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVfpc *self; + GOmxCore *gomx; + GOmxPort *port; + + self = GST_OMX_BASE_VFPC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + if (self->omx_setup) + { + self->omx_setup (omx_base); + } + + /* enable input port */ + port = omx_base->in_port; + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + /* enable output port */ + port = omx_base->out_port; + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + /* indicate that port is now configured */ + self->port_configured = TRUE; + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + GST_OMX_BASE_FILTER_CLASS (g_class)->push_buffer = push_buffer; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_PORT_INDEX, + g_param_spec_uint ("port-index", "port index", + "input/output start port index", + 0, 8, 0, G_PARAM_READWRITE)); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxBaseVfpc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_BASE_VFPC (instance); + + omx_base->omx_setup = omx_setup; + self->g_class = g_class; + + gst_pad_set_setcaps_function (omx_base->sinkpad, + GST_DEBUG_FUNCPTR (sink_setcaps)); + gst_pad_set_setcaps_function (omx_base->srcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.h new file mode 100644 index 0000000..0538e8d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_vfpc.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010-2011 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_VFPC_H +#define GSTOMX_BASE_VFPC_H + +#include <gst/gst.h> + +#include <OMX_TI_Index.h> +#include <OMX_TI_Common.h> +#include <omx_vfpc.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_VFPC(obj) (GstOmxBaseVfpc *) (obj) +#define GST_OMX_BASE_VFPC_TYPE (gst_omx_base_vfpc_get_type ()) +#define GST_OMX_BASE_VFPC_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_OMX_BASE_VFPC_TYPE, GstOmxBaseVfpcClass)) + +typedef struct GstOmxBaseVfpc GstOmxBaseVfpc; +typedef struct GstOmxBaseVfpcClass GstOmxBaseVfpcClass; + +#include "gstomx_base_filter.h" + +struct GstOmxBaseVfpc +{ + GstOmxBaseFilter omx_base; + + gint framerate_num; + gint framerate_denom; + gboolean port_configured; + GstPadSetCapsFunction sink_setcaps; + gint in_width, in_height, in_stride; + gint out_width, out_height, out_stride; + gint left, top; + gint port_index, input_port_index, output_port_index; + GstOmxBaseFilterCb omx_setup; + gpointer g_class; + gint pixel_aspect_ratio_num; + gint pixel_aspect_ratio_denom; + gboolean interlaced; +}; + +struct GstOmxBaseVfpcClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_base_vfpc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_VFPC_H */ + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.c new file mode 100644 index 0000000..e6be904 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.c @@ -0,0 +1,490 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_videodec.h" +#include "gstomx.h" + +#include <gst/video/video.h> + +#ifdef USE_OMXTICORE +# include <OMX_TI_Index.h> +#endif + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +/* OMX component not handling other color formats properly.. use this workaround + * until component is fixed or we rebase to get config file support.. + */ +#define VIDDEC_COLOR_WORKAROUND +#ifdef VIDDEC_COLOR_WORKAROUND +# undef GSTOMX_ALL_FORMATS +# define GSTOMX_ALL_FORMATS "{NV12}" +#endif + +static GstStaticPadTemplate src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ( + GSTOMX_ALL_FORMATS, "[ 0, max ]")) + ); + +static GstFlowReturn push_buffer (GstOmxBaseFilter *self, GstBuffer *buf); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GST_OMX_BASE_FILTER_CLASS (g_class)->push_buffer = push_buffer; +} + +static GstFlowReturn +push_buffer (GstOmxBaseFilter *omx_base, GstBuffer *buf) +{ + GstOmxBaseVideoDec *self = GST_OMX_BASE_VIDEODEC (omx_base); + guint n_offset = omx_base->out_port->n_offset; + if (n_offset) + { + gst_pad_push_event (omx_base->srcpad, + gst_event_new_crop (n_offset / self->rowstride, /* top */ + n_offset % self->rowstride, /* left */ + -1, -1)); /* width/height: can be invalid for now */ + } + return parent_class->push_buffer (omx_base, buf); +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + GstOmxBaseVideoDec *self; + GstCaps *new_caps; + + omx_base = core->object; + self = GST_OMX_BASE_VIDEODEC (omx_base); + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + new_caps = gst_caps_intersect (gst_pad_get_caps (omx_base->srcpad), + gst_pad_peer_get_caps (omx_base->srcpad)); + + if (!gst_caps_is_fixed (new_caps)) + { + gst_caps_do_simplify (new_caps); + GST_INFO_OBJECT (omx_base, "pre-fixated caps: %" GST_PTR_FORMAT, new_caps); + gst_pad_fixate_caps (omx_base->srcpad, new_caps); + } + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + GST_INFO_OBJECT (omx_base, "old caps are: %" GST_PTR_FORMAT, GST_PAD_CAPS (omx_base->srcpad)); + + gst_pad_set_caps (omx_base->srcpad, new_caps); +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseVideoDec *self; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + + gint width = 0; + gint height = 0; + + self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + structure = gst_caps_get_structure (caps, 0); + + g_return_val_if_fail (structure, FALSE); + + if (!(gst_structure_get_int (structure, "width", &width) && + gst_structure_get_int (structure, "height", &height))) + { + GST_WARNING_OBJECT (self, "width and/or height not set in caps: %dx%d", + width, height); + return FALSE; + } + + { + const GValue *framerate = NULL; + framerate = gst_structure_get_value (structure, "framerate"); + if (framerate) + { + self->framerate_num = gst_value_get_fraction_numerator (framerate); + self->framerate_denom = gst_value_get_fraction_denominator (framerate); + + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND, + gst_value_get_fraction_denominator (framerate), + gst_value_get_fraction_numerator (framerate)); + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + } + /* check for pixel-aspect-ratio, to set to src caps */ + { + const GValue *v = NULL; + v = gst_structure_get_value (structure, "pixel-aspect-ratio"); + if (v) { + self->pixel_aspect_ratio_num = gst_value_get_fraction_numerator (v); + self->pixel_aspect_ratio_denom = gst_value_get_fraction_denominator (v); + } else self->pixel_aspect_ratio_denom = 0; + } + + if (!gst_structure_get_boolean (structure, "interlaced", &self->interlaced)) + self->interlaced = FALSE; + + { + const GValue *codec_data; + GstBuffer *buffer; + + codec_data = gst_structure_get_value (structure, "codec_data"); + if (codec_data) + { + buffer = gst_value_get_buffer (codec_data); + omx_base->codec_data = buffer; + gst_buffer_ref (buffer); + } + } + + /* REVISIT: to use OMX package from EZSDK you need to configure ports */ + #ifdef USE_OMXTICORE + { + if (self->initialize_port) { + self->extendedParams.width = width; + self->extendedParams.height = height; + self->initialize_port(omx_base); + } + } + #endif + + /* Input port configuration. */ + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + param.nBufferSize = width * height; + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION"); + } + + self->inport_configured = TRUE; + + if (self->sink_setcaps) + self->sink_setcaps (pad, caps); + + return gst_pad_set_caps (pad, caps); +} + +static GstCaps * +src_getcaps (GstPad *pad) +{ + GstCaps *caps; + GstOmxBaseVideoDec *self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + GstOmxBaseFilter *omx_base = GST_OMX_BASE_FILTER (self); + + if (omx_base->gomx->omx_state > OMX_StateLoaded) + { + /* currently, we cannot change caps once out of loaded.. later this + * could possibly be supported by enabling/disabling the port.. + */ + GST_DEBUG_OBJECT (self, "cannot getcaps in %d state", omx_base->gomx->omx_state); + return GST_PAD_CAPS (pad); + } + + if (self->inport_configured) + { + /* if we already have src-caps, we want to take the already configured + * width/height/etc. But we can still support any option of rowstride, + * so we still don't want to return fixed caps + */ + OMX_PARAM_PORTDEFINITIONTYPE param; + int i; + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + caps = gst_caps_new_empty (); + + for (i=1; i<2; i++) + { + GstStructure *struc = gst_structure_new ( + (i ? "video/x-raw-yuv-strided" : "video/x-raw-yuv"), + "width", G_TYPE_INT, param.format.video.nFrameWidth, + "height", G_TYPE_INT, param.format.video.nFrameHeight, +#ifdef VIDDEC_COLOR_WORKAROUND + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N', 'V', '1', '2'), +#endif + NULL); + + if(i) + { + /* if buffer sharing is used, we let the upstream that allocates + * the buffer dictate stride, otherwise we let the OMX component + * decide on the stride + */ + if (omx_base->out_port->share_buffer) + { + gst_structure_set (struc, + "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, + NULL); + } + else + { + gst_structure_set (struc, + "rowstride", G_TYPE_INT, param.format.video.nStride, + NULL); + } + } + + if (self->framerate_denom) + { + gst_structure_set (struc, + "framerate", GST_TYPE_FRACTION, self->framerate_num, self->framerate_denom, + NULL); + } + + if (self->pixel_aspect_ratio_denom) + { + gst_structure_set (struc, + "pixel-aspect-ratio", GST_TYPE_FRACTION, self->pixel_aspect_ratio_num, + self->pixel_aspect_ratio_denom, NULL); + } + + gst_structure_set (struc, + "interlaced", G_TYPE_BOOLEAN, self->interlaced, NULL); + + gst_caps_append_structure (caps, struc); + } + } + else + { + /* we don't have valid width/height/etc yet, so just use the template.. */ + caps = gst_static_pad_template_get_caps (&src_template); + GST_DEBUG_OBJECT (self, "caps=%"GST_PTR_FORMAT, caps); + } + +#ifndef VIDDEC_COLOR_WORKAROUND + caps = g_omx_port_set_video_formats (omx_base->out_port, caps); +#endif + + GST_DEBUG_OBJECT (self, "caps=%"GST_PTR_FORMAT, caps); + + return caps; +} + +static gboolean +src_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxBaseVideoDec *self; + GstOmxBaseFilter *omx_base; + + GstVideoFormat format; + gint width, height, rowstride; + + self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + GST_INFO_OBJECT (omx_base, "setcaps (src): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (gst_video_format_parse_caps_strided (caps, + &format, &width, &height, &rowstride)) + { + /* Output port configuration: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + /* REVISIT: if rowstride is not defined then use the one from output params */ + if (!rowstride) + rowstride = param.format.video.nStride; + + param.format.video.eColorFormat = g_omx_fourcc_to_colorformat ( + gst_video_format_to_fourcc (format)); + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + param.format.video.nStride = self->rowstride = rowstride; + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + GST_INFO_OBJECT (omx_base,"G_OMX_PORT_SET_DEFINITION"); + } + + /* save the src caps later needed by omx transport buffer */ + if (omx_base->out_port->caps) + gst_caps_unref (omx_base->out_port->caps); + omx_base->out_port->caps = gst_caps_copy (caps); + + return TRUE; +} + +#if 0 +static gboolean +src_query (GstPad *pad, GstQuery *query) +{ + GstOmxBaseVideoDec *self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + GstOmxBaseFilter *omx_base = GST_OMX_BASE_FILTER (self); + gboolean ret = FALSE; + + GST_DEBUG_OBJECT (self, "begin"); + + if (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS) { + const GstCaps *caps; + OMX_ERRORTYPE err; + OMX_PARAM_PORTDEFINITIONTYPE param; + + _G_OMX_INIT_PARAM (¶m); + + gst_query_parse_buffers_caps (query, &caps); + + /* ensure the caps we are querying are the current ones, otherwise + * results are meaningless.. + * + * @todo should we save and restore current caps?? + */ + src_setcaps (pad, (GstCaps *)caps); + + param.nPortIndex = omx_base->out_port->port_index; + err = OMX_GetParameter (omx_base->gomx->omx_handle, + OMX_IndexParamPortDefinition, ¶m); + g_assert (err == OMX_ErrorNone); + + param.nBufferCountActual = param.nBufferCountMin; + err = OMX_SetParameter (omx_base->gomx->omx_handle, + OMX_IndexParamPortDefinition, ¶m); + g_assert (err == OMX_ErrorNone); + + GST_DEBUG_OBJECT (self, "min buffers: %ld", param.nBufferCountMin); + + gst_query_set_buffers_count (query, param.nBufferCountMin); + +/* REVISIT: OMX_TI_IndexParam2DBufferAllocDimension is not implemented in EZSDK OMX components */ +#if 0 +#ifdef USE_OMXTICORE + { + OMX_CONFIG_RECTTYPE rect; + _G_OMX_INIT_PARAM (&rect); + + rect.nPortIndex = omx_base->out_port->port_index; + err = OMX_GetParameter (omx_base->gomx->omx_handle, + OMX_TI_IndexParam2DBufferAllocDimension, &rect); + if (err == OMX_ErrorNone) { + GST_DEBUG_OBJECT (self, "min dimensions: %ldx%ld", + rect.nWidth, rect.nHeight); + gst_query_set_buffers_dimensions (query, + rect.nWidth, rect.nHeight); + } + } +#endif +#endif + + ret = TRUE; + } + + GST_DEBUG_OBJECT (self, "end -> %d", ret); + + return ret; +} +#endif + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Input port configuration. */ + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.video.eCompressionFormat = self->compression_format; + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION 1!!!"); + } + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + omx_base->in_port->omx_allocate = TRUE; + omx_base->out_port->omx_allocate = TRUE; + omx_base->in_port->share_buffer = FALSE; + omx_base->in_port->always_copy = TRUE; + omx_base->out_port->share_buffer = FALSE; + omx_base->out_port->always_copy = FALSE; + + gst_pad_set_setcaps_function (omx_base->sinkpad, + GST_DEBUG_FUNCPTR (sink_setcaps)); + + gst_pad_set_getcaps_function (omx_base->srcpad, + GST_DEBUG_FUNCPTR (src_getcaps)); + gst_pad_set_setcaps_function (omx_base->srcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); +// gst_pad_set_query_function (omx_base->srcpad, +// GST_DEBUG_FUNCPTR (src_query)); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.h new file mode 100644 index 0000000..2a19057 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videodec.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_VIDEODEC_H +#define GSTOMX_BASE_VIDEODEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_VIDEODEC(obj) (GstOmxBaseVideoDec *) (obj) +#define GST_OMX_BASE_VIDEODEC_TYPE (gst_omx_base_videodec_get_type ()) +#define GST_OMX_BASE_VIDEODEC_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_OMX_BASE_VIDEODEC_TYPE, GstOmxBaseVideoDecClass)) + +typedef struct GstOmxBaseVideoDec GstOmxBaseVideoDec; +typedef struct GstOmxBaseVideoDecClass GstOmxBaseVideoDecClass; + +#include "gstomx_base_filter.h" + +struct _extendedParams +{ + gint width; + gint height; + gint framerate_num; + gint framerate_denom; +}; + +struct GstOmxBaseVideoDec +{ + GstOmxBaseFilter omx_base; + + OMX_VIDEO_CODINGTYPE compression_format; + gint framerate_num; + gint framerate_denom; + gboolean inport_configured; + GstPadSetCapsFunction sink_setcaps; + GstOmxBaseFilterCb initialize_port; + struct _extendedParams extendedParams; + + gint rowstride; /**< rowstride of output buffer */ + + gint pixel_aspect_ratio_num; + gint pixel_aspect_ratio_denom; + gboolean interlaced; +}; + +struct GstOmxBaseVideoDecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_base_videodec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_VIDEODEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.c new file mode 100644 index 0000000..fd8ff96 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.c @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_base_videoenc.h" +#include "gstomx.h" +#include <OMX_TI_Index.h> +#include <gst/video/video.h> + +#include <string.h> /* for memset, strcmp */ + +enum +{ + ARG_0, + ARG_BITRATE, +}; + +#define DEFAULT_BITRATE 500000 + +GSTOMX_BOILERPLATE (GstOmxBaseVideoEnc, gst_omx_base_videoenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ( + "{ NV12 }", "[ 0, max ]")) + ); + +static gboolean pad_event (GstPad *pad, GstEvent *event); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + GstOmxBaseFilterClass *bfilter_class = GST_OMX_BASE_FILTER_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + bfilter_class->pad_event = pad_event; +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseVideoEnc *self; + + self = GST_OMX_BASE_VIDEOENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + self->bitrate = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseVideoEnc *self; + + self = GST_OMX_BASE_VIDEOENC (obj); + + switch (prop_id) + { + case ARG_BITRATE: + /** @todo propagate this to OpenMAX when processing. */ + g_value_set_uint (value, self->bitrate); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_BITRATE, + g_param_spec_uint ("bitrate", "Bit-rate", + "Encoding bit-rate", + 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE)); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstOmxBaseVideoEnc *self; + GstOmxBaseFilter *omx_base; + GstQuery *query; + GstVideoFormat format; + gint width, height, rowstride; + const GValue *framerate = NULL; + + self = GST_OMX_BASE_VIDEOENC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + framerate = gst_structure_get_value ( + gst_caps_get_structure (caps, 0), "framerate"); + + if (framerate) + { + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND, + gst_value_get_fraction_denominator (framerate), + gst_value_get_fraction_numerator (framerate)); + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + + if (gst_video_format_parse_caps_strided (caps, + &format, &width, &height, &rowstride)) + { + /* Output port configuration: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar ; + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + if (!rowstride) + rowstride = (width + 15) & 0xFFFFFFF0; + param.format.video.nStride = self->rowstride = rowstride; + + if (framerate) + { + guint frameRate; + self->framerate_num = gst_value_get_fraction_numerator (framerate); + self->framerate_denom = gst_value_get_fraction_denominator (framerate); + frameRate = (self->framerate_num + self->framerate_denom - 1)/self->framerate_denom; + /*if(ABS(30 - framerate) < ABS(60 - framerate)) + frameRate = 30; + else + frameRate = 60;*/ + /* convert to Q.16 */ + param.format.video.xFramerate = (frameRate << 16); + /* (gst_value_get_fraction_numerator (framerate) / + gst_value_get_fraction_denominator (framerate)) << 16;*/ + } + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + } + + + return TRUE; +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoEnc *self; + GOmxCore *gomx; + + self = GST_OMX_BASE_VIDEOENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Output port configuration. */ + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + param.format.video.eCompressionFormat = self->compression_format; + + /** @todo this should be set with a property */ + param.format.video.nBitrate = self->bitrate; + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + + /* some workarounds required for TI components. */ + { + guint32 fourcc; + gint width, height; + gulong framerate; + + /* the component should do this instead */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + width = param.format.video.nFrameWidth; + height = param.format.video.nFrameHeight; + framerate = param.format.video.xFramerate; + + /* this is against the standard; nBufferSize is read-only. */ + fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2'); + param.nBufferSize = gst_video_format_get_size_strided ( + gst_video_format_from_fourcc (fourcc), + + width, height, param.format.video.nStride); + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + + /* the component should do this instead */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + /* this is against the standard; nBufferSize is read-only. */ + param.nBufferSize = width * height; + + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + param.format.video.xFramerate = framerate; + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + } + + /* the component should do this instead */ + { + GOmxPort *port; + + /* enable input port */ + port = omx_base->in_port; + OMX_SendCommand (g_omx_core_get_handle (port->core), OMX_CommandPortEnable, + port->port_index, NULL); + g_sem_down (port->core->port_sem); + + /* enable output port */ + port = omx_base->out_port; + OMX_SendCommand (g_omx_core_get_handle (port->core), OMX_CommandPortEnable, + port->port_index, NULL); + g_sem_down (port->core->port_sem); + + } + } + } + + if (self->omx_setup) + self->omx_setup (GST_OMX_BASE_FILTER (self)); + + GST_INFO_OBJECT (omx_base, "end"); +} + +static gboolean +pad_event (GstPad *pad, GstEvent *event) +{ + GstOmxBaseVideoEnc *self; + GstOmxBaseFilter *omx_base; + + self = GST_OMX_BASE_VIDEOENC (GST_OBJECT_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_CROP: + { + gint top, left; + gst_event_parse_crop (event, &top, &left, NULL, NULL); + + omx_base->in_port->n_offset = (self->rowstride * top) + left; + + return TRUE; + } + default: + { + return parent_class->pad_event (pad, event); + } + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxBaseVideoEnc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_BASE_VIDEOENC (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->in_port->omx_allocate = TRUE; + omx_base->out_port->omx_allocate = TRUE; + omx_base->in_port->share_buffer = FALSE; + omx_base->out_port->share_buffer = FALSE; + omx_base->out_port->always_copy = FALSE; + omx_base->in_port->always_copy = TRUE; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->bitrate = DEFAULT_BITRATE; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.h new file mode 100644 index 0000000..7d02eb4 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_base_videoenc.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_BASE_VIDEOENC_H +#define GSTOMX_BASE_VIDEOENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_BASE_VIDEOENC(obj) (GstOmxBaseVideoEnc *) (obj) +#define GST_OMX_BASE_VIDEOENC_TYPE (gst_omx_base_videoenc_get_type ()) + +typedef struct GstOmxBaseVideoEnc GstOmxBaseVideoEnc; +typedef struct GstOmxBaseVideoEncClass GstOmxBaseVideoEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxBaseVideoEnc +{ + GstOmxBaseFilter omx_base; + + OMX_VIDEO_CODINGTYPE compression_format; + guint bitrate; + gint framerate_num; + gint framerate_denom; + GstOmxBaseFilterCb omx_setup; + + gint rowstride; /**< rowstride of input buffer */ +}; + +struct GstOmxBaseVideoEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_base_videoenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_BASE_VIDEOENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.c new file mode 100755 index 0000000..b9837be --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.c @@ -0,0 +1,176 @@ +/* + * This file defines the "OmxBufferTransport" buffer object, which is used + * to encapsulate an existing DMAI buffer object inside of a gStreamer + * buffer so it can be passed along the gStreamer pipeline. + * + * Specifically, this object provides a finalize function that will release + * a DMAI buffer properly when gst_buffer_unref() is called. If the specified + * DMAI buffer is part of a BufTab, it will be released for re-use. + * DMAI buffers no part of a BufTab will be deleted when no longer referenced. + * + * Downstream elements may use the GST_IS_OMXBUFFERTRANSPORT() macro to + * check to see if a gStreamer buffer encapsulates a DMAI buffer. When passed + * an element of this type, elements can take advantage of the fact that the + * buffer is contiguously allocated in memory. Also, if the element is using + * OMX it can access the OMX buffer directly via the + * GST_OMXBUFFERTRANSPORT_OMXBUF() macro. + * + * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program 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 version 2.1 of the License. + * + * This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, + * whether express or implied; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + +#include <stdlib.h> +#include <pthread.h> + +#include "gstomx_buffertransport.h" +#include "gstomx.h" +#include "gstomx_port.h" + +GST_DEBUG_CATEGORY_STATIC (gst_omxbuffertransport_debug); + +static GstBufferClass *parent_class; + +static void gst_omxbuffertransport_init(GstOmxBufferTransport *self); +static void gst_omxbuffertransport_log_init(void); +static void gst_omxbuffertransport_class_init(GstOmxBufferTransportClass *klass); +static void gst_omxbuffertransport_finalize(GstBuffer *gstbuffer); + +G_DEFINE_TYPE_WITH_CODE (GstOmxBufferTransport, gst_omxbuffertransport, \ + GST_TYPE_BUFFER, gst_omxbuffertransport_log_init()); + +static void gst_omxbuffertransport_log_init(void) +{ + GST_DEBUG_CATEGORY_INIT(gst_omxbuffertransport_debug, + "OmxBufferTransport", 0, "OMX Buffer Transport"); +} + +static void gst_omxbuffertransport_init(GstOmxBufferTransport *self) +{ + GST_LOG("begin\n"); + + self->omxbuffer = NULL; + self->port = NULL; + + GST_LOG("end\n"); +} + +static void gst_omxbuffertransport_class_init( + GstOmxBufferTransportClass *klass) +{ + GST_LOG("begin\n"); + + parent_class = g_type_class_peek_parent(klass); + + /* Override the mini-object's finalize routine so we can do cleanup when + * a GstOmxBufferTransport is unref'd. + */ + klass->derived_methods.mini_object_class.finalize = + (GstMiniObjectFinalizeFunction) gst_omxbuffertransport_finalize; + + GST_LOG("end class_init\n"); +} + +static void +release_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer) +{ + switch (port->type) + { + case GOMX_PORT_INPUT: + GST_LOG ("ETB: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer ? omx_buffer->pAppPrivate : 0, omx_buffer ? omx_buffer->pBuffer : 0); + OMX_EmptyThisBuffer (port->core->omx_handle, omx_buffer); + break; + case GOMX_PORT_OUTPUT: + GST_LOG ("FTB: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer ? omx_buffer->pAppPrivate : 0, omx_buffer ? omx_buffer->pBuffer : 0); + OMX_FillThisBuffer (port->core->omx_handle, omx_buffer); + break; + default: + break; + } +} + +static void gst_omxbuffertransport_finalize(GstBuffer *gstbuffer) +{ + GstOmxBufferTransport *self = GST_OMXBUFFERTRANSPORT(gstbuffer); + int ii; + GST_LOG("begin\n"); + + release_buffer (self->port, self->omxbuffer); + + for(ii = 0; ii < self->numAdditionalHeaders; ii++) { + //printf("finalize buffer:%p\n",self->addHeader[ii]); + if(self->addHeader[ii]) + release_buffer(self->port,self->addHeader[ii]); + } + + self->omxbuffer = NULL; + self->port = NULL; + + /* Call GstBuffer's finalize routine, so our base class can do it's cleanup + * as well. If we don't do this, we'll have a memory leak that is very + * difficult to track down. + */ + GST_BUFFER_CLASS(parent_class)-> + mini_object_class.finalize(GST_MINI_OBJECT(gstbuffer)); + + GST_LOG("end finalize\n"); +} + +GstBuffer* gst_omxbuffertransport_new (GOmxPort *port, OMX_BUFFERHEADERTYPE *buffer) +{ + GstOmxBufferTransport *tdt_buf; + + tdt_buf = (GstOmxBufferTransport*) + gst_mini_object_new(GST_TYPE_OMXBUFFERTRANSPORT); + + g_return_val_if_fail(tdt_buf != NULL, NULL); + + GST_BUFFER_SIZE(tdt_buf) = buffer->nFilledLen; + GST_BUFFER_DATA(tdt_buf) = buffer->pBuffer; + gst_buffer_set_caps(GST_BUFFER (tdt_buf), port->caps); + + if (GST_BUFFER_DATA(tdt_buf) == NULL) { + gst_mini_object_unref(GST_MINI_OBJECT(tdt_buf)); + return NULL; + } + + tdt_buf->omxbuffer = buffer; + tdt_buf->port = port; + + tdt_buf->numAdditionalHeaders = 0; + tdt_buf->addHeader = NULL; + + GST_LOG("end new\n"); + + return GST_BUFFER(tdt_buf); +} + +void gst_omxbuffertransport_set_additional_headers (GstOmxBufferTransport *self ,guint numHeaders,OMX_BUFFERHEADERTYPE **buffer) +{ + int ii; + + if(numHeaders == 0) + return; + + self->addHeader = malloc(numHeaders*sizeof(OMX_BUFFERHEADERTYPE *)); + + for(ii = 0; ii < numHeaders; ii++) { + //printf("additional header:%p\n", buffer[ii]); + self->addHeader[ii] = buffer[ii]; + } + self->numAdditionalHeaders = numHeaders; + + return ; +} + + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.h new file mode 100644 index 0000000..74f1416 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_buffertransport.h @@ -0,0 +1,78 @@ +/* + * gstomxbuffertransport.h + * + * This file declares the "OMXBufferTransport" buffer object, which is used + * to encapsulate an existing OMX buffer object inside of a gStreamer + * buffer so it can be passed along the gStreamer pipeline. + * + * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/ + * + * This program 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 version 2.1 of the License. + * + * This program is distributed #as is# WITHOUT ANY WARRANTY of any kind, + * whether express or implied; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + +#ifndef __GST_OMXBUFFERTRANSPORT_H__ +#define __GST_OMXBUFFERTRANSPORT_H__ + +#include <gst/gst.h> + +#include "gstomx_util.h" + +G_BEGIN_DECLS + +/* Type macros for GST_TYPE_OMXBUFFERTRANSPORT */ +#define GST_TYPE_OMXBUFFERTRANSPORT \ + (gst_omxbuffertransport_get_type()) +#define GST_OMXBUFFERTRANSPORT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_OMXBUFFERTRANSPORT, \ + GstOmxBufferTransport)) +#define GST_IS_OMXBUFFERTRANSPORT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_OMXBUFFERTRANSPORT)) +#define GST_OMXBUFFERTRANSPORT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_OMXBUFFERTRANSPORT, \ + GstOmxBufferTransportClass)) +#define GST_IS_OMXBUFFERTRANSPORT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_OMXBUFFERTRANSPORT)) +#define GST_OMXBUFFERTRANSPORT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_OMXBUFFERTRANSPORT, \ + GstOmxBufferTransportClass)) + +typedef struct _GstOmxBufferTransport GstOmxBufferTransport; +typedef struct _GstOmxBufferTransportClass GstOmxBufferTransportClass; + +/* Utility macros for GST_TYPE_OMXBUFFERTRANSPORT */ +#define GST_GET_OMXBUFFER(obj) \ + ((obj) ? GST_OMXBUFFERTRANSPORT(obj)->omxbuffer : NULL) +#define GST_GET_OMXPORT(obj) \ + ((obj) ? GST_OMXBUFFERTRANSPORT(obj)->port : NULL) + + +/* _GstOmxBufferTransport object */ +struct _GstOmxBufferTransport { + GstBuffer parent_instance; + OMX_BUFFERHEADERTYPE *omxbuffer; + GOmxPort *port; + guint numAdditionalHeaders; + OMX_BUFFERHEADERTYPE **addHeader; +}; + +struct _GstOmxBufferTransportClass { + GstBufferClass derived_methods; +}; + +/* External function declarations */ +GType gst_omxbuffertransport_get_type(void); +GstBuffer* gst_omxbuffertransport_new(GOmxPort *port, OMX_BUFFERHEADERTYPE *buffer); +void gst_omxbuffertransport_set_additional_headers (GstOmxBufferTransport *self ,guint numHeaders,OMX_BUFFERHEADERTYPE **buffer); + + +G_END_DECLS + +#endif /* __GST_OMXBUFFERTRANSPORT_H__ */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.c new file mode 100644 index 0000000..66c6381 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.c @@ -0,0 +1,3329 @@ +/* GStreamer + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: OMX Camera element + * Created on: Aug 31, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "gstomx_camera.h" +#include "gstomx.h" + +#include <gst/video/video.h> + +#ifdef USE_OMXTICORE +# include <OMX_TI_IVCommon.h> +# include <OMX_TI_Index.h> +#endif + +#include <stdint.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/timer-32k.h> +#include <OMX_CoreExt.h> +#include <OMX_IndexExt.h> + +/** + * SECTION:element-omx_camerasrc + * + * omx_camerasrc can be used to capture video and/or still frames from OMX + * camera. It can also be used as a filter to provide access to the camera's + * memory-to-memory mode. + * <p> + * In total, the omx_camerasrc element exposes one optional input port, "sink", + * one mandatory src pad, "src", and two optional src pads, "imgsrc" and + * "vidsrc". If "imgsrc" and/or "vidsrc" are linked, then viewfinder buffers + * are pushed on the "src" pad. + * <p> + * In all modes, preview buffers are pushed on the "src" pad. In video capture + * mode, the same buffer is pushed on the "vidsrc" pad. In image capture mode, + * a separate full resolution image (either raw or jpg encoded) is pushed on + * the "imgsrc" pad. + * <p> + * The camera pad_alloc()s buffers from the "src" pad, in order to allocate + * memory from the video driver. The "vidsrc" caps are slaved to the "src" + * caps. Although this should be considered an implementation detail. + * <p> + * TODO: for legacy mode support, as a replacement for v4l2src, can we push + * buffers of the requested resolution on the "src" pad? Can we configure the + * OMX component for arbitrary resolution on the preview port, or do we need + * to dynamically map the "src" pad to different ports depending on the config? + * The OMX camera supports only video resolutions on the preview and video + * ports, but supports higher resolution stills on the image port. + * + * <refsect2> + * <title>Example launch lines</title> + * |[ + * gst-launch omx_camera vstab=1 mode=2 vnf=1 name=cam cam.src ! queue ! v4l2sink \ + * cam.vidsrc ! "video/x-raw-yuv, format=(fourcc)UYVY, width=720, height=480, framerate=30/1" ! \ + * queue ! omx_h264enc matroskamux name=mux ! filesink location=capture.mkv ! \ + * alsasrc ! "audio/x-raw-int,rate=48000,channels=1, width=16, depth=16, endianness=1234" ! \ + * queue ! omx_aacenc bitrate=64000 profile=2 ! "audio/mpeg,mpegversion=4,rate=48000,channels=1" ! \ + * mux. cam.imgsrc ! "image/jpeg, width=720, height=480" ! filesink name=capture.jpg + * ]| + * </refsect2> + */ + +static const GstElementDetails element_details = +GST_ELEMENT_DETAILS ("Video OMX Camera Source", + "Source/Video", + "Reads frames from a OMX Camera Component", + "Rob Clark <rob@ti.com>"); + + +enum +{ + ARG_0, + ARG_NUM_IMAGE_OUTPUT_BUFFERS, + ARG_NUM_VIDEO_OUTPUT_BUFFERS, + ARG_MODE, + ARG_SHUTTER, + ARG_ZOOM, + ARG_FOCUS, + ARG_AWB, + ARG_CONTRAST, + ARG_BRIGHTNESS, + ARG_EXPOSURE, + ARG_ISO, + ARG_ROTATION, + ARG_MIRROR, + ARG_SATURATION, + ARG_EXPOSUREVALUE, + ARG_MANUALFOCUS, + ARG_QFACTORJPEG, +#ifdef USE_OMXTICORE + ARG_THUMBNAIL_WIDTH, + ARG_THUMBNAIL_HEIGHT, + ARG_FLICKER, + ARG_SCENE, + ARG_VNF, + ARG_YUV_RANGE, + ARG_VSTAB, + ARG_DEVICE, + ARG_LDC, + ARG_NSF, + ARG_MTIS, + ARG_SENSOR_OVERCLOCK, + ARG_WB_COLORTEMP, + ARG_FOCUSSPOT_WEIGHT, + ARG_WIDTHFOCUSREGION, + ARG_HEIGHTFOCUSREGION, + ARG_SHARPNESS, + ARG_CAC, +#endif +}; + +#define DEFAULT_ZOOM_LEVEL 100 +#define MIN_ZOOM_LEVEL 100 +#define MAX_ZOOM_LEVEL 800 +#define CAM_ZOOM_IN_STEP 65536 +#define DEFAULT_FOCUS OMX_IMAGE_FocusControlOff +#define DEFAULT_AWB OMX_WhiteBalControlOff +#define DEFAULT_EXPOSURE OMX_ExposureControlOff +#define DEFAULT_CONTRAST_LEVEL 0 +#define MIN_CONTRAST_LEVEL -100 +#define MAX_CONTRAST_LEVEL 100 +#define DEFAULT_BRIGHTNESS_LEVEL 50 +#define MIN_BRIGHTNESS_LEVEL 0 +#define MAX_BRIGHTNESS_LEVEL 100 +#define DEFAULT_ISO_LEVEL 0 +#define MIN_ISO_LEVEL 0 +#define MAX_ISO_LEVEL 1600 +#define DEFAULT_ROTATION 180 +#define DEFAULT_MIRROR OMX_MirrorNone +#define MIN_SATURATION_VALUE -100 +#define MAX_SATURATION_VALUE 100 +#define DEFAULT_SATURATION_VALUE 0 +#define MIN_EXPOSURE_VALUE -3.0 +#define MAX_EXPOSURE_VALUE 3.0 +#define DEFAULT_EXPOSURE_VALUE 0.0 +#define MIN_MANUALFOCUS 0 +#define MAX_MANUALFOCUS 100 +#define DEFAULT_MANUALFOCUS 50 +#define MIN_QFACTORJPEG 1 +#define MAX_QFACTORJPEG 100 +#define DEFAULT_QFACTORJPEG 75 +#ifdef USE_OMXTICORE +# define DEFAULT_THUMBNAIL_WIDTH 352 +# define DEFAULT_THUMBNAIL_HEIGHT 288 +# define MIN_THUMBNAIL_LEVEL 16 +# define MAX_THUMBNAIL_LEVEL 1920 +# define DEFAULT_FLICKER OMX_FlickerCancelOff +# define DEFAULT_SCENE OMX_Manual +# define DEFAULT_VNF OMX_VideoNoiseFilterModeOn +# define DEFAULT_YUV_RANGE OMX_ITURBT601 +# define DEFAULT_DEVICE OMX_PrimarySensor +# define DEFAULT_NSF OMX_ISONoiseFilterModeOff +# define DEFAULT_WB_COLORTEMP_VALUE 5000 +# define MIN_WB_COLORTEMP_VALUE 2020 +# define MAX_WB_COLORTEMP_VALUE 7100 +# define DEFAULT_FOCUSSPOT_WEIGHT OMX_FocusSpotDefault +# define MIN_FOCUSREGION 1 +# define MAX_FOCUSREGION 8064 +# define DEFAULT_FOCUSREGION 1 +# define DEFAULT_FOCUSREGIONWIDTH 176 +# define DEFAULT_FOCUSREGIONHEIGHT 144 +# define MIN_SHARPNESS_VALUE -100 +# define MAX_SHARPNESS_VALUE 100 +# define DEFAULT_SHARPNESS_VALUE 0 +#endif + + +GSTOMX_BOILERPLATE (GstOmxCamera, gst_omx_camera, GstOmxBaseSrc, GST_OMX_BASE_SRC_TYPE); + +#define USE_GSTOMXCAM_IMGSRCPAD +#define USE_GSTOMXCAM_VIDSRCPAD +#define USE_GSTOMXCAM_THUMBSRCPAD +//#define USE_GSTOMXCAM_IN_PORT + +/* + * Mode table + */ +enum +{ + MODE_PREVIEW = 0, + MODE_VIDEO = 1, + MODE_VIDEO_IMAGE = 2, + MODE_IMAGE = 3, + MODE_IMAGE_HS = 4, +}; + +/* + * Shutter state + */ +enum +{ + SHUTTER_OFF = 0, + SHUTTER_HALF_PRESS = 1, + SHUTTER_FULL_PRESS = 2, +}; + +/** + * Table mapping mode to features and ports. The mode is used as an index + * into this table to determine which ports and features are used in that + * particular mode. Since there is some degree of overlap between various + * modes, this is to simplify the code to not care about modes, but instead + * just which bits are set in the config. + */ +static const enum +{ + /* ports that can be used: */ + PORT_PREVIEW = 0x01, + PORT_VIDEO = 0x02, + PORT_IMAGE = 0x04, +} config[] = { + /* MODE_PREVIEW */ PORT_PREVIEW, + /* MODE_VIDEO */ PORT_PREVIEW, + /* MODE_VIDEO_IMAGE */ PORT_PREVIEW | PORT_IMAGE, + /* MODE_IMAGE */ PORT_PREVIEW | PORT_IMAGE, + /* MODE_IMAGE_HS */ PORT_PREVIEW | PORT_IMAGE, +}; + + + +/* + * Enums: + */ + +#define GST_TYPE_OMX_CAMERA_MODE (gst_omx_camera_mode_get_type ()) +static GType +gst_omx_camera_mode_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {MODE_PREVIEW, "Preview", "preview"}, + {MODE_VIDEO, "Video Capture", "video"}, + {MODE_VIDEO_IMAGE, "Video+Image Capture", "video-image"}, + {MODE_IMAGE, "Image Capture", "image"}, + {MODE_IMAGE_HS, "Image Capture High Speed", "image-hs"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraMode", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_SHUTTER (gst_omx_camera_shutter_get_type ()) +static GType +gst_omx_camera_shutter_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {SHUTTER_OFF, "Off", "off"}, + {SHUTTER_HALF_PRESS, "Half Press", "half-press"}, + {SHUTTER_FULL_PRESS, "Full Press", "full-press"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraShutter", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_FOCUS (gst_omx_camera_focus_get_type ()) +static GType +gst_omx_camera_focus_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {OMX_IMAGE_FocusControlOff, "off", "off"}, + {OMX_IMAGE_FocusControlOn, "on", "on"}, + {OMX_IMAGE_FocusControlAuto, "auto", "auto"}, + {OMX_IMAGE_FocusControlAutoLock, "autolock", "autolock"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraFocus", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_AWB (gst_omx_camera_awb_get_type ()) +static GType +gst_omx_camera_awb_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_WhiteBalControlOff, "Balance off", "off"}, + {OMX_WhiteBalControlAuto, "Auto balance", "auto"}, + {OMX_WhiteBalControlSunLight, "Sun light", "sunlight"}, + {OMX_WhiteBalControlCloudy, "Cloudy", "cloudy"}, + {OMX_WhiteBalControlShade, "Shade", "shade"}, + {OMX_WhiteBalControlTungsten, "Tungsten", "tungsten"}, + {OMX_WhiteBalControlFluorescent, "Fluorescent", "fluorescent"}, + {OMX_WhiteBalControlIncandescent, "Incandescent", "incandescent"}, + {OMX_WhiteBalControlFlash, "Flash", "flash" }, + {OMX_WhiteBalControlHorizon, "Horizon", "horizon" }, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxCameraWhiteBalance",vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_EXPOSURE (gst_omx_camera_exposure_get_type ()) +static GType +gst_omx_camera_exposure_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_ExposureControlOff, "Exposure control off", "off"}, + {OMX_ExposureControlAuto, "Auto exposure", "auto"}, + {OMX_ExposureControlNight, "Night exposure", "night"}, + {OMX_ExposureControlBackLight, "Backlight exposure", "backlight"}, + {OMX_ExposureControlSpotLight, "SportLight exposure", "sportlight"}, + {OMX_ExposureControlSports, "Sports exposure", "sports"}, + {OMX_ExposureControlSnow, "Snow exposure", "snow"}, + {OMX_ExposureControlBeach, "Beach exposure", "beach"}, + {OMX_ExposureControlLargeAperture, "Large aperture exposure", "large-aperture"}, + {OMX_ExposureControlSmallApperture, "Small aperture exposure", "small-aperture"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxCameraExposureControl", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_MIRROR (gst_omx_camera_mirror_get_type ()) +static GType +gst_omx_camera_mirror_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {OMX_MirrorNone, "Off", "off"}, + {OMX_MirrorVertical, "Vertical", "vertical"}, + {OMX_MirrorHorizontal, "Horizontal", "horizontal"}, + {OMX_MirrorBoth, "Both", "both"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraMirror", vals); + } + + return type; +} + +#ifdef USE_OMXTICORE +#define GST_TYPE_OMX_CAMERA_FLICKER (gst_omx_camera_flicker_get_type ()) +static GType +gst_omx_camera_flicker_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_FlickerCancelOff, "Flicker control off", "off"}, + {OMX_FlickerCancelAuto, "Auto flicker control", "auto"}, + {OMX_FlickerCancel50, "Flicker control for 50Hz", "flick-50hz"}, + {OMX_FlickerCancel60, "Flicker control for 60Hz", "flick-60hz"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxCameraFlickerCancel", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_SCENE (gst_omx_camera_scene_get_type ()) +static GType +gst_omx_camera_scene_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_Manual, "Manual settings", "manual"}, + {OMX_Closeup, "Closeup settings", "closeup"}, + {OMX_Portrait, "Portrait settings", "portrait"}, + {OMX_Landscape, "Landscape settings", "landscape"}, + {OMX_Underwater, "Underwater settings", "underwater"}, + {OMX_Sport, "Sport settings", "sport"}, + {OMX_SnowBeach, "SnowBeach settings", "snowbeach"}, + {OMX_Mood, "Mood settings", "mood"}, +#if 0 /* The following options are not yet enabled at OMX level */ + {OMX_NightPortrait, "NightPortrait settings", "night-portrait"}, + {OMX_NightIndoor, "NightIndoor settings", "night-indoor"}, + {OMX_Fireworks, "Fireworks settings", "fireworks"}, + /* for still image: */ + {OMX_Document, "Document settings", "document"}, + {OMX_Barcode, "Barcode settings", "barcode"}, + /* for video: */ + {OMX_SuperNight, "SuperNight settings", "supernight"}, + {OMX_Cine, "Cine settings", "cine"}, + {OMX_OldFilm, "OldFilm settings", "oldfilm"}, +#endif + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraScene", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_VNF (gst_omx_camera_vnf_get_type ()) +static GType +gst_omx_camera_vnf_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {OMX_VideoNoiseFilterModeOff, "off", "off"}, + {OMX_VideoNoiseFilterModeOn, "on", "on"}, + {OMX_VideoNoiseFilterModeAuto, "auto", "auto"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraVnf", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_YUV_RANGE (gst_omx_camera_yuv_range_get_type ()) +static GType +gst_omx_camera_yuv_range_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {OMX_ITURBT601, "OMX_ITURBT601", "OMX_ITURBT601"}, + {OMX_Full8Bit, "OMX_Full8Bit", "OMX_Full8Bit"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraYuvRange", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_DEVICE (gst_omx_camera_device_get_type ()) +static GType +gst_omx_camera_device_get_type (void) +{ + static GType type = 0; + + if (!type) + { + static GEnumValue vals[] = + { + {OMX_PrimarySensor, "Primary", "primary"}, + {OMX_SecondarySensor, "Secondary", "secondary"}, + {OMX_TI_StereoSensor, "Stereo", "stereo"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxCameraDevice", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_NSF (gst_omx_camera_nsf_get_type ()) +static GType +gst_omx_camera_nsf_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_ISONoiseFilterModeOff, "nsf control off", "off"}, + {OMX_ISONoiseFilterModeOn, "nsf control on", "on"}, + {OMX_ISONoiseFilterModeAuto, "nsf control auto", "auto"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxCameraISONoiseFilter", vals); + } + + return type; +} + +#define GST_TYPE_OMX_CAMERA_FOCUSSPOT_WEIGHT (gst_omx_camera_focusspot_weight_get_type ()) +static GType +gst_omx_camera_focusspot_weight_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_FocusSpotDefault, "Common focus region", "default"}, + {OMX_FocusSpotSinglecenter, "Single center", "center"}, + {OMX_FocusSpotMultiNormal, "Multi normal", "multinormal"}, + {OMX_FocusSpotMultiAverage, "Multi average", "multiaverage"}, + {OMX_FocusSpotMultiCenter, "Multi center", "multicenter"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxCameraFocusSpotWeight", vals); + } + + return type; +} +#endif + +/* + * Caps: + */ + + +static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED (GSTOMX_ALL_FORMATS, "[ 0, max ]")) + ); + +static GstStaticPadTemplate imgsrc_template = GST_STATIC_PAD_TEMPLATE ("imgsrc", + GST_PAD_SRC, + GST_PAD_SOMETIMES, + /* Note: imgsrc pad supports JPEG format, Bayer, as well as + non-strided YUV. */ + GST_STATIC_CAPS ( + "image/jpeg, width=(int)[1,max], height=(int)[1,max]; " + "video/x-raw-bayer, width=(int)[1,max], height=(int)[1,max]; " + GST_VIDEO_CAPS_YUV (GSTOMX_ALL_FORMATS)) + ); + +static GstStaticPadTemplate vidsrc_template = GST_STATIC_PAD_TEMPLATE ("vidsrc", + GST_PAD_SRC, + GST_PAD_SOMETIMES, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED (GSTOMX_ALL_FORMATS, "[ 0, max ]")) + ); + +static GstStaticPadTemplate thumbsrc_template = GST_STATIC_PAD_TEMPLATE ("thumbsrc", + GST_PAD_SRC, + GST_PAD_REQUEST, + GST_STATIC_CAPS ( + "video/x-raw-bayer, width=(int)[1,max], height=(int)[1,max]; " + GST_VIDEO_CAPS_RGB "; " + GST_VIDEO_CAPS_RGB_16 "; " + GST_VIDEO_CAPS_YUV (GSTOMX_ALL_FORMATS)) + ); + +#ifdef USE_GSTOMXCAM_IN_PORT +static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("???") + ); +#endif + +static gboolean +src_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxCamera *self = GST_OMX_CAMERA (GST_PAD_PARENT (pad)); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + GstVideoFormat format; + gint width, height, rowstride; + gint framerate_num, framerate_denom; + const GValue *framerate = NULL; + OMX_ERRORTYPE err; + + if (!self) + { + GST_DEBUG_OBJECT (pad, "pad has no parent (yet?)"); + return TRUE; // ??? + } + + GST_INFO_OBJECT (omx_base, "setcaps (src/vidsrc): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (gst_video_format_parse_caps_strided (caps, + &format, &width, &height, &rowstride)) + { + /* Output port configuration: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + gboolean configure_port = FALSE; + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + if ((param.format.video.nFrameWidth != width) || + (param.format.video.nFrameHeight != height) || + (param.format.video.nStride != rowstride)) + { + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + param.format.video.nStride = self->rowstride = rowstride; + configure_port = TRUE; + } + + param.nBufferSize = gst_video_format_get_size_strided (format, width, height, rowstride); + + /* special hack to work around OMX camera bug: + */ + if (param.format.video.eColorFormat != g_omx_gstvformat_to_colorformat (format)) + { + if (g_omx_gstvformat_to_colorformat (format) == OMX_COLOR_FormatYUV420PackedSemiPlanar) + { + if (param.format.video.eColorFormat != OMX_COLOR_FormatYUV420SemiPlanar) + { + param.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + configure_port = TRUE; + } + } + else + { + param.format.video.eColorFormat = g_omx_gstvformat_to_colorformat (format); + configure_port = TRUE; + } + } + + framerate = gst_structure_get_value ( + gst_caps_get_structure (caps, 0), "framerate"); + + if (framerate) + { + guint32 xFramerate; + framerate_num = gst_value_get_fraction_numerator (framerate); + framerate_denom = gst_value_get_fraction_denominator (framerate); + + xFramerate = (framerate_num << 16) / framerate_denom; + + if (param.format.video.xFramerate != xFramerate) + { + param.format.video.xFramerate = xFramerate; + configure_port = TRUE; + } + } + + /* At the moment we are only using preview port and not vid_port + * From omx camera desing document we are missing + * SetParam CommonSensormode -> bOneShot = FALSE ? + */ + + if (configure_port) + { + gboolean port_enabled = FALSE; + + if (omx_base->out_port->enabled && (omx_base->gomx->omx_state != OMX_StateLoaded)) + { + g_omx_port_disable (omx_base->out_port); + port_enabled = TRUE; + } + + err = G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + if (err != OMX_ErrorNone) + return FALSE; + + if (port_enabled) + g_omx_port_enable (omx_base->out_port); + } + + GST_INFO_OBJECT (omx_base, " Rowstride=%d, Width=%d, Height=%d, Color=%d, Buffersize=%d, framerate=%d", + param.format.video.nStride, param.format.video.nFrameWidth, param.format.video.nFrameHeight, param.format.video.eColorFormat, param.nBufferSize,param.format.video.xFramerate ); + +#ifdef USE_OMXTICORE + self->img_regioncenter_x = (param.format.video.nFrameWidth / 2); + self->img_regioncenter_y = (param.format.video.nFrameHeight / 2); +#endif + + if (!gst_pad_set_caps (GST_BASE_SRC (self)->srcpad, caps)) + return FALSE; + +#if 0 + /* force the src pad and vidsrc pad to use the same caps: */ + if (pad == self->vidsrcpad) + { + gst_pad_set_caps (GST_BASE_SRC (self)->srcpad, caps); + } + else + { + gst_pad_set_caps (self->vidsrcpad, caps); + } + + GST_INFO_OBJECT (omx_base, " exit setcaps src: %"); +#endif + } + + return TRUE; +} + +static gboolean +imgsrc_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxCamera *self = GST_OMX_CAMERA (GST_PAD_PARENT (pad)); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + GstVideoFormat format; + gint width, height, rowstride; + GstStructure *s; + + GST_INFO_OBJECT (omx_base, "setcaps (imgsrc): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (gst_video_format_parse_caps_strided (caps, + &format, &width, &height, &rowstride)) + { + /* Output port configuration for YUV: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + GST_DEBUG_OBJECT (self, "set raw format"); + + G_OMX_PORT_GET_DEFINITION (self->img_port, ¶m); + + param.format.image.eCompressionFormat = OMX_IMAGE_CodingUnused; + param.format.image.eColorFormat = g_omx_gstvformat_to_colorformat (format); + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.nStride = rowstride; + + /* special hack to work around OMX camera bug: + */ + if (param.format.video.eColorFormat == OMX_COLOR_FormatYUV420PackedSemiPlanar) + param.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + + G_OMX_PORT_SET_DEFINITION (self->img_port, ¶m); + } + else if (gst_structure_has_name (s=gst_caps_get_structure (caps, 0), "image/jpeg")) + { + /* Output port configuration for JPEG: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + GST_DEBUG_OBJECT (self, "set JPEG format"); + + G_OMX_PORT_GET_DEFINITION (self->img_port, ¶m); + + gst_structure_get_int (s, "width", &width); + gst_structure_get_int (s, "height", &height); + + param.format.image.eColorFormat = OMX_COLOR_FormatCbYCrY; + param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG; + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.nStride = 0; + + GST_INFO_OBJECT (self, "Rowstride=%d, Width=%d, Height=%d, Buffersize=%d, num-buffer=%d", + param.format.image.nStride, param.format.image.nFrameWidth, param.format.image.nFrameHeight, param.nBufferSize, param.nBufferCountActual); + + G_OMX_PORT_SET_DEFINITION (self->img_port, ¶m); + } + else if (gst_structure_has_name (s=gst_caps_get_structure (caps, 0), + "video/x-raw-bayer")) + { + /* Output port configuration for Bayer: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + GST_DEBUG_OBJECT (self, "set Raw-Bayer format"); + + G_OMX_PORT_GET_DEFINITION (self->img_port, ¶m); + + gst_structure_get_int (s, "width", &width); + gst_structure_get_int (s, "height", &height); + + param.format.image.eColorFormat = OMX_COLOR_FormatRawBayer10bit; + param.format.image.eCompressionFormat = OMX_IMAGE_CodingUnused; + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.nStride = width * 2; + + GST_INFO_OBJECT (self, "Rowstride=%d, Width=%d, Height=%d, " + "Buffersize=%d, num-buffer=%d", param.format.image.nStride, + param.format.image.nFrameWidth, param.format.image.nFrameHeight, + param.nBufferSize, param.nBufferCountActual); + + G_OMX_PORT_SET_DEFINITION (self->img_port, ¶m); + } + + return TRUE; +} + +static gboolean +thumbsrc_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxCamera *self = GST_OMX_CAMERA (GST_PAD_PARENT (pad)); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + GstVideoFormat format; + gint width, height; + GstStructure *s; + + GST_INFO_OBJECT (omx_base, "setcaps (thumbsrc): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (gst_video_format_parse_caps (caps, &format, &width, &height)) + { + /* Output port configuration for RAW: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + GST_DEBUG_OBJECT (self, "set YUV/RGB raw format"); + + G_OMX_PORT_GET_DEFINITION (self->vid_port, ¶m); + + param.format.image.eCompressionFormat = OMX_VIDEO_CodingUnused; + param.format.image.eColorFormat = g_omx_gstvformat_to_colorformat (format); + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + + /* special hack to work around OMX camera bug: + */ + if (param.format.video.eColorFormat == OMX_COLOR_FormatYUV420PackedSemiPlanar) + param.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + + G_OMX_PORT_SET_DEFINITION (self->vid_port, ¶m); + } + else if (gst_structure_has_name (s=gst_caps_get_structure (caps, 0), + "video/x-raw-bayer")) + { + /* Output port configuration for Bayer: */ + OMX_PARAM_PORTDEFINITIONTYPE param; + + GST_DEBUG_OBJECT (self, "set Raw-Bayer format"); + + G_OMX_PORT_GET_DEFINITION (self->vid_port, ¶m); + + gst_structure_get_int (s, "width", &width); + gst_structure_get_int (s, "height", &height); + + param.format.image.eColorFormat = OMX_COLOR_FormatRawBayer10bit; + param.format.image.eCompressionFormat = OMX_VIDEO_CodingUnused; + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + + GST_INFO_OBJECT (self, "Width=%d, Height=%d, Buffersize=%d, num-buffer=%d", + param.format.image.nFrameWidth, param.format.image.nFrameHeight, + param.nBufferSize, param.nBufferCountActual); + + G_OMX_PORT_SET_DEFINITION (self->vid_port, ¶m); + } + + return TRUE; +} + +static gboolean +src_query (GstPad *pad, GstQuery *query) +{ + GstOmxCamera *self = GST_OMX_CAMERA (GST_PAD_PARENT (pad)); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + gboolean ret = FALSE; + + GST_DEBUG_OBJECT (self, "Begin"); + + if (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERS) + { + const GstCaps *caps; + OMX_ERRORTYPE err; + OMX_PARAM_PORTDEFINITIONTYPE param; + + _G_OMX_INIT_PARAM (¶m); + + gst_query_parse_buffers_caps (query, &caps); + + /* ensure the caps we are querying are the current ones, otherwise + * results are meaningless.. + * + * @todo should we save and restore current caps?? + */ + src_setcaps (pad, (GstCaps *)caps); + + param.nPortIndex = omx_base->out_port->port_index; + err = OMX_GetParameter (omx_base->gomx->omx_handle, + OMX_IndexParamPortDefinition, ¶m); + g_assert (err == OMX_ErrorNone); + + GST_DEBUG_OBJECT (self, "Actual buffers: %d", param.nBufferCountActual); + + gst_query_set_buffers_count (query, param.nBufferCountActual); + +#ifdef USE_OMXTICORE + { + OMX_CONFIG_RECTTYPE rect; + _G_OMX_INIT_PARAM (&rect); + + rect.nPortIndex = omx_base->out_port->port_index; + err = OMX_GetParameter (omx_base->gomx->omx_handle, + OMX_TI_IndexParam2DBufferAllocDimension, &rect); + if (err == OMX_ErrorNone) + { + GST_DEBUG_OBJECT (self, "Min dimensions: %dx%d", + rect.nWidth, rect.nHeight); + + gst_query_set_buffers_dimensions (query, + rect.nWidth, rect.nHeight); + } + } +#endif + + ret = TRUE; + } + + GST_DEBUG_OBJECT (self, "End -> %d", ret); + + return ret; +} + +/* note.. maybe this should be moved somewhere common... GstOmxBaseVideoDec has + * almost same logic.. + */ +static void +settings_changed (GstElement *self, GstPad *pad) +{ + GstCaps *new_caps; + + if (!gst_pad_is_linked (pad)) + { + GST_DEBUG_OBJECT (self, "%"GST_PTR_FORMAT": pad is not linked", pad); + return; + } + + new_caps = gst_caps_intersect (gst_pad_get_caps (pad), + gst_pad_peer_get_caps (pad)); + + if (!gst_caps_is_fixed (new_caps)) + { + gst_caps_do_simplify (new_caps); + + if (gst_caps_is_subset (GST_PAD_CAPS(pad), new_caps)) + { + gst_caps_replace (&new_caps, GST_PAD_CAPS(pad)); + } + + GST_INFO_OBJECT (self, "%"GST_PTR_FORMAT": pre-fixated caps: %" GST_PTR_FORMAT, pad, new_caps); + gst_pad_fixate_caps (pad, new_caps); + } + + GST_INFO_OBJECT (self, "%"GST_PTR_FORMAT": caps are: %" GST_PTR_FORMAT, pad, new_caps); + GST_INFO_OBJECT (self, "%"GST_PTR_FORMAT": old caps are: %" GST_PTR_FORMAT, pad, GST_PAD_CAPS (pad)); + + gst_pad_set_caps (pad, new_caps); + gst_caps_unref (new_caps); +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxCamera *self = core->object; + + GST_DEBUG_OBJECT (self, "settings changed"); + + settings_changed (GST_ELEMENT (self), GST_BASE_SRC (self)->srcpad); + +#ifdef USE_GSTOMXCAM_VIDSRCPAD + settings_changed (GST_ELEMENT (self), self->vidsrcpad); +#endif +#ifdef USE_GSTOMXCAM_IMGSRCPAD + settings_changed (GST_ELEMENT (self), self->imgsrcpad); +#endif +#ifdef USE_GSTOMXCAM_THUMBSRCPAD + settings_changed (GST_ELEMENT (self), self->thumbsrcpad); +#endif +} + +static void +autofocus_cb (GstOmxCamera *self) +{ + guint32 autofocus_cb_time; + + GstStructure *structure = gst_structure_new ("omx_camera", + "auto-focus", G_TYPE_BOOLEAN, TRUE, NULL); + + GstMessage *message = gst_message_new_element (GST_OBJECT (self), + structure); + + gst_element_post_message (GST_ELEMENT (self), message); + + autofocus_cb_time = omap_32k_readraw (); + GST_CAT_INFO_OBJECT (gstomx_ppm, GST_OBJECT (self), "%d Autofocus locked", + autofocus_cb_time); +} + +static void +index_settings_changed_cb (GOmxCore *core, gint data1, gint data2) +{ + GstOmxCamera *self = core->object; + + if (data2 == OMX_IndexConfigCommonFocusStatus) + autofocus_cb (self); +} + +static void +setup_ports (GstOmxBaseSrc *base_src) +{ + GstOmxCamera *self = GST_OMX_CAMERA (base_src); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + OMX_PARAM_PORTDEFINITIONTYPE param; + +#ifdef USE_GSTOMXCAM_THUMBSRCPAD + G_OMX_PORT_GET_DEFINITION (self->vid_port, ¶m); + g_omx_port_setup (self->vid_port, ¶m); +#endif + +#ifdef USE_GSTOMXCAM_IMGSRCPAD + G_OMX_PORT_GET_DEFINITION (self->img_port, ¶m); + g_omx_port_setup (self->img_port, ¶m); +#endif + +#ifdef USE_GSTOMXCAM_IN_PORT + G_OMX_PORT_GET_DEFINITION (self->in_port, ¶m); + g_omx_port_setup (self->in_port, ¶m); +#endif + +/* Not supported yet + self->vid_port->share_buffer = TRUE; + self->img_port->share_buffer = TRUE; +*/ + omx_base->out_port->omx_allocate = FALSE; + omx_base->out_port->share_buffer = TRUE; + +#ifdef USE_GSTOMXCAM_IMGSRCPAD + self->img_port->omx_allocate = TRUE; + self->img_port->share_buffer = FALSE; +#endif + +#ifdef USE_GSTOMXCAM_THUMBSRCPAD + self->vid_port->omx_allocate = TRUE; + self->vid_port->share_buffer = FALSE; +#endif +} + + +static GstClockTime +get_timestamp (GstOmxCamera *self) +{ + GstClock *clock; + GstClockTime timestamp; + + /* timestamps, LOCK to get clock and base time. */ + GST_OBJECT_LOCK (self); + if ((clock = GST_ELEMENT_CLOCK (self))) { + /* we have a clock, get base time and ref clock */ + timestamp = GST_ELEMENT (self)->base_time; + gst_object_ref (clock); + } else { + /* no clock, can't set timestamps */ + timestamp = GST_CLOCK_TIME_NONE; + } + GST_OBJECT_UNLOCK (self); + + if (clock) { + /* the time now is the time of the clock minus the base time */ + /* Hack: Need to subtract the extra lag that is causing problems to AV sync */ + timestamp = gst_clock_get_time (clock) - timestamp - (140 * GST_MSECOND); + gst_object_unref (clock); + + /* if we have a framerate adjust timestamp for frame latency */ +#if 0 + if (self->fps_n > 0 && self->fps_d > 0) + { + GstClockTime latency; + + latency = gst_util_uint64_scale_int (GST_SECOND, self->fps_d, self->fps_n); + + if (timestamp > latency) + timestamp -= latency; + else + timestamp = 0; + } +#endif + } + + return timestamp; +} + +#ifdef USE_GSTOMXCAM_IMGSRCPAD +/** This function configure the camera component on capturing/no capturing mode **/ +static void +set_capture (GstOmxCamera *self, gboolean capture_mode) +{ + OMX_CONFIG_BOOLEANTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE err; + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (¶m); + + param.bEnabled = (capture_mode == TRUE) ? OMX_TRUE : OMX_FALSE; + + err = G_OMX_CORE_SET_CONFIG (gomx, OMX_IndexConfigCapturing, ¶m); + g_warn_if_fail (err == OMX_ErrorNone); + + GST_DEBUG_OBJECT (self, "Capture = %d", param.bEnabled); +} +#endif + +static void +set_camera_operating_mode (GstOmxCamera *self) +{ + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + OMX_CONFIG_CAMOPERATINGMODETYPE mode; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&mode); + + switch (self->next_mode) + { + case MODE_VIDEO: + mode.eCamOperatingMode = OMX_CaptureVideo; + break; + case MODE_PREVIEW: + case MODE_IMAGE: + mode.eCamOperatingMode = OMX_CaptureImageProfileBase; + break; + case MODE_VIDEO_IMAGE: /* @todo check this */ + case MODE_IMAGE_HS: + mode.eCamOperatingMode = + OMX_CaptureImageHighSpeedTemporalBracketing; + break; + default: + g_assert_not_reached (); + } + GST_DEBUG_OBJECT (self, "OMX_CaptureImageMode: set = %d", + mode.eCamOperatingMode); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexCameraOperatingMode, &mode); + g_assert (error_val == OMX_ErrorNone); +} + +static void +start_ports (GstOmxCamera *self) +{ + +#if 0 + /* Not utilized because we are setting the preview port enable since the beginning*/ + + if (config[self->mode] & PORT_PREVIEW) + { + GST_DEBUG_OBJECT (self, "enable preview port"); + g_omx_port_enable (omx_base->out_port); + } +#endif + +#ifdef USE_GSTOMXCAM_THUMBSRCPAD + if (config[self->mode] & PORT_VIDEO) + { + GST_DEBUG_OBJECT (self, "enable video port"); + gst_pad_set_active (self->thumbsrcpad, TRUE); + gst_element_add_pad (GST_ELEMENT_CAST (self), self->thumbsrcpad); + g_omx_port_enable (self->vid_port); + } +#endif + +#ifdef USE_GSTOMXCAM_VIDSRCPAD + if (self->mode == MODE_VIDEO) + { + GST_DEBUG_OBJECT (self, "enable video srcpad"); + gst_pad_set_active (self->vidsrcpad, TRUE); + gst_element_add_pad (GST_ELEMENT_CAST (self), self->vidsrcpad); + } +#endif + +#ifdef USE_GSTOMXCAM_IMGSRCPAD + if (config[self->mode] & PORT_IMAGE) + { + guint32 capture_start_time; + + GST_DEBUG_OBJECT (self, "enable image port"); + gst_pad_set_active (self->imgsrcpad, TRUE); + gst_element_add_pad (GST_ELEMENT_CAST (self), self->imgsrcpad); + + /* WORKAROUND: Image capture set only in LOADED state */ + /* set_camera_operating_mode (self); */ + g_omx_port_enable (self->img_port); + + GST_DEBUG_OBJECT (self, "image port set_capture set to %d", TRUE); + + capture_start_time = omap_32k_readraw(); + GST_CAT_INFO_OBJECT (gstomx_ppm, self, "%d Start Image Capture", + capture_start_time); + + set_capture (self, TRUE); + } +#endif +} + + +static void +stop_ports (GstOmxCamera *self) +{ + +#if 0 + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + if (config[self->mode] & PORT_PREVIEW) + { + GST_DEBUG_OBJECT (self, "disable preview port"); + g_omx_port_disable (omx_base->out_port); + } +#endif + +#ifdef USE_GSTOMXCAM_THUMBSRCPAD + if (config[self->mode] & PORT_VIDEO) + { + GST_DEBUG_OBJECT (self, "disable video port"); + gst_pad_set_active (self->thumbsrcpad, FALSE); + //gst_element_remove_pad (GST_ELEMENT_CAST (self), self->thumbsrcpad); + g_omx_port_disable (self->vid_port); + } +#endif + +#ifdef USE_GSTOMXCAM_VIDSRCPAD + if (self->mode == MODE_VIDEO) + { + GST_DEBUG_OBJECT (self, "disable video src pad"); + gst_pad_set_active (self->vidsrcpad, FALSE); + } +#endif + +#ifdef USE_GSTOMXCAM_IMGSRCPAD + if (config[self->mode] & PORT_IMAGE) + { + GST_DEBUG_OBJECT (self, "disable image port"); + gst_pad_set_active (self->imgsrcpad, FALSE); + //gst_element_remove_pad (GST_ELEMENT_CAST (self), self->imgsrcpad); + g_omx_port_disable (self->img_port); + } +#endif +} + +#define CALC_RELATIVE(mult, image_size, chunk_size) ((mult * chunk_size) / image_size) + +#ifdef USE_OMXTICORE +static gboolean +gst_camera_handle_src_event (GstPad * pad, GstEvent * event) +{ + GstOmxCamera *self; + GstOmxBaseSrc *omx_base; + const gchar *type; + gboolean new_focus_setting; + gint temp_width, temp_height; + + self = GST_OMX_CAMERA (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_SRC (self); + new_focus_setting = 0; + + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_NAVIGATION: + { + const GstStructure *s = gst_event_get_structure (event); + gdouble x, y, x_mid_point, y_mid_point; + + type = gst_structure_get_string (s, "event"); + + if (g_str_equal (type, "mouse-button-press")) + { + gst_structure_get_double (s, "pointer_x", &x); + gst_structure_get_double (s, "pointer_y", &y); + + self->click_x = x; + self->click_y = y; + + GST_DEBUG_OBJECT (self, "Mouse click x:%d y:%d", + (gint)self->click_x, (gint)self->click_y); + + } + else if (g_str_equal (type, "mouse-button-release")) + { + gst_structure_get_double (s, "pointer_x", &x); + gst_structure_get_double (s, "pointer_y", &y); + + temp_width = ABS (self->click_x - x); + if (temp_width < self->img_focusregion_width) + temp_width = self->img_focusregion_width; + + temp_height = ABS (self->click_y - y); + if (temp_height < self->img_focusregion_height) + temp_height = self->img_focusregion_height; + + x_mid_point = (x - ((x - self->click_x) / 2)); + if (x_mid_point > (temp_width / 2)) + self->img_regioncenter_x = (gint) x_mid_point; + else + self->img_regioncenter_x = (gint) (temp_width / 2); + + y_mid_point = (y - ((y - self->click_y) / 2)); + if (y_mid_point > (temp_height / 2)) + self->img_regioncenter_y = (gint) y_mid_point; + else + self->img_regioncenter_y = (gint) (temp_height / 2); + + new_focus_setting = 1; + } + break; + } + default: + break; + } + + if (new_focus_setting) + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + OMX_CONFIG_EXTFOCUSREGIONTYPE ext_config; + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxCore *gomx; + gint prv_width, prv_height; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + new_focus_setting = 0; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + _G_OMX_INIT_PARAM (&ext_config); + _G_OMX_INIT_PARAM (¶m); + + param.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (omx_base->gomx->omx_handle, + OMX_IndexParamPortDefinition, ¶m); + g_assert (error_val == OMX_ErrorNone); + + prv_width = param.format.video.nFrameWidth; + prv_height = param.format.video.nFrameHeight; + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + ext_config.nPortIndex = omx_base->out_port->port_index; + ext_config.nWidth = temp_width; + ext_config.nHeight = temp_height; + if ((ext_config.nWidth / 2) > self->img_regioncenter_x) + ext_config.nLeft = 0; + else + ext_config.nLeft = self->img_regioncenter_x - + (ext_config.nWidth / 2); + + if ((ext_config.nHeight / 2) > self->img_regioncenter_y) + ext_config.nTop = 0; + else + ext_config.nTop = self->img_regioncenter_y - + (ext_config.nHeight / 2); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eFocusControl = OMX_IMAGE_FocusRegionPriorityMode; + + GST_DEBUG_OBJECT (self, "FocusRegion: Mode=%d Left=%d Top=%d " + "Width=%d Height=%d", config.eFocusControl, + ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + + /* Calculate the coordinates relative with a base of 255 */ + ext_config.nTop = CALC_RELATIVE(255, prv_height, ext_config.nTop); + ext_config.nLeft = CALC_RELATIVE(255, prv_width, ext_config.nLeft); + ext_config.nWidth = CALC_RELATIVE(255, prv_width, ext_config.nWidth); + ext_config.nHeight = CALC_RELATIVE(255, prv_height, ext_config.nHeight); + + GST_DEBUG_OBJECT (self, "After conv FocusRegion: Mode=%d Left=%d Top=%d " + "Width=%d Height=%d", config.eFocusControl, + ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + } + + return gst_pad_event_default (pad, event); +} +#endif + +/* + * GstBaseSrc Methods: + */ + +static GstFlowReturn +create (GstBaseSrc *gst_base, + guint64 offset, + guint length, + GstBuffer **ret_buf) +{ + GstOmxCamera *self = GST_OMX_CAMERA (gst_base); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + GstBuffer *preview_buf = NULL; + GstBuffer *vid_buf = NULL; + GstBuffer *img_buf = NULL; + GstBuffer *thumb_buf = NULL; + GstFlowReturn ret = GST_FLOW_NOT_NEGOTIATED; + GstClockTime timestamp; + GstEvent *vstab_evt = NULL; + gboolean pending_eos; + guint n_offset = 0; + static guint cont; + + pending_eos = g_atomic_int_compare_and_exchange (&self->pending_eos, TRUE, FALSE); + + GST_DEBUG_OBJECT (self, "begin, mode=%d, pending_eos=%d", self->mode, pending_eos); + + GST_LOG_OBJECT (self, "state: %d", omx_base->gomx->omx_state); + + if (omx_base->gomx->omx_state == OMX_StateLoaded) + { + GST_INFO_OBJECT (self, "omx: prepare"); + gst_omx_base_src_setup_ports (omx_base); + g_omx_core_prepare (omx_base->gomx); + } + + if (self->mode != self->next_mode) + { + if (self->mode != -1) + stop_ports (self); + self->mode = self->next_mode; + start_ports (self); + + /* @todo for now just capture one image... later let the user config + * this to the number of desired burst mode images + */ + if (self->mode == MODE_IMAGE) + self->img_count = 1; + if (self->mode == MODE_IMAGE_HS) + self->img_count = self->img_port->num_buffers; + } + + if (config[self->mode] & PORT_PREVIEW) + { + ret = gst_omx_base_src_create_from_port (omx_base, + omx_base->out_port, &preview_buf); + n_offset = omx_base->out_port->n_offset; + if (ret != GST_FLOW_OK) + goto fail; + if (self->mode == MODE_VIDEO) + { + vid_buf = gst_buffer_ref (preview_buf); + } + } + + if (config[self->mode] & PORT_VIDEO) + { + ret = gst_omx_base_src_create_from_port (omx_base, + self->vid_port, &thumb_buf); + n_offset = self->vid_port->n_offset; + if (ret != GST_FLOW_OK) + goto fail; + } + + if (config[self->mode] & PORT_IMAGE) + { + ret = gst_omx_base_src_create_from_port (omx_base, + self->img_port, &img_buf); + if (ret != GST_FLOW_OK) + goto fail; + + if (--self->img_count == 0) + { + self->next_mode = MODE_PREVIEW; + GST_DEBUG_OBJECT (self, "image port set_capture set to %d", FALSE); + set_capture (self, FALSE); + } + GST_DEBUG_OBJECT (self, "### img_count = %d ###", self->img_count); + } + + timestamp = get_timestamp (self); + cont ++; + GST_DEBUG_OBJECT (self, "******** preview buffers cont = %d", cont); + GST_BUFFER_TIMESTAMP (preview_buf) = timestamp; + + *ret_buf = preview_buf; + + if (n_offset) + { + vstab_evt = gst_event_new_crop (n_offset / self->rowstride, /* top */ + n_offset % self->rowstride, /* left */ + -1, -1); /* width/height: we can just give invalid for now */ + gst_pad_push_event (GST_BASE_SRC (self)->srcpad, + gst_event_ref (vstab_evt)); + } + + if (vid_buf) + { + GST_DEBUG_OBJECT (self, "pushing vid_buf"); + GST_BUFFER_TIMESTAMP (vid_buf) = timestamp; + if (vstab_evt) + gst_pad_push_event (self->vidsrcpad, gst_event_ref (vstab_evt)); + gst_pad_push (self->vidsrcpad, vid_buf); + if (G_UNLIKELY (pending_eos)) + gst_pad_push_event (self->vidsrcpad, gst_event_new_eos ()); + } + + if (img_buf) + { + GST_DEBUG_OBJECT (self, "pushing img_buf"); + GST_BUFFER_TIMESTAMP (img_buf) = timestamp; + gst_pad_push (self->imgsrcpad, img_buf); + if (G_UNLIKELY (pending_eos)) + gst_pad_push_event (self->imgsrcpad, gst_event_new_eos ()); + } + + if (thumb_buf) + { + GST_DEBUG_OBJECT (self, "pushing thumb_buf"); + GST_BUFFER_TIMESTAMP (thumb_buf) = timestamp; + gst_pad_push (self->thumbsrcpad, thumb_buf); + if (G_UNLIKELY (pending_eos)) + gst_pad_push_event (self->thumbsrcpad, gst_event_new_eos ()); + } + + if (vstab_evt) + { + gst_event_unref (vstab_evt); + } + + if (G_UNLIKELY (pending_eos)) + { + /* now send eos event, which was previously deferred, to parent + * class this will trigger basesrc's eos logic. Unfortunately we + * can't call parent->send_event() directly from here to pass along + * the eos, which would be a more obvious approach, because that + * would deadlock when it tries to acquire live-lock.. but live- + * lock is already held when calling create(). + */ + return GST_FLOW_UNEXPECTED; + } + + GST_DEBUG_OBJECT (self, "end, ret=%d", ret); + + return GST_FLOW_OK; + +fail: + if (preview_buf) gst_buffer_unref (preview_buf); + if (vid_buf) gst_buffer_unref (vid_buf); + if (img_buf) gst_buffer_unref (img_buf); + if (thumb_buf) gst_buffer_unref (thumb_buf); + + return ret; +} + +static gboolean +send_event (GstElement * element, GstEvent * event) +{ + GstOmxCamera *self = GST_OMX_CAMERA (element); + + GST_DEBUG_OBJECT (self, "received %s event", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_EOS: + /* note: we don't pass the eos event on to basesrc until + * we have a chance to handle it ourselves.. + */ + g_atomic_int_set (&self->pending_eos, TRUE); + gst_event_unref (event); + return TRUE; + default: + return GST_ELEMENT_CLASS (parent_class)->send_event (element, event); + } +} + +/* + * GObject Methods: + */ + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxCamera *self = GST_OMX_CAMERA (obj); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + switch (prop_id) + { + case ARG_NUM_IMAGE_OUTPUT_BUFFERS: + case ARG_NUM_VIDEO_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + OMX_U32 nBufferCountActual = g_value_get_uint (value); + GOmxPort *port = (prop_id == ARG_NUM_IMAGE_OUTPUT_BUFFERS) ? + self->img_port : self->vid_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_return_if_fail (nBufferCountActual >= param.nBufferCountMin); + param.nBufferCountActual = nBufferCountActual; + + G_OMX_PORT_SET_DEFINITION (port, ¶m); + + break; + } + case ARG_MODE: + { + /* WORKAROUND: Image capture set only once (in LOADED state) */ + static gboolean first_time = TRUE; + self->next_mode = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "mode: %d", self->next_mode); + /* WORKAROUND : Image capture set only once (in LOADED state) */ + if (first_time) + set_camera_operating_mode (self); + first_time = FALSE; + break; + } + case ARG_SHUTTER: + { + self->shutter = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "shutter: %d", self->shutter); + break; + } + case ARG_ZOOM: + { + OMX_CONFIG_SCALEFACTORTYPE zoom_scalefactor; + GOmxCore *gomx; + OMX_U32 zoom_factor; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gint32 zoom_value; + zoom_value = g_value_get_int (value); + gomx = (GOmxCore *) omx_base->gomx; + zoom_factor = (OMX_U32)((CAM_ZOOM_IN_STEP * zoom_value) / 100); + GST_DEBUG_OBJECT (self, "Set Property for zoom factor = %d", zoom_value); + + _G_OMX_INIT_PARAM (&zoom_scalefactor); + error_val = OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonDigitalZoom, + &zoom_scalefactor); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "OMX_GetConfig Successful for zoom"); + zoom_scalefactor.xWidth = (zoom_factor); + zoom_scalefactor.xHeight = (zoom_factor); + GST_DEBUG_OBJECT (self, "zoom_scalefactor = %d", zoom_scalefactor.xHeight); + error_val = OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonDigitalZoom, + &zoom_scalefactor); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "OMX_SetConfig Successful for zoom"); + break; + } + case ARG_FOCUS: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + OMX_CONFIG_CALLBACKREQUESTTYPE focusreq_cb; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + _G_OMX_INIT_PARAM (&focusreq_cb); + error_val = OMX_GetConfig(gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eFocusControl = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "AF: param=%d port=%d", config.eFocusControl, + config.nPortIndex); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + + if (config.eFocusControl == OMX_IMAGE_FocusControlAutoLock) + focusreq_cb.bEnable = OMX_TRUE; + else + focusreq_cb.bEnable = OMX_FALSE; + + if (omx_base->gomx->omx_state == OMX_StateExecuting) + { + guint32 autofocus_start_time; + + focusreq_cb.nPortIndex = OMX_ALL; + focusreq_cb.nIndex = OMX_IndexConfigCommonFocusStatus; + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCallbackRequest, + &focusreq_cb); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "AF_cb: enable=%d port=%d", + focusreq_cb.bEnable, focusreq_cb.nPortIndex); + + if (config.eFocusControl == OMX_IMAGE_FocusControlAutoLock) + { + GstStructure *structure = gst_structure_new ("omx_camera", + "auto-focus", G_TYPE_BOOLEAN, FALSE, NULL); + + GstMessage *message = gst_message_new_element ( + GST_OBJECT (self), structure); + + gst_element_post_message (GST_ELEMENT (self), message); + + autofocus_start_time = omap_32k_readraw (); + GST_CAT_INFO_OBJECT (gstomx_ppm, self, + "%d Autofocus started", autofocus_start_time); + } + } + break; + } + case ARG_AWB: + { + OMX_CONFIG_WHITEBALCONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonWhiteBalance, + &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eWhiteBalControl = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "AWB: param=%d", + config.eWhiteBalControl, + config.nPortIndex); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonWhiteBalance, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_CONTRAST: + { + OMX_CONFIG_CONTRASTTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonContrast, &config); + g_assert (error_val == OMX_ErrorNone); + config.nContrast = g_value_get_int (value); + GST_DEBUG_OBJECT (self, "Contrast: param=%d", config.nContrast); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonContrast, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_BRIGHTNESS: + { + OMX_CONFIG_BRIGHTNESSTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonBrightness, &config); + g_assert (error_val == OMX_ErrorNone); + config.nBrightness = g_value_get_int (value); + GST_DEBUG_OBJECT (self, "Brightness: param=%d", config.nBrightness); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonBrightness, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_EXPOSURE: + { + OMX_CONFIG_EXPOSURECONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposure, + &config); + g_assert (error_val == OMX_ErrorNone); + config.eExposureControl = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Exposure control = %d", + config.eExposureControl); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposure, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_ISO: + { + OMX_CONFIG_EXPOSUREVALUETYPE config; + GOmxCore *gomx; + OMX_U32 iso_requested; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + iso_requested = g_value_get_uint (value); + config.bAutoSensitivity = (iso_requested < 100) ? OMX_TRUE : OMX_FALSE; + if (config.bAutoSensitivity == OMX_FALSE) + { + config.nSensitivity = iso_requested; + } + GST_DEBUG_OBJECT (self, "ISO Speed: Auto=%d Sensitivity=%d", + config.bAutoSensitivity, config.nSensitivity); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_ROTATION: + { + OMX_CONFIG_ROTATIONTYPE config; + + G_OMX_PORT_GET_CONFIG (self->img_port, OMX_IndexConfigCommonRotate, &config); + + config.nRotation = g_value_get_uint (value); + GST_DEBUG_OBJECT (self, "Rotation: param=%d", config.nRotation); + + G_OMX_PORT_SET_CONFIG (self->img_port, OMX_IndexConfigCommonRotate, &config); + break; + } + case ARG_MIRROR: + { + OMX_CONFIG_MIRRORTYPE config; + G_OMX_PORT_GET_CONFIG (self->img_port, OMX_IndexConfigCommonMirror, &config); + + config.eMirror = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Mirror: param=%d", config.eMirror); + + G_OMX_PORT_SET_CONFIG (self->img_port, OMX_IndexConfigCommonMirror, &config); + break; + } + case ARG_SATURATION: + { + OMX_CONFIG_SATURATIONTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonSaturation, &config); + g_assert (error_val == OMX_ErrorNone); + config.nSaturation = g_value_get_int (value); + GST_DEBUG_OBJECT (self, "Saturation: param=%d", config.nSaturation); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonSaturation, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_EXPOSUREVALUE: + { + OMX_CONFIG_EXPOSUREVALUETYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gfloat exposure_float_value; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + exposure_float_value = g_value_get_float (value); + /* Converting into Q16 ( X << 16 = X*65536 ) */ + config.xEVCompensation = (OMX_S32) (exposure_float_value * 65536); + GST_DEBUG_OBJECT (self, "xEVCompensation: value=%f EVCompensation=%d", + exposure_float_value, config.xEVCompensation); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_MANUALFOCUS: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eFocusControl = OMX_IMAGE_FocusControlOn; + config.nFocusSteps = g_value_get_uint (value); + GST_DEBUG_OBJECT (self, "Manual AF: param=%d port=%d value=%d", + config.eFocusControl, + config.nPortIndex, + config.nFocusSteps); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_QFACTORJPEG: + { + OMX_IMAGE_PARAM_QFACTORTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + param.nPortIndex = self->img_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamQFactor, ¶m); + GST_DEBUG_OBJECT (self, "Q Factor JPEG Error = %lu", error_val); + g_assert (error_val == OMX_ErrorNone); + param.nPortIndex = self->img_port->port_index; + param.nQFactor = g_value_get_uint (value); + GST_DEBUG_OBJECT (self, "Q Factor JPEG: port=%d value=%d", + param.nPortIndex, + param.nQFactor); + + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamQFactor, ¶m); + GST_DEBUG_OBJECT (self, "Q Factor JPEG Error = %lu", error_val); + g_assert (error_val == OMX_ErrorNone); + break; + } +#ifdef USE_OMXTICORE + case ARG_THUMBNAIL_WIDTH: + { + OMX_PARAM_THUMBNAILTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamThumbnail, + ¶m); + g_assert (error_val == OMX_ErrorNone); + self->img_thumbnail_width = g_value_get_int (value); + param.nWidth = self->img_thumbnail_width; + GST_DEBUG_OBJECT (self, "Thumbnail width=%d", param.nWidth); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamThumbnail,¶m); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_THUMBNAIL_HEIGHT: + { + OMX_PARAM_THUMBNAILTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamThumbnail, + ¶m); + g_assert (error_val == OMX_ErrorNone); + self->img_thumbnail_height = g_value_get_int (value); + param.nHeight = self->img_thumbnail_height; + GST_DEBUG_OBJECT (self, "Thumbnail height=%d", param.nHeight); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamThumbnail,¶m); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_FLICKER: + { + OMX_CONFIG_FLICKERCANCELTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFlickerCancel, + &config); + g_assert (error_val == OMX_ErrorNone); + config.eFlickerCancel = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Flicker control = %d", config.eFlickerCancel); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFlickerCancel, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_SCENE: + { + OMX_CONFIG_SCENEMODETYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamSceneMode, + &config); + g_assert (error_val == OMX_ErrorNone); + config.eSceneMode = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Scene mode = %d", + config.eSceneMode); + + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamSceneMode, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_VNF: + { + OMX_PARAM_VIDEONOISEFILTERTYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamVideoNoiseFilter, ¶m); + + param.eMode = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "vnf: param=%d", param.eMode); + + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamVideoNoiseFilter, ¶m); + + break; + } + case ARG_YUV_RANGE: + { + OMX_PARAM_VIDEOYUVRANGETYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamVideoCaptureYUVRange, ¶m); + + param.eYUVRange = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "yuv-range: param=%d", param.eYUVRange); + + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamVideoCaptureYUVRange, ¶m); + + break; + } + case ARG_VSTAB: + { + OMX_CONFIG_BOOLEANTYPE param; + OMX_CONFIG_FRAMESTABTYPE config; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, OMX_IndexParamFrameStabilisation, ¶m); + G_OMX_CORE_GET_CONFIG (omx_base->gomx, OMX_IndexConfigCommonFrameStabilisation, &config); + + param.bEnabled = config.bStab = g_value_get_boolean (value); + GST_DEBUG_OBJECT (self, "vstab: param=%d, config=%d", param.bEnabled, config.bStab); + + G_OMX_CORE_SET_PARAM (omx_base->gomx, OMX_IndexParamFrameStabilisation, ¶m); + G_OMX_CORE_SET_CONFIG (omx_base->gomx, OMX_IndexConfigCommonFrameStabilisation, &config); + + break; + } + case ARG_DEVICE: + { + OMX_CONFIG_SENSORSELECTTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigSensorSelect, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eSensor = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Device src=%d, port=%d", config.eSensor, + config.nPortIndex); + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_TI_IndexConfigSensorSelect, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_LDC: + { + OMX_CONFIG_BOOLEANTYPE param; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, + OMX_IndexParamLensDistortionCorrection, ¶m); + + param.bEnabled = g_value_get_boolean (value); + GST_DEBUG_OBJECT (self, "Lens Distortion Correction: param=%d", + param.bEnabled); + G_OMX_CORE_SET_PARAM (omx_base->gomx, + OMX_IndexParamLensDistortionCorrection, ¶m); + break; + } + case ARG_NSF: + { + OMX_PARAM_ISONOISEFILTERTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamHighISONoiseFiler, + ¶m); + g_assert (error_val == OMX_ErrorNone); + param.eMode = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "ISO Noise Filter (NSF)=%d", param.eMode); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamHighISONoiseFiler, + ¶m); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_MTIS: + { + OMX_CONFIG_BOOLEANTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigMotionTriggeredImageStabilisation, + &config); + g_assert (error_val == OMX_ErrorNone); + + config.bEnabled = g_value_get_boolean (value); + GST_DEBUG_OBJECT (self, "Motion Triggered Image Stabilisation = %d", + config.bEnabled); + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigMotionTriggeredImageStabilisation, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_SENSOR_OVERCLOCK: + { + OMX_CONFIG_BOOLEANTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_TI_IndexParamSensorOverClockMode, + ¶m); + g_assert (error_val == OMX_ErrorNone); + + param.bEnabled = g_value_get_boolean (value); + GST_DEBUG_OBJECT (self, "Sensor OverClock Mode: param=%d", + param.bEnabled); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_TI_IndexParamSensorOverClockMode, + ¶m); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_WB_COLORTEMP: + { + OMX_TI_CONFIG_WHITEBALANCECOLORTEMPTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigWhiteBalanceManualColorTemp, + &config); + g_assert (error_val == OMX_ErrorNone); + config.nColorTemperature = g_value_get_uint (value); + GST_DEBUG_OBJECT (self, "White balance color temperature = %d", + config.nColorTemperature); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_TI_IndexConfigWhiteBalanceManualColorTemp, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_FOCUSSPOT_WEIGHT: + { + OMX_TI_CONFIG_FOCUSSPOTWEIGHTINGTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigFocusSpotWeighting, + &config); + g_assert (error_val == OMX_ErrorNone); + config.eMode = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Focus spot weighting = %d", config.eMode); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_TI_IndexConfigFocusSpotWeighting, + &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_WIDTHFOCUSREGION: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + OMX_CONFIG_EXTFOCUSREGIONTYPE ext_config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + _G_OMX_INIT_PARAM (&ext_config); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + ext_config.nPortIndex = omx_base->out_port->port_index; + ext_config.nWidth = g_value_get_uint (value); + self->img_focusregion_width = ext_config.nWidth; + ext_config.nHeight = self->img_focusregion_height; + if ((self->img_focusregion_width / 2) > self->img_regioncenter_x) + ext_config.nLeft = 0; + else + ext_config.nLeft = self->img_regioncenter_x - + (self->img_focusregion_width / 2); + + if ((self->img_focusregion_height / 2) > self->img_regioncenter_y) + ext_config.nTop = 0; + else + ext_config.nTop = self->img_regioncenter_y - + (self->img_focusregion_height / 2); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eFocusControl = OMX_IMAGE_FocusRegionPriorityMode; + + GST_DEBUG_OBJECT (self, "FocusRegion: Mode=%d Left=%d Top=%d " + "Width=%d Height=%d", config.eFocusControl, + ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_HEIGHTFOCUSREGION: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + OMX_CONFIG_EXTFOCUSREGIONTYPE ext_config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + _G_OMX_INIT_PARAM (&ext_config); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + ext_config.nPortIndex = omx_base->out_port->port_index; + ext_config.nHeight = g_value_get_uint (value); + self->img_focusregion_height = ext_config.nHeight; + ext_config.nWidth = self->img_focusregion_width; + if ((self->img_focusregion_height / 2) > self->img_regioncenter_y) + ext_config.nTop = 0; + else + ext_config.nTop = self->img_regioncenter_y - + (self->img_focusregion_height / 2); + + if ((self->img_focusregion_width / 2) > self->img_regioncenter_x) + ext_config.nLeft = 0; + else + ext_config.nLeft = self->img_regioncenter_x - + (self->img_focusregion_width / 2); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.eFocusControl = OMX_IMAGE_FocusRegionPriorityMode; + + GST_DEBUG_OBJECT (self, "FocusRegion: Mode=%d Left=%d Top=%d " + "Width=%d Height=%d", config.eFocusControl, + ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_SHARPNESS: + { + OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigSharpeningLevel, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + config.nLevel = g_value_get_int (value); + if (config.nLevel == 0) + config.bAuto = OMX_TRUE; + else + config.bAuto = OMX_FALSE; + GST_DEBUG_OBJECT (self, "Sharpness: value=%d", config.nLevel); + + error_val = OMX_SetConfig (gomx->omx_handle, + OMX_IndexConfigSharpeningLevel, &config); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_CAC: + { + OMX_CONFIG_BOOLEANTYPE param; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, + OMX_IndexConfigChromaticAberrationCorrection, + ¶m); + + param.bEnabled = g_value_get_boolean (value); + GST_DEBUG_OBJECT (self, "Chromatic Aberration Correction: param=%d", + param.bEnabled); + G_OMX_CORE_SET_PARAM (omx_base->gomx, + OMX_IndexConfigChromaticAberrationCorrection, + ¶m); + break; + } +#endif + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxCamera *self = GST_OMX_CAMERA (obj); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + + switch (prop_id) + { + case ARG_NUM_IMAGE_OUTPUT_BUFFERS: + case ARG_NUM_VIDEO_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port = (prop_id == ARG_NUM_IMAGE_OUTPUT_BUFFERS) ? + self->img_port : self->vid_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_value_set_uint (value, param.nBufferCountActual); + + break; + } + case ARG_MODE: + { + GST_DEBUG_OBJECT (self, "mode: %d", self->mode); + g_value_set_enum (value, self->mode); + break; + } + case ARG_SHUTTER: + { + GST_DEBUG_OBJECT (self, "shutter: %d", self->shutter); + g_value_set_enum (value, self->shutter); + break; + } + case ARG_ZOOM: + { + OMX_CONFIG_SCALEFACTORTYPE zoom_scalefactor; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + GST_DEBUG_OBJECT (self, "Get Property for zoom"); + + _G_OMX_INIT_PARAM (&zoom_scalefactor); + error_val = OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonDigitalZoom, + &zoom_scalefactor); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_FOCUS: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + GST_DEBUG_OBJECT (self, "AF: param=%d port=%d", config.eFocusControl, + config.nPortIndex); + g_value_set_enum (value, config.eFocusControl); + + break; + } + case ARG_AWB: + { + OMX_CONFIG_WHITEBALCONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonWhiteBalance, + &config); + g_assert (error_val == OMX_ErrorNone); + config.nPortIndex = omx_base->out_port->port_index; + GST_DEBUG_OBJECT (self, "AWB: param=%d", config.eWhiteBalControl); + g_value_set_enum (value, config.eWhiteBalControl); + + break; + } + case ARG_CONTRAST: + { + OMX_CONFIG_CONTRASTTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonContrast, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Contrast=%d", config.nContrast); + break; + } + case ARG_BRIGHTNESS: + { + OMX_CONFIG_BRIGHTNESSTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonBrightness, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Brightness=%d", config.nBrightness); + break; + } + case ARG_EXPOSURE: + { + OMX_CONFIG_EXPOSURECONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposure, + &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Exposure control = %d", + config.eExposureControl); + g_value_set_enum (value, config.eExposureControl); + + break; + } + case ARG_ISO: + { + OMX_CONFIG_EXPOSUREVALUETYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "ISO Speed: param=%d", config.nSensitivity); + g_value_set_uint (value, config.nSensitivity); + + break; + } + case ARG_ROTATION: + { + OMX_CONFIG_ROTATIONTYPE config; + + G_OMX_PORT_GET_CONFIG (self->img_port, OMX_IndexConfigCommonRotate, &config); + + GST_DEBUG_OBJECT (self, "Rotation: param=%d", config.nRotation); + g_value_set_uint (value, config.nRotation); + break; + } + case ARG_MIRROR: + { + OMX_CONFIG_MIRRORTYPE config; + G_OMX_PORT_GET_CONFIG (self->img_port, OMX_IndexConfigCommonMirror, &config); + + GST_DEBUG_OBJECT (self, "Mirror: param=%d", config.eMirror); + g_value_set_enum (value, config.eMirror); + break; + } + case ARG_SATURATION: + { + OMX_CONFIG_SATURATIONTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonSaturation, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Saturation=%d", config.nSaturation); + break; + } + case ARG_EXPOSUREVALUE: + { + OMX_CONFIG_EXPOSUREVALUETYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigCommonExposureValue, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "xEVCompensation: EVCompensation=%d", + config.xEVCompensation); + break; + } + case ARG_MANUALFOCUS: + { + OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFocusControl, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Manual AF: param=%d port=%d value=%d", + config.eFocusControl, + config.nPortIndex, + config.nFocusSteps); + g_value_set_uint (value, config.nFocusSteps); + break; + } + case ARG_QFACTORJPEG: + { + OMX_IMAGE_PARAM_QFACTORTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + param.nPortIndex = self->img_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamQFactor, ¶m); + GST_DEBUG_OBJECT (self, "Q Factor JPEG Error: port=%lu", error_val); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Q Factor JPEG: port=%d value=%d", + param.nPortIndex, + param.nQFactor); + g_value_set_uint (value, param.nQFactor); + break; + } +#ifdef USE_OMXTICORE + case ARG_THUMBNAIL_WIDTH: + { + OMX_PARAM_THUMBNAILTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter(gomx->omx_handle, + OMX_IndexParamThumbnail, + ¶m); + g_assert (error_val == OMX_ErrorNone); + self->img_thumbnail_width = param.nWidth; + GST_DEBUG_OBJECT (self, "Thumbnail width=%d", + self->img_thumbnail_width); + break; + } + case ARG_THUMBNAIL_HEIGHT: + { + OMX_PARAM_THUMBNAILTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter(gomx->omx_handle, + OMX_IndexParamThumbnail, + ¶m); + g_assert (error_val == OMX_ErrorNone); + self->img_thumbnail_height = param.nHeight; + GST_DEBUG_OBJECT (self, "Thumbnail height=%d", + self->img_thumbnail_height); + break; + } + case ARG_FLICKER: + { + OMX_CONFIG_FLICKERCANCELTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + gomx = (GOmxCore *) omx_base->gomx; + + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigFlickerCancel, + &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Flicker control = %d", config.eFlickerCancel); + g_value_set_enum (value, config.eFlickerCancel); + + break; + } + case ARG_SCENE: + { + OMX_CONFIG_SCENEMODETYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamSceneMode, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Scene mode = %d", config.eSceneMode); + g_value_set_enum (value, config.eSceneMode); + + break; + } + case ARG_VNF: + { + OMX_PARAM_VIDEONOISEFILTERTYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamVideoNoiseFilter, ¶m); + + GST_DEBUG_OBJECT (self, "vnf: param=%d", param.eMode); + g_value_set_enum (value, param.eMode); + + break; + } + case ARG_YUV_RANGE: + { + OMX_PARAM_VIDEOYUVRANGETYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamVideoCaptureYUVRange, ¶m); + + GST_DEBUG_OBJECT (self, "yuv-range: param=%d", param.eYUVRange); + g_value_set_enum (value, param.eYUVRange); + + break; + } + case ARG_VSTAB: + { + OMX_CONFIG_BOOLEANTYPE param; + OMX_CONFIG_FRAMESTABTYPE config; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, OMX_IndexParamFrameStabilisation, ¶m); + G_OMX_CORE_GET_CONFIG (omx_base->gomx, OMX_IndexConfigCommonFrameStabilisation, &config); + + GST_DEBUG_OBJECT (self, "vstab: param=%d, config=%d", param.bEnabled, config.bStab); + g_value_set_boolean (value, param.bEnabled && config.bStab); + + break; + } + case ARG_DEVICE: + { + OMX_CONFIG_SENSORSELECTTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigSensorSelect, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Device src=%d", config.eSensor); + g_value_set_enum (value, config.eSensor); + + break; + } + case ARG_LDC: + { + OMX_CONFIG_BOOLEANTYPE param; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, + OMX_IndexParamLensDistortionCorrection, ¶m); + GST_DEBUG_OBJECT (self, "Lens Distortion Correction: param=%d", + param.bEnabled); + g_value_set_boolean (value, param.bEnabled); + break; + } + case ARG_NSF: + { + OMX_PARAM_ISONOISEFILTERTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamHighISONoiseFiler, + ¶m); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "ISO Noise Filter (NSF)=%d", param.eMode); + g_value_set_enum (value, param.eMode); + + break; + } + case ARG_MTIS: + { + OMX_CONFIG_BOOLEANTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigMotionTriggeredImageStabilisation, + &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Motion Triggered Image Stabilisation = %d", + config.bEnabled); + g_value_set_boolean (value, config.bEnabled); + break; + } + case ARG_SENSOR_OVERCLOCK: + { + OMX_CONFIG_BOOLEANTYPE param; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (¶m); + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_TI_IndexParamSensorOverClockMode, + ¶m); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Sensor OverClock Mode: param=%d", + param.bEnabled); + g_value_set_boolean (value, param.bEnabled); + break; + } + case ARG_WB_COLORTEMP: + { + OMX_TI_CONFIG_WHITEBALANCECOLORTEMPTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigWhiteBalanceManualColorTemp, + &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "White balance color temperature = %d", + config.nColorTemperature); + g_value_set_uint (value, config.nColorTemperature); + break; + } + case ARG_FOCUSSPOT_WEIGHT: + { + OMX_TI_CONFIG_FOCUSSPOTWEIGHTINGTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_TI_IndexConfigFocusSpotWeighting, + &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Focus spot weighting = %d", config.eMode); + g_value_set_enum (value, config.eMode); + break; + } + case ARG_WIDTHFOCUSREGION: + { + OMX_CONFIG_EXTFOCUSREGIONTYPE ext_config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&ext_config); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "FocusRegion: Left=%d Top=%d Width=%d " + "Height=%d", ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + g_value_set_uint (value, ext_config.nWidth); + break; + } + case ARG_HEIGHTFOCUSREGION: + { + OMX_CONFIG_EXTFOCUSREGIONTYPE ext_config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&ext_config); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigExtFocusRegion, + &ext_config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "FocusRegion: Left=%d Top=%d Width=%d" + "Height=%d", ext_config.nLeft, ext_config.nTop, + ext_config.nWidth, ext_config.nHeight); + g_value_set_uint (value, ext_config.nHeight); + break; + } + case ARG_SHARPNESS: + { + OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE config; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&config); + + error_val = OMX_GetConfig (gomx->omx_handle, + OMX_IndexConfigSharpeningLevel, &config); + g_assert (error_val == OMX_ErrorNone); + GST_DEBUG_OBJECT (self, "Sharpness: value=%d bAuto=%d", + config.nLevel, config.bAuto); + g_value_set_int (value, config.nLevel); + break; + } + case ARG_CAC: + { + OMX_CONFIG_BOOLEANTYPE param; + + G_OMX_CORE_GET_PARAM (omx_base->gomx, + OMX_IndexConfigChromaticAberrationCorrection, + ¶m); + GST_DEBUG_OBJECT (self, "Chromatic Aberration Correction: param=%d", + param.bEnabled); + g_value_set_boolean (value, param.bEnabled); + break; + } +#endif + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } + } +} + +/* + * Initialization: + */ + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (element_class, &element_details); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&vidsrc_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&imgsrc_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&thumbsrc_template)); + +#if 0 + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); +#endif +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); + GstElementClass *gst_element_class = GST_ELEMENT_CLASS (g_class); + GstBaseSrcClass *gst_base_src_class = GST_BASE_SRC_CLASS (g_class); + GstOmxBaseSrcClass *omx_base_class = GST_OMX_BASE_SRC_CLASS (g_class); + + omx_base_class->out_port_index = OMX_CAMERA_PORT_VIDEO_OUT_PREVIEW; + + /* GstBaseSrc methods: */ + gst_base_src_class->create = GST_DEBUG_FUNCPTR (create); + + /* GstElement methods: */ + gst_element_class->send_event = GST_DEBUG_FUNCPTR (send_event); + + /* GObject methods: */ + gobject_class->set_property = GST_DEBUG_FUNCPTR (set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (get_property); + + /* install properties: */ + g_object_class_install_property (gobject_class, ARG_NUM_IMAGE_OUTPUT_BUFFERS, + g_param_spec_uint ("image-output-buffers", "Image port output buffers", + "The number of OMX image port output buffers", + 1, 10, 4, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_NUM_VIDEO_OUTPUT_BUFFERS, + g_param_spec_uint ("video-output-buffers", "Video port output buffers", + "The number of OMX video port output buffers", + 1, 10, 4, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_MODE, + g_param_spec_enum ("mode", "Camera Mode", + "image capture, video capture, or both", + GST_TYPE_OMX_CAMERA_MODE, + MODE_PREVIEW, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_SHUTTER, + g_param_spec_enum ("shutter", "Shutter State", + "shutter button state", + GST_TYPE_OMX_CAMERA_SHUTTER, + SHUTTER_OFF, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_ZOOM, + g_param_spec_int ("zoom", "Digital Zoom", + "digital zoom factor/level", + MIN_ZOOM_LEVEL, MAX_ZOOM_LEVEL, DEFAULT_ZOOM_LEVEL, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_FOCUS, + g_param_spec_enum ("focus", "Auto Focus", + "auto focus state", + GST_TYPE_OMX_CAMERA_FOCUS, + DEFAULT_FOCUS, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_AWB, + g_param_spec_enum ("awb", "Auto White Balance", + "auto white balance state", + GST_TYPE_OMX_CAMERA_AWB, + DEFAULT_AWB, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_CONTRAST, + g_param_spec_int ("contrast", "Contrast", + "contrast level", MIN_CONTRAST_LEVEL, + MAX_CONTRAST_LEVEL, DEFAULT_CONTRAST_LEVEL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_BRIGHTNESS, + g_param_spec_int ("brightness", "Brightness", + "brightness level", MIN_BRIGHTNESS_LEVEL, + MAX_BRIGHTNESS_LEVEL, DEFAULT_BRIGHTNESS_LEVEL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_EXPOSURE, + g_param_spec_enum ("exposure", "Exposure Control", + "exposure control mode", + GST_TYPE_OMX_CAMERA_EXPOSURE, + DEFAULT_EXPOSURE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_ISO, + g_param_spec_uint ("iso-speed", "ISO Speed", + "ISO speed level", MIN_ISO_LEVEL, + MAX_ISO_LEVEL, DEFAULT_ISO_LEVEL, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_ROTATION, + g_param_spec_uint ("rotation", "Rotation", + "Image rotation", + 0, 270, DEFAULT_ROTATION , G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_MIRROR, + g_param_spec_enum ("mirror", "Mirror", + "Mirror image", + GST_TYPE_OMX_CAMERA_MIRROR, + DEFAULT_MIRROR, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_SATURATION, + g_param_spec_int ("saturation", "Saturation", + "Saturation level", MIN_SATURATION_VALUE, + MAX_SATURATION_VALUE, DEFAULT_SATURATION_VALUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_EXPOSUREVALUE, + g_param_spec_float ("exposure-value", "Exposure value", + "EVCompensation level", MIN_EXPOSURE_VALUE, + MAX_EXPOSURE_VALUE, DEFAULT_EXPOSURE_VALUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_MANUALFOCUS, + g_param_spec_uint ("manual-focus", "Manual Focus", + "Manual focus level, 0:Infinity 100:Macro", + MIN_MANUALFOCUS, MAX_MANUALFOCUS, DEFAULT_MANUALFOCUS, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_QFACTORJPEG, + g_param_spec_uint ("qfactor", "Q Factor JPEG", + "JPEG Q Factor level, 1:Highest compression 100:Best quality", + MIN_QFACTORJPEG, MAX_QFACTORJPEG, DEFAULT_QFACTORJPEG, + G_PARAM_READWRITE)); +#ifdef USE_OMXTICORE + g_object_class_install_property (gobject_class, ARG_THUMBNAIL_WIDTH, + g_param_spec_int ("thumb-width", "Thumbnail width", + "Thumbnail width in pixels", MIN_THUMBNAIL_LEVEL, + MAX_THUMBNAIL_LEVEL, DEFAULT_THUMBNAIL_WIDTH, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_THUMBNAIL_HEIGHT, + g_param_spec_int ("thumb-height", "Thumbnail height", + "Thumbnail height in pixels", MIN_THUMBNAIL_LEVEL, + MAX_THUMBNAIL_LEVEL, DEFAULT_THUMBNAIL_HEIGHT, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_FLICKER, + g_param_spec_enum ("flicker", "Flicker Control", + "flicker control state", + GST_TYPE_OMX_CAMERA_FLICKER, + DEFAULT_FLICKER, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_SCENE, + g_param_spec_enum ("scene", "Scene Mode", + "Scene mode", + GST_TYPE_OMX_CAMERA_SCENE, + DEFAULT_SCENE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_VNF, + g_param_spec_enum ("vnf", "Video Noise Filter", + "is video noise filter algorithm enabled?", + GST_TYPE_OMX_CAMERA_VNF, + DEFAULT_VNF, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_YUV_RANGE, + g_param_spec_enum ("yuv-range", "YUV Range", + "YUV Range", + GST_TYPE_OMX_CAMERA_YUV_RANGE, + DEFAULT_YUV_RANGE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_VSTAB, + g_param_spec_boolean ("vstab", "Video Frame Stabilization", + "is video stabilization algorithm enabled?", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_DEVICE, + g_param_spec_enum ("device", "Camera sensor", + "Image and video stream source", + GST_TYPE_OMX_CAMERA_DEVICE, + DEFAULT_DEVICE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_LDC, + g_param_spec_boolean ("ldc", "Lens Distortion Correction", + "Lens Distortion Correction state", + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_NSF, + g_param_spec_enum ("nsf", "ISO noise suppression filter", + "low light environment noise filter", + GST_TYPE_OMX_CAMERA_NSF, + DEFAULT_NSF, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_MTIS, + g_param_spec_boolean ("mtis", "Motion triggered image stabilisation mode", + "Motion triggered image stabilisation mode", + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_SENSOR_OVERCLOCK, + g_param_spec_boolean ("overclock", "Sensor over-clock mode", + "Sensor over-clock mode", + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_WB_COLORTEMP, + g_param_spec_uint ("wb-colortemp", + "White Balance Color Temperature", + "White balance color temperature", MIN_WB_COLORTEMP_VALUE, + MAX_WB_COLORTEMP_VALUE, DEFAULT_WB_COLORTEMP_VALUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_FOCUSSPOT_WEIGHT, + g_param_spec_enum ("focusweight", "Focus Spot Weight mode", + "Focus spot weight mode", + GST_TYPE_OMX_CAMERA_FOCUSSPOT_WEIGHT, + DEFAULT_FOCUSSPOT_WEIGHT, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_WIDTHFOCUSREGION, + g_param_spec_uint ("focusregion-width", "Width Focus Region", + "Width focus region", MIN_FOCUSREGION, + MAX_FOCUSREGION, DEFAULT_FOCUSREGION, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_HEIGHTFOCUSREGION, + g_param_spec_uint ("focusregion-height", "Height Focus Region", + "Height focus region", MIN_FOCUSREGION, + MAX_FOCUSREGION, DEFAULT_FOCUSREGION, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_SHARPNESS, + g_param_spec_int ("sharpness", "Sharpness value", + "Sharpness value, 0:automatic mode)", MIN_SHARPNESS_VALUE, + MAX_SHARPNESS_VALUE, DEFAULT_SHARPNESS_VALUE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_CAC, + g_param_spec_boolean ("cac", "Chromatic Aberration Correction", + "Chromatic Aberration Correction state", + FALSE, + G_PARAM_READWRITE)); +#endif +} + + +void check_settings (GOmxPort *port, GstPad *pad); + + +/** + * overrides the default buffer allocation for img_port to allow + * pad_alloc'ing from the imgsrcpad + */ +static GstBuffer * +img_buffer_alloc (GOmxPort *port, gint len) +{ + GstOmxCamera *self = port->core->object; + GstBuffer *buf; + GstFlowReturn ret; + + GST_DEBUG_OBJECT (self, "img_buffer_alloc begin"); + check_settings (self->img_port, self->imgsrcpad); + + ret = gst_pad_alloc_buffer_and_set_caps ( + self->imgsrcpad, GST_BUFFER_OFFSET_NONE, + len, GST_PAD_CAPS (self->imgsrcpad), &buf); + + if (ret == GST_FLOW_OK) return buf; + + return NULL; +} + + +/** + * overrides the default buffer allocation for thumb_port to allow + * pad_alloc'ing from the thumbsrcpad + */ +static GstBuffer * +thumb_buffer_alloc (GOmxPort *port, gint len) +{ + GstOmxCamera *self = port->core->object; + GstBuffer *buf; + GstFlowReturn ret; + + GST_DEBUG_OBJECT (self, "thumb_buffer_alloc begin"); + check_settings (self->vid_port, self->thumbsrcpad); + + ret = gst_pad_alloc_buffer_and_set_caps ( + self->thumbsrcpad, GST_BUFFER_OFFSET_NONE, + len, GST_PAD_CAPS (self->thumbsrcpad), &buf); + + if (ret == GST_FLOW_OK) return buf; + + return NULL; +} + + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxCamera *self = GST_OMX_CAMERA (instance); + GstOmxBaseSrc *omx_base = GST_OMX_BASE_SRC (self); + GstBaseSrc *basesrc = GST_BASE_SRC (self); + GstPadTemplate *pad_template; + + GST_DEBUG_OBJECT (omx_base, "begin"); + + self->mode = -1; + self->next_mode = MODE_PREVIEW; + +#ifdef USE_OMXTICORE + self->img_focusregion_width=DEFAULT_FOCUSREGIONWIDTH; + self->img_focusregion_height=DEFAULT_FOCUSREGIONHEIGHT; + self->img_regioncenter_x = (DEFAULT_FOCUSREGIONWIDTH / 2); + self->img_regioncenter_y = (DEFAULT_FOCUSREGIONHEIGHT / 2); + self->click_x = 0; + self->click_y = 0; +#endif + + omx_base->setup_ports = setup_ports; + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + omx_base->gomx->index_settings_changed_cb = index_settings_changed_cb; + + omx_base->gomx->use_timestamps = TRUE; + + self->vid_port = g_omx_core_get_port (omx_base->gomx, "vid", + OMX_CAMERA_PORT_VIDEO_OUT_VIDEO); + self->img_port = g_omx_core_get_port (omx_base->gomx, "img", + OMX_CAMERA_PORT_IMAGE_OUT_IMAGE); + self->in_port = g_omx_core_get_port (omx_base->gomx, "in", + OMX_CAMERA_PORT_OTHER_IN); + self->in_vid_port = g_omx_core_get_port (omx_base->gomx, "in_vid", + OMX_CAMERA_PORT_VIDEO_IN_VIDEO); + self->msr_port = g_omx_core_get_port (omx_base->gomx, "msr", + OMX_CAMERA_PORT_VIDEO_OUT_MEASUREMENT); + + self->img_port->buffer_alloc = img_buffer_alloc; + self->vid_port->buffer_alloc = thumb_buffer_alloc; +#if 0 + self->in_port = g_omx_core_get_port (omx_base->gomx, "in" + OMX_CAMERA_PORT_VIDEO_IN_VIDEO); +#endif + + gst_base_src_set_live (basesrc, TRUE); + + /* setup src pad (already created by basesrc): */ + + gst_pad_set_setcaps_function (basesrc->srcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); + + /* create/setup vidsrc pad: */ + pad_template = gst_element_class_get_pad_template ( + GST_ELEMENT_CLASS (g_class), "vidsrc"); + g_return_if_fail (pad_template != NULL); + + GST_DEBUG_OBJECT (basesrc, "creating vidsrc pad"); + self->vidsrcpad = gst_pad_new_from_template (pad_template, "vidsrc"); + + /* src and vidsrc pads have same caps: */ + gst_pad_set_setcaps_function (self->vidsrcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); + + /* create/setup imgsrc pad: */ + pad_template = gst_element_class_get_pad_template ( + GST_ELEMENT_CLASS (g_class), "imgsrc"); + g_return_if_fail (pad_template != NULL); + + GST_DEBUG_OBJECT (basesrc, "creating imgsrc pad"); + self->imgsrcpad = gst_pad_new_from_template (pad_template, "imgsrc"); + gst_pad_set_setcaps_function (self->imgsrcpad, + GST_DEBUG_FUNCPTR (imgsrc_setcaps)); + + /* create/setup thumbsrc pad: */ + pad_template = gst_element_class_get_pad_template ( + GST_ELEMENT_CLASS (g_class), "thumbsrc"); + g_return_if_fail (pad_template != NULL); + + GST_DEBUG_OBJECT (basesrc, "creating thumbsrc pad"); + self->thumbsrcpad = gst_pad_new_from_template (pad_template, "thumbsrc"); + gst_pad_set_setcaps_function (self->thumbsrcpad, + GST_DEBUG_FUNCPTR (thumbsrc_setcaps)); + + gst_pad_set_query_function (basesrc->srcpad, + GST_DEBUG_FUNCPTR (src_query)); + gst_pad_set_query_function (self->vidsrcpad, + GST_DEBUG_FUNCPTR (src_query)); + gst_pad_set_event_function (basesrc->srcpad, + GST_DEBUG_FUNCPTR (gst_camera_handle_src_event)); + +#if 0 + /* disable all ports to begin with: */ + g_omx_port_disable (self->in_port); + g_omx_port_disable (omx_base->out_port); +#endif + g_omx_port_disable (self->vid_port); + g_omx_port_disable (self->img_port); + g_omx_port_disable (self->in_port); + g_omx_port_disable (self->in_vid_port); + g_omx_port_disable (self->msr_port); + + GST_DEBUG_OBJECT (omx_base, "end"); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.h new file mode 100644 index 0000000..e3f6dac --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_camera.h @@ -0,0 +1,115 @@ +/* GStreamer + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: OMX Camera element + * Created on: Aug 31, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef GSTOMX_CAMERA_H +#define GSTOMX_CAMERA_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_CAMERA(obj) (GstOmxCamera *) (obj) +#define GST_OMX_CAMERA_TYPE (gst_omx_camera_get_type ()) + +typedef struct GstOmxCamera GstOmxCamera; +typedef struct GstOmxCameraClass GstOmxCameraClass; + +#include "gstomx_base_src.h" + +struct GstOmxCamera +{ + GstOmxBaseSrc omx_base; + + /*< private >*/ + gint mode, next_mode; + gint shutter; + gint img_count; +#ifdef USE_OMXTICORE + gint img_thumbnail_width; + gint img_thumbnail_height; + gint img_focusregion_width; + gint img_focusregion_height; + gint img_regioncenter_x; + gint img_regioncenter_y; + gdouble click_x; + gdouble click_y; +#endif + + gint rowstride; /**< rowstride of preview/video buffer */ + + GOmxPort *vid_port; + GOmxPort *img_port; + GOmxPort *in_vid_port; + GOmxPort *in_port; + GOmxPort *msr_port; +#if 0 + GOmxPort *in_port; +#endif + + GstPad *vidsrcpad; + GstPad *imgsrcpad; + GstPad *thumbsrcpad; + + /* if EOS is pending (atomic) */ + gint pending_eos; +}; + +struct GstOmxCameraClass +{ + GstOmxBaseSrcClass parent_class; +}; + +GType gst_omx_camera_get_type (void); + + +/* (can we get these port #'s in a cleaner way??) */ +/* ****** from omx_iss_cam_def.h ******************************************* */ +/* Default portstartnumber of Camera component */ +#define OMX_CAMERA_DEFAULT_START_PORT_NUM 0 + +/* Define number of ports for differt domains */ +#define OMX_CAMERA_PORT_OTHER_NUM 1 +#define OMX_CAMERA_PORT_VIDEO_NUM 4 +#define OMX_CAMERA_PORT_IMAGE_NUM 1 +#define OMX_CAMERA_PORT_AUDIO_NUM 0 + +/* Define start port number for differt domains */ +#define OMX_CAMERA_PORT_OTHER_START OMX_CAMERA_DEFAULT_START_PORT_NUM +#define OMX_CAMERA_PORT_VIDEO_START (OMX_CAMERA_PORT_OTHER_START + OMX_CAMERA_PORT_OTHER_NUM) +#define OMX_CAMERA_PORT_IMAGE_START (OMX_CAMERA_PORT_VIDEO_START + OMX_CAMERA_PORT_VIDEO_NUM) +#define OMX_CAMERA_PORT_AUDIO_START (OMX_CAMERA_PORT_IMAGE_START + OMX_CAMERA_PORT_IMAGE_NUM) + +/* Port index for camera component */ +#define OMX_CAMERA_PORT_OTHER_IN (OMX_CAMERA_PORT_OTHER_START + 0) +#define OMX_CAMERA_PORT_VIDEO_IN_VIDEO (OMX_CAMERA_PORT_VIDEO_START + 0) +#define OMX_CAMERA_PORT_VIDEO_OUT_PREVIEW (OMX_CAMERA_PORT_VIDEO_START + 1) +#define OMX_CAMERA_PORT_VIDEO_OUT_VIDEO (OMX_CAMERA_PORT_VIDEO_START + 2) +#define OMX_CAMERA_PORT_VIDEO_OUT_MEASUREMENT (OMX_CAMERA_PORT_VIDEO_START + 3) +#define OMX_CAMERA_PORT_IMAGE_OUT_IMAGE (OMX_CAMERA_PORT_IMAGE_START + 0) +/* ************************************************************************* */ + + +G_END_DECLS + +#endif /* GSTOMX_CAMERA_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.c new file mode 100644 index 0000000..b243323 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.c @@ -0,0 +1,745 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_util.h" +#include "gstomx.h" + +#ifdef USE_OMXTICORE +# include <OMX_TI_Common.h> +/* REVISIT: Header file is not available in EZSDK OMX components */ +#if 0 +# include <OMX_TI_Core.h> +#endif +# include <OMX_TI_Index.h> +#endif + +#include <OMX_CoreExt.h> + +GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug); + +/* + * Forward declarations + */ + +static inline void +change_state (GOmxCore *core, + OMX_STATETYPE state); + +static inline void +wait_for_state (GOmxCore *core, + OMX_STATETYPE state); + +static inline void +in_port_cb (GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer); + +static inline void +out_port_cb (GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer); + +static OMX_ERRORTYPE +EventHandler (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_EVENTTYPE event, + OMX_U32 data_1, + OMX_U32 data_2, + OMX_PTR event_data); + +static OMX_ERRORTYPE +EmptyBufferDone (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *omx_buffer); + +static OMX_ERRORTYPE +FillBufferDone (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *omx_buffer); + +static inline GOmxPort *get_port (GOmxCore *core, guint index); + + +static OMX_CALLBACKTYPE callbacks = { EventHandler, EmptyBufferDone, FillBufferDone }; + + +/* + * Util + */ + +static void +g_ptr_array_clear (GPtrArray *array) +{ + guint index; + for (index = 0; index < array->len; index++) + array->pdata[index] = NULL; +} + +static void +g_ptr_array_insert (GPtrArray *array, + guint index, + gpointer data) +{ + if (index + 1 > array->len) + { + g_ptr_array_set_size (array, index + 1); + } + + array->pdata[index] = data; +} + +typedef void (*GOmxPortFunc) (GOmxPort *port); + +static void inline +core_for_each_port (GOmxCore *core, + GOmxPortFunc func) +{ + guint index; + + for (index = 0; index < core->ports->len; index++) + { + GOmxPort *port; + + port = get_port (core, index); + + if (port) + func (port); + } +} + + +/* + * Core + */ + +/** + * Construct new core + * + * @object: the GstOmx object (ie. GstOmxBaseFilter, GstOmxBaseSrc, or + * GstOmxBaseSink). The GstOmx object should have "component-role", + * "component-name", and "library-name" properties. + */ +GOmxCore * +g_omx_core_new (gpointer object, gpointer klass) +{ + GOmxCore *core; + + core = g_new0 (GOmxCore, 1); + + core->object = object; + + core->ports = g_ptr_array_new (); + + core->omx_state_condition = g_cond_new (); + core->omx_state_mutex = g_mutex_new (); + + core->done_sem = g_sem_new (); + core->flush_sem = g_sem_new (); + core->port_sem = g_sem_new (); + + core->omx_state = OMX_StateInvalid; + + core->use_timestamps = TRUE; + core->gen_timestamps = TRUE; + core->last_buf_timestamp = GST_CLOCK_TIME_NONE; + + { + gchar *library_name, *component_name, *component_role; + + library_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), + g_quark_from_static_string ("library-name")); + + component_name = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), + g_quark_from_static_string ("component-name")); + + component_role = g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass), + g_quark_from_static_string ("component-role")); + + g_object_set (core->object, + "component-role", component_role, + "component-name", component_name, + "library-name", library_name, + NULL); + } + + return core; +} + +void +g_omx_core_free (GOmxCore *core) +{ + g_omx_core_deinit (core); /* just in case we didn't have a READY->NULL.. mainly for gst-inspect */ + + g_sem_free (core->port_sem); + g_sem_free (core->flush_sem); + g_sem_free (core->done_sem); + + g_mutex_free (core->omx_state_mutex); + g_cond_free (core->omx_state_condition); + + g_ptr_array_free (core->ports, TRUE); + + g_free (core); +} + +void +g_omx_core_init (GOmxCore *core) +{ + gchar *library_name=NULL, *component_name=NULL, *component_role=NULL; + + if (core->omx_handle) + return; + + g_object_get (core->object, + "component-role", &component_role, + "component-name", &component_name, + "library-name", &library_name, + NULL); + + GST_DEBUG_OBJECT (core->object, "loading: %s %s (%s)", component_name, + component_role ? component_role : "", library_name); + + g_return_if_fail (component_name); + g_return_if_fail (library_name); + + core->imp = g_omx_request_imp (library_name); + + if (!core->imp) + return; + + #ifdef USE_STATIC + core->omx_error = core->imp->sym_table.get_handle (&core->omx_handle, + (char *) component_name, + core, + &callbacks); + #else + core->omx_error = OMX_GetHandle (&core->omx_handle, (char *) component_name, + core, + &callbacks); + #endif + + GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %s", + core->omx_handle, g_omx_error_to_str (core->omx_error)); + + g_return_if_fail (core->omx_handle); + + if (component_role) + { + OMX_PARAM_COMPONENTROLETYPE param; + + GST_DEBUG_OBJECT (core->object, "setting component role: %s", + component_role); + + G_OMX_CORE_GET_PARAM (core, + OMX_IndexParamStandardComponentRole, ¶m); + + strcpy((char*)param.cRole, component_role); + + G_OMX_CORE_SET_PARAM (core, + OMX_IndexParamStandardComponentRole, ¶m); + + g_free (component_role); + } + + g_free (component_name); + g_free (library_name); + + if (!core->omx_error) + core->omx_state = OMX_StateLoaded; +} + +void +g_omx_core_change_state (GOmxCore *core, OMX_STATETYPE state) +{ + change_state (core, state); + wait_for_state (core, state); +} + +void +g_omx_core_deinit (GOmxCore *core) +{ + if (!core->imp) + return; + + core_for_each_port (core, g_omx_port_free); + g_ptr_array_clear (core->ports); + + if (core->omx_state == OMX_StateLoaded || + core->omx_state == OMX_StateInvalid) + { + if (core->omx_handle) + { + #ifdef USE_STATIC + core->omx_error = OMX_FreeHandle (core->omx_handle); + #else + core->omx_error = core->imp->sym_table.free_handle (core->omx_handle); + #endif + GST_DEBUG_OBJECT (core->object, "OMX_FreeHandle(%p) -> %s", + core->omx_handle, g_omx_error_to_str (core->omx_error)); + core->omx_handle = NULL; + } + } + + g_omx_release_imp (core->imp); + core->imp = NULL; +} + +static void +port_prepare (GOmxPort *port) +{ + /* only prepare if the port is actually enabled: */ + if (port->enabled) + g_omx_port_prepare (port); +} + +static void +port_allocate_buffers (GOmxPort *port) +{ + /* only allocate buffers if the port is actually enabled: */ + if (port->enabled) + g_omx_port_allocate_buffers (port); +} + +void +g_omx_core_prepare (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + + /* Prepare port */ + core_for_each_port (core, port_prepare); + + change_state (core, OMX_StateIdle); + + /* Allocate buffers. */ + core_for_each_port (core, port_allocate_buffers); + + wait_for_state (core, OMX_StateIdle); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_start (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + change_state (core, OMX_StateExecuting); + wait_for_state (core, OMX_StateExecuting); + + if (core->omx_state == OMX_StateExecuting) + core_for_each_port (core, g_omx_port_start_buffers); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_stop (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + if (core->omx_state == OMX_StateExecuting || + core->omx_state == OMX_StatePause) + { + change_state (core, OMX_StateIdle); + wait_for_state (core, OMX_StateIdle); + } + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_pause (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + change_state (core, OMX_StatePause); + wait_for_state (core, OMX_StatePause); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_unload (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + if (core->omx_state == OMX_StateIdle || + core->omx_state == OMX_StateWaitForResources || + core->omx_state == OMX_StateInvalid) + { + if (core->omx_state != OMX_StateInvalid) + change_state (core, OMX_StateLoaded); + + core_for_each_port (core, g_omx_port_free_buffers); + + if (core->omx_state != OMX_StateInvalid) + wait_for_state (core, OMX_StateLoaded); + } + GST_DEBUG_OBJECT (core->object, "end"); +} + +static inline GOmxPort * +get_port (GOmxCore *core, guint index) +{ + if (G_LIKELY (index < core->ports->len)) + { + return g_ptr_array_index (core->ports, index); + } + + return NULL; +} + +GOmxPort * +g_omx_core_get_port (GOmxCore *core, const gchar *name, guint index) +{ + GOmxPort *port = get_port (core, index); + + if (!port) + { + port = g_omx_port_new (core, name, index); + g_ptr_array_insert (core->ports, index, port); + } + + return port; +} + +void +g_omx_core_set_done (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + g_sem_up (core->done_sem); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_wait_for_done (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + g_sem_down (core->done_sem); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_flush_start (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + core_for_each_port (core, g_omx_port_pause); + GST_DEBUG_OBJECT (core->object, "end"); +} + +void +g_omx_core_flush_stop (GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + core_for_each_port (core, g_omx_port_flush); + core_for_each_port (core, g_omx_port_resume); + GST_DEBUG_OBJECT (core->object, "end"); +} + +/** + * Accessor for OMX component handle. If the OMX component is not constructed + * yet, this will trigger it to be constructed (OMX_GetHandle()). This should + * at least be used in places where g_omx_core_init() might not have been + * called yet (such as setting/getting properties) + */ +OMX_HANDLETYPE +g_omx_core_get_handle (GOmxCore *core) +{ + if (!core->omx_handle) g_omx_core_init (core); + g_return_val_if_fail (core->omx_handle, NULL); + return core->omx_handle; +} + + +/* + * Helper functions. + */ + +static inline void +change_state (GOmxCore *core, + OMX_STATETYPE state) +{ + GST_DEBUG_OBJECT (core->object, "state=%d", state); + OMX_SendCommand (core->omx_handle, OMX_CommandStateSet, state, NULL); +} + +static inline void +complete_change_state (GOmxCore *core, + OMX_STATETYPE state) +{ + g_mutex_lock (core->omx_state_mutex); + + core->omx_state = state; + g_cond_signal (core->omx_state_condition); + GST_DEBUG_OBJECT (core->object, "state=%d", state); + + g_mutex_unlock (core->omx_state_mutex); +} + +static inline void +wait_for_state (GOmxCore *core, + OMX_STATETYPE state) +{ + GTimeVal tv; + gboolean signaled; + + g_mutex_lock (core->omx_state_mutex); + + if (core->omx_error != OMX_ErrorNone) + goto leave; + + g_get_current_time (&tv); + g_time_val_add (&tv, 100000000); + + /* try once */ + if (core->omx_state != state) + { + signaled = g_cond_timed_wait (core->omx_state_condition, core->omx_state_mutex, &tv); + + if (!signaled) + { + GST_ERROR_OBJECT (core->object, "timed out"); + } + } + + if (core->omx_error != OMX_ErrorNone) + goto leave; + + if (core->omx_state != state) + { + GST_ERROR_OBJECT (core->object, "wrong state received: state=%d, expected=%d", + core->omx_state, state); + } + +leave: + g_mutex_unlock (core->omx_state_mutex); +} + +/* + * Callbacks + */ + +static inline void +in_port_cb (GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + /** @todo remove this */ + + if (!port->enabled) + return; +} + +static inline void +out_port_cb (GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + /** @todo remove this */ + + if (!port->enabled) + return; + +#if 0 + if (omx_buffer->nFlags & OMX_BUFFERFLAG_EOS) + { + g_omx_port_set_done (port); + return; + } +#endif +} + +void +g_omx_core_got_buffer (GOmxCore *core, + GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + if (G_UNLIKELY (!omx_buffer)) + { + return; + } + + if (G_LIKELY (port)) + { + g_omx_port_push_buffer (port, omx_buffer); + + switch (port->type) + { + case GOMX_PORT_INPUT: + in_port_cb (port, omx_buffer); + break; + case GOMX_PORT_OUTPUT: + out_port_cb (port, omx_buffer); + break; + default: + break; + } + } +} + +/* + * OpenMAX IL callbacks. + */ + +static OMX_ERRORTYPE +EventHandler (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_EVENTTYPE event, + OMX_U32 data_1, + OMX_U32 data_2, + OMX_PTR event_data) +{ + GOmxCore *core; + + core = (GOmxCore *) app_data; + + switch (event) + { + case OMX_EventCmdComplete: + { + OMX_COMMANDTYPE cmd; + + cmd = (OMX_COMMANDTYPE) data_1; + + GST_DEBUG_OBJECT (core->object, "OMX_EventCmdComplete: %d", cmd); + + switch (cmd) + { + case OMX_CommandStateSet: + complete_change_state (core, data_2); + break; + case OMX_CommandFlush: + g_sem_up (core->flush_sem); + break; + case OMX_CommandPortDisable: + case OMX_CommandPortEnable: + g_sem_up (core->port_sem); + default: + break; + } + break; + } + case OMX_EventBufferFlag: + { + GST_DEBUG_OBJECT (core->object, "OMX_EventBufferFlag"); + if (data_2 & OMX_BUFFERFLAG_EOS) + { + g_omx_core_set_done (core); + } + break; + } + case OMX_EventPortSettingsChanged: + { + GST_DEBUG_OBJECT (core->object, "OMX_EventPortSettingsChanged"); + /** @todo only on the relevant port. */ + if (core->settings_changed_cb) + { + core->settings_changed_cb (core); + } + break; + } + case OMX_EventIndexSettingChanged: + { + GST_DEBUG_OBJECT (core->object, + "OMX_EventIndexSettingsChanged"); + if (core->index_settings_changed_cb) + { + core->index_settings_changed_cb (core, data_1, data_2); + } + break; + } + case OMX_EventError: + { + GST_ERROR_OBJECT (core->object, "unrecoverable error: %s (0x%lx)", + g_omx_error_to_str (data_1), data_1); + if (data_1 != 0x8000100b) { + printf("unrecoverable error: %s (0x%lx)\n", + g_omx_error_to_str (data_1), data_1); + fflush(stdout); + core->omx_error = data_1; + /* component might leave us waiting for buffers, unblock */ + g_omx_core_flush_start (core); + /* unlock wait_for_state */ + g_mutex_lock (core->omx_state_mutex); + g_cond_signal (core->omx_state_condition); + g_mutex_unlock (core->omx_state_mutex); + } else { + printf("Stream is corrupt error, ignorable ... \n"); + fflush(stdout); + } + break; + } +#ifdef USE_OMXTICORE + case OMX_TI_EventBufferRefCount: + { + OMX_BUFFERHEADERTYPE *omx_buffer = (OMX_BUFFERHEADERTYPE *)data_1; + GOmxPort *port = get_port (core, omx_buffer->nOutputPortIndex); + + GST_DEBUG_OBJECT (core->object, "unref: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer->pAppPrivate, omx_buffer->pBuffer); + + g_mutex_lock (core->omx_state_mutex); + omx_buffer->nFlags |= GST_BUFFERFLAG_UNREF_CHECK; + g_mutex_unlock (core->omx_state_mutex); + + g_omx_port_push_buffer (port, omx_buffer); + break; + } +#endif + default: + GST_WARNING_OBJECT (core->object, "unhandled event: %d", event); + break; + } + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +EmptyBufferDone (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + GOmxCore *core; + GOmxPort *port; + + g_return_val_if_fail (omx_buffer, OMX_ErrorBadParameter); + + core = (GOmxCore*) app_data; + port = get_port (core, omx_buffer->nInputPortIndex); + + GST_DEBUG_OBJECT (core->object, "EBD: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer->pAppPrivate, omx_buffer->pBuffer); + + g_omx_core_got_buffer (core, port, omx_buffer); + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +FillBufferDone (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + GOmxCore *core; + GOmxPort *port; + + g_return_val_if_fail (omx_buffer, OMX_ErrorBadParameter); + + core = (GOmxCore *) app_data; + port = get_port (core, omx_buffer->nOutputPortIndex); + + GST_DEBUG_OBJECT (core->object, "FBD: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer->pAppPrivate, omx_buffer->pBuffer); + + g_omx_core_got_buffer (core, port, omx_buffer); + + return OMX_ErrorNone; +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.h new file mode 100644 index 0000000..b669ced --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_core.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_CORE_H +#define GSTOMX_CORE_H + +#include "gstomx_util.h" + +G_BEGIN_DECLS + +/* Typedefs. */ + +typedef void (*GOmxCb) (GOmxCore *core); +typedef void (*GOmxCbargs2) (GOmxCore *core, gint data1, gint data2); + +/* Structures. */ + +struct GOmxCore +{ + gpointer object; /**< GStreamer element. */ + + OMX_HANDLETYPE omx_handle; + OMX_ERRORTYPE omx_error; + + OMX_STATETYPE omx_state; + GCond *omx_state_condition; + GMutex *omx_state_mutex; + + GPtrArray *ports; + + GSem *done_sem; + GSem *flush_sem; + GSem *port_sem; + + GOmxCb settings_changed_cb; + GOmxCbargs2 index_settings_changed_cb; + + GOmxImp *imp; + + gboolean done; + + gboolean use_timestamps; /** @todo remove; timestamps should always be used */ + + gboolean gen_timestamps; + GstClockTime last_buf_timestamp; +}; + +/* Utility Macros */ + +#define _G_OMX_INIT_PARAM(param) G_STMT_START { /* util for other macros */ \ + memset ((param), 0, sizeof (*(param))); \ + (param)->nSize = sizeof (*(param)); \ + (param)->nVersion.s.nVersionMajor = 1; \ + (param)->nVersion.s.nVersionMinor = 1; \ + } G_STMT_END + +#define G_OMX_CORE_GET_PARAM(core, idx, param) G_STMT_START { \ + _G_OMX_INIT_PARAM (param); \ + OMX_GetParameter (g_omx_core_get_handle (core), (idx), (param)); \ + } G_STMT_END + +#define G_OMX_CORE_SET_PARAM(core, idx, param) \ + OMX_SetParameter ( \ + g_omx_core_get_handle (core), (idx), (param)) + +#define G_OMX_CORE_GET_CONFIG(core, idx, param) G_STMT_START { \ + _G_OMX_INIT_PARAM (param); \ + OMX_GetConfig (g_omx_core_get_handle (core), (idx), (param)); \ + } G_STMT_END + +#define G_OMX_CORE_SET_CONFIG(core, idx, param) \ + OMX_SetConfig ( \ + g_omx_core_get_handle (core), (idx), (param)) + + +/* Functions. */ + +GOmxCore *g_omx_core_new (gpointer object, gpointer klass); +void g_omx_core_free (GOmxCore *core); +void g_omx_core_init (GOmxCore *core); +void g_omx_core_deinit (GOmxCore *core); +void g_omx_core_prepare (GOmxCore *core); +void g_omx_core_start (GOmxCore *core); +void g_omx_core_pause (GOmxCore *core); +void g_omx_core_stop (GOmxCore *core); +void g_omx_core_unload (GOmxCore *core); +void g_omx_core_set_done (GOmxCore *core); +void g_omx_core_wait_for_done (GOmxCore *core); +void g_omx_core_flush_start (GOmxCore *core); +void g_omx_core_flush_stop (GOmxCore *core); +OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core); +GOmxPort *g_omx_core_get_port (GOmxCore *core, const gchar *name, guint index); +void g_omx_core_change_state (GOmxCore *core, OMX_STATETYPE state); + +/* Friend: helpers used by GOmxPort */ +void g_omx_core_got_buffer (GOmxCore *core, + GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer); + +G_END_DECLS + + +#endif /* GSTOMX_CORE_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.c new file mode 100644 index 0000000..03ebc41 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.c @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_dummy.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxDummy, gst_omx_dummy, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_any (); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_any (); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL dummy element"; + details.klass = "None"; + details.description = "Does nothing"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.h new file mode 100644 index 0000000..bd8df97 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_dummy.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_DUMMY_H +#define GSTOMX_DUMMY_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_DUMMY(obj) (GstOmxDummy *) (obj) +#define GST_OMX_DUMMY_TYPE (gst_omx_dummy_get_type ()) + +typedef struct GstOmxDummy GstOmxDummy; +typedef struct GstOmxDummyClass GstOmxDummyClass; + +#include "gstomx_base_filter.h" + +struct GstOmxDummy +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxDummyClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_dummy_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_DUMMY_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.c new file mode 100644 index 0000000..38b6964 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.c @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_filereadersrc.h" +#include "gstomx_base_src.h" +#include "gstomx.h" + +enum +{ + ARG_0, + ARG_FILE_NAME, +}; + +GSTOMX_BOILERPLATE (GstOmxFilereaderSrc, gst_omx_filereadersrc, GstOmxBaseSrc, GST_OMX_BASE_SRC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_any (); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL filereader src element"; + details.klass = "None"; + details.description = "Does nothing"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static gboolean +setcaps (GstBaseSrc *gst_src, + GstCaps *caps) +{ + GstOmxBaseSrc *self; + + self = GST_OMX_BASE_SRC (gst_src); + + GST_INFO_OBJECT (self, "setcaps (src): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + return TRUE; +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseSrc *omx_base; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + /** @todo properly set the capabilities */ +} + +static void +setup_ports (GstOmxBaseSrc *base_src) +{ + GOmxCore *gomx; + GstOmxFilereaderSrc *self; + + self = GST_OMX_FILEREADERSRC (base_src); + gomx = base_src->gomx; + + /* This is specific for Bellagio. */ + { + OMX_INDEXTYPE index; + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.ST.index.param.filereader.inputfilename", &index); + OMX_SetParameter (gomx->omx_handle, index, self->file_name); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxFilereaderSrc *self; + + self = GST_OMX_FILEREADERSRC (obj); + + switch (prop_id) + { + case ARG_FILE_NAME: + if (self->file_name) + { + g_free (self->file_name); + } + self->file_name = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxFilereaderSrc *self; + + self = GST_OMX_FILEREADERSRC (obj); + + switch (prop_id) + { + case ARG_FILE_NAME: + g_value_set_string (value, self->file_name); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GstBaseSrcClass *gst_base_src_class; + GObjectClass *gobject_class; + + gst_base_src_class = GST_BASE_SRC_CLASS (g_class); + gobject_class = G_OBJECT_CLASS (g_class); + + gst_base_src_class->set_caps = setcaps; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_FILE_NAME, + g_param_spec_string ("file-name", "File name", + "The input filename to use", + NULL, G_PARAM_READWRITE)); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseSrc *omx_base; + + omx_base = GST_OMX_BASE_SRC (instance); + + GST_DEBUG_OBJECT (omx_base, "begin"); + + omx_base->setup_ports = setup_ports; + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + GST_DEBUG_OBJECT (omx_base, "end"); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.h new file mode 100644 index 0000000..80224a1 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_filereadersrc.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_FILEREADERSRC_H +#define GSTOMX_FILEREADERSRC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_FILEREADERSRC(obj) (GstOmxFilereaderSrc *) (obj) +#define GST_OMX_FILEREADERSRC_TYPE (gst_omx_filereadersrc_get_type ()) + +typedef struct GstOmxFilereaderSrc GstOmxFilereaderSrc; +typedef struct GstOmxFilereaderSrcClass GstOmxFilereaderSrcClass; + +#include "gstomx_base_src.h" + +struct GstOmxFilereaderSrc +{ + GstOmxBaseSrc omx_base; + + char *file_name; /**< The input file name. */ +}; + +struct GstOmxFilereaderSrcClass +{ + GstOmxBaseSrcClass parent_class; +}; + +GType gst_omx_filereadersrc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_FILEREADERSRC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.c new file mode 100644 index 0000000..22d78db --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.c @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_g711dec.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset, strcmp */ + +/* should this class extend GstOmxBaseAudioDec? */ +GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/x-alaw", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + struc = gst_structure_new ("audio/x-mulaw", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL G.711 audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in G.711 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + const gchar *mode; + gboolean ret = TRUE; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + structure = gst_caps_get_structure (caps, 0); + + mode = gst_structure_get_name (structure); + + /* Output port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 0; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + if (strcmp (mode, "audio/x-alaw") == 0) + param.ePCMMode = OMX_AUDIO_PCMModeALaw; + else if (strcmp (mode, "audio/x-mulaw") == 0) + param.ePCMMode = OMX_AUDIO_PCMModeMULaw; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + ret = gst_pad_set_caps (pad, caps); + + return ret; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.h new file mode 100644 index 0000000..209e617 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_G711DEC_H +#define GSTOMX_G711DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_G711DEC(obj) (GstOmxG711Dec *) (obj) +#define GST_OMX_G711DEC_TYPE (gst_omx_g711dec_get_type ()) + +typedef struct GstOmxG711Dec GstOmxG711Dec; +typedef struct GstOmxG711DecClass GstOmxG711DecClass; + +#include "gstomx_base_filter.h" + +struct GstOmxG711Dec +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxG711DecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_g711dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_G711DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.c new file mode 100644 index 0000000..16d58aa --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_g711enc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset, strcmp */ + +GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/x-alaw", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + struc = gst_structure_new ("audio/x-mulaw", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL G.711 audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in G.711 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstCaps *peer_caps; + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + const gchar *mode; + gboolean ret = TRUE; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + peer_caps = gst_pad_peer_get_caps (omx_base->srcpad); + + g_return_val_if_fail (peer_caps, FALSE); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): peercaps: %" GST_PTR_FORMAT, peer_caps); + + if (gst_caps_get_size (peer_caps) == 0) + goto leave; + + structure = gst_caps_get_structure (peer_caps, 0); + + mode = gst_structure_get_name (structure); + + /* Output port configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + if (strcmp (mode, "audio/x-alaw") == 0) + param.ePCMMode = OMX_AUDIO_PCMModeALaw; + else if (strcmp (mode, "audio/x-mulaw") == 0) + param.ePCMMode = OMX_AUDIO_PCMModeMULaw; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + } + +leave: + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + ret = gst_pad_set_caps (pad, caps); + + gst_caps_unref (peer_caps); + + return ret; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.h new file mode 100644 index 0000000..1678b4b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g711enc.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_G711ENC_H +#define GSTOMX_G711ENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_G711ENC(obj) (GstOmxG711Enc *) (obj) +#define GST_OMX_G711ENC_TYPE (gst_omx_g711enc_get_type ()) + +typedef struct GstOmxG711Enc GstOmxG711Enc; +typedef struct GstOmxG711EncClass GstOmxG711EncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxG711Enc +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxG711EncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_g711enc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_G711ENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.c new file mode 100644 index 0000000..a558011 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.c @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_g729dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/G729", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL G.729 audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in G.729 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +/* should we be overriding the settings_changed_cb from parent class like this?? */ +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.h new file mode 100644 index 0000000..49e525f --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_G729DEC_H +#define GSTOMX_G729DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_G729DEC(obj) (GstOmxG729Dec *) (obj) +#define GST_OMX_G729DEC_TYPE (gst_omx_g729dec_get_type ()) + +typedef struct GstOmxG729Dec GstOmxG729Dec; +typedef struct GstOmxG729DecClass GstOmxG729DecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxG729Dec +{ + GstOmxBaseAudioDec omx_base; +}; + +struct GstOmxG729DecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_g729dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_G729DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.c new file mode 100644 index 0000000..3d7e0c7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.c @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_g729enc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +#define DEFAULT_DTX TRUE + +enum +{ + ARG_0, + ARG_DTX, +}; + +GSTOMX_BOILERPLATE (GstOmxG729Enc, gst_omx_g729enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/G729", + "rate", G_TYPE_INT, 8000, + "channels", G_TYPE_INT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL G.729 audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in G.729 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxG729Enc *self; + + self = GST_OMX_G729ENC (obj); + + switch (prop_id) + { + case ARG_DTX: + self->dtx = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxG729Enc *self; + + self = GST_OMX_G729ENC (obj); + + switch (prop_id) + { + case ARG_DTX: + /** @todo propagate this to OpenMAX when processing. */ + g_value_set_boolean (value, self->dtx); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_DTX, + g_param_spec_boolean ("dtx", "DTX", + "Enable DTX", + DEFAULT_DTX, G_PARAM_READWRITE)); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstOmxBaseFilter *omx_base; + gboolean ret = TRUE; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + if (!caps || gst_caps_get_size (caps) == 0) + goto refuse_caps; + + /* some extreme checking */ + if (!gst_pad_accept_caps (pad, caps)) + goto refuse_caps; + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + /* src template are fixed caps */ + tmp_caps = generate_src_template (); + + ret = gst_pad_set_caps (omx_base->srcpad, tmp_caps); + gst_caps_unref (tmp_caps); + } + + return ret; + + /* ERRORS */ +refuse_caps: + { + GST_WARNING_OBJECT (omx_base, "refused caps %" GST_PTR_FORMAT, caps); + return FALSE; + } +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxG729Enc *self; + GOmxCore *gomx; + + self = GST_OMX_G729ENC (omx_base); + gomx = omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_AUDIO_PARAM_G729TYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_G729TYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m); + + param.bDTX = self->dtx; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m); + } + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxG729Enc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_G729ENC (instance); + + omx_base->omx_setup = omx_setup; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->dtx = DEFAULT_DTX; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.h new file mode 100644 index 0000000..5e7a411 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_g729enc.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_G729ENC_H +#define GSTOMX_G729ENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_G729ENC(obj) (GstOmxG729Enc *) (obj) +#define GST_OMX_G729ENC_TYPE (gst_omx_g729enc_get_type ()) + +typedef struct GstOmxG729Enc GstOmxG729Enc; +typedef struct GstOmxG729EncClass GstOmxG729EncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxG729Enc +{ + GstOmxBaseFilter omx_base; + gboolean dtx; +}; + +struct GstOmxG729EncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_g729enc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_G729ENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.c new file mode 100644 index 0000000..233e041 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_h263dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxH263Dec, gst_omx_h263dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-h263", + "variant", G_TYPE_STRING, "itu", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL H.263 video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in H.263 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingH263; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.h new file mode 100644 index 0000000..b99369f --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_H263DEC_H +#define GSTOMX_H263DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_H263DEC(obj) (GstOmxH263Dec *) (obj) +#define GST_OMX_H263DEC_TYPE (gst_omx_h263dec_get_type ()) + +typedef struct GstOmxH263Dec GstOmxH263Dec; +typedef struct GstOmxH263DecClass GstOmxH263DecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxH263Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxH263DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_h263dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_H263DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.c new file mode 100644 index 0000000..3cff05b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.c @@ -0,0 +1,323 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_h263enc.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE); + +enum +{ + ARG_0, + ARG_PROFILE, + ARG_LEVEL, +}; + +#define DEFAULT_PROFILE OMX_VIDEO_H263ProfileBaseline +#define DEFAULT_LEVEL OMX_VIDEO_H263Level40 + +#define GST_TYPE_OMX_VIDEO_H263PROFILETYPE (gst_omx_video_h263profiletype_get_type ()) +static GType +gst_omx_video_h263profiletype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_H263ProfileBaseline, "Base Profile", "base"}, + {OMX_VIDEO_H263ProfileH320Coding, "H.320 Coding", "h320"}, + {OMX_VIDEO_H263ProfileBackwardCompatible, "Backward Compatible", "backward"}, + {OMX_VIDEO_H263ProfileISWV2, "ISWV2", "isw2"}, + {OMX_VIDEO_H263ProfileISWV3, "ISWV3", "isw3"}, + {OMX_VIDEO_H263ProfileHighCompression, "High Compression", "high-compression"}, + {OMX_VIDEO_H263ProfileInternet, "Internet", "internet"}, + {OMX_VIDEO_H263ProfileInterlace, "Interlace", "interlace"}, + {OMX_VIDEO_H263ProfileHighLatency, "High Latency", "high-latency"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxVideoH263Profile", vals); + } + + return type; +} + +#define GST_TYPE_OMX_VIDEO_H263LEVELTYPE (gst_omx_video_h263leveltype_get_type ()) +static GType +gst_omx_video_h263leveltype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_H263Level10, "Level 10", "level-10"}, + {OMX_VIDEO_H263Level20, "Level 20", "level-20"}, + {OMX_VIDEO_H263Level30, "Level 30", "level-30"}, + {OMX_VIDEO_H263Level40, "Level 40", "level-40"}, + {OMX_VIDEO_H263Level45, "Level 45", "level-45"}, + {OMX_VIDEO_H263Level50, "Level 50", "level-50"}, + {OMX_VIDEO_H263Level60, "Level 60", "level-60"}, + {OMX_VIDEO_H263Level70, "Level 70", "level-70"}, + {0, NULL, NULL}, + }; + + type = g_enum_register_static ("GstOmxVideoH263Level", vals); + } + + return type; +} + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("video/x-h263", + "variant", G_TYPE_STRING, "itu", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL H.263 video encoder"; + details.klass = "Codec/Encoder/Video"; + details.description = "Encodes video in H.263 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *omx_base; + GstOmxH263Enc *self; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_H263ENC (obj); + + switch (prop_id) + { + case ARG_PROFILE: + { + self->profile = g_value_get_enum (value); + break; + } + case ARG_LEVEL: + { + self->level = g_value_get_enum (value); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *omx_base; + GstOmxH263Enc *self; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_H263ENC (obj); + + switch (prop_id) + { + case ARG_PROFILE: + { + g_value_set_enum (value, self->profile); + break; + } + case ARG_LEVEL: + { + g_value_set_enum (value, self->level); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_PROFILE, + g_param_spec_enum ("profile", "H.263 Profile", + "H.263 Profile", + GST_TYPE_OMX_VIDEO_H263PROFILETYPE, + DEFAULT_PROFILE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_LEVEL, + g_param_spec_enum ("level", "H.263 Level", + "H.263 Level", + GST_TYPE_OMX_VIDEO_H263LEVELTYPE, + DEFAULT_LEVEL, + G_PARAM_READWRITE)); + } +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxH263Enc *self; + GOmxCore *gomx; + + self = GST_OMX_H263ENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + { + OMX_VIDEO_PARAM_H263TYPE tParamH263Type; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + _G_OMX_INIT_PARAM (&tParamH263Type); + tParamH263Type.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamVideoH263, + &tParamH263Type); + g_assert (error_val == OMX_ErrorNone); + if (self->profile != 0) + tParamH263Type.eProfile = self->profile; + else + tParamH263Type.eProfile = DEFAULT_PROFILE; + GST_DEBUG_OBJECT (self, "Profile: param=%d", + (gint)tParamH263Type.eProfile); + if (self->level != 0) + tParamH263Type.eLevel = self->level; + else + tParamH263Type.eLevel = DEFAULT_LEVEL; + GST_DEBUG_OBJECT (self, "Level: param=%d", + (gint)tParamH263Type.eLevel); + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamVideoH263, + &tParamH263Type); + g_assert (error_val == OMX_ErrorNone); + } + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseVideoEnc *omx_base; + GstOmxBaseFilter *omx_base_filter; + guint width; + guint height; + + omx_base_filter = core->object; + omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); + + width = param.format.video.nFrameWidth; + height = param.format.video.nFrameHeight; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("video/x-h263", + "variant", G_TYPE_STRING, "itu", + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, + omx_base->framerate_num, omx_base->framerate_denom, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base_filter->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base_filter; + GstOmxBaseVideoEnc *omx_base; + + omx_base_filter = GST_OMX_BASE_FILTER (instance); + omx_base = GST_OMX_BASE_VIDEOENC (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->compression_format = OMX_VIDEO_CodingH263; + + omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.h new file mode 100644 index 0000000..dab4dff --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h263enc.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_H263ENC_H +#define GSTOMX_H263ENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_H263ENC(obj) (GstOmxH263Enc *) (obj) +#define GST_OMX_H263ENC_TYPE (gst_omx_h263enc_get_type ()) + +typedef struct GstOmxH263Enc GstOmxH263Enc; +typedef struct GstOmxH263EncClass GstOmxH263EncClass; + +#include "gstomx_base_videoenc.h" + +struct GstOmxH263Enc +{ + GstOmxBaseVideoEnc omx_base; + OMX_VIDEO_H263PROFILETYPE profile; + OMX_VIDEO_H263LEVELTYPE level; +}; + +struct GstOmxH263EncClass +{ + GstOmxBaseVideoEncClass parent_class; +}; + +GType gst_omx_h263enc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_H263ENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.c new file mode 100755 index 0000000..d59a278 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.c @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_h264dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxH264Dec, gst_omx_h264dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-h264", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL H.264/AVC video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in H.264/AVC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +initialize_port (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE paramPort; + gint width, height; + GOmxPort *port; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + GST_DEBUG_OBJECT (self, "G_OMX_PORT_GET_DEFINITION (output)"); + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶mPort); + + width = self->extendedParams.width; + height = self->extendedParams.height; + + paramPort.nPortIndex = 1; + paramPort.nBufferCountActual = 20;//15;//output_buffer_count + paramPort.format.video.nFrameWidth = width; + paramPort.format.video.nFrameHeight = height; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + paramPort.format.video.xFramerate = (60) << 16; + + GST_DEBUG_OBJECT (self, "nFrameWidth = %ld, nFrameHeight = %ld, nBufferCountActual = %ld", + paramPort.format.video.nFrameWidth, paramPort.format.video.nFrameHeight, + paramPort.nBufferCountActual); + + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION (output)"); + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶mPort); + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶mPort); + //paramPort.nBufferCountActual = 8; + paramPort.format.video.xFramerate = (60) << 16; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶mPort); +#if 0 + port = g_omx_core_get_port (gomx, "input", 0); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + port = g_omx_core_get_port (gomx, "output", 1); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); +#endif + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingAVC; + omx_base->initialize_port = initialize_port; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.h new file mode 100644 index 0000000..81527e9 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_H264DEC_H +#define GSTOMX_H264DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_H264DEC(obj) (GstOmxH264Dec *) (obj) +#define GST_OMX_H264DEC_TYPE (gst_omx_h264dec_get_type ()) + +typedef struct GstOmxH264Dec GstOmxH264Dec; +typedef struct GstOmxH264DecClass GstOmxH264DecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxH264Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxH264DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_h264dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_H264DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.c new file mode 100644 index 0000000..82a2d65 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.c @@ -0,0 +1,396 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_h264enc.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE); + +enum +{ + ARG_0, + ARG_BYTESTREAM, + ARG_PROFILE, + ARG_LEVEL, +}; + +#define DEFAULT_BYTESTREAM FALSE +#define DEFAULT_PROFILE OMX_VIDEO_AVCProfileHigh +#define DEFAULT_LEVEL OMX_VIDEO_AVCLevel4 + +#define GST_TYPE_OMX_VIDEO_AVCPROFILETYPE (gst_omx_video_avcprofiletype_get_type ()) +static GType +gst_omx_video_avcprofiletype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_AVCProfileBaseline, "Base Profile", "base"}, + {OMX_VIDEO_AVCProfileMain, "Main Profile", "main"}, + {OMX_VIDEO_AVCProfileExtended, "Extended Profile", "extended"}, + {OMX_VIDEO_AVCProfileHigh, "High Profile", "high"}, + {OMX_VIDEO_AVCProfileHigh10, "High 10 Profile", "high-10"}, + {OMX_VIDEO_AVCProfileHigh422, "High 4:2:2 Profile", "high-422"}, + {OMX_VIDEO_AVCProfileHigh444, "High 4:4:4 Profile", "high-444"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxVideoAVCProfile", vals); + } + + return type; +} + +#define GST_TYPE_OMX_VIDEO_AVCLEVELTYPE (gst_omx_video_avcleveltype_get_type ()) +static GType +gst_omx_video_avcleveltype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_AVCLevel1, "Level 1", "level-1"}, + {OMX_VIDEO_AVCLevel1b, "Level 1b", "level-1b"}, + {OMX_VIDEO_AVCLevel11, "Level 11", "level-11"}, + {OMX_VIDEO_AVCLevel12, "Level 12", "level-12"}, + {OMX_VIDEO_AVCLevel13, "Level 13", "level-13"}, + {OMX_VIDEO_AVCLevel2, "Level 2", "level-2"}, + {OMX_VIDEO_AVCLevel21, "Level 21", "level-21"}, + {OMX_VIDEO_AVCLevel22, "Level 22", "level-22"}, + {OMX_VIDEO_AVCLevel3, "Level 3", "level-3"}, + {OMX_VIDEO_AVCLevel31, "Level 31", "level-31"}, + {OMX_VIDEO_AVCLevel32, "Level 32", "level-32"}, + {OMX_VIDEO_AVCLevel4, "Level 4", "level-4"}, + {OMX_VIDEO_AVCLevel41, "Level 41", "level-41"}, + {OMX_VIDEO_AVCLevel42, "Level 42", "level-42"}, + {OMX_VIDEO_AVCLevel5, "Level 5", "level-5"}, + {OMX_VIDEO_AVCLevel51, "Level 51", "level-51"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxVideoAVCLevel", vals); + } + + return type; +} + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("video/x-h264", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL H.264/AVC video encoder"; + details.klass = "Codec/Encoder/Video"; + details.description = "Encodes video in H.264/AVC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *omx_base; + GstOmxH264Enc *self; + GOmxCore *gomx; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_H264ENC (obj); + gomx = (GOmxCore*) omx_base->gomx; + + switch (prop_id) + { + case ARG_BYTESTREAM: + self->bytestream = g_value_get_boolean (value); + break; + case ARG_PROFILE: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + tProfileLevel.eProfile = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Profile: param=%d", + (gint)tProfileLevel.eProfile); + + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_LEVEL: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + tProfileLevel.eLevel = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Level: param=%d", + (gint)tProfileLevel.eLevel); + + error_val = OMX_SetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxH264Enc *self; + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_H264ENC (obj); + + switch (prop_id) + { + case ARG_BYTESTREAM: + g_value_set_boolean (value, self->bytestream); + break; + case ARG_PROFILE: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + g_value_set_enum (value, tProfileLevel.eProfile); + + GST_DEBUG_OBJECT (self, "Profile: param=%d", + (gint)tProfileLevel.eProfile); + + break; + } + case ARG_LEVEL: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (gomx->omx_handle, + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + g_value_set_enum (value, tProfileLevel.eLevel); + + GST_DEBUG_OBJECT (self, "Level: param=%d", + (gint)tProfileLevel.eLevel); + + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_BYTESTREAM, + g_param_spec_boolean ("bytestream", "BYTESTREAM", "bytestream", + DEFAULT_BYTESTREAM, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_PROFILE, + g_param_spec_enum ("profile", "H.264 Profile", + "H.264 Profile", + GST_TYPE_OMX_VIDEO_AVCPROFILETYPE, + DEFAULT_PROFILE, + G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_LEVEL, + g_param_spec_enum ("level", "H.264 Level", + "H.264 Level", + GST_TYPE_OMX_VIDEO_AVCLEVELTYPE, + DEFAULT_LEVEL, + G_PARAM_READWRITE)); + + } +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoEnc *self; + GOmxCore *gomx; + + self = GST_OMX_BASE_VIDEOENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_INDEXTYPE index; + + if (OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.VideoEncode.Config.NALFormat", &index) == OMX_ErrorNone) + { + OMX_U32 nal_format; + GstOmxH264Enc *h264enc; + + h264enc = GST_OMX_H264ENC (omx_base); + nal_format = h264enc->bytestream ? 0 : 1; + GST_DEBUG_OBJECT (omx_base, "setting 'OMX.TI.VideoEncode.Config.NALFormat' to %ld", nal_format); + + OMX_SetParameter (gomx->omx_handle, index, &nal_format); + } + else + { + GST_WARNING_OBJECT (omx_base, "'OMX.TI.VideoEncode.Config.NALFormat' unsupported"); + } + } + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseVideoEnc *omx_base; + GstOmxBaseFilter *omx_base_filter; + guint width; + guint height; + + omx_base_filter = core->object; + omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base_filter->out_port, ¶m); + width = param.format.video.nFrameWidth; + height = param.format.video.nFrameHeight; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("video/x-h264", + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, + omx_base->framerate_num, omx_base->framerate_denom, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base_filter->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base_filter; + GstOmxBaseVideoEnc *omx_base; + + omx_base_filter = GST_OMX_BASE_FILTER (instance); + omx_base = GST_OMX_BASE_VIDEOENC (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->compression_format = OMX_VIDEO_CodingAVC; + + omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.h new file mode 100644 index 0000000..9066092 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_h264enc.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_H264ENC_H +#define GSTOMX_H264ENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_H264ENC(obj) (GstOmxH264Enc *) (obj) +#define GST_OMX_H264ENC_TYPE (gst_omx_h264enc_get_type ()) + +typedef struct GstOmxH264Enc GstOmxH264Enc; +typedef struct GstOmxH264EncClass GstOmxH264EncClass; + +#include "gstomx_base_videoenc.h" + +struct GstOmxH264Enc +{ + GstOmxBaseVideoEnc omx_base; + gboolean bytestream; +}; + +struct GstOmxH264EncClass +{ + GstOmxBaseVideoEncClass parent_class; +}; + +GType gst_omx_h264enc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_H264ENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.c new file mode 100644 index 0000000..ff899ac --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.c @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_ilbcdec.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +/* should this class extend GstOmxBaseAudioDec? */ +GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/x-iLBC", + NULL); + + { + GValue list; + GValue val; + + list.g_type = val.g_type = 0; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_INT); + + g_value_set_int (&val, 20); + gst_value_list_append_value (&list, &val); + + g_value_set_int (&val, 30); + gst_value_list_append_value (&list, &val); + + gst_structure_set_value (struc, "mode", &list); + + g_value_unset (&val); + g_value_unset (&list); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL iLBC audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in iLBC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.h new file mode 100644 index 0000000..fcf4da2 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_ILBCDEC_H +#define GSTOMX_ILBCDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_ILBCDEC(obj) (GstOmxIlbcDec *) (obj) +#define GST_OMX_ILBCDEC_TYPE (gst_omx_ilbcdec_get_type ()) + +typedef struct GstOmxIlbcDec GstOmxIlbcDec; +typedef struct GstOmxIlbcDecClass GstOmxIlbcDecClass; + +#include "gstomx_base_filter.h" + +struct GstOmxIlbcDec +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxIlbcDecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_ilbcdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_ILBCDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.c new file mode 100644 index 0000000..1da2c53 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_ilbcenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxIlbcEnc, gst_omx_ilbcenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("audio/x-iLBC", + NULL); + + { + GValue list; + GValue val; + + list.g_type = val.g_type = 0; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&val, G_TYPE_INT); + + g_value_set_int (&val, 20); + gst_value_list_append_value (&list, &val); + + g_value_set_int (&val, 30); + gst_value_list_append_value (&list, &val); + + gst_structure_set_value (struc, "mode", &list); + + g_value_unset (&val); + g_value_unset (&list); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, 8000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", G_TYPE_INT, 1, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL iLBC audio encoder"; + details.klass = "Codec/Encoder/Audio"; + details.description = "Encodes audio in iLBC format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + /* set caps on the srcpad */ + { + GstCaps *tmp_caps; + + tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); + tmp_caps = gst_caps_make_writable (tmp_caps); + gst_caps_truncate (tmp_caps); + + gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); + + if (gst_caps_is_fixed (tmp_caps)) + { + GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); + gst_pad_set_caps (omx_base->srcpad, tmp_caps); + } + + gst_caps_unref (tmp_caps); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.h new file mode 100644 index 0000000..114e803 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_ilbcenc.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_ILBCENC_H +#define GSTOMX_ILBCENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_ILBCENC(obj) (GstOmxIlbcEnc *) (obj) +#define GST_OMX_ILBCENC_TYPE (gst_omx_ilbcenc_get_type ()) + +typedef struct GstOmxIlbcEnc GstOmxIlbcEnc; +typedef struct GstOmxIlbcEncClass GstOmxIlbcEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxIlbcEnc +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxIlbcEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_ilbcenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_ILBCENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.c new file mode 100644 index 0000000..f7828e7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_interface.h" + +GType +gst_omx_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + GTypeInfo *type_info; + + type_info = g_new0 (GTypeInfo, 1); + + type_info->class_size = sizeof (GstOmxClass); + + type = g_type_register_static (G_TYPE_INTERFACE, "GstOmx", type_info, 0); + g_type_interface_add_prerequisite (type, GST_TYPE_IMPLEMENTS_INTERFACE); + } + + return type; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.h new file mode 100644 index 0000000..5804e84 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_interface.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_INTERFACE_H +#define GSTOMX_INTERFACE_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_TYPE_OMX (gst_omx_get_type ()) +#define GST_OMX(obj) (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OMX, GstOmx)) +#define GST_IS_OMX(obj) (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OMX)) + +typedef struct GstOmx GstOmx; + +typedef struct GstOmxClass +{ + GTypeInterface klass; + +} GstOmxClass; + +GType gst_omx_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_INTERFACE_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.c new file mode 100644 index 0000000..88e3478 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.c @@ -0,0 +1,579 @@ +/* + * Created on: Aug 17, 2009 + * + * This is the first version for the jpeg decoder on gst-openmax + * + * Copyright (C) 2009 Texas Instruments - http://www.ti.com/ + * + * Author: + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "gstomx_jpegdec.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> +#include <stdlib.h> + +/*these should change in the future to 864 x 480 (LCD resolution)*/ +#define MAX_WIDTH 176 +#define MAX_HEIGHT 144 + +GSTOMX_BOILERPLATE (GstOmxJpegDec, gst_omx_jpegdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + + +static GstStaticPadTemplate src_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( + GST_VIDEO_CAPS_YUV_STRIDED ( "{ NV12, UYVY }", "[ 0, max ]") ";") +); + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS ("image/jpeg, " + "width = (int)[16,MAX], " + "height = (int)[16,MAX], " + "framerate = (fraction)[0/1,max];") + ); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL JPEG image decoder"; + details.klass = "Codec/Decoder/Image"; + details.description = "Decodes image in JPEG format with OpenMAX IL"; + details.author = "Texas Instrument"; + + gst_element_class_set_details (element_class, &details); + } + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); +} + +/*The properties have not been implemented yet*/ +/*** +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxJpegDec *self; + + self = GST_OMX_JPEGDEC (obj); + + switch (prop_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxJpegDec *self; + + self = GST_OMX_JPEGDEC (obj); + + switch (prop_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} +**/ +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + /*{ + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + } + */ +} +static GstCaps * +fixcaps (GstCaps* mycaps, GstCaps* intercaps) +{ + GstStructure *ins, *outs; + gint my_w, my_h, n_h, n_w; + gint p_w = 0, p_h = 0, i=0; + + /*From preloaded caps we are only taken the fist structure to know width an d height*/ + ins = gst_caps_get_structure (mycaps, 0); + outs = gst_caps_get_structure (intercaps, 0); + + gst_structure_get_int (outs, "width", &p_w); + gst_structure_get_int (outs, "height", &p_h); + gst_structure_get_int (ins, "width", &my_w); + gst_structure_get_int (ins, "height", &my_h); + + if ( p_h && ( my_h >= MAX_HEIGHT) && ( p_h < my_h) ) + { + n_h = GST_ROUND_UP_2 (p_h); + } + else + { + n_h = my_h; + GST_WARNING ( "Height value is missing or resize is not supported for this image size"); + } + if (p_w && ( my_w >= MAX_WIDTH) && (p_w < my_w) ) + { + n_w = GST_ROUND_UP_2 (p_w); + } + else + { + n_w = my_w; + GST_WARNING (" Width value is missing resize is not supported for this image size"); + } + /* now fixate */ + intercaps = gst_caps_make_writable (intercaps); + + for (i=0; i<gst_caps_get_size (intercaps); i++) + { + GstStructure *struc = gst_caps_get_structure (intercaps, i); + gst_structure_set (struc, "width", G_TYPE_INT, n_w, NULL); + gst_structure_set (struc, "height", G_TYPE_INT, n_h, NULL); + } + + return intercaps; +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + GstOmxJpegDec *self; + GstCaps *inter_caps, *fixed_caps, *new_caps; + + omx_base = core->object; + self = GST_OMX_JPEGDEC (omx_base); + + GST_DEBUG_OBJECT (omx_base, "settings changed cb "); + + inter_caps = gst_caps_intersect ( gst_static_pad_template_get_caps (&src_template), + gst_pad_peer_get_caps (omx_base->srcpad)); + + fixed_caps = fixcaps ( gst_pad_get_caps (omx_base->srcpad), inter_caps); + + new_caps = gst_caps_intersect ( fixed_caps, gst_pad_peer_get_caps (omx_base->srcpad)) ; + + if (!gst_caps_is_fixed (new_caps)) + { + gst_caps_do_simplify (new_caps); + gst_pad_fixate_caps (omx_base->srcpad, new_caps); + GST_INFO_OBJECT (omx_base, "pre-fixated caps: %" GST_PTR_FORMAT, new_caps); + } + + gst_pad_set_caps (omx_base->srcpad, new_caps); +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GstOmxJpegDec *self; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE param; + gint width = 0; + gint height = 0; + OMX_COLOR_FORMATTYPE color_format = OMX_COLOR_FormatCbYCrY; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + self = GST_OMX_JPEGDEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + gst_structure_get_boolean (structure, "interlaced", &self->progressive); + + height = GST_ROUND_UP_16 ( height ); + width = GST_ROUND_UP_16 ( width ); + + { + guint32 fourcc; + if (gst_structure_get_fourcc (structure, "format", &fourcc)) + { + color_format = g_omx_fourcc_to_colorformat (fourcc); + } + } + + { + const GValue *framerate = NULL; + framerate = gst_structure_get_value (structure, "framerate"); + if (framerate) + { + self->framerate_num = gst_value_get_fraction_numerator (framerate); + self->framerate_denom = gst_value_get_fraction_denominator (framerate); + if (self->framerate_num == 0) + { + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND,0,1); + } + else + { + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND, + gst_value_get_fraction_denominator (framerate), + gst_value_get_fraction_numerator (framerate)); + } + + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + } + + { + const GValue *codec_data; + GstBuffer *buffer; + + codec_data = gst_structure_get_value (structure, "codec_data"); + if (codec_data) + { + buffer = gst_value_get_buffer (codec_data); + omx_base->codec_data = buffer; + gst_buffer_ref (buffer); + } + } + + /* Input port configuration. */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.eColorFormat = color_format; + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + + return gst_pad_set_caps (pad, caps); + +} + +static gboolean +src_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxJpegDec *self; + GOmxCore *gomx; + GstStructure* structure; + + GstOmxBaseFilter *omx_base; + GstVideoFormat format; + gint width, height, rowstride; + OMX_PARAM_PORTDEFINITIONTYPE param; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + self = GST_OMX_JPEGDEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + GST_INFO_OBJECT (omx_base, "begin set src caps"); + + structure = gst_caps_get_structure (caps, 0); + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + if (gst_video_format_parse_caps_strided (caps, + &format, &width, &height, &rowstride)) + { + param.format.image.eColorFormat = g_omx_gstvformat_to_colorformat (format); + param.nBufferSize = gst_video_format_get_size_strided (format, width, height, rowstride); + + param.format.image.nStride = rowstride; + param.format.image.nFrameWidth = GST_ROUND_UP_2 (width); /*Should be factor of 2 or 16 ?*/ + param.format.image.nFrameHeight = GST_ROUND_UP_2 (height); + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + + GST_INFO_OBJECT (omx_base, "exit set src caps"); + + return TRUE; + } + else + { + GST_WARNING_OBJECT (self, " GST_VIDEO_FORMAT_UNKNOWN "); + return FALSE; + } +} + +static GstCaps * +src_getcaps (GstPad *pad) +{ + GstOmxBaseFilter *omx_base; + GstOmxJpegDec *self; + GstCaps *poss_caps; + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + self = GST_OMX_JPEGDEC (omx_base); + + if (self->outport_configured) + { + OMX_PARAM_PORTDEFINITIONTYPE param; + int i; + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + poss_caps = gst_caps_new_empty (); + + /* note: we only support strided caps if outport buffer is shared: + */ + for (i=0; i<(omx_base->out_port->share_buffer ? 2 : 1); i++) + { + GstStructure *struc = gst_structure_new ( + (i ? "video/x-raw-yuv-strided" : "video/x-raw-yuv"), + "width", G_TYPE_INT, param.format.image.nFrameWidth, + "height", G_TYPE_INT, param.format.image.nFrameHeight, + NULL); + if(i) + { + gst_structure_set (struc, "rowstride", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL); + } + if (self->framerate_denom) + { + gst_structure_set (struc, "framerate", GST_TYPE_FRACTION, self->framerate_num, + self->framerate_denom, NULL); + } + gst_caps_append_structure (poss_caps, struc); + } + + poss_caps = g_omx_port_set_image_formats (omx_base->out_port, poss_caps); + + } + else + { + /* we don't have valid width/height/etc yet, so just use the template.. */ + poss_caps = gst_static_pad_template_get_caps (&src_template); + } + return poss_caps; +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxJpegDec *self; + GOmxCore *gomx; + gint width, height; + OMX_COLOR_FORMATTYPE color_format; + guint32 fourcc; + + self = GST_OMX_JPEGDEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Input port configuration. */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.image.cMIMEType = "OMXJPEGD"; + param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG; + + width = param.format.image.nFrameWidth; + height = param.format.image.nFrameHeight; + param.format.image.nSliceHeight = 0; /*Frame mode , no slice*/ + param.format.image.nStride = 0; + color_format = param.format.image.eColorFormat; + fourcc = g_omx_colorformat_to_fourcc (color_format); + param.nBufferCountActual = 1; + + /* this is against the standard;nBufferSize is read-only. */ + param.nBufferSize = width * height; /*Avoiding to get a biger image that memory allocated*/ + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + + /* Output port configuration. */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + param.format.image.cMIMEType = "OMXJPEGD"; + param.format.image.eCompressionFormat = OMX_IMAGE_CodingUnused; + + /*We are configured the output port with the same values + from input port, except the eColorFormat = NV12*/ + param.nBufferCountActual = 1; + /*No stride format by default, this maybe change after read the peer caps*/ + param.format.image.nStride = 0; + + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.eColorFormat = OMX_COLOR_FormatYUV420PackedSemiPlanar; + + color_format = param.format.image.eColorFormat; + fourcc = g_omx_colorformat_to_fourcc (color_format); + + /* this is against the standard; nBufferSize is read-only. */ + param.nBufferSize = gst_video_format_get_size_strided ( + gst_video_format_from_fourcc (fourcc), width, height, 0); + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + } + self->outport_configured = TRUE; + } + + /*Set parameters*/ +#ifdef OMAP3 + { + OMX_CUSTOM_RESOLUTION pMaxResolution; + OMX_INDEXTYPE index; +#if 0 + /*By the moment properties don't have been added */ + OMX_CUSTOM_IMAGE_DECODE_SECTION pSectionDecode; + OMX_CUSTOM_IMAGE_DECODE_SUBREGION pSubRegionDecode; + OMX_CONFIG_SCALEFACTORTYPE* pScalefactor; + + /* Section decoding */ + memset (&pSectionDecode, 0, sizeof (pSectionDecode)); + pSectionDecode.nSize = sizeof (OMX_CUSTOM_IMAGE_DECODE_SECTION); + + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.JPEG.decode.Param.SectionDecode", &index); + + pSectionDecode.nMCURow = 0; + pSectionDecode.bSectionsInput = OMX_FALSE; + pSectionDecode.bSectionsOutput = OMX_TRUE; + + OMX_SetParameter (gomx->omx_handle, index, &pSectionDecode); + + /* SubRegion decoding */ + memset (&pSubRegionDecode, 0, sizeof (pSubRegionDecode)); + pSubRegionDecode.nSize = sizeof (OMX_CUSTOM_IMAGE_DECODE_SUBREGION); + + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.JPEG.decode.Param.SubRegionDecode", &index); + + pSubRegionDecode.nXOrg = 0; + pSubRegionDecode.nYOrg = 0; + pSubRegionDecode.nXLength = 0; + pSubRegionDecode.nYLength = 0; + + OMX_SetParameter (gomx->omx_handle, index, &pSubRegionDecode); + + /*scale factor*/ + + memset (&pScalefactor, 0, sizeof (pScalefactor)); + pScalefactor.nSize = sizeof (OMX_CONFIG_SCALEFACTORTYPE); + + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.JPEG.decode.Param.SetMaxResolution", &index); + + pScalefactor.xWidth = (OMX_S32) 100; + pScalefactor.xHeight = (OMX_S32) 100; + + OMX_SetParameter (gomx->omx_handle, OMX_IndexConfigCommonScale, &pScalefactor); + +#endif + /*Max resolution */ + memset (&pMaxResolution, 0, sizeof (pMaxResolution)); + + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.JPEG.decode.Param.SetMaxResolution", &index); + + pMaxResolution.nWidth = width; + pMaxResolution.nHeight = height; + + OMX_SetParameter (gomx->omx_handle, index, &pMaxResolution); + } + + /*Set config*/ + { + OMX_INDEXTYPE index; + OMX_U32 nProgressive; + /*Dinamic color change */ + OMX_GetExtensionIndex(gomx->omx_handle, "OMX.TI.JPEG.decode.Config.OutputColorFormat", &index); + + g_assert ( (OMX_SetConfig (gomx->omx_handle, index, &color_format )) == OMX_ErrorNone ); + + /*Progressive image decode*/ + OMX_GetExtensionIndex(gomx->omx_handle, "OMX.TI.JPEG.decode.Config.ProgressiveFactor", &index); + + nProgressive= self->progressive; + + OMX_SetConfig(gomx->omx_handle, index, &(nProgressive)); + + } +#endif + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxJpegDec *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + + self = GST_OMX_JPEGDEC (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + GST_DEBUG_OBJECT (self, "Setup omx_allocate ports = TRUE; "); + omx_base->out_port->omx_allocate = TRUE; + omx_base->out_port->share_buffer = FALSE; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + gst_pad_set_getcaps_function (omx_base->srcpad, + GST_DEBUG_FUNCPTR (src_getcaps)); + + gst_pad_set_setcaps_function (omx_base->srcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); + + self->framerate_num = 0; + self->framerate_denom = 1; + self->progressive = FALSE; + self->outport_configured = FALSE; + +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.h new file mode 100644 index 0000000..f29c8a5 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegdec.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Texas Instruments - http://www.ti.com/ + * + * Author: + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef GSTOMX_JPEGDEC_H +#define GSTOMX_JPEGDEC_H + +#include <gst/gst.h> +#include <gst/video/video.h> + +#include <config.h> + +G_BEGIN_DECLS + +#define GST_OMX_JPEGDEC(obj) (GstOmxJpegDec *) (obj) +#define GST_OMX_JPEGDEC_TYPE (gst_omx_jpegdec_get_type ()) + +typedef struct GstOmxJpegDec GstOmxJpegDec; +typedef struct GstOmxJpegDecClass GstOmxJpegDecClass; + +#include "gstomx_base_filter.h" + +typedef struct OMX_CUSTOM_IMAGE_DECODE_SECTION +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nMCURow; + OMX_U32 nAU; + OMX_BOOL bSectionsInput; + OMX_BOOL bSectionsOutput; +}OMX_CUSTOM_IMAGE_DECODE_SECTION; + +typedef struct OMX_CUSTOM_IMAGE_DECODE_SUBREGION +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nXOrg; /*Sectional decoding: X origin*/ + OMX_U32 nYOrg; /*Sectional decoding: Y origin*/ + OMX_U32 nXLength; /*Sectional decoding: X lenght*/ + OMX_U32 nYLength; /*Sectional decoding: Y lenght*/ +}OMX_CUSTOM_IMAGE_DECODE_SUBREGION; + + +typedef struct OMX_CUSTOM_RESOLUTION +{ + OMX_U32 nWidth; + OMX_U32 nHeight; +}OMX_CUSTOM_RESOLUTION; + +struct GstOmxJpegDec +{ + GstOmxBaseFilter omx_base; + gint framerate_num; + gint framerate_denom; + gboolean progressive; + gboolean outport_configured; + +}; + +struct GstOmxJpegDecClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_jpegdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_JPEGEDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.c new file mode 100644 index 0000000..4dbe581 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.c @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "gstomx_jpegenc.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <gst/video/video.h> +#include <string.h> +#include <stdlib.h> + +enum +{ + ARG_0, + ARG_QUALITY, +}; + +#define DEFAULT_QUALITY 90 + +GSTOMX_BOILERPLATE (GstOmxJpegEnc, gst_omx_jpegenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstStaticPadTemplate src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, GST_PAD_ALWAYS, + GST_STATIC_CAPS ("image/jpeg, " + "width = (int)[16,4096], " + "height = (int)[16,4096], " + "framerate = (fraction)[0/1,max];") + ); + + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ( + GSTOMX_ALL_FORMATS)) + ); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL JPEG image encoder"; + details.klass = "Codec/Encoder/Image"; + details.description = "Encodes image in JPEG format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxJpegEnc *self; + + self = GST_OMX_JPEGENC (obj); + + switch (prop_id) + { + case ARG_QUALITY: + self->quality = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxJpegEnc *self; + + self = GST_OMX_JPEGENC (obj); + + switch (prop_id) + { + case ARG_QUALITY: + g_value_set_uint (value, self->quality); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_QUALITY, + g_param_spec_uint ("quality", "Quality of image", + "Set the quality from 0 to 100", + 0, 100, DEFAULT_QUALITY, G_PARAM_READWRITE)); + } +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + GstOmxJpegEnc *self; + guint width; + guint height; + + omx_base = core->object; + self = GST_OMX_JPEGENC (omx_base); + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + width = param.format.image.nFrameWidth; + height = param.format.image.nFrameHeight; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("image/jpeg", + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, + self->framerate_num, self->framerate_denom, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseFilter *omx_base; + GstOmxJpegEnc *self; + GOmxCore *gomx; + OMX_COLOR_FORMATTYPE color_format = OMX_COLOR_FormatYUV420PackedPlanar; + gint width = 0; + gint height = 0; + + omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); + self = GST_OMX_JPEGENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + + if (!gst_structure_get_fraction (structure, "framerate", + &self->framerate_num, + &self->framerate_denom)) + { + self->framerate_num = 0; + self->framerate_denom = 1; + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND,0,1); + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + + if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) + { + guint32 fourcc; + + if (gst_structure_get_fourcc (structure, "format", &fourcc)) + { + color_format = g_omx_fourcc_to_colorformat (fourcc); + } + } + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Input port configuration. */ + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + param.format.image.eColorFormat = color_format; + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + + return gst_pad_set_caps (pad, caps); +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GstOmxJpegEnc *self; + GOmxCore *gomx; + + self = GST_OMX_JPEGENC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + /* Output port configuration. */ + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG; + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + + /* some workarounds required for TI components. */ + { + guint32 fourcc; + gint width, height; + + /* the component should do this instead */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + width = param.format.image.nFrameWidth; + height = param.format.image.nFrameHeight; + fourcc = g_omx_colorformat_to_fourcc ( + param.format.image.eColorFormat); + + /* this is against the standard; nBufferSize is read-only. */ + param.nBufferSize = gst_video_format_get_size ( + gst_video_format_from_fourcc (fourcc), + GST_ROUND_UP_16 (width), GST_ROUND_UP_16 (height)); + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + } + + /* the component should do this instead */ + { + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); + + param.nBufferSize = width * height; + + param.format.image.nFrameWidth = width; + param.format.image.nFrameHeight = height; + + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶m); + } + } + } + + { + OMX_IMAGE_PARAM_QFACTORTYPE param; + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, ¶m); + + param.nQFactor = self->quality; + + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, ¶m); + } + + GST_INFO_OBJECT (omx_base, "end"); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxJpegEnc *self; + + omx_base = GST_OMX_BASE_FILTER (instance); + self = GST_OMX_JPEGENC (instance); + + omx_base->omx_setup = omx_setup; + + omx_base->gomx->settings_changed_cb = settings_changed_cb; + + gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + + self->framerate_num = 0; + self->framerate_denom = 1; + self->quality = DEFAULT_QUALITY; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.h new file mode 100644 index 0000000..b14a0d0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_jpegenc.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef GSTOMX_JPEGENC_H +#define GSTOMX_JPEGENC_H + +#include <gst/gst.h> + +#include <config.h> + +G_BEGIN_DECLS + +#define GST_OMX_JPEGENC(obj) (GstOmxJpegEnc *) (obj) +#define GST_OMX_JPEGENC_TYPE (gst_omx_jpegenc_get_type ()) + +typedef struct GstOmxJpegEnc GstOmxJpegEnc; +typedef struct GstOmxJpegEncClass GstOmxJpegEncClass; + +#include "gstomx_base_filter.h" + +struct GstOmxJpegEnc +{ + GstOmxBaseFilter omx_base; + + gint framerate_num; + gint framerate_denom; + guint quality; +}; + +struct GstOmxJpegEncClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_jpegenc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_JPEGENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.c new file mode 100644 index 0000000..984b142 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.c @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_mp2dec.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "layer", G_TYPE_INT, 2, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", GST_TYPE_INT_RANGE, 1, 2, + "parsed", G_TYPE_BOOLEAN, TRUE, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL MP2 audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in MP2 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.h new file mode 100644 index 0000000..c6c517e --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp2dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_MP2DEC_H +#define GSTOMX_MP2DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_MP2DEC(obj) (GstOmxMp2Dec *) (obj) +#define GST_OMX_MP2DEC_TYPE (gst_omx_mp2dec_get_type ()) + +typedef struct GstOmxMp2Dec GstOmxMp2Dec; +typedef struct GstOmxMp2DecClass GstOmxMp2DecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxMp2Dec +{ + GstOmxBaseAudioDec omx_base; +}; + +struct GstOmxMp2DecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_mp2dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_MP2DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.c new file mode 100644 index 0000000..424d7c0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.c @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_mp3dec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +#ifdef USE_OMXTIAUDIODEC +# include <TIDspOmx.h> +#endif +#include <OMX_Core.h> + +enum +{ + ARG_0, + ARG_FRAMEMODE, +}; + +#define DEFAULT_FRAMEMODE FALSE + +GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 2, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/mpeg", + "mpegversion", G_TYPE_INT, 1, + "layer", G_TYPE_INT, 3, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "channels", GST_TYPE_INT_RANGE, 1, 8, + "parsed", G_TYPE_BOOLEAN, TRUE, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL MP3 audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in MP3 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxMp3Dec *self; + + self = GST_OMX_MP3DEC (obj); + + switch (prop_id) + { + case ARG_FRAMEMODE: + self->framemode = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxMp3Dec *self; + + self = GST_OMX_MP3DEC (obj); + + switch (prop_id) + { + case ARG_FRAMEMODE: + g_value_set_boolean (value, self->framemode); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + /* This is specific for TI. */ +#ifdef USE_OMXTIAUDIODEC + GOmxCore *gomx = omx_base->gomx; + GstOmxMp3Dec *self; + self = GST_OMX_MP3DEC (omx_base); + { + OMX_INDEXTYPE index; + TI_OMX_DSP_DEFINITION audioinfo; + + memset (&audioinfo, 0, sizeof (audioinfo)); + + audioinfo.framemode = self->framemode; + + g_assert( OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.index.config.mp3headerinfo", + &index) == OMX_ErrorNone); + + g_assert( OMX_SetConfig (gomx->omx_handle, index, &audioinfo)== OMX_ErrorNone); + + GST_DEBUG_OBJECT (omx_base, "OMX_SetConfig OMX.TI.index.config.mp3headerinfo"); + GST_DEBUG_OBJECT (omx_base, "setting frame-mode"); + } +#endif + + /* Output parameter configuration. */ + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + GstOmxBaseAudioDec *base_audiodec; + base_audiodec = GST_OMX_BASE_AUDIODEC (omx_base); + + G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m); + + param.nSamplingRate = base_audiodec->rate; + param.nChannels = base_audiodec->channels; + + G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamAudioPcm, ¶m); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_FRAMEMODE, + g_param_spec_boolean ("framemode", "Frame mode", + "Frame mode", DEFAULT_FRAMEMODE, G_PARAM_READWRITE)); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + GstOmxMp3Dec *self; + + self = GST_OMX_MP3DEC (instance); + + omx_base = GST_OMX_BASE_FILTER (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); + + omx_base->omx_setup = omx_setup; + + self->framemode = DEFAULT_FRAMEMODE; + +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.h new file mode 100644 index 0000000..3144798 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mp3dec.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_MP3DEC_H +#define GSTOMX_MP3DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_MP3DEC(obj) (GstOmxMp3Dec *) (obj) +#define GST_OMX_MP3DEC_TYPE (gst_omx_mp3dec_get_type ()) + +typedef struct GstOmxMp3Dec GstOmxMp3Dec; +typedef struct GstOmxMp3DecClass GstOmxMp3DecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxMp3Dec +{ + GstOmxBaseAudioDec omx_base; + gboolean framemode; +}; + +struct GstOmxMp3DecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_mp3dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_MP3DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.c new file mode 100755 index 0000000..15c5071 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.c @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_mpeg2dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxMpeg2Dec, gst_omx_mpeg2dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +#if 0 +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/mpeg", + "mpegversion",G_TYPE_INT,2, + "systemstream",G_TYPE_BOOLEAN,FALSE, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + /* "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1,*/ + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} +#else +static GstStaticPadTemplate mpeg2dec_sink_template = +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/mpeg, " + "mpegversion = (int) [ 1, 2 ], " + "parsed = (boolean) true, " + "systemstream = (boolean) false, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]") + ); +#endif +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + { +#if 0 + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); +#else + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&mpeg2dec_sink_template)); +#endif + } + { + GstElementDetails details; + + details.longname = "OpenMAX IL MPEG2 video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in MPEG2 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} +#if 0 +static void +initialize_port (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE paramPort; + gint width, height; + GOmxPort *port; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); +#if 1 + GST_DEBUG_OBJECT (self, "G_OMX_PORT_GET_DEFINITION (output)"); + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶mPort); + + width = self->extendedParams.width; + height = self->extendedParams.height; + + paramPort.nPortIndex = 1; + paramPort.nBufferCountActual = 6;//output_buffer_count + paramPort.format.video.nFrameWidth = width; + paramPort.format.video.nFrameHeight = height; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + + GST_DEBUG_OBJECT (self, "nFrameWidth = %ld, nFrameHeight = %ld, nBufferCountActual = %ld", + paramPort.format.video.nFrameWidth, paramPort.format.video.nFrameHeight, + paramPort.nBufferCountActual); + + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION (output)"); + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶mPort); +#endif + port = g_omx_core_get_port (gomx, "in", 0); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + port = g_omx_core_get_port (gomx, "out", 1); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + GST_INFO_OBJECT (omx_base, "end"); +} +#else +#define UTIL_ALIGN(a,b) ((((guint32)(a)) + (b)-1) & (~((guint32)((b)-1)))) +#define PADX 32 +#define PADY 24 + +static void +initialize_port (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE pInPortDef, pOutPortDef; + gint width, height; + GOmxPort *port; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); +#if 1 + width = self->extendedParams.width; + height = self->extendedParams.height; + printf("Width :%d, Height: %d\n",width,height); + GST_DEBUG_OBJECT (self, "G_OMX_PORT_GET_DEFINITION (output)"); + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &pInPortDef); + pInPortDef.nPortIndex = 0; + /* It is input port so direction is set as Input, Empty buffers call would be + accepted based on this */ + pInPortDef.eDir = OMX_DirInput; + /* number of buffers are set here */ + pInPortDef.nBufferCountActual = 4; + pInPortDef.nBufferCountMin = 1; + /* buffer size by deafult is assumed as width * height for input bitstream + which would suffice most of the cases */ + pInPortDef.nBufferSize = width * height; + + pInPortDef.bEnabled = OMX_TRUE; + pInPortDef.bPopulated = OMX_FALSE; + pInPortDef.eDomain = OMX_PortDomainVideo; + pInPortDef.bBuffersContiguous = OMX_FALSE; + pInPortDef.nBufferAlignment = 0x0; + + /* OMX_VIDEO_PORTDEFINITION values for input port */ + pInPortDef.format.video.cMIMEType = "H264"; + pInPortDef.format.video.pNativeRender = NULL; + /* set the width and height, used for buffer size calculation */ + pInPortDef.format.video.nFrameWidth = width; + pInPortDef.format.video.nFrameHeight = height; + /* for bitstream buffer stride is not a valid parameter */ + pInPortDef.format.video.nStride = -1; + /* component supports only frame based processing */ + pInPortDef.format.video.nSliceHeight = 0; + + /* bitrate does not matter for decoder */ + pInPortDef.format.video.nBitrate = 104857600; + /* as per openmax frame rate is in Q16 format */ + pInPortDef.format.video.xFramerate = 60 << 16; + /* input port would receive H264 stream */ + pInPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG2; + /* this is codec setting, OMX component does not support it */ + pInPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* color format is irrelavant */ + pInPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &pInPortDef); + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &pOutPortDef); + pOutPortDef.nPortIndex = 1; + pOutPortDef.eDir = OMX_DirOutput; + /* componet would expect these numbers of buffers to be allocated */ + pOutPortDef.nBufferCountActual = 8; + pOutPortDef.nBufferCountMin = 1; + + /* Codec requires padded height and width and width needs to be aligned at + 128 byte boundary */ + pOutPortDef.nBufferSize = + (UTIL_ALIGN ((width + (2 * PADX)), 128) * ((height + (4 * PADY))) * 3) >> 1; + + pOutPortDef.bEnabled = OMX_TRUE; + pOutPortDef.bPopulated = OMX_FALSE; + pOutPortDef.eDomain = OMX_PortDomainVideo; + /* currently component alloactes contigous buffers with 128 alignment, these + values are do't care */ + pOutPortDef.bBuffersContiguous = OMX_FALSE; + pOutPortDef.nBufferAlignment = 0x0; + + /* OMX_VIDEO_PORTDEFINITION values for output port */ + pOutPortDef.format.video.cMIMEType = "H264"; + pOutPortDef.format.video.pNativeRender = NULL; + pOutPortDef.format.video.nFrameWidth = width; + pOutPortDef.format.video.nFrameHeight = height; + + /* stride is set as buffer width */ + pOutPortDef.format.video.nStride = UTIL_ALIGN (width + (2 * PADX), 128); + pOutPortDef.format.video.nSliceHeight = 0; + + /* bitrate does not matter for decoder */ + pOutPortDef.format.video.nBitrate = 25000000; + /* as per openmax frame rate is in Q16 format */ + pOutPortDef.format.video.xFramerate = 60 << 16; + pOutPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* output is raw YUV 420 SP format, It support only this */ + pOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + pOutPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + + /*GST_DEBUG_OBJECT (self, "nFrameWidth = %ld, nFrameHeight = %ld, nBufferCountActual = %ld", + paramPort.format.video.nFrameWidth, paramPort.format.video.nFrameHeight, + paramPort.nBufferCountActual);*/ + + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION (output)"); + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &pOutPortDef); +#endif + port = g_omx_core_get_port (gomx, "in", 0); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + port = g_omx_core_get_port (gomx, "out", 1); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + GST_INFO_OBJECT (omx_base, "end"); +} + + +#endif +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingMPEG2; + omx_base->initialize_port = initialize_port; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.h new file mode 100755 index 0000000..4561bb1 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg2dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_MPEG2DEC_H +#define GSTOMX_MPEG2DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_MPEG2DEC(obj) (GstOmxMpeg2Dec *) (obj) +#define GST_OMX_MPEG2DEC_TYPE (gst_omx_mpeg2dec_get_type ()) + +typedef struct GstOmxMpeg2Dec GstOmxMpeg2Dec; +typedef struct GstOmxMpeg2DecClass GstOmxMpeg2DecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxMpeg2Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxMpeg2DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_mpeg2dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_MPEG2DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.c new file mode 100755 index 0000000..90dcd1a --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.c @@ -0,0 +1,258 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_mpeg4dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, + "systemstream", G_TYPE_BOOLEAN, FALSE, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + struc = gst_structure_new ("video/x-divx", + "divxversion", GST_TYPE_INT_RANGE, 4, 5, + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + struc = gst_structure_new ("video/x-xvid", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + struc = gst_structure_new ("video/x-3ivx", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL MPEG-4 video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in MPEG-4 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} +#define UTIL_ALIGN(a,b) ((((guint32)(a)) + (b)-1) & (~((guint32)((b)-1)))) +//#define PADX 16 +//#define PADY 16 + +static void +initialize_port (GstOmxBaseFilter *omx_base) +{ + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE pInPortDef, pOutPortDef; + gint width, height; + GOmxPort *port; + OMX_PORT_PARAM_TYPE portInit; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + width = self->extendedParams.width; + height = self->extendedParams.height; + printf("Width :%d, Height: %d\n",width,height); + + _G_OMX_INIT_PARAM (&portInit); + + portInit.nPorts = 2; + portInit.nStartPortNumber = 0; + //OMX_SetParameter (pHandle, OMX_IndexParamVideoInit, &portInit); + G_OMX_PORT_SET_PARAM(omx_base->in_port, OMX_IndexParamVideoInit, &portInit); + + #if 1 + GST_DEBUG_OBJECT (self, "G_OMX_PORT_GET_DEFINITION (output)"); + _G_OMX_INIT_PARAM (&pInPortDef); + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &pInPortDef); + pInPortDef.nPortIndex = 0; + /* It is input port so direction is set as Input, Empty buffers call would be + accepted based on this */ + pInPortDef.eDir = OMX_DirInput; + /* number of buffers are set here */ + pInPortDef.nBufferCountActual = 4; + pInPortDef.nBufferCountMin = 1; + /* buffer size by deafult is assumed as width * height for input bitstream + which would suffice most of the cases */ + pInPortDef.nBufferSize = width * height; + + pInPortDef.bEnabled = OMX_TRUE; + pInPortDef.bPopulated = OMX_FALSE; + pInPortDef.eDomain = OMX_PortDomainVideo; + pInPortDef.bBuffersContiguous = OMX_FALSE; + pInPortDef.nBufferAlignment = 0x0; + + /* OMX_VIDEO_PORTDEFINITION values for input port */ + pInPortDef.format.video.cMIMEType = "H264"; + pInPortDef.format.video.pNativeRender = NULL; + /* set the width and height, used for buffer size calculation */ + pInPortDef.format.video.nFrameWidth = width; + pInPortDef.format.video.nFrameHeight = height; + /* for bitstream buffer stride is not a valid parameter */ + pInPortDef.format.video.nStride = -1; + /* component supports only frame based processing */ + pInPortDef.format.video.nSliceHeight = 0; + + /* bitrate does not matter for decoder */ + pInPortDef.format.video.nBitrate = 104857600; + /* as per openmax frame rate is in Q16 format */ + pInPortDef.format.video.xFramerate = 60 << 16; + /* input port would receive H264 stream */ + pInPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4; + /* this is codec setting, OMX component does not support it */ + pInPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* color format is irrelavant */ + pInPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &pInPortDef); +#endif +#if 1 + _G_OMX_INIT_PARAM (&pOutPortDef); + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &pOutPortDef); + pOutPortDef.nPortIndex = 1; + pOutPortDef.eDir = OMX_DirOutput; + /* componet would expect these numbers of buffers to be allocated */ + pOutPortDef.nBufferCountActual = 8; + pOutPortDef.nBufferCountMin = 1; + + /* Codec requires padded height and width and width needs to be aligned at + 128 byte boundary */ + pOutPortDef.nBufferSize = + (UTIL_ALIGN ((width + (2 * 16)), 128) * ((height + (4 * 16))) * 3) >> 1; + + pOutPortDef.bEnabled = OMX_TRUE; + pOutPortDef.bPopulated = OMX_FALSE; + pOutPortDef.eDomain = OMX_PortDomainVideo; + /* currently component alloactes contigous buffers with 128 alignment, these + values are do't care */ + pOutPortDef.bBuffersContiguous = OMX_FALSE; + pOutPortDef.nBufferAlignment = 0x0; + + /* OMX_VIDEO_PORTDEFINITION values for output port */ + pOutPortDef.format.video.cMIMEType = "H264"; + pOutPortDef.format.video.pNativeRender = NULL; + pOutPortDef.format.video.nFrameWidth = width; + pOutPortDef.format.video.nFrameHeight = height; + + /* stride is set as buffer width */ + pOutPortDef.format.video.nStride = UTIL_ALIGN (width + (2 * 16), 128); + pOutPortDef.format.video.nSliceHeight = 0; + + /* bitrate does not matter for decoder */ + pOutPortDef.format.video.nBitrate = 25000000; + /* as per openmax frame rate is in Q16 format */ + pOutPortDef.format.video.xFramerate = 60 << 16; + pOutPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* output is raw YUV 420 SP format, It support only this */ + pOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + pOutPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + + /*GST_DEBUG_OBJECT (self, "nFrameWidth = %ld, nFrameHeight = %ld, nBufferCountActual = %ld", + paramPort.format.video.nFrameWidth, paramPort.format.video.nFrameHeight, + paramPort.nBufferCountActual);*/ + + GST_DEBUG_OBJECT (self, "G_OMX_PORT_SET_DEFINITION (output)"); + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &pOutPortDef); +#endif +#if 0 + port = g_omx_core_get_port (gomx, "in", 0); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + port = g_omx_core_get_port (gomx, "out", 1); + + GST_DEBUG_OBJECT(self, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); +#endif + GST_INFO_OBJECT (omx_base, "end"); +} + + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingMPEG4; + omx_base->initialize_port = initialize_port; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.h new file mode 100644 index 0000000..ed35ac0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_MPEG4DEC_H +#define GSTOMX_MPEG4DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_MPEG4DEC(obj) (GstOmxMpeg4Dec *) (obj) +#define GST_OMX_MPEG4DEC_TYPE (gst_omx_mpeg4dec_get_type ()) + +typedef struct GstOmxMpeg4Dec GstOmxMpeg4Dec; +typedef struct GstOmxMpeg4DecClass GstOmxMpeg4DecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxMpeg4Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxMpeg4DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_mpeg4dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_MPEG4DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.c new file mode 100644 index 0000000..0d9ed6d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.c @@ -0,0 +1,340 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_mpeg4enc.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE); + +enum +{ + ARG_0, + ARG_PROFILE, + ARG_LEVEL, +}; + +#define DEFAULT_PROFILE OMX_VIDEO_MPEG4ProfileSimple +#define DEFAULT_LEVEL OMX_VIDEO_MPEG4Level5 + +#define GST_TYPE_OMX_VIDEO_MPEG4PROFILETYPE (gst_omx_video_mpeg4profiletype_get_type ()) +static GType +gst_omx_video_mpeg4profiletype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_MPEG4ProfileSimple, "Simple Profile", "simple"}, + {0, NULL, NULL }, + }; + + + type = g_enum_register_static ("GstOmxVideoMPEG4Profile", vals); + } + + return type; +} + +#define GST_TYPE_OMX_VIDEO_MPEG4LEVELTYPE (gst_omx_video_mpeg4leveltype_get_type ()) +static GType +gst_omx_video_mpeg4leveltype_get_type () +{ + static GType type = 0; + + if (!type) + { + static const GEnumValue vals[] = + { + {OMX_VIDEO_MPEG4Level0, "Level 0", "level-0"}, + {OMX_VIDEO_MPEG4Level1, "Level 1", "level-1"}, + {OMX_VIDEO_MPEG4Level2, "Level 2", "level-2"}, + {OMX_VIDEO_MPEG4Level3, "Level 3", "level-3"}, + {OMX_VIDEO_MPEG4Level4, "Level 4", "level-4"}, + {OMX_VIDEO_MPEG4Level4a, "Level 4a", "level-4a"}, + {OMX_VIDEO_MPEG4Level5, "Level 5", "level-5"}, + {0, NULL, NULL }, + }; + + type = g_enum_register_static ("GstOmxVideoMPEG4Level", vals); + } + + return type; +} + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("video/mpeg", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + "mpegversion", G_TYPE_INT, 4, + "systemstream", G_TYPE_BOOLEAN, FALSE, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL MPEG-4 video encoder"; + details.klass = "Codec/Encoder/Video"; + details.description = "Encodes video in MPEG-4 format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxBaseFilter *omx_base; + GstOmxMpeg4Enc *self; + GOmxCore *gomx; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_MPEG4ENC (obj); + gomx = (GOmxCore*) omx_base->gomx; + + switch (prop_id) + { + case ARG_PROFILE: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + tProfileLevel.eProfile = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Profile: param=%d", + (gint)tProfileLevel.eProfile); + + error_val = OMX_SetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + break; + } + case ARG_LEVEL: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + tProfileLevel.eLevel = g_value_get_enum (value); + GST_DEBUG_OBJECT (self, "Level: param=%d", + (gint)tProfileLevel.eLevel); + + error_val = OMX_SetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxMpeg4Enc *self; + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (obj); + self = GST_OMX_MPEG4ENC (obj); + + switch (prop_id) + { + case ARG_PROFILE: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + g_value_set_enum (value, tProfileLevel.eProfile); + + GST_DEBUG_OBJECT (self, "Profile: param=%d", + (gint)tProfileLevel.eProfile); + + break; + } + case ARG_LEVEL: + { + OMX_VIDEO_PARAM_PROFILELEVELTYPE tProfileLevel; + GOmxCore *gomx; + OMX_ERRORTYPE error_val = OMX_ErrorNone; + + gomx = (GOmxCore *) omx_base->gomx; + _G_OMX_INIT_PARAM (&tProfileLevel); + tProfileLevel.nPortIndex = omx_base->out_port->port_index; + error_val = OMX_GetParameter (g_omx_core_get_handle (gomx), + OMX_IndexParamVideoProfileLevelCurrent, + &tProfileLevel); + g_assert (error_val == OMX_ErrorNone); + g_value_set_enum (value, tProfileLevel.eLevel); + + GST_DEBUG_OBJECT (self, "Level: param=%d", + (gint)tProfileLevel.eLevel); + + break; + } + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS (g_class); + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_PROFILE, + g_param_spec_enum ("profile", "MPEG4 Profile", + "MPEG4 Profile", + GST_TYPE_OMX_VIDEO_MPEG4PROFILETYPE, + DEFAULT_PROFILE, + G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LEVEL, + g_param_spec_enum ("level", "MPEG4 Level", + "MPEG4 Level", + GST_TYPE_OMX_VIDEO_MPEG4LEVELTYPE, + DEFAULT_LEVEL, + G_PARAM_READWRITE)); + } +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseVideoEnc *omx_base; + GstOmxBaseFilter *omx_base_filter; + guint width; + guint height; + + omx_base_filter = core->object; + omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_PARAM_PORTDEFINITIONTYPE param; + + G_OMX_PORT_GET_DEFINITION (omx_base_filter->out_port, ¶m); + + width = param.format.video.nFrameWidth; + height = param.format.video.nFrameHeight; + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("video/mpeg", + "mpegversion", G_TYPE_INT, 4, + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, + omx_base->framerate_num, omx_base->framerate_denom, + "systemstream", G_TYPE_BOOLEAN, FALSE, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base_filter->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base_filter; + GstOmxBaseVideoEnc *omx_base; + + omx_base_filter = GST_OMX_BASE_FILTER (instance); + omx_base = GST_OMX_BASE_VIDEOENC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingMPEG4; + + omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.h new file mode 100644 index 0000000..9fab0b4 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_mpeg4enc.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_MPEG4ENC_H +#define GSTOMX_MPEG4ENC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_MPEG4ENC(obj) (GstOmxMpeg4Enc *) (obj) +#define GST_OMX_MPEG4ENC_TYPE (gst_omx_mpeg4enc_get_type ()) + +typedef struct GstOmxMpeg4Enc GstOmxMpeg4Enc; +typedef struct GstOmxMpeg4EncClass GstOmxMpeg4EncClass; + +#include "gstomx_base_videoenc.h" + +struct GstOmxMpeg4Enc +{ + GstOmxBaseVideoEnc omx_base; +}; + +struct GstOmxMpeg4EncClass +{ + GstOmxBaseVideoEncClass parent_class; +}; + +GType gst_omx_mpeg4enc_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_MPEG4ENC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.c new file mode 100644 index 0000000..1bd31ec --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.c @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_noisefilter.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxNoiseFilter, gst_omx_noisefilter, GstOmxBaseVfpc, GST_OMX_BASE_VFPC_TYPE); + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ( + "{YUY2}", "[ 0, max ]")) + ); + +static GstStaticPadTemplate src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ( "{NV12}" )) + ); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL for OMX.TI.VPSSM3.VFPC.NF component"; + details.klass = "Filter"; + details.description = "Noise filter using VPSS Noise filter module"; + details.author = "Brijesh Singh"; + + gst_element_class_set_details (element_class, &details); + } + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static GstCaps* +create_src_caps (GstOmxBaseFilter *omx_base) +{ + GstCaps *caps; + GstOmxBaseVfpc *self; + GstStructure *struc; + + self = GST_OMX_BASE_VFPC (omx_base); + + caps = gst_caps_new_empty (); + struc = gst_structure_new (("video/x-raw-yuv"), + "width", G_TYPE_INT, self->in_width, + "height", G_TYPE_INT, self->in_height, + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N', 'V', '1', '2'), + NULL); + + if (self->framerate_denom) + { + gst_structure_set (struc, + "framerate", GST_TYPE_FRACTION, self->framerate_num, self->framerate_denom, NULL); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GOmxCore *gomx; + OMX_ERRORTYPE err; + OMX_PARAM_PORTDEFINITIONTYPE paramPort; + OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg; + OMX_PARAM_VFPC_NUMCHANNELPERHANDLE numChannels; + OMX_CONFIG_VIDCHANNEL_RESOLUTION chResolution; + OMX_CONFIG_ALG_ENABLE algEnable; + GstOmxBaseVfpc *self; + + gomx = (GOmxCore *) omx_base->gomx; + self = GST_OMX_BASE_VFPC (omx_base); + + GST_LOG_OBJECT (self, "begin"); + + /* set the output cap */ + gst_pad_set_caps (omx_base->srcpad, create_src_caps (omx_base)); + + /* Setting Memory type at input port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting input port to Raw memory"); + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->input_port_index; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Setting Memory type at output port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting output port to Raw memory"); + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->output_port_index; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Input port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (input)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶mPort); + paramPort.format.video.nFrameWidth = self->in_width; + paramPort.format.video.nFrameHeight = self->in_height; + paramPort.format.video.nStride = self->in_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; + paramPort.nBufferSize = self->in_stride * self->in_height; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶mPort); + g_omx_port_setup (omx_base->in_port, ¶mPort); + + /* Output port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (output)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶mPort); + paramPort.format.video.nFrameWidth = self->out_width; + paramPort.format.video.nFrameHeight = self->out_height; + paramPort.format.video.nStride = self->out_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + paramPort.nBufferSize = self->out_stride * self->out_height * 1.5; + paramPort.nBufferCountActual = 3; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶mPort); + g_omx_port_setup (omx_base->out_port, ¶mPort); + + /* Set number of channles */ + GST_LOG_OBJECT (self, "Setting number of channels"); + + _G_OMX_INIT_PARAM (&numChannels); + numChannels.nNumChannelsPerHandle = 1; + err = OMX_SetParameter (gomx->omx_handle, + (OMX_INDEXTYPE) OMX_TI_IndexParamVFPCNumChPerHandle, &numChannels); + + if (err != OMX_ErrorNone) + return; + + /* Set input channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (input)"); + + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->in_width; + chResolution.Frm0Height = self->in_height; + chResolution.Frm0Pitch = self->in_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = self->left; + chResolution.FrmStartY = self->top; + chResolution.FrmCropWidth = 0; + chResolution.FrmCropHeight = 0; + chResolution.eDir = OMX_DirInput; + chResolution.nChId = 0; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + /* Set output channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (output)"); + + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->out_width; + chResolution.Frm0Height = self->out_height; + chResolution.Frm0Pitch = self->out_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = 0; + chResolution.FrmStartY = 0; + chResolution.FrmCropWidth = 0; + chResolution.FrmCropHeight = 0; + chResolution.eDir = OMX_DirOutput; + chResolution.nChId = 0; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + _G_OMX_INIT_PARAM (&algEnable); + algEnable.nPortIndex = 0; + algEnable.nChId = 0; + algEnable.bAlgBypass = OMX_FALSE; + + err = OMX_SetConfig (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexConfigAlgEnable, &algEnable); + + if (err != OMX_ErrorNone) + return; +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVfpc *self; + + self = GST_OMX_BASE_VFPC (instance); + + self->omx_setup = omx_setup; + g_object_set (self, "port-index", 0, NULL); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.h new file mode 100644 index 0000000..cd2f2df --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_noisefilter.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_NOISEFILTER_H +#define GSTOMX_NOISEFILTER_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_NOISEFILTER(obj) (GstOmxNoiseFilter *) (obj) +#define GST_OMX_NOISEFILTER_TYPE (gst_omx_noisefilter_get_type ()) + +typedef struct GstOmxNoiseFilter GstOmxNoiseFilter; +typedef struct GstOmxNoiseFilterClass GstOmxNoiseFilterClass; + +#include "gstomx_base_vfpc.h" + +struct GstOmxNoiseFilter +{ + GstOmxBaseVfpc omx_base; +}; + +struct GstOmxNoiseFilterClass +{ + GstOmxBaseVfpcClass parent_class; +}; + +GType gst_omx_noisefilter_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_NOISEFILTER_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.c new file mode 100755 index 0000000..7f792fe --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.c @@ -0,0 +1,1276 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <string.h> + +#include "gstomx_util.h" +#include "gstomx_port.h" +#include "gstomx.h" +#include "gstomx_base_filter.h" +#include "gstomx_base_videodec.h" +#include "gstomx_buffertransport.h" + +#ifdef USE_OMXTICORE +# include <OMX_TI_Common.h> +# include <OMX_TI_Index.h> +#endif + +GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug); + +#ifndef OMX_BUFFERFLAG_CODECCONFIG +# define OMX_BUFFERFLAG_CODECCONFIG 0x00000080 /* special nFlags field to use to indicated codec-data */ +#endif + +static OMX_BUFFERHEADERTYPE * request_buffer (GOmxPort *port); +static void release_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer); +static void setup_shared_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer); + +#define DEBUG(port, fmt, args...) \ + GST_DEBUG ("<%s:%s> "fmt, GST_OBJECT_NAME ((port)->core->object), (port)->name, ##args) +#define LOG(port, fmt, args...) \ + GST_LOG ("<%s:%s> "fmt, GST_OBJECT_NAME ((port)->core->object), (port)->name, ##args) +#define WARNING(port, fmt, args...) \ + GST_WARNING ("<%s:%s> "fmt, GST_OBJECT_NAME ((port)->core->object), (port)->name, ##args) + +/* + * Port + */ + +GOmxPort * +g_omx_port_new (GOmxCore *core, const gchar *name, guint index) +{ + GOmxPort *port = g_new0 (GOmxPort, 1); + + port->core = core; + port->name = g_strdup_printf ("%s:%d", name, index); + port->port_index = index; + port->num_buffers = 0; + port->buffers = NULL; + + port->enabled = TRUE; + port->queue = async_queue_new (); + port->mutex = g_mutex_new (); + + port->ignore_count = 0; + port->n_offset = 0; + port->vp6_hack = FALSE; + + return port; +} + +void +g_omx_port_free (GOmxPort *port) +{ + DEBUG (port, "begin"); + + g_mutex_free (port->mutex); + async_queue_free (port->queue); + + g_free (port->name); + + g_free (port->buffers); + g_free (port); + + GST_DEBUG ("end"); +} + +void +g_omx_port_setup (GOmxPort *port, + OMX_PARAM_PORTDEFINITIONTYPE *omx_port) +{ + GOmxPortType type = -1; + + switch (omx_port->eDir) + { + case OMX_DirInput: + type = GOMX_PORT_INPUT; + break; + case OMX_DirOutput: + type = GOMX_PORT_OUTPUT; + break; + default: + break; + } + + port->type = type; + /** @todo should it be nBufferCountMin? */ + port->num_buffers = omx_port->nBufferCountActual; + port->port_index = omx_port->nPortIndex; + + DEBUG (port, "type=%d, num_buffers=%d, port_index=%d", + port->type, port->num_buffers, port->port_index); + + /* I don't think it is valid for buffers to be allocated at this point.. + * if there is a case where it is, then call g_omx_port_free_buffers() + * here instead: + */ + g_return_if_fail (!port->buffers); +} + +static GstBuffer * +buffer_alloc (GOmxPort *port, gint len) +{ + GstBuffer *buf = NULL; + + if (port->buffer_alloc) + buf = port->buffer_alloc (port, len); + + if (!buf) + buf = gst_buffer_new_and_alloc (len); + + return buf; +} + + +/** + * Ensure that srcpad caps are set before beginning transition-to-idle or + * transition-to-loaded. This is a bit ugly, because it requires pad-alloc'ing + * a buffer from the downstream element for no particular purpose other than + * triggering upstream caps negotiation from the sink.. + */ +void +g_omx_port_prepare (GOmxPort *port) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + GstBuffer *buf; + guint size; + + DEBUG (port, "begin"); + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + buf = buffer_alloc (port, size); + + if (GST_BUFFER_SIZE (buf) != size) + { + DEBUG (port, "buffer sized changed, %d->%d", + size, GST_BUFFER_SIZE (buf)); + } + + /* number of buffers could have changed */ + G_OMX_PORT_GET_DEFINITION (port, ¶m); + port->num_buffers = param.nBufferCountActual; + + gst_buffer_unref (buf); + +/* REVISIT: In WBU code these macros are implemented in OMX_TI_Core.h and EZSDK is missing it hence + commenting out code for now + */ +#if 0 +#ifdef USE_OMXTICORE + if (port->share_buffer) + { + OMX_TI_PARAM_BUFFERPREANNOUNCE param; + OMX_TI_CONFIG_BUFFERREFCOUNTNOTIFYTYPE config; + + G_OMX_PORT_GET_PARAM (port, OMX_TI_IndexParamBufferPreAnnouncement, ¶m); + param.bEnabled = FALSE; + G_OMX_PORT_SET_PARAM (port, OMX_TI_IndexParamBufferPreAnnouncement, ¶m); + + G_OMX_PORT_GET_CONFIG (port, OMX_TI_IndexConfigBufferRefCountNotification, &config); + config.bNotifyOnDecrease = TRUE; + config.bNotifyOnIncrease = FALSE; + config.nCountForNotification = 1; + G_OMX_PORT_SET_CONFIG (port, OMX_TI_IndexConfigBufferRefCountNotification, &config); + } +#endif +#endif + DEBUG (port, "end"); +} + +void +g_omx_port_allocate_buffers (GOmxPort *port) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + guint i; + guint size; + OMX_ERRORTYPE eError = OMX_ErrorNone; + + if (port->buffers) + return; + + DEBUG (port, "begin"); + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers); + + for (i = 0; i < port->num_buffers; i++) + { + + if (port->omx_allocate) + { + + DEBUG (port, "%d: OMX_AllocateBuffer(), size=%d", i, size); + eError = OMX_AllocateBuffer (port->core->omx_handle, + &port->buffers[i], + port->port_index, + NULL, + size); + if (eError != OMX_ErrorNone) { + DEBUG (port, "%d: OMX_AllocateBuffer(), returned=%x", eError); + } + + g_return_if_fail (port->buffers[i]); + } + else + { + gpointer buffer_data = NULL; + + if (!port->always_copy) + { + buffer_data = port->share_buffer_info->pBuffer[i]; + } + else if (! port->share_buffer) + { + buffer_data = g_malloc (size); + } + + DEBUG (port, "%d: OMX_UseBuffer(), size=%d, share_buffer=%d", i, size, port->share_buffer); + OMX_UseBuffer (port->core->omx_handle, + &port->buffers[i], + port->port_index, + NULL, + size, + buffer_data); + + g_return_if_fail (port->buffers[i]); + + if (port->share_buffer) + { + /* we will need this later: */ + port->buffers[i]->nAllocLen = size; + } + } + } + + DEBUG (port, "end"); +} + +void +g_omx_port_free_buffers (GOmxPort *port) +{ + guint i; + + if (!port->buffers) + return; + + DEBUG (port, "begin"); + + for (i = 0; i < port->num_buffers; i++) + { + OMX_BUFFERHEADERTYPE *omx_buffer; + + /* pop the buffer, to be sure that it has been returned from the + * OMX component, to avoid freeing a buffer that the component + * is still accessing: + */ + omx_buffer = async_queue_pop_full (port->queue, TRUE, TRUE); + + if (omx_buffer) + { +#if 0 + /** @todo how shall we free that buffer? */ + if (!port->omx_allocate) + { + g_free (omx_buffer->pBuffer); + omx_buffer->pBuffer = NULL; + } +#endif + + DEBUG (port, "OMX_FreeBuffer(%p)", omx_buffer); + OMX_FreeBuffer (port->core->omx_handle, port->port_index, omx_buffer); + port->buffers[i] = NULL; + } + } + + g_free (port->buffers); + port->buffers = NULL; + + DEBUG (port, "end"); +} + +void +g_omx_port_start_buffers (GOmxPort *port) +{ + guint i; + + if (!port->enabled) + return; + + g_return_if_fail (port->buffers); + + DEBUG (port, "begin"); + + for (i = 0; i < port->num_buffers; i++) + { + OMX_BUFFERHEADERTYPE *omx_buffer; + + omx_buffer = port->buffers[i]; + + /* If it's an input port we will need to fill the buffer, so put it in + * the queue, otherwise send to omx for processing (fill it up). */ + if (port->type == GOMX_PORT_INPUT) + { + if (port->always_copy) + g_omx_core_got_buffer (port->core, port, omx_buffer); + } + else + { + setup_shared_buffer (port, omx_buffer); + release_buffer (port, omx_buffer); + } + } + + DEBUG (port, "end"); +} + +void +g_omx_port_push_buffer (GOmxPort *port, + OMX_BUFFERHEADERTYPE *omx_buffer) +{ + if (!port->always_copy && omx_buffer->pAppPrivate) + { + gst_buffer_unref (omx_buffer->pAppPrivate); + omx_buffer->pAppPrivate = NULL; + } + + async_queue_push (port->queue, omx_buffer); +} + +static gint +omxbuffer_index (GOmxPort *port, OMX_U8 *pBuffer) +{ + int i; + + for (i=0; i < port->num_buffers; i++) + if (port->buffers[i]->pBuffer == pBuffer) + return i; + + return -1; +} + + +static OMX_BUFFERHEADERTYPE * +request_buffer (GOmxPort *port) +{ + LOG (port, "request buffer"); + return async_queue_pop (port->queue); +} + +static void +release_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer) +{ + + OMX_ERRORTYPE eError = OMX_ErrorNone; + + + switch (port->type) + { + case GOMX_PORT_INPUT: + DEBUG (port, "ETB: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer ? omx_buffer->pAppPrivate : 0, omx_buffer ? omx_buffer->pBuffer : 0); + if(omx_buffer->nFilledLen != 0) { + eError = OMX_EmptyThisBuffer (port->core->omx_handle, omx_buffer); + if (eError != OMX_ErrorNone) { + DEBUG (port, "Empty this buffer returned eError =%x",eError); + } + } + else{ + DEBUG (port, "filled length is zero put back into queue "); + g_omx_port_push_buffer(port, omx_buffer); + } + break; + case GOMX_PORT_OUTPUT: + DEBUG (port, "FTB: omx_buffer=%p, pAppPrivate=%p, pBuffer=%p", + omx_buffer, omx_buffer ? omx_buffer->pAppPrivate : 0, omx_buffer ? omx_buffer->pBuffer : 0); + eError = OMX_FillThisBuffer (port->core->omx_handle, omx_buffer); + if (eError != OMX_ErrorNone) { + + } + break; + default: + break; + } + + + +} + +/* NOTE ABOUT BUFFER SHARING: + * + * Buffer sharing is a sort of "extension" to OMX to allow zero copy buffer + * passing between GST and OMX. + * + * There are only two cases: + * + * 1) shared_buffer is enabled, in which case we control nOffset, and use + * pAppPrivate to store the reference to the original GstBuffer that + * pBuffer ptr is copied from. Note that in case of input buffers, + * the DSP/coprocessor should treat the buffer as read-only so cache- + * line alignment is not an issue. For output buffers which are not + * pad_alloc()d, some care may need to be taken to ensure proper buffer + * alignment. + * 2) shared_buffer is not enabled, in which case we respect the nOffset + * set by the component and pAppPrivate is NULL + * + */ + +static void +setup_shared_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer) +{ + if (port->share_buffer) + { + GstBuffer *new_buf = buffer_alloc (port, omx_buffer->nAllocLen); + + omx_buffer->pAppPrivate = new_buf; + omx_buffer->pBuffer = GST_BUFFER_DATA (new_buf); + omx_buffer->nAllocLen = GST_BUFFER_SIZE (new_buf); + omx_buffer->nOffset = 0; + omx_buffer->nFlags = 0; + + /* special hack.. this should be removed: */ + omx_buffer->nFlags |= OMX_BUFFERHEADERFLAG_MODIFIED; + } + else + { + g_assert (omx_buffer->pBuffer && !omx_buffer->pAppPrivate); + } +} + +typedef void (*SendPrep) (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, gpointer obj); + +static void +send_prep_codec_data (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstBuffer *buf) +{ + omx_buffer->nFlags |= OMX_BUFFERFLAG_CODECCONFIG; + omx_buffer->nFilledLen = GST_BUFFER_SIZE (buf); + + if (port->share_buffer) + { + omx_buffer->nOffset = 0; + omx_buffer->pBuffer = malloc (omx_buffer->nFilledLen); + } + + if (port->always_copy) + { + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen); + } +} + +static void +send_prep_buffer_data (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstBuffer *buf) +{ + if (port->share_buffer) + { + omx_buffer->nOffset = port->n_offset; + omx_buffer->pBuffer = GST_BUFFER_DATA (buf); + omx_buffer->nFilledLen = GST_BUFFER_SIZE (buf); + /* Temp hack to not update nAllocLen for each ETB/FTB till we + * find a cleaner solution to get padded width and height */ + /* omx_buffer->nAllocLen = GST_BUFFER_SIZE (buf); */ + omx_buffer->pAppPrivate = gst_buffer_ref (buf); + + /* special hack.. this should be removed: */ + omx_buffer->nFlags |= OMX_BUFFERHEADERFLAG_MODIFIED; + } + else + { + if (port->always_copy) + { + omx_buffer->nFilledLen = MIN (GST_BUFFER_SIZE (buf), + omx_buffer->nAllocLen - omx_buffer->nOffset); + //printf("filled len:%d, buffer size:%d\n",omx_buffer->nFilledLen,GST_BUFFER_SIZE (buf)); + //printf("alloclen:%d, offset:%d\n",omx_buffer->nAllocLen,omx_buffer->nOffset); + } + + if (G_UNLIKELY (port->vp6_hack)) + { + DEBUG (port, "VP6 hack begin"); + + DEBUG (port, "Adding the frame-length"); + memcpy (omx_buffer->pBuffer, &(omx_buffer->nFilledLen), 4); + + DEBUG (port, "memcpy the vp6 data"); + memcpy (omx_buffer->pBuffer + 4, GST_BUFFER_DATA (buf), + omx_buffer->nFilledLen); + + DEBUG (port, "add four bytes to nFilledLen"); + omx_buffer->nFilledLen += 4; + + DEBUG (port, "VP6 hack end"); + } + else + { + if (port->always_copy) + { + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen); + } + } + } + + if (port->core->use_timestamps) + { + if (GST_CLOCK_TIME_NONE != GST_BUFFER_TIMESTAMP (buf)) { + omx_buffer->nTimeStamp = gst_util_uint64_scale_int ( + GST_BUFFER_TIMESTAMP (buf), + OMX_TICKS_PER_SECOND, GST_SECOND); + } else { + omx_buffer->nTimeStamp = (OMX_TICKS)-1; + } + } + + DEBUG (port, "omx_buffer: size=%lu, len=%lu, flags=%lu, offset=%lu, timestamp=%lld", + omx_buffer->nAllocLen, omx_buffer->nFilledLen, omx_buffer->nFlags, + omx_buffer->nOffset, omx_buffer->nTimeStamp); +} + +/*wmv Send prepare start*/ +static void +send_prep_wmv_codec_data (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstBuffer *buf) +{ + + omx_buffer->nFlags |= OMX_BUFFERFLAG_CODECCONFIG; + + omx_buffer->nFilledLen = 0;//GST_BUFFER_SIZE (buf); + + + if (port->share_buffer) + { + omx_buffer->nOffset = 0; + omx_buffer->pBuffer = malloc (omx_buffer->nFilledLen); + } + + if (port->always_copy) + { + + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen); + } + + +} + +static void +send_prep_wmv_buffer_data (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstBuffer *buf) +{ + + + GstOmxBaseFilter *self = port->core->object; + + if (port->share_buffer) + { + omx_buffer->nOffset = port->n_offset; + omx_buffer->pBuffer = GST_BUFFER_DATA (buf); + omx_buffer->nFilledLen = GST_BUFFER_SIZE (buf); + /* Temp hack to not update nAllocLen for each ETB/FTB till we + * find a cleaner solution to get padded width and height */ + /* omx_buffer->nAllocLen = GST_BUFFER_SIZE (buf); */ + omx_buffer->pAppPrivate = gst_buffer_ref (buf); + + /* special hack.. this should be removed: */ + omx_buffer->nFlags |= OMX_BUFFERHEADERFLAG_MODIFIED; + } + else + { + if (port->always_copy && self->codec_data) + { + omx_buffer->nFilledLen = MIN (GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE(self->codec_data), + omx_buffer->nAllocLen - omx_buffer->nOffset) ; + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (self->codec_data), GST_BUFFER_SIZE(self->codec_data)); + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset + GST_BUFFER_SIZE(self->codec_data), + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen - GST_BUFFER_SIZE(self->codec_data)); + if(GST_BUFFER_SIZE(self->codec_data) == 36){ + self->codec_data = NULL;/*To be done, making null disables memcpy of configdata to every buffer*/ + } + } + else + { + if (port->always_copy) + { + omx_buffer->nFilledLen = MIN (GST_BUFFER_SIZE (buf), + omx_buffer->nAllocLen - omx_buffer->nOffset); + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen); + } + } + } + + if (port->core->use_timestamps) + { + omx_buffer->nTimeStamp = gst_util_uint64_scale_int ( + GST_BUFFER_TIMESTAMP (buf), + OMX_TICKS_PER_SECOND, GST_SECOND); + + } + + DEBUG (port, "omx_buffer: size=%lu, len=%lu, flags=%lu, offset=%lu, timestamp=%lld", + omx_buffer->nAllocLen, omx_buffer->nFilledLen, omx_buffer->nFlags, + omx_buffer->nOffset, omx_buffer->nTimeStamp); + +} +/*wmv sendprepare end*/ + +static void +send_prep_mpeg4_buffer_data (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstBuffer *buf) +{ + + + GstOmxBaseFilter *self = port->core->object; + + if (port->share_buffer) + { + omx_buffer->nOffset = port->n_offset; + omx_buffer->pBuffer = GST_BUFFER_DATA (buf); + omx_buffer->nFilledLen = GST_BUFFER_SIZE (buf); + /* Temp hack to not update nAllocLen for each ETB/FTB till we + * find a cleaner solution to get padded width and height */ + /* omx_buffer->nAllocLen = GST_BUFFER_SIZE (buf); */ + omx_buffer->pAppPrivate = gst_buffer_ref (buf); + + /* special hack.. this should be removed: */ + omx_buffer->nFlags |= OMX_BUFFERHEADERFLAG_MODIFIED; + } + else + { + if (port->always_copy && self->codec_data) + { + omx_buffer->nFilledLen = MIN (GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE(self->codec_data), + omx_buffer->nAllocLen - omx_buffer->nOffset) ; + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (self->codec_data), GST_BUFFER_SIZE(self->codec_data)); + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset + GST_BUFFER_SIZE(self->codec_data), + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen - GST_BUFFER_SIZE(self->codec_data)); + } + else + { + if (port->always_copy) + { + omx_buffer->nFilledLen = MIN (GST_BUFFER_SIZE (buf), + omx_buffer->nAllocLen - omx_buffer->nOffset); + memcpy (omx_buffer->pBuffer + omx_buffer->nOffset, + GST_BUFFER_DATA (buf), omx_buffer->nFilledLen); + } + } + } + + if (port->core->use_timestamps) + { + omx_buffer->nTimeStamp = gst_util_uint64_scale_int ( + GST_BUFFER_TIMESTAMP (buf), + OMX_TICKS_PER_SECOND, GST_SECOND); + + } + + DEBUG (port, "omx_buffer: size=%lu, len=%lu, flags=%lu, offset=%lu, timestamp=%lld", + omx_buffer->nAllocLen, omx_buffer->nFilledLen, omx_buffer->nFlags, + omx_buffer->nOffset, omx_buffer->nTimeStamp); + +} +/*wmv sendprepare end*/ + + + +static void +send_prep_eos_event (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer, GstEvent *evt) +{ + omx_buffer->nFlags |= OMX_BUFFERFLAG_EOS; + omx_buffer->nFilledLen = 0; + if (port->share_buffer) { + /* OMX should not try to read from the buffer, since it is empty.. + * but yet it complains if pBuffer is NULL. This will get us past + * that check, and ensure that OMX segfaults in a debuggible way + * if they do something stupid like read from the empty buffer: + */ + omx_buffer->pBuffer = (OMX_U8 *)1; + /* TODO: Temporary hack as OMX currently complains about + * non-zero nAllocLen. Need to be removed once aligned with OMX. + */ + /* omx_buffer->nAllocLen = 0; */ + } +} + +/* we are configured not copy the input buffer then update the pBuffer + * to point to the recieved buffer and save the gstreamer buffer reference + * in pAppPrivate so that it can be later freed up. + */ +static OMX_BUFFERHEADERTYPE * +get_input_buffer_header (GOmxPort *port, GstBuffer *src) +{ + OMX_BUFFERHEADERTYPE *omx_buffer; + int index; + + index = omxbuffer_index(port, GST_BUFFER_DATA (src)); + + omx_buffer = port->buffers[index]; + + omx_buffer->pBuffer = GST_BUFFER_DATA(src); + omx_buffer->nOffset = GST_GET_OMXBUFFER(src)->nOffset; + omx_buffer->nFilledLen = GST_BUFFER_SIZE (src); + omx_buffer->pAppPrivate = gst_buffer_ref (src); + + return omx_buffer; +} + +/** + * Send a buffer/event to the OMX component. This handles conversion of + * GST buffer, codec-data, and EOS events to the equivalent OMX buffer. + * + * This method does not take ownership of the ref to @obj + * + * Returns number of bytes sent, or negative if error + */ +gint +g_omx_port_send (GOmxPort *port, gpointer obj) +{ + + SendPrep send_prep = NULL; + + g_return_val_if_fail (port->type == GOMX_PORT_INPUT, -1); + + + GstOmxBaseVideoDec *self = GST_OMX_BASE_VIDEODEC (port->core->object);; + + if (GST_IS_BUFFER (obj)) + { + if(self->compression_format == OMX_VIDEO_CodingWMV) + { + + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (obj, GST_BUFFER_FLAG_IN_CAPS))) + send_prep = (SendPrep)send_prep_wmv_codec_data; + else + send_prep = (SendPrep)send_prep_wmv_buffer_data; + } + else + if(self->compression_format == OMX_VIDEO_CodingMPEG4) + { + + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (obj, GST_BUFFER_FLAG_IN_CAPS))) + send_prep = (SendPrep)send_prep_wmv_codec_data; + else + send_prep = (SendPrep)send_prep_mpeg4_buffer_data; + } + else + { + if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (obj, GST_BUFFER_FLAG_IN_CAPS))) + send_prep = (SendPrep)send_prep_codec_data; + else + send_prep = (SendPrep)send_prep_buffer_data; + } + } + else if (GST_IS_EVENT (obj)) + { + if (G_LIKELY (GST_EVENT_TYPE (obj) == GST_EVENT_EOS)) + send_prep = (SendPrep)send_prep_eos_event; + } + + if (G_LIKELY (send_prep)) + { + gint ret; + OMX_BUFFERHEADERTYPE *omx_buffer = NULL; + + if (port->always_copy) + { + + omx_buffer = request_buffer (port); + if (!omx_buffer) + { + DEBUG (port, "null buffer"); + return -1; + } + + /* don't assume OMX component clears flags! + */ + omx_buffer->nFlags = 0; + + /* if buffer sharing is enabled, pAppPrivate might hold the ref to + * a buffer that is no longer required and should be unref'd. We + * do this check here, rather than in send_prep_buffer_data() so + * we don't keep the reference live in case, for example, this time + * the buffer is used for an EOS event. + */ + if (omx_buffer->pAppPrivate) + { + GstBuffer *old_buf = omx_buffer->pAppPrivate; + gst_buffer_unref (old_buf); + omx_buffer->pAppPrivate = NULL; + omx_buffer->pBuffer = NULL; /* just to ease debugging */ + } + } + else + { + + if (GST_IS_OMXBUFFERTRANSPORT (obj)) + omx_buffer = get_input_buffer_header (port, obj); + else if(GST_IS_EVENT (obj) && (GST_EVENT_TYPE (obj) == GST_EVENT_EOS)) { + omx_buffer = port->buffers[0]; + } + else { + GST_ERROR_OBJECT(port->core->object,"something went wrong!!\n"); + return -1; /* something went wrong */ + } + } + + send_prep (port, omx_buffer, obj); + + ret = omx_buffer->nFilledLen; + release_buffer (port, omx_buffer); + return ret; + } + + WARNING (port, "unknown obj type"); + return -1; +} + +/** + * Receive a buffer/event from OMX component. This handles the conversion + * of OMX buffer to GST buffer, codec-data, or EOS event. + * + * Returns <code>NULL</code> if buffer could not be received. + */ +gpointer +g_omx_port_recv (GOmxPort *port) +{ + gpointer ret = NULL; + + g_return_val_if_fail (port->type == GOMX_PORT_OUTPUT, NULL); + + while (!ret && port->enabled) + { + OMX_BUFFERHEADERTYPE *omx_buffer = request_buffer (port); + + if (G_UNLIKELY (!omx_buffer)) + { + return NULL; + } + + DEBUG (port, "omx_buffer=%p size=%lu, len=%lu, flags=%lu, offset=%lu, timestamp=%lld", + omx_buffer, omx_buffer->nAllocLen, omx_buffer->nFilledLen, omx_buffer->nFlags, + omx_buffer->nOffset, omx_buffer->nTimeStamp); + + /* XXX this ignore_count workaround might play badly w/ refcnting + * in OMX component.. + */ + + if (port->ignore_count) + { + DEBUG (port, "ignore_count=%d", port->ignore_count); + release_buffer (port, omx_buffer); + port->ignore_count--; + continue; + } + + if (G_UNLIKELY (omx_buffer->nFlags & OMX_BUFFERFLAG_EOS)) + { + DEBUG (port, "got eos"); + ret = gst_event_new_eos (); + } + else if (G_LIKELY (omx_buffer->nFilledLen > 0)) + { + GstBuffer *buf = omx_buffer->pAppPrivate; + + /* I'm not really sure if it was intentional to block zero-copy of + * the codec-data buffer.. this is how the original code worked, + * so I kept the behavior + */ + if (!buf || (omx_buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) + { + if (buf) + gst_buffer_unref (buf); + + if (port->always_copy) { + buf = buffer_alloc (port, omx_buffer->nFilledLen); + memcpy (GST_BUFFER_DATA (buf), omx_buffer->pBuffer, omx_buffer->nFilledLen); + } + else { + buf = gst_omxbuffertransport_new (port, omx_buffer); + } + } + else if (buf) + { + /* don't rely on OMX having told us the correct buffer size + * when we allocated the buffer. + */ + GST_BUFFER_SIZE (buf) = omx_buffer->nFilledLen; + } + + if (port->core->use_timestamps) + { + if (omx_buffer->nTimeStamp != (OMX_TICKS)-1) { + GST_BUFFER_TIMESTAMP (buf) = gst_util_uint64_scale_int ( + omx_buffer->nTimeStamp, + GST_SECOND, OMX_TICKS_PER_SECOND); + } else { + GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE; + } + } + + if (G_UNLIKELY (omx_buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) + { + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS); + } + + port->n_offset = omx_buffer->nOffset; + + ret = buf; + } + else + { + GstBuffer *buf = omx_buffer->pAppPrivate; + + if (buf) + { + gst_buffer_unref (buf); + omx_buffer->pAppPrivate = NULL; + } + + DEBUG (port, "empty buffer %p", omx_buffer); /* keep looping */ + } + +/* REVISIT: I don't know why but EZSDK OMX component sets this read-only + flag for resolution > QVGA + */ +#if 0 +#ifdef USE_OMXTICORE + if (omx_buffer->nFlags & OMX_TI_BUFFERFLAG_READONLY) + { + GstBuffer *buf = omx_buffer->pAppPrivate; + + if (buf) + { + /* if using buffer sharing, create an extra ref to the buffer + * to account for the fact that the OMX component is still + * holding a reference. (This prevents the buffer from being + * free'd while the component is still using it as, for ex, a + * reference frame.) + */ + gst_buffer_ref (buf); + } + + DEBUG (port, "dup'd buffer %p", omx_buffer); + + g_mutex_lock (port->core->omx_state_mutex); + omx_buffer->nFlags &= ~OMX_TI_BUFFERFLAG_READONLY; + g_mutex_unlock (port->core->omx_state_mutex); + } + else if (omx_buffer->nFlags & GST_BUFFERFLAG_UNREF_CHECK) + { + /* buffer has already been handled under READONLY case.. so + * don't return it to gst. Just unref it, and release the omx + * buffer which was previously not released. + */ + gst_buffer_unref(ret); + ret = NULL; + + DEBUG (port, "unref'd buffer %p", omx_buffer); + + setup_shared_buffer (port, omx_buffer); + release_buffer (port, omx_buffer); + } + else +#endif +#endif + { + setup_shared_buffer (port, omx_buffer); + if (port->always_copy) + release_buffer (port, omx_buffer); + } + } + + + return ret; +} + +void +g_omx_port_resume (GOmxPort *port) +{ + DEBUG (port, "resume"); + async_queue_enable (port->queue); +} + +void +g_omx_port_pause (GOmxPort *port) +{ + DEBUG (port, "pause"); + async_queue_disable (port->queue); +} + +void +g_omx_port_flush (GOmxPort *port) +{ + DEBUG (port, "begin"); + + if (port->type == GOMX_PORT_OUTPUT) + { + /* This will get rid of any buffers that we have received, but not + * yet processed in the output_loop. + */ + OMX_BUFFERHEADERTYPE *omx_buffer; + while ((omx_buffer = async_queue_pop_full (port->queue, FALSE, TRUE))) + { + omx_buffer->nFilledLen = 0; + +#ifdef USE_OMXTICORE + if (omx_buffer->nFlags & OMX_TI_BUFFERFLAG_READONLY) + { + /* For output buffer that is marked with READONLY, we + cannot release until EventHandler OMX_TI_EventBufferRefCount + come. So, reset the nFlags to be released later. */ + DEBUG (port, "During flush encounter ReadOnly buffer %p", omx_buffer); + g_mutex_lock (port->core->omx_state_mutex); + omx_buffer->nFlags &= ~OMX_TI_BUFFERFLAG_READONLY; + g_mutex_unlock (port->core->omx_state_mutex); + } + else +#endif + { + release_buffer (port, omx_buffer); + } + } + } + + DEBUG (port, "SendCommand(Flush, %d)", port->port_index); + OMX_SendCommand (port->core->omx_handle, OMX_CommandFlush, port->port_index, NULL); + g_sem_down (port->core->flush_sem); + port->ignore_count = port->num_buffers; + DEBUG (port, "end"); +} + +void +g_omx_port_enable (GOmxPort *port) +{ + if (port->enabled) + { + DEBUG (port, "already enabled"); + return; + } + + DEBUG (port, "begin"); + + g_omx_port_prepare (port); + + DEBUG (port, "SendCommand(PortEnable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + + g_omx_port_allocate_buffers (port); + + g_sem_down (port->core->port_sem); + + port->enabled = TRUE; + + if (port->core->omx_state == OMX_StateExecuting) + g_omx_port_start_buffers (port); + + DEBUG (port, "end"); +} + +void +g_omx_port_disable (GOmxPort *port) +{ + if (!port->enabled) + { + DEBUG (port, "already disabled"); + return; + } + + DEBUG (port, "begin"); + + port->enabled = FALSE; + + DEBUG (port, "SendCommand(PortDisable, %d)", port->port_index); + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortDisable, port->port_index, NULL); + + g_omx_port_free_buffers (port); + + g_sem_down (port->core->port_sem); + + DEBUG (port, "end"); +} + +void +g_omx_port_finish (GOmxPort *port) +{ + DEBUG (port, "finish"); + port->enabled = FALSE; + async_queue_disable (port->queue); +} + + +/* + * Some domain specific port related utility functions: + */ + +/* keep this list in sync GSTOMX_ALL_FORMATS */ +static gint32 all_fourcc[] = { + GST_MAKE_FOURCC ('N','V','1','2'), + GST_MAKE_FOURCC ('I','4','2','0'), + GST_MAKE_FOURCC ('Y','U','Y','2'), + GST_MAKE_FOURCC ('U','Y','V','Y'), +}; + +#ifndef DIM /* XXX is there a better alternative available? */ +# define DIM(x) (sizeof(x)/sizeof((x)[0])) +#endif + +/** + * A utility function to query the port for supported color formats, and + * add the appropriate list of formats to @caps. The @port can either + * be an input port for a video encoder, or an output port for a decoder + */ +GstCaps * +g_omx_port_set_video_formats (GOmxPort *port, GstCaps *caps) +{ + OMX_VIDEO_PARAM_PORTFORMATTYPE param; + int i,j; + + G_OMX_PORT_GET_PARAM (port, OMX_IndexParamVideoPortFormat, ¶m); + + caps = gst_caps_make_writable (caps); + + for (i=0; i<gst_caps_get_size (caps); i++) + { + GstStructure *struc = gst_caps_get_structure (caps, i); + GValue formats = {0}; + + g_value_init (&formats, GST_TYPE_LIST); + + for (j=0; j<DIM(all_fourcc); j++) + { + OMX_ERRORTYPE err; + GValue fourccval = {0}; + + g_value_init (&fourccval, GST_TYPE_FOURCC); + + /* check and see if OMX supports the format: + */ + param.eColorFormat = g_omx_fourcc_to_colorformat (all_fourcc[j]); + err = G_OMX_PORT_SET_PARAM (port, OMX_IndexParamVideoPortFormat, ¶m); + + if( err == OMX_ErrorIncorrectStateOperation ) + { + DEBUG (port, "already executing?"); + + /* if we are already executing, such as might be the case if + * we get a OMX_EventPortSettingsChanged event, just take the + * current format and bail: + */ + G_OMX_PORT_GET_PARAM (port, OMX_IndexParamVideoPortFormat, ¶m); + gst_value_set_fourcc (&fourccval, + g_omx_colorformat_to_fourcc (param.eColorFormat)); + gst_value_list_append_value (&formats, &fourccval); + break; + } + else if( err == OMX_ErrorNone ) + { + gst_value_set_fourcc (&fourccval, all_fourcc[j]); + gst_value_list_append_value (&formats, &fourccval); + } + } + + gst_structure_set_value (struc, "format", &formats); + } + + return caps; +} + + /*For avoid repeated code needs to do only one function in order to configure + video and images caps strure, and also maybe adding RGB color format*/ + +static gint32 jpeg_fourcc[] = { + GST_MAKE_FOURCC ('U','Y','V','Y'), + GST_MAKE_FOURCC ('N','V','1','2') +}; + +/** + * A utility function to query the port for supported color formats, and + * add the appropriate list of formats to @caps. The @port can either + * be an input port for a image encoder, or an output port for a decoder + */ +GstCaps * +g_omx_port_set_image_formats (GOmxPort *port, GstCaps *caps) +{ + //OMX_IMAGE_PARAM_PORTFORMATTYPE param; + int i,j; + + //G_OMX_PORT_GET_PARAM (port, OMX_IndexParamImagePortFormat, ¶m); + + caps = gst_caps_make_writable (caps); + + for (i=0; i<gst_caps_get_size (caps); i++) + { + GstStructure *struc = gst_caps_get_structure (caps, i); + GValue formats = {0}; + + g_value_init (&formats, GST_TYPE_LIST); + + for (j=0; j<DIM(jpeg_fourcc); j++) + { + //OMX_ERRORTYPE err; + GValue fourccval = {0}; + + g_value_init (&fourccval, GST_TYPE_FOURCC); + + /* Got error from omx jpeg component , avoiding these lines by the moment till they support it*/ +#if 0 + /* check and see if OMX supports the format: + */ + param.eColorFormat = g_omx_fourcc_to_colorformat (all_fourcc[j]); + err = G_OMX_PORT_SET_PARAM (port, OMX_IndexParamImagePortFormat, ¶m); + + if( err == OMX_ErrorIncorrectStateOperation ) + { + DEBUG (port, "already executing?"); + + /* if we are already executing, such as might be the case if + * we get a OMX_EventPortSettingsChanged event, just take the + * current format and bail: + */ + G_OMX_PORT_GET_PARAM (port, OMX_IndexParamImagePortFormat, ¶m); + gst_value_set_fourcc (&fourccval, + g_omx_colorformat_to_fourcc (param.eColorFormat)); + gst_value_list_append_value (&formats, &fourccval); + break; + } + else if( err == OMX_ErrorNone ) + { + gst_value_set_fourcc (&fourccval, all_fourcc[j]); + gst_value_list_append_value (&formats, &fourccval); + } +#else + gst_value_set_fourcc (&fourccval, jpeg_fourcc[j]); + gst_value_list_append_value (&formats, &fourccval); +#endif + } + + gst_structure_set_value (struc, "format", &formats); + } + + return caps; +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.h new file mode 100644 index 0000000..e1ad8a9 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_port.h @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_PORT_H +#define GSTOMX_PORT_H + +#include <string.h> /* for memset, memcpy */ +#include <gst/gst.h> + +#include "gstomx_util.h" + +G_BEGIN_DECLS + +/* Typedefs. */ + +typedef enum GOmxPortType GOmxPortType; +typedef struct OmxBufferInfo OmxBufferInfo; + +/* Enums. */ + +enum GOmxPortType +{ + GOMX_PORT_INPUT, + GOMX_PORT_OUTPUT +}; + +struct OmxBufferInfo +{ + /** number of pBuffer pointer */ + guint num_buffers; + + /* arrary of OMX pBuffer pointer */ + OMX_U8 **pBuffer; +}; + +struct GOmxPort +{ + GOmxCore *core; + gchar *name; + GOmxPortType type; + + guint num_buffers; + guint port_index; + OMX_BUFFERHEADERTYPE **buffers; + + GMutex *mutex; + gboolean enabled; + gboolean omx_allocate; /**< Setup with OMX_AllocateBuffer rather than OMX_UseBuffer */ + AsyncQueue *queue; + + GstBuffer * (*buffer_alloc)(GOmxPort *port, gint len); /**< allows elements to override shared buffer allocation for output ports */ + + /** @todo this is a hack.. OpenMAX IL spec should be revised. */ + gboolean share_buffer; + + gint ignore_count; /* XXX hack to work around seek bug w/ codec */ + + /** nOffset value of the last received (input) or next sent (output) port */ + guint n_offset; /* a bit ugly.. but.. */ + + /** variable to indicate if the conversion from elementary to intermediate video data is done */ + gboolean vp6_hack; /* only needed for vp6 */ + + /** varaible to indicate if we need to perform memcpy of incoming or outgoing gstreamer buffer into OMX buffer. */ + gboolean always_copy; + + /** variable to store caps for sinkpad */ + GstCaps *caps; + + /** if omx_allocate flag is not set then structure will contain upstream omx buffer pointer information */ + OmxBufferInfo *share_buffer_info; +}; + +/* Macros. */ + +#define G_OMX_PORT_GET_PARAM(port, idx, param) G_STMT_START { \ + _G_OMX_INIT_PARAM (param); \ + (param)->nPortIndex = (port)->port_index; \ + OMX_GetParameter (g_omx_core_get_handle ((port)->core), idx, (param)); \ + } G_STMT_END + +#define G_OMX_PORT_SET_PARAM(port, idx, param) \ + OMX_SetParameter ( \ + g_omx_core_get_handle ((port)->core), idx, (param)) + +#define G_OMX_PORT_GET_CONFIG(port, idx, param) G_STMT_START { \ + _G_OMX_INIT_PARAM (param); \ + (param)->nPortIndex = (port)->port_index; \ + OMX_GetConfig (g_omx_core_get_handle ((port)->core), idx, (param)); \ + } G_STMT_END + +#define G_OMX_PORT_SET_CONFIG(port, idx, param) \ + OMX_SetConfig ( \ + g_omx_core_get_handle ((port)->core), idx, (param)) + +#define G_OMX_PORT_GET_DEFINITION(port, param) \ + G_OMX_PORT_GET_PARAM (port, OMX_IndexParamPortDefinition, param) + +#define G_OMX_PORT_SET_DEFINITION(port, param) \ + G_OMX_PORT_SET_PARAM (port, OMX_IndexParamPortDefinition, param) + + +/* Functions. */ + +GOmxPort *g_omx_port_new (GOmxCore *core, const gchar *name, guint index); +void g_omx_port_free (GOmxPort *port); + +void g_omx_port_setup (GOmxPort *port, OMX_PARAM_PORTDEFINITIONTYPE *omx_port); +void g_omx_port_prepare (GOmxPort *port); +void g_omx_port_allocate_buffers (GOmxPort *port); +void g_omx_port_free_buffers (GOmxPort *port); +void g_omx_port_start_buffers (GOmxPort *port); +void g_omx_port_resume (GOmxPort *port); +void g_omx_port_pause (GOmxPort *port); +void g_omx_port_flush (GOmxPort *port); +void g_omx_port_enable (GOmxPort *port); +void g_omx_port_disable (GOmxPort *port); +void g_omx_port_finish (GOmxPort *port); +void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer); +gint g_omx_port_send (GOmxPort *port, gpointer obj); +gpointer g_omx_port_recv (GOmxPort *port); + +/* + * Some domain specific port related utility functions: + */ + +#define GSTOMX_ALL_FORMATS "{ NV12, I420, YUY2, UYVY }" + +GstCaps * g_omx_port_set_video_formats (GOmxPort *port, GstCaps *caps); +GstCaps * g_omx_port_set_image_formats (GOmxPort *port, GstCaps *caps); + +G_END_DECLS + +#endif /* GSTOMX_PORT_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.c new file mode 100644 index 0000000..33e3cff --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.c @@ -0,0 +1,281 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_scaler.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxScaler, gst_omx_scaler, GstOmxBaseVfpc, GST_OMX_BASE_VFPC_TYPE); + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ( + "{NV12}", "[ 0, max ]")) + ); + +static GstStaticPadTemplate src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ( "{YUY2}" )) + ); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL for OMX.TI.VPSSM3.VFPC.INDTXSCWB component"; + details.klass = "Filter"; + details.description = "Scale video using VPSS Scaler module "; + details.author = "Brijesh Singh"; + + gst_element_class_set_details (element_class, &details); + } + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); +} + +static GstCaps* +create_src_caps (GstOmxBaseFilter *omx_base) +{ + GstCaps *caps; + GstOmxBaseVfpc *self; + int width, height; + GstStructure *struc; + + self = GST_OMX_BASE_VFPC (omx_base); + caps = gst_pad_peer_get_caps (omx_base->srcpad); + + if (gst_caps_is_empty (caps)) + { + width = self->in_width; + height = self->in_height; + } + else + { + GstStructure *s; + + s = gst_caps_get_structure (caps, 0); + + if (!(gst_structure_get_int (s, "width", &width) && + gst_structure_get_int (s, "height", &height))) + { + width = self->in_width; + height = self->in_height; + } + } + + caps = gst_caps_new_empty (); + struc = gst_structure_new (("video/x-raw-yuv"), + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), + NULL); + + + if (self->framerate_denom) + { + gst_structure_set (struc, + "framerate", GST_TYPE_FRACTION, self->framerate_num, self->framerate_denom, NULL); + } + + if (self->pixel_aspect_ratio_denom) + { + gst_structure_set (struc, + "pixel-aspect-ratio", GST_TYPE_FRACTION, self->pixel_aspect_ratio_num, + self->pixel_aspect_ratio_denom, NULL); + } + + gst_structure_set (struc, + "interlaced", G_TYPE_BOOLEAN, self->interlaced, NULL); + + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +omx_setup (GstOmxBaseFilter *omx_base) +{ + GOmxCore *gomx; + OMX_ERRORTYPE err; + OMX_PARAM_PORTDEFINITIONTYPE paramPort; + OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg; + OMX_PARAM_VFPC_NUMCHANNELPERHANDLE numChannels; + OMX_CONFIG_VIDCHANNEL_RESOLUTION chResolution; + OMX_CONFIG_ALG_ENABLE algEnable; + GstOmxBaseVfpc *self; + + gomx = (GOmxCore *) omx_base->gomx; + self = GST_OMX_BASE_VFPC (omx_base); + + GST_LOG_OBJECT (self, "begin"); + + /* set the output cap */ + gst_pad_set_caps (omx_base->srcpad, create_src_caps (omx_base)); + + /* Setting Memory type at input port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting input port to Raw memory"); + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->input_port_index; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Setting Memory type at output port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting output port to Raw memory"); + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->output_port_index; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Input port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (input)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶mPort); + paramPort.format.video.nFrameWidth = self->in_width; + paramPort.format.video.nFrameHeight = self->in_height; + paramPort.format.video.nStride = self->in_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + paramPort.nBufferSize = self->in_stride * self->in_height * 1.5; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶mPort); + g_omx_port_setup (omx_base->in_port, ¶mPort); + + /* Output port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (output)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶mPort); + paramPort.format.video.nFrameWidth = self->out_width; + paramPort.format.video.nFrameHeight = self->out_height; + paramPort.format.video.nStride = self->out_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; + paramPort.nBufferSize = self->out_stride * self->out_height; + paramPort.nBufferCountActual = 8; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, ¶mPort); + g_omx_port_setup (omx_base->out_port, ¶mPort); + + /* Set number of channles */ + GST_LOG_OBJECT (self, "Setting number of channels"); + + _G_OMX_INIT_PARAM (&numChannels); + numChannels.nNumChannelsPerHandle = 1; + err = OMX_SetParameter (gomx->omx_handle, + (OMX_INDEXTYPE) OMX_TI_IndexParamVFPCNumChPerHandle, &numChannels); + + if (err != OMX_ErrorNone) + return; + + /* Set input channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (input)"); + + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->in_width; + chResolution.Frm0Height = self->in_height; + chResolution.Frm0Pitch = self->in_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = 0;//self->left; + chResolution.FrmStartY = 0;//self->top; + chResolution.FrmCropWidth = 0;//self->in_width - self->left; + chResolution.FrmCropHeight = 0;//self->in_height - self->top; + chResolution.eDir = OMX_DirInput; + chResolution.nChId = 0; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + /* Set output channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (output)"); + + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->out_width; + chResolution.Frm0Height = self->out_height; + chResolution.Frm0Pitch = self->out_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = 0; + chResolution.FrmStartY = 0; + chResolution.FrmCropWidth = 0; + chResolution.FrmCropHeight = 0; + chResolution.eDir = OMX_DirOutput; + chResolution.nChId = 0; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + _G_OMX_INIT_PARAM (&algEnable); + algEnable.nPortIndex = 0; + algEnable.nChId = 0; + algEnable.bAlgBypass = OMX_FALSE; + + err = OMX_SetConfig (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexConfigAlgEnable, &algEnable); + + if (err != OMX_ErrorNone) + return; +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVfpc *self; + + self = GST_OMX_BASE_VFPC (instance); + + self->omx_setup = omx_setup; + g_object_set (self, "port-index", 0, NULL); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.h new file mode 100644 index 0000000..8b44b6c --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_scaler.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc. + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_SCALER_H +#define GSTOMX_SCALER_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_SCALER(obj) (GstOmxScaler *) (obj) +#define GST_OMX_SCALER_TYPE (gst_omx_scaler_get_type ()) + +typedef struct GstOmxScaler GstOmxScaler; +typedef struct GstOmxScalerClass GstOmxScalerClass; + +#include "gstomx_base_vfpc.h" + +struct GstOmxScaler +{ + GstOmxBaseVfpc omx_base; +}; + +struct GstOmxScalerClass +{ + GstOmxBaseVfpcClass parent_class; +}; + +GType gst_omx_scaler_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_SCALER_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.c new file mode 100644 index 0000000..8ac128c --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.c @@ -0,0 +1,367 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_util.h" +#include <dlfcn.h> +#include <string.h> + +#include "gstomx.h" +#include <xdc/runtime/knl/Thread.h> + +GST_DEBUG_CATEGORY (gstomx_util_debug); + + +/* protect implementations hash_table */ +static GMutex *imp_mutex; +static GHashTable *implementations; +static gboolean initialized; + + +/* + * Main + */ + +static GOmxImp * +imp_new (const gchar *name) +{ + GOmxImp *imp; + + imp = g_new0 (GOmxImp, 1); + + #ifdef USE_STATIC + imp->mutex = g_mutex_new (); + #else + /* Load the OpenMAX IL symbols */ + { + void *handle; + + imp->dl_handle = handle = dlopen (name, RTLD_LAZY); + GST_DEBUG ("dlopen(%s) -> %p", name, handle); + if (!handle) + { + g_warning ("%s\n", dlerror ()); + g_free (imp); + return NULL; + } + + imp->mutex = g_mutex_new (); + imp->sym_table.init = dlsym (handle, "OMX_Init"); + imp->sym_table.deinit = dlsym (handle, "OMX_Deinit"); + imp->sym_table.get_handle = dlsym (handle, "OMX_GetHandle"); + imp->sym_table.free_handle = dlsym (handle, "OMX_FreeHandle"); + } + #endif + + return imp; +} + +static void +imp_free (GOmxImp *imp) +{ + if (imp->dl_handle) + { + dlclose (imp->dl_handle); + } + g_mutex_free (imp->mutex); + g_free (imp); +} + +/* + * Helpers used by GOmxCore: + */ + +GOmxImp * +g_omx_request_imp (const gchar *name) +{ + GOmxImp *imp = NULL; + + g_mutex_lock (imp_mutex); + imp = g_hash_table_lookup (implementations, name); + if (!imp) + { + imp = imp_new (name); + if (imp) + g_hash_table_insert (implementations, g_strdup (name), imp); + } + g_mutex_unlock (imp_mutex); + + if (!imp) + return NULL; + + g_mutex_lock (imp->mutex); + if (imp->client_count == 0) + { + OMX_ERRORTYPE omx_error; + + #ifdef USE_STATIC + omx_error = OMX_Init (); + #else + omx_error = imp->sym_table.init (); + #endif + if (omx_error) + { + g_mutex_unlock (imp->mutex); + return NULL; + } + } + imp->client_count++; + g_mutex_unlock (imp->mutex); + + return imp; +} + +void +g_omx_release_imp (GOmxImp *imp) +{ + g_mutex_lock (imp->mutex); + imp->client_count--; + if (imp->client_count == 0) + { + #ifdef USE_STATIC + OMX_Deinit(); + #else + imp->sym_table.deinit (); + #endif + } + g_mutex_unlock (imp->mutex); +} + +/* + * Helpers used by plugin: + */ + +void +g_omx_init (void) +{ + if (!initialized) + { + /* safe as plugin_init is safe */ + imp_mutex = g_mutex_new (); + implementations = g_hash_table_new_full (g_str_hash, + g_str_equal, + g_free, + (GDestroyNotify) imp_free); + initialized = TRUE; + } +} + +void +g_omx_deinit (void) +{ + if (initialized) + { + g_hash_table_destroy (implementations); + g_mutex_free (imp_mutex); + initialized = FALSE; + } +} + + + +/* + * Some misc utilities.. + */ + +const char * +g_omx_error_to_str (OMX_ERRORTYPE omx_error) +{ + switch (omx_error) + { + case OMX_ErrorNone: + return "None"; + + case OMX_ErrorInsufficientResources: + return "There were insufficient resources to perform the requested operation"; + + case OMX_ErrorUndefined: + return "The cause of the error could not be determined"; + + case OMX_ErrorInvalidComponentName: + return "The component name string was not valid"; + + case OMX_ErrorComponentNotFound: + return "No component with the specified name string was found"; + + case OMX_ErrorInvalidComponent: + return "The component specified did not have an entry point"; + + case OMX_ErrorBadParameter: + return "One or more parameters were not valid"; + + case OMX_ErrorNotImplemented: + return "The requested function is not implemented"; + + case OMX_ErrorUnderflow: + return "The buffer was emptied before the next buffer was ready"; + + case OMX_ErrorOverflow: + return "The buffer was not available when it was needed"; + + case OMX_ErrorHardware: + return "The hardware failed to respond as expected"; + + case OMX_ErrorInvalidState: + return "The component is in invalid state"; + + case OMX_ErrorStreamCorrupt: + return "Stream is found to be corrupt"; + + case OMX_ErrorPortsNotCompatible: + return "Ports being connected are not compatible"; + + case OMX_ErrorResourcesLost: + return "Resources allocated to an idle component have been lost"; + + case OMX_ErrorNoMore: + return "No more indices can be enumerated"; + + case OMX_ErrorVersionMismatch: + return "The component detected a version mismatch"; + + case OMX_ErrorNotReady: + return "The component is not ready to return data at this time"; + + case OMX_ErrorTimeout: + return "There was a timeout that occurred"; + + case OMX_ErrorSameState: + return "This error occurs when trying to transition into the state you are already in"; + + case OMX_ErrorResourcesPreempted: + return "Resources allocated to an executing or paused component have been preempted"; + + case OMX_ErrorPortUnresponsiveDuringAllocation: + return "Waited an unusually long time for the supplier to allocate buffers"; + + case OMX_ErrorPortUnresponsiveDuringDeallocation: + return "Waited an unusually long time for the supplier to de-allocate buffers"; + + case OMX_ErrorPortUnresponsiveDuringStop: + return "Waited an unusually long time for the non-supplier to return a buffer during stop"; + + case OMX_ErrorIncorrectStateTransition: + return "Attempting a state transition that is not allowed"; + + case OMX_ErrorIncorrectStateOperation: + return "Attempting a command that is not allowed during the present state"; + + case OMX_ErrorUnsupportedSetting: + return "The values encapsulated in the parameter or config structure are not supported"; + + case OMX_ErrorUnsupportedIndex: + return "The parameter or config indicated by the given index is not supported"; + + case OMX_ErrorBadPortIndex: + return "The port index supplied is incorrect"; + + case OMX_ErrorPortUnpopulated: + return "The port has lost one or more of its buffers and it thus unpopulated"; + + case OMX_ErrorComponentSuspended: + return "Component suspended due to temporary loss of resources"; + + case OMX_ErrorDynamicResourcesUnavailable: + return "Component suspended due to an inability to acquire dynamic resources"; + + case OMX_ErrorMbErrorsInFrame: + return "Frame generated macroblock error"; + + case OMX_ErrorFormatNotDetected: + return "Cannot parse or determine the format of an input stream"; + + case OMX_ErrorContentPipeOpenFailed: + return "The content open operation failed"; + + case OMX_ErrorContentPipeCreationFailed: + return "The content creation operation failed"; + + case OMX_ErrorSeperateTablesUsed: + return "Separate table information is being used"; + + case OMX_ErrorTunnelingUnsupported: + return "Tunneling is unsupported by the component"; + + default: + return "Unknown error"; + } +} + +OMX_COLOR_FORMATTYPE g_omx_fourcc_to_colorformat (guint32 fourcc) +{ + switch (fourcc) + { + case GST_MAKE_FOURCC ('I', '4', '2', '0'): + return OMX_COLOR_FormatYUV420PackedPlanar; + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): + return OMX_COLOR_FormatYCbYCr; + case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): + return OMX_COLOR_FormatCbYCrY; + case GST_MAKE_FOURCC ('N', 'V', '1', '2'): + return OMX_COLOR_FormatYUV420PackedSemiPlanar; + default: + /* TODO, add other needed color formats.. */ + return OMX_COLOR_FormatUnused; + } +} + +guint32 g_omx_colorformat_to_fourcc (OMX_COLOR_FORMATTYPE eColorFormat) +{ + switch (eColorFormat) + { + case OMX_COLOR_FormatYUV420PackedPlanar: + return GST_MAKE_FOURCC ('I', '4', '2', '0'); + case OMX_COLOR_FormatYCbYCr: + return GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); + case OMX_COLOR_FormatCbYCrY: + return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); + case OMX_COLOR_FormatYUV420PackedSemiPlanar: + return GST_MAKE_FOURCC ('N', 'V', '1', '2'); + default: + /* TODO, add other needed color formats.. */ + return 0; + } +} + +OMX_COLOR_FORMATTYPE g_omx_gstvformat_to_colorformat (GstVideoFormat videoformat) +{ + switch (videoformat) + { + case GST_VIDEO_FORMAT_I420: + return OMX_COLOR_FormatYUV420PackedPlanar; + case GST_VIDEO_FORMAT_YUY2: + return OMX_COLOR_FormatYCbYCr; + case GST_VIDEO_FORMAT_UYVY: + return OMX_COLOR_FormatCbYCrY; + case GST_VIDEO_FORMAT_NV12: + return OMX_COLOR_FormatYUV420PackedSemiPlanar; + case GST_VIDEO_FORMAT_RGB: + return OMX_COLOR_Format24bitRGB888; + case GST_VIDEO_FORMAT_ARGB: + return OMX_COLOR_Format32bitARGB8888; + /* Remove this comment after RGB_16 being added to GstVideoFormat list + case GST_VIDEO_FORMAT_RGB_16: + return OMX_COLOR_Format16bitRGB565; + */ + default: + return OMX_COLOR_FormatUnused; + } + } diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.h new file mode 100644 index 0000000..88dc0f1 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_util.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2006-2009 Texas Instruments, Incorporated + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_UTIL_H +#define GSTOMX_UTIL_H + +#include <glib.h> +#include <gst/video/video.h> +#include <OMX_Core.h> +#include <OMX_Component.h> +#include <OMX_TI_Video.h> /* for OMX_TI_VIDEO_CODINGTYPE enumeration including VP6 and VP7 formats*/ + +#include <async_queue.h> +#include <sem.h> + +G_BEGIN_DECLS + +#define GST_BUFFERFLAG_UNREF_CHECK 0x10000000 + +/* Typedefs. */ + +typedef struct GOmxCore GOmxCore; +typedef struct GOmxPort GOmxPort; +typedef struct GOmxImp GOmxImp; +typedef struct GOmxSymbolTable GOmxSymbolTable; + + +#include "gstomx_core.h" +#include "gstomx_port.h" + + +/* Structures. */ + +struct GOmxSymbolTable +{ + OMX_ERRORTYPE (*init) (void); + OMX_ERRORTYPE (*deinit) (void); + OMX_ERRORTYPE (*get_handle) (OMX_HANDLETYPE *handle, + OMX_STRING name, + OMX_PTR data, + OMX_CALLBACKTYPE *callbacks); + OMX_ERRORTYPE (*free_handle) (OMX_HANDLETYPE handle); +}; + +struct GOmxImp +{ + guint client_count; + void *dl_handle; + GOmxSymbolTable sym_table; + GMutex *mutex; +}; + +/* Functions. */ + +void g_omx_init (void); +void g_omx_deinit (void); + +GOmxImp * g_omx_request_imp (const gchar *name); +void g_omx_release_imp (GOmxImp *imp); + +const char * g_omx_error_to_str (OMX_ERRORTYPE omx_error); +OMX_COLOR_FORMATTYPE g_omx_fourcc_to_colorformat (guint32 fourcc); +guint32 g_omx_colorformat_to_fourcc (OMX_COLOR_FORMATTYPE eColorFormat); +OMX_COLOR_FORMATTYPE g_omx_gstvformat_to_colorformat (GstVideoFormat videoformat); + + + +/** + * Basically like GST_BOILERPLATE / GST_BOILERPLATE_FULL, but follows the + * init fxn naming conventions used by gst-openmax. It expects the following + * functions to be defined in the same src file following this macro + * <ul> + * <li> type_base_init(gpointer g_class) + * <li> type_class_init(gpointer g_class, gpointer class_data) + * <li> type_instance_init(GTypeInstance *instance, gpointer g_class) + * </ul> + */ +#define GSTOMX_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \ +static void type_base_init (gpointer g_class); \ +static void type_class_init (gpointer g_class, gpointer class_data); \ +static void type_instance_init (GTypeInstance *instance, gpointer g_class); \ +static parent_type ## Class *parent_class; \ +static void type_class_init_trampoline (gpointer g_class, gpointer class_data)\ +{ \ + parent_class = g_type_class_ref (parent_type_macro); \ + type_class_init (g_class, class_data); \ +} \ +GType type_as_function ## _get_type (void) \ +{ \ + /* The typedef for GType may be gulong or gsize, depending on the \ + * system and whether the compiler is c++ or not. The g_once_init_* \ + * functions always take a gsize * though ... */ \ + static volatile gsize gonce_data = 0; \ + if (g_once_init_enter (&gonce_data)) { \ + GType _type; \ + GTypeInfo *type_info; \ + type_info = g_new0 (GTypeInfo, 1); \ + type_info->class_size = sizeof (type ## Class); \ + type_info->base_init = type_base_init; \ + type_info->class_init = type_class_init_trampoline; \ + type_info->instance_size = sizeof (type); \ + type_info->instance_init = type_instance_init; \ + _type = g_type_register_static (parent_type_macro, #type, type_info, 0);\ + g_free (type_info); \ + additional_initializations (_type); \ + g_once_init_leave (&gonce_data, (gsize) _type); \ + } \ + return (GType) gonce_data; \ +} + +#define GSTOMX_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \ + GSTOMX_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \ + __GST_DO_NOTHING) + + +/* Debug Macros: + */ +#if 1 +#define PRINT_BUFFER(obj, buffer) G_STMT_START { \ + if (buffer) { \ + GST_DEBUG_OBJECT (obj, #buffer "=%p (time=%"GST_TIME_FORMAT", duration=%"GST_TIME_FORMAT", flags=%08x, size=%d)", \ + (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), GST_TIME_ARGS (GST_BUFFER_DURATION(buffer)), \ + GST_BUFFER_FLAGS (buffer), GST_BUFFER_SIZE (buffer)); \ + } else { \ + GST_DEBUG_OBJECT (obj, #buffer "=null"); \ + } \ + } G_STMT_END +#else +#define PRINT_BUFFER(obj, buffer) G_STMT_START { \ + if (buffer) { \ + printf ( "buffer=%p (time=%"GST_TIME_FORMAT", duration=%"GST_TIME_FORMAT", flags=%08x, size=%d)\n", \ + (buffer), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)), GST_TIME_ARGS (GST_BUFFER_DURATION(buffer)), \ + GST_BUFFER_FLAGS (buffer), GST_BUFFER_SIZE (buffer)); \ + } else { \ + GST_DEBUG_OBJECT (obj, #buffer "=null"); \ + } \ + } G_STMT_END +#endif + +G_END_DECLS + +#endif /* GSTOMX_UTIL_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.c new file mode 100755 index 0000000..3d23dea --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.c @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_vc1dec.h" +#include "gstomx.h" + +#define PADX 16 +#define PADY 16 +#define UTIL_ALIGN(a,b) ((((OMX_U32)(a)) + (b)-1) & (~((OMX_U32)((b)-1)))) + +GSTOMX_BOILERPLATE (GstOmxVC1Dec, gst_omx_vc1dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-wmv", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS + ("video/x-raw-yuv, " /* UYVY */ + "format=(fourcc)UYVY, " + "framerate=(fraction)[ 0, MAX ], " + "width=(int)[ 1, MAX ], " + "height=(int)[ 1, MAX ]" + ) +); + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL vc1/WMV video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in vc1/WMV format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + + gst_element_class_add_pad_template(element_class, + gst_static_pad_template_get (&src_factory)); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *capStruct; + GstOmxBaseVideoDec *self; + GstOmxBaseFilter *omx_base; + GOmxCore *gomx; + GstBuffer *wmv_header_buf; + VC1SequenceHdr vc1header; + char *tmp; + guint32 fourcc; + + gint width = 0; + gint height = 0; + + self = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_BASE_FILTER (self); + + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + capStruct = gst_caps_get_structure(caps, 0); + + if (!gst_structure_get_fourcc(capStruct, "format", &fourcc)) { + fourcc = GST_MAKE_FOURCC('W','M','V','3'); + } + + if(fourcc == GST_MAKE_FOURCC('W','V','C','1')){ + GST_DEBUG_OBJECT (self, "Got wvc1 fourcc advance profile file"); + wmv_header_buf = gst_buffer_new_and_alloc(GST_BUFFER_SIZE (omx_base->codec_data)+3); + if (wmv_header_buf == NULL) { + GST_ERROR("Failed to allocate memory for wmv advance profile header\n"); + return NULL; + } + else{ + GST_DEBUG_OBJECT (self, "Allocated buffer for wmv header of size =%d",GST_BUFFER_SIZE (omx_base->codec_data)+3); + } + + if (omx_base->codec_data){ + tmp = (char*)GST_BUFFER_DATA(omx_base->codec_data); + //memcpy(GST_BUFFER_DATA(wmv_header_buf),(tmp+1),21); + memcpy(GST_BUFFER_DATA(wmv_header_buf),(tmp+1),(GST_BUFFER_SIZE (omx_base->codec_data)-1)); + tmp = (char*)GST_BUFFER_DATA(wmv_header_buf); + tmp[GST_BUFFER_SIZE (omx_base->codec_data)-1] = 0; + tmp[GST_BUFFER_SIZE (omx_base->codec_data)] = 0; + tmp[GST_BUFFER_SIZE (omx_base->codec_data)+1] = 1; + tmp[GST_BUFFER_SIZE (omx_base->codec_data)+2] = 0xd; + GST_BUFFER_SIZE(wmv_header_buf) = GST_BUFFER_SIZE (omx_base->codec_data)+3; + omx_base->codec_data = wmv_header_buf; + gst_buffer_ref (wmv_header_buf); + + } + else{ + GST_ERROR("No codec data"); + } + }//if(fourcc == GST_MAKE_FOURCC('W','V','C','1')) + else{ + GST_DEBUG_OBJECT (self, "got simple profile file"); + wmv_header_buf = gst_buffer_new_and_alloc(sizeof(VC1SequenceHdr)); + if (wmv_header_buf == NULL) { + GST_ERROR("Failed to allocate memory for wmv advance profile header\n"); + return NULL; + } + else{ + GST_DEBUG_OBJECT (self, "Allocated buffer for wmv header of size =%d",GST_BUFFER_SIZE (omx_base->codec_data)+3); + } + if (omx_base->codec_data){ + //omx_base->pVC1SqHdr = (struct VC1SequenceHdr*)malloc(sizeof(struct VC1SequenceHdr)); + vc1header.nFrames = (0xc5 << 24)| (100); + vc1header.resv1 = 0x4; + tmp = (char*)GST_BUFFER_DATA(omx_base->codec_data); + memcpy(&vc1header.StructC,tmp,4); // 4 bytes of sequence header + vc1header.StructA.width = self->extendedParams.height; + vc1header.StructA.height = self->extendedParams.width; + vc1header.resv2 = 0x0000000C; + vc1header.StructB[0] = 0; + vc1header.StructB[1] = 0; + vc1header.StructB[2] = 0; + memcpy(GST_BUFFER_DATA(wmv_header_buf),&vc1header,36); + GST_BUFFER_SIZE(wmv_header_buf) = 36; + omx_base->codec_data = wmv_header_buf; + } + else{ + GST_ERROR("No codec data"); + } + + } + return gst_pad_set_caps (pad, caps); + +} + + +static void +initialize_port (GstOmxBaseFilter *omx_base) +{ + + GstOmxBaseVideoDec *self; + GOmxCore *gomx; + OMX_PORT_PARAM_TYPE portInit; + OMX_PARAM_PORTDEFINITIONTYPE pInPortDef, pOutPortDef; + gint width, height; + GOmxPort *port; + + self = GST_OMX_BASE_VIDEODEC (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "begin"); + + width = self->extendedParams.width; + height = self->extendedParams.height; + _G_OMX_INIT_PARAM(&portInit); + portInit.nPorts = 2; + portInit.nStartPortNumber = 0; + G_OMX_PORT_SET_PARAM(omx_base->in_port,OMX_IndexParamAudioInit,&portInit); + + _G_OMX_INIT_PARAM(&pInPortDef); + + /* populate the input port definataion structure, It is Standard OpenMax + structure */ + /* set the port index */ + pInPortDef.nPortIndex = 0;//OMX_VIDDEC_INPUT_PORT; + /* It is input port so direction is set as Input, Empty buffers call would be + accepted based on this */ + pInPortDef.eDir = OMX_DirInput; + /* number of buffers are set here */ + pInPortDef.nBufferCountActual = 4; + pInPortDef.nBufferCountMin = 1; + /* buffer size by deafult is assumed as width * height for input bitstream + which would suffice most of the cases */ + pInPortDef.nBufferSize = width * height; + + pInPortDef.bEnabled = OMX_TRUE; + pInPortDef.bPopulated = OMX_FALSE; + pInPortDef.eDomain = OMX_PortDomainVideo; + pInPortDef.bBuffersContiguous = OMX_FALSE; + pInPortDef.nBufferAlignment = 0x0; + + /* OMX_VIDEO_PORTDEFINITION values for input port */ + + pInPortDef.format.video.cMIMEType = "VC1"; + pOutPortDef.format.video.cMIMEType = "VC1"; + pOutPortDef.nBufferSize = + ((((width + (2 * 16) + 127) & 0xFFFFFF80) * ((height + + (4 * 16))) * 3) >> 1) + + 256; + pInPortDef.format.video.pNativeRender = NULL; + /* set the width and height, used for buffer size calculation */ + pInPortDef.format.video.nFrameWidth = width; + pInPortDef.format.video.nFrameHeight = height; + /* for bitstream buffer stride is not a valid parameter */ + pInPortDef.format.video.nStride = -1; + /* component supports only frame based processing */ + pInPortDef.format.video.nSliceHeight = 0; + + /* bitrate does not matter for decoder */ + //pInPortDef.format.video.nBitrate = 104857600; + /* as per openmax frame rate is in Q16 format */ + //pInPortDef.format.video.xFramerate = 60 << 16; + pInPortDef.format.video.xFramerate = 60<<16;//(self->framerate_num/self->framerate_denom)<<16; + /* input port would receive H264 stream */ + pInPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingWMV;//compressionFormat; + /* this is codec setting, OMX component does not support it */ + pInPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* color format is irrelavant */ + pInPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &pInPortDef); + + _G_OMX_INIT_PARAM(&pOutPortDef); + pOutPortDef.nPortIndex = 1;//OMX_VIDDEC_OUTPUT_PORT; + pOutPortDef.eDir = OMX_DirOutput; + /* componet would expect these numbers of buffers to be allocated */ + pOutPortDef.nBufferCountActual = 8; + pOutPortDef.nBufferCountMin = 1; + + /* Codec requires padded height and width and width needs to be aligned at + 128 byte boundary */ + + pOutPortDef.bEnabled = OMX_TRUE; + pOutPortDef.bPopulated = OMX_FALSE; + pOutPortDef.eDomain = OMX_PortDomainVideo; + /* currently component alloactes contigous buffers with 128 alignment, these + values are do't care */ + pOutPortDef.bBuffersContiguous = OMX_FALSE; + pOutPortDef.nBufferAlignment = 0x0; + /* OMX_VIDEO_PORTDEFINITION values for output port */ + pOutPortDef.format.video.cMIMEType = "H264"; + pOutPortDef.format.video.pNativeRender = NULL; + pOutPortDef.format.video.nFrameWidth = width; + pOutPortDef.format.video.nFrameHeight = height; + + /* stride is set as buffer width */ + pOutPortDef.format.video.nStride = UTIL_ALIGN (width + (2 * PADX), 128); + pOutPortDef.format.video.nSliceHeight = 0; + /* bitrate does not matter for decoder */ + //pOutPortDef.format.video.nBitrate = 25000000; + /* as per openmax frame rate is in Q16 format */ + //pOutPortDef.format.video.xFramerate = 60 << 16; + pOutPortDef.format.video.xFramerate = 60<<16;//(self->framerate_num/self->framerate_denom)<<16; + pOutPortDef.format.video.bFlagErrorConcealment = OMX_FALSE; + /* output is raw YUV 420 SP format, It support only this */ + pOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + pOutPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &pOutPortDef); + + + port = g_omx_core_get_port (gomx, "input", 0); + port = g_omx_core_get_port (gomx, "output", 1); + GST_INFO_OBJECT (omx_base, "end"); + +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + + GstOmxBaseVideoDec *omx_base; + omx_base = GST_OMX_BASE_VIDEODEC (instance); + omx_base->compression_format = OMX_VIDEO_CodingWMV; + omx_base->initialize_port = initialize_port; + omx_base->sink_setcaps = sink_setcaps; + +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.h new file mode 100755 index 0000000..ce189b4 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vc1dec.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_VC1DEC_H +#define GSTOMX_VC1DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_VC1DEC(obj) (GstOmxVC1Dec *) (obj) +#define GST_OMX_VC1DEC_TYPE (gst_omx_vc1dec_get_type ()) + +typedef struct GstOmxVC1Dec GstOmxVC1Dec; +typedef struct GstOmxVC1DecClass GstOmxVC1DecClass; + +#include "gstomx_base_videodec.h" + +typedef struct VC1StructA +{ + OMX_U32 width; + OMX_U32 height; +}VC1StructA; + +typedef struct VC1SequenceHdr +{ + OMX_U32 nFrames; + OMX_U32 resv1; + OMX_U32 StructC; + VC1StructA StructA; + OMX_U32 resv2; + OMX_U32 StructB[3]; +}VC1SequenceHdr; + +struct GstOmxVC1Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxVC1DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_vc1dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VC1DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.c new file mode 100755 index 0000000..023a428 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.c @@ -0,0 +1,1697 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_videomixer.h" +#include "gstomx.h" +#include "gstomx_interface.h" +#include "gstomx_buffertransport.h" + +enum +{ + ARG_0, + ARG_COMPONENT_ROLE, + ARG_COMPONENT_NAME, + ARG_LIBRARY_NAME, + ARG_USE_TIMESTAMPS, + ARG_NUM_INPUT_BUFFERS, + ARG_NUM_OUTPUT_BUFFERS, + ARG_PORT_INDEX, +}; + +static void init_interfaces (GType type); +GSTOMX_BOILERPLATE_FULL (GstOmxVideoMixer, gst_omx_video_mixer, GstElement, GST_TYPE_ELEMENT, init_interfaces); + +static GstStaticPadTemplate sink_template = + GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV_STRIDED ( + "{NV12}", "[ 0, max ]")) + ); + +static GstStaticPadTemplate src_template = + GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ( "{YUY2}" )) + ); + + + +static GstFlowReturn push_buffer (GstOmxVideoMixer *self, GstBuffer *buf); +static GstFlowReturn pad_chain (GstPad *pad, GstBuffer *buf); +static gboolean pad_event (GstPad *pad, GstEvent *event); + +static void* vidmix_input_loop(void *arg); + + +static void +setup_input_buffer (GstOmxVideoMixer *self) +{ + guint ii; + GstBuffer *buf; + for(ii = 0; ii < NUM_PORTS; ii++) { + /* if (GST_IS_OMXBUFFERTRANSPORT (buf))*/ + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port, *in_port; + gint i; + in_port = self->in_port[ii]; + /* retrieve incoming buffer port information */ + buf = (GstBuffer *)async_queue_pop_full(self->chInfo[ii].queue,TRUE,FALSE); + port = GST_GET_OMXPORT (buf); + /* configure input buffer size to match with upstream buffer */ + G_OMX_PORT_GET_DEFINITION (self->in_port[ii], ¶m); + param.nBufferSize = GST_BUFFER_SIZE (buf); + param.nBufferCountActual = port->num_buffers; + G_OMX_PORT_SET_DEFINITION (self->in_port[ii], ¶m); + + /* allocate resource to save the incoming buffer port pBuffer pointer in + * OmxBufferInfo structure. + */ + in_port->share_buffer_info = malloc (sizeof(OmxBufferInfo)); + in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers); + for (i=0; i < port->num_buffers; i++) { + in_port->share_buffer_info->pBuffer[i] = port->buffers[i]->pBuffer; + } + + /* disable omx_allocate alloc flag, so that we can fall back to shared method */ + self->in_port[ii]->omx_allocate = FALSE; + self->in_port[ii]->always_copy = FALSE; + async_queue_push (self->chInfo[ii].queue, buf); + } + /*else + { + printf("Ensure upstream component allocates OMX buffer!!\n"); + }*/ + } +} +#if 0 +static void +gstomx_vfpc_set_port_index (GObject *obj, int index) +{ + GstOmxVideoMixer *omx_base; + GstOmxVideoMixer *self; + + omx_base = GST_OMX_VIDEO_MIXER (obj); + self = GST_OMX_VIDEO_MIXER (obj); + + self->input_port_index = OMX_VFPC_INPUT_PORT_START_INDEX + index; + self->output_port_index = OMX_VFPC_OUTPUT_PORT_START_INDEX + index; + + /* free the existing core and ports */ + g_omx_core_free (omx_base->gomx); + g_omx_port_free (omx_base->in_port); + g_omx_port_free (omx_base->out_port); + + /* create new core and ports */ + omx_base->gomx = g_omx_core_new (omx_base, self->g_class); + omx_base->in_port = g_omx_core_get_port (omx_base->gomx, "in", self->input_port_index); + omx_base->out_port = g_omx_core_get_port (omx_base->gomx, "out", self->output_port_index); + + omx_base->in_port->omx_allocate = TRUE; + omx_base->in_port->share_buffer = FALSE; + omx_base->in_port->always_copy = FALSE; + + omx_base->out_port->omx_allocate = TRUE; + omx_base->out_port->share_buffer = FALSE; + omx_base->out_port->always_copy = FALSE; + + omx_base->in_port->port_index = self->input_port_index; + omx_base->out_port->port_index = self->output_port_index; +} +#endif + +static GstStateChangeReturn +change_state (GstElement *element, + GstStateChange transition) +{ + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstOmxVideoMixer *self; + GOmxCore *core; + + self = GST_OMX_VIDEO_MIXER (element); + core = self->gomx; + + GST_INFO_OBJECT (self, "begin: changing state %s -> %s", + gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)), + gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); + + + switch (transition) + { + case GST_STATE_CHANGE_NULL_TO_READY: + g_omx_core_init (core); + if (core->omx_state != OMX_StateLoaded) + { + ret = GST_STATE_CHANGE_FAILURE; + goto leave; + } else { + } + break; + + default: + break; + } + //sleep(10); + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + if (ret == GST_STATE_CHANGE_FAILURE) + goto leave; + + switch (transition) + { + case GST_STATE_CHANGE_PAUSED_TO_READY: + if (self->ready) + { + int ii = 0; + guint thread_ret; + gpointer obj; + /* unlock */ + + for(ii = 0; ii < NUM_PORTS; ii++) { + g_omx_port_finish (self->in_port[ii]); + g_omx_port_finish (self->out_port[ii]); + } + for(ii = 0; ii < NUM_PORTS; ii++) + async_queue_disable (self->chInfo[ii].queue); + + // printf("Waiting for ip thread to exit!!\n"); + pthread_join(self->input_loop, &thread_ret); + + for(ii = 0; ii < NUM_PORTS; ii++) + while(obj = async_queue_pop_full(self->chInfo[ii].queue, FALSE, TRUE)) { + // printf("freeing un-processed buffer in queue - %d\n",ii); + gst_buffer_unref(obj); + } + + g_omx_core_stop (core); + g_omx_core_unload (core); + self->ready = FALSE; + } + // g_mutex_unlock (self->ready_lock); + if (core->omx_state != OMX_StateLoaded && + core->omx_state != OMX_StateInvalid) + { + ret = GST_STATE_CHANGE_FAILURE; + goto leave; + } + break; + + case GST_STATE_CHANGE_READY_TO_NULL: + //printf("calling g_omx_core_deinit\n"); + g_omx_core_deinit (core); + break; + + default: + break; + } + +leave: + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static void +finalize (GObject *obj) +{ + GstOmxVideoMixer *self; + + self = GST_OMX_VIDEO_MIXER (obj); + + if (self->codec_data) + { + gst_buffer_unref (self->codec_data); + self->codec_data = NULL; + } + + g_omx_core_free (self->gomx); + + g_free (self->omx_role); + g_free (self->omx_component); + g_free (self->omx_library); + + g_mutex_free (self->ready_lock); + + G_OBJECT_CLASS (parent_class)->finalize (obj); +} + +static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxVideoMixer *self; + + self = GST_OMX_VIDEO_MIXER (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_free (self->omx_role); + self->omx_role = g_value_dup_string (value); + break; + case ARG_COMPONENT_NAME: + g_free (self->omx_component); + self->omx_component = g_value_dup_string (value); + break; + case ARG_LIBRARY_NAME: + g_free (self->omx_library); + self->omx_library = g_value_dup_string (value); + break; + case ARG_USE_TIMESTAMPS: + self->gomx->use_timestamps = g_value_get_boolean (value); + break; + case ARG_NUM_INPUT_BUFFERS: + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + OMX_U32 nBufferCountActual = g_value_get_uint (value); + GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ? + self->in_port : self->out_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_return_if_fail (nBufferCountActual >= param.nBufferCountMin); + param.nBufferCountActual = nBufferCountActual; + + G_OMX_PORT_SET_DEFINITION (port, ¶m); + } + break; + case ARG_PORT_INDEX: + self->port_index = g_value_get_uint (value); + if (!self->port_configured) + //gstomx_vfpc_set_port_index (obj, self->port_index); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *obj, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxVideoMixer *self; + + self = GST_OMX_VIDEO_MIXER (obj); + + switch (prop_id) + { + case ARG_COMPONENT_ROLE: + g_value_set_string (value, self->omx_role); + break; + case ARG_COMPONENT_NAME: + g_value_set_string (value, self->omx_component); + break; + case ARG_LIBRARY_NAME: + g_value_set_string (value, self->omx_library); + break; + case ARG_USE_TIMESTAMPS: + g_value_set_boolean (value, self->gomx->use_timestamps); + break; + case ARG_NUM_INPUT_BUFFERS: + case ARG_NUM_OUTPUT_BUFFERS: + { + OMX_PARAM_PORTDEFINITIONTYPE param; + GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ? + self->in_port : self->out_port; + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + + g_value_set_uint (value, param.nBufferCountActual); + } + break; + case ARG_PORT_INDEX: + g_value_set_uint (value, self->port_index); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + break; + } +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL for OMX.TI.VPSSM3.VFPC.INDTXSCWB component"; + details.klass = "Filter"; + details.description = "Scale video using VPSS Scaler module "; + details.author = "Prashant Nandakumar"; + + gst_element_class_set_details (element_class, &details); + } + printf("In base init!!\n"); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_template)); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_template)); + +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstOmxVideoMixerClass *bclass; + + gobject_class = G_OBJECT_CLASS (g_class); + gstelement_class = GST_ELEMENT_CLASS (g_class); + bclass = GST_OMX_VIDEO_MIXER_CLASS (g_class); + printf("In class init!!\n"); + gobject_class->finalize = finalize; + gstelement_class->change_state = change_state; + bclass->push_buffer = push_buffer; + bclass->pad_chain = pad_chain; + bclass->pad_event = pad_event; + + /* Properties stuff */ + { + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE, + g_param_spec_string ("component-role", "Component role", + "Role of the OpenMAX IL component", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME, + g_param_spec_string ("component-name", "Component name", + "Name of the OpenMAX IL component to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME, + g_param_spec_string ("library-name", "Library name", + "Name of the OpenMAX IL implementation library to use", + NULL, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS, + g_param_spec_boolean ("use-timestamps", "Use timestamps", + "Whether or not to use timestamps", + TRUE, G_PARAM_READWRITE)); + + /* note: the default values for these are just a guess.. since we wouldn't know + * until the OMX component is constructed. But that is ok, these properties are + * only for debugging + */ + g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS, + g_param_spec_uint ("input-buffers", "Input buffers", + "The number of OMX input buffers", + 1, 10, 4, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS, + g_param_spec_uint ("output-buffers", "Output buffers", + "The number of OMX output buffers", + 1, 10, 4, G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_PORT_INDEX, + g_param_spec_uint ("port-index", "port index", + "input/output start port index", + 0, 8, 0, G_PARAM_READWRITE)); + } +} + +static GstCaps* +create_src_caps (GstOmxVideoMixer *omx_base) +{ + GstCaps *caps; + GstOmxVideoMixer *self; + int width, height; + GstStructure *struc; + + self = GST_OMX_VIDEO_MIXER (omx_base); + caps = gst_pad_peer_get_caps (omx_base->srcpad); + printf("create src caps!!\n"); + if (gst_caps_is_empty (caps)) + { + width = self->chInfo[0].in_width; + height = self->chInfo[0].in_height; + printf("set 1 height:%d, width:%d\n",height,width); + } + else + { + GstStructure *s; + + s = gst_caps_get_structure (caps, 0); + + if (!(gst_structure_get_int (s, "width", &width) && + gst_structure_get_int (s, "height", &height))) + { + width = self->chInfo[0].in_width; + height = self->chInfo[0].in_height; + printf("set 2 height:%d, width:%d\n",height,width); + } + } + printf("set 3 height:%d, width:%d\n",height,width); + caps = gst_caps_new_empty (); + struc = gst_structure_new (("video/x-raw-yuv"), + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), + NULL); + + + if (self->framerate_denom) + { + gst_structure_set (struc, + "framerate", GST_TYPE_FRACTION, self->framerate_num, self->framerate_denom, NULL); + } + + gst_caps_append_structure (caps, struc); + + printf("createdf caps:%s\n",gst_caps_to_string(caps)); + + return caps; +} + + +static void +scaler_setup (GstOmxVideoMixer *omx_base) +{ + GOmxCore *gomx; + OMX_ERRORTYPE err; + OMX_PARAM_PORTDEFINITIONTYPE paramPort; + OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg; + OMX_PARAM_VFPC_NUMCHANNELPERHANDLE numChannels; + OMX_CONFIG_VIDCHANNEL_RESOLUTION chResolution; + OMX_CONFIG_ALG_ENABLE algEnable; + GstOmxVideoMixer *self; + int ii; + + gomx = (GOmxCore *) omx_base->gomx; + self = GST_OMX_VIDEO_MIXER (omx_base); + + GST_LOG_OBJECT (self, "begin"); + printf("scaler setup!!|n"); + /* set the output cap */ + gst_pad_set_caps (omx_base->srcpad, create_src_caps (omx_base)); + + /* Setting Memory type at input port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting input port to Raw memory"); + for(ii = 0; ii < NUM_PORTS; ii++) { + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->input_port_index[ii]; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Setting Memory type at output port to Raw Memory */ + GST_LOG_OBJECT (self, "Setting output port to Raw memory"); + + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = self->output_port_index[ii]; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + err = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + if (err != OMX_ErrorNone) + return; + + /* Input port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (input)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->in_port[ii], ¶mPort); + paramPort.format.video.nFrameWidth = self->chInfo[ii].in_width; + paramPort.format.video.nFrameHeight = self->chInfo[ii].in_height; + paramPort.format.video.nStride = self->chInfo[ii].in_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; + paramPort.nBufferSize = self->chInfo[ii].in_stride * self->chInfo[ii].in_height * 1.5; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->in_port[ii], ¶mPort); + g_omx_port_setup (omx_base->in_port[ii], ¶mPort); + + /* Output port configuration. */ + GST_LOG_OBJECT (self, "Setting port definition (output)"); + + G_OMX_PORT_GET_DEFINITION (omx_base->out_port[ii], ¶mPort); + paramPort.format.video.nFrameWidth = self->out_width/2; + paramPort.format.video.nFrameHeight = self->out_height/2; + paramPort.format.video.nStride = self->out_stride; + paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; + paramPort.nBufferSize = self->out_stride * self->out_height; + paramPort.nBufferCountActual = 8; + paramPort.nBufferAlignment = 0; + paramPort.bBuffersContiguous = 0; + G_OMX_PORT_SET_DEFINITION (omx_base->out_port[ii], ¶mPort); + g_omx_port_setup (omx_base->out_port[ii], ¶mPort); + + } + /* Set number of channles */ + GST_LOG_OBJECT (self, "Setting number of channels"); + + _G_OMX_INIT_PARAM (&numChannels); + numChannels.nNumChannelsPerHandle = NUM_PORTS; + err = OMX_SetParameter (gomx->omx_handle, + (OMX_INDEXTYPE) OMX_TI_IndexParamVFPCNumChPerHandle, &numChannels); + + if (err != OMX_ErrorNone) + return; + + for(ii = 0; ii < NUM_PORTS; ii++) { + /* Set input channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (input)"); + + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->chInfo[ii].in_width; + chResolution.Frm0Height = self->chInfo[ii].in_height; + chResolution.Frm0Pitch = self->chInfo[ii].in_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = self->left; + chResolution.FrmStartY = self->top; + chResolution.FrmCropWidth = 0; + chResolution.FrmCropHeight = 0; + chResolution.eDir = OMX_DirInput; + chResolution.nPortIndex = ii; + chResolution.nChId = ii; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + /* Set output channel resolution */ + GST_LOG_OBJECT (self, "Setting channel resolution (output)"); + _G_OMX_INIT_PARAM (&chResolution); + chResolution.Frm0Width = self->out_width/2; + chResolution.Frm0Height = self->out_height/2; + chResolution.Frm0Pitch = self->out_stride; + chResolution.Frm1Width = 0; + chResolution.Frm1Height = 0; + chResolution.Frm1Pitch = 0; + chResolution.FrmStartX = 0; + chResolution.FrmStartY = 0; + chResolution.FrmCropWidth = 0; + chResolution.FrmCropHeight = 0; + chResolution.eDir = OMX_DirOutput; + chResolution.nPortIndex = ii; + chResolution.nChId = ii; + err = OMX_SetConfig (gomx->omx_handle, OMX_TI_IndexConfigVidChResolution, &chResolution); + + if (err != OMX_ErrorNone) + return; + + _G_OMX_INIT_PARAM (&algEnable); + algEnable.nPortIndex = ii; + algEnable.nChId = ii; + algEnable.bAlgBypass = OMX_FALSE; + + err = OMX_SetConfig (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexConfigAlgEnable, &algEnable); + + if (err != OMX_ErrorNone) + return; + } + printf("scaler setup...done!!|n"); +} + +static void +omx_setup (GstOmxVideoMixer *omx_base) +{ + GstOmxVideoMixer *self; + GOmxCore *gomx; + GOmxPort *port; + int ii; + + self = GST_OMX_VIDEO_MIXER (omx_base); + gomx = (GOmxCore *) omx_base->gomx; + printf("omx_setup!!\n"); + GST_INFO_OBJECT (omx_base, "begin"); + + /* enable input port */ + for(ii = 0; ii < NUM_PORTS; ii++) { + port = omx_base->in_port[ii]; + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + + /* enable output port */ + port = omx_base->out_port[ii]; + OMX_SendCommand (g_omx_core_get_handle (port->core), + OMX_CommandPortEnable, port->port_index, NULL); + g_sem_down (port->core->port_sem); + } + + /* indicate that port is now configured */ + self->port_configured = TRUE; + printf("omx_setup...done!!\n"); + GST_INFO_OBJECT (omx_base, "end"); +} + + +static GstFlowReturn +push_buffer (GstOmxVideoMixer *self, + GstBuffer *buf) +{ + GstFlowReturn ret; + + GST_BUFFER_DURATION (buf) = self->duration; + + PRINT_BUFFER (self, buf); + + /** @todo check if tainted */ + GST_LOG_OBJECT (self, "begin"); + ret = gst_pad_push (self->srcpad, buf); + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static OMX_BUFFERHEADERTYPE * +request_buffer (GOmxPort *port) +{ + //LOG (port, "request buffer"); + return async_queue_pop (port->queue); +} + + +gpointer +vidmix_port_recv (GstOmxVideoMixer *self) +{ + gpointer ret = NULL; + GOmxPort *port; + OMX_BUFFERHEADERTYPE *omx_buffer,*omx_buffer1; + guint ii; + OMX_BUFFERHEADERTYPE *omx_bufferHdr[NUM_PORTS - 1]; +//printf("a\n"); + //while (!ret && port->enabled) + for(ii = 0; ii < NUM_PORTS; ii++) + { + + port = self->out_port[ii]; + g_return_val_if_fail (port->type == GOMX_PORT_OUTPUT, NULL); + + if((self->chInfo[ii].eos == TRUE) && (self->numEosPending != 0)) { + omx_bufferHdr[ii-1] = NULL; + continue; + } + //printf("Request buffer:%d!!\n",ii); + omx_buffer1 = request_buffer (port); + //printf("got buffer:%d!!\n",ii); + + if (G_UNLIKELY (!omx_buffer1)) + { + return NULL; + } + + if(ii == 0) { + omx_buffer = omx_buffer1; + } else { + //printf("vidmixop:%p\n",omx_buffer1); + omx_bufferHdr[ii-1] = omx_buffer1; + } + + + if (G_UNLIKELY (omx_buffer1->nFlags & OMX_BUFFERFLAG_EOS)) + { + //DEBUG (port, "got eos"); + return gst_event_new_eos (); + } + } + + + if (G_LIKELY (omx_buffer->nFilledLen > 0)) + { + GstBuffer *buf; + + buf = gst_omxbuffertransport_new (self->out_port[0], omx_buffer); + //printf("buffer size:%d\n",GST_BUFFER_SIZE(buf)); + GST_BUFFER_SIZE(buf) = GST_BUFFER_SIZE(buf)*2; + if (port->core->use_timestamps) + { + GST_BUFFER_TIMESTAMP (buf) = gst_util_uint64_scale_int ( + omx_buffer->nTimeStamp, + GST_SECOND, OMX_TICKS_PER_SECOND); + } + + gst_omxbuffertransport_set_additional_headers (buf ,NUM_PORTS -1,&omx_bufferHdr); + + port->n_offset = omx_buffer->nOffset; + + ret = buf; + } + //printf("b\n"); +return ret; +} +static void +output_loop (gpointer data) +{ + GstPad *pad; + GOmxCore *gomx; + GOmxPort *out_port; + GstOmxVideoMixer *self; + GstFlowReturn ret = GST_FLOW_OK; + GstOmxVideoMixerClass *bclass; + gpointer obj; + pad = data; + self = GST_OMX_VIDEO_MIXER (gst_pad_get_parent (pad)); + gomx = self->gomx; + + bclass = GST_OMX_VIDEO_MIXER_GET_CLASS (self); + + GST_LOG_OBJECT (self, "begin"); + + if (!self->ready) + { + g_error ("not ready"); + return; + } + + out_port = self->out_port[0]; + + if (G_LIKELY (out_port->enabled)) + { + obj = vidmix_port_recv (self); + if (G_UNLIKELY (!obj)) + { + GST_WARNING_OBJECT (self, "null buffer: leaving"); + printf("NULL buffer leaving!!\n"); + ret = GST_FLOW_WRONG_STATE; + goto leave; + } + + if (G_LIKELY (GST_IS_BUFFER (obj))) + { + + GstBuffer *buf = GST_BUFFER (obj); + ret = bclass->push_buffer (self, buf); + GST_DEBUG_OBJECT (self, "ret=%s", gst_flow_get_name (ret)); + + } + else if (GST_IS_EVENT (obj)) + { + GST_DEBUG_OBJECT (self, "got eos"); + printf("here....eos!!\n"); + gst_pad_push_event (self->srcpad, obj); + ret = GST_FLOW_UNEXPECTED; + goto leave; + } + } + +leave: + + self->last_pad_push_return = ret; + + if (gomx->omx_error != OMX_ErrorNone) + { + GST_DEBUG_OBJECT (self, "omx_error=%s", g_omx_error_to_str (gomx->omx_error)); + ret = GST_FLOW_ERROR; + } + + if (ret != GST_FLOW_OK) + { + GST_INFO_OBJECT (self, "pause task, reason: %s", + gst_flow_get_name (ret)); + gst_pad_pause_task (self->srcpad); + } + + GST_LOG_OBJECT (self, "end"); + + gst_object_unref (self); +} + +void +vidmix_prepare (GOmxPort *port) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; +#if 0 + GstBuffer *buf; + guint size; + + DEBUG (port, "begin"); + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + buf = buffer_alloc (port, size); + + if (GST_BUFFER_SIZE (buf) != size) + { + DEBUG (port, "buffer sized changed, %d->%d", + size, GST_BUFFER_SIZE (buf)); + } +#endif + /* number of buffers could have changed */ + G_OMX_PORT_GET_DEFINITION (port, ¶m); + port->num_buffers = param.nBufferCountActual; + + // gst_buffer_unref (buf); +} +static void +videomixer_port_prepare (GOmxPort *port) +{ + /* only prepare if the port is actually enabled: */ + if (port->enabled) + vidmix_prepare (port); +} + +typedef void (*GOmxPortFunc) (GOmxPort *port); + +static inline GOmxPort * +get_port (GOmxCore *core, guint index) +{ + if (G_LIKELY (index < core->ports->len)) + { + return g_ptr_array_index (core->ports, index); + } + + return NULL; +} + + +static void inline +core_for_each_port (GOmxCore *core, + GOmxPortFunc func) +{ + guint index; + + for (index = 0; index < core->ports->len; index++) + { + GOmxPort *port; + + port = get_port (core, index); + + if (port) + func (port); + } +} + +static inline void +change_state1 (GOmxCore *core, + OMX_STATETYPE state) +{ + GST_DEBUG_OBJECT (core->object, "state=%d", state); + OMX_SendCommand (core->omx_handle, OMX_CommandStateSet, state, NULL); +} + +static inline void +wait_for_state (GOmxCore *core, + OMX_STATETYPE state) +{ + GTimeVal tv; + gboolean signaled; + + g_mutex_lock (core->omx_state_mutex); + + if (core->omx_error != OMX_ErrorNone) + goto leave; + + g_get_current_time (&tv); + g_time_val_add (&tv, 100000000); + + /* try once */ + if (core->omx_state != state) + { + signaled = g_cond_timed_wait (core->omx_state_condition, core->omx_state_mutex, &tv); + + if (!signaled) + { + GST_ERROR_OBJECT (core->object, "timed out"); + } + } + + if (core->omx_error != OMX_ErrorNone) + goto leave; + + if (core->omx_state != state) + { + GST_ERROR_OBJECT (core->object, "wrong state received: state=%d, expected=%d", + core->omx_state, state); + } + +leave: + g_mutex_unlock (core->omx_state_mutex); +} +//guint arr[3] = {1920,3840*1080/2,3840*1080/2+1920}; +//guint arr[3] = {1280,1280*720,1280*720+1280}; +guint arr[3][2] = { {1,0}, {0,1}, {1,1} }; +//guint arr[3] = {720,720*480,720*480+720}; + + +void +vidmix_port_allocate_buffers (GstOmxVideoMixer *self) +{ + OMX_PARAM_PORTDEFINITIONTYPE param; + guint i,ii; + guint size; + GOmxPort *port; + + for(ii = 0; ii < NUM_PORTS; ii++) { + + port = self->in_port[ii]; + if (port->buffers) { + printf("WTF?? buffers already allocated!!\n"); + return; + } + + //DEBUG (port, "begin"); + + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers); + + for (i = 0; i < port->num_buffers; i++) + { + gpointer buffer_data = NULL; + + buffer_data = port->share_buffer_info->pBuffer[i]; + + //DEBUG (port, "%d: OMX_UseBuffer(), size=%d, share_buffer=%d", i, size, port->share_buffer); + OMX_UseBuffer (port->core->omx_handle, + &port->buffers[i], + port->port_index, + NULL, + size, + buffer_data); + + //printf("portidx ip of buffer ip:%d, op:%d\n",port->buffers[i]->nInputPortIndex,port->buffers[i]->nOutputPortIndex); + + g_return_if_fail (port->buffers[i]); + } + } + + for(ii = 0; ii < NUM_PORTS; ii++) { + + port = self->out_port[ii]; + if (port->buffers) { + printf("Invalid !! buffers already allocated...\n"); + return; + } + + //DEBUG (port, "begin"); + if(ii == 0) { + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers); + + for (i = 0; i < port->num_buffers; i++) + { + gpointer buffer_data = NULL; + + //DEBUG (port, "%d: OMX_AllocateBuffer(), size=%d", i, size); + //printf("allocating buffer for port idx:%d\n",port->port_index); + OMX_AllocateBuffer (port->core->omx_handle, + &port->buffers[i], + port->port_index, + NULL, + size); + + + //printf("portidx op of buffer ip:%d, op:%d\n",port->buffers[i]->nInputPortIndex,port->buffers[i]->nOutputPortIndex); + g_return_if_fail (port->buffers[i]); + //printf("allocated buffer:%p\n",port->buffers[i]->pBuffer); + } + }else { + G_OMX_PORT_GET_DEFINITION (port, ¶m); + size = param.nBufferSize; + + port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers); + + for (i = 0; i < port->num_buffers; i++) + { + gpointer buffer_data = NULL; + + //printf("Use buffer for port idx:%d\n",port->port_index); + buffer_data = self->out_port[0]->buffers[i]->pBuffer; + //printf("Use buffer:%p\n",buffer_data); + //printf("out_width:%d out_height:%d\n",self->out_width,self->out_height); + OMX_UseBuffer (port->core->omx_handle, + &port->buffers[i], + port->port_index, + NULL, + size, + (gchar*)buffer_data+(arr[ii -1][0]*self->out_width + arr[ii -1][1]*self->out_width*self->out_height)); + + + g_return_if_fail (port->buffers[i]); + } + + } + } + // DEBUG (port, "end"); +} + + +static void +videomixer_port_allocate_buffers (GOmxPort *port) +{ + /* only allocate buffers if the port is actually enabled: */ + if (port->enabled) + vidmix_port_allocate_buffers (port); +} + + +void +videomixer_prepare (GstOmxVideoMixer *self,GOmxCore *core) +{ + GST_DEBUG_OBJECT (core->object, "begin"); + + /* Prepare port */ + core_for_each_port (core, videomixer_port_prepare); + + change_state1 (core, OMX_StateIdle); + + /* Allocate buffers. */ + //core_for_each_port (core, videomixer_port_allocate_buffers); + videomixer_port_allocate_buffers(self); + + wait_for_state (core, OMX_StateIdle); + GST_DEBUG_OBJECT (core->object, "end"); +} + +static void* vidmix_input_loop(void *arg) { + GstOmxVideoMixer *self = (GstOmxVideoMixer *)arg; + GOmxPort *port,*in_port; + int ii; + GstBuffer * buf; + GOmxCore *gomx; + int kk=0; + gint sent; + + port = self->in_port[0]; + gomx = port->core; + + if (G_UNLIKELY (gomx->omx_state == OMX_StateLoaded)) + { + GST_INFO_OBJECT (self, "omx: prepare"); + + /** @todo this should probably **/ + + omx_setup (self); + + + setup_input_buffer (self); + + scaler_setup(self); + + //printf("calline prepare!!\n"); + videomixer_prepare (self,self->gomx); + //printf("calline prepare returned!!\n"); + + if (gomx->omx_state == OMX_StateIdle) + { + self->ready = TRUE; + //printf("Starting output loop1\n"); + gst_pad_start_task (self->srcpad, output_loop, self->srcpad); + } + + if (gomx->omx_state != OMX_StateIdle) { + //g_mutex_unlock (self->ready_lock); + printf("Transition to idle failed!!\n"); + } + } + + //printf("inport enabled:%d\n",in_port->enabled); + in_port = self->in_port[0]; + if (G_LIKELY (in_port->enabled)) + { + if (G_UNLIKELY (gomx->omx_state == OMX_StateIdle)) + { + GST_INFO_OBJECT (self, "omx: play"); + printf("calling omx start!!\n"); + g_omx_core_start (gomx); + printf("calling omx startret \n"); + + if (gomx->omx_state != OMX_StateExecuting) { + //g_mutex_unlock (self->ready_lock); + printf("Transition to executing failed!!\n"); + } + } + } + else + { + printf("port not ennabled!!\n"); + } + + + while(TRUE) { + for(ii = 0; ii < NUM_PORTS; ii++) { + port = self->in_port[ii]; + gomx = port->core; + buf = NULL; + //printf("pop queue:%d\n",ii); + if(self->chInfo[ii].eos == FALSE) { + buf = (GstBuffer *)async_queue_pop_full(self->chInfo[ii].queue,TRUE,FALSE); + if(buf == NULL) { + //printf("NULL buffer...ip exiting!!\n"); + goto leave; + } + + //printf("send: %d:%p!!\n",ii,buf); + sent = g_omx_port_send (port, buf); + gst_buffer_unref (buf); + } + + } + + } + +leave: + //printf("leaving ip thread!!\n"); + return NULL; + +} + +static GstFlowReturn +pad_chain (GstPad *pad, + GstBuffer *buf) +{ + GOmxCore *gomx; + GOmxPort *in_port; + GstOmxVideoMixer *self; + GstFlowReturn ret = GST_FLOW_OK; + gint ii; + ip_params *ch_info; + ch_info = (ip_params *)gst_pad_get_element_private(pad); + + self = GST_OMX_VIDEO_MIXER (GST_OBJECT_PARENT (pad)); + if(self->eos == TRUE) { + gst_buffer_unref(buf); + return ret; + } + PRINT_BUFFER (self, buf); + //printf("ip for channel %d\n",ch_info->idx); + gomx = self->gomx; + + GST_LOG_OBJECT (self, "begin: size=%u, state=%d", GST_BUFFER_SIZE (buf), gomx->omx_state); + g_mutex_lock (self->ready_lock); + if(self->ipCreated == FALSE) { + + printf("Starting input thread!!\n"); + pthread_create(&self->input_loop,NULL,vidmix_input_loop,(void*)self); + self->ipCreated = TRUE; + } + g_mutex_unlock (self->ready_lock); + //printf("pushing buffer:%p to queue:%p\n",buf,gst_pad_get_element_private(pad)); + + //usleep(1000*1000); + async_queue_push (ch_info->queue, buf); + //async_queue_push (self->queue[1], gst_buffer_ref(buf)); + +leave: + + GST_LOG_OBJECT (self, "end"); + //printf("leaving!!\n"); + return ret; + + /* special conditions */ +out_flushing: + { + const gchar *error_msg = NULL; + printf("out flushing!!\n"); + if (gomx->omx_error) + { + error_msg = "Error from OpenMAX component"; + } + else if (gomx->omx_state != OMX_StateExecuting && + gomx->omx_state != OMX_StatePause) + { + error_msg = "OpenMAX component in wrong state"; + } + + if (error_msg) + { + GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), (error_msg)); + ret = GST_FLOW_ERROR; + } + + gst_buffer_unref (buf); + + goto leave; + } +} + +static gboolean +pad_event (GstPad *pad, + GstEvent *event) +{ + GstOmxVideoMixer *self; + GOmxCore *gomx; + gboolean ret = TRUE; + ip_params *ch_info; + ch_info = (ip_params *)gst_pad_get_element_private(pad); + + self = GST_OMX_VIDEO_MIXER (GST_OBJECT_PARENT (pad)); + gomx = self->gomx; + + GST_INFO_OBJECT (self, "begin: event=%s", GST_EVENT_TYPE_NAME (event)); + + switch (GST_EVENT_TYPE (event)) + { + case GST_EVENT_EOS: + // printf ("Recieved EOS event, press <CTRL+C> to terminate pipeline.\n"); + /* if we are init'ed, and there is a running loop; then + * if we get a buffer to inform it of EOS, let it handle the rest + * in any other case, we send EOS */ +#if 0 + if (self->ready && self->last_pad_push_return == GST_FLOW_OK) + { + if (g_omx_port_send (self->in_port, event) >= 0) + { + gst_event_unref (event); + break; + } + } +#endif +#if 0 + ch_info->eos = TRUE; + g_mutex_lock (self->ready_lock); + self->numEosPending--; + printf("EOS pending - %d\n",self->numEosPending); + g_mutex_unlock (self->ready_lock); + if(self->numEosPending == 0) { + printf("sending EOS from mixer!!\n"); + ret = gst_pad_push_event (self->srcpad, event); + } + else + gst_event_unref (event); +#else + if(self->eos == FALSE) { + self->eos = TRUE; + ret = gst_pad_push_event (self->srcpad, event); + } else + gst_event_unref (event); + +#endif + + + break; + + case GST_EVENT_FLUSH_START: + gst_pad_push_event (self->srcpad, event); + self->last_pad_push_return = GST_FLOW_WRONG_STATE; + + g_omx_core_flush_start (gomx); + + gst_pad_pause_task (self->srcpad); + + ret = TRUE; + break; + + case GST_EVENT_FLUSH_STOP: + gst_pad_push_event (self->srcpad, event); + self->last_pad_push_return = GST_FLOW_OK; + + g_omx_core_flush_stop (gomx); + + if (self->ready) + gst_pad_start_task (self->srcpad, output_loop, self->srcpad); + + ret = TRUE; + break; + + case GST_EVENT_NEWSEGMENT: + ret = gst_pad_push_event (self->srcpad, event); + break; + case GST_EVENT_CROP: + gst_event_unref(event); + ret = TRUE; + break; + + default: + ret = gst_pad_push_event (self->srcpad, event); + break; + } + + GST_LOG_OBJECT (self, "end"); + + return ret; +} + +static gboolean +activate_push (GstPad *pad, + gboolean active) +{ + gboolean result = TRUE; + GstOmxVideoMixer *self; + + self = GST_OMX_VIDEO_MIXER (gst_pad_get_parent (pad)); + printf("Video mixer activate push!!\n"); + if (active) + { + GST_DEBUG_OBJECT (self, "activate"); + self->last_pad_push_return = GST_FLOW_OK; + + /* we do not start the task yet if the pad is not connected */ + if (gst_pad_is_linked (pad)) + { + if (self->ready) + { + int ii; + /** @todo link callback function also needed */ + for(ii = 0; ii < NUM_PORTS; ii++) { + g_omx_port_resume (self->in_port); + g_omx_port_resume (self->out_port); + } + printf("Starting output loop\n"); + result = gst_pad_start_task (pad, output_loop, pad); + } + } + } + else + { + GST_DEBUG_OBJECT (self, "deactivate"); + + if (self->ready) + { + int ii; + /** @todo disable this until we properly reinitialize the buffers. */ +#if 0 + /* flush all buffers */ + OMX_SendCommand (self->gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); +#endif + + /* unlock loops */ + for(ii = 0; ii < NUM_PORTS; ii++) { + g_omx_port_pause (self->in_port[ii]); + g_omx_port_pause (self->out_port[ii]); + } + } + + /* make sure streaming finishes */ + result = gst_pad_stop_task (pad); + } + + gst_object_unref (self); + + return result; +} + +/** + * overrides the default buffer allocation for output port to allow + * pad_alloc'ing from the srcpad + */ +static GstBuffer * +buffer_alloc (GOmxPort *port, gint len) +{ + GstOmxVideoMixer *self = port->core->object; + GstBuffer *buf; + GstFlowReturn ret; + //printf("here!!!!!!!!!!!!\n"); +#if 1 + /** @todo remove this check */ + if (G_LIKELY (self->in_port[0]->enabled)) + { + GstCaps *caps = NULL; + + caps = gst_pad_get_negotiated_caps (self->srcpad); + + if (!caps) + { + /** @todo We shouldn't be doing this. */ + GOmxCore *gomx = self->gomx; + GST_WARNING_OBJECT (self, "faking settings changed notification"); + if (gomx->settings_changed_cb) + gomx->settings_changed_cb (gomx); + } + else + { + GST_LOG_OBJECT (self, "caps already fixed: %" GST_PTR_FORMAT, caps); + gst_caps_unref (caps); + } + } +#endif + //printf("allocating buffer!!\n"); + ret = gst_pad_alloc_buffer_and_set_caps ( + self->srcpad, GST_BUFFER_OFFSET_NONE, + len, GST_PAD_CAPS (self->srcpad), &buf); + + if (ret == GST_FLOW_OK) return buf; + + return NULL; +} + +static gint +gstomx_calculate_stride (int width, GstVideoFormat format) +{ + switch (format) + { + case GST_VIDEO_FORMAT_NV12: + return width; + case GST_VIDEO_FORMAT_YUY2: + return width * 2; + default: + GST_ERROR ("unsupported color format"); + } + return -1; +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxVideoMixer *self; + GstOmxVideoMixer *omx_base; + GOmxCore *gomx; + GstVideoFormat format; + gchar *name; + ip_params * ch_info; + self = GST_OMX_VIDEO_MIXER (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_VIDEO_MIXER (self); + + gomx = (GOmxCore *) omx_base->gomx; + ch_info = (ip_params *)gst_pad_get_element_private(pad); + GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + name = gst_caps_to_string(caps); + printf("In sink set caps:%s\n",name); + g_free(name); + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + structure = gst_caps_get_structure (caps, 0); + + g_return_val_if_fail (structure, FALSE); + + if (!gst_video_format_parse_caps_strided (caps, + &format, &ch_info->in_width, &ch_info->in_height, &ch_info->in_stride)) + { + GST_WARNING_OBJECT (self, "width and/or height is not set in caps"); + return FALSE; + } + + if (!ch_info->in_stride) + { + ch_info->in_stride = gstomx_calculate_stride (ch_info->in_width, format); + } + + { + const GValue *framerate = NULL; + framerate = gst_structure_get_value (structure, "framerate"); + if (framerate) + { + self->framerate_num = gst_value_get_fraction_numerator (framerate); + self->framerate_denom = gst_value_get_fraction_denominator (framerate); + + omx_base->duration = gst_util_uint64_scale_int(GST_SECOND, + gst_value_get_fraction_denominator (framerate), + gst_value_get_fraction_numerator (framerate)); + GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT, + GST_TIME_ARGS (omx_base->duration)); + } + } + + if (self->sink_setcaps) + self->sink_setcaps (pad, caps); + + return gst_pad_set_caps (pad, caps); +} + +static gboolean +src_setcaps (GstPad *pad, GstCaps *caps) +{ + GstOmxVideoMixer *self; + GstOmxVideoMixer *omx_base; + GstVideoFormat format; + GstStructure *structure; + gchar *name; + + self = GST_OMX_VIDEO_MIXER (GST_PAD_PARENT (pad)); + omx_base = GST_OMX_VIDEO_MIXER (self); + structure = gst_caps_get_structure (caps, 0); + + name = gst_caps_to_string(caps); + printf("In src set caps:%s\n",name); + g_free(name); + + GST_INFO_OBJECT (omx_base, "setcaps (src): %" GST_PTR_FORMAT, caps); + g_return_val_if_fail (caps, FALSE); + g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); + + if (!gst_video_format_parse_caps_strided (caps, + &format, &self->out_width, &self->out_height, &self->out_stride)) + { + GST_WARNING_OBJECT (self, "width and/or height is not set in caps"); + return FALSE; + } + printf("set src_setcaps height:%d, width:%d\n",self->out_height,self->out_width); + if (!self->out_stride) + { + self->out_stride = gstomx_calculate_stride (self->out_width, format); + } + + /* save the src caps later needed by omx transport buffer */ + if (omx_base->out_port[0]->caps) + gst_caps_unref (omx_base->out_port[0]->caps); + + omx_base->out_port[0]->caps = gst_caps_copy (caps); + + return TRUE; +} + + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxVideoMixer *self; + GstElementClass *element_class; + GstOmxVideoMixerClass *bclass; + int ii; + + element_class = GST_ELEMENT_CLASS (g_class); + bclass = GST_OMX_VIDEO_MIXER_CLASS (g_class); + + self = GST_OMX_VIDEO_MIXER (instance); + printf("In instance init!!\n"); + GST_LOG_OBJECT (self, "begin"); + + /* GOmx */ + self->gomx = g_omx_core_new (self, g_class); + + for(ii = 0; ii < NUM_PORTS; ii++) { + self->input_port_index[ii] = OMX_VFPC_INPUT_PORT_START_INDEX + ii; + self->output_port_index[ii] = OMX_VFPC_OUTPUT_PORT_START_INDEX + ii; + self->in_port[ii] = g_omx_core_get_port (self->gomx, "in", self->input_port_index[ii]); + self->out_port[ii] = g_omx_core_get_port (self->gomx, "out", self->output_port_index[ii]); + //self->out_port[ii]->buffer_alloc = buffer_alloc; + self->in_port[ii]->omx_allocate = TRUE; + self->out_port[ii]->omx_allocate = TRUE; + self->in_port[ii]->share_buffer = FALSE; + self->out_port[ii]->share_buffer = FALSE; + self->in_port[ii]->port_index = self->input_port_index[ii]; + self->out_port[ii]->port_index = self->output_port_index[ii]; + } + self->ipCreated = FALSE; + self->numEosPending = NUM_PORTS; + self->eos = FALSE; + self->ready_lock = g_mutex_new (); + + for(ii = 0; ii < NUM_PORTS; ii++) { + gchar *name = g_strdup_printf ("sink_%02d", ii); + + self->sinkpad[ii] = + gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "sink"), name); + + g_free(name); + + gst_pad_set_chain_function (self->sinkpad[ii], bclass->pad_chain); + gst_pad_set_event_function (self->sinkpad[ii], bclass->pad_event); + + self->chInfo[ii].queue = async_queue_new (); + self->chInfo[ii].idx = ii; + self->chInfo[ii].eos = FALSE; + printf("queue_%d : %p\n",ii,self->chInfo[ii].queue); + gst_pad_set_element_private(self->sinkpad[ii], &(self->chInfo[ii])); + + gst_element_add_pad (GST_ELEMENT (self), self->sinkpad[ii]); + + gst_pad_set_setcaps_function (self->sinkpad[ii], + GST_DEBUG_FUNCPTR (sink_setcaps)); + } + + self->srcpad = + gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "src"), "src"); + + gst_pad_set_activatepush_function (self->srcpad, activate_push); + + gst_pad_use_fixed_caps (self->srcpad); + + gst_element_add_pad (GST_ELEMENT (self), self->srcpad); + + gst_pad_set_setcaps_function (self->srcpad, + GST_DEBUG_FUNCPTR (src_setcaps)); + + self->duration = GST_CLOCK_TIME_NONE; + printf("In instance init/...done!!\n"); + GST_LOG_OBJECT (self, "end"); +} + +static void +omx_interface_init (GstImplementsInterfaceClass *klass) +{ +} + +static gboolean +interface_supported (GstImplementsInterface *iface, + GType type) +{ + g_assert (type == GST_TYPE_OMX); + return TRUE; +} + +static void +interface_init (GstImplementsInterfaceClass *klass) +{ + klass->supported = interface_supported; +} + +static void +init_interfaces (GType type) +{ + GInterfaceInfo *iface_info; + GInterfaceInfo *omx_info; + + + iface_info = g_new0 (GInterfaceInfo, 1); + iface_info->interface_init = (GInterfaceInitFunc) interface_init; + + g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info); + g_free (iface_info); + + omx_info = g_new0 (GInterfaceInfo, 1); + omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init; + + g_type_add_interface_static (type, GST_TYPE_OMX, omx_info); + g_free (omx_info); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.h new file mode 100755 index 0000000..9255e08 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videomixer.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_VIDEOMIXER_H +#define GSTOMX_VIDEOMIXER_H + +#include <gst/gst.h> + +#include <OMX_TI_Index.h> +#include <OMX_TI_Common.h> +#include <omx_vfpc.h> + + +G_BEGIN_DECLS + +#define GST_OMX_VIDEO_MIXER(obj) ((GstOmxVideoMixer *) (obj)) +#define GST_OMX_VIDEO_MIXER_TYPE (gst_omx_video_mixer_get_type ()) +#define GST_OMX_VIDEO_MIXER_CLASS(obj) ((GstOmxVideoMixerClass *) (obj)) +#define GST_OMX_VIDEO_MIXER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_OMX_VIDEO_MIXER_TYPE, GstOmxVideoMixerClass)) + +typedef struct GstOmxVideoMixer GstOmxVideoMixer; +typedef struct GstOmxVideoMixerClass GstOmxVideoMixerClass; + +#include "gstomx_util.h" +#include <async_queue.h> + +#define NUM_PORTS 4 + +typedef struct ip_params { + guint idx; + gint in_width, in_height, in_stride; + AsyncQueue *queue; + gboolean eos; +} ip_params ; + + +struct GstOmxVideoMixer +{ + GstElement element; + + GstPad *sinkpad[NUM_PORTS]; + GstPad *srcpad; + + GOmxCore *gomx; + GOmxPort *in_port[NUM_PORTS]; + GOmxPort *out_port[NUM_PORTS]; + + char *omx_role; + char *omx_component; + char *omx_library; + gboolean ready; + GMutex *ready_lock; + + GstFlowReturn last_pad_push_return; + GstBuffer *codec_data; + GstClockTime duration; + /* Borrowed from gstomx_vfpc */ + gint framerate_num; + gint framerate_denom; + gboolean port_configured; + GstPadSetCapsFunction sink_setcaps; + // gint in_width, in_height, in_stride; + gint out_width, out_height, out_stride; + gint left, top; + gint port_index, input_port_index[NUM_PORTS], output_port_index[NUM_PORTS]; + pthread_t input_loop; + //AsyncQueue *queue[NUM_PORTS]; + gboolean ipCreated; + gboolean eos; + //gpointer g_class; + ip_params chInfo[NUM_PORTS]; + guint numEosPending; +}; + + +struct GstOmxVideoMixerClass +{ + GstElementClass parent_class; + + GstFlowReturn (*push_buffer) (GstOmxVideoMixer *self, GstBuffer *buf); + GstFlowReturn (*pad_chain) (GstPad *pad, GstBuffer *buf); + gboolean (*pad_event) (GstPad *pad, GstEvent *event); +}; + +GType gst_omx_video_mixer_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VIDEOMIXER_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.c new file mode 100755 index 0000000..59a9e10 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.c @@ -0,0 +1,550 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_videosink.h" +#include "gstomx_base_sink.h" +#include "gstomx.h" + +#include <string.h> /* for memset, strcmp */ + +#include <xdc/std.h> +#include <OMX_TI_Index.h> +#include <OMX_TI_Common.h> +#include <omx_vfdc.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/fb.h> +#include <linux/ti81xxfb.h> +#include <unistd.h> + +GSTOMX_BOILERPLATE (GstOmxVideoSink, gst_omx_videosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE); + +enum +{ + ARG_0, + ARG_X_SCALE, + ARG_Y_SCALE, + ARG_ROTATION, + ARG_TOP, + ARG_LEFT, + ARG_DISPLAY_MODE, + ARG_ENABLE_COLORKEY, + ARG_DISPLAY_DEVICE, +}; + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-raw-yuv", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + { + GValue list; + GValue val; + + list.g_type = val.g_type = 0; + + g_value_init (&list, GST_TYPE_LIST); + g_value_init (&val, GST_TYPE_FOURCC); + gst_value_set_fourcc (&val, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')); + gst_value_list_append_value (&list, &val); + gst_structure_set_value (struc, "format", &list); + + g_value_unset (&val); + g_value_unset (&list); + } + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL videosink element"; + details.klass = "Video/Sink"; + details.description = "Renders video"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static int +gstomx_videosink_colorkey (gboolean enable) +{ + struct fb_fix_screeninfo fixinfo; + struct fb_var_screeninfo varinfo; + int fd = 0, ret = -1; + struct ti81xxfb_region_params regp; + + fd = open("/dev/fb0", O_RDWR); + + if (fd <= 0) { + return -1; + } + + ret = ioctl(fd, FBIOGET_FSCREENINFO, &fixinfo); + if (ret < 0) { + goto exit; + } + + ret = ioctl(fd, FBIOGET_VSCREENINFO, &varinfo); + if (ret < 0) { + goto exit; + } + + ret = ioctl(fd, TIFB_GET_PARAMS, ®p); + if (ret < 0) { + goto exit; + } + + regp.transen = enable ? TI81XXFB_FEATURE_ENABLE : TI81XXFB_FEATURE_DISABLE; + regp.transcolor = 0x000000; + + ret = ioctl(fd, TIFB_SET_PARAMS, ®p); + if (ret < 0) { + goto exit; + } + + ret = 0; +exit: + if (fd) + close(fd); + + return ret; +} + +static int +get_display_mode_from_string (char *str, int *mode, int *maxWidth, int *maxHeight) +{ + if (!strcmp (str, "OMX_DC_MODE_1080P_30")) + { + *mode = OMX_DC_MODE_1080P_30; + *maxWidth = 1920; + *maxHeight = 1080; + return; + } + + if (!strcmp (str, "OMX_DC_MODE_1080I_60")) + { + *mode = OMX_DC_MODE_1080I_60; + *maxWidth = 1920; + *maxHeight = 1080; + return; + } + + if (!strcmp (str, "OMX_DC_MODE_720P_60")) + { + *mode = OMX_DC_MODE_720P_60; + *maxWidth = 1280; + *maxHeight = 720; + return; + } + + if (!strcmp (str, "OMX_DC_MODE_1080P_60")) + { + *mode = OMX_DC_MODE_1080P_60; + *maxWidth = 1920; + *maxHeight = 1080; + return; + } + + if (!strcmp (str, "OMX_DC_MODE_PAL")) + { + *mode = OMX_DC_MODE_PAL; + *maxWidth = 720; + *maxHeight = 576; + return; + } + + if (!strcmp (str, "OMX_DC_MODE_NTSC")) + { + *mode = OMX_DC_MODE_NTSC; + *maxWidth = 720; + *maxHeight = 480; + return; + } + + return; +} +#define LCD_WIDTH (800) +#define LCD_HEIGHT (480) +#define LCD_PIXEL_CLOCK (33500) +#define LCD_H_FRONT_PORCH (164) +#define LCD_H_BACK_PORCH (89) +#define LCD_H_SYNC_LENGTH (10) +#define LCD_V_FRONT_PORCH (10) +#define LCD_V_BACK_PORCH (23) +#define LCD_V_SYNC_LENGTH (10) + + +static void +omx_setup (GstBaseSink *gst_sink, GstCaps *caps) +{ + GstOmxBaseSink *omx_base, *self; + GstOmxVideoSink *sink; + GOmxCore *gomx; + OMX_PARAM_PORTDEFINITIONTYPE param; + OMX_PARAM_VFDC_DRIVERINSTID driverId; + OMX_PARAM_VFDC_CREATEMOSAICLAYOUT mosaicLayout; + OMX_CONFIG_VFDC_MOSAICLAYOUT_PORT2WINMAP port2Winmap; + OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg; + OMX_PARAM_VFDC_FIELD_MERGE_INFO fieldMergeInfo; + OMX_PARAM_DC_CUSTOM_MODE_INFO customModeInfo; + GstStructure *structure; + gint width; + gint height; + gint maxWidth, maxHeight, mode; + guint isLCD; + + sink = GST_OMX_VIDEOSINK (gst_sink); + self = omx_base = GST_OMX_BASE_SINK (gst_sink); + gomx = (GOmxCore *) omx_base->gomx; + + if (self->port_initialized) + return; + + structure = gst_caps_get_structure (caps, 0); + + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "height", &height); + + /* set input port definition */ + G_OMX_PORT_GET_DEFINITION (omx_base->in_port, ¶m); + + param.nBufferSize = (width * height * 2); + param.format.video.nFrameWidth = width; + param.format.video.nFrameHeight = height; + param.format.video.nStride = width * 2; + param.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; + param.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; + param.nBufferCountActual = 5; + + G_OMX_PORT_SET_DEFINITION (omx_base->in_port, ¶m); + g_omx_port_setup (omx_base->in_port, ¶m); + + /* get the display mode set via property */ + get_display_mode_from_string (sink->display_mode, &mode, &maxWidth, &maxHeight); + + /* set display driver mode */ + _G_OMX_INIT_PARAM (&driverId); + + if(!strcmp(sink->display_device,"LCD")) { + driverId.nDrvInstID = OMX_VIDEO_DISPLAY_ID_HD1; + driverId.eDispVencMode = OMX_DC_MODE_CUSTOM;//mode; + isLCD = 1; + } else { + driverId.nDrvInstID = 0; /* on chip HDMI */ + driverId.eDispVencMode = mode; + isLCD = 0; + } + + OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexParamVFDCDriverInstId, &driverId); + +#if 1 + if(isLCD) { + _G_OMX_INIT_PARAM (&customModeInfo); + + customModeInfo.width = LCD_WIDTH; + customModeInfo.height = LCD_HEIGHT; + customModeInfo.scanFormat = OMX_SF_PROGRESSIVE; + customModeInfo.pixelClock = LCD_PIXEL_CLOCK; + customModeInfo.hFrontPorch = LCD_H_FRONT_PORCH; + customModeInfo.hBackPorch = LCD_H_BACK_PORCH; + customModeInfo.hSyncLen = LCD_H_SYNC_LENGTH; + customModeInfo.vFrontPorch = LCD_V_FRONT_PORCH; + customModeInfo.vBackPorch = LCD_V_BACK_PORCH; + customModeInfo.vSyncLen = LCD_V_SYNC_LENGTH; + /*Configure Display component and Display controller with these parameters*/ + + OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE) + OMX_TI_IndexParamVFDCCustomModeInfo, + &customModeInfo); + } +#endif + + /* center the video */ + if (!sink->left && !sink->top) + { + sink->left = ((maxWidth - width) / 2) & ~1; + sink->top = ((maxHeight - height) / 2) & ~1; + } + + /* set mosiac window information */ + _G_OMX_INIT_PARAM (&mosaicLayout); + mosaicLayout.nPortIndex = 0; + + if (!isLCD) { + mosaicLayout.sMosaicWinFmt[0].winStartX = sink->left; + mosaicLayout.sMosaicWinFmt[0].winStartY = sink->top; + mosaicLayout.sMosaicWinFmt[0].winWidth = width; + mosaicLayout.sMosaicWinFmt[0].winHeight = height; + mosaicLayout.sMosaicWinFmt[0].pitch[VFDC_YUV_INT_ADDR_IDX] = width * 2; + } else { + /* For LCD Display, start the window at (0,0) */ + mosaicLayout.sMosaicWinFmt[0].winStartX = 0; + mosaicLayout.sMosaicWinFmt[0].winStartY = 0; + + /*If LCD is chosen, fir the mosaic window to the size of the LCD display*/ + mosaicLayout.sMosaicWinFmt[0].winWidth = LCD_WIDTH; + mosaicLayout.sMosaicWinFmt[0].winHeight = LCD_HEIGHT; + mosaicLayout.sMosaicWinFmt[0].pitch[VFDC_YUV_INT_ADDR_IDX] = + LCD_WIDTH * 2; + } + mosaicLayout.sMosaicWinFmt[0].dataFormat = VFDC_DF_YUV422I_YVYU; + mosaicLayout.sMosaicWinFmt[0].bpp = VFDC_BPP_BITS16; + mosaicLayout.sMosaicWinFmt[0].priority = 0; + mosaicLayout.nDisChannelNum = 0; + mosaicLayout.nNumWindows = 1; + + OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexParamVFDCCreateMosaicLayout, + &mosaicLayout); + + /* set port to window mapping */ + _G_OMX_INIT_PARAM (&port2Winmap); + port2Winmap.nLayoutId = 0; + port2Winmap.numWindows = 1; + port2Winmap.omxPortList[0] = OMX_VFDC_INPUT_PORT_START_INDEX + 0; + + OMX_SetConfig (gomx->omx_handle, (OMX_INDEXTYPE) OMX_TI_IndexConfigVFDCMosaicPort2WinMap, &port2Winmap); + + /* set default input memory to Raw */ + _G_OMX_INIT_PARAM (&memTypeCfg); + memTypeCfg.nPortIndex = 0; + memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; + + OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); + + _G_OMX_INIT_PARAM (&fieldMergeInfo); + fieldMergeInfo.fieldMergeMode = FALSE; + + OMX_SetParameter (gomx->omx_handle, (OMX_INDEXTYPE)OMX_TI_IndexParamVFDCFieldMergeMode, &fieldMergeInfo); + + /* enable the input port */ + OMX_SendCommand (gomx->omx_handle, OMX_CommandPortEnable, omx_base->in_port->port_index, NULL); + g_sem_down (omx_base->in_port->core->port_sem); + + /* port is now initalized */ + self->port_initialized = TRUE; + + return; +} + + +static gboolean +setcaps (GstBaseSink *gst_sink, + GstCaps *caps) +{ + GstOmxBaseSink *omx_base; + GstOmxVideoSink *self; + GOmxCore *gomx; + + omx_base = GST_OMX_BASE_SINK (gst_sink); + self = GST_OMX_VIDEOSINK (gst_sink); + gomx = (GOmxCore *) omx_base->gomx; + + GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); + + g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); + + omx_setup (gst_sink, caps); + + return TRUE; +} + +static void +set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GstOmxVideoSink *self; + + self = GST_OMX_VIDEOSINK (object); + + switch (prop_id) + { + case ARG_X_SCALE: + self->x_scale = g_value_get_uint (value); + break; + case ARG_Y_SCALE: + self->y_scale = g_value_get_uint (value); + break; + case ARG_ROTATION: + self->rotation = g_value_get_uint (value); + break; + case ARG_TOP: + self->top = g_value_get_uint (value); + break; + case ARG_LEFT: + self->left = g_value_get_uint (value); + break; + case ARG_ENABLE_COLORKEY: + self->colorkey = g_value_get_boolean (value); + gstomx_videosink_colorkey (self->colorkey); + break; + case ARG_DISPLAY_MODE: + g_free (self->display_mode); + self->display_mode = g_value_dup_string (value); + break; + case ARG_DISPLAY_DEVICE: + g_free (self->display_device); + self->display_device = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GstOmxVideoSink *self; + + self = GST_OMX_VIDEOSINK (object); + + switch (prop_id) + { + case ARG_X_SCALE: + g_value_set_uint (value, self->x_scale); + break; + case ARG_Y_SCALE: + g_value_set_uint (value, self->y_scale); + break; + case ARG_ROTATION: + g_value_set_uint (value, self->rotation); + break; + case ARG_LEFT: + g_value_set_uint (value, self->left); + break; + case ARG_TOP: + g_value_set_uint (value, self->top); + break; + case ARG_ENABLE_COLORKEY: + g_value_set_boolean (value, self->colorkey); + break; + case ARG_DISPLAY_MODE: + g_value_set_string (value, self->display_mode); + break; + case ARG_DISPLAY_DEVICE: + g_value_set_string (value, self->display_device); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ + GObjectClass *gobject_class; + GstBaseSinkClass *gst_base_sink_class; + + gobject_class = (GObjectClass *) g_class; + gst_base_sink_class = GST_BASE_SINK_CLASS (g_class); + + gst_base_sink_class->set_caps = setcaps; + + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + + g_object_class_install_property (gobject_class, ARG_TOP, + g_param_spec_uint ("top", "Top", + "The top most co-ordinate on video display", + 0, G_MAXUINT, 100, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_LEFT, + g_param_spec_uint ("left", "left", + "The left most co-ordinate on video display", + 0, G_MAXUINT, 100, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_ENABLE_COLORKEY, + g_param_spec_boolean ("colorkey", "Enable colorkey", + "Enable colorkey", + TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_DISPLAY_MODE, + g_param_spec_string ("display-mode", "Display mode", + "Display driver configuration mode (see below)" + "\n\t\t\t OMX_DC_MODE_NTSC " + "\n\t\t\t OMX_DC_MODE_PAL " + "\n\t\t\t OMX_DC_MODE_1080P_60 " + "\n\t\t\t OMX_DC_MODE_720P_60 " + "\n\t\t\t OMX_DC_MODE_1080I_60 " + "\n\t\t\t OMX_DC_MODE_1080P_30", + "OMX_DC_MODE_1080P_60", G_PARAM_READWRITE)); + + g_object_class_install_property (gobject_class, ARG_DISPLAY_DEVICE, + g_param_spec_string ("display-device", "Display Device", + "Display device to be used -" + "\n\t\t\t HDMI " + "\n\t\t\t LCD ", "HDMI",G_PARAM_READWRITE)); +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseSink *omx_base; + GstOmxVideoSink *self; + + omx_base = GST_OMX_BASE_SINK (instance); + self = GST_OMX_VIDEOSINK (instance); + omx_base->omx_setup = omx_setup; + + g_object_set (self, "colorkey", TRUE, NULL); + g_object_set (self, "display-mode", "OMX_DC_MODE_1080P_60", NULL); + g_object_set (self, "display-device", "HDMI", NULL); +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.h new file mode 100755 index 0000000..d996340 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_videosink.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_VIDEOSINK_H +#define GSTOMX_VIDEOSINK_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_VIDEOSINK(obj) (GstOmxVideoSink *) (obj) +#define GST_OMX_VIDEOSINK_TYPE (gst_omx_videosink_get_type ()) + +typedef struct GstOmxVideoSink GstOmxVideoSink; +typedef struct GstOmxVideoSinkClass GstOmxVideoSinkClass; + +#include "gstomx_base_sink.h" + +struct GstOmxVideoSink +{ + GstOmxBaseSink omx_base; + guint x_scale; + guint y_scale; + guint rotation; + guint top; + guint left; + guint width; + guint height; + gboolean colorkey; + gchar *display_mode; + guint maxWidth, maxHeight; + gchar *display_device; +}; + +struct GstOmxVideoSinkClass +{ + GstOmxBaseSinkClass parent_class; +}; + +GType gst_omx_videosink_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VIDEOSINK_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.c new file mode 100644 index 0000000..cd23103 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * Copyright (C) 2008 NXP. + * + * Author: Frederik Vernelen <frederik.vernelen@nxp.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "gstomx_volume.h" +#include "gstomx_base_filter.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 8, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", GST_TYPE_INT_RANGE, 8000, 48000, + "signed", G_TYPE_BOOLEAN, TRUE, + "channels", GST_TYPE_INT_RANGE, 1, 8, + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL Volume component"; + details.klass = "Filter/Effect/Audio"; + details.description = "Changes the volume with OpenMAX IL"; + details.author = "Frederik Vernelen"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +settings_changed_cb (GOmxCore *core) +{ + GstOmxBaseFilter *omx_base; + guint rate; + guint channels; + + omx_base = core->object; + + GST_DEBUG_OBJECT (omx_base, "settings changed"); + + { + OMX_AUDIO_PARAM_PCMMODETYPE param; + + memset (¶m, 0, sizeof (param)); + param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); + param.nVersion.s.nVersionMajor = 1; + param.nVersion.s.nVersionMinor = 1; + + param.nPortIndex = 1; + OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); + + rate = param.nSamplingRate; + channels = param.nChannels; + if (rate == 0) + { + /** @todo: this shouldn't happen. */ + GST_WARNING_OBJECT (omx_base, "Bad samplerate"); + rate = 44100; + } + } + + { + GstCaps *new_caps; + + new_caps = gst_caps_new_simple ("audio/x-raw-int", + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "rate", G_TYPE_INT, rate, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "channels", G_TYPE_INT, channels, + NULL); + + GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); + gst_pad_set_caps (omx_base->srcpad, new_caps); + } +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); + + omx_base->gomx->settings_changed_cb = settings_changed_cb; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.h new file mode 100644 index 0000000..0e21080 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_volume.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * Copyright (C) 2008 NXP. + * + * Author: Frederik Vernelen <frederik.vernelen@nxp.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef GSTOMX_VOLUME_H +#define GSTOMX_VOLUME_H + +#include <gst/gst.h> + +#include <config.h> + +G_BEGIN_DECLS + +#define GST_OMX_VOLUME(obj) (GstOmxVolume *) (obj) +#define GST_OMX_VOLUME_TYPE (gst_omx_volume_get_type ()) + +typedef struct GstOmxVolume GstOmxVolume; +typedef struct GstOmxVolumeClass GstOmxVolumeClass; + +#include "gstomx_base_filter.h" + +struct GstOmxVolume +{ + GstOmxBaseFilter omx_base; +}; + +struct GstOmxVolumeClass +{ + GstOmxBaseFilterClass parent_class; +}; + +GType gst_omx_volume_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VOLUME_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.c new file mode 100644 index 0000000..d082081 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.c @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_vorbisdec.h" +#include "gstomx.h" + +#include <string.h> /* for memset */ + +GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE); + +static GstCaps * +generate_src_template (void) +{ + GstCaps *caps = NULL; + + caps = gst_caps_new_simple ("audio/x-raw-int", + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "signed", G_TYPE_BOOLEAN, TRUE, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 16, + "depth", G_TYPE_INT, 16, + "channels", GST_TYPE_INT_RANGE, 1, 256, + NULL); + + return caps; +} + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps = NULL; + + caps = gst_caps_new_simple ("application/ogg", + NULL); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL Vorbis audio decoder"; + details.klass = "Codec/Decoder/Audio"; + details.description = "Decodes audio in Vorbis format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("src", GST_PAD_SRC, + GST_PAD_ALWAYS, + generate_src_template ()); + + gst_element_class_add_pad_template (element_class, template); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseFilter *omx_base; + + omx_base = GST_OMX_BASE_FILTER (instance); + + GST_DEBUG_OBJECT (omx_base, "start"); + + omx_base->gomx->use_timestamps = FALSE; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.h new file mode 100644 index 0000000..c7737a3 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vorbisdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_VORBISDEC_H +#define GSTOMX_VORBISDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_VORBISDEC(obj) (GstOmxVorbisDec *) (obj) +#define GST_OMX_VORBISDEC_TYPE (gst_omx_vorbisdec_get_type ()) + +typedef struct GstOmxVorbisDec GstOmxVorbisDec; +typedef struct GstOmxVorbisDecClass GstOmxVorbisDecClass; + +#include "gstomx_base_audiodec.h" + +struct GstOmxVorbisDec +{ + GstOmxBaseAudioDec omx_base; +}; + +struct GstOmxVorbisDecClass +{ + GstOmxBaseAudioDecClass parent_class; +}; + +GType gst_omx_vorbisdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VORBISDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.c new file mode 100644 index 0000000..25e8188 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.c @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010 Texas Instruments. + * + * Author: Leonardo Sandoval <lsandoval@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_vp6dec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxVP6Dec, gst_omx_vp6dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-vp6", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL VP6 video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in VP6 format with OpenMAX IL"; + details.author = "Leonardo Sandoval"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + GstOmxBaseFilter *omx_filter; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + omx_filter = GST_OMX_BASE_FILTER (instance); + + omx_base->compression_format = OMX_VIDEO_CodingVP6; + omx_filter->in_port->vp6_hack = TRUE; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.h new file mode 100644 index 0000000..1b72e3b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_vp6dec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Texas Instruments. + * + * Author: Leonardo Sandoval <lsandoval@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_VP6DEC_H +#define GSTOMX_VP6DEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_VP6DEC(obj) (GstOmxVP6Dec *) (obj) +#define GST_OMX_VP6DEC_TYPE (gst_omx_vp6dec_get_type ()) + +typedef struct GstOmxVP6Dec GstOmxVP6Dec; +typedef struct GstOmxVP6DecClass GstOmxVP6DecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxVP6Dec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxVP6DecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_vp6dec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_VP6DEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.c new file mode 100644 index 0000000..c7afe99 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.c @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "gstomx_wmvdec.h" +#include "gstomx.h" + +GSTOMX_BOILERPLATE (GstOmxWmvDec, gst_omx_wmvdec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE); + +static GstCaps * +generate_sink_template (void) +{ + GstCaps *caps; + GstStructure *struc; + + caps = gst_caps_new_empty (); + + struc = gst_structure_new ("video/x-wmv", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, + "wmvversion", G_TYPE_INT, 3, + NULL); + + gst_caps_append_structure (caps, struc); + + return caps; +} + +static gboolean +sink_setcaps (GstPad *pad, + GstCaps *caps) +{ + GstStructure *structure; + GstOmxBaseVideoDec *omx_base; + GstOmxBaseFilter *omx_base_filter; + GOmxCore *gomx; + gboolean is_vc1 = FALSE; + + omx_base = GST_OMX_BASE_VIDEODEC (GST_PAD_PARENT (pad)); + omx_base_filter = GST_OMX_BASE_FILTER (omx_base); + + gomx = (GOmxCore *) omx_base_filter->gomx; + + structure = gst_caps_get_structure (caps, 0); + + { + guint32 fourcc; + + /** @todo which one should it be? Is this a demuxer bug? */ + if (gst_structure_get_fourcc (structure, "fourcc", &fourcc) || + gst_structure_get_fourcc (structure, "format", &fourcc)) + { + if (fourcc == GST_MAKE_FOURCC ('W', 'V', 'C', '1')) + is_vc1 = TRUE; + } + } + + /* This is specific for TI. */ + { + OMX_INDEXTYPE index; + OMX_U32 file_type = is_vc1 ? 0 : 1; /* 0 = wvc1, 1 = wmv3 */ + OMX_GetExtensionIndex (gomx->omx_handle, "OMX.TI.VideoDecode.Param.WMVFileType", &index); + OMX_SetParameter (gomx->omx_handle, index, &file_type); + + GST_DEBUG_OBJECT (omx_base, + "OMX_SetParameter OMX.TI.VideoDecode.Param.WMVFileType %ld" G_GUINT32_FORMAT, + file_type); + } + + return TRUE; +} + +static void +type_base_init (gpointer g_class) +{ + GstElementClass *element_class; + + element_class = GST_ELEMENT_CLASS (g_class); + + { + GstElementDetails details; + + details.longname = "OpenMAX IL WMV video decoder"; + details.klass = "Codec/Decoder/Video"; + details.description = "Decodes video in WMV format with OpenMAX IL"; + details.author = "Felipe Contreras"; + + gst_element_class_set_details (element_class, &details); + } + + { + GstPadTemplate *template; + + template = gst_pad_template_new ("sink", GST_PAD_SINK, + GST_PAD_ALWAYS, + generate_sink_template ()); + + gst_element_class_add_pad_template (element_class, template); + } +} + +static void +type_class_init (gpointer g_class, + gpointer class_data) +{ +} + +static void +type_instance_init (GTypeInstance *instance, + gpointer g_class) +{ + GstOmxBaseVideoDec *omx_base; + + omx_base = GST_OMX_BASE_VIDEODEC (instance); + + omx_base->compression_format = OMX_VIDEO_CodingWMV; + + omx_base->sink_setcaps = sink_setcaps; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.h new file mode 100644 index 0000000..663f00d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstomx_wmvdec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef GSTOMX_WMVDEC_H +#define GSTOMX_WMVDEC_H + +#include <gst/gst.h> + +G_BEGIN_DECLS + +#define GST_OMX_WMVDEC(obj) (GstOmxWmvDec *) (obj) +#define GST_OMX_WMVDEC_TYPE (gst_omx_wmvdec_get_type ()) + +typedef struct GstOmxWmvDec GstOmxWmvDec; +typedef struct GstOmxWmvDecClass GstOmxWmvDecClass; + +#include "gstomx_base_videodec.h" + +struct GstOmxWmvDec +{ + GstOmxBaseVideoDec omx_base; +}; + +struct GstOmxWmvDecClass +{ + GstOmxBaseVideoDecClass parent_class; +}; + +GType gst_omx_wmvdec_get_type (void); + +G_END_DECLS + +#endif /* GSTOMX_WMVDEC_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.c new file mode 100644 index 0000000..5fb6084 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.c @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "gstperf.h" + +/* Declare variable used to categorize GST_LOG output */ +GST_DEBUG_CATEGORY_STATIC (gst_perf_debug); +#define GST_CAT_DEFAULT gst_perf_debug + +/* Property default */ +#define DEFAULT_INTERVAL 1 +#define PRINT_ARM_LOAD TRUE +#define PRINT_FPS TRUE + +enum +{ + PROP_0, + PROP_PRINT_ARM_LOAD, + PROP_PRINT_FPS +}; + +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("ANY") + ); + +static GstElementClass *parent_class = NULL; + +static void gst_perf_base_init (gpointer g_class); +static void gst_perf_class_init (GstperfClass * g_class); +static void gst_perf_init (Gstperf * object, GstperfClass * g_class ); +static GstFlowReturn gst_perf_transform_ip (GstBaseTransform * trans,GstBuffer * buf); +static gboolean gst_perf_start (GstBaseTransform * trans); +static gboolean gst_perf_stop (GstBaseTransform * trans); +static void gst_perf_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); + +static void +gst_perf_init (Gstperf * perf, GstperfClass * gclass) +{ + Gstperf *self = perf; + + gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM (perf), TRUE); + self->fps_update_interval = GST_SECOND * DEFAULT_INTERVAL; + self->print_arm_load = PRINT_ARM_LOAD; + self->print_fps = PRINT_FPS; +} + +static gboolean +display_current_fps (gpointer data) +{ + Gstperf *self = GST_PERF (data); + guint64 frames_count; + gdouble rr, average_fps; + gchar fps_message[256]; + gdouble time_diff, time_elapsed; + GstClockTime current_ts = gst_util_get_timestamp (); + + frames_count = self->frames_count; + + time_diff = (gdouble) (current_ts - self->last_ts) / GST_SECOND; + time_elapsed = (gdouble) (current_ts - self->start_ts) / GST_SECOND; + + rr = (gdouble) (frames_count - self->last_frames_count) / time_diff; + + average_fps = (gdouble) frames_count / time_elapsed; + + g_snprintf (fps_message, 255, "frames: %" G_GUINT64_FORMAT " \tcurrent: %.2f\t average: %.2f", + frames_count, rr, average_fps); + g_print ("%s", fps_message); + + self->last_frames_count = frames_count; + self->last_ts = current_ts; + + return TRUE; +} + +GType +gst_perf_get_type (void) +{ + static GType object_type = 0; + + if (G_UNLIKELY (object_type == 0)) { + static const GTypeInfo object_info = { + sizeof (GstperfClass), + gst_perf_base_init, + NULL, + (GClassInitFunc) gst_perf_class_init, + NULL, + NULL, + sizeof (Gstperf), + 0, + (GInstanceInitFunc) gst_perf_init + }; + + object_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM, + "Gstperf", &object_info, (GTypeFlags) 0); + + GST_DEBUG_CATEGORY_INIT (gst_perf_debug, "perf", 0, " performance tool"); + + } + + return object_type; +}; + + +static void +gst_perf_base_init (gpointer gclass) +{ + static GstElementDetails element_details = { + " Performance element", + "Filter/Perf", + "display performance data", + "Brijesh Singh, bksingh@ti.com" + }; + + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details (element_class, &element_details); +} + +static GstFlowReturn +gst_perf_prepare_output_buffer (GstBaseTransform * trans, + GstBuffer * in_buf, gint out_size, GstCaps * out_caps, GstBuffer ** out_buf) +{ + *out_buf = gst_buffer_ref (in_buf); + return GST_FLOW_OK; +} + +static void +gst_perf_class_init (GstperfClass * klass) +{ + GObjectClass *gobject_class; + GstBaseTransformClass *trans_class; + + gobject_class = (GObjectClass *) klass; + + gobject_class->set_property = gst_perf_set_property; + gobject_class = (GObjectClass *) klass; + trans_class = (GstBaseTransformClass *) klass; + + trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_perf_transform_ip); + trans_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_perf_prepare_output_buffer); + trans_class->start = GST_DEBUG_FUNCPTR (gst_perf_start); + trans_class->stop = GST_DEBUG_FUNCPTR (gst_perf_stop); + + trans_class->passthrough_on_same_caps = FALSE; + + parent_class = g_type_class_peek_parent (klass); + + g_object_class_install_property (gobject_class, PROP_PRINT_ARM_LOAD, + g_param_spec_boolean ("print-arm-load", "print-arm-load", + "Print the CPU load info", PRINT_ARM_LOAD, G_PARAM_WRITABLE)); + + g_object_class_install_property (gobject_class, PROP_PRINT_FPS, + g_param_spec_boolean ("print-fps", "print-fps", + "Print framerate", PRINT_FPS, G_PARAM_WRITABLE)); +} + +static void +gst_perf_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + Gstperf *perf = GST_PERF (object); + + switch (prop_id) { + case PROP_PRINT_ARM_LOAD: + perf->print_arm_load = g_value_get_boolean(value); + break; + + case PROP_PRINT_FPS: + perf->print_fps = g_value_get_boolean(value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static gboolean +gst_perf_start (GstBaseTransform * trans) +{ + Gstperf *self = (Gstperf *) trans; + + /* Init counters */ + self->frames_count = G_GUINT64_CONSTANT (0); + self->total_size = G_GUINT64_CONSTANT (0); + self->last_frames_count = G_GUINT64_CONSTANT (0); + + /* init time stamps */ + self->last_ts = self->start_ts = self->interval_ts = GST_CLOCK_TIME_NONE; + + return TRUE; +} + +static gboolean +gst_perf_stop (GstBaseTransform * trans) +{ + + return TRUE; +} + +static int +print_cpu_load (Gstperf *perf) +{ + int cpuLoadFound = FALSE; + unsigned long nice, sys, idle, iowait, irq, softirq, steal; + unsigned long deltaTotal; + char textBuf[4]; + FILE *fptr; + int load; + + /* Read the overall system information */ + fptr = fopen("/proc/stat", "r"); + + if (fptr == NULL) { + return -1; + } + + perf->prevTotal = perf->total; + perf->prevuserTime = perf->userTime; + + /* Scan the file line by line */ + while (fscanf(fptr, "%4s %lu %lu %lu %lu %lu %lu %lu %lu", textBuf, + &perf->userTime, &nice, &sys, &idle, &iowait, &irq, &softirq, + &steal) != EOF) { + if (strcmp(textBuf, "cpu") == 0) { + cpuLoadFound = TRUE; + break; + } + } + + if (fclose(fptr) != 0) { + return -1; + } + + if (!cpuLoadFound) { + return -1; + } + + perf->total = perf->userTime + nice + sys + idle + iowait + irq + softirq + + steal; + perf->userTime += nice + sys + iowait + irq + softirq + steal; + deltaTotal = perf->total - perf->prevTotal; + + if(deltaTotal) { + load = 100 * (perf->userTime - perf->prevuserTime) / deltaTotal; + } else { + load = 0; + } + + g_print ("\tarm-load: %d", load); + return 0; +} + +static GstFlowReturn +gst_perf_transform_ip (GstBaseTransform * trans, GstBuffer * buf) +{ + Gstperf *self = GST_PERF (trans); + GstClockTime ts; + + { + self->frames_count++; + self->total_size += GST_BUFFER_SIZE(buf); + + ts = gst_util_get_timestamp (); + if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (self->start_ts))) { + self->interval_ts = self->last_ts = self->start_ts = ts; + } + + if (GST_CLOCK_DIFF (self->interval_ts, ts) > self->fps_update_interval) { + + if (self->print_fps) + display_current_fps (self); + + if (self->print_arm_load) + print_cpu_load (self); + + g_print ("\n"); + self->interval_ts = ts; + } + } + + return GST_FLOW_OK;; +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.h new file mode 100644 index 0000000..bd08cd7 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/gstperf.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011-2012 Texas Instruments Inc + * + * Author: Brijesh Singh <bksingh@ti.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __GST_PERF_H__ +#define __GST_PERF_H__ + +#include <pthread.h> +#include <stdio.h> +#include <string.h> +#include <gst/gst.h> +#include <gst/base/gstbasetransform.h> + +G_BEGIN_DECLS + +/* Standard macros for maniuplating perf objects */ +#define GST_TYPE_PERF \ + (gst_perf_get_type()) +#define GST_PERF(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PERF,Gstperf)) +#define GST_PERF_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PERF,GstperfClass)) +#define GST_IS_PERF(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PERF)) +#define GST_IS_PERF_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PERF)) + +typedef struct _Gstperf Gstperf; +typedef struct _GstperfClass GstperfClass; + +/* _Gstperf object */ +struct _Gstperf +{ + /* gStreamer infrastructure */ + GstBaseTransform element; + GstPad *sinkpad; + GstPad *srcpad; + + /* statistics */ + guint64 frames_count, last_frames_count, total_size; + + GstClockTime start_ts; + GstClockTime last_ts; + GstClockTime interval_ts; + + gboolean print_fps, print_arm_load, fps_update_interval; + unsigned long int total; + unsigned long int prevTotal; + unsigned long int userTime; + unsigned long int prevuserTime; +}; + +/* _GstperfClass object */ +struct _GstperfClass +{ + GstBaseTransformClass parent_class; +}; + +/* External function enclarations */ +GType gst_perf_get_type(void); + +G_END_DECLS + +#endif /* __GST_PERF_H__ */ + + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Audio.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Audio.h new file mode 100644 index 0000000..0f5d30d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Audio.h @@ -0,0 +1,1263 @@ +/*
+ * Copyright (c) 2007 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.1
+ * 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_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_PCMTYPE 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_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_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 or unsigned */
+ 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_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_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_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_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_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_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;
+
+
+/** 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Component.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Component.h new file mode 100644 index 0000000..7f3ea77 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Component.h @@ -0,0 +1,567 @@ +/* + * Copyright (c) 2007 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.1 + * 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_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_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_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_MetadataCharsetTypeMax= 0x7FFFFFFF +} OMX_METADATACHARSETTYPE; + +/** @ingroup metadata */ +typedef enum OMX_METADATASCOPETYPE +{ + OMX_MetadataScopeAllLevels, + OMX_MetadataScopeTopLevel, + OMX_MetadataScopePortLevel, + OMX_MetadataScopeNodeLevel, + OMX_MetadataScopeTypeMax = 0x7fffffff +} OMX_METADATASCOPETYPE; + +/** @ingroup metadata */ +typedef enum OMX_METADATASEARCHMODETYPE +{ + OMX_MetadataSearchValueSizeByIndex, + OMX_MetadataSearchItemByIndex, + OMX_MetadataSearchNextItemByKey, + 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_NoError. 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_NoError. 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_NoError. 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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_ContentPipe.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_ContentPipe.h new file mode 100644 index 0000000..fe7c965 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_ContentPipe.h @@ -0,0 +1,202 @@ +/*
+ * Copyright (c) 2007 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.1
+ * 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 (13)
+#define KD_EADDRINUSE (98)
+#define KD_EAGAIN (11)
+#define KD_EBADF (9)
+#define KD_EBUSY (16)
+#define KD_ECANCELED (125)
+#define KD_ECONNABORTED (103)
+#define KD_ECONNREFUSED (111)
+#define KD_ECONNRESET (104)
+#define KD_EDEADLK (35)
+#define KD_EDESTADDRREQ (89)
+#define KD_EDOM (33)
+#define KD_ERANGE (34)
+#define KD_EEXIST (17)
+#define KD_EFAULT (14)
+#define KD_EFBIG (27)
+#define KD_EHOSTUNREACH (113)
+#define KD_EINPROGRESS (115)
+#define KD_EINTR (4)
+#define KD_EINVAL (22)
+#define KD_EIO (5)
+#define KD_EISCONN (106)
+#define KD_EISDIR (21)
+#define KD_EMFILE (24)
+#define KD_ENAMETOOLONG (36)
+#define KD_ENETDOWN (100)
+#define KD_ENETRESET (102)
+#define KD_ENETUNREACH (101)
+#define KD_ENOBUFS (105)
+#define KD_ENOENT (2)
+#define KD_ENOMEM (12)
+#define KD_ENOSPC (28)
+#define KD_ENOSYS (28)
+#define KD_ENOTCONN (107)
+#define KD_ENOTDIR (20)
+#define KD_ENOTEMPTY (39)
+#define KD_ENOTSOCK (88)
+#define KD_ENOTSUP (95)
+#define KD_EPERM (1)
+#define KD_EPROTO (71)
+#define KD_ETIMEDOUT (110)
+#define KD_EILSEQ (84)
+#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_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_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_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_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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Core.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Core.h new file mode 100644 index 0000000..3306efe --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Core.h @@ -0,0 +1,1390 @@ +/*
+ * Copyright (c) 2007 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.1
+ * 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_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_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 = 0x80001000,
+
+ /** There was an error, but the cause of the error could not be determined */
+ OMX_ErrorUndefined = 0x80001001,
+
+ /** The component name string was not valid */
+ OMX_ErrorInvalidComponentName = 0x80001002,
+
+ /** No component with the specified name string was found */
+ OMX_ErrorComponentNotFound = 0x80001003,
+
+ /** The component specified did not have a "OMX_ComponentInit" or
+ "OMX_ComponentDeInit entry point */
+ OMX_ErrorInvalidComponent = 0x80001004,
+
+ /** One or more parameters were not valid */
+ OMX_ErrorBadParameter = 0x80001005,
+
+ /** The requested function is not implemented */
+ OMX_ErrorNotImplemented = 0x80001006,
+
+ /** The buffer was emptied before the next buffer was ready */
+ OMX_ErrorUnderflow = 0x80001007,
+
+ /** The buffer was not available when it was needed */
+ OMX_ErrorOverflow = 0x80001008,
+
+ /** The hardware failed to respond as expected */
+ OMX_ErrorHardware = 0x80001009,
+
+ /** The component is in the state OMX_StateInvalid */
+ OMX_ErrorInvalidState = 0x8000100A,
+
+ /** Stream is found to be corrupt */
+ OMX_ErrorStreamCorrupt = 0x8000100B,
+
+ /** Ports being connected are not compatible */
+ OMX_ErrorPortsNotCompatible = 0x8000100C,
+
+ /** Resources allocated to an idle component have been
+ lost resulting in the component returning to the loaded state */
+ OMX_ErrorResourcesLost = 0x8000100D,
+
+ /** No more indicies can be enumerated */
+ OMX_ErrorNoMore = 0x8000100E,
+
+ /** The component detected a version mismatch */
+ OMX_ErrorVersionMismatch = 0x8000100F,
+
+ /** The component is not ready to return data at this time */
+ OMX_ErrorNotReady = 0x80001010,
+
+ /** There was a timeout that occurred */
+ OMX_ErrorTimeout = 0x80001011,
+
+ /** This error occurs when trying to transition into the state you are already in */
+ OMX_ErrorSameState = 0x80001012,
+
+ /** Resources allocated to an executing or paused component have been
+ preempted, causing the component to return to the idle state */
+ OMX_ErrorResourcesPreempted = 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 = 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 = 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 = 0x80001016,
+
+ /** Attempting a state transtion that is not allowed */
+ OMX_ErrorIncorrectStateTransition = 0x80001017,
+
+ /* Attempting a command that is not allowed during the present state. */
+ OMX_ErrorIncorrectStateOperation = 0x80001018,
+
+ /** The values encapsulated in the parameter or config structure are not supported. */
+ OMX_ErrorUnsupportedSetting = 0x80001019,
+
+ /** The parameter or config indicated by the given index is not supported. */
+ OMX_ErrorUnsupportedIndex = 0x8000101A,
+
+ /** The port index supplied is incorrect. */
+ OMX_ErrorBadPortIndex = 0x8000101B,
+
+ /** The port has lost one or more of its buffers and it thus unpopulated. */
+ OMX_ErrorPortUnpopulated = 0x8000101C,
+
+ /** Component suspended due to temporary loss of resources */
+ OMX_ErrorComponentSuspended = 0x8000101D,
+
+ /** Component suspended due to an inability to acquire dynamic resources */
+ OMX_ErrorDynamicResourcesUnavailable = 0x8000101E,
+
+ /** When the macroblock error reporting is enabled the component returns new error
+ for every frame that has errors */
+ OMX_ErrorMbErrorsInFrame = 0x8000101F,
+
+ /** A component reports this error when it cannot parse or determine the format of an input stream. */
+ OMX_ErrorFormatNotDetected = 0x80001020,
+
+ /** The content open operation failed. */
+ OMX_ErrorContentPipeOpenFailed = 0x80001021,
+
+ /** The content creation operation failed. */
+ OMX_ErrorContentPipeCreationFailed = 0x80001022,
+
+ /** Separate table information is being used */
+ OMX_ErrorSeperateTablesUsed = 0x80001023,
+
+ /** Tunneling is unsupported by the component*/
+ OMX_ErrorTunnelingUnsupported = 0x80001024,
+
+ 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
+
+/** @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 */
+} OMX_BUFFERHEADERTYPE;
+
+/* Extra Data flags */
+
+/* Quant Data Flag: This flag is set when the extra data is appended to the buffer containing quantization information */
+#define OMX_EXTRADATAFLAG_QUANT 0x00000001
+
+typedef struct OMX_OTHER_EXTRADATATYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nFlags; /* Extra Data flags */
+ 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_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_StateChange 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_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 <OMX_Component.h> */
+
+/** 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_NoError. 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.
+
+ 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.
+
+ When the command is "OMX_CommandPortDisable" or
+ "OMX_CommandPortEnable", the component's port (given by the value of
+ nParam) will be stopped or restarted.
+
+ 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_SetStateCmd, value is a member of OMX_StateType. When Cmd has
+ the value OMX_FlushCmd, 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_NoError. 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_IndalidState 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_NoError. 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_LoadedState 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_ExecutingState. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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_NoError. 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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_IVCommon.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_IVCommon.h new file mode 100644 index 0000000..144be87 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_IVCommon.h @@ -0,0 +1,896 @@ +/**
+ * Copyright (c) 2007 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.1
+ * 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_FormatMax = 0x7FFFFFFF
+} OMX_COLOR_FORMATTYPE;
+
+
+/**
+ * Defines the matrix for conversion from RGB to YUV or vice versa.
+ * iColorMatrix should be initialized with the fixed point values
+ * used in converting between formats.
+ */
+typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
+ OMX_U32 nSize; /**< Size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
+ OMX_U32 nPortIndex; /**< Port that this struct applies to */
+ OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
+ OMX_S32 xColorOffset[4]; /**< Stored in signed Q16 format */
+}OMX_CONFIG_COLORCONVERSIONTYPE;
+
+
+/**
+ * Structure defining percent to scale each frame dimension. For example:
+ * To make the width 50% larger, use fWidth = 1.5 and to make the width
+ * 1/2 the original size, use fWidth = 0.5
+ */
+typedef struct OMX_CONFIG_SCALEFACTORTYPE {
+ OMX_U32 nSize; /**< Size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
+ OMX_U32 nPortIndex; /**< Port that this struct applies to */
+ OMX_S32 xWidth; /**< Fixed point value stored as Q16 */
+ OMX_S32 xHeight; /**< Fixed point value stored as Q16 */
+}OMX_CONFIG_SCALEFACTORTYPE;
+
+
+/**
+ * Enumeration of possible image filter types
+ */
+typedef enum OMX_IMAGEFILTERTYPE {
+ OMX_ImageFilterNone,
+ OMX_ImageFilterNoise,
+ OMX_ImageFilterEmboss,
+ OMX_ImageFilterNegative,
+ OMX_ImageFilterSketch,
+ OMX_ImageFilterOilPaint,
+ OMX_ImageFilterHatch,
+ OMX_ImageFilterGpen,
+ OMX_ImageFilterAntialias,
+ OMX_ImageFilterDeRing,
+ OMX_ImageFilterSolarize,
+ OMX_ImageFilterMax = 0x7FFFFFFF
+} OMX_IMAGEFILTERTYPE;
+
+
+/**
+ * Image filter configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eImageFilter : Image filter type enumeration
+ */
+typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_IMAGEFILTERTYPE eImageFilter;
+} OMX_CONFIG_IMAGEFILTERTYPE;
+
+
+/**
+ * Customized U and V for color enhancement
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * bColorEnhancement : Enable/disable color enhancement
+ * nCustomizedU : Practical values: 16-240, range: 0-255, value set for
+ * U component
+ * nCustomizedV : Practical values: 16-240, range: 0-255, value set for
+ * V component
+ */
+typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_BOOL bColorEnhancement;
+ OMX_U8 nCustomizedU;
+ OMX_U8 nCustomizedV;
+} OMX_CONFIG_COLORENHANCEMENTTYPE;
+
+
+/**
+ * Define color key and color key mask
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nARGBColor : 32bit Alpha, Red, Green, Blue Color
+ * nARGBMask : 32bit Mask for Alpha, Red, Green, Blue channels
+ */
+typedef struct OMX_CONFIG_COLORKEYTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nARGBColor;
+ OMX_U32 nARGBMask;
+} OMX_CONFIG_COLORKEYTYPE;
+
+
+/**
+ * List of color blend types for pre/post processing
+ *
+ * ENUMS:
+ * None : No color blending present
+ * AlphaConstant : Function is (alpha_constant * src) +
+ * (1 - alpha_constant) * dst)
+ * AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
+ * Alternate : Function is alternating pixels from src and dst
+ * And : Function is (src & dst)
+ * Or : Function is (src | dst)
+ * Invert : Function is ~src
+ */
+typedef enum OMX_COLORBLENDTYPE {
+ OMX_ColorBlendNone,
+ OMX_ColorBlendAlphaConstant,
+ OMX_ColorBlendAlphaPerPixel,
+ OMX_ColorBlendAlternate,
+ OMX_ColorBlendAnd,
+ OMX_ColorBlendOr,
+ OMX_ColorBlendInvert,
+ OMX_ColorBlendMax = 0x7FFFFFFF
+} OMX_COLORBLENDTYPE;
+
+
+/**
+ * Color blend configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nRGBAlphaConstant : Constant global alpha values when global alpha is used
+ * eColorBlend : Color blend type enumeration
+ */
+typedef struct OMX_CONFIG_COLORBLENDTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nRGBAlphaConstant;
+ OMX_COLORBLENDTYPE eColorBlend;
+} OMX_CONFIG_COLORBLENDTYPE;
+
+
+/**
+ * Hold frame dimension
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nWidth : Frame width in pixels
+ * nHeight : Frame height in pixels
+ */
+typedef struct OMX_FRAMESIZETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nWidth;
+ OMX_U32 nHeight;
+} OMX_FRAMESIZETYPE;
+
+
+/**
+ * Rotation configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nRotation : +/- integer rotation value
+ */
+typedef struct OMX_CONFIG_ROTATIONTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nRotation;
+} OMX_CONFIG_ROTATIONTYPE;
+
+
+/**
+ * Possible mirroring directions for pre/post processing
+ *
+ * ENUMS:
+ * None : No mirroring
+ * Vertical : Vertical mirroring, flip on X axis
+ * Horizontal : Horizontal mirroring, flip on Y axis
+ * Both : Both vertical and horizontal mirroring
+ */
+typedef enum OMX_MIRRORTYPE {
+ OMX_MirrorNone = 0,
+ OMX_MirrorVertical,
+ OMX_MirrorHorizontal,
+ OMX_MirrorBoth,
+ OMX_MirrorMax = 0x7FFFFFFF
+} OMX_MIRRORTYPE;
+
+
+/**
+ * Mirroring configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eMirror : Mirror type enumeration
+ */
+typedef struct OMX_CONFIG_MIRRORTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_MIRRORTYPE eMirror;
+} OMX_CONFIG_MIRRORTYPE;
+
+
+/**
+ * Position information only
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nX : X coordinate for the point
+ * nY : Y coordinate for the point
+ */
+typedef struct OMX_CONFIG_POINTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nX;
+ OMX_S32 nY;
+} OMX_CONFIG_POINTTYPE;
+
+
+/**
+ * Frame size plus position
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nLeft : X Coordinate of the top left corner of the rectangle
+ * nTop : Y Coordinate of the top left corner of the rectangle
+ * nWidth : Width of the rectangle
+ * nHeight : Height of the rectangle
+ */
+typedef struct OMX_CONFIG_RECTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nLeft;
+ OMX_S32 nTop;
+ OMX_U32 nWidth;
+ OMX_U32 nHeight;
+} OMX_CONFIG_RECTTYPE;
+
+
+/**
+ * Deblocking state; it is required to be set up before starting the codec
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * bDeblocking : Enable/disable deblocking mode
+ */
+typedef struct OMX_PARAM_DEBLOCKINGTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_BOOL bDeblocking;
+} OMX_PARAM_DEBLOCKINGTYPE;
+
+
+/**
+ * Stabilization state
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * bStab : Enable/disable frame stabilization state
+ */
+typedef struct OMX_CONFIG_FRAMESTABTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_BOOL bStab;
+} OMX_CONFIG_FRAMESTABTYPE;
+
+
+/**
+ * White Balance control type
+ *
+ * STRUCT MEMBERS:
+ * SunLight : Referenced in JSR-234
+ * Flash : Optimal for device's integrated flash
+ */
+typedef enum OMX_WHITEBALCONTROLTYPE {
+ OMX_WhiteBalControlOff = 0,
+ OMX_WhiteBalControlAuto,
+ OMX_WhiteBalControlSunLight,
+ OMX_WhiteBalControlCloudy,
+ OMX_WhiteBalControlShade,
+ OMX_WhiteBalControlTungsten,
+ OMX_WhiteBalControlFluorescent,
+ OMX_WhiteBalControlIncandescent,
+ OMX_WhiteBalControlFlash,
+ OMX_WhiteBalControlHorizon,
+ OMX_WhiteBalControlMax = 0x7FFFFFFF
+} OMX_WHITEBALCONTROLTYPE;
+
+
+/**
+ * White Balance control configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eWhiteBalControl : White balance enumeration
+ */
+typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
+} OMX_CONFIG_WHITEBALCONTROLTYPE;
+
+
+/**
+ * Exposure control type
+ */
+typedef enum OMX_EXPOSURECONTROLTYPE {
+ OMX_ExposureControlOff = 0,
+ OMX_ExposureControlAuto,
+ OMX_ExposureControlNight,
+ OMX_ExposureControlBackLight,
+ OMX_ExposureControlSpotLight,
+ OMX_ExposureControlSports,
+ OMX_ExposureControlSnow,
+ OMX_ExposureControlBeach,
+ OMX_ExposureControlLargeAperture,
+ OMX_ExposureControlSmallApperture,
+ OMX_ExposureControlMax = 0x7FFFFFFF
+} OMX_EXPOSURECONTROLTYPE;
+
+
+/**
+ * White Balance control configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eExposureControl : Exposure control enumeration
+ */
+typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_EXPOSURECONTROLTYPE eExposureControl;
+} OMX_CONFIG_EXPOSURECONTROLTYPE;
+
+
+/**
+ * Defines sensor supported mode.
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nFrameRate : Single shot mode is indicated by a 0
+ * bOneShot : Enable for single shot, disable for streaming
+ * sFrameSize : Framesize
+ */
+typedef struct OMX_PARAM_SENSORMODETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nFrameRate;
+ OMX_BOOL bOneShot;
+ OMX_FRAMESIZETYPE sFrameSize;
+} OMX_PARAM_SENSORMODETYPE;
+
+
+/**
+ * Defines contrast level
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nContrast : Values allowed for contrast -100 to 100, zero means no change
+ */
+typedef struct OMX_CONFIG_CONTRASTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nContrast;
+} OMX_CONFIG_CONTRASTTYPE;
+
+
+/**
+ * Defines brightness level
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nBrightness : 0-100%
+ */
+typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nBrightness;
+} OMX_CONFIG_BRIGHTNESSTYPE;
+
+
+/**
+ * Defines backlight level configuration for a video sink, e.g. LCD panel
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nBacklight : Values allowed for backlight 0-100%
+ * nTimeout : Number of milliseconds before backlight automatically turns
+ * off. A value of 0x0 disables backight timeout
+ */
+typedef struct OMX_CONFIG_BACKLIGHTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nBacklight;
+ OMX_U32 nTimeout;
+} OMX_CONFIG_BACKLIGHTTYPE;
+
+
+/**
+ * Defines setting for Gamma
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nGamma : Values allowed for gamma -100 to 100, zero means no change
+ */
+typedef struct OMX_CONFIG_GAMMATYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nGamma;
+} OMX_CONFIG_GAMMATYPE;
+
+
+/**
+ * Define for setting saturation
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nSaturation : Values allowed for saturation -100 to 100, zero means
+ * no change
+ */
+typedef struct OMX_CONFIG_SATURATIONTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nSaturation;
+} OMX_CONFIG_SATURATIONTYPE;
+
+
+/**
+ * Define for setting Lightness
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nLightness : Values allowed for lightness -100 to 100, zero means no
+ * change
+ */
+typedef struct OMX_CONFIG_LIGHTNESSTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_S32 nLightness;
+} OMX_CONFIG_LIGHTNESSTYPE;
+
+
+/**
+ * Plane blend configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Index of input port associated with the plane.
+ * nDepth : Depth of the plane in relation to the screen. Higher
+ * numbered depths are "behind" lower number depths.
+ * This number defaults to the Port Index number.
+ * nAlpha : Transparency blending component for the entire plane.
+ * See blending modes for more detail.
+ */
+typedef struct OMX_CONFIG_PLANEBLENDTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nDepth;
+ OMX_U32 nAlpha;
+} OMX_CONFIG_PLANEBLENDTYPE;
+
+
+/**
+ * Define interlace type
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * bEnable : Enable control variable for this functionality
+ * (see below)
+ * nInterleavePortIndex : Index of input or output port associated with
+ * the interleaved plane.
+ * pPlanarPortIndexes[4] : Index of input or output planar ports.
+ */
+typedef struct OMX_PARAM_INTERLEAVETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_BOOL bEnable;
+ OMX_U32 nInterleavePortIndex;
+} OMX_PARAM_INTERLEAVETYPE;
+
+
+/**
+ * Defines the picture effect used for an input picture
+ */
+typedef enum OMX_TRANSITIONEFFECTTYPE {
+ OMX_EffectNone,
+ OMX_EffectFadeFromBlack,
+ OMX_EffectFadeToBlack,
+ OMX_EffectUnspecifiedThroughConstantColor,
+ OMX_EffectDissolve,
+ OMX_EffectWipe,
+ OMX_EffectUnspecifiedMixOfTwoScenes,
+ OMX_EffectMax = 0x7FFFFFFF
+} OMX_TRANSITIONEFFECTTYPE;
+
+
+/**
+ * Structure used to configure current transition effect
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eEffect : Effect to enable
+ */
+typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_TRANSITIONEFFECTTYPE eEffect;
+} OMX_CONFIG_TRANSITIONEFFECTTYPE;
+
+
+/**
+ * Defines possible data unit types for encoded video data. The data unit
+ * types are used both for encoded video input for playback as well as
+ * encoded video output from recording.
+ */
+typedef enum OMX_DATAUNITTYPE {
+ OMX_DataUnitCodedPicture,
+ OMX_DataUnitVideoSegment,
+ OMX_DataUnitSeveralSegments,
+ OMX_DataUnitArbitraryStreamSection,
+ OMX_DataUnitMax = 0x7FFFFFFF
+} OMX_DATAUNITTYPE;
+
+
+/**
+ * Defines possible encapsulation types for coded video data unit. The
+ * encapsulation information is used both for encoded video input for
+ * playback as well as encoded video output from recording.
+ */
+typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
+ OMX_DataEncapsulationElementaryStream,
+ OMX_DataEncapsulationGenericPayload,
+ OMX_DataEncapsulationRtpPayload,
+ OMX_DataEncapsulationMax = 0x7FFFFFFF
+} OMX_DATAUNITENCAPSULATIONTYPE;
+
+
+/**
+ * Structure used to configure the type of being decoded/encoded
+ */
+typedef struct OMX_PARAM_DATAUNITTYPE {
+ 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_DATAUNITTYPE eUnitType;
+ OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
+} OMX_PARAM_DATAUNITTYPE;
+
+
+/**
+ * Defines dither types
+ */
+typedef enum OMX_DITHERTYPE {
+ OMX_DitherNone,
+ OMX_DitherOrdered,
+ OMX_DitherErrorDiffusion,
+ OMX_DitherOther,
+ OMX_DitherMax = 0x7FFFFFFF
+} OMX_DITHERTYPE;
+
+
+/**
+ * Structure used to configure current type of dithering
+ */
+typedef struct OMX_CONFIG_DITHERTYPE {
+ 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_DITHERTYPE eDither; /**< Type of dithering to use */
+} OMX_CONFIG_DITHERTYPE;
+
+typedef struct OMX_CONFIG_CAPTUREMODETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex; /**< Port that this structure applies to */
+ OMX_BOOL bContinuous; /**< If true then ignore frame rate and emit capture
+ * data as fast as possible (otherwise obey port's frame rate). */
+ OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
+ * specified number of frames (otherwise the port does not
+ * terminate the capture until instructed to do so by the client).
+ * Even if set, the client may manually terminate the capture prior
+ * to reaching the limit. */
+ OMX_U32 nFrameLimit; /**< Limit on number of frames emitted during a capture (only
+ * valid if bFrameLimited is set). */
+} OMX_CONFIG_CAPTUREMODETYPE;
+
+typedef enum OMX_METERINGTYPE {
+
+ OMX_MeteringModeAverage, /**< Center-weighted average metering. */
+ OMX_MeteringModeSpot, /**< Spot (partial) metering. */
+ OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */
+
+ OMX_EVModeMax = 0x7ffffff
+} OMX_METERINGTYPE;
+
+typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_METERINGTYPE eMetering;
+ OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */
+ OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
+ OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */
+ OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */
+ OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */
+ OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */
+ OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */
+} OMX_CONFIG_EXPOSUREVALUETYPE;
+
+/**
+ * Focus region configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * bCenter : Use center region as focus region of interest
+ * bLeft : Use left region as focus region of interest
+ * bRight : Use right region as focus region of interest
+ * bTop : Use top region as focus region of interest
+ * bBottom : Use bottom region as focus region of interest
+ * bTopLeft : Use top left region as focus region of interest
+ * bTopRight : Use top right region as focus region of interest
+ * bBottomLeft : Use bottom left region as focus region of interest
+ * bBottomRight : Use bottom right region as focus region of interest
+ */
+typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_BOOL bCenter;
+ OMX_BOOL bLeft;
+ OMX_BOOL bRight;
+ OMX_BOOL bTop;
+ OMX_BOOL bBottom;
+ OMX_BOOL bTopLeft;
+ OMX_BOOL bTopRight;
+ OMX_BOOL bBottomLeft;
+ OMX_BOOL bBottomRight;
+} OMX_CONFIG_FOCUSREGIONTYPE;
+
+/**
+ * Focus Status type
+ */
+typedef enum OMX_FOCUSSTATUSTYPE {
+ OMX_FocusStatusOff = 0,
+ OMX_FocusStatusRequest,
+ OMX_FocusStatusReached,
+ OMX_FocusStatusUnableToReach,
+ OMX_FocusStatusLost,
+ OMX_FocusStatusMax = 0x7FFFFFFF
+} OMX_FOCUSSTATUSTYPE;
+
+/**
+ * Focus status configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eFocusStatus : Specifies the focus status
+ * bCenterStatus : Use center region as focus region of interest
+ * bLeftStatus : Use left region as focus region of interest
+ * bRightStatus : Use right region as focus region of interest
+ * bTopStatus : Use top region as focus region of interest
+ * bBottomStatus : Use bottom region as focus region of interest
+ * bTopLeftStatus : Use top left region as focus region of interest
+ * bTopRightStatus : Use top right region as focus region of interest
+ * bBottomLeftStatus : Use bottom left region as focus region of interest
+ * bBottomRightStatus : Use bottom right region as focus region of interest
+ */
+typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_FOCUSSTATUSTYPE eFocusStatus;
+ OMX_BOOL bCenterStatus;
+ OMX_BOOL bLeftStatus;
+ OMX_BOOL bRightStatus;
+ OMX_BOOL bTopStatus;
+ OMX_BOOL bBottomStatus;
+ OMX_BOOL bTopLeftStatus;
+ OMX_BOOL bTopRightStatus;
+ OMX_BOOL bBottomLeftStatus;
+ OMX_BOOL bBottomRightStatus;
+} OMX_PARAM_FOCUSSTATUSTYPE;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Image.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Image.h new file mode 100644 index 0000000..a34c1b2 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Image.h @@ -0,0 +1,318 @@ +/**
+ * Copyright (c) 2007 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_Image.h - OpenMax IL version 1.1.1
+ * The structures needed by Image components to exchange parameters and
+ * configuration data with the components.
+ */
+#ifndef OMX_Image_h
+#define OMX_Image_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_IVCommon.h>
+
+/** @defgroup imaging OpenMAX IL Imaging Domain
+ * @ingroup iv
+ * Structures for OpenMAX IL Imaging domain
+ * @{
+ */
+
+/**
+ * Enumeration used to define the possible image compression coding.
+ */
+typedef enum OMX_IMAGE_CODINGTYPE {
+ OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
+ OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
+ OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
+ OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
+ OMX_IMAGE_CodingEXIF, /**< EXIF image format */
+ OMX_IMAGE_CodingTIFF, /**< TIFF image format */
+ OMX_IMAGE_CodingGIF, /**< Graphics image format */
+ OMX_IMAGE_CodingPNG, /**< PNG image format */
+ OMX_IMAGE_CodingLZW, /**< LZW image format */
+ OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
+ OMX_IMAGE_CodingMax = 0x7FFFFFFF
+} OMX_IMAGE_CODINGTYPE;
+
+
+/**
+ * Data structure used to define an image path. The number of image paths
+ * for input and output will vary by type of the image 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
+ * image 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 OMX_GetParameter() 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 port if
+ * uncompressed format is used. Use 0 for
+ * unknown, don't care or variable
+ * nFrameHeight : Height of frame to be used on port 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
+ * 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_IMAGE_CodingUnused is
+ * specified, eColorFormat is valid
+ * 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_IMAGE_PORTDEFINITIONTYPE {
+ OMX_STRING cMIMEType;
+ OMX_NATIVE_DEVICETYPE pNativeRender;
+ OMX_U32 nFrameWidth;
+ OMX_U32 nFrameHeight;
+ OMX_S32 nStride;
+ OMX_U32 nSliceHeight;
+ OMX_BOOL bFlagErrorConcealment;
+ OMX_IMAGE_CODINGTYPE eCompressionFormat;
+ OMX_COLOR_FORMATTYPE eColorFormat;
+ OMX_NATIVE_WINDOWTYPE pNativeWindow;
+} OMX_IMAGE_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_IMAGE_CodingUnused is specified,
+ * eColorFormat is valid
+ * eColorFormat : Decompressed format used by this component
+ */
+typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nIndex;
+ OMX_IMAGE_CODINGTYPE eCompressionFormat;
+ OMX_COLOR_FORMATTYPE eColorFormat;
+} OMX_IMAGE_PARAM_PORTFORMATTYPE;
+
+
+/**
+ * Flash control type
+ *
+ * ENUMS
+ * Torch : Flash forced constantly on
+ */
+typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
+ OMX_IMAGE_FlashControlOn = 0,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FlashControlRedEyeReduction,
+ OMX_IMAGE_FlashControlFillin,
+ OMX_IMAGE_FlashControlTorch,
+ OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
+} OMX_IMAGE_FLASHCONTROLTYPE;
+
+
+/**
+ * Flash control configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eFlashControl : Flash control type
+ */
+typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
+} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
+
+
+/**
+ * Focus control type
+ */
+typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
+ OMX_IMAGE_FocusControlOn = 0,
+ OMX_IMAGE_FocusControlOff,
+ OMX_IMAGE_FocusControlAuto,
+ OMX_IMAGE_FocusControlAutoLock,
+ OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
+} OMX_IMAGE_FOCUSCONTROLTYPE;
+
+
+/**
+ * Focus control configuration
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eFocusControl : Focus control
+ * nFocusSteps : Focus can take on values from 0 mm to infinity.
+ * Interest is only in number of steps over this range.
+ * nFocusStepIndex : Current focus step index
+ */
+typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
+ OMX_U32 nFocusSteps;
+ OMX_U32 nFocusStepIndex;
+} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
+
+
+/**
+ * Q Factor for JPEG compression, which controls the tradeoff between image
+ * quality and size. Q Factor provides a more simple means of controlling
+ * JPEG compression quality, without directly programming Quantization
+ * tables for chroma and luma
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
+ * produces the smallest, worst quality images, and a factor
+ * of 100 produces the largest, best quality images. A
+ * typical default is 75 for small good quality images
+ */
+typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_U32 nQFactor;
+} OMX_IMAGE_PARAM_QFACTORTYPE;
+
+/**
+ * Quantization table type
+ */
+
+typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
+ OMX_IMAGE_QuantizationTableLuma = 0,
+ OMX_IMAGE_QuantizationTableChroma,
+ OMX_IMAGE_QuantizationTableChromaCb,
+ OMX_IMAGE_QuantizationTableChromaCr,
+ OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
+} OMX_IMAGE_QUANTIZATIONTABLETYPE;
+
+/**
+ * JPEG quantization tables are used to determine DCT compression for
+ * YUV data, as an alternative to specifying Q factor, providing exact
+ * control of compression
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eQuantizationTable : Quantization table type
+ * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
+ * in increasing columns then by rows of data (i.e.
+ * row 1, ... row 8). Quantization values are in
+ * the range 0-255 and stored in linear order
+ * (i.e. the component will zig-zag the
+ * quantization table data if required internally)
+ */
+typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
+ OMX_U8 nQuantizationMatrix[64];
+} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
+
+
+/**
+ * Huffman table type, the same Huffman table is applied for chroma and
+ * luma component
+ */
+typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
+ OMX_IMAGE_HuffmanTableAC = 0,
+ OMX_IMAGE_HuffmanTableDC,
+ OMX_IMAGE_HuffmanTableACLuma,
+ OMX_IMAGE_HuffmanTableACChroma,
+ OMX_IMAGE_HuffmanTableDCLuma,
+ OMX_IMAGE_HuffmanTableDCChroma,
+ OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
+} OMX_IMAGE_HUFFMANTABLETYPE;
+
+/**
+ * JPEG Huffman table
+ *
+ * STRUCT MEMBERS:
+ * nSize : Size of the structure in bytes
+ * nVersion : OMX specification version information
+ * nPortIndex : Port that this structure applies to
+ * eHuffmanTable : Huffman table type
+ * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
+ * possible length
+ * nHuffmanTable[256] : 0-255, the size used for AC and DC
+ * HuffmanTable are 16 and 162
+ */
+typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
+ OMX_U8 nNumberOfHuffmanCodeOfLength[16];
+ OMX_U8 nHuffmanTable[256];
+}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Index.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Index.h new file mode 100644 index 0000000..08ebefc --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Index.h @@ -0,0 +1,256 @@ +/*
+ * Copyright (c) 2007 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_Index.h - OpenMax IL version 1.1.1
+ * The OMX_Index header file contains the definitions for both applications
+ * and components .
+ */
+
+
+#ifndef OMX_Index_h
+#define OMX_Index_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_Types.h>
+
+
+/** The OMX_INDEXTYPE enumeration is used to select a structure when either
+ * getting or setting parameters and/or configuration data. Each entry in
+ * this enumeration maps to an OMX specified structure. When the
+ * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
+ * are used, the second parameter will always be an entry from this enumeration
+ * and the third entry will be the structure shown in the comments for the entry.
+ * For example, if the application is initializing a cropping function, the
+ * OMX_SetConfig command would have OMX_ConfigInputCrop as the second parameter
+ * and would send a pointer to an initialized OMX_RECTTYPE structure as the
+ * third parameter.
+ *
+ * The enumeration entries named with the OMX_Config prefix are sent using
+ * the OMX_SetConfig command and the enumeration entries named with the
+ * OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
+ */
+typedef enum OMX_INDEXTYPE {
+
+ OMX_IndexComponentStartUnused = 0x01000000,
+ OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
+ OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */
+ OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */
+ OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */
+ OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */
+ OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */
+ OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */
+ OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
+ OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */
+ OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */
+ OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
+ OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */
+ OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */
+ OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */
+ OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
+ OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
+ OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
+ OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */
+ OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
+ OMX_IndexParamMetadataFilterType, /** < reference: OMX_PARAM_METADATAFILTERTYPE */
+ OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
+ OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
+ OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */
+
+ OMX_IndexPortStartUnused = 0x02000000,
+ OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
+ OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE (*/
+ OMX_IndexReservedStartUnused = 0x03000000,
+
+ /* Audio parameters and configurations */
+ OMX_IndexAudioStartUnused = 0x04000000,
+ OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
+ OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
+ OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
+ OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */
+ OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
+ OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
+ OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */
+ OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */
+ OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
+ OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */
+ OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
+ OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
+ OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM__GSMFRTYPE */
+ OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
+ OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */
+ OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
+ OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
+ OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
+ OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
+ OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
+ OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
+ OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
+ OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
+ OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
+ OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
+ OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
+ OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
+
+ OMX_IndexConfigAudioMidiImmediateEvent, /**< OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
+ OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
+ OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
+ OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
+ OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
+ OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
+ OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
+ OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
+ OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
+ OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
+ OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
+ OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
+ OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
+ OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
+ OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
+ OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
+ OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
+ OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
+ OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
+ OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
+
+ /* Image specific parameters and configurations */
+ OMX_IndexImageStartUnused = 0x05000000,
+ OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
+ OMX_IndexParamFlashControl, /**< refer to OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
+ OMX_IndexConfigFocusControl, /**< refer to OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
+ OMX_IndexParamQFactor, /**< refer to OMX_IMAGE_PARAM_QFACTORTYPE */
+ OMX_IndexParamQuantizationTable, /**< refer to OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
+ OMX_IndexParamHuffmanTable, /**< For jpeg, refer to OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
+ OMX_IndexConfigFlashControl, /**< refer to OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
+
+ /* Video specific parameters and configurations */
+ OMX_IndexVideoStartUnused = 0x06000000,
+ OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
+ OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONPARAMTYPE */
+ OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
+ OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
+ OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
+ OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
+ OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
+ OMX_IndexParamVideoVBSMC, /**< reference:OMX_VIDEO_PARAM_VBSMCTYPE */
+ OMX_IndexParamVideoMpeg2, /**< reference:OMX_VIDEO_PARAM_MPEG2TYPE */
+ OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_CONFIG_MPEG4TYPE */
+ OMX_IndexParamVideoWmv, /**< reference:OMX_VIDEO_PARAM_WMVTYPE */
+ OMX_IndexParamVideoRv, /**< reference:OMX_VIDEO_PARAM_RVTYPE */
+ OMX_IndexParamVideoAvc, /**< reference:OMX_VIDEO_PARAM_AVCTYPE */
+ OMX_IndexParamVideoH263, /**< reference:OMX_VIDEO_PARAM_H263TYPE */
+ OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference:OMX_VIDEO_PARAM_PROFILELEVEL */
+ OMX_IndexParamVideoProfileLevelCurrent, /**< reference:OMX_VIDEO_PARAM_PROFILELEVEL */
+ OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
+ OMX_IndexConfigVideoFramerate, /**< reference:OMX_VIDEO_CONFIG_FRAMERATETYPE */
+ OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
+ OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
+ OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
+ OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
+ OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
+ OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
+ OMX_IndexConfigVideoAVCIntraPeriod, /** reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
+ OMX_IndexConfigVideoNalSize, /** reference: OMX_VIDEO_CONFIG_NALSIZE */
+
+ /* Image & Video common Configurations */
+ OMX_IndexCommonStartUnused = 0x07000000,
+ OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
+ OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */
+ OMX_IndexParamCommonInterleave, /** reference: OMX_PARAM_INTERLEAVETYPE */
+ OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
+ OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
+ OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
+ OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
+ OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */
+ OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */
+ OMX_IndexConfigCommonFrameStabilisation, /**< reference: OMX_CONFIG_FRAMESTABTYPE */
+ OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */
+ OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */
+ OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */
+ OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
+ OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
+ OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
+ OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
+ OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
+ OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
+ OMX_IndexConfigCommonContrast, /**< reference to OMX_CONFIG_CONTRASTTYPE */
+ OMX_IndexConfigCommonBrightness, /**< reference to OMX_CONFIG_BRIGHTNESSTYPE */
+ OMX_IndexConfigCommonBacklight, /**< reference to OMX_CONFIG_BACKLIGHTTYPE */
+ OMX_IndexConfigCommonGamma, /**< reference to OMX_CONFIG_GAMMATYPE */
+ OMX_IndexConfigCommonSaturation, /**< reference to OMX_CONFIG_SATURATIONTYPE */
+ OMX_IndexConfigCommonLightness, /**< reference to OMX_CONFIG_LIGHTNESSTYPE */
+ OMX_IndexConfigCommonExclusionRect, /** reference: OMX_CONFIG_RECTTYPE */
+ OMX_IndexConfigCommonDithering, /**< reference: OMX_TIME_CONFIG_DITHERTYPE */
+ OMX_IndexConfigCommonPlaneBlend, /** reference: OMX_CONFIG_PLANEBLENDTYPE */
+ OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
+ OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */
+ OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */
+ OMX_IndexConfigCommonFocusRegion, /**< refer to OMX_PARAM_FOCUSREGIONTYPE */
+ OMX_IndexConfigCommonFocusStatus, /**< refer to OMX_IMAGE_CONFIG_FOCUSSTATUSTYPE */
+
+ /* Reserved Configuration range */
+ OMX_IndexOtherStartUnused = 0x08000000,
+ OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
+ OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
+ OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
+
+
+ /* Reserved Time range */
+ OMX_IndexTimeStartUnused = 0x09000000,
+ OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */
+ OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
+ OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
+ OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only)*/
+ OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only)*/
+ OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+ OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+ OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
+ OMX_IndexConfigTimeClientStartTime, /**<reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+ OMX_IndexConfigTimePosition, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
+ OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
+
+
+ /* Vendor specific area */
+ OMX_IndexVendorStartUnused = 0x7F000000,
+ /* Vendor specific structures should be in the range of 0x7F000000
+ to 0x7FFFFFFE. This range is not broken out by vendor, so
+ private indexes are not guaranteed unique and therefore should
+ only be sent to the appropriate component. */
+
+ OMX_IndexMax = 0x7FFFFFFF
+
+} OMX_INDEXTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Other.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Other.h new file mode 100644 index 0000000..a4b5bd9 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Other.h @@ -0,0 +1,325 @@ +/*
+ * Copyright (c) 2007 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_Other.h - OpenMax IL version 1.1.1
+ * The structures needed by Other components to exchange
+ * parameters and configuration data with the components.
+ */
+
+#ifndef OMX_Other_h
+#define OMX_Other_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>
+
+
+/**
+ * Enumeration of possible data types which match to multiple domains or no
+ * domain at all. For types which are vendor specific, a value above
+ * OMX_OTHER_VENDORTSTART should be used.
+ */
+typedef enum OMX_OTHER_FORMATTYPE {
+ OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time,
+ time deltas, etc */
+ OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power
+ management, setting clocks? */
+ OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames
+ dropped, etc */
+ OMX_OTHER_FormatBinary, /**< Arbitrary binary data */
+ OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific
+ formats */
+
+ OMX_OTHER_FormatMax = 0x7FFFFFFF
+} OMX_OTHER_FORMATTYPE;
+
+/**
+ * Enumeration of seek modes.
+ */
+typedef enum OMX_TIME_SEEKMODETYPE {
+ OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
+ * of the requested seek position over
+ * the actual seek position if it
+ * results in a faster seek. */
+ OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek
+ * position over an approximation
+ * of the requested seek position even
+ * if it results in a slower seek. */
+ OMX_TIME_SeekModeMax = 0x7FFFFFFF
+} OMX_TIME_SEEKMODETYPE;
+
+/* Structure representing the seekmode of the component */
+typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */
+} OMX_TIME_CONFIG_SEEKMODETYPE;
+
+/** Structure representing a time stamp used with the following configs
+ * on the Clock Component (CC):
+ *
+ * OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall
+ * time
+ * OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media
+ * time
+ * OMX_IndexConfigTimeAudioReferenceTime and
+ * OMX_IndexConfigTimeVideoReferenceTime: audio/video reference
+ * clock sending SC its reference time
+ * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends
+ * this structure to the Clock Component via a SetConfig on its
+ * client port when it receives a buffer with
+ * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
+ * specified by that buffer for nStartTimestamp.
+ *
+ * It’s also used with the following config on components in general:
+ *
+ * OMX_IndexConfigTimePosition: IL client querying component position
+ * (GetConfig) or commanding a component to seek to the given location
+ * (SetConfig)
+ */
+typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
+ 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_TICKS nTimestamp; /**< timestamp .*/
+} OMX_TIME_CONFIG_TIMESTAMPTYPE;
+
+/** Enumeration of possible reference clocks to the media time. */
+typedef enum OMX_TIME_UPDATETYPE {
+ OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */
+ OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */
+ OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */
+ OMX_TIME_UpdateMax = 0x7FFFFFFF
+} OMX_TIME_UPDATETYPE;
+
+/** Enumeration of possible reference clocks to the media time. */
+typedef enum OMX_TIME_REFCLOCKTYPE {
+ OMX_TIME_RefClockNone, /**< Use no references. */
+ OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
+ OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
+ OMX_TIME_RefClockMax = 0x7FFFFFFF
+} OMX_TIME_REFCLOCKTYPE;
+
+/** Enumeration of clock states. */
+typedef enum OMX_TIME_CLOCKSTATE {
+ OMX_TIME_ClockStateRunning, /**< Clock running. */
+ OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the
+ * prescribed clients emit their
+ * start time. */
+ OMX_TIME_ClockStateStopped, /**< Clock stopped. */
+ OMX_TIME_ClockStateMax = 0x7FFFFFFF
+} OMX_TIME_CLOCKSTATE;
+
+/** Structure representing a media time request to the clock component.
+ *
+ * A client component sends this structure to the Clock Component via a SetConfig
+ * on its client port to specify a media timestamp the Clock Component
+ * should emit. The Clock Component should fulfill the request by sending a
+ * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested
+ * timestamp.
+ *
+ * The client may require a media time request be fulfilled slightly
+ * earlier than the media time specified. In this case the client specifies
+ * an offset which is equal to the difference between wall time corresponding
+ * to the requested media time and the wall time when it will be
+ * fulfilled.
+ *
+ * A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
+ * time events according to timestamps. If a client must perform an operation O at
+ * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a
+ * media time request at T (perhaps specifying an offset to ensure the request fulfillment
+ * is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
+ * structure back to the client component, the client may perform operation O (perhaps having
+ * to wait a slight amount more time itself as specified by the return values).
+ */
+
+typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
+ 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_PTR pClientPrivate; /**< Client private data to disabiguate this media time
+ * from others (e.g. the number of the frame to deliver).
+ * Duplicated in the media time structure that fulfills
+ * this request. A value of zero is reserved for time scale
+ * updates. */
+ OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/
+ OMX_TICKS nOffset; /**< Amount of wall clock time by which this
+ * request should be fulfilled early */
+} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
+
+/**< Structure sent from the clock component client either when fulfilling
+ * a media time request or when the time scale has changed.
+ *
+ * In the former case the Clock Component fills this structure and times its emission
+ * to a client component (via the client port) according to the corresponding media
+ * time request sent by the client. The Clock Component should time the emission to occur
+ * when the requested timestamp matches the Clock Component's media time but also the
+ * prescribed offset early.
+ *
+ * Upon scale changes the clock component clears the nClientPrivate data, sends the current
+ * media time and sets the nScale to the new scale via the client port. It emits a
+ * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to
+ * alter processing to accomodate scaling. For instance a video component might skip inter-frames
+ * in the case of extreme fastforward. Likewise an audio component might add or remove samples
+ * from an audio frame to scale audio data.
+ *
+ * It is expected that some clock components may not be able to fulfill requests
+ * at exactly the prescribed time. This is acceptable so long as the request is
+ * fulfilled at least as early as described and not later. This structure provides
+ * fields the client may use to wait for the remaining time.
+ *
+ * The client may use either the nOffset or nWallTimeAtMedia fields to determine the
+ * wall time until the nMediaTimestamp actually occurs. In the latter case the
+ * client can get a more accurate value for offset by getting the current wall
+ * from the cloc component and subtracting it from nWallTimeAtMedia.
+ */
+
+typedef struct OMX_TIME_MEDIATIMETYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time
+ * from others. Copied from the media time request.
+ * A value of zero is reserved for time scale updates. */
+ OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
+ OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was
+ * requested then this is the current media time. */
+ OMX_TICKS nOffset; /**< Amount of wall clock time by which this
+ * request was actually fulfilled early */
+
+ OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
+ * A client may compare this value to current
+ * media time obtained from the Clock Component to determine
+ * the wall time until the media timestamp is really
+ * current. */
+ OMX_S32 xScale; /**< Current media time scale in Q16 format. */
+ OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/
+ /**< State of the media time. */
+} OMX_TIME_MEDIATIMETYPE;
+
+/** Structure representing the current media time scale factor. Applicable only to clock
+ * component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
+ * the clock component client ports. Upon recieving this config the clock component changes
+ * the rate by which the media time increases or decreases effectively implementing trick modes.
+ */
+typedef struct OMX_TIME_CONFIG_SCALETYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ OMX_S32 xScale; /**< This is a value in Q16 format which is used for
+ * scaling the media time */
+} OMX_TIME_CONFIG_SCALETYPE;
+
+/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG’s nWaitMask field */
+#define OMX_CLOCKPORT0 0x00000001
+#define OMX_CLOCKPORT1 0x00000002
+#define OMX_CLOCKPORT2 0x00000004
+#define OMX_CLOCKPORT3 0x00000008
+#define OMX_CLOCKPORT4 0x00000010
+#define OMX_CLOCKPORT5 0x00000020
+#define OMX_CLOCKPORT6 0x00000040
+#define OMX_CLOCKPORT7 0x00000080
+
+/** Structure representing the current mode of the media clock.
+ * IL Client uses this config to change or query the mode of the
+ * media clock of the clock component. Applicable only to clock
+ * component.
+ *
+ * On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
+ * starts immediately at the prescribed start time. If
+ * OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
+ * the given nStartTime and waits for all clients specified in the
+ * nWaitMask to send starttimes (via
+ * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts
+ * the media clock using the earliest start time supplied. */
+typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version
+ * information */
+ OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
+ OMX_TICKS nStartTime; /**< Start time of the media time. */
+ OMX_TICKS nOffset; /**< Time to offset the media time by
+ * (e.g. preroll). Media time will be
+ * reported to be nOffset ticks earlier.
+ */
+ OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */
+} OMX_TIME_CONFIG_CLOCKSTATETYPE;
+
+/** Structure representing the reference clock currently being used to
+ * compute media time. IL client uses this config to change or query the
+ * clock component's active reference clock */
+typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */
+} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
+
+/** Descriptor for setting specifics of power type. */
+typedef struct OMX_OTHER_CONFIG_POWERTYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ OMX_BOOL bEnablePM; /**< Flag to enable Power Management */
+} OMX_OTHER_CONFIG_POWERTYPE;
+
+
+/** Descriptor for setting specifics of stats type. */
+typedef struct OMX_OTHER_CONFIG_STATSTYPE {
+ OMX_U32 nSize; /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+ /* what goes here */
+} OMX_OTHER_CONFIG_STATSTYPE;
+
+
+/**
+ * The PortDefinition structure is used to define all of the parameters
+ * necessary for the compliant component to setup an input or an output other
+ * path.
+ */
+typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
+ OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
+} OMX_OTHER_PORTDEFINITIONTYPE;
+
+/** Port format parameter. This structure is used to enumerate
+ * the various data input/output format supported by the port.
+ */
+typedef struct OMX_OTHER_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_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
+} OMX_OTHER_PARAM_PORTFORMATTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Types.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Types.h new file mode 100644 index 0000000..a6ad31e --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Types.h @@ -0,0 +1,355 @@ +/*
+ * Copyright (c) 2007 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_Types.h - OpenMax IL version 1.1.1
+ * The OMX_Types header file contains the primitive type definitions used by
+ * the core, the application and the component. This file may need to be
+ * modified to be used on systems that do not have "char" set to 8 bits,
+ * "short" set to 16 bits and "long" set to 32 bits.
+ */
+
+#ifndef OMX_Types_h
+#define OMX_Types_h
+
+#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 _WIN32
+# ifdef __OMX_EXPORTS
+# define OMX_API __declspec(dllexport)
+# else
+# define OMX_API __declspec(dllimport)
+# endif
+#else
+# ifdef __OMX_EXPORTS
+# define OMX_API
+# else
+# define OMX_API extern
+# endif
+#endif
+
+#ifdef __SYMBIAN32__
+# ifdef __OMX_EXPORTS
+# define OMX_API EXPORT_C
+# else
+# define OMX_API IMPORT_C
+# endif
+#elif defined(_WIN32)
+# ifdef __OMX_EXPORTS
+# define OMX_API __declspec(dllexport)
+# else
+# define OMX_API __declspec(dllimport)
+# endif
+#else
+# ifdef __OMX_EXPORTS
+# define OMX_API
+# else
+# define OMX_API extern
+# 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 unsigned long OMX_U32;
+
+/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
+typedef signed long 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;
+
+/** 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;
+
+/** 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 or unsigned
+ */
+typedef enum OMX_NUMERICALDATATYPE
+{
+ OMX_NumericalDataSigned, /**< signed data */
+ OMX_NumericalDataUnsigned, /**< unsigned 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 void* 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 void* 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 void* 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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Video.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Video.h new file mode 100644 index 0000000..21ce5be --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/headers/OMX_Video.h @@ -0,0 +1,1025 @@ +/**
+ * Copyright (c) 2007 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.1
+ * 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_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_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
+ */
+typedef struct OMX_VIDEO_PARAM_BITRATETYPE {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+ OMX_VIDEO_CONTROLRATETYPE eControlRate;
+ OMX_U32 nTargetBitrate;
+} 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_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_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_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_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_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_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_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_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 */
+ OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */
+ OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */
+ OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */
+ 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_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_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_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_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_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_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/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.c new file mode 100644 index 0000000..7179fd0 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.c @@ -0,0 +1,291 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <gst/gst.h> +#include <gst/video/video.h> +#include <gst/base/gstbasetransform.h> + + +#include "swcsc.h" + +GST_DEBUG_CATEGORY_STATIC (gst_swcsc_debug); +#define GST_CAT_DEFAULT gst_swcsc_debug + +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS + ( GST_VIDEO_CAPS_YUV("NV12")) +); + +static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS + ( GST_VIDEO_CAPS_YUV("I420")) +); + +static GstElementClass *parent_class = NULL; + +static void + gst_swcsc_base_init(gpointer g_class); +static void + gst_swcsc_class_init(GstSwcscClass *g_class); +static void + gst_swcsc_init(GstSwcsc *object); +static gboolean gst_swcsc_exit_colorspace(GstSwcsc *swcsc); +static void gst_swcsc_fixate_caps (GstBaseTransform *trans, + GstPadDirection direction, GstCaps *caps, GstCaps *othercaps); +static gboolean gst_swcsc_set_caps (GstBaseTransform *trans, + GstCaps *in, GstCaps *out); +static GstCaps * gst_swcsc_transform_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps); +static GstFlowReturn gst_swcsc_transform (GstBaseTransform *trans, + GstBuffer *inBuf, GstBuffer *outBuf); + +static void gst_swcsc_init (GstSwcsc + *swcsc) +{ + gst_base_transform_set_qos_enabled (GST_BASE_TRANSFORM(swcsc), + TRUE); +} + +GType gst_swcsc_get_type(void) +{ + static GType object_type = 0; + + if (G_UNLIKELY(object_type == 0)) { + static const GTypeInfo object_info = { + sizeof(GstSwcscClass), + gst_swcsc_base_init, + NULL, + (GClassInitFunc) gst_swcsc_class_init, + NULL, + NULL, + sizeof(GstSwcsc), + 0, + (GInstanceInitFunc) gst_swcsc_init + }; + + object_type = g_type_register_static(GST_TYPE_BASE_TRANSFORM, + "GstSwcsc", &object_info, + (GTypeFlags)0); + + /* Initialize GST_LOG for this object */ + GST_DEBUG_CATEGORY_INIT(gst_swcsc_debug, + "swcsc", 0, " Image colorspace"); + + GST_LOG("initialized get_type\n"); + } + + return object_type; +}; + +static void gst_swcsc_base_init(gpointer gclass) +{ + static GstElementDetails element_details = { + " Image colorconversion", + "Filter/Conversion", + "SW based color conversion ", + "Brijesh Singh; Texas Instruments, Inc." + }; + + GstElementClass *element_class = GST_ELEMENT_CLASS(gclass); + + gst_element_class_add_pad_template(element_class, + gst_static_pad_template_get (&src_factory)); + gst_element_class_add_pad_template(element_class, + gst_static_pad_template_get (&sink_factory)); + gst_element_class_set_details(element_class, &element_details); +} + +static gboolean +gst_transform_event (GstBaseTransform * trans, GstEvent * event) +{ + GstSwcsc *self = GST_SWCSC (trans); + + GST_DEBUG_OBJECT (self, "event %" GST_PTR_FORMAT, event); + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_CROP: + gst_event_parse_crop (event, &self->crop_top, &self->crop_left, + &self->crop_width, &self->crop_height); + default: + break; + } + + /* forward all events */ + return TRUE; +} + +static void gst_swcsc_class_init(GstSwcscClass + *klass) +{ + GObjectClass *gobject_class; + GstBaseTransformClass *trans_class; + + gobject_class = (GObjectClass*) klass; + trans_class = (GstBaseTransformClass *) klass; + + gobject_class->finalize = + (GObjectFinalizeFunc)gst_swcsc_exit_colorspace; + + trans_class->transform_caps = + GST_DEBUG_FUNCPTR(gst_swcsc_transform_caps); + trans_class->set_caps = + GST_DEBUG_FUNCPTR(gst_swcsc_set_caps); + trans_class->transform = + GST_DEBUG_FUNCPTR(gst_swcsc_transform); + trans_class->fixate_caps = + GST_DEBUG_FUNCPTR(gst_swcsc_fixate_caps); + trans_class->passthrough_on_same_caps = TRUE; + trans_class->event = + GST_DEBUG_FUNCPTR (gst_transform_event); + parent_class = g_type_class_peek_parent (klass); + + GST_LOG("initialized class init\n"); +} + +static void _convert_420psemi_to_420p (unsigned char * lBuffPtr, unsigned char * cBuffPtr, + unsigned int xoff, unsigned int yoff, unsigned int ref_width, unsigned int ref_height, unsigned int width, + unsigned int height, void *fieldBuf) +{ + + unsigned char *CbBuf, *CrBuf, *YBuf, *lumaAddr, *chromaAddr; + unsigned int pic_size, i, j; + + pic_size = width * height; + + lumaAddr = ( unsigned char *) ((unsigned int) lBuffPtr + (yoff * ref_width) + xoff); + chromaAddr = ( unsigned char *) ((unsigned int) cBuffPtr + ((yoff >> 1) * ref_width) + xoff); + YBuf = (unsigned char *) fieldBuf; + + for (i = 0; i < height; i++) { + memcpy(YBuf, lumaAddr, width); + YBuf += width; + lumaAddr += ref_width; + } + + CbBuf = (unsigned char *) ((unsigned int)fieldBuf + pic_size); + CrBuf = (unsigned char *) ((unsigned int)fieldBuf + pic_size + (pic_size >> 2)); + + for (i = 0; i < (height >> 1); i++) { + for (j = 0; j < (width >> 1); j++) { + CbBuf[j] = chromaAddr[(j * 2)]; + CrBuf[j] = chromaAddr[(j * 2) + 1]; + } + CbBuf += (width >> 1); + CrBuf += (width >> 1); + chromaAddr += ref_width; + } +} + +static void convert_420psemi_to_420p(unsigned char* buffer, int xoffset, int yoffset, int width, + int height, int size, unsigned char *output) +{ + int stride, ref_height; + unsigned char *cptr; + + stride = ((width + (2 * xoffset) + 127) & 0xFFFFFF80); + ref_height = height + (yoffset << 1); + + cptr = (unsigned char *) ((unsigned long) buffer + ((size / 3) << 1)); + _convert_420psemi_to_420p (buffer, cptr, xoffset, yoffset, stride, ref_height, width, height, output); +} + +static GstFlowReturn gst_swcsc_transform (GstBaseTransform *trans, + GstBuffer *src, GstBuffer *dst) +{ + GstSwcsc *self = GST_SWCSC (trans); + + GST_LOG("begin transform\n"); + + convert_420psemi_to_420p(GST_BUFFER_DATA(src), self->crop_left, self->crop_top, self->width, self->height, + GST_BUFFER_SIZE(src), GST_BUFFER_DATA(dst)); + + gst_buffer_set_data (dst, GST_BUFFER_DATA(dst), self->width * self->height * 1.5); + + GST_LOG("end transform\n"); + return GST_FLOW_OK; +} + +static GstCaps * gst_swcsc_transform_caps (GstBaseTransform + *trans, GstPadDirection direction, GstCaps *from) +{ + GstSwcsc *swcsc; + GstCaps *result; + GstPad *other; + const GstCaps *templ; + + GST_LOG("begin transform caps (%s)\n", + direction==GST_PAD_SRC ? "src" : "sink"); + + swcsc = GST_SWCSC(trans); + g_return_val_if_fail(from != NULL, NULL); + + other = (direction == GST_PAD_SINK) ? trans->srcpad : trans->sinkpad; + templ = gst_pad_get_pad_template_caps(other); + + result = gst_caps_copy(templ); + + + GST_LOG("returing cap %" GST_PTR_FORMAT, result); + GST_LOG("end transform caps\n"); + + return result; +} + +static gboolean gst_swcsc_set_caps (GstBaseTransform *trans, + GstCaps *in, GstCaps *out) +{ + GstSwcsc *self = GST_SWCSC(trans); + gboolean ret = TRUE; + GstVideoFormat in_format; + + GST_LOG("begin set caps\n"); + + gst_video_format_parse_caps (in, &in_format, &self->width, &self->height); + + GST_LOG("end set caps\n"); + return ret; +} + +static void gst_swcsc_fixate_caps (GstBaseTransform *trans, + GstPadDirection direction, GstCaps *caps, GstCaps *othercaps) +{ + GstStructure *outs; + gint width, height, framerateNum, framerateDen; + gboolean ret; + + g_return_if_fail(gst_caps_is_fixed(caps)); + + GST_LOG("begin fixating cap\n"); + + ret = gst_video_format_parse_caps(caps, NULL, &width, &height); + if (!ret) + return; + + ret = gst_video_parse_caps_framerate(caps, &framerateNum, &framerateDen); + if (!ret) + return; + + outs = gst_caps_get_structure(othercaps, 0); + gst_structure_fixate_field_nearest_int (outs, "width", width); + gst_structure_fixate_field_nearest_int (outs, "height", height); + gst_structure_fixate_field_nearest_fraction (outs, "framerate", + framerateNum, framerateDen); + + GST_LOG("end fixating cap\n"); +} + +static gboolean gst_swcsc_exit_colorspace(GstSwcsc *swcsc) +{ + GST_LOG("begin exit_video\n"); + + return TRUE; +} + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.h new file mode 100644 index 0000000..fc5b4c1 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/omx/swcsc.h @@ -0,0 +1,52 @@ + +#ifndef __GST_SWCSC_H__ +#define __GST_SWCSC_H__ + +#include <pthread.h> + +#include <gst/gst.h> +#include <gst/base/gstbasetransform.h> + +G_BEGIN_DECLS + +/* Standard macros for maniuplating TIC6xColorspace objects */ +#define GST_TYPE_SWCSC \ + (gst_swcsc_get_type()) +#define GST_SWCSC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SWCSC,GstSwcsc)) +#define GST_SWCSC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SWCSC,GstSwcscClass)) +#define GST_IS_SWCSC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SWCSC)) +#define GST_IS_SWCSC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SWCSC)) + +typedef struct _GstSwcsc GstSwcsc; +typedef struct _GstSwcscClass GstSwcscClass; + +/* _GstTISwcsc object */ +struct _GstSwcsc +{ + /* gStreamer infrastructure */ + GstBaseTransform element; + GstPad *sinkpad; + GstPad *srcpad; + + gint crop_left, crop_top, crop_width, crop_height; + gint width, height; + +}; + +/* _GstTISwcscClass object */ +struct _GstSwcscClass +{ + GstBaseTransformClass parent_class; +}; + +/* External function enclarations */ +GType gst_swcsc_get_type(void); + +G_END_DECLS + +#endif /* __GST_SWCSC_H__ */ + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave-libtool.in b/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave-libtool.in new file mode 100644 index 0000000..1f3a720 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave-libtool.in @@ -0,0 +1,69 @@ +#!/bin/sh + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the real libtool to use +LIBTOOL="$1" +shift + +# if 1, don't print anything, the underlaying wrapper will do it +pass_though=0 + +# scan the arguments, keep the right ones for libtool, and discover the mode +preserved_args= +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + preserved_args="$preserved_args $opt" + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args $opt" + ;; + esac +done + +case "$mode" in +compile) + # shave will be called and print the actual CC/CXX/LINK line + preserved_args="$preserved_args --shave-mode=$mode" + pass_though=1 + ;; +link) + preserved_args="$preserved_args --shave-mode=$mode" + Q=" LINK " + ;; +*) + # let's u + # echo "*** libtool: Unimplemented mode: $mode, fill a bug report" + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +if test -z $V; then + if test $pass_though -eq 0; then + echo "$Q$output" + fi + $LIBTOOL --silent $preserved_args +else + echo $LIBTOOL $preserved_args + $LIBTOOL $preserved_args +fi diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave.in b/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave.in new file mode 100644 index 0000000..5c16f27 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/shave.in @@ -0,0 +1,79 @@ +#!/bin/sh + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the tool to wrap (cc, cxx, ar, ranlib, ..) +tool="$1" +shift + +# the reel tool (to call) +REEL_TOOL="$1" +shift + +pass_through=0 +preserved_args= +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --shave-mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args $opt" + ;; + esac +done + +# mode=link is handled in the libtool wrapper +case "$mode,$tool" in +link,*) + pass_through=1 + ;; +*,cxx) + Q=" CXX " + ;; +*,cc) + Q=" CC " + ;; +*,fc) + Q=" FC " + ;; +*,f77) + Q=" F77 " + ;; +*,objc) + Q=" OBJC " + ;; +*,*) + # should not happen + Q=" CC " + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +if test -z $V; then + if test $pass_through -eq 0; then + echo "$Q$output" + fi + $REEL_TOOL $preserved_args +else + echo $REEL_TOOL $preserved_args + $REEL_TOOL $preserved_args +fi diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/.gitignore b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/.gitignore new file mode 100644 index 0000000..2a2e8e4 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/.gitignore @@ -0,0 +1,5 @@ +check_async_queue +check_gstomx +check_libomxil +standalone/libomxil-foo.so +test-registry.reg diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/Makefile.am b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/Makefile.am new file mode 100644 index 0000000..41057c6 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/Makefile.am @@ -0,0 +1,28 @@ +SUBDIRS = standalone + +TESTS = check_async_queue \ + check_libomxil \ + check_gstomx + +CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg + +TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \ + LD_LIBRARY_PATH=$(builddir)/standalone \ + GST_PLUGIN_PATH=$(top_builddir)/omx + +check_PROGRAMS = + +check_PROGRAMS += check_async_queue +check_async_queue_SOURCES = check_async_queue.c +check_async_queue_CFLAGS = $(CHECK_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir)/util +check_async_queue_LDADD = $(CHECK_LIBS) $(GTHREAD_LIBS) $(top_builddir)/util/libutil.la + +check_PROGRAMS += check_libomxil +check_libomxil_SOURCES = check_libomxil.c +check_libomxil_CFLAGS = $(CHECK_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir)/omx/headers +check_libomxil_LDADD = $(CHECK_LIBS) $(GTHREAD_LIBS) -ldl + +check_PROGRAMS += check_gstomx +check_gstomx_SOURCES = check_gstomx.c +check_gstomx_CFLAGS = $(GST_CHECK_CFLAGS) +check_gstomx_LDADD = $(GST_CHECK_LIBS) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/cameratest.py b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/cameratest.py new file mode 100644 index 0000000..20abc50 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/cameratest.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- Mode: Python -*- +# vi:si:et:sw=4:sts=4:ts=4 +# ChangeLog: +# 2008-02-20 - Initial Version + + +import os +import gc +import sys +import time +import threading + +import gobject + +import gst +import gst.interfaces + +loop = gobject.MainLoop() + + +# TODO add vidbin for video capture later +pipeline = gst.parse_launch(''' +omx_camera name=cam vstab=false vnf=off output-buffers=6 image-output-buffers=1 + cam.src ! ( queue ! video/x-raw-yuv-strided, format=(fourcc)UYVY, width=640, height=480, framerate=30/1, buffer-count-requested=6 ! v4l2sink sync=false ) + cam.imgsrc ! ( name=imgbin queue ! image/jpeg, width=640, height=480 ! multifilesink location=test_imagecapture_%02d.jpg ) +''') + +i = 0 +def on_timeout(): + global i + if i == 0: + print "switching to image mode" + cam.set_property('mode', 'image') + pipeline.add(imgbin) + #cam.link_pads('imgsrc', imgbin, None) + gobject.timeout_add(10000, on_timeout) + elif i == 1: + print "switching to preview mode" + cam.set_property('mode', 'preview') + gobject.timeout_add(10000, on_timeout) + elif i == 2: + print "finishing up" + pipeline.set_state(gst.STATE_NULL) + i = i + 1 + return False + + +def on_message(bus, message): + global pipeline + t = message.type + if t == gst.MESSAGE_ERROR: + err, debug = message.parse_error() + print "Error: %s" % err, debug + elif t == gst.MESSAGE_EOS: + print "eos" + elif t == gst.MESSAGE_STATE_CHANGED: + oldstate, newstate, pending = message.parse_state_changed() + elem = message.src + print "State Changed: %s: %s --> %s" % (elem, oldstate.value_name, newstate.value_name) + if elem == pipeline: + if newstate == gst.STATE_PLAYING: + print "State Change complete.. triggering next step" + gobject.timeout_add(10000, on_timeout) + + +bus = pipeline.get_bus() +bus.enable_sync_message_emission() +bus.add_signal_watch() +bus.connect('message', on_message) + + +cam = None +imgbin = None +vidbin = None + +for elem in pipeline: + name = elem.get_name() + if name.startswith('cam'): + cam = elem + elif name.startswith('imgbin'): + imgbin = elem + elif name.startswith('vidbin'): + vidbin = elem + +cam.set_property('mode', 'preview') +pipeline.remove(imgbin) + +print "setting state to playing" +ret = pipeline.set_state(gst.STATE_PLAYING) +print "setting pipeline to PLAYING: %s" % ret.value_name + +ret = imgbin.set_state(gst.STATE_PLAYING) +print "setting imgbin to PLAYING: %s" % ret.value_name + +loop.run() + diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_async_queue.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_async_queue.c new file mode 100644 index 0000000..60c6526 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_async_queue.c @@ -0,0 +1,419 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <check.h> +#include "async_queue.h" +#include "sem.h" + +#define PROCESS_COUNT 0x1000 +#define DISABLE_AT PROCESS_COUNT / 2 + +typedef struct CustomData CustomData; + +struct CustomData +{ + AsyncQueue *queue; + GSem *push_sem; + GSem *pop_sem; + gboolean done; +}; + +static CustomData * +custom_data_new (void) +{ + CustomData *custom_data; + custom_data = g_new0 (CustomData, 1); + custom_data->queue = async_queue_new (); + custom_data->push_sem = g_sem_new (); + custom_data->pop_sem = g_sem_new (); + return custom_data; +} + +static void +custom_data_free (CustomData *custom_data) +{ + g_sem_free (custom_data->pop_sem); + g_sem_free (custom_data->push_sem); + async_queue_free (custom_data->queue); + g_free (custom_data); +} + +START_TEST (test_async_queue_create) +{ + AsyncQueue *queue; + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + async_queue_free (queue); +} +END_TEST + +START_TEST (test_async_queue_pop) +{ + AsyncQueue *queue; + gpointer foo; + gpointer tmp; + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + foo = GINT_TO_POINTER (1); + async_queue_push (queue, foo); + tmp = async_queue_pop (queue); + fail_if (tmp != foo, + "Pop failed"); + async_queue_free (queue); +} +END_TEST + +START_TEST (test_async_queue_process) +{ + AsyncQueue *queue; + gpointer foo; + guint i; + + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + + foo = GINT_TO_POINTER (1); + for (i = 0; i < PROCESS_COUNT; i++, foo++) + { + async_queue_push (queue, foo); + } + foo = GINT_TO_POINTER (1); + for (i = 0; i < PROCESS_COUNT; i++, foo++) + { + gpointer tmp; + tmp = async_queue_pop (queue); + fail_if (tmp != foo, + "Pop failed"); + } + + async_queue_free (queue); +} +END_TEST + +static gpointer +push_func (gpointer data) +{ + AsyncQueue *queue; + gpointer foo; + guint i; + + queue = data; + foo = GINT_TO_POINTER (1); + for (i = 0; i < PROCESS_COUNT; i++, foo++) + { + async_queue_push (queue, foo); + } + + return NULL; +} + +static gpointer +pop_func (gpointer data) +{ + AsyncQueue *queue; + gpointer foo; + guint i; + + queue = data; + foo = GINT_TO_POINTER (1); + for (i = 0; i < PROCESS_COUNT; i++, foo++) + { + gpointer tmp; + tmp = async_queue_pop (queue); + fail_if (tmp != foo, + "Pop failed"); + } + + return NULL; +} + +START_TEST (test_async_queue_threads) +{ + AsyncQueue *queue; + GThread *push_thread; + GThread *pop_thread; + + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + + pop_thread = g_thread_create (pop_func, queue, TRUE, NULL); + push_thread = g_thread_create (push_func, queue, TRUE, NULL); + + g_thread_join (pop_thread); + g_thread_join (push_thread); + + async_queue_free (queue); +} +END_TEST + +static gpointer +push_and_disable_func (gpointer data) +{ + AsyncQueue *queue; + gpointer foo; + guint i; + + queue = data; + foo = GINT_TO_POINTER (1); + for (i = 0; i < DISABLE_AT; i++, foo++) + { + async_queue_push (queue, foo); + } + + async_queue_disable (queue); + + return NULL; +} + +static gpointer +pop_with_disable_func (gpointer data) +{ + AsyncQueue *queue; + gpointer foo; + guint i; + guint count = 0; + + queue = data; + foo = GINT_TO_POINTER (1); + for (i = 0; i < PROCESS_COUNT; i++, foo++) + { + gpointer tmp; + tmp = async_queue_pop (queue); + if (!tmp) + continue; + count++; + fail_if (tmp != foo, + "Pop failed"); + } + + return GINT_TO_POINTER (count); +} + +static gpointer +pop_stress (gpointer data) +{ + CustomData *custom_data; + AsyncQueue *queue; + guint i, j; + + custom_data = data; + queue = custom_data->queue; + while (!custom_data->done) + { + for (i = 0; i < 10; i++) + { + gpointer tmp; + tmp = async_queue_pop (queue); + if (!tmp) + break; + } + + g_sem_up (custom_data->pop_sem); + g_sem_down (custom_data->push_sem); + } + + return NULL; +} + +static gpointer +push_stress (gpointer data) +{ + CustomData *custom_data; + AsyncQueue *queue; + gpointer foo; + guint i, j; + + custom_data = data; + queue = custom_data->queue; + foo = GINT_TO_POINTER (1); + for (j = 0; j < 10; j++) + { + for (i = 0; i < 10; i++, foo++) + { + async_queue_push (queue, foo); + } + + async_queue_disable (queue); + + g_sem_down (custom_data->pop_sem); + +#if 0 + if (queue->length) + g_debug ("flusihng %i elements", queue->length); +#endif + + async_queue_flush (queue); + + async_queue_enable (queue); + + g_sem_up (custom_data->push_sem); + } + + custom_data->done = TRUE; + async_queue_disable (queue); + g_sem_up (custom_data->push_sem); + + return NULL; +} + +START_TEST (test_async_queue_disable_simple) +{ + AsyncQueue *queue; + GThread *pop_thread; + guint count; + + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + + pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL); + + async_queue_disable (queue); + + count = GPOINTER_TO_INT (g_thread_join (pop_thread)); + + fail_if (count != 0, + "Disable failed"); + + async_queue_free (queue); +} +END_TEST + +START_TEST (test_async_queue_disable) +{ + AsyncQueue *queue; + GThread *push_thread; + GThread *pop_thread; + guint count; + + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + + pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL); + push_thread = g_thread_create (push_and_disable_func, queue, TRUE, NULL); + + count = GPOINTER_TO_INT (g_thread_join (pop_thread)); + g_thread_join (push_thread); + + fail_if (count > DISABLE_AT, + "Disable failed"); + + async_queue_free (queue); +} +END_TEST + +START_TEST (test_async_queue_enable) +{ + AsyncQueue *queue; + GThread *push_thread; + GThread *pop_thread; + guint count; + + queue = async_queue_new (); + fail_if (!queue, + "Construction failed"); + + pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL); + + async_queue_disable (queue); + + count = GPOINTER_TO_INT (g_thread_join (pop_thread)); + + fail_if (count != 0, + "Disable failed"); + + async_queue_enable (queue); + + pop_thread = g_thread_create (pop_with_disable_func, queue, TRUE, NULL); + push_thread = g_thread_create (push_and_disable_func, queue, TRUE, NULL); + + count = GPOINTER_TO_INT (g_thread_join (pop_thread)); + g_thread_join (push_thread); + + fail_if (count > DISABLE_AT, + "Disable failed"); + + async_queue_free (queue); +} +END_TEST + +START_TEST (test_async_queue_stress) +{ + GThread *push_thread; + GThread *pop_thread; + guint count; + CustomData *custom_data; + + custom_data = custom_data_new (); + + pop_thread = g_thread_create (pop_stress, custom_data, TRUE, NULL); + push_thread = g_thread_create (push_stress, custom_data, TRUE, NULL); + + g_thread_join (pop_thread); + g_thread_join (push_thread); + + custom_data_free (custom_data); +} +END_TEST + +Suite * +util_suite (void) +{ + Suite *s = suite_create ("util"); + + if (!g_thread_supported ()) + g_thread_init (NULL); + + /* Core test case */ + TCase *tc_core = tcase_create ("Core"); + tcase_add_test (tc_core, test_async_queue_create); + tcase_add_test (tc_core, test_async_queue_pop); + tcase_add_test (tc_core, test_async_queue_process); + tcase_add_test (tc_core, test_async_queue_threads); + tcase_add_test (tc_core, test_async_queue_disable_simple); + tcase_add_test (tc_core, test_async_queue_disable); + tcase_add_test (tc_core, test_async_queue_enable); + tcase_add_test (tc_core, test_async_queue_stress); + suite_add_tcase (s, tc_core); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s; + SRunner *sr; + + s = util_suite (); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + + return (number_failed == 0) ? 0 : 1; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_gstomx.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_gstomx.c new file mode 100644 index 0000000..366396c --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_gstomx.c @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2007-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <gst/check/gstcheck.h> + +#define BUFFER_SIZE 0x1000 +#define BUFFER_COUNT 0x100 +#define FLUSH_AT 0x10 + +static gboolean +bus_cb (GstBus *bus, + GstMessage *msg, + gpointer data) +{ + switch (GST_MESSAGE_TYPE (msg)) + { + case GST_MESSAGE_EOS: + /* g_debug ("end-of-stream"); */ + break; + case GST_MESSAGE_ERROR: + { + gchar *debug; + GError *err; + + gst_message_parse_error (msg, &err, &debug); + g_free (debug); + + g_warning ("Error: %s", err->message); + g_error_free (err); + break; + } + default: + /* g_debug ("message-type: %s", GST_MESSAGE_TYPE_NAME (msg)); */ + break; + } + + return TRUE; +} + +static GstStaticPadTemplate sinktemplate = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +/* some global vars, makes it easy as for the ones above */ +static GMutex *eos_mutex; +static GCond *eos_cond; +static gboolean eos_arrived; + +gboolean +test_sink_event (GstPad * pad, GstEvent * event) +{ + + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_EOS: + g_mutex_lock (eos_mutex); + eos_arrived = TRUE; + g_cond_signal (eos_cond); + g_mutex_unlock (eos_mutex); + break; + default: + break; + } + + return gst_pad_event_default (pad, event); +} + +static void +helper (gboolean flush) +{ + GstElement *filter; + GstBus *bus; + GstPad *mysrcpad; + GstPad *mysinkpad; + + /* init */ + filter = gst_check_setup_element ("omx_dummy"); + mysrcpad = gst_check_setup_src_pad (filter, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (filter, &sinktemplate, NULL); + + gst_pad_set_active (mysrcpad, TRUE); + gst_pad_set_active (mysinkpad, TRUE); + + /* need to know when we are eos */ + gst_pad_set_event_function (mysinkpad, test_sink_event); + + /* and notify the test run */ + eos_mutex = g_mutex_new (); + eos_cond = g_cond_new (); + eos_arrived = FALSE; + + g_object_set (G_OBJECT (filter), "library-name", "libomxil-foo.so", NULL); + + /* start */ + + fail_unless_equals_int (gst_element_set_state (filter, GST_STATE_PLAYING), + GST_STATE_CHANGE_SUCCESS); + + bus = gst_bus_new (); + + gst_element_set_bus (filter, bus); + + /* send buffers in order*/ + { + guint i; + for (i = 0; i < BUFFER_COUNT; i++) + { + GstBuffer *inbuffer; + inbuffer = gst_buffer_new_and_alloc (BUFFER_SIZE); + GST_BUFFER_DATA(inbuffer)[0] = i; + ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); + + fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); + + if (flush && i % FLUSH_AT == 0) + { + gst_pad_push_event (mysrcpad, gst_event_new_flush_start ()); + gst_pad_push_event (mysrcpad, gst_event_new_flush_stop ()); + i += FLUSH_AT; + } + } + } + + { + GstMessage *message; + fail_if ((message = gst_bus_pop (bus)) != NULL); + + /* make sure there's no error on the bus */ + message = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0); + fail_if (message); + } + + gst_pad_push_event (mysrcpad, gst_event_new_eos ()); + /* need to wait a bit to make sure src pad task digested all and sent eos */ + g_mutex_lock (eos_mutex); + while (!eos_arrived) + g_cond_wait (eos_cond, eos_mutex); + g_mutex_unlock (eos_mutex); + + /* check the order of the buffers*/ + if (!flush) + { + GList *cur; + guint i; + for (cur = buffers, i = 0; cur; cur = g_list_next (cur), i++) + { + GstBuffer *buffer; + buffer = cur->data; + fail_unless (GST_BUFFER_DATA(buffer)[0] == i); + } + fail_unless (i == BUFFER_COUNT); + } + + /* cleanup */ + gst_bus_set_flushing (bus, TRUE); + gst_element_set_bus (filter, NULL); + gst_object_unref (GST_OBJECT (bus)); + gst_check_drop_buffers (); + + /* deinit */ + gst_element_set_state (filter, GST_STATE_NULL); + + gst_pad_set_active (mysrcpad, FALSE); + gst_pad_set_active (mysinkpad, FALSE); + gst_check_teardown_src_pad (filter); + gst_check_teardown_sink_pad (filter); + gst_check_teardown_element (filter); + + g_mutex_free (eos_mutex); + g_cond_free (eos_cond); +} + +GST_START_TEST (test_flush) +{ + helper (TRUE); +} +GST_END_TEST + +GST_START_TEST (test_basic) +{ + helper (FALSE); +} +GST_END_TEST + +static Suite * +gstomx_suite (void) +{ + Suite *s = suite_create ("gstomx"); + TCase *tc_chain = tcase_create ("general"); + + tcase_set_timeout (tc_chain, 10); + tcase_add_test (tc_chain, test_basic); + tcase_add_test (tc_chain, test_flush); + suite_add_tcase (s, tc_chain); + + return s; +} + +GST_CHECK_MAIN (gstomx); diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_libomxil.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_libomxil.c new file mode 100644 index 0000000..9c6550b --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/check_libomxil.c @@ -0,0 +1,250 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <check.h> +#include <OMX_Core.h> +#include <OMX_Component.h> + +#include <glib.h> +#include <dlfcn.h> + +static const char *lib_name; +static void *dl_handle; +static OMX_ERRORTYPE (*init) (void); +static OMX_ERRORTYPE (*deinit) (void); +static OMX_ERRORTYPE (*get_handle) (OMX_HANDLETYPE *handle, + OMX_STRING name, + OMX_PTR data, + OMX_CALLBACKTYPE *callbacks); +static OMX_ERRORTYPE (*free_handle) (OMX_HANDLETYPE handle); + +typedef struct CustomData CustomData; + +struct CustomData +{ + OMX_HANDLETYPE omx_handle; + OMX_STATETYPE omx_state; + GCond *omx_state_condition; + GMutex *omx_state_mutex; +}; + +static CustomData * +custom_data_new (void) +{ + CustomData *custom_data; + custom_data = g_new0 (CustomData, 1); + custom_data->omx_state_condition = g_cond_new (); + custom_data->omx_state_mutex = g_mutex_new (); + return custom_data; +} + +static void +custom_data_free (CustomData *custom_data) +{ + g_mutex_free (custom_data->omx_state_mutex); + g_cond_free (custom_data->omx_state_condition); + g_free (custom_data); +} + +static inline void +change_state (CustomData *core, + OMX_STATETYPE state) +{ + fail_if (OMX_SendCommand (core->omx_handle, OMX_CommandStateSet, state, NULL) != OMX_ErrorNone); +} + +static inline void +complete_change_state (CustomData *core, + OMX_STATETYPE state) +{ + g_mutex_lock (core->omx_state_mutex); + + core->omx_state = state; + g_cond_signal (core->omx_state_condition); + + g_mutex_unlock (core->omx_state_mutex); +} + +static inline void +wait_for_state (CustomData *core, + OMX_STATETYPE state) +{ + g_mutex_lock (core->omx_state_mutex); + + while (core->omx_state != state) + g_cond_wait (core->omx_state_condition, core->omx_state_mutex); + + g_mutex_unlock (core->omx_state_mutex); +} + +static OMX_ERRORTYPE +EventHandler (OMX_HANDLETYPE omx_handle, + OMX_PTR app_data, + OMX_EVENTTYPE event, + OMX_U32 data_1, + OMX_U32 data_2, + OMX_PTR event_data) +{ + CustomData *core; + + core = app_data; + + switch (event) + { + case OMX_EventCmdComplete: + { + OMX_COMMANDTYPE cmd; + + cmd = (OMX_COMMANDTYPE) data_1; + + switch (cmd) + { + case OMX_CommandStateSet: + complete_change_state (core, data_2); + break; + default: + break; + } + break; + } + default: + break; + } + + return OMX_ErrorNone; +} + +static OMX_CALLBACKTYPE callbacks = { EventHandler, NULL, NULL }; + +START_TEST (test_basic) +{ + OMX_ERRORTYPE omx_error; + omx_error = init (); + fail_if (omx_error != OMX_ErrorNone); + omx_error = deinit (); + fail_if (omx_error != OMX_ErrorNone); +} +END_TEST + +START_TEST (test_handle) +{ + OMX_ERRORTYPE omx_error; + OMX_HANDLETYPE omx_handle; + + omx_error = init (); + fail_if (omx_error != OMX_ErrorNone); + + omx_error = get_handle (&omx_handle, "OMX.check.dummy", NULL, NULL); + fail_if (omx_error != OMX_ErrorNone); + + omx_error = free_handle (omx_handle); + fail_if (omx_error != OMX_ErrorNone); + + omx_error = deinit (); + fail_if (omx_error != OMX_ErrorNone); +} +END_TEST + +START_TEST (test_idle) +{ + CustomData *custom_data; + OMX_ERRORTYPE omx_error; + OMX_HANDLETYPE omx_handle; + + custom_data = custom_data_new (); + + omx_error = init (); + fail_if (omx_error != OMX_ErrorNone); + + omx_error = get_handle (&omx_handle, "OMX.check.dummy", custom_data, &callbacks); + fail_if (omx_error != OMX_ErrorNone); + + custom_data->omx_handle = omx_handle; + + change_state (custom_data, OMX_StateIdle); + + /* allocate_buffers */ + + wait_for_state (custom_data, OMX_StateIdle); + + change_state (custom_data, OMX_StateLoaded); + + /* free_buffers */ + + wait_for_state (custom_data, OMX_StateLoaded); + + omx_error = free_handle (omx_handle); + fail_if (omx_error != OMX_ErrorNone); + + omx_error = deinit (); + fail_if (omx_error != OMX_ErrorNone); + + custom_data_free (custom_data); +} +END_TEST + +static Suite * +util_suite (void) +{ + Suite *s = suite_create ("libomxil"); + TCase *tc_chain = tcase_create ("general"); + + lib_name = "libomxil-foo.so"; + + if (!g_thread_supported ()) + g_thread_init (NULL); + + { + dl_handle = dlopen (lib_name, RTLD_LAZY); + if (!dl_handle) + { + /** @todo report error. */ + } + + init = dlsym (dl_handle, "OMX_Init"); + deinit = dlsym (dl_handle, "OMX_Deinit"); + get_handle = dlsym (dl_handle, "OMX_GetHandle"); + free_handle = dlsym (dl_handle, "OMX_FreeHandle"); + } + + tcase_add_test (tc_chain, test_basic); + tcase_add_test (tc_chain, test_handle); + tcase_add_test (tc_chain, test_idle); + suite_add_tcase (s, tc_chain); + + return s; +} + +int +main (void) +{ + int number_failed; + Suite *s; + SRunner *sr; + + s = util_suite (); + sr = srunner_create (s); + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + + return (number_failed == 0) ? 0 : 1; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/standalone/core.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/standalone/core.c new file mode 100644 index 0000000..bfc340d --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/tests/standalone/core.c @@ -0,0 +1,401 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <OMX_Core.h> +#include <OMX_Component.h> + +#include <glib.h> + +#include <stdlib.h> /* For calloc, free */ +#include <string.h> /* For memcpy */ + +#include "async_queue.h" + +static void *foo_thread (void *cb_data); + +OMX_ERRORTYPE +OMX_Init (void) +{ + if (!g_thread_supported ()) + { + g_thread_init (NULL); + } + + return OMX_ErrorNone; +} + +OMX_ERRORTYPE +OMX_Deinit (void) +{ + return OMX_ErrorNone; +} + +typedef struct CompPrivate CompPrivate; +typedef struct CompPrivatePort CompPrivatePort; + +struct CompPrivate +{ + OMX_STATETYPE state; + OMX_CALLBACKTYPE *callbacks; + OMX_PTR app_data; + CompPrivatePort *ports; + gboolean done; + GMutex *flush_mutex; +}; + +struct CompPrivatePort +{ + OMX_PARAM_PORTDEFINITIONTYPE port_def; + AsyncQueue *queue; +}; + +static OMX_ERRORTYPE +comp_GetState (OMX_HANDLETYPE handle, + OMX_STATETYPE *state) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("GetState\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + *state = private->state; + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_GetParameter (OMX_HANDLETYPE handle, + OMX_INDEXTYPE index, + OMX_PTR param) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("GetParameter\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + switch (index) + { + case OMX_IndexParamPortDefinition: + { + OMX_PARAM_PORTDEFINITIONTYPE *port_def; + port_def = param; + memcpy (port_def, &private->ports[port_def->nPortIndex].port_def, port_def->nSize); + break; + } + default: + break; + } + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_SetParameter (OMX_HANDLETYPE handle, + OMX_INDEXTYPE index, + OMX_PTR param) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("SetParameter\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + switch (index) + { + case OMX_IndexParamPortDefinition: + { + OMX_PARAM_PORTDEFINITIONTYPE *port_def; + port_def = param; + memcpy (&private->ports[port_def->nPortIndex].port_def, port_def, port_def->nSize); + break; + } + default: + break; + } + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_SendCommand (OMX_HANDLETYPE handle, + OMX_COMMANDTYPE command, + OMX_U32 param_1, + OMX_PTR data) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("SendCommand\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + switch (command) + { + case OMX_CommandStateSet: + { + if (private->state == OMX_StateLoaded && param_1 == OMX_StateIdle) + { + g_thread_create (foo_thread, comp, TRUE, NULL); + } + private->state = param_1; + private->callbacks->EventHandler (handle, + private->app_data, OMX_EventCmdComplete, + OMX_CommandStateSet, private->state, data); + } + break; + case OMX_CommandFlush: + { + g_mutex_lock (private->flush_mutex); + { + OMX_BUFFERHEADERTYPE *buffer; + + while (buffer = async_queue_pop_full (private->ports[0].queue, FALSE, TRUE)) + { + private->callbacks->EmptyBufferDone (comp, + private->app_data, buffer); + } + + while (buffer = async_queue_pop_full (private->ports[1].queue, FALSE, TRUE)) + { + private->callbacks->FillBufferDone (comp, + private->app_data, buffer); + } + } + g_mutex_unlock (private->flush_mutex); + + private->callbacks->EventHandler (handle, + private->app_data, OMX_EventCmdComplete, + OMX_CommandFlush, param_1, data); + } + break; + default: + /* printf ("command: %d\n", command); */ + break; + } + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_UseBuffer (OMX_HANDLETYPE handle, + OMX_BUFFERHEADERTYPE **buffer_header, + OMX_U32 index, + OMX_PTR data, + OMX_U32 size, + OMX_U8 *buffer) +{ + OMX_BUFFERHEADERTYPE *new; + + new = calloc (1, sizeof (OMX_BUFFERHEADERTYPE)); + new->nSize = sizeof (OMX_BUFFERHEADERTYPE); + new->nVersion.nVersion = 1; + new->pBuffer = buffer; + new->nAllocLen = size; + + switch (index) + { + case 0: new->nInputPortIndex = 0; break; + case 1: new->nOutputPortIndex = 1; break; + default: break; + } + + *buffer_header = new; + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_FreeBuffer (OMX_HANDLETYPE handle, + OMX_U32 index, + OMX_BUFFERHEADERTYPE *buffer_header) +{ + free (buffer_header); + + return OMX_ErrorNone; +} + +static gpointer +foo_thread (gpointer cb_data) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + comp = cb_data; + private = comp->pComponentPrivate; + + while (!private->done) + { + OMX_BUFFERHEADERTYPE *in_buffer; + OMX_BUFFERHEADERTYPE *out_buffer; + + in_buffer = async_queue_pop (private->ports[0].queue); + if (!in_buffer) continue; + + out_buffer = async_queue_pop (private->ports[1].queue); + if (!out_buffer) continue; + + /* process buffers */ + { + unsigned long size; + size = MIN (in_buffer->nFilledLen, out_buffer->nAllocLen); + memcpy (out_buffer->pBuffer, in_buffer->pBuffer, size); + out_buffer->nFilledLen = size; + in_buffer->nFilledLen -= size; + out_buffer->nTimeStamp = in_buffer->nTimeStamp; + out_buffer->nFlags = in_buffer->nFlags; + } + + g_mutex_lock (private->flush_mutex); + + private->callbacks->FillBufferDone (comp, + private->app_data, out_buffer); + if (in_buffer->nFilledLen == 0) + { + private->callbacks->EmptyBufferDone (comp, + private->app_data, in_buffer); + } + + g_mutex_unlock (private->flush_mutex); + } + + return NULL; +} + +static OMX_ERRORTYPE +comp_EmptyThisBuffer (OMX_HANDLETYPE handle, + OMX_BUFFERHEADERTYPE *buffer_header) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("EmptyThisBuffer\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + async_queue_push (private->ports[0].queue, buffer_header); + + return OMX_ErrorNone; +} + +static OMX_ERRORTYPE +comp_FillThisBuffer (OMX_HANDLETYPE handle, + OMX_BUFFERHEADERTYPE *buffer_header) +{ + OMX_COMPONENTTYPE *comp; + CompPrivate *private; + + /* printf ("FillThisBuffer\n"); */ + + comp = handle; + private = comp->pComponentPrivate; + + async_queue_push (private->ports[1].queue, buffer_header); + + return OMX_ErrorNone; +} + +OMX_ERRORTYPE +OMX_GetHandle (OMX_HANDLETYPE *handle, + OMX_STRING component_name, + OMX_PTR data, + OMX_CALLBACKTYPE *callbacks) +{ + OMX_COMPONENTTYPE *comp; + + comp = calloc (1, sizeof (OMX_COMPONENTTYPE)); + comp->nSize = sizeof (OMX_COMPONENTTYPE); + comp->nVersion.nVersion = 1; + + comp->GetState = comp_GetState; + comp->GetParameter = comp_GetParameter; + comp->SetParameter = comp_SetParameter; + comp->SendCommand = comp_SendCommand; + comp->UseBuffer = comp_UseBuffer; + comp->FreeBuffer = comp_FreeBuffer; + comp->EmptyThisBuffer = comp_EmptyThisBuffer; + comp->FillThisBuffer = comp_FillThisBuffer; + + { + CompPrivate *private; + + private = calloc (1, sizeof (CompPrivate)); + private->state = OMX_StateLoaded; + private->callbacks = callbacks; + private->app_data = data; + private->ports = calloc (2, sizeof (CompPrivatePort)); + private->flush_mutex = g_mutex_new (); + + private->ports[0].queue = async_queue_new (); + private->ports[1].queue = async_queue_new (); + + { + OMX_PARAM_PORTDEFINITIONTYPE *port_def; + + port_def = &private->ports[0].port_def; + port_def->nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE); + port_def->nVersion.nVersion = 1; + port_def->nPortIndex = 0; + port_def->eDir = OMX_DirInput; + port_def->nBufferCountActual = 1; + port_def->nBufferCountMin = 1; + port_def->nBufferSize = 0x1000; + port_def->eDomain = OMX_PortDomainAudio; + + } + + { + OMX_PARAM_PORTDEFINITIONTYPE *port_def; + + port_def = &private->ports[1].port_def; + port_def->nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE); + port_def->nVersion.nVersion = 1; + port_def->nPortIndex = 1; + port_def->eDir = OMX_DirOutput; + port_def->nBufferCountActual = 1; + port_def->nBufferCountMin = 1; + port_def->nBufferSize = 0x1000; + port_def->eDomain = OMX_PortDomainAudio; + } + + comp->pComponentPrivate = private; + } + + *handle = comp; + + return OMX_ErrorNone; +} + +OMX_ERRORTYPE +OMX_FreeHandle (OMX_HANDLETYPE handle) +{ + /** @todo Free private structure? */ + return OMX_ErrorNone; +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/Makefile.am b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/Makefile.am new file mode 100644 index 0000000..fb6e0c3 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/Makefile.am @@ -0,0 +1,7 @@ +noinst_LTLIBRARIES = libutil.la + +libutil_la_SOURCES = async_queue.c async_queue.h \ + sem.c sem.h + +libutil_la_CFLAGS = $(GTHREAD_CFLAGS) +libutil_la_LIBADD = $(GTHREAD_LIBS) diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.c new file mode 100644 index 0000000..71b8695 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.c @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <glib.h> + +#include "async_queue.h" + +AsyncQueue * +async_queue_new (void) +{ + AsyncQueue *queue; + + queue = g_slice_new0 (AsyncQueue); + + queue->condition = g_cond_new (); + queue->mutex = g_mutex_new (); + queue->enabled = TRUE; + + return queue; +} + +void +async_queue_free (AsyncQueue *queue) +{ + g_cond_free (queue->condition); + g_mutex_free (queue->mutex); + + g_list_free (queue->head); + g_slice_free (AsyncQueue, queue); +} + +void +async_queue_push (AsyncQueue *queue, + gpointer data) +{ + g_mutex_lock (queue->mutex); + + queue->head = g_list_prepend (queue->head, data); + if (!queue->tail) + queue->tail = queue->head; + queue->length++; + + g_cond_signal (queue->condition); + + g_mutex_unlock (queue->mutex); +} + +gpointer +async_queue_pop_full (AsyncQueue *queue, gboolean wait, gboolean force) +{ + gpointer data = NULL; + + g_mutex_lock (queue->mutex); + + if (!force && !queue->enabled) + { + /* g_warning ("not enabled!"); */ + goto leave; + } + + if (wait && !queue->tail) + { + g_cond_wait (queue->condition, queue->mutex); + } + + if (queue->tail) + { + GList *node = queue->tail; + data = node->data; + + queue->tail = node->prev; + if (queue->tail) + queue->tail->next = NULL; + else + queue->head = NULL; + queue->length--; + g_list_free_1 (node); + } + +leave: + g_mutex_unlock (queue->mutex); + + return data; +} + +gpointer +async_queue_pop (AsyncQueue *queue) +{ + return async_queue_pop_full (queue, TRUE, FALSE); +} + +void +async_queue_disable (AsyncQueue *queue) +{ + g_mutex_lock (queue->mutex); + queue->enabled = FALSE; + g_cond_broadcast (queue->condition); + g_mutex_unlock (queue->mutex); +} + +void +async_queue_enable (AsyncQueue *queue) +{ + g_mutex_lock (queue->mutex); + queue->enabled = TRUE; + g_mutex_unlock (queue->mutex); +} + +void +async_queue_flush (AsyncQueue *queue) +{ + g_mutex_lock (queue->mutex); + g_list_free (queue->head); + queue->head = queue->tail = NULL; + queue->length = 0; + g_mutex_unlock (queue->mutex); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.h new file mode 100644 index 0000000..3fb9c09 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/async_queue.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef ASYNC_QUEUE_H +#define ASYNC_QUEUE_H + +#include <glib.h> + +typedef struct AsyncQueue AsyncQueue; + +struct AsyncQueue +{ + GMutex *mutex; + GCond *condition; + GList *head; + GList *tail; + guint length; + gboolean enabled; +}; + +AsyncQueue *async_queue_new (void); +void async_queue_free (AsyncQueue *queue); +void async_queue_push (AsyncQueue *queue, gpointer data); +gpointer async_queue_pop_full (AsyncQueue *queue, gboolean wait, gboolean force); +gpointer async_queue_pop (AsyncQueue *queue); +void async_queue_disable (AsyncQueue *queue); +void async_queue_enable (AsyncQueue *queue); +void async_queue_flush (AsyncQueue *queue); + +#endif /* ASYNC_QUEUE_H */ diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.c b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.c new file mode 100644 index 0000000..2ac6fac --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.c @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <glib.h> + +#include "sem.h" + +GSem * +g_sem_new (void) +{ + GSem *sem; + + sem = g_new (GSem, 1); + sem->condition = g_cond_new (); + sem->mutex = g_mutex_new (); + sem->counter = 0; + + return sem; +} + +void +g_sem_free (GSem *sem) +{ + g_cond_free (sem->condition); + g_mutex_free (sem->mutex); + g_free (sem); +} + +void +g_sem_down (GSem *sem) +{ + g_mutex_lock (sem->mutex); + + while (sem->counter == 0) + { + g_cond_wait (sem->condition, sem->mutex); + } + + sem->counter--; + + g_mutex_unlock (sem->mutex); +} + +void +g_sem_up (GSem *sem) +{ + g_mutex_lock (sem->mutex); + + sem->counter++; + g_cond_signal (sem->condition); + + g_mutex_unlock (sem->mutex); +} diff --git a/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.h b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.h new file mode 100644 index 0000000..7d8b342 --- /dev/null +++ b/gstreamer_ti_dm81xx/ti_build/gst-openmax/util/sem.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2008-2009 Nokia Corporation. + * + * Author: Felipe Contreras <felipe.contreras@nokia.com> + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef SEM_H +#define SEM_H + +#include <glib.h> + +typedef struct GSem GSem; + +struct GSem +{ + GCond *condition; + GMutex *mutex; + gint counter; +}; + +GSem *g_sem_new (void); +void g_sem_free (GSem *sem); +void g_sem_down (GSem *sem); +void g_sem_up (GSem *sem); + +#endif /* SEM_H */ |