[Buildroot] [PATCH 13/17] GStreamer Plugin (gstreamer-ti) for TI ARM/DSP processors
Pierre-Luc Simard
pierreluc.simard at admetric.ca
Fri Sep 17 17:59:58 UTC 2010
---
package/ti/Config.in | 1 +
package/ti/ti-gst-plugin/Config.in | 33 +
...-plugin-1.01.00-angstrom_combined_patches.patch | 2887 ++++++++++++++++++++
package/ti/ti-gst-plugin/ti-gst-plugin.mk | 87 +
4 files changed, 3008 insertions(+), 0 deletions(-)
create mode 100644 package/ti/ti-gst-plugin/Config.in
create mode 100644 package/ti/ti-gst-plugin/ti-gst-plugin-1.01.00-angstrom_combined_patches.patch
create mode 100644 package/ti/ti-gst-plugin/ti-gst-plugin.mk
diff --git a/package/ti/Config.in b/package/ti/Config.in
index d766e20..8e47e57 100644
--- a/package/ti/Config.in
+++ b/package/ti/Config.in
@@ -40,6 +40,7 @@ endchoice
comment "Target components"
source "package/ti/ti-codecs-omap3/Config.in"
source "package/ti/ti-dsplink/Config.in"
+source "package/ti/ti-gst-plugin/Config.in"
comment "Staging tools"
source "package/ti/ti-biosutils/Config.in"
diff --git a/package/ti/ti-gst-plugin/Config.in b/package/ti/ti-gst-plugin/Config.in
new file mode 100644
index 0000000..e92cc29
--- /dev/null
+++ b/package/ti/ti-gst-plugin/Config.in
@@ -0,0 +1,33 @@
+config BR2_PACKAGE_TI_GST_PLUGIN
+ bool "GStreamer Plugin"
+ depends on BR2_PACKAGE_TI_PLATFORM_omap3
+ select BR2_PACKAGE_TI_DMAI
+ select BR2_PACKAGE_TI_CODECS_OMAP3
+ select BR2_PACKAGE_GSTREAMER
+ select BR2_PACKAGE_GST_BASE
+ help
+ GStreamer Plugin (gstreamer-ti) for TI ARM/DSP processors
+ http://gstreamer.ti.com/
+
+config BR2_PACKAGE_TI_GST_PLUGIN
+ bool "GStreamer Plugin"
+ depends on BR2_PACKAGE_TI_PLATFORM_dm365
+ select BR2_PACKAGE_TI_DVSDK_DM365
+ select BR2_PACKAGE_GSTREAMER
+ select BR2_PACKAGE_GST_BASE
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_APP
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_ADDER
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_AUDIOCONVERT
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_AUDIORATE
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_AUDIORESAMPLE
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_FFMPEGCOLORSPACE
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_TYPEFIND
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_PLAYBACK
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_VIDEOSCALE
+ select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_VOLUME
+ help
+ GStreamer Plugin (gstreamer-ti) for TI ARM/DSP processors
+ http://gstreamer.ti.com/
+
+
+#TODO: Add other architectures
\ No newline at end of file
diff --git a/package/ti/ti-gst-plugin/ti-gst-plugin-1.01.00-angstrom_combined_patches.patch b/package/ti/ti-gst-plugin/ti-gst-plugin-1.01.00-angstrom_combined_patches.patch
new file mode 100644
index 0000000..ae37e10
--- /dev/null
+++ b/package/ti/ti-gst-plugin/ti-gst-plugin-1.01.00-angstrom_combined_patches.patch
@@ -0,0 +1,2887 @@
+diff -rupN a/Makefile.external b/Makefile.external
+--- a/Makefile.external 2009-07-14 08:17:55.000000000 -0700
++++ b/Makefile.external 2010-09-16 12:25:09.000000000 -0700
+@@ -3,8 +3,7 @@
+ #
+ # The only customization required below is defining the DVSDK_PATH
+ # and, if your DVSDK doesn't include DMAI, the set DMAI_INSTALL_DIR variable
+-# appropriately. If your DVSDK does include DMAI, then delete the line
+-# setting the DMAI_INSTALL_DIR variable below.
++# appropriately.
+ #
+ # Copyright (C) 2009 Ridgerun
+ #
+@@ -17,15 +16,16 @@ DMAI_INSTALL_DIR=undefined
+ ifeq ($(DVSDK_PATH),undefined)
+ $(error You need to define the environment variable DVSDK_PATH)
+ endif
++include $(DVSDK_PATH)/Rules.make
++
+ ifeq ($(DMAI_INSTALL_DIR),undefined)
+ $(error You need to define the environment variable DMAI_INSTALL_DIR)
+ endif
+
+ default:
+- @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm365"
++ @echo "Please specify the target: dm6446, omap3530, dm355, dm6467, dm6467t, dm365"
+
+-include $(DVSDK_PATH)/Rules.make
+-export PLATFORM=$(MAKECMDGOALS)
++export GST_TI_PLATFORM=$(MAKECMDGOALS)
+ export BIOS_INSTALL_DIR
+ export CE_INSTALL_DIR
+ export CMEM_INSTALL_DIR
+@@ -33,6 +33,7 @@ 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 LINUXKERNEL_INSTALL_DIR
+ export LPM_INSTALL_DIR
+ export MVTOOL_DIR
+@@ -41,34 +42,49 @@ export XDAIS_INSTALL_DIR
+ export XDC_INSTALL_DIR
+ export EDMA3_LLD_INSTALL_DIR
+
+-ifeq ($(PLATFORM), dm355)
+- export XDC_TARGET = gnu.targets.MVArm9
+- export XDC_PLATFORM = ti.platforms.evmDM355
++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}
+ endif
+
+-ifeq ($(PLATFORM), dm6446)
++ifeq ($(GST_TI_PLATFORM), dm6446)
+ export XDC_TARGET = gnu.targets.MVArm9
+ export XDC_PLATFORM = ti.platforms.evmDM6446
+ endif
+
+-ifeq ($(PLATFORM), dm6467)
++ifeq ($(GST_TI_PLATFORM), dm6467)
+ export XDC_TARGET = gnu.targets.MVArm9
+ export XDC_PLATFORM = ti.platforms.evmDM6467
+ endif
+
+-ifeq ($(PLATFORM), dm365)
+- export XDC_TARGET = gnu.targets.MVArm9
+- export XDC_PLATFORM = ti.platforms.evmDM365
++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}
+ endif
+
+-ifeq ($(PLATFORM), omap3530)
++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}
++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)
+ endif
+
+-CPPFLAGS=-DPlatform_$(PLATFORM)
++CPPFLAGS=-DPlatform_$(GST_TI_PLATFORM)
+ HOST=arm-none-linux-gnueabi
+
+ configure:
+@@ -86,6 +102,9 @@ dm6446: Makefile
+ dm6467: Makefile
+ $(MAKE) -f Makefile
+
++dm6467t: Makefile
++ $(MAKE) -f Makefile
++
+ dm355: Makefile
+ $(MAKE) -f Makefile
+
+diff -rupN a/src/gsttiauddec1.c b/src/gsttiauddec1.c
+--- a/src/gsttiauddec1.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttiauddec1.c 2010-09-16 12:41:11.000000000 -0700
+@@ -85,7 +85,7 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ("audio/mpeg, "
+- "mpegversion = (int) { 1, 4 }")
++ "mpegversion = (int) { 4 }")
+ );
+
+ /* Define source (output) pad capabilities. Currently, RAW is supported. */
+diff -rupN a/src/gsttiauddec.c b/src/gsttiauddec.c
+--- a/src/gsttiauddec.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttiauddec.c 2010-09-16 12:41:11.000000000 -0700
+@@ -85,7 +85,7 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ("audio/mpeg, "
+- "mpegversion = (int) { 1, 4 }")
++ "mpegversion = (int) { 4 }")
+ );
+
+ /* Constants */
+diff -rupN a/src/gstticodecplugin_dm355.cfg b/src/gstticodecplugin_dm355.cfg
+--- a/src/gstticodecplugin_dm355.cfg 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecplugin_dm355.cfg 2010-09-16 12:38:28.000000000 -0700
+@@ -1,84 +1,59 @@
+-/*
+- * Copyright (C) 2008-2009 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.
++/* ===========================================================================
++ * Copyright (c) Texas Instruments Incorporated 2009
+ *
++ * Use of this software is controlled by the terms and conditions found in
++ * the license agreement under which this software has been supplied or
++ * provided.
++ * ===========================================================================
+ */
+
+-prog.build.platform = "ti.platforms.evmDM355";
+-
+ /* Load support for the Codec Engine OSAL */
+ var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
+
+ /* Configure CE to use it's DSP Link Linux version */
+ osalGlobal.runtimeEnv = osalGlobal.LINUX;
+
++/* Configure RMAN */
++var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
++RMAN.useDSKT2 = false;
++RMAN.persistentAllocFxn = "__ALG_allocMemory";
++RMAN.persistentFreeFxn = "__ALG_freeMemory";
++RMAN.semCreateFxn = "Sem_create";
++RMAN.semDeleteFxn = "Sem_delete";
++RMAN.semPendFxn = "Sem_pend";
++RMAN.semPostFxn = "Sem_post";
++RMAN.tableSize = 10;
++
++var EDMA3 = xdc.useModule('ti.sdo.fc.edma3.Settings');
++var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');
++var EDMA = xdc.useModule('ti.sdo.linuxutils.edma.EDMA');
++var VICPLU = xdc.useModule('ti.sdo.linuxutils.vicp.VICP');
++var VICP = xdc.useModule('ti.sdo.fc.ires.vicp.VICP2');
++var VICPSYNC = xdc.useModule('ti.sdo.fc.vicpsync.VICPSYNC');
++var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
++var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
++
+ /*
+ * ======== Engine Configuration ========
+ */
+ var viddec = xdc.module('ti.sdo.ce.video2.IVIDDEC2');
+-var imgenc = xdc.module('ti.sdo.ce.image1.IIMGENC1');
+-var MPEG4DEC = xdc.useModule('ti.sdo.codecs.mpeg4dec.dm355.ce.MPEG4DEC');
+-var MPEG4ENC = xdc.useModule('ti.sdo.codecs.mpeg4enc.dm355.ce.MPEG4ENC');
+-var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.dm355.ce.JPEGENC');
+-var JPEGDEC = xdc.useModule('ti.sdo.codecs.jpegdec.dm355.ce.JPEGDEC');
++var auddec = xdc.module('ti.sdo.ce.audio.IAUDDEC');
++var videnc = xdc.module('ti.sdo.ce.video1.IVIDENC1');
++var audenc = xdc.module('ti.sdo.ce.audio.IAUDENC');
++
++var MPEG4DEC = xdc.useModule('ti.sdo.codecs.mpeg4dec.ce.MPEG4DEC');
++var JPEGDEC = xdc.useModule('ti.sdo.codecs.jpegdec.ce.JPEGDEC');
++var MPEG4ENC = xdc.useModule('ti.sdo.codecs.mpeg4enc.ce.MPEG4ENC');
++var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');
+
+-var Engine = xdc.useModule('ti.sdo.ce.Engine');
+-var decodeEngine = Engine.create("decode", [
++var Engine = xdc.useModule('ti.sdo.ce.Engine');
++var myEngine = Engine.create("codecServer", [
+ {name: "mpeg4dec", mod: MPEG4DEC, local: true, groupId: 1},
+ {name: "jpegdec", mod: JPEGDEC, local: true, groupId: 1},
+-]);
+-
+-var encodeEngine = Engine.create("encode", [
+ {name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
+- {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
++ {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1}
+ ]);
+
+ /* Load support for the 'Davinci Multimedia Application Interface' modules */
+ var DMAI = xdc.loadPackage('ti.sdo.dmai');
+
+-/*
+- * ======== DMAN3 Configuration ========
+- */
+-
+-var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');
+-
+-/* give DMAN3 all TCCs except those hard-coded by The JPEG & MPEG Enc & Decs */
+-
+-/*
+- * For the 32-63 range, configure tccAllocationMaskH to exclude used channels
+- * JPEG Dec: {33-47, 52-57}
+- * JPEG Enc: {34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49}
+- * MPEG Dec: {32-63}
+- * MPEG Enc: {12, 13, 34, 35, 40,41,42,43,44,45,46,47,48,49,50,52,53,
+- * 54,55,56,57,63}
+- */
+-DMAN3.tccAllocationMaskH = 0x0; /* everthing 32-63 hardcoded and unavailable */
+-
+-/* Give DMAN3 all lower TCCs except what's taken by Linux kernel and a Codec:
+- * Based on the info from montavista: {2, 3, 8, 9, 26, 27, 30, 31}
+- * and MPEG Enc taking up: {12, 13}
+- */
+-DMAN3.tccAllocationMaskL = 0x33ffccf3;
+-
+-/* Following assignments will give DMAN3 control of PaRAMs above 78: */
+-DMAN3.paRamBaseIndex = 64;
+-DMAN3.numPaRamEntries = 48;
+-DMAN3.nullPaRamIndex = 127;
+-
+-/* Configure Scratch Group's DMAN3 resources */
+-DMAN3.numTccGroup[1] = 0;
+-DMAN3.numPaRamGroup[1] = 32;
+-
+-DMAN3.qdmaChannels = [0, 1, 2, 3, 4, 5, 6, 7];
+-DMAN3.maxQdmaChannels = 8;
+-DMAN3.numQdmaChannels = 8;
+-DMAN3.maxTCs = 2;
+-
+diff -rupN a/src/gstticodecplugin_dm365.cfg b/src/gstticodecplugin_dm365.cfg
+--- a/src/gstticodecplugin_dm365.cfg 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecplugin_dm365.cfg 2010-09-16 12:39:28.000000000 -0700
+@@ -1,19 +1,11 @@
+-/*
+- * Copyright (C) 2008-2009 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.
++/* ============================================================================
++ * Copyright (c) Texas Instruments Incorporated 2009
+ *
++ * Use of this software is controlled by the terms and conditions found in the
++ * license agreement under which this software has been supplied or provided.
++ * ============================================================================
+ */
+
+-prog.build.platform = "ti.platforms.evmDM365";
+-
+ /* Load support for the Codec Engine OSAL */
+ var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
+
+@@ -23,34 +15,30 @@ osalGlobal.runtimeEnv = osalGlobal.LINUX
+ /*
+ * ======== Engine Configuration ========
+ */
+-var videnc = xdc.module('ti.sdo.ce.video1.IVIDENC1');
+ var viddec = xdc.module('ti.sdo.ce.video2.IVIDDEC2');
++var auddec = xdc.module('ti.sdo.ce.audio.IAUDDEC');
+
+-var MPEG4ENC = xdc.useModule('ti.sdo.codecs.mpeg4enc.ce.MPEG4ENC');
+-var H264ENC = xdc.useModule('ti.sdo.codecs.h264enc.ce.H264ENC');
+-var MPEG4DEC = xdc.useModule('ti.sdo.codecs.mpeg4dec.ce.MPEG4DEC');
++var MPEG4DEC = xdc.useModule('ti.sdo.codecs.mpeg4dec_hdvicp.ce.MPEG4DEC_HDVICP');
++var MPEG2DEC = xdc.useModule('ti.sdo.codecs.mpeg2dec.ce.MPEG2DEC');
+ var H264DEC = xdc.useModule('ti.sdo.codecs.h264dec.ce.H264DEC');
+-var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');
+-var JPEGDEC = xdc.useModule('ti.sdo.codecs.jpegdec.ce.JPEGDEC');
++var MPEG4ENC = xdc.useModule('ti.sdo.codecs.mpeg4enc_hdvicp.ce.MPEG4ENC_HDVICP');
++var MPEG2ENC = xdc.useModule('ti.sdo.codecs.mpeg2enc.ce.MPEG2ENC');
++var H264ENC = xdc.useModule('ti.sdo.codecs.h264enc.ce.H264ENC');
+
+ var Engine = xdc.useModule('ti.sdo.ce.Engine');
+-var encodeEngine = Engine.create("encode", [
+- {name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
+- {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
+- {name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
+-]);
+-var decodeEngine = Engine.create("decode", [
++var myEngine = Engine.create("codecServer", [
+ {name: "mpeg4dec", mod: MPEG4DEC, local: true, groupId: 1},
++ {name: "mpeg2dec", mod: MPEG2DEC, local: true, groupId: 1},
+ {name: "h264dec", mod: H264DEC, local: true, groupId: 1},
+- {name: "jpegdec", mod: JPEGDEC, local: true, groupId: 1},
++ {name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
++ {name: "mpeg2enc", mod: MPEG2ENC, local: true, groupId: 1},
++ {name: "h264enc", mod: H264ENC, local: true, groupId: 1},
+ ]);
+
+-/* Load support for the 'Davinci Multimedia Application Interface' modules */
+-var DMAI = xdc.loadPackage('ti.sdo.dmai');
+
+-/* Load support for SimpleWidget */
+-/*var SW = xdc.loadPackage('ti.sdo.simplewidget');*/
+
++/* Load support for the 'Davinci Multimedia Application Interface' modules */
++var DMAI = xdc.loadPackage('ti.sdo.dmai');
+
+ /* Configure RMAN */
+ var RMAN = xdc.useModule('ti.sdo.fc.rman.RMAN');
+@@ -78,17 +66,16 @@ var HDVICP = xdc.useModule('ti.sdo.fc.ir
+
+ var VICP = xdc.useModule('ti.sdo.fc.ires.vicp.VICP2');
+
+-var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
+-
+ var EDMA3CHAN = xdc.useModule('ti.sdo.fc.ires.edma3chan.EDMA3CHAN');
+
+-var LSP = xdc.useModule('ti.sdo.linuxutils.edma.EDMA');
++var EDMA = xdc.useModule('ti.sdo.linuxutils.edma.EDMA');
+
+-var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
++var ADDRSPACE = xdc.useModule('ti.sdo.fc.ires.addrspace.ADDRSPACE');
+
++var CMEM = xdc.useModule('ti.sdo.linuxutils.cmem.CMEM');
+
+ /* Uncomment these lines if you wish to debug FC and enable FC trace */
+-
++/*
+ /*
+ xdc.loadPackage('ti.sdo.fc.ires.vicp').profile = "debug_trace";
+ xdc.loadPackage('ti.sdo.fc.ires.edma3chan').profile = "debug_trace";
+Binary files a/src/.gstticodecplugin_dm365.cfg.rej.swp and b/src/.gstticodecplugin_dm365.cfg.rej.swp differ
+diff -rupN a/src/gstticodecplugin_dm6467.cfg b/src/gstticodecplugin_dm6467.cfg
+--- a/src/gstticodecplugin_dm6467.cfg 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecplugin_dm6467.cfg 2010-09-16 12:41:05.000000000 -0700
+@@ -29,25 +29,15 @@ TraceUtil.attrs = TraceUtil.SOCRATES_TRA
+ * ======== Engine Configuration ========
+ */
+ var Engine = xdc.useModule('ti.sdo.ce.Engine');
+-var decodeEngine = Engine.createFromServer(
+- "decode",
+- "./decodeCombo.x64P",
+- "ti.sdo.servers.decode"
++var demoEngine = Engine.createFromServer(
++ "codecServer",
++ "./bin/cs.x64P",
++ "ti.sdo.server.cs"
+ );
+-var encodeEngine = Engine.createFromServer(
+- "encode",
+- "./encodeCombo.x64P",
+- "ti.sdo.servers.encode"
+- );
+-
+-var encpath = "" + java.lang.System.getenv("ENCODE_COMBO");
+-if (encpath != "" && encpath != "null") {
+- encodeEngine.server = java.lang.System.getenv("ENCODE_COMBO");
+-}
+
+-var decpath = "" + java.lang.System.getenv("DECODE_COMBO");
+-if (decpath != "" && decpath != "null") {
+- decodeEngine.server = java.lang.System.getenv("DECODE_COMBO");
++var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
++if (combopath != "" && combopath != "null") {
++ demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
+ }
+
+ /* Load support for the 'Davinci Multimedia Application Interface' modules */
+diff -rupN a/src/gstticodecplugin_dm6467t.cfg b/src/gstticodecplugin_dm6467t.cfg
+--- a/src/gstticodecplugin_dm6467t.cfg 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecplugin_dm6467t.cfg 2010-09-16 12:25:09.000000000 -0700
+@@ -0,0 +1,34 @@
++/* ============================================================================
++ * Copyright (c) Texas Instruments Incorporated 2009
++ *
++ * Use of this software is controlled by the terms and conditions found in the
++ * license agreement under which this software has been supplied or provided.
++ * ============================================================================
++ */
++
++/* Load support for the Codec Engine OSAL */
++var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
++var os = xdc.useModule('ti.sdo.ce.osal.linux.Settings');
++osalGlobal.os = os;
++
++/* Configure CE to use it's DSP Link Linux version */
++var ipc = xdc.useModule('ti.sdo.ce.ipc.Settings');
++ipc.commType = ipc.COMM_DSPLINK;
++
++/*
++ * ======== Engine Configuration ========
++ */
++var Engine = xdc.useModule('ti.sdo.ce.Engine');
++var demoEngine = Engine.createFromServer(
++ "codecServer",
++ "./bin/cs.x64P",
++ "ti.sdo.server.cs"
++ );
++
++var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
++if (combopath != "" && combopath != "null") {
++ demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
++}
++
++/* Load support for the 'Davinci Multimedia Application Interface' modules */
++var DMAI = xdc.loadPackage('ti.sdo.dmai');
+diff -rupN a/src/gstticodecplugin_omapl137.cfg b/src/gstticodecplugin_omapl137.cfg
+--- a/src/gstticodecplugin_omapl137.cfg 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecplugin_omapl137.cfg 2010-09-16 12:40:59.000000000 -0700
+@@ -0,0 +1,41 @@
++/*
++ * Copyright (C) $year 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.
++ *
++ */
++
++/* Load the Codec Engine 'Operating System Abstraction Layer' */
++var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
++
++var os = xdc.useModule('ti.sdo.ce.osal.linux.Settings');
++osalGlobal.os = os;
++
++/* Configure CE to use it's DSP Link Linux version */
++var ipc = xdc.useModule('ti.sdo.ce.ipc.Settings');
++ipc.commType = ipc.COMM_DSPLINK;
++
++/*
++* ======== Engine Configuration ========
++ */
++var Engine = xdc.useModule('ti.sdo.ce.Engine');
++var demoEngine = Engine.createFromServer(
++ "codecServer",
++ "./bin/cs.x64P",
++ "ti.sdo.server.cs"
++ );
++
++var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
++if (combopath != "" && combopath != "null") {
++ demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
++}
++
++/* Load support for the DMAI module */
++var DMAI = xdc.loadPackage('ti.sdo.dmai');
+diff -rupN a/src/gstticodecplugin_omapl138.cfg b/src/gstticodecplugin_omapl138.cfg
+--- a/src/gstticodecplugin_omapl138.cfg 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecplugin_omapl138.cfg 2010-09-16 12:40:52.000000000 -0700
+@@ -0,0 +1,41 @@
++/*
++ * Copyright (C) $year 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.
++ *
++ */
++
++/* Load the Codec Engine 'Operating System Abstraction Layer' */
++var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
++
++var os = xdc.useModule('ti.sdo.ce.osal.linux.Settings');
++osalGlobal.os = os;
++
++/* Configure CE to use it's DSP Link Linux version */
++var ipc = xdc.useModule('ti.sdo.ce.ipc.Settings');
++ipc.commType = ipc.COMM_DSPLINK;
++
++/*
++* ======== Engine Configuration ========
++ */
++var Engine = xdc.useModule('ti.sdo.ce.Engine');
++var demoEngine = Engine.createFromServer(
++ "codecServer",
++ "./bin/cs.x64P",
++ "ti.sdo.server.cs"
++ );
++
++var combopath = "" + java.lang.System.getenv("CODEC_SERVER");
++if (combopath != "" && combopath != "null") {
++ demoEngine.server = java.lang.System.getenv("CODEC_SERVER");
++}
++
++/* Load support for the DMAI module */
++var DMAI = xdc.loadPackage('ti.sdo.dmai');
+diff -rupN a/src/gstticodecs_dm355.c b/src/gstticodecs_dm355.c
+--- a/src/gstticodecs_dm355.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecs_dm355.c 2010-09-16 12:25:09.000000000 -0700
+@@ -22,8 +22,7 @@
+ #include "gstticodecs.h"
+
+ /* Declaration of the production engine and decoders shipped with the DVSDK */
+-static Char decodeEngine[] = "decode";
+-static Char encodeEngine[] = "encode";
++static Char codecServer[] = "codecServer";
+
+ /* NULL terminated list of speech decoders in the engine to use in the demo */
+ GstTICodec gst_ticodec_codecs[] = {
+@@ -32,25 +31,25 @@ GstTICodec gst_ticodec_codecs[] = {
+ {
+ "MPEG4 Video Decoder", /* String name of codec used by plugin */
+ "mpeg4dec", /* String name of codec used by CE */
+- decodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
+ },
+
+ {
+ "MPEG4 Video Encoder", /* String name of codec used by plugin */
+ "mpeg4enc", /* String name of codec used by CE */
+- encodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
+ },
+
+ /* Imaging Codecs */
+ {
+ "JPEG Image Encoder",
+ "jpegenc",
+- encodeEngine
++ codecServer
+ },
+ {
+ "JPEG Image Decoder",
+ "jpegdec",
+- decodeEngine
++ codecServer
+ },
+
+ { NULL }
+diff -rupN a/src/gstticodecs_dm365.c b/src/gstticodecs_dm365.c
+--- a/src/gstticodecs_dm365.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecs_dm365.c 2010-09-16 12:25:09.000000000 -0700
+@@ -22,8 +22,7 @@
+ #include "gstticodecs.h"
+
+ /* Declaration of the production engine and decoders shipped with the DVSDK */
+-static Char decodeEngine[] = "decode";
+-static Char encodeEngine[] = "encode";
++static Char codecServer[] = "codecServer";
+
+ /* NULL terminated list of speech decoders in the engine to use in the demo */
+ GstTICodec gst_ticodec_codecs[] = {
+@@ -32,25 +31,37 @@ GstTICodec gst_ticodec_codecs[] = {
+ {
+ "MPEG4 Video Decoder", /* String name of codec used by plugin */
+ "mpeg4dec", /* String name of codec used by CE */
+- decodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
++ },
++
++ {
++ "MPEG2 Video Decoder", /* String name of codec used by plugin */
++ "mpeg2dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
+ },
+
+ {
+ "MPEG4 Video Encoder", /* String name of codec used by plugin */
+ "mpeg4enc", /* String name of codec used by CE */
+- encodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
++ },
++
++ {
++ "MPEG2 Video Encoder", /* String name of codec used by plugin */
++ "mpeg2enc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
+ },
+
+ {
+ "H.264 Video Decoder", /* String name of codec used by plugin */
+ "h264dec", /* String name of codec used by CE */
+- decodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
+ },
+
+ {
+ "H.264 Video Encoder", /* String name of codec used by plugin */
+ "h264enc", /* String name of codec used by CE */
+- encodeEngine /* Engine that contains this codec */
++ codecServer /* Engine that contains this codec */
+ },
+
+ { NULL }
+diff -rupN a/src/gstticodecs_dm6467.c b/src/gstticodecs_dm6467.c
+--- a/src/gstticodecs_dm6467.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gstticodecs_dm6467.c 2010-09-16 12:25:09.000000000 -0700
+@@ -1,5 +1,5 @@
+ /*
+- * gstticodecs_dm6446.c
++ * gstticodecs_dm6467.c
+ *
+ * This file provides information for available codecs on the DM6446 platform.
+ *
+diff -rupN a/src/gstticodecs_dm6467t.c b/src/gstticodecs_dm6467t.c
+--- a/src/gstticodecs_dm6467t.c 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecs_dm6467t.c 2010-09-16 12:25:09.000000000 -0700
+@@ -0,0 +1,69 @@
++/*
++ * gstticodecs_dm6467t.c
++ *
++ * This file provides information for available codecs on the DM6446 platform.
++ *
++ * Original Author:
++ * Don Darling, Texas Instruments, Inc.
++ *
++ * Copyright (C) $year 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 "gstticodecs.h"
++
++/* Declaration of the production engine and decoders shipped with the DVSDK */
++static Char codecServer[] = "codecServer";
++
++/* NULL terminated list of speech decoders in the engine to use in the demo */
++GstTICodec gst_ticodec_codecs[] = {
++
++ /* Speech Codecs */
++ {
++ "G.711 Speech Decoder", /* String name of codec used by plugin */
++ "g711dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "G.711 Speech Encoder", /* String name of codec used by plugin */
++ "g711enc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Audio Codecs */
++ {
++ "AAC Audio Decoder", /* String name of codec used by plugin */
++ "aachedec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Video Codecs */
++ {
++ "H.264 Video Decoder", /* String name of codec used by plugin */
++ "h264dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "H.264 BP/HP Decoder", /* Name of codec used by plugin */
++ "h2641080p60vdec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "H.264 Video Encoder", /* String name of codec used by plugin */
++ "h264enc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "MPEG2 Video Decoder", /* String name of codec used by plugin */
++ "mpeg2dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ { NULL }
++};
++
+diff -rupN a/src/gstticodecs_omapl137.c b/src/gstticodecs_omapl137.c
+--- a/src/gstticodecs_omapl137.c 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecs_omapl137.c 2010-09-16 12:40:59.000000000 -0700
+@@ -0,0 +1,81 @@
++/*
++ * gstticodecs_omapl137.c
++ *
++ * This file provides information for available codecs on the OMAP3530 platform.
++ *
++ * Original Author:
++ * Don Darling, Texas Instruments, Inc.
++ *
++ * Copyright (C) $year 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 "gstticodecs.h"
++
++/* Declaration of the production engine and decoders shipped with the DVSDK */
++static Char codecServer[] = "codecServer";
++
++/* NULL terminated list of speech decoders in the engine to use in the demo */
++GstTICodec gst_ticodec_codecs[] = {
++
++ /* Audio Decoders */
++ {
++ "AAC Audio Decoder", /* String name of codec used by plugin */
++ "aachedec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Video Decoders */
++ {
++ "H.264 Video Decoder", /* String name of codec used by plugin */
++ "h264dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "MPEG4 Video Decoder", /* String name of codec used by plugin */
++ "mpeg4dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Image Decoders */
++ {
++ "JPEG Image Decoder", /* String name of codec used by plugin */
++ "jpegdec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Video Encoders */
++ {
++ "H.264 Video Encoder", /* String name of codec used by plugin */
++ "h264enc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Image Encoders */
++ {
++ "JPEG Image Encoder", /* String name of codec used by plugin */
++ "jpegenc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ { NULL }
++};
++
++
++/******************************************************************************
++ * Custom ViM Settings for editing this file
++ ******************************************************************************/
++#if 0
++ Tabs (use 4 spaces for indentation)
++ vim:set tabstop=4: /* Use 4 spaces for tabs */
++ vim:set shiftwidth=4: /* Use 4 spaces for >> operations */
++ vim:set expandtab: /* Expand tabs into white spaces */
++#endif
+diff -rupN a/src/gstticodecs_omapl138.c b/src/gstticodecs_omapl138.c
+--- a/src/gstticodecs_omapl138.c 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gstticodecs_omapl138.c 2010-09-16 12:40:52.000000000 -0700
+@@ -0,0 +1,81 @@
++/*
++ * gstticodecs_omapl138.c
++ *
++ * This file provides information for available codecs on the OMAP3530 platform.
++ *
++ * Original Author:
++ * Don Darling, Texas Instruments, Inc.
++ *
++ * Copyright (C) $year 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 "gstticodecs.h"
++
++/* Declaration of the production engine and decoders shipped with the DVSDK */
++static Char codecServer[] = "codecServer";
++
++/* NULL terminated list of speech decoders in the engine to use in the demo */
++GstTICodec gst_ticodec_codecs[] = {
++
++ /* Audio Decoders */
++ {
++ "AAC Audio Decoder", /* String name of codec used by plugin */
++ "aachedec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Video Decoders */
++ {
++ "H.264 Video Decoder", /* String name of codec used by plugin */
++ "h264dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ }, {
++ "MPEG4 Video Decoder", /* String name of codec used by plugin */
++ "mpeg4dec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Image Decoders */
++ {
++ "JPEG Image Decoder", /* String name of codec used by plugin */
++ "jpegdec", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Video Encoders */
++ {
++ "H.264 Video Encoder", /* String name of codec used by plugin */
++ "h264enc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ /* Image Encoders */
++ {
++ "JPEG Image Encoder", /* String name of codec used by plugin */
++ "jpegenc", /* String name of codec used by CE */
++ codecServer /* Engine that contains this codec */
++ },
++
++ { NULL }
++};
++
++
++/******************************************************************************
++ * Custom ViM Settings for editing this file
++ ******************************************************************************/
++#if 0
++ Tabs (use 4 spaces for indentation)
++ vim:set tabstop=4: /* Use 4 spaces for tabs */
++ vim:set shiftwidth=4: /* Use 4 spaces for >> operations */
++ vim:set expandtab: /* Expand tabs into white spaces */
++#endif
+diff -rupN a/src/gsttidmaivideosink.c b/src/gsttidmaivideosink.c
+--- a/src/gsttidmaivideosink.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttidmaivideosink.c 2010-09-16 12:40:59.000000000 -0700
+@@ -32,11 +32,12 @@
+ /* Define sink (input) pad capabilities.
+ *
+ * UYVY - YUV 422 interleaved corresponding to V4L2_PIX_FMT_UYVY in v4l2
+- * Y8C8 - YUV 422 semi planar. The dm6467 VDCE outputs this format after a
++ * NV16 - YUV 422 semi planar. The dm6467 VDCE outputs this format after a
+ * color conversion.The format consists of two planes: one with the
+ * Y component and one with the CbCr components interleaved (hence semi) *
+ * See the LSP VDCE documentation for a thorough description of this
+ * format.
++ * Y8C8 - Same as NV16. Y8C8 was used in MVL-based LSPs.
+ * NV12 - YUV 420 semi planar corresponding to V4L2_PIX_FMT_NV12 in v4l2.
+ * The format consists of two planes: one with the
+ * Y component and one with the CbCr components interleaved with
+@@ -51,6 +52,19 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
++#if defined(Platform_omapl138) || defined(Platform_omapl137)
++ ("video/x-raw-rgb, "
++ "bpp=(int)16, "
++ "depth=(int)16, "
++ "endianness=(int)1234, "
++ "red_mask=(int)63488, "
++ "green_mask=(int)2016, "
++ "blue_mask=(int)31, "
++ "framerate=(fraction)[ 0, MAX ], "
++ "width=(int)[ 1, MAX ], "
++ "height=(int)[1, MAX ] "
++ )
++#else
+ ("video/x-raw-yuv, "
+ "format=(fourcc)UYVY, "
+ "framerate=(fraction)[ 0, MAX ], "
+@@ -62,11 +76,17 @@ static GstStaticPadTemplate sink_factory
+ "width=(int)[ 1, MAX ], "
+ "height=(int)[ 1, MAX ];"
+ "video/x-raw-yuv, "
++ "format=(fourcc)NV16, "
++ "framerate=(fraction)[ 0, MAX ], "
++ "width=(int)[ 1, MAX ], "
++ "height=(int)[ 1, MAX ];"
++ "video/x-raw-yuv, "
+ "format=(fourcc)NV12, "
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+ "height=(int)[ 1, MAX ]"
+ )
++#endif
+ );
+
+ GST_DEBUG_CATEGORY_STATIC (gst_tidmaivideosink_debug);
+@@ -219,7 +239,7 @@ static void gst_tidmaivideosink_class_in
+ "Video Standard used\n"
+ "\tAUTO (if supported), CIF, SIF_NTSC, SIF_PAL, VGA, D1_NTSC\n"
+ "\tD1_PAL, 480P, 576P, 720P_60, 720P_50, 1080I_30, 1080I_25\n"
+- "\t1080P_30, 1080P_25, 1080P_24\n",
++ "\t1080P_30, 1080P_60, 1080P_25, 1080P_24\n",
+ NULL, G_PARAM_READWRITE));
+
+ g_object_class_install_property(gobject_class, PROP_VIDEOOUTPUT,
+@@ -661,9 +681,18 @@ static int gst_tidmaivideosink_videostd_
+ break;
+ case VideoStd_480P:
+ case VideoStd_720P_60:
++ #if defined(Platform_dm6467t)
++ case VideoStd_1080P_60:
++ #endif
+ vattrs->framerate = 60;
+ break;
+
++ #if defined(Platform_omapl138) || defined(Platform_omapl137)
++ case VideoStd_QVGA:
++ vattrs->framerate = 30;
++ break;
++ #endif
++
+ #if defined(Platform_omap3530)
+ case VideoStd_VGA:
+ vattrs->framerate = 60;
+@@ -715,6 +744,9 @@ static int gst_tidmaivideosink_videostd_
+
+ case VideoStd_480P:
+ case VideoStd_720P_60:
++ #if defined(Platform_dm6467t)
++ case VideoStd_1080P_60:
++ #endif
+ return 16667;
+
+ #if defined(Platform_omap3530)
+@@ -949,6 +981,10 @@ static int gst_tidmaivideosink_convert_a
+ return VideoStd_1080P_25;
+ else if (!strcmp(sink->videoStd, "1080P_24"))
+ return VideoStd_1080P_24;
++ #if defined(Platform_dm6467t)
++ else if (!strcmp(sink->videoStd, "1080P_60"))
++ return VideoStd_1080P_60;
++ #endif
+ #if defined(Platform_omap3530)
+ else if (!strcmp(sink->videoStd, "VGA"))
+ return VideoStd_VGA;
+@@ -958,7 +994,7 @@ static int gst_tidmaivideosink_convert_a
+ "Please choose from:\n"
+ "\tAUTO (if supported), CIF, SIF_NTSC, SIF_PAL, VGA, D1_NTSC\n"
+ "\tD1_PAL, 480P, 576P, 720P_60, 720P_50, 1080I_30, 1080I_25\n"
+- "\t1080P_30, 1080P_25, 1080P_24\n", sink->videoStd);
++ "\t1080P_30, 1080P_60, 1080P_25, 1080P_24\n", sink->videoStd);
+ return -1;
+ }
+ break;
+@@ -1035,6 +1071,18 @@ static gboolean gst_tidmaivideosink_set_
+ sink->dAttrs.colorSpace = colorSpace;
+ break;
+ #endif
++ #if defined(Platform_omapl138)
++ case Cpu_Device_OMAPL138:
++ sink->dAttrs = Display_Attrs_OMAPL138_OSD_DEFAULT;
++ sink->dAttrs.colorSpace = colorSpace;
++ break;
++ #endif
++ #if defined(Platform_omapl137)
++ case Cpu_Device_OMAPL137:
++ sink->dAttrs = Display_Attrs_OMAPL137_OSD_DEFAULT;
++ sink->dAttrs.colorSpace = colorSpace;
++ break;
++ #endif
+ default:
+ sink->dAttrs = Display_Attrs_DM6446_DM355_VID_DEFAULT;
+ break;
+@@ -1291,8 +1339,10 @@ static gboolean gst_tidmaivideosink_proc
+ ColorSpace_Type inBufColorSpace;
+ gint framerateDen;
+ gint framerateNum;
++ const gchar *mime;
+
+ structure = gst_caps_get_structure(caps, 0);
++ mime = gst_structure_get_name(structure);
+
+ /* The width and height of the input buffer are collected here so that it
+ * can be checked against the width and height of the display buffer.
+@@ -1300,24 +1350,38 @@ static gboolean gst_tidmaivideosink_proc
+ gst_structure_get_int(structure, "width", &width);
+ gst_structure_get_int(structure, "height", &height);
+
+- /* Map input buffer fourcc to dmai color space */
+- gst_structure_get_fourcc(structure, "format", &fourcc);
++ if (!strcmp(mime, "video/x-raw-rgb")) {
++ gint rm,gm,bm;
+
+- switch (fourcc) {
+- case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
+- inBufColorSpace = ColorSpace_UYVY;
+- break;
+- case GST_MAKE_FOURCC('Y', '8', 'C', '8'):
+- inBufColorSpace = ColorSpace_YUV422PSEMI;
+- break;
+- #if defined(Platform_dm365)
+- case GST_MAKE_FOURCC('N', 'V', '1', '2'):
+- inBufColorSpace = ColorSpace_YUV420PSEMI;
+- break;
+- #endif
+- default:
+- GST_ERROR("unsupported fourcc\n");
++ gst_structure_get_int(structure,"red_mask",&rm);
++ gst_structure_get_int(structure,"green_mask",&gm);
++ gst_structure_get_int(structure,"blue_mask",&bm);
++ if ((rm == 63488) && (gm == 2016) && (bm == 31)){
++ inBufColorSpace = ColorSpace_RGB565;
++ } else {
++ GST_ERROR("unsupported color space\n");
+ return FALSE;
++ }
++ } else {
++
++ /* Map input buffer fourcc to dmai color space */
++ gst_structure_get_fourcc(structure, "format", &fourcc);
++
++ switch (fourcc) {
++ case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
++ inBufColorSpace = ColorSpace_UYVY;
++ break;
++ case GST_MAKE_FOURCC('N', 'V', '1', '6'):
++ case GST_MAKE_FOURCC('Y', '8', 'C', '8'):
++ inBufColorSpace = ColorSpace_YUV422PSEMI;
++ break;
++ case GST_MAKE_FOURCC('N', 'V', '1', '2'):
++ inBufColorSpace = ColorSpace_YUV420PSEMI;
++ break;
++ default:
++ GST_ERROR("unsupported fourcc\n");
++ return FALSE;
++ }
+ }
+
+ /* Read the frame rate */
+diff -rupN a/src/gsttividdec2.c b/src/gsttividdec2.c
+--- a/src/gsttividdec2.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttividdec2.c 2010-09-16 12:41:15.000000000 -0700
+@@ -83,7 +83,7 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ("video/mpeg, "
+- "mpegversion=(int){ 2, 4 }, " /* MPEG versions 2 and 4 */
++ "mpegversion=(int){ 2, 4 }, " /* MPEG versions 2 and 4 */
+ "systemstream=(boolean)false, "
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+@@ -91,7 +91,8 @@ static GstStaticPadTemplate sink_factory
+ "video/x-h264, " /* H264 */
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+- "height=(int)[ 1, MAX ]"
++ "height=(int)[ 1, MAX ] ;"
++ "video/x-xvid" /* XVID */
+ )
+ );
+
+@@ -613,6 +614,11 @@ static gboolean gst_tividdec2_set_sink_c
+ codec = gst_ticodec_get_codec("H.264 Video Decoder");
+ }
+
++ /* XVID Decode */
++ else if (!strcmp(mime, "video/x-xvid")) {
++ codec = gst_ticodec_get_codec("MPEG4 Video Decoder");
++ }
++
+ /* Mime type not supported */
+ else {
+ GST_ELEMENT_ERROR(viddec2, STREAM, NOT_IMPLEMENTED,
+@@ -671,16 +677,8 @@ static gboolean gst_tividdec2_set_source
+ given buffer */
+ BufferGfx_getDimensions(hBuf, &dim);
+
+-#if !defined(Platform_dm365)
+- caps =
+- gst_caps_new_simple("video/x-raw-yuv",
+- "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('U','Y','V','Y'),
+- "framerate", GST_TYPE_FRACTION, viddec2->framerateNum,
+- viddec2->framerateDen,
+- "width", G_TYPE_INT, dim.width,
+- "height", G_TYPE_INT, dim.height,
+- NULL);
+-#else
++#if defined(Platform_dm365) || defined(Platform_dm6467) || \
++ defined(Platform_dm6467t)
+ caps =
+ gst_caps_new_simple("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('N','V','1','2'),
+@@ -689,6 +687,15 @@ static gboolean gst_tividdec2_set_source
+ "width", G_TYPE_INT, dim.width,
+ "height", G_TYPE_INT, dim.height,
+ NULL);
++#else
++ caps =
++ gst_caps_new_simple("video/x-raw-yuv",
++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('U','Y','V','Y'),
++ "framerate", GST_TYPE_FRACTION, viddec2->framerateNum,
++ viddec2->framerateDen,
++ "width", G_TYPE_INT, dim.width,
++ "height", G_TYPE_INT, dim.height,
++ NULL);
+ #endif
+
+ /* Set the source pad caps */
+@@ -1165,29 +1172,35 @@ static gboolean gst_tividdec2_codec_star
+
+ /* Set up codec parameters depending on device */
+ switch(device) {
+- case Cpu_Device_DM6467:
+- params.forceChromaFormat = XDM_YUV_420P;
+- params.maxWidth = VideoStd_1080I_WIDTH;
+- params.maxHeight = VideoStd_1080I_HEIGHT + 8;
+- colorSpace = ColorSpace_YUV420PSEMI;
+- defaultNumBufs = 5;
+- break;
+-#if defined(Platform_dm365)
+- case Cpu_Device_DM365:
+- params.forceChromaFormat = XDM_YUV_420SP;
+- params.maxWidth = VideoStd_720P_WIDTH;
+- params.maxHeight = VideoStd_720P_HEIGHT;
+- colorSpace = ColorSpace_YUV420PSEMI;
+- defaultNumBufs = 5;
+- break;
+-#endif
+- default:
+- params.forceChromaFormat = XDM_YUV_422ILE;
+- params.maxWidth = VideoStd_D1_WIDTH;
+- params.maxHeight = VideoStd_D1_PAL_HEIGHT;
+- colorSpace = ColorSpace_UYVY;
+- defaultNumBufs = 3;
+- break;
++ case Cpu_Device_DM6467:
++ #if defined(Platform_dm6467t)
++ params.forceChromaFormat = XDM_YUV_420SP;
++ params.maxFrameRate = 60000;
++ params.maxBitRate = 30000000;
++ #else
++ params.forceChromaFormat = XDM_YUV_420P;
++ #endif
++ params.maxWidth = VideoStd_1080I_WIDTH;
++ params.maxHeight = VideoStd_1080I_HEIGHT + 8;
++ colorSpace = ColorSpace_YUV420PSEMI;
++ defaultNumBufs = 5;
++ break;
++ #if defined(Platform_dm365)
++ case Cpu_Device_DM365:
++ params.forceChromaFormat = XDM_YUV_420SP;
++ params.maxWidth = VideoStd_720P_WIDTH;
++ params.maxHeight = VideoStd_720P_HEIGHT;
++ colorSpace = ColorSpace_YUV420PSEMI;
++ defaultNumBufs = 4;
++ break;
++ #endif
++ default:
++ params.forceChromaFormat = XDM_YUV_422ILE;
++ params.maxWidth = VideoStd_D1_WIDTH;
++ params.maxHeight = VideoStd_D1_PAL_HEIGHT;
++ colorSpace = ColorSpace_UYVY;
++ defaultNumBufs = 3;
++ break;
+ }
+
+ GST_LOG("opening video decoder \"%s\"\n", viddec2->codecName);
+diff -rupN a/src/gsttividdec.c b/src/gsttividdec.c
+--- a/src/gsttividdec.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttividdec.c 2010-09-16 12:41:15.000000000 -0700
+@@ -82,7 +82,7 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ("video/mpeg, "
+- "mpegversion=(int){ 2, 4 }, " /* MPEG versions 2 and 4 */
++ "mpegversion=(int){ 2, 4 }, " /* MPEG versions 2 and 4 */
+ "systemstream=(boolean)false, "
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+@@ -90,7 +90,8 @@ static GstStaticPadTemplate sink_factory
+ "video/x-h264, " /* H264 */
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+- "height=(int)[ 1, MAX ]"
++ "height=(int)[ 1, MAX ] ;"
++ "video/x-xvid" /* XVID */
+ )
+ );
+
+@@ -603,6 +604,11 @@ static gboolean gst_tividdec_set_sink_ca
+ codec = gst_ticodec_get_codec("H.264 Video Decoder");
+ }
+
++ /* XVID Decode */
++ else if (!strcmp(mime, "video/x-xvid")) {
++ codec = gst_ticodec_get_codec("MPEG4 Video Decoder");
++ }
++
+ /* Mime type not supported */
+ else {
+ GST_ELEMENT_ERROR(viddec, STREAM, NOT_IMPLEMENTED,
+diff -rupN a/src/gsttividdec.c.orig b/src/gsttividdec.c.orig
+--- a/src/gsttividdec.c.orig 1969-12-31 16:00:00.000000000 -0800
++++ b/src/gsttividdec.c.orig 2010-09-16 12:24:16.000000000 -0700
+@@ -0,0 +1,1496 @@
++/*
++ * gsttividdec.c
++ *
++ * This file defines the "TIViddec" element, which decodes an xDM 0.9 video
++ * stream.
++ *
++ * Example usage:
++ * gst-launch filesrc location=<video file> !
++ * TIViddec engineName="<engine name>" codecName="<codecName>" !
++ * fakesink silent=TRUE
++ *
++ * Notes:
++ * * If the upstream element (i.e. demuxer or typefind element) negotiates
++ * caps with TIViddec, the engineName and codecName properties will be
++ * auto-detected based on the mime type requested. The engine and codec
++ * names used for particular mime types are defined in gsttividdec.h.
++ * Currently, they are set to use the engine and codec names provided with
++ * the TI evaluation codecs.
++ * * This element currently assumes that the codec produces UYVY output.
++ *
++ * Original Author:
++ * Don Darling, Texas Instruments, Inc.
++ *
++ * Copyright (C) 2008-2009 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.
++ *
++ */
++
++#ifdef HAVE_CONFIG_H
++# include <config.h>
++#endif
++
++#include <stdio.h>
++#include <string.h>
++#include <gst/gst.h>
++#include <semaphore.h>
++
++#include <ti/sdo/dmai/Dmai.h>
++#include <ti/sdo/dmai/VideoStd.h>
++#include <ti/sdo/dmai/Buffer.h>
++#include <ti/sdo/dmai/BufferGfx.h>
++#include <ti/sdo/dmai/BufTab.h>
++#include <ti/sdo/dmai/ce/Vdec.h>
++
++#include "gsttividdec.h"
++#include "gsttidmaibuffertransport.h"
++#include "gstticodecs.h"
++#include "gsttithreadprops.h"
++#include "gsttiquicktime_h264.h"
++#include "gstticommonutils.h"
++
++/* Declare variable used to categorize GST_LOG output */
++GST_DEBUG_CATEGORY_STATIC (gst_tividdec_debug);
++#define GST_CAT_DEFAULT gst_tividdec_debug
++
++/* Element property identifiers */
++enum
++{
++ PROP_0,
++ PROP_ENGINE_NAME, /* engineName (string) */
++ PROP_CODEC_NAME, /* codecName (string) */
++ PROP_NUM_OUTPUT_BUFS, /* numOutputBufs (int) */
++ PROP_FRAMERATE, /* frameRate (int) */
++ PROP_DISPLAY_BUFFER, /* displayBuffer (boolean) */
++ PROP_GEN_TIMESTAMPS /* genTimeStamps (boolean) */
++};
++
++/* Define sink (input) pad capabilities. Currently, MPEG and H264 are
++ * supported.
++ */
++static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE(
++ "sink",
++ GST_PAD_SINK,
++ GST_PAD_ALWAYS,
++ GST_STATIC_CAPS
++ ("video/mpeg, "
++ "mpegversion=(int){ 2, 4 }, " /* MPEG versions 2 and 4 */
++ "systemstream=(boolean)false, "
++ "framerate=(fraction)[ 0, MAX ], "
++ "width=(int)[ 1, MAX ], "
++ "height=(int)[ 1, MAX ] ;"
++ "video/x-h264, " /* H264 */
++ "framerate=(fraction)[ 0, MAX ], "
++ "width=(int)[ 1, MAX ], "
++ "height=(int)[ 1, MAX ]"
++ )
++);
++
++/* Constants */
++#define gst_tividdec_CODEC_FREE 0x2
++
++/* Define source (output) pad capabilities. Currently, UYVY is supported. */
++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 ]"
++ )
++);
++
++
++/* Declare a global pointer to our element base class */
++static GstElementClass *parent_class = NULL;
++
++/* Static Function Declarations */
++static void
++ gst_tividdec_base_init(gpointer g_class);
++static void
++ gst_tividdec_class_init(GstTIViddecClass *g_class);
++static void
++ gst_tividdec_init(GstTIViddec *object, GstTIViddecClass *g_class);
++static void
++ gst_tividdec_set_property (GObject *object, guint prop_id,
++ const GValue *value, GParamSpec *pspec);
++static void
++ gst_tividdec_get_property (GObject *object, guint prop_id, GValue *value,
++ GParamSpec *pspec);
++static gboolean
++ gst_tividdec_set_sink_caps(GstPad *pad, GstCaps *caps);
++static gboolean
++ gst_tividdec_set_source_caps(GstTIViddec *viddec, Buffer_Handle hBuf);
++static gboolean
++ gst_tividdec_sink_event(GstPad *pad, GstEvent *event);
++static GstFlowReturn
++ gst_tividdec_chain(GstPad *pad, GstBuffer *buf);
++static gboolean
++ gst_tividdec_init_video(GstTIViddec *viddec);
++static gboolean
++ gst_tividdec_exit_video(GstTIViddec *viddec);
++static GstStateChangeReturn
++ gst_tividdec_change_state(GstElement *element, GstStateChange transition);
++static void*
++ gst_tividdec_decode_thread(void *arg);
++static void
++ gst_tividdec_drain_pipeline(GstTIViddec *viddec);
++static GstClockTime
++ gst_tividdec_frame_duration(GstTIViddec *viddec);
++static gboolean
++ gst_tividdec_codec_start (GstTIViddec *viddec);
++static gboolean
++ gst_tividdec_codec_stop (GstTIViddec *viddec);
++static void
++ gst_tividdec_init_env(GstTIViddec *viddec);
++static void
++ gst_tividdec_dispose(GObject * object);
++static gboolean
++ gst_tividdec_set_query_pad(GstPad * pad, GstQuery * query);
++
++/******************************************************************************
++ * gst_tividdec_class_init_trampoline
++ * Boiler-plate function auto-generated by "make_element" script.
++ ******************************************************************************/
++static void gst_tividdec_class_init_trampoline(gpointer g_class, gpointer data)
++{
++ parent_class = (GstElementClass*) g_type_class_peek_parent(g_class);
++ gst_tividdec_class_init((GstTIViddecClass*)g_class);
++}
++
++
++/******************************************************************************
++ * gst_tividdec_get_type
++ * Boiler-plate function auto-generated by "make_element" script.
++ * Defines function pointers for initialization routines for this element.
++ ******************************************************************************/
++GType gst_tividdec_get_type(void)
++{
++ static GType object_type = 0;
++
++ if (G_UNLIKELY(object_type == 0)) {
++ static const GTypeInfo object_info = {
++ sizeof(GstTIViddecClass),
++ gst_tividdec_base_init,
++ NULL,
++ gst_tividdec_class_init_trampoline,
++ NULL,
++ NULL,
++ sizeof(GstTIViddec),
++ 0,
++ (GInstanceInitFunc) gst_tividdec_init
++ };
++
++ object_type = g_type_register_static((gst_element_get_type()),
++ "GstTIViddec", &object_info, (GTypeFlags)0);
++
++ /* Initialize GST_LOG for this object */
++ GST_DEBUG_CATEGORY_INIT(gst_tividdec_debug, "TIViddec", 0,
++ "TI xDM 0.9 Video Decoder");
++
++ GST_LOG("initialized get_type\n");
++ }
++
++ return object_type;
++};
++
++
++/******************************************************************************
++ * gst_tividdec_base_init
++ * Boiler-plate function auto-generated by "make_element" script.
++ * Initializes element base class.
++ ******************************************************************************/
++static void gst_tividdec_base_init(gpointer gclass)
++{
++ static GstElementDetails element_details = {
++ "TI xDM 0.9 Video Decoder",
++ "Codec/Decoder/Video",
++ "Decodes video using an xDM 0.9-based codec",
++ "Don Darling; 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);
++
++}
++
++
++/******************************************************************************
++ * gst_tividdec_class_init
++ * Boiler-plate function auto-generated by "make_element" script.
++ * Initializes the TIViddec class.
++ ******************************************************************************/
++static void gst_tividdec_class_init(GstTIViddecClass *klass)
++{
++ GObjectClass *gobject_class;
++ GstElementClass *gstelement_class;
++
++ gobject_class = (GObjectClass*) klass;
++ gstelement_class = (GstElementClass*) klass;
++
++ gobject_class->set_property = gst_tividdec_set_property;
++ gobject_class->get_property = gst_tividdec_get_property;
++ gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_tividdec_dispose);
++
++ gstelement_class->change_state = gst_tividdec_change_state;
++
++ g_object_class_install_property(gobject_class, PROP_ENGINE_NAME,
++ g_param_spec_string("engineName", "Engine Name",
++ "Engine name used by Codec Engine", "unspecified",
++ G_PARAM_READWRITE));
++
++ g_object_class_install_property(gobject_class, PROP_CODEC_NAME,
++ g_param_spec_string("codecName", "Codec Name", "Name of video codec",
++ "unspecified", G_PARAM_READWRITE));
++
++ g_object_class_install_property(gobject_class, PROP_NUM_OUTPUT_BUFS,
++ g_param_spec_int("numOutputBufs",
++ "Number of Ouput Buffers",
++ "Number of output buffers to allocate for codec",
++ 2, G_MAXINT32, 3, G_PARAM_WRITABLE));
++
++ g_object_class_install_property(gobject_class, PROP_FRAMERATE,
++ g_param_spec_int("frameRate",
++ "Frame rate to play output",
++ "Communicate this framerate to downstream elements. The frame "
++ "rate specified should be an integer. If 29.97fps is desired, "
++ "specify 30 for this setting",
++ 1, G_MAXINT32, 30, G_PARAM_WRITABLE));
++
++ g_object_class_install_property(gobject_class, PROP_DISPLAY_BUFFER,
++ g_param_spec_boolean("displayBuffer", "Display Buffer",
++ "Display circular buffer status while processing",
++ FALSE, G_PARAM_WRITABLE));
++
++ g_object_class_install_property(gobject_class, PROP_GEN_TIMESTAMPS,
++ g_param_spec_boolean("genTimeStamps", "Generate Time Stamps",
++ "Set timestamps on output buffers",
++ TRUE, G_PARAM_WRITABLE));
++}
++
++/******************************************************************************
++ * gst_tividdec_dispose
++ *****************************************************************************/
++static void gst_tividdec_dispose(GObject * object)
++{
++ GstTIViddec *viddec = GST_TIVIDDEC(object);
++
++ if (viddec->segment) {
++ gst_segment_free(viddec->segment);
++ viddec->segment = NULL;
++ }
++
++ G_OBJECT_CLASS(parent_class)->dispose (object);
++}
++
++
++/******************************************************************************
++ * gst_tividdec_init_env
++ *****************************************************************************/
++static void gst_tividdec_init_env(GstTIViddec *viddec)
++{
++ GST_LOG("gst_tividdec_init_env - begin\n");
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_engineName")) {
++ viddec->engineName = gst_ti_env_get_string("GST_TI_TIViddec_engineName");
++ GST_LOG("Setting engineName=%s\n", viddec->engineName);
++ }
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_codecName")) {
++ viddec->codecName = gst_ti_env_get_string("GST_TI_TIViddec_codecName");
++ GST_LOG("Setting codecName=%s\n", viddec->codecName);
++ }
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_numOutputBufs")) {
++ viddec->numOutputBufs =
++ gst_ti_env_get_int("GST_TI_TIViddec_numOutputBufs");
++ GST_LOG("Setting numOutputBufs=%ld\n", viddec->numOutputBufs);
++ }
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_displayBuffer")) {
++ viddec->displayBuffer =
++ gst_ti_env_get_boolean("GST_TI_TIViddec_displayBuffer");
++ GST_LOG("Setting displayBuffer=%s\n",
++ viddec->displayBuffer ? "TRUE" : "FALSE");
++ }
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_genTimeStamps")) {
++ viddec->genTimeStamps =
++ gst_ti_env_get_boolean("GST_TI_TIViddec_genTimeStamps");
++ GST_LOG("Setting genTimeStamps =%s\n",
++ viddec->genTimeStamps ? "TRUE" : "FALSE");
++ }
++
++ if (gst_ti_env_is_defined("GST_TI_TIViddec_frameRate")) {
++ viddec->framerateNum =
++ gst_ti_env_get_int("GST_TI_TIViddec_frameRate");
++ GST_LOG("Setting frameRate=%d\n", viddec->framerateNum);
++ }
++
++ GST_LOG("gst_tividdec_init_env - end\n");
++}
++
++
++/******************************************************************************
++ * gst_tividdec_init
++ * Initializes a new element instance, instantiates pads and sets the pad
++ * callback functions.
++ ******************************************************************************/
++static void gst_tividdec_init(GstTIViddec *viddec, GstTIViddecClass *gclass)
++{
++ /* Instantiate encoded video sink pad.
++ *
++ * Fixate on our static template caps instead of writing a getcaps
++ * function, which is overkill for this element.
++ */
++ viddec->sinkpad =
++ gst_pad_new_from_static_template(&sink_factory, "sink");
++ gst_pad_set_setcaps_function(
++ viddec->sinkpad, GST_DEBUG_FUNCPTR(gst_tividdec_set_sink_caps));
++ gst_pad_set_event_function(
++ viddec->sinkpad, GST_DEBUG_FUNCPTR(gst_tividdec_sink_event));
++ gst_pad_set_chain_function(
++ viddec->sinkpad, GST_DEBUG_FUNCPTR(gst_tividdec_chain));
++ gst_pad_fixate_caps(viddec->sinkpad,
++ gst_caps_make_writable(
++ gst_caps_copy(gst_pad_get_pad_template_caps(viddec->sinkpad))));
++
++ /* Instantiate deceoded video source pad.
++ *
++ * Fixate on our static template caps instead of writing a getcaps
++ * function, which is overkill for this element.
++ */
++ viddec->srcpad =
++ gst_pad_new_from_static_template(&src_factory, "src");
++ gst_pad_fixate_caps(viddec->srcpad,
++ gst_caps_make_writable(
++ gst_caps_copy(gst_pad_get_pad_template_caps(viddec->srcpad))));
++ gst_pad_set_query_function(viddec->srcpad,
++ GST_DEBUG_FUNCPTR(gst_tividdec_set_query_pad));
++
++ /* Add pads to TIViddec element */
++ gst_element_add_pad(GST_ELEMENT(viddec), viddec->sinkpad);
++ gst_element_add_pad(GST_ELEMENT(viddec), viddec->srcpad);
++
++ /* Initialize TIViddec state */
++ viddec->engineName = NULL;
++ viddec->codecName = NULL;
++ viddec->displayBuffer = FALSE;
++ viddec->genTimeStamps = TRUE;
++
++ viddec->hEngine = NULL;
++ viddec->hVd = NULL;
++ viddec->drainingEOS = FALSE;
++ viddec->threadStatus = 0UL;
++
++ viddec->waitOnDecodeThread = NULL;
++ viddec->waitOnDecodeDrain = NULL;
++ viddec->waitOnBufTab = NULL;
++
++ viddec->framerateNum = 0;
++ viddec->framerateDen = 0;
++
++ viddec->numOutputBufs = 0UL;
++ viddec->hOutBufTab = NULL;
++ viddec->circBuf = NULL;
++
++ viddec->sps_pps_data = NULL;
++ viddec->nal_code_prefix = NULL;
++ viddec->nal_length = 0;
++
++ viddec->segment = gst_segment_new();
++ viddec->totalDuration = 0;
++ viddec->totalBytes = 0;
++
++ gst_tividdec_init_env(viddec);
++}
++
++/******************************************************************************
++ * gst_tiauddec_set_query_pad
++ * This function reuturn stream duration and position.
++ *****************************************************************************/
++static gboolean gst_tividdec_set_query_pad(GstPad *pad, GstQuery *query)
++{
++ GstTIViddec *viddec;
++ gboolean ret = FALSE;
++
++ viddec = GST_TIVIDDEC(gst_pad_get_parent(pad));
++
++ ret = gst_ti_query_srcpad(pad, query, viddec->sinkpad,
++ viddec->totalDuration, viddec->totalBytes);
++
++ gst_object_unref(viddec);
++
++ return ret;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_set_property
++ * Set element properties when requested.
++ ******************************************************************************/
++static void gst_tividdec_set_property(GObject *object, guint prop_id,
++ const GValue *value, GParamSpec *pspec)
++{
++ GstTIViddec *viddec = GST_TIVIDDEC(object);
++
++ GST_LOG("begin set_property\n");
++
++ switch (prop_id) {
++ case PROP_ENGINE_NAME:
++ if (viddec->engineName) {
++ g_free((gpointer)viddec->engineName);
++ }
++ viddec->engineName =
++ (gchar*)g_malloc(strlen(g_value_get_string(value)) + 1);
++ strcpy((gchar *)viddec->engineName, g_value_get_string(value));
++ GST_LOG("setting \"engineName\" to \"%s\"\n", viddec->engineName);
++ break;
++ case PROP_CODEC_NAME:
++ if (viddec->codecName) {
++ g_free((gpointer)viddec->codecName);
++ }
++ viddec->codecName =
++ (gchar*)g_malloc(strlen(g_value_get_string(value)) + 1);
++ strcpy((gchar*)viddec->codecName, g_value_get_string(value));
++ GST_LOG("setting \"codecName\" to \"%s\"\n", viddec->codecName);
++ break;
++ case PROP_NUM_OUTPUT_BUFS:
++ viddec->numOutputBufs = g_value_get_int(value);
++ GST_LOG("setting \"numOutputBufs\" to \"%ld\"\n",
++ viddec->numOutputBufs);
++ break;
++ case PROP_FRAMERATE:
++ {
++ viddec->framerateNum = g_value_get_int(value);
++ viddec->framerateDen = 1;
++
++ /* If 30fps was specified, use 29.97 */
++ if (viddec->framerateNum == 30) {
++ viddec->framerateNum = 30000;
++ viddec->framerateDen = 1001;
++ }
++
++ GST_LOG("setting \"frameRate\" to \"%2.2lf\"\n",
++ (gdouble)viddec->framerateNum / (gdouble)viddec->framerateDen);
++ break;
++ }
++ case PROP_DISPLAY_BUFFER:
++ viddec->displayBuffer = g_value_get_boolean(value);
++ GST_LOG("setting \"displayBuffer\" to \"%s\"\n",
++ viddec->displayBuffer ? "TRUE" : "FALSE");
++ break;
++ case PROP_GEN_TIMESTAMPS:
++ viddec->genTimeStamps = g_value_get_boolean(value);
++ GST_LOG("setting \"genTimeStamps\" to \"%s\"\n",
++ viddec->genTimeStamps ? "TRUE" : "FALSE");
++ break;
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
++ break;
++ }
++
++ GST_LOG("end set_property\n");
++}
++
++/******************************************************************************
++ * gst_tividdec_get_property
++ * Return values for requested element property.
++ ******************************************************************************/
++static void gst_tividdec_get_property(GObject *object, guint prop_id,
++ GValue *value, GParamSpec *pspec)
++{
++ GstTIViddec *viddec = GST_TIVIDDEC(object);
++
++ GST_LOG("begin get_property\n");
++
++ switch (prop_id) {
++ case PROP_ENGINE_NAME:
++ g_value_set_string(value, viddec->engineName);
++ break;
++ case PROP_CODEC_NAME:
++ g_value_set_string(value, viddec->codecName);
++ break;
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
++ break;
++ }
++
++ GST_LOG("end get_property\n");
++}
++
++
++/******************************************************************************
++ * gst_tividdec_set_sink_caps
++ * Negotiate our sink pad capabilities.
++ ******************************************************************************/
++static gboolean gst_tividdec_set_sink_caps(GstPad *pad, GstCaps *caps)
++{
++ GstTIViddec *viddec;
++ GstStructure *capStruct;
++ const gchar *mime;
++ GstTICodec *codec = NULL;
++
++ viddec = GST_TIVIDDEC(gst_pad_get_parent(pad));
++ capStruct = gst_caps_get_structure(caps, 0);
++ mime = gst_structure_get_name(capStruct);
++
++ GST_INFO("requested sink caps: %s", gst_caps_to_string(caps));
++
++ /* Generic Video Properties */
++ if (!strncmp(mime, "video/", 6)) {
++ gint framerateNum;
++ gint framerateDen;
++
++ if (gst_structure_get_fraction(capStruct, "framerate", &framerateNum,
++ &framerateDen)) {
++ viddec->framerateNum = framerateNum;
++ viddec->framerateDen = framerateDen;
++ }
++ }
++
++ /* MPEG Decode */
++ if (!strcmp(mime, "video/mpeg")) {
++ gboolean systemstream;
++ gint mpegversion;
++
++ /* Retreive video properties */
++ if (!gst_structure_get_int(capStruct, "mpegversion", &mpegversion)) {
++ mpegversion = 0;
++ }
++
++ if (!gst_structure_get_boolean(capStruct, "systemstream",
++ &systemstream)) {
++ systemstream = FALSE;
++ }
++
++ /* Determine the correct decoder to use */
++ if (systemstream) {
++ gst_object_unref(viddec);
++ return FALSE;
++ }
++
++ if (mpegversion == 2) {
++ codec = gst_ticodec_get_codec("MPEG2 Video Decoder");
++ }
++ else if (mpegversion == 4) {
++ codec = gst_ticodec_get_codec("MPEG4 Video Decoder");
++ }
++ else {
++ gst_object_unref(viddec);
++ return FALSE;
++ }
++ }
++
++ /* H.264 Decode */
++ else if (!strcmp(mime, "video/x-h264")) {
++ codec = gst_ticodec_get_codec("H.264 Video Decoder");
++ }
++
++ /* Mime type not supported */
++ else {
++ GST_ELEMENT_ERROR(viddec, STREAM, NOT_IMPLEMENTED,
++ ("stream type not supported"), (NULL));
++ gst_object_unref(viddec);
++ return FALSE;
++ }
++
++ /* Report if the required codec was not found */
++ if (!codec) {
++ GST_ELEMENT_ERROR(viddec, STREAM, CODEC_NOT_FOUND,
++ ("unable to find codec needed for stream"), (NULL));
++ gst_object_unref(viddec);
++ return FALSE;
++ }
++
++ /* Shut-down any running video decoder */
++ if (!gst_tividdec_exit_video(viddec)) {
++ gst_object_unref(viddec);
++ return FALSE;
++ }
++
++ /* Configure the element to use the detected engine name and codec, unless
++ * they have been using the set_property function.
++ */
++ if (!viddec->engineName) {
++ viddec->engineName = codec->CE_EngineName;
++ }
++ if (!viddec->codecName) {
++ viddec->codecName = codec->CE_CodecName;
++ }
++
++ gst_object_unref(viddec);
++
++ GST_LOG("sink caps negotiation successful\n");
++ return TRUE;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_set_source_caps
++ * Negotiate our source pad capabilities.
++ ******************************************************************************/
++static gboolean gst_tividdec_set_source_caps(
++ GstTIViddec *viddec, Buffer_Handle hBuf)
++{
++ BufferGfx_Dimensions dim;
++ GstCaps *caps;
++ gboolean ret;
++ GstPad *pad;
++ char *string;
++
++ pad = viddec->srcpad;
++
++ /* Create a UYVY caps object using the dimensions from the given buffer */
++ BufferGfx_getDimensions(hBuf, &dim);
++
++ caps =
++ gst_caps_new_simple("video/x-raw-yuv",
++ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC('U','Y','V','Y'),
++ "framerate", GST_TYPE_FRACTION, viddec->framerateNum,
++ viddec->framerateDen,
++ "width", G_TYPE_INT, dim.width,
++ "height", G_TYPE_INT, dim.height,
++ NULL);
++
++ /* Set the source pad caps */
++ string = gst_caps_to_string(caps);
++ GST_LOG("setting source caps to UYVY: %s", string);
++ g_free(string);
++ ret = gst_pad_set_caps(pad, caps);
++ gst_caps_unref(caps);
++
++ return ret;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_sink_event
++ * Perform event processing on the input stream. At the moment, this
++ * function isn't needed as this element doesn't currently perform any
++ * specialized event processing. We'll leave it in for now in case we need
++ * it later on.
++ ******************************************************************************/
++static gboolean gst_tividdec_sink_event(GstPad *pad, GstEvent *event)
++{
++ GstTIViddec *viddec;
++ gboolean ret;
++
++ viddec = GST_TIVIDDEC(GST_OBJECT_PARENT(pad));
++
++ GST_DEBUG("pad \"%s\" received: %s\n", GST_PAD_NAME(pad),
++ GST_EVENT_TYPE_NAME(event));
++
++ switch (GST_EVENT_TYPE(event)) {
++
++ case GST_EVENT_NEWSEGMENT:
++ /* if event format is byte then convert in time format */
++ gst_ti_parse_newsegment(&event, viddec->segment,
++ &viddec->totalDuration, viddec->totalBytes);
++
++ /* Propagate NEWSEGMENT to downstream elements */
++ ret = gst_pad_push_event(viddec->srcpad, event);
++ break;
++
++ case GST_EVENT_EOS:
++ /* end-of-stream: process any remaining encoded frame data */
++ GST_LOG("no more input; draining remaining encoded video data\n");
++
++ if (!viddec->drainingEOS) {
++ gst_tividdec_drain_pipeline(viddec);
++ }
++
++ /* Propagate EOS to downstream elements */
++ ret = gst_pad_push_event(viddec->srcpad, event);
++ break;
++
++ case GST_EVENT_FLUSH_STOP:
++ ret = gst_pad_push_event(viddec->srcpad, event);
++ break;
++
++ /* Unhandled events */
++ case GST_EVENT_BUFFERSIZE:
++ case GST_EVENT_CUSTOM_BOTH:
++ case GST_EVENT_CUSTOM_BOTH_OOB:
++ case GST_EVENT_CUSTOM_DOWNSTREAM:
++ case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
++ case GST_EVENT_CUSTOM_UPSTREAM:
++ case GST_EVENT_FLUSH_START:
++ case GST_EVENT_NAVIGATION:
++ case GST_EVENT_QOS:
++ case GST_EVENT_SEEK:
++ case GST_EVENT_TAG:
++ default:
++ ret = gst_pad_event_default(pad, event);
++ break;
++
++ }
++
++ return ret;
++
++}
++
++/******************************************************************************
++ * gst_tividdec_chain
++ * This is the main processing routine. This function receives a buffer
++ * from the sink pad, processes it, and pushes the result to the source
++ * pad.
++ ******************************************************************************/
++static GstFlowReturn gst_tividdec_chain(GstPad * pad, GstBuffer * buf)
++{
++ GstTIViddec *viddec = GST_TIVIDDEC(GST_OBJECT_PARENT(pad));
++ GstFlowReturn flow = GST_FLOW_OK;
++ gboolean checkResult;
++
++ /* If the decode thread aborted, signal it to let it know it's ok to
++ * shut down, and communicate the failure to the pipeline.
++ */
++ if (gst_tithread_check_status(viddec, TIThread_CODEC_ABORTED,
++ checkResult)) {
++ flow = GST_FLOW_UNEXPECTED;
++ goto exit;
++ }
++
++ /* If our engine handle is currently NULL, then either this is our first
++ * buffer or the upstream element has re-negotiated our capabilities which
++ * resulted in our engine being closed. In either case, we need to
++ * initialize (or re-initialize) our video decoder to handle the new
++ * stream.
++ */
++ if (viddec->hEngine == NULL) {
++ if (!gst_tividdec_init_video(viddec)) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("unable to initialize video\n"), (NULL));
++ flow = GST_FLOW_UNEXPECTED;
++ goto exit;
++ }
++
++ /* check if we have recieved buffer from qtdemuxer. To do this,
++ * we will verify if codec_data field has a valid avcC header.
++ */
++ if (gst_is_h264_decoder(viddec->codecName) &&
++ gst_h264_valid_quicktime_header(buf)) {
++ viddec->nal_length = gst_h264_get_nal_length(buf);
++ viddec->sps_pps_data = gst_h264_get_sps_pps_data(buf);
++ viddec->nal_code_prefix = gst_h264_get_nal_prefix_code();
++ }
++
++ GST_TICIRCBUFFER_TIMESTAMP(viddec->circBuf) =
++ GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(buf)) ?
++ GST_BUFFER_TIMESTAMP(buf) : 0ULL;
++ }
++
++ /* If demuxer has passed SPS and PPS NAL unit dump in codec_data field,
++ * then we have a packetized h264 stream. We need to transform this stream
++ * into byte-stream.
++ */
++ if (viddec->sps_pps_data) {
++ if (gst_h264_parse_and_queue(viddec->circBuf, buf,
++ viddec->sps_pps_data, viddec->nal_code_prefix,
++ viddec->nal_length) < 0) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, WRITE,
++ ("Failed to queue input buffer into circular buffer\n"), (NULL));
++ flow = GST_FLOW_UNEXPECTED;
++ goto exit;
++ }
++ }
++ else {
++ /* Queue up the encoded data stream into a circular buffer */
++ if (!gst_ticircbuffer_queue_data(viddec->circBuf, buf)) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, WRITE,
++ ("Failed to queue input buffer into circular buffer\n"), (NULL));
++ flow = GST_FLOW_UNEXPECTED;
++ goto exit;
++ }
++ }
++
++exit:
++ gst_buffer_unref(buf);
++ return flow;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_init_video
++ * Initialize or re-initializes the video stream
++ ******************************************************************************/
++static gboolean gst_tividdec_init_video(GstTIViddec *viddec)
++{
++ Rendezvous_Attrs rzvAttrs = Rendezvous_Attrs_DEFAULT;
++ struct sched_param schedParam;
++ pthread_attr_t attr;
++
++ GST_LOG("begin init_video\n");
++
++ /* If video has already been initialized, shut down previous decoder */
++ if (viddec->hEngine) {
++ if (!gst_tividdec_exit_video(viddec)) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("failed to shut down existing video decoder\n"), (NULL));
++ return FALSE;
++ }
++ }
++
++ /* Make sure we know what codec we're using */
++ if (!viddec->engineName) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("engine name not specified\n"), (NULL));
++ return FALSE;
++ }
++
++ if (!viddec->codecName) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("codec name not specified\n"), (NULL));
++ return FALSE;
++ }
++
++ /* Initialize thread status management */
++ viddec->threadStatus = 0UL;
++ pthread_mutex_init(&viddec->threadStatusMutex, NULL);
++
++ /* Initialize rendezvous objects for making threads wait on conditions */
++ viddec->waitOnDecodeThread = Rendezvous_create(2, &rzvAttrs);
++ viddec->waitOnDecodeDrain = Rendezvous_create(100, &rzvAttrs);
++ viddec->waitOnBufTab = Rendezvous_create(100, &rzvAttrs);
++ viddec->drainingEOS = FALSE;
++
++ /* Initialize custom thread attributes */
++ if (pthread_attr_init(&attr)) {
++ GST_WARNING("failed to initialize thread attrs\n");
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++
++ /* Force the thread to use the system scope */
++ if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) {
++ GST_WARNING("failed to set scope attribute\n");
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++
++ /* Force the thread to use custom scheduling attributes */
++ if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) {
++ GST_WARNING("failed to set schedule inheritance attribute\n");
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++
++ /* Set the thread to be fifo real time scheduled */
++ if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO)) {
++ GST_WARNING("failed to set FIFO scheduling policy\n");
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++
++ /* Set the display thread priority */
++ schedParam.sched_priority = GstTIVideoThreadPriority;
++ if (pthread_attr_setschedparam(&attr, &schedParam)) {
++ GST_WARNING("failed to set scheduler parameters\n");
++ return FALSE;
++ }
++
++ /* Create decoder thread */
++ if (pthread_create(&viddec->decodeThread, &attr,
++ gst_tividdec_decode_thread, (void*)viddec)) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("failed to create decode thread\n"), (NULL));
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++ gst_tithread_set_status(viddec, TIThread_CODEC_CREATED);
++
++ /* Destroy the custom thread attributes */
++ if (pthread_attr_destroy(&attr)) {
++ GST_WARNING("failed to destroy thread attrs\n");
++ gst_tividdec_exit_video(viddec);
++ return FALSE;
++ }
++
++ /* Make sure circular buffer and display buffers are created by decoder
++ * thread.
++ */
++ Rendezvous_meet(viddec->waitOnDecodeThread);
++
++ if (viddec->circBuf == NULL || viddec->hOutBufTab == NULL) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("decode thread failed to create circular or display buffer handles\n"),
++ (NULL));
++ return FALSE;
++ }
++
++ GST_LOG("end init_video\n");
++ return TRUE;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_exit_video
++ * Shut down any running video decoder, and reset the element state.
++ ******************************************************************************/
++static gboolean gst_tividdec_exit_video(GstTIViddec *viddec)
++{
++ void* thread_ret;
++ gboolean checkResult;
++
++ GST_LOG("begin exit_video\n");
++
++ /* Drain the pipeline if it hasn't already been drained */
++ if (!viddec->drainingEOS) {
++ gst_tividdec_drain_pipeline(viddec);
++ }
++
++ /* Shut down the decode thread */
++ if (gst_tithread_check_status(
++ viddec, TIThread_CODEC_CREATED, checkResult)) {
++ GST_LOG("shutting down decode thread\n");
++
++ Rendezvous_force(viddec->waitOnDecodeThread);
++ if (pthread_join(viddec->decodeThread, &thread_ret) == 0) {
++ if (thread_ret == GstTIThreadFailure) {
++ GST_DEBUG("decode thread exited with an error condition\n");
++ }
++ }
++ }
++
++ /* Shut down thread status management */
++ viddec->threadStatus = 0UL;
++ pthread_mutex_destroy(&viddec->threadStatusMutex);
++
++ /* Shut-down any remaining items */
++ if (viddec->waitOnDecodeDrain) {
++ Rendezvous_delete(viddec->waitOnDecodeDrain);
++ viddec->waitOnDecodeDrain = NULL;
++ }
++
++ if (viddec->waitOnDecodeThread) {
++ Rendezvous_delete(viddec->waitOnDecodeThread);
++ viddec->waitOnDecodeThread = NULL;
++ }
++
++ if (viddec->waitOnBufTab) {
++ Rendezvous_delete(viddec->waitOnBufTab);
++ viddec->waitOnBufTab = NULL;
++ }
++
++ if (viddec->sps_pps_data) {
++ GST_LOG("freeing sps_pps buffers\n");
++ gst_buffer_unref(viddec->sps_pps_data);
++ viddec->sps_pps_data = NULL;
++ }
++
++ if (viddec->nal_code_prefix) {
++ GST_LOG("freeing nal code prefix buffers\n");
++ gst_buffer_unref(viddec->nal_code_prefix);
++ viddec->nal_code_prefix = NULL;
++ }
++
++ if (viddec->nal_length) {
++ GST_LOG("reseting nal length to zero\n");
++ viddec->nal_length = 0;
++ }
++
++ GST_LOG("end exit_video\n");
++ return TRUE;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_change_state
++ * Manage state changes for the video stream. The gStreamer documentation
++ * states that state changes must be handled in this manner:
++ * 1) Handle ramp-up states
++ * 2) Pass state change to base class
++ * 3) Handle ramp-down states
++ ******************************************************************************/
++static GstStateChangeReturn gst_tividdec_change_state(GstElement *element,
++ GstStateChange transition)
++{
++ GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
++ GstTIViddec *viddec = GST_TIVIDDEC(element);
++
++ GST_LOG("begin change_state (%d)\n", transition);
++
++ /* Handle ramp-up state changes */
++ switch (transition) {
++ case GST_STATE_CHANGE_NULL_TO_READY:
++ break;
++ default:
++ break;
++ }
++
++ /* Pass state changes to base class */
++ ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
++ if (ret == GST_STATE_CHANGE_FAILURE)
++ return ret;
++
++ /* Handle ramp-down state changes */
++ switch (transition) {
++ case GST_STATE_CHANGE_READY_TO_NULL:
++ /* Shut down any running video decoder */
++ if (!gst_tividdec_exit_video(viddec)) {
++ return GST_STATE_CHANGE_FAILURE;
++ }
++ break;
++
++ case GST_STATE_CHANGE_READY_TO_PAUSED:
++ gst_segment_init (viddec->segment, GST_FORMAT_TIME);
++ break;
++
++ case GST_STATE_CHANGE_PAUSED_TO_READY:
++ viddec->totalBytes = 0;
++ viddec->totalDuration = 0;
++ break;
++
++ default:
++ break;
++ }
++
++ GST_LOG("end change_state\n");
++ return ret;
++}
++
++/******************************************************************************
++ * gst_tividdec2_codec_start
++ * Initialize codec engine
++ *****************************************************************************/
++static gboolean gst_tividdec_codec_start (GstTIViddec *viddec)
++{
++ VIDDEC_Params params = Vdec_Params_DEFAULT;
++ VIDDEC_DynamicParams dynParams = Vdec_DynamicParams_DEFAULT;
++ BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT;
++
++ /* Open the codec engine */
++ GST_LOG("opening codec engine \"%s\"\n", viddec->engineName);
++ viddec->hEngine = Engine_open((Char *) viddec->engineName, NULL, NULL);
++
++ if (viddec->hEngine == NULL) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("failed to open codec engine \"%s\"\n", viddec->engineName), (NULL));
++ return FALSE;
++ }
++
++ /* Initialize video decoder */
++ params.forceChromaFormat = XDM_YUV_422ILE;
++ params.maxWidth = VideoStd_D1_WIDTH;
++ params.maxHeight = VideoStd_D1_PAL_HEIGHT;
++
++ GST_LOG("opening video decoder \"%s\"\n", viddec->codecName);
++ viddec->hVd = Vdec_create(viddec->hEngine, (Char*)viddec->codecName,
++ ¶ms, &dynParams);
++
++ if (viddec->hVd == NULL) {
++ GST_ELEMENT_ERROR(viddec, STREAM, CODEC_NOT_FOUND,
++ ("failed to create video decoder: %s\n", viddec->codecName), (NULL));
++ GST_LOG("closing codec engine\n");
++ return FALSE;
++ }
++
++ /* Create a circular input buffer */
++ viddec->circBuf =
++ gst_ticircbuffer_new(Vdec_getInBufSize(viddec->hVd), 3, FALSE);
++
++ if (viddec->circBuf == NULL) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, NO_SPACE_LEFT,
++ ("failed to create circular input buffer\n"), (NULL));
++ return FALSE;
++ }
++
++ /* Display buffer contents if displayBuffer=TRUE was specified */
++ gst_ticircbuffer_set_display(viddec->circBuf, viddec->displayBuffer);
++
++ /* Define the number of display buffers to allocate. This number must be
++ * at least 2, but should be more if codecs don't return a display buffer
++ * after every process call. If this has not been set via set_property(),
++ * default to 3 output buffers.
++ */
++ if (viddec->numOutputBufs == 0) {
++ viddec->numOutputBufs = 3;
++ }
++
++ /* Create codec output buffers */
++ GST_LOG("creating output buffer table\n");
++ gfxAttrs.colorSpace = ColorSpace_UYVY;
++ gfxAttrs.dim.width = params.maxWidth;
++ gfxAttrs.dim.height = params.maxHeight;
++ gfxAttrs.dim.lineLength = BufferGfx_calcLineLength(
++ gfxAttrs.dim.width, gfxAttrs.colorSpace);
++
++ /* By default, new buffers are marked as in-use by the codec */
++ gfxAttrs.bAttrs.useMask = gst_tividdec_CODEC_FREE;
++
++ viddec->hOutBufTab =
++ BufTab_create(viddec->numOutputBufs, Vdec_getOutBufSize(viddec->hVd),
++ BufferGfx_getBufferAttrs(&gfxAttrs));
++
++ if (viddec->hOutBufTab == NULL) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, NO_SPACE_LEFT,
++ ("failed to create output buffers\n"), (NULL));
++ return FALSE;
++ }
++
++ /* Tell the Vdec module that hOutBufTab will be used for display buffers */
++ Vdec_setBufTab(viddec->hVd, viddec->hOutBufTab);
++
++ return TRUE;
++}
++
++/******************************************************************************
++ * gst_tividdec2_codec_stop
++ * Release codec engine resources
++ *****************************************************************************/
++static gboolean gst_tividdec_codec_stop (GstTIViddec *viddec)
++{
++ /* Shut down remaining items */
++ if (viddec->circBuf) {
++ GstTICircBuffer *circBuf;
++
++ GST_LOG("freeing cicrular input buffer\n");
++
++ circBuf = viddec->circBuf;
++ viddec->circBuf = NULL;
++ viddec->framerateNum = 0;
++ viddec->framerateDen = 0;
++ gst_ticircbuffer_unref(circBuf);
++ }
++
++ if (viddec->hOutBufTab) {
++
++ /* Re-claim all output buffers that were pushed downstream, and then
++ * delete the BufTab.
++ */
++ gst_ti_reclaim_buffers(viddec->hOutBufTab);
++
++ GST_LOG("freeing output buffers\n");
++ BufTab_delete(viddec->hOutBufTab);
++ viddec->hOutBufTab = NULL;
++ }
++
++ if (viddec->hVd) {
++ GST_LOG("closing video decoder\n");
++ Vdec_delete(viddec->hVd);
++ viddec->hVd = NULL;
++ }
++
++ if (viddec->hEngine) {
++ GST_LOG("closing codec engine\n");
++ Engine_close(viddec->hEngine);
++ viddec->hEngine = NULL;
++ }
++
++ return TRUE;
++}
++
++/******************************************************************************
++ * gst_tividdec_decode_thread
++ * Call the video codec to process a full input buffer
++ ******************************************************************************/
++static void* gst_tividdec_decode_thread(void *arg)
++{
++ GstTIViddec *viddec = GST_TIVIDDEC(gst_object_ref(arg));
++ GstBuffer *encDataWindow = NULL;
++ Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;
++ gboolean codecFlushed = FALSE;
++ void *threadRet = GstTIThreadSuccess;
++ Buffer_Handle hDummyInputBuf = NULL;
++ Buffer_Handle hDstBuf;
++ Int32 encDataConsumed;
++ GstClockTime encDataTime;
++ GstClockTime frameDuration;
++ Buffer_Handle hEncDataWindow;
++ GstBuffer *outBuf;
++ Int bufIdx;
++ Int ret;
++
++ GST_LOG("init video decode_thread \n");
++
++ /* Initialize codec engine */
++ ret = gst_tividdec_codec_start(viddec);
++
++ /* Notify main thread that is ok to continue initialization */
++ Rendezvous_meet(viddec->waitOnDecodeThread);
++ Rendezvous_reset(viddec->waitOnDecodeThread);
++
++ if (ret == FALSE) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, FAILED,
++ ("failed to start codec\n"), (NULL));
++ goto thread_exit;
++ }
++
++ /* Calculate the duration of a single frame in this stream */
++ frameDuration = gst_tividdec_frame_duration(viddec);
++
++ /* Main thread loop */
++ while (TRUE) {
++
++ /* Obtain an encoded data frame */
++ encDataWindow = gst_ticircbuffer_get_data(viddec->circBuf);
++ encDataTime = GST_BUFFER_TIMESTAMP(encDataWindow);
++ hEncDataWindow = GST_TIDMAIBUFFERTRANSPORT_DMAIBUF(encDataWindow);
++
++ /* If we received a data frame of zero size, there is no more data to
++ * process -- exit the thread. If we weren't told that we are
++ * draining the pipeline, something is not right, so exit with an
++ * error.
++ */
++ if (GST_BUFFER_SIZE(encDataWindow) == 0) {
++ GST_LOG("no video data remains\n");
++ if (!viddec->drainingEOS) {
++ goto thread_failure;
++ }
++
++ /* When no input remains, we must flush any remaining display
++ * frames out of the codec and push them to the sink.
++ */
++ if (!codecFlushed) {
++ Vdec_flush(viddec->hVd);
++
++ /* Create a dummy input dummy buffer for the process call.
++ * After a flush the codec ignores the input buffer, but since
++ * Codec Engine still address translates the buffer, it needs
++ * to exist.
++ */
++ hEncDataWindow = hDummyInputBuf = Buffer_create(1, &bAttrs);
++ Buffer_setNumBytesUsed(hDummyInputBuf, 1);
++ codecFlushed = TRUE;
++ }
++ else {
++ Buffer_delete(hDummyInputBuf);
++ goto thread_exit;
++ }
++ }
++
++ /* Obtain a free output buffer for the decoded data */
++ /* If we are not able to find free buffer from BufTab then decoder
++ * thread will be blocked on waitOnBufTab rendezvous. And this will be
++ * woke-up by dmaitransportbuffer finalize method.
++ */
++ hDstBuf = BufTab_getFreeBuf(viddec->hOutBufTab);
++ if (hDstBuf == NULL) {
++ GST_LOG("Failed to get free buffer, waiting on bufTab\n");
++ Rendezvous_meet(viddec->waitOnBufTab);
++ hDstBuf = BufTab_getFreeBuf(viddec->hOutBufTab);
++
++ if (hDstBuf == NULL) {
++ GST_ELEMENT_ERROR(viddec, RESOURCE, READ,
++ ("failed to get a free contiguous buffer from BufTab\n"),
++ (NULL));
++ goto thread_failure;
++ }
++ }
++
++ /* Reset waitOnBufTab rendezvous handle to its orignal state */
++ Rendezvous_reset(viddec->waitOnBufTab);
++
++ /* Make sure the whole buffer is used for output */
++ BufferGfx_resetDimensions(hDstBuf);
++
++ /* Invoke the video decoder */
++ GST_LOG("invoking the video decoder\n");
++ ret = Vdec_process(viddec->hVd, hEncDataWindow, hDstBuf);
++ encDataConsumed = (codecFlushed) ? 0 :
++ Buffer_getNumBytesUsed(hEncDataWindow);
++
++ if (ret < 0) {
++ GST_ELEMENT_ERROR(viddec, STREAM, DECODE,
++ ("failed to decode video buffer\n"), (NULL));
++ goto thread_failure;
++ }
++
++ /* If no encoded data was used we cannot find the next frame */
++ if (ret == Dmai_EBITERROR && encDataConsumed == 0 && !codecFlushed) {
++ GST_ELEMENT_ERROR(viddec, STREAM, DECODE,
++ ("fatal bit error\n"), (NULL));
++ goto thread_failure;
++ }
++
++ if (ret > 0) {
++ GST_LOG("Vdec_process returned success code %d\n", ret);
++ }
++
++ /* Release the reference buffer, and tell the circular buffer how much
++ * data was consumed.
++ */
++ ret = gst_ticircbuffer_data_consumed(viddec->circBuf, encDataWindow,
++ encDataConsumed);
++ encDataWindow = NULL;
++
++ if (!ret) {
++ goto thread_failure;
++ }
++
++ /* Obtain the display buffer returned by the codec (it may be a
++ * different one than the one we passed it.
++ */
++ hDstBuf = Vdec_getDisplayBuf(viddec->hVd);
++
++ /* Increment total bytes recieved */
++ viddec->totalBytes += encDataConsumed;
++
++ /* If we were given back decoded frame, push it to the source pad */
++ while (hDstBuf) {
++
++ /* Set the source pad capabilities based on the decoded frame
++ * properties.
++ */
++ gst_tividdec_set_source_caps(viddec, hDstBuf);
++
++ /* Create a DMAI transport buffer object to carry a DMAI buffer to
++ * the source pad. The transport buffer knows how to release the
++ * buffer for re-use in this element when the source pad calls
++ * gst_buffer_unref().
++ */
++ outBuf = gst_tidmaibuffertransport_new(hDstBuf,
++ viddec->waitOnBufTab);
++ gst_buffer_set_data(outBuf, GST_BUFFER_DATA(outBuf),
++ gst_ti_correct_display_bufSize(hDstBuf));
++ gst_buffer_set_caps(outBuf, GST_PAD_CAPS(viddec->srcpad));
++
++ /* Set output buffer timestamp */
++ if (viddec->genTimeStamps) {
++ GST_BUFFER_TIMESTAMP(outBuf) = viddec->totalDuration;
++ GST_BUFFER_DURATION(outBuf) = frameDuration;
++ viddec->totalDuration += GST_BUFFER_DURATION(outBuf);
++ }
++ else {
++ GST_BUFFER_TIMESTAMP(outBuf) = GST_CLOCK_TIME_NONE;
++ }
++
++ /* Tell circular buffer how much time we consumed */
++ gst_ticircbuffer_time_consumed(viddec->circBuf, frameDuration);
++
++ /* Push the transport buffer to the source pad */
++ GST_LOG("pushing buffer to source pad with timestamp : %"
++ GST_TIME_FORMAT ", duration: %" GST_TIME_FORMAT,
++ GST_TIME_ARGS (GST_BUFFER_TIMESTAMP(outBuf)),
++ GST_TIME_ARGS (GST_BUFFER_DURATION(outBuf)));
++
++ if (gst_pad_push(viddec->srcpad, outBuf) != GST_FLOW_OK) {
++ GST_DEBUG("push to source pad failed\n");
++ goto thread_failure;
++ }
++
++ /* Release buffers no longer in use by the codec */
++ Buffer_freeUseMask(hDstBuf, gst_tividdec_CODEC_FREE);
++
++ hDstBuf = Vdec_getDisplayBuf(viddec->hVd);
++ }
++ }
++
++thread_failure:
++
++ gst_tithread_set_status(viddec, TIThread_CODEC_ABORTED);
++ gst_ticircbuffer_consumer_aborted(viddec->circBuf);
++ threadRet = GstTIThreadFailure;
++
++thread_exit:
++
++ /* Re-claim any buffers owned by the codec */
++ bufIdx = BufTab_getNumBufs(viddec->hOutBufTab);
++
++ while (bufIdx-- > 0) {
++ Buffer_Handle hBuf = BufTab_getBuf(viddec->hOutBufTab, bufIdx);
++ Buffer_freeUseMask(hBuf, gst_tividdec_CODEC_FREE);
++ }
++
++ /* Release the last buffer we retrieved from the circular buffer */
++ if (encDataWindow) {
++ gst_ticircbuffer_data_consumed(viddec->circBuf, encDataWindow, 0);
++ }
++
++ /* We have to wait to shut down this thread until we can guarantee that
++ * no more input buffers will be queued into the circular buffer
++ * (we're about to delete it).
++ */
++ Rendezvous_meet(viddec->waitOnDecodeThread);
++ Rendezvous_reset(viddec->waitOnDecodeThread);
++
++ /* Notify main thread that we are done draining before we shutdown the
++ * codec, or we will hang. We proceed in this order so the EOS event gets
++ * propagated downstream before we attempt to shut down the codec. The
++ * codec-shutdown process will block until all BufTab buffers have been
++ * released, and downstream-elements may hang on to buffers until
++ * they get the EOS.
++ */
++ Rendezvous_force(viddec->waitOnDecodeDrain);
++
++ /* Stop codec engine */
++ if (gst_tividdec_codec_stop(viddec) < 0) {
++ GST_ERROR("failed to stop codec\n");
++ }
++
++ gst_object_unref(viddec);
++
++ GST_LOG("exit video decode_thread (%d)\n", (int)threadRet);
++ return threadRet;
++}
++
++
++/******************************************************************************
++ * gst_tividdec_drain_pipeline
++ * Wait for the decode thread to finish processing queued input data.
++ ******************************************************************************/
++static void gst_tividdec_drain_pipeline(GstTIViddec *viddec)
++{
++ gboolean checkResult;
++
++ /* If the decode thread hasn't been created, there is nothing to drain */
++ if (!gst_tithread_check_status(
++ viddec, TIThread_CODEC_CREATED, checkResult)) {
++ return;
++ }
++
++ viddec->drainingEOS = TRUE;
++ gst_ticircbuffer_drain(viddec->circBuf, TRUE);
++
++ /* Tell the decode thread that it is ok to shut down */
++ Rendezvous_force(viddec->waitOnDecodeThread);
++
++ /* Wait for the decoder to finish draining */
++ Rendezvous_meet(viddec->waitOnDecodeDrain);
++}
++
++
++/******************************************************************************
++ * gst_tividdec_frame_duration
++ * Return the duration of a single frame in nanoseconds.
++ ******************************************************************************/
++static GstClockTime gst_tividdec_frame_duration(GstTIViddec *viddec)
++{
++ /* Default to 29.97 if the frame rate was not specified */
++ if (viddec->framerateNum == 0 && viddec->framerateDen == 0) {
++ GST_WARNING("framerate not specified; using 29.97fps");
++ viddec->framerateNum = 30000;
++ viddec->framerateDen = 1001;
++ }
++
++ return (GstClockTime)
++ ((1 / ((gdouble)viddec->framerateNum/(gdouble)viddec->framerateDen))
++ * GST_SECOND);
++}
++
++
++/******************************************************************************
++ * Custom ViM Settings for editing this file
++ ******************************************************************************/
++#if 0
++ Tabs (use 4 spaces for indentation)
++ vim:set tabstop=4: /* Use 4 spaces for tabs */
++ vim:set shiftwidth=4: /* Use 4 spaces for >> operations */
++ vim:set expandtab: /* Expand tabs into white spaces */
++#endif
+diff -rupN a/src/gsttividenc1.c b/src/gsttividenc1.c
+--- a/src/gsttividenc1.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttividenc1.c 2010-09-16 12:44:32.000000000 -0700
+@@ -129,6 +129,11 @@ static GstStaticPadTemplate sink_factory
+ "framerate=(fraction)[ 0, MAX ], "
+ "width=(int)[ 1, MAX ], "
+ "height=(int)[ 1, MAX ];"
++ "video/x-raw-yuv, " /* NV16 - YUV422 semi planar */
++ "format=(fourcc)NV16, "
++ "framerate=(fraction)[ 0, MAX ], "
++ "width=(int)[ 1, MAX ], "
++ "height=(int)[ 1, MAX ];"
+ "video/x-raw-yuv, " /* NV12 - YUV420 semi planar */
+ "format=(fourcc)NV12, "
+ "framerate=(fraction)[ 0, MAX ], "
+@@ -286,7 +291,7 @@ static void gst_tividenc1_class_init(Gst
+
+ g_object_class_install_property(gobject_class, PROP_IN_COLORSPACE,
+ g_param_spec_string("iColorSpace", "Input colorspace",
+- "Input color space (UYVY, Y8C8 or NV12)",
++ "Input color space (UYVY, Y8C8, NV16 or NV12)",
+ "unspecified", G_PARAM_READWRITE));
+
+ g_object_class_install_property(gobject_class, PROP_BITRATE,
+@@ -435,6 +440,8 @@ static ColorSpace_Type gst_tividenc1_fin
+ {
+ if (!strcmp(colorSpace, "UYVY"))
+ return ColorSpace_UYVY;
++ else if (!strcmp(colorSpace, "NV16"))
++ return ColorSpace_YUV422PSEMI;
+ else if (!strcmp(colorSpace, "Y8C8"))
+ return ColorSpace_YUV422PSEMI;
+ else if (!strcmp(colorSpace, "NV12"))
+@@ -634,6 +641,7 @@ static gboolean gst_tividenc1_set_sink_c
+ videnc1->colorSpace = ColorSpace_UYVY;
+ break;
+
++ case GST_MAKE_FOURCC('N', 'V', '1', '6'):
+ case GST_MAKE_FOURCC('Y', '8', 'C', '8'):
+ videnc1->colorSpace = ColorSpace_YUV422PSEMI;
+ break;
+@@ -685,11 +693,14 @@ static gboolean gst_tividenc1_set_source
+ gboolean ret;
+ GstPad *pad;
+ char *string;
+- GstTICodec *h264Codec = NULL, *mpeg4Codec = NULL;
+-
++ GstTICodec *h264Codec = NULL;
++ GstTICodec *mpeg4Codec = NULL;
++ GstTICodec *mpeg2Codec = NULL;
++
+ h264Codec = gst_ticodec_get_codec("H.264 Video Encoder");
+ mpeg4Codec = gst_ticodec_get_codec("MPEG4 Video Encoder");
+-
++ mpeg2Codec = gst_ticodec_get_codec("MPEG2 Video Encoder");
++
+ pad = videnc1->srcpad;
+
+ /* Create a video caps object using the dimensions from the given buffer */
+@@ -728,6 +739,25 @@ static gboolean gst_tividenc1_set_source
+ g_free(string);
+ }
+
++ /* Create MPEG-2 source cap */
++ if (mpeg2Codec && (!strcmp(mpeg2Codec->CE_CodecName, videnc1->codecName))) {
++ gint mpegversion = 2;
++
++ caps =
++ gst_caps_new_simple("video/mpeg",
++ "mpegversion", G_TYPE_INT, mpegversion,
++ "framerate", GST_TYPE_FRACTION, videnc1->framerateNum,
++ videnc1->framerateDen,
++ "width", G_TYPE_INT, dim.width,
++ "height", G_TYPE_INT, dim.height,
++ NULL);
++
++ string = gst_caps_to_string(caps);
++ GST_LOG("setting source caps to mpeg2: %s", string);
++ g_free(string);
++ }
++
++
+ /* Set the source pad caps */
+ ret = gst_pad_set_caps(pad, caps);
+ gst_caps_unref(caps);
+@@ -1438,6 +1468,12 @@ static gboolean gst_tividenc1_codec_star
+ #if defined(Platform_omap3530)
+ case Cpu_Device_OMAP3530:
+ #endif
++ #if defined(Platform_omapl138)
++ case Cpu_Device_OMAPL138:
++ #endif
++ #if defined(Platform_omapl137)
++ case Cpu_Device_OMAPL137:
++ #endif
+ case Cpu_Device_DM6446:
+ params.inputChromaFormat = XDM_YUV_422ILE;
+ break;
+diff -rupN a/src/gsttividresize.c b/src/gsttividresize.c
+--- a/src/gsttividresize.c 2009-10-29 15:01:23.000000000 -0700
++++ b/src/gsttividresize.c 2010-09-16 12:25:09.000000000 -0700
+@@ -90,6 +90,7 @@ static GstStaticPadTemplate sink_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ( GST_VIDEO_CAPS_YUV("UYVY")";"
++ GST_VIDEO_CAPS_YUV("NV16")";"
+ GST_VIDEO_CAPS_YUV("Y8C8")";"
+ GST_VIDEO_CAPS_YUV("NV12")
+ )
+@@ -101,6 +102,7 @@ static GstStaticPadTemplate src_factory
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS
+ ( GST_VIDEO_CAPS_YUV("UYVY")";"
++ GST_VIDEO_CAPS_YUV("NV16")";"
+ GST_VIDEO_CAPS_YUV("Y8C8")";"
+ GST_VIDEO_CAPS_YUV("NV12")
+ )
+@@ -583,6 +585,7 @@ static GstCaps * gst_tividresize_transfo
+ int i;
+ static const guint32 supported_fmt[] = {
+ GST_MAKE_FOURCC('U','Y','V','Y'),
++ GST_MAKE_FOURCC('N','V','1','6'),
+ GST_MAKE_FOURCC('Y','8','C','8'),
+ GST_MAKE_FOURCC('N','V','1','2'),
+ };
+@@ -649,6 +652,7 @@ ColorSpace_Type gst_tividresize_get_colo
+ switch (fourcc) {
+ case GST_MAKE_FOURCC('U', 'Y', 'V', 'Y'):
+ return ColorSpace_UYVY;
++ case GST_MAKE_FOURCC('N', 'V', '1', '6'):
+ case GST_MAKE_FOURCC('Y', '8', 'C', '8'):
+ return ColorSpace_YUV422PSEMI;
+ case GST_MAKE_FOURCC('N', 'V', '1', '2'):
+diff -rupN a/src/Makefile.am b/src/Makefile.am
+--- a/src/Makefile.am 2009-10-20 13:15:34.000000000 -0700
++++ b/src/Makefile.am 2010-09-16 12:48:03.000000000 -0700
+@@ -1,6 +1,6 @@
+ # plugindir is set in configure
+
+-XDC_CONFIG_BASENAME = gstticodecplugin_$(PLATFORM)
++XDC_CONFIG_BASENAME = gstticodecplugin_$(GST_TI_PLATFORM)
+ plugin_LTLIBRARIES = libgstticodecplugin.la
+
+ # sources used to compile this plug-in
+@@ -21,7 +21,7 @@ BUILT_SOURCES = $(XDC_CONFIG_BASENAME)/c
+ XDC_PATH = .;$(XDC_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/packages;$(XDAIS_INSTALL_DIR)/packages;$(CODEC_INSTALL_DIR)/packages;$(CMEM_INSTALL_DIR)/packages;$(DMAI_INSTALL_DIR)/packages;$(LPM_INSTALL_DIR)/packages;$(XDC_USER_PATH);$(EDMA3_LLD_INSTALL_DIR)/packages;
+
+ gstticodecs_platform.c :
+- ln -s $(srcdir)/gstticodecs_$(PLATFORM).c gstticodecs_platform.c
++ ln -s $(srcdir)/gstticodecs_$(GST_TI_PLATFORM).c gstticodecs_platform.c
+
+ %/compiler.opt %/linker.cmd : %.cfg
+ XDCPATH="$(XDC_PATH)" $(CONFIGURO) -c $(MVTOOL_DIR) -o $(XDC_CONFIG_BASENAME) -t $(XDC_TARGET) -p $(XDC_PLATFORM) -b $(DMAI_INSTALL_DIR)/packages/config.bld $<
diff --git a/package/ti/ti-gst-plugin/ti-gst-plugin.mk b/package/ti/ti-gst-plugin/ti-gst-plugin.mk
new file mode 100644
index 0000000..170e402
--- /dev/null
+++ b/package/ti/ti-gst-plugin/ti-gst-plugin.mk
@@ -0,0 +1,87 @@
+################################################################################
+#
+# ti-gst-plugin
+#
+################################################################################
+
+TI_GST_PLUGIN_VERSION:=1.01.00
+TI_GST_PLUGIN_SOURCE:=gst-ti-plugin-minimal-$(TI_GST_PLUGIN_VERSION).tar.gz
+TI_GST_PLUGIN_SITE:=https://gforge.ti.com/gf/download/frsrelease/211/2821/
+TI_GST_PLUGIN_DIR:=$(BUILD_DIR)/gst-ti-plugin-minimal-$(TI_GST_PLUGIN_VERSION)
+
+TI_GST_PLUGIN_LIBTOOL_PATCH = NO
+TI_GST_PLUGIN_DEPENDENCIES = gstreamer gst-plugins-base
+
+TI_GST_PLUGIN_PLATFORM=UNDEFINED
+TI_GST_PLUGIN_XDC_PLATFORM=UNDEFINED
+ifeq ($(BR2_PACKAGE_TI_PLATFORM_omap3),y)
+ TI_GST_PLUGIN_PLATFORM=omap3530
+ TI_GST_PLUGIN_XDC_PLATFORM=ti.platforms.evm3530
+ TI_GST_PLUGIN_DEPENDENCIES += ti-codecs-omap3 ti-dmai
+ TI_GST_PLUGIN_ENV = \
+ PLATFORM=$(TI_GST_PLUGIN_PLATFORM) \
+ GST_TI_PLATFORM=$(TI_GST_PLUGIN_PLATFORM) \
+ XDC_PLATFORM=$(TI_GST_PLUGIN_XDC_PLATFORM) \
+ XDC_TARGET="gnu.targets.arm.GCArmv5T" \
+ CROSS_COMPILE=$(TARGET_CROSS) \
+ MVTOOL_DIR=$(dir $(TARGET_CROSS)) \
+ LINK_XDC_ROOT=$(TI_DSPLINK_INSTALL_STAGING_DIR) \
+ CODEC_SERVER=$(TI_CODECS_OMAP3_INSTALL_TARGET_DIR)/cs.x64P \
+ XDC_INSTALL_DIR=$(TI_XDCTOOLS_INSTALL_DIR) \
+ LINK_INSTALL_DIR=$(TI_DSPLINK_INSTALL_STAGING_DIR)/.. \
+ FC_INSTALL_DIR=$(TI_FRAMEWORK_COMPONENTS_INSTALL_DIR) \
+ CE_INSTALL_DIR=$(TI_CODEC_ENGINE_DIR) \
+ XDAIS_INSTALL_DIR=$(TI_XDAIS_INSTALL_DIR) \
+ CMEM_INSTALL_DIR=$(TI_LINUXUTILS_INSTALL_STAGING_DIR) \
+ DMAI_INSTALL_DIR=$(TI_DMAI_INSTALL_STAGING_DIR)/dmai \
+ LPM_INSTALL_DIR=$(TI_LOCAL_POWER_MANAGER_INSTALL_STAGING_DIR) \
+ EDMA3_LLD_INSTALL_DIR=$(TI_EDMA3LLD_INSTALL_DIR) \
+ CODEC_INSTALL_DIR=$(TI_CODECS_OMAP3_INSTALL_STAGING_DIR) \
+ BIOSUTILS_INSTALL_DIR=$(TI_BIOSUTILS_INSTALL_DIR) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LINUXKERNEL_INSTALL_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION)
+endif
+ifeq ($(BR2_PACKAGE_TI_PLATFORM_dm365),y)
+ TI_GST_PLUGIN_PLATFORM=dm365
+ TI_GST_PLUGIN_XDC_PLATFORM=ti.platforms.evmDM365
+ TI_GST_PLUGIN_DEPENDENCIES += ti-dvsdk-dm365
+ TI_GST_PLUGIN_ENV = \
+ PLATFORM=$(TI_GST_PLUGIN_PLATFORM) \
+ GST_TI_PLATFORM=$(TI_GST_PLUGIN_PLATFORM) \
+ XDC_PLATFORM=$(TI_GST_PLUGIN_XDC_PLATFORM) \
+ XDC_TARGET="gnu.targets.arm.GCArmv5T" \
+ CROSS_COMPILE=$(TARGET_CROSS) \
+ MVTOOL_DIR=$(dir $(TARGET_CROSS))/.. \
+ LINK_XDC_ROOT=$(TI_DVSDK_DM365_DM365MM_MODULE_INSTALL_DIR) \
+ CODEC_SERVER=/usr/lib/ti-codecs\
+ XDC_INSTALL_DIR=$(TI_DVSDK_DM365_XDC_INSTALL_DIR) \
+ LINK_INSTALL_DIR=$(TI_DVSDK_DM365_DM365MM_MODULE_INSTALL_DIR)\
+ FC_INSTALL_DIR=$(TI_DVSDK_DM365_FC_INSTALL_DIR) \
+ CE_INSTALL_DIR=$(TI_DVSDK_DM365_CE_INSTALL_DIR) \
+ XDAIS_INSTALL_DIR=$(TI_DVSDK_DM365_XDAIS_INSTALL_DIR) \
+ CMEM_INSTALL_DIR=$(TI_DVSDK_DM365_LINUXUTILS_INSTALL_DIR) \
+ DMAI_INSTALL_DIR=$(TI_DVSDK_DM365_DMAI_INSTALL_DIR) \
+ LPM_INSTALL_DIR=$(TI_DVSDK_DM365_DM365MM_MODULE_INSTALL_DIR) \
+ EDMA3_LLD_INSTALL_DIR=$(TI_EDMA3LLD_INSTALL_DIR) \
+ CODEC_INSTALL_DIR=$(TI_DVSDK_DM365_CODEC_INSTALL_DIR) \
+ BIOSUTILS_INSTALL_DIR= \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LINUXKERNEL_INSTALL_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION)
+endif
+
+
+TI_GST_PLUGIN_CONF_ENV+=$(TI_GST_PLUGIN_ENV)
+TI_GST_PLUGIN_MAKE_ENV+=$(TI_GST_PLUGIN_ENV) CPPFLAGS='-DPlatform_$(TI_GST_PLUGIN_PLATFORM)'
+
+define TI_GST_PLUGIN_AUTOGEN
+ (cd $(TI_GST_PLUGIN_DIR); \
+ chmod +x ./autogen.sh; \
+ chmod +x ./gst-autogen.sh; \
+ $(HOST_CONFIGURE_OPTS) AUTOGEN_CONFIGURE_ARGS=--version ./autogen.sh; \
+ $(HOST_CONFIGURE_OPTS) AUTOGEN_CONFIGURE_ARGS=--version ./gst-autogen.sh \
+ )
+endef
+
+TI_GST_PLUGIN_POST_PATCH_HOOKS+=TI_GST_PLUGIN_AUTOGEN
+
+$(eval $(call AUTOTARGETS,package/ti,ti-gst-plugin))
--
1.7.0.4
More information about the buildroot
mailing list