Changed a way to use device memory.
authorKitae Kim <kt920.kim@samsung.com>
Fri, 21 Jun 2013 12:11:41 +0000 (21:11 +0900)
committerKitae Kim <kt920.kim@samsung.com>
Fri, 21 Jun 2013 13:10:04 +0000 (22:10 +0900)
- reduced memcpy overhead on guest to improve performance.
- use device memory as output buffer without copying data during decoding codec.

Change-Id: Ib9a778c79a8eb32378ab22c6324702f801b44a0c
Signed-off-by: Kitae Kim <kt920.kim@samsung.com>
13 files changed:
config.log [deleted file]
packaging/gst-plugins-emulator.changes [new file with mode: 0644]
packaging/gst-plugins-emulator.manifest [new file with mode: 0644]
packaging/gst-plugins-emulator.spec [new file with mode: 0644]
src/gstemul.c
src/gstemulapi.c
src/gstemulapi.h
src/gstemulapi2.c
src/gstemulcommon.h
src/gstemuldev.c
src/gstemuldev.h
src/gstemulnewdec.c
src/gstemulutils.c

diff --git a/config.log b/config.log
deleted file mode 100644 (file)
index 0eaebd4..0000000
+++ /dev/null
@@ -1,613 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by my-plugin-package configure 0.10.0, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
-
-  $ ./configure 
-
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = kt-score
-uname -m = i686
-uname -r = 3.2.0-40-generic-pae
-uname -s = Linux
-uname -v = #64-Ubuntu SMP Mon Mar 25 21:44:41 UTC 2013
-
-/usr/bin/uname -p = unknown
-/bin/uname -X     = unknown
-
-/bin/arch              = unknown
-/usr/bin/arch -k       = unknown
-/usr/convex/getsysinfo = unknown
-/usr/bin/hostinfo      = unknown
-/bin/machine           = unknown
-/usr/bin/oslevel       = unknown
-/bin/universe          = unknown
-
-PATH: /usr/lib/ccache
-PATH: /sb2/wrappers
-PATH: /sb2/scripts
-PATH: /home/kt/.scratchbox2/sbs-i386_home_kt_sbs/bin
-PATH: /home/kt/sbs-install/bin
-PATH: /home/kt/sbs-install/bin
-PATH: /bin
-PATH: /usr/lib/lightdm/lightdm
-PATH: /usr/local/sbin
-PATH: /usr/local/bin
-PATH: /usr/sbin
-PATH: /usr/bin
-PATH: /sbin
-PATH: /bin
-PATH: /usr/games
-PATH: /home/kt/tizen-sdk/tools
-PATH: /usr/local/sbin
-PATH: /usr/sbin
-PATH: /sbin
-PATH: /sbin
-PATH: /usr/sbin
-PATH: /home/kt/sbs/target-i386/bin
-PATH: /home/kt/sbs/target-i386/usr/bin
-PATH: /home/kt/sbs/target-i386/usr/local/bin
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-configure:2289: checking for a BSD-compatible install
-configure:2357: result: /usr/bin/install -c
-configure:2368: checking whether build environment is sane
-configure:2418: result: yes
-configure:2559: checking for a thread-safe mkdir -p
-configure:2598: result: /bin/mkdir -p
-configure:2611: checking for gawk
-configure:2627: found /usr/bin/gawk
-configure:2638: result: gawk
-configure:2649: checking whether make sets $(MAKE)
-configure:2671: result: yes
-configure:2753: checking whether to disable maintainer-specific portions of Makefiles
-configure:2762: result: yes
-configure:2824: checking for gcc
-configure:2840: found /usr/lib/ccache/gcc
-configure:2851: result: gcc
-configure:3080: checking for C compiler version
-configure:3089: gcc --version >&5
-gcc (SLP 4.5.3-1ubuntu2slp2+s1) 4.5.3
-Copyright (C) 2010 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:3100: $? = 0
-configure:3089: gcc -v >&5
-Using built-in specs.
-Reading specs from /home/kt/sbs-install/share/scratchbox2/../../share/scratchbox2/modeconf/gcc-specs.slp2
-rename spec cpp to old_cpp
-rename spec cc1_options to old_cc1_options
-rename spec link_libgcc to old_link_libgcc
-COLLECT_GCC=/home/kt/sbs/tools/usr/bin/gcc
-COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.5.3/lto-wrapper
-Target: i486-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='SLP 4.5.3-1ubuntu2slp2+s1' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib --enable-nls --disable-bootstrap --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
-Thread model: posix
-... rest of stderr output deleted ...
-configure:3100: $? = 0
-configure:3089: gcc -V >&5
-/home/kt/sbs/tools/usr/bin/gcc: error trying to exec '/home/kt/sbs/tools/usr/bin/i486-linux-gnu-gcc--specs=/home/kt/sbs-install/share/scratchbox2/../../share/scratchbox2/modeconf/gcc-specs.slp2': execvp: No such file or directory
-configure:3100: $? = 0
-configure:3089: gcc -qversion >&5
-gcc: unrecognized option '-qversion'
-gcc: no input files
-configure:3100: $? = 1
-configure:3120: checking whether the C compiler works
-configure:3142: gcc -Wall   conftest.c  >&5
-configure:3146: $? = 0
-configure:3194: result: yes
-configure:3197: checking for C compiler default output file name
-configure:3199: result: a.out
-configure:3205: checking for suffix of executables
-configure:3212: gcc -o conftest -Wall   conftest.c  >&5
-configure:3216: $? = 0
-configure:3238: result: 
-configure:3260: checking whether we are cross compiling
-configure:3268: gcc -o conftest -Wall   conftest.c  >&5
-configure:3272: $? = 0
-configure:3279: ./conftest
-configure:3283: $? = 0
-configure:3298: result: no
-configure:3303: checking for suffix of object files
-configure:3325: gcc -c -Wall  conftest.c >&5
-configure:3329: $? = 0
-configure:3350: result: o
-configure:3354: checking whether we are using the GNU C compiler
-configure:3373: gcc -c -Wall  conftest.c >&5
-configure:3373: $? = 0
-configure:3382: result: yes
-configure:3391: checking whether gcc accepts -g
-configure:3411: gcc -c -g  conftest.c >&5
-configure:3411: $? = 0
-configure:3452: result: yes
-configure:3469: checking for gcc option to accept ISO C89
-configure:3533: gcc  -c -Wall  conftest.c >&5
-configure:3533: $? = 0
-configure:3546: result: none needed
-configure:3577: checking for style of include used by make
-configure:3605: result: GNU
-configure:3630: checking dependency style of gcc
-configure:3740: result: gcc3
-configure:3786: checking build system type
-configure:3800: result: i686-pc-linux-gnu
-configure:3820: checking host system type
-configure:3833: result: i686-pc-linux-gnu
-configure:3853: checking for a sed that does not truncate output
-configure:3917: result: /bin/sed
-configure:3935: checking for grep that handles long lines and -e
-configure:3993: result: /bin/grep
-configure:3998: checking for egrep
-configure:4060: result: /bin/grep -E
-configure:4065: checking for fgrep
-configure:4127: result: /bin/grep -F
-configure:4162: checking for ld used by gcc
-configure:4229: result: /usr/bin/ld
-configure:4236: checking if the linker (/usr/bin/ld) is GNU ld
-configure:4251: result: yes
-configure:4263: checking for BSD- or MS-compatible name lister (nm)
-configure:4312: result: /usr/bin/nm -B
-configure:4430: checking the name lister (/usr/bin/nm -B) interface
-configure:4437: gcc -c -Wall  conftest.c >&5
-configure:4440: /usr/bin/nm -B "conftest.o"
-configure:4443: output
-00000000 B some_variable
-configure:4450: result: BSD nm
-configure:4453: checking whether ln -s works
-configure:4457: result: yes
-configure:4465: checking the maximum length of command line arguments
-configure:4585: result: 1572864
-configure:4602: checking whether the shell understands some XSI constructs
-configure:4612: result: yes
-configure:4616: checking whether the shell understands "+="
-configure:4622: result: yes
-configure:4657: checking for /usr/bin/ld option to reload object files
-configure:4664: result: -r
-configure:4733: checking for objdump
-configure:4749: found /usr/bin/objdump
-configure:4760: result: objdump
-configure:4792: checking how to recognize dependent libraries
-configure:4988: result: pass_all
-configure:5048: checking for ar
-configure:5064: found /usr/bin/ar
-configure:5075: result: ar
-configure:5153: checking for strip
-configure:5169: found /usr/bin/strip
-configure:5180: result: strip
-configure:5252: checking for ranlib
-configure:5268: found /usr/bin/ranlib
-configure:5279: result: ranlib
-configure:5369: checking command to parse /usr/bin/nm -B output from gcc object
-configure:5487: gcc -c -Wall  conftest.c >&5
-configure:5490: $? = 0
-configure:5494: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[  ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm
-configure:5497: $? = 0
-configure:5551: gcc -o conftest -Wall   conftest.c conftstm.o >&5
-configure:5554: $? = 0
-configure:5592: result: ok
-configure:6401: checking how to run the C preprocessor
-configure:6432: gcc -E  conftest.c
-configure:6432: $? = 0
-configure:6446: gcc -E  conftest.c
-conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:6446: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "my-plugin-package"
-| #define PACKAGE_TARNAME "my-plugin-package"
-| #define PACKAGE_VERSION "0.10.0"
-| #define PACKAGE_STRING "my-plugin-package 0.10.0"
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| #define PACKAGE "my-plugin-package"
-| #define VERSION "0.10.0"
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:6471: result: gcc -E
-configure:6491: gcc -E  conftest.c
-configure:6491: $? = 0
-configure:6505: gcc -E  conftest.c
-conftest.c:11:28: fatal error: ac_nonexistent.h: No such file or directory
-compilation terminated.
-configure:6505: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME "my-plugin-package"
-| #define PACKAGE_TARNAME "my-plugin-package"
-| #define PACKAGE_VERSION "0.10.0"
-| #define PACKAGE_STRING "my-plugin-package 0.10.0"
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| #define PACKAGE "my-plugin-package"
-| #define VERSION "0.10.0"
-| /* end confdefs.h.  */
-| #include <ac_nonexistent.h>
-configure:6534: checking for ANSI C header files
-configure:6554: gcc -c -Wall  conftest.c >&5
-configure:6554: $? = 0
-configure:6627: gcc -o conftest -Wall   conftest.c  >&5
-configure:6627: $? = 0
-configure:6627: ./conftest
-configure:6627: $? = 0
-configure:6638: result: yes
-configure:6651: checking for sys/types.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for sys/stat.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for stdlib.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for string.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for memory.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for strings.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for inttypes.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for stdint.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6651: checking for unistd.h
-configure:6651: gcc -c -Wall  conftest.c >&5
-configure:6651: $? = 0
-configure:6651: result: yes
-configure:6665: checking for dlfcn.h
-configure:6665: gcc -c -Wall  conftest.c >&5
-configure:6665: $? = 0
-configure:6665: result: yes
-configure:6849: checking for objdir
-configure:6864: result: .libs
-configure:7156: checking if gcc supports -fno-rtti -fno-exceptions
-configure:7174: gcc -c -Wall  -fno-rtti -fno-exceptions conftest.c >&5
-cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
-cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
-configure:7178: $? = 0
-configure:7191: result: no
-configure:7211: checking for gcc option to produce PIC
-configure:7483: result: -fPIC -DPIC
-configure:7495: checking if gcc PIC flag -fPIC -DPIC works
-configure:7513: gcc -c -Wall  -fPIC -DPIC -DPIC conftest.c >&5
-configure:7517: $? = 0
-configure:7530: result: yes
-configure:7554: checking if gcc static flag -static works
-configure:7582: result: yes
-configure:7597: checking if gcc supports -c -o file.o
-configure:7618: gcc -c -Wall  -o out/conftest2.o conftest.c >&5
-configure:7622: $? = 0
-configure:7644: result: yes
-configure:7652: checking if gcc supports -c -o file.o
-configure:7699: result: yes
-configure:7732: checking whether the gcc linker (/usr/bin/ld) supports shared libraries
-configure:8723: result: yes
-configure:8760: checking whether -lc should be explicitly linked in
-configure:8765: gcc -c -Wall  conftest.c >&5
-configure:8768: $? = 0
-configure:8783: gcc -shared conftest.o  -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| /bin/grep  -lc  \>/dev/null 2\>\&1
-configure:8786: $? = 0
-configure:8798: result: no
-configure:8962: checking dynamic linker characteristics
-configure:9395: gcc -o conftest -Wall   -Wl,-rpath -Wl,/foo conftest.c  >&5
-configure:9395: $? = 0
-configure:9625: result: GNU/Linux ld.so
-configure:9727: checking how to hardcode library paths into programs
-configure:9752: result: immediate
-configure:10272: checking whether stripping libraries is possible
-configure:10277: result: yes
-configure:10312: checking if libtool supports shared libraries
-configure:10314: result: yes
-configure:10317: checking whether to build shared libraries
-configure:10338: result: yes
-configure:10341: checking whether to build static libraries
-configure:10345: result: yes
-configure:10383: checking for pkg-config
-configure:10399: found /usr/bin/pkg-config
-configure:10413: result:  
-configure:10475: checking for pkg-config
-configure:10493: found /usr/bin/pkg-config
-configure:10505: result: /usr/bin/pkg-config
-configure:10530: checking pkg-config is at least version 0.9.0
-configure:10533: result: yes
-configure:10543: checking for GST
-configure:10554: $PKG_CONFIG --exists --print-errors "
-  gstreamer-0.10 >= $GST_REQUIRED
-  gstreamer-base-0.10 >= $GST_REQUIRED
-  gstreamer-controller-0.10 >= $GST_REQUIRED
-"
-configure:10561: $? = 0
-configure:10582: $PKG_CONFIG --exists --print-errors "
-  gstreamer-0.10 >= $GST_REQUIRED
-  gstreamer-base-0.10 >= $GST_REQUIRED
-  gstreamer-controller-0.10 >= $GST_REQUIRED
-"
-configure:10589: $? = 0
-configure:10654: result: yes
-configure:10662: checking to see if compiler understands -Wall
-configure:10677: gcc -c -Wall -Wall  conftest.c >&5
-configure:10677: $? = 0
-configure:10680: result: yes
-configure:10826: creating ./config.status
-
-## ---------------------- ##
-## Running config.status. ##
-## ---------------------- ##
-
-This file was extended by my-plugin-package config.status 0.10.0, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
-
-  CONFIG_FILES    = 
-  CONFIG_HEADERS  = 
-  CONFIG_LINKS    = 
-  CONFIG_COMMANDS = 
-  $ ./config.status 
-
-on kt-score
-
-config.status:1080: creating Makefile
-config.status:1080: creating src/Makefile
-config.status:1080: creating config.h
-config.status:1308: executing depfiles commands
-config.status:1308: executing libtool commands
-
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-
-ac_cv_build=i686-pc-linux-gnu
-ac_cv_c_compiler_gnu=yes
-ac_cv_env_CC_set=
-ac_cv_env_CC_value=
-ac_cv_env_CFLAGS_set=set
-ac_cv_env_CFLAGS_value=-Wall
-ac_cv_env_CPPFLAGS_set=
-ac_cv_env_CPPFLAGS_value=
-ac_cv_env_CPP_set=
-ac_cv_env_CPP_value=
-ac_cv_env_GST_CFLAGS_set=
-ac_cv_env_GST_CFLAGS_value=
-ac_cv_env_GST_LIBS_set=
-ac_cv_env_GST_LIBS_value=
-ac_cv_env_LDFLAGS_set=
-ac_cv_env_LDFLAGS_value=
-ac_cv_env_LIBS_set=
-ac_cv_env_LIBS_value=
-ac_cv_env_PKG_CONFIG_LIBDIR_set=
-ac_cv_env_PKG_CONFIG_LIBDIR_value=
-ac_cv_env_PKG_CONFIG_PATH_set=set
-ac_cv_env_PKG_CONFIG_PATH_value=/home/kt/sbs/target-i386/usr/lib/pkgconfig:/home/kt/sbs/target-i386/usr/share/pkgconfig:/home/kt/sbs/tools/usr/share/pkgconfig
-ac_cv_env_PKG_CONFIG_set=
-ac_cv_env_PKG_CONFIG_value=
-ac_cv_env_build_alias_set=
-ac_cv_env_build_alias_value=
-ac_cv_env_host_alias_set=
-ac_cv_env_host_alias_value=
-ac_cv_env_target_alias_set=
-ac_cv_env_target_alias_value=
-ac_cv_header_dlfcn_h=yes
-ac_cv_header_inttypes_h=yes
-ac_cv_header_memory_h=yes
-ac_cv_header_stdc=yes
-ac_cv_header_stdint_h=yes
-ac_cv_header_stdlib_h=yes
-ac_cv_header_string_h=yes
-ac_cv_header_strings_h=yes
-ac_cv_header_sys_stat_h=yes
-ac_cv_header_sys_types_h=yes
-ac_cv_header_unistd_h=yes
-ac_cv_host=i686-pc-linux-gnu
-ac_cv_objext=o
-ac_cv_path_EGREP='/bin/grep -E'
-ac_cv_path_FGREP='/bin/grep -F'
-ac_cv_path_GREP=/bin/grep
-ac_cv_path_SED=/bin/sed
-ac_cv_path_ac_pt_PKG_CONFIG=/usr/bin/pkg-config
-ac_cv_path_install='/usr/bin/install -c'
-ac_cv_path_mkdir=/bin/mkdir
-ac_cv_prog_AWK=gawk
-ac_cv_prog_CPP='gcc -E'
-ac_cv_prog_HAVE_PKGCONFIG=' '
-ac_cv_prog_ac_ct_AR=ar
-ac_cv_prog_ac_ct_CC=gcc
-ac_cv_prog_ac_ct_OBJDUMP=objdump
-ac_cv_prog_ac_ct_RANLIB=ranlib
-ac_cv_prog_ac_ct_STRIP=strip
-ac_cv_prog_cc_c89=
-ac_cv_prog_cc_g=yes
-ac_cv_prog_make_make_set=yes
-am_cv_CC_dependencies_compiler_type=gcc3
-lt_cv_deplibs_check_method=pass_all
-lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_ld_reload_flag=-r
-lt_cv_nm_interface='BSD nm'
-lt_cv_objdir=.libs
-lt_cv_path_LD=/usr/bin/ld
-lt_cv_path_NM='/usr/bin/nm -B'
-lt_cv_prog_compiler_c_o=yes
-lt_cv_prog_compiler_pic_works=yes
-lt_cv_prog_compiler_rtti_exceptions=no
-lt_cv_prog_compiler_static_works=yes
-lt_cv_prog_gnu_ld=yes
-lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[      ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"\2", (void *) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/  {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/  {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/  {"lib\2", (void *) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
-lt_cv_sys_max_cmd_len=1572864
-pkg_cv_GST_CFLAGS='-pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2  '
-pkg_cv_GST_LIBS='-pthread -lgstbase-0.10 -lgstcontroller-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0  '
-
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-
-ACLOCAL='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run aclocal-1.11'
-AMDEPBACKSLASH='\'
-AMDEP_FALSE='#'
-AMDEP_TRUE=''
-AMTAR='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run tar'
-AR='ar'
-AUTOCONF='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run autoconf'
-AUTOHEADER='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run autoheader'
-AUTOMAKE='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run automake-1.11'
-AWK='gawk'
-CC='gcc'
-CCDEPMODE='depmode=gcc3'
-CFLAGS='-Wall -Wall'
-CPP='gcc -E'
-CPPFLAGS=''
-CYGPATH_W='echo'
-DEFS='-DHAVE_CONFIG_H'
-DEPDIR='.deps'
-DSYMUTIL=''
-DUMPBIN=''
-ECHO_C=''
-ECHO_N='-n'
-ECHO_T=''
-EGREP='/bin/grep -E'
-EXEEXT=''
-FGREP='/bin/grep -F'
-GREP='/bin/grep'
-GST_CFLAGS='-pthread -I/usr/include/gstreamer-0.10 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2   -Wall'
-GST_LIBS='-pthread -lgstbase-0.10 -lgstcontroller-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0  '
-GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex _*\(gst_\|Gst\|GST_\).*'
-HAVE_PKGCONFIG=' '
-INSTALL_DATA='${INSTALL} -m 644'
-INSTALL_PROGRAM='${INSTALL}'
-INSTALL_SCRIPT='${INSTALL}'
-INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
-LD='/usr/bin/ld'
-LDFLAGS=''
-LIBOBJS=''
-LIBS=''
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-LIPO=''
-LN_S='ln -s'
-LTLIBOBJS=''
-MAINT=''
-MAINTAINER_MODE_FALSE='#'
-MAINTAINER_MODE_TRUE=''
-MAKEINFO='${SHELL} /home/kt/codec/dev/gst-emul_20130124/missing --run makeinfo'
-MKDIR_P='/bin/mkdir -p'
-NM='/usr/bin/nm -B'
-NMEDIT=''
-OBJDUMP='objdump'
-OBJEXT='o'
-OTOOL64=''
-OTOOL=''
-PACKAGE='my-plugin-package'
-PACKAGE_BUGREPORT=''
-PACKAGE_NAME='my-plugin-package'
-PACKAGE_STRING='my-plugin-package 0.10.0'
-PACKAGE_TARNAME='my-plugin-package'
-PACKAGE_URL=''
-PACKAGE_VERSION='0.10.0'
-PATH_SEPARATOR=':'
-PKG_CONFIG='/usr/bin/pkg-config'
-PKG_CONFIG_LIBDIR=''
-PKG_CONFIG_PATH='/home/kt/sbs/target-i386/usr/lib/pkgconfig:/home/kt/sbs/target-i386/usr/share/pkgconfig:/home/kt/sbs/tools/usr/share/pkgconfig'
-RANLIB='ranlib'
-SED='/bin/sed'
-SET_MAKE=''
-SHELL='/bin/sh'
-STRIP='strip'
-VERSION='0.10.0'
-ac_ct_CC='gcc'
-ac_ct_DUMPBIN=''
-am__EXEEXT_FALSE=''
-am__EXEEXT_TRUE='#'
-am__fastdepCC_FALSE='#'
-am__fastdepCC_TRUE=''
-am__include='include'
-am__isrc=''
-am__leading_dot='.'
-am__quote=''
-am__tar='${AMTAR} chof - "$$tardir"'
-am__untar='${AMTAR} xf -'
-bindir='${exec_prefix}/bin'
-build='i686-pc-linux-gnu'
-build_alias=''
-build_cpu='i686'
-build_os='linux-gnu'
-build_vendor='pc'
-datadir='${datarootdir}'
-datarootdir='${prefix}/share'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-dvidir='${docdir}'
-exec_prefix='${prefix}'
-host='i686-pc-linux-gnu'
-host_alias=''
-host_cpu='i686'
-host_os='linux-gnu'
-host_vendor='pc'
-htmldir='${docdir}'
-includedir='${prefix}/include'
-infodir='${datarootdir}/info'
-install_sh='${SHELL} /home/kt/codec/dev/gst-emul_20130124/install-sh'
-libdir='${exec_prefix}/lib'
-libexecdir='${exec_prefix}/libexec'
-localedir='${datarootdir}/locale'
-localstatedir='${prefix}/var'
-lt_ECHO='echo'
-mandir='${datarootdir}/man'
-mkdir_p='/bin/mkdir -p'
-oldincludedir='/usr/include'
-pdfdir='${docdir}'
-plugindir='$(libdir)/gstreamer-0.10'
-prefix='/usr/local'
-program_transform_name='s,x,x,'
-psdir='${docdir}'
-sbindir='${exec_prefix}/sbin'
-sharedstatedir='${prefix}/com'
-sysconfdir='${prefix}/etc'
-target_alias=''
-
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-
-/* confdefs.h */
-#define PACKAGE_NAME "my-plugin-package"
-#define PACKAGE_TARNAME "my-plugin-package"
-#define PACKAGE_VERSION "0.10.0"
-#define PACKAGE_STRING "my-plugin-package 0.10.0"
-#define PACKAGE_BUGREPORT ""
-#define PACKAGE_URL ""
-#define PACKAGE "my-plugin-package"
-#define VERSION "0.10.0"
-#define STDC_HEADERS 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_DLFCN_H 1
-#define LT_OBJDIR ".libs/"
-
-configure: exit 0
diff --git a/packaging/gst-plugins-emulator.changes b/packaging/gst-plugins-emulator.changes
new file mode 100644 (file)
index 0000000..15a3d16
--- /dev/null
@@ -0,0 +1,2 @@
+* Fri Jun 21 11:49:35 UTC 2013 Kitae Kim kt920.kim@samsung.com 
+- improved architecture of gstreamer codec plugin.
diff --git a/packaging/gst-plugins-emulator.manifest b/packaging/gst-plugins-emulator.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/gst-plugins-emulator.spec b/packaging/gst-plugins-emulator.spec
new file mode 100644 (file)
index 0000000..89e6023
--- /dev/null
@@ -0,0 +1,50 @@
+Name: gst-plugins-emulator
+Version: 0.1.0
+Release: 2 
+Summary: GStreamer Streaming-media framework plug-in for Tizen emulator.
+Group: TO_BE/FILLED_IN
+License: LGPLv2+
+URL: http://gstreamer.net/
+Source0: %{name}-%{version}.tar.gz
+Source1001: packaging/gst-plugins-emulator.manifest
+BuildRequires:  gettext
+BuildRequires:  which
+BuildRequires:  gstreamer-tools
+BuildRequires:  gst-plugins-base-devel
+BuildRequires:  pkgconfig(gstreamer-0.10)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(zlib)
+
+%description
+
+%prep
+
+%setup -q
+
+%build
+cp %{SOURCE1001} .
+./autogen.sh
+%configure --disable-static \
+ --disable-nls \
+ --prefix=%{_prefix} \
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+%post
+
+%postun
+
+%files
+%manifest gst-plugins-emulator.manifest
+%defattr(-,root,root,-)
+%{_libdir}/gstreamer-0.10/libgstemul.so
+
+%changelog
index ec5798d..d4482af 100644 (file)
@@ -65,7 +65,6 @@ gst_emul_codec_element_init ()
   void *buffer = NULL;
   GList *element = NULL;
   CodecIOParams params;
-//  CodecDevice dev;
 
   fd = open (CODEC_DEV, O_RDWR);
   if (fd < 0) {
@@ -84,12 +83,18 @@ gst_emul_codec_element_init ()
     perror ("failure memory mapping.");
   }
 
+#if 0
   memset(&params, 0, sizeof(params));
   params.api_index = CODEC_ELEMENT_INIT;
   if (write (fd, &params, 1) < 0) {
     perror ("failed to copy data to qemu");
   }
+#endif
+
+  CODEC_LOG (DEBUG, "request a device to get codec element.\n");
+  ioctl(fd, CODEC_CMD_GET_ELEMENT, NULL);
 
+  // TODO: source clean-up.
 #if 0
   do {
     CodecElement *elm = NULL;
@@ -185,7 +190,7 @@ plugin_init (GstPlugin *plugin)
 }
 
 #ifndef PACKAGE
-#define PACKAGE "GST-EMUL-CODEC"
+#define PACKAGE "gst-plugins-emulator"
 #endif
 
 GST_PLUGIN_DEFINE (
@@ -196,6 +201,6 @@ GST_PLUGIN_DEFINE (
   plugin_init,
   "0.1.1",
   "LGPL",
-  "Gst-Emul-Codec",
+  "gst-plugins-emulator",
   "http://tizen.org"
 )
index d02f170..3405a6a 100644 (file)
@@ -33,8 +33,6 @@
 #include "gstemulapi2.h"
 #include "gstemuldev.h"
 
-static GStaticMutex codec_mutex = G_STATIC_MUTEX_INIT; 
-
 void emul_codec_write_to_qemu (int ctx_index, int api_index, CodecDevice *dev)
 {
   CodecIOParams ioparam;
@@ -43,10 +41,80 @@ void emul_codec_write_to_qemu (int ctx_index, int api_index, CodecDevice *dev)
   ioparam.api_index = api_index;
   ioparam.ctx_index = ctx_index;
   ioparam.mem_offset = dev->mem_info.offset;
-  ioparam.mem_type = dev->mem_info.type;
   if (write (dev->fd, &ioparam, 1) < 0) {
     printf ("[%s:%d] failed to copy data.\n", __func__, __LINE__);
   }
+  CODEC_LOG (DEBUG, "[%s] mem_offset = 0x%x\n", __func__, ioparam.mem_offset);
+}
+
+extern int device_fd;
+extern gpointer device_mem;
+
+struct mem_info {
+    gpointer start;
+    uint32_t offset;
+};
+
+static struct mem_info secure_device_mem()
+{
+  uint32_t mem_offset = 0;
+  struct mem_info info;
+
+  CODEC_LOG (DEBUG, "enter: %s\n", __func__);
+
+  ioctl(device_fd, CODEC_CMD_SECURE_MEMORY, &mem_offset);
+  info.start = (gpointer)((uint32_t)device_mem + mem_offset);
+  info.offset = mem_offset;
+
+  CODEC_LOG (DEBUG, "leave: %s\n", __func__);
+  CODEC_LOG (DEBUG, "caramis0 = 0x%x\n", mem_offset);
+
+  return info;
+}
+
+static void release_device_mem(gpointer start)
+{
+  uint32_t offset = start - device_mem;
+  CODEC_LOG (DEBUG, "enter: %s\n", __func__);
+
+  ioctl(device_fd, CODEC_CMD_RELEASE_MEMORY, &offset);
+
+  CODEC_LOG (DEBUG, "leave: %s\n", __func__);
+}
+
+static void emul_buffer_free(gpointer start)
+{
+  CODEC_LOG (DEBUG, "enter: %s\n", __func__);
+
+  release_device_mem(start);
+
+  CODEC_LOG (DEBUG, "leave: %s\n", __func__);
+}
+
+GstFlowReturn emul_buffer_alloc(GstPad *pad, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf)
+{
+  struct mem_info info;
+
+  CODEC_LOG (DEBUG, "enter: %s\n", __func__);
+
+  *buf = gst_buffer_new ();
+
+  info = secure_device_mem();
+
+  CODEC_LOG (DEBUG, "[%s] start: 0x%x, offset 0x%x\n", __func__, info.start, info.offset);
+
+  GST_BUFFER_DATA (*buf) = GST_BUFFER_MALLOCDATA (*buf) = info.start;
+  GST_BUFFER_SIZE (*buf) = size;
+  GST_BUFFER_FREE_FUNC (*buf) = emul_buffer_free;
+
+  GST_BUFFER_OFFSET (*buf) = offset;
+
+  if (caps) {
+    gst_buffer_set_caps (*buf, caps);
+  }
+
+  CODEC_LOG (DEBUG, "leave: %s\n", __func__);
+  return GST_FLOW_OK;
 }
 
 int
@@ -55,7 +123,7 @@ emul_avcodec_init (CodecContext *ctx, CodecElement *codec, CodecDevice *dev)
   int fd;
   uint8_t *mmapbuf;
   int ret = 0;
-  int usable, copyback;
+  uint32_t mem_offset = 0;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -72,79 +140,18 @@ emul_avcodec_init (CodecContext *ctx, CodecElement *codec, CodecDevice *dev)
   }
 
   ioctl(fd, CODEC_CMD_GET_CONTEXT_INDEX, &ctx->index);
+  CODEC_LOG (DEBUG, "recv context index: %d\n", ctx->index);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    emul_avcodec_init_to (ctx, codec, mmapbuf);
-  } else {
-    ret = ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, &usable);
-    if (ret < 0) {
-      perror("ioctl failure");
-      CODEC_LOG (ERR, "[%d] return value: %d\n", __LINE__, ret);
-    }
-
-    while (1) {
-      ret = ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (ret < 0) {
-        perror("ioctl failure");
-        CODEC_LOG (ERR, "[%d] return value: %d\n", __LINE__, ret);
-      } else {
-        if (usable) {
-          CODEC_LOG (DEBUG, "[init] waiting after before.\n");
-          usleep (500);
-          continue;
-        }
-
-        emul_avcodec_init_to (ctx, codec, mmapbuf);
-        break;
-      }
-    }
-  }
+  ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &mem_offset);
+  emul_avcodec_init_to (ctx, codec, mmapbuf + mem_offset);
+  dev->mem_info.offset = mem_offset;
   emul_codec_write_to_qemu (ctx->index, CODEC_INIT, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-#if 0
-    while (1) {
-      ret = ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (ret < 0) {
-        perror("ioctl failure");
-        CODEC_LOG (ERR, "[%d] return value: %d\n", __LINE__, ret);
-      } else {
-        if (wait) {
-          CODEC_LOG (DEBUG, "[init] waiting after write.\n");
-          usleep (500);
-          continue;
-        }
-
-        ret = emul_avcodec_init_from (ctx, codec, mmapbuf);
-        break;
-      }
-    }
-#endif
 
-#if 1 
-    ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-    ret = emul_avcodec_init_from (ctx, codec, mmapbuf);
-#endif
-  } else {
-    while (1) {
-      ret = ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (ret < 0) {
-        perror("ioctl failure");
-        CODEC_LOG (ERR, "[%d] return value: %d\n", __LINE__, ret);
-      } else {
-        if (usable) {
-          CODEC_LOG (DEBUG, "[init][%d] waiting after write.\n", __LINE__);
-          usleep (500);
-          continue;
-        }
-
-        ret = emul_avcodec_init_from (ctx, codec, mmapbuf);
-        break;
-      }
-    }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
-  }
+  ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &mem_offset);
+  ret = emul_avcodec_init_from (ctx, codec, mmapbuf + mem_offset);
+
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &mem_offset);
 
   CODEC_LOG (DEBUG, "leave: %s, ret: %d\n", __func__, ret);
   return ret;
@@ -176,13 +183,15 @@ emul_avcodec_deinit (CodecContext *ctx, CodecDevice *dev)
 }
 
 int
-emul_avcodec_decode_video (CodecContext *ctx, uint8_t *in_buf, int in_size, gint idx, gint64 in_offset,
-    GstBuffer **out_buf, int *got_picture_ptr, CodecDevice *dev)
+emul_avcodec_decode_video (CodecContext *ctx, uint8_t *in_buf, int in_size,
+                          gint idx, gint64 in_offset, GstBuffer **out_buf,
+                          int *got_picture_ptr, CodecDevice *dev)
 {
   int fd;
   uint8_t *mmapbuf = NULL;
   int len = 0;
-  int copyback, usable;
+//  int copyback, usable;
+  uint32_t mem_offset = 0;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -198,61 +207,18 @@ emul_avcodec_decode_video (CodecContext *ctx, uint8_t *in_buf, int in_size, gint
     return -1;
   }
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    emul_avcodec_decode_video_to (in_buf, in_size, idx, in_offset, mmapbuf);
-  } else {
-    ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
-
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[decode_video] waiting before write.\n");
-        usleep (500);
-        continue;
-      }
-
-      emul_avcodec_decode_video_to (in_buf, in_size, idx, in_offset, mmapbuf);
-      break;
-    }
-  }
+  ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &mem_offset);
+  CODEC_LOG (DEBUG, "[%s] mem_offset = 0x%x\n", __func__, mem_offset);
+  emul_avcodec_decode_video_to (in_buf, in_size, idx, in_offset, mmapbuf + mem_offset);
 
-  /* provide raw image for decoding to qemu */
+  dev->mem_info.offset = mem_offset;
   emul_codec_write_to_qemu (ctx->index, CODEC_DECODE_VIDEO, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-//    ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-#if 0 
-    while (1) {
-      ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (wait) {
-        CODEC_LOG (DEBUG, "[decode_video][%d] waiting after write.\n", __LINE__);
-        usleep (500);
-        continue;
-      }
-
-      len = emul_avcodec_decode_video_from (ctx, got_picture_ptr, mmapbuf);
-      break;
-    }
-#endif
+  ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &mem_offset);
+  CODEC_LOG (DEBUG, "[%s] mem_offset = 0x%x\n", __func__, mem_offset);
+  len = emul_avcodec_decode_video_from (ctx, got_picture_ptr, mmapbuf + mem_offset);
 
-#if 1
-       ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-    len = emul_avcodec_decode_video_from (ctx, got_picture_ptr, mmapbuf);
-#endif
-  } else {
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[decode_video] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-      len = emul_avcodec_decode_video_from (ctx, got_picture_ptr, mmapbuf);
-      break;
-    }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
-  }
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &mem_offset);
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
   return len;
@@ -264,7 +230,8 @@ emul_av_picture_copy (CodecContext *ctx, uint8_t *pict,
 {
   int fd;
   void *mmapbuf = NULL;
-  int copyback, usable;
+//  int copyback, usable;
+  uint32_t mem_offset = 0;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -280,55 +247,46 @@ emul_av_picture_copy (CodecContext *ctx, uint8_t *pict,
     return;
   }
 
-  if (dev->mem_info.type == CODEC_SHARED_DEVICE_MEM) {
-    ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
-
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[copy_frame] waiting before write.\n");
-        usleep (500);
-        continue;
-      }
-      break;
+#if 0
+  ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
+
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[copy_frame] waiting before write.\n");
+      usleep (500);
+      continue;
     }
+    break;
   }
 
   emul_codec_write_to_qemu (ctx->index, CODEC_PICTURE_COPY, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-//    ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-#if 0 
-    while (1) {
-      ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (wait) {
-        CODEC_LOG (DEBUG, "[copy_frame] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-      memcpy (pict, mmapbuf, pict_size);
-      break;
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[copy_frame] waiting after write.\n");
+      usleep (500);
+      continue;
     }
+    memcpy (pict, mmapbuf, pict_size);
+    break;
+  }
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
 #endif
 
-#if 1
-    ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-    memcpy (pict, mmapbuf, pict_size);
+  dev->mem_info.offset = (uint32_t)pict - (uint32_t)device_mem;
+  CODEC_LOG (DEBUG, "[%s] mem_offset = 0x%x\n", __func__, dev->mem_info.offset);
+  emul_codec_write_to_qemu (ctx->index, CODEC_PICTURE_COPY, dev);
+//  ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &mem_offset);
+  ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM2, &(dev->mem_info.offset));
+
+  CODEC_LOG (DEBUG, "caramis1 = 0x%x\n", __func__, mem_offset);
+#if 0
+  memcpy (pict, mmapbuf, pict_size);
+
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &mem_offset);
 #endif
-  } else {
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[copy_frame] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-      memcpy (pict, mmapbuf, pict_size);
-      break;
-    }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
-  }
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
 }
@@ -341,7 +299,8 @@ emul_avcodec_decode_audio (CodecContext *ctx, int16_t *samples,
   int fd;
   uint8_t *mmapbuf = NULL;
   int len;
-  int copyback, usable;
+//  int copyback, usable;
+  uint32_t mem_offset = 0;
 
   CODEC_LOG (DEBUG, "enter: %s\n", __func__);
 
@@ -357,63 +316,52 @@ emul_avcodec_decode_audio (CodecContext *ctx, int16_t *samples,
     return -1;
   }
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    emul_avcodec_decode_audio_to (in_buf, in_size, mmapbuf);
-  } else {
-    ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
-
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[decode_audio] waiting before write.\n");
-        usleep (500);
-        continue;
-      }
-
-      emul_avcodec_decode_audio_to (in_buf, in_size, mmapbuf);
-      break;
+#if 0
+  ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
+
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[decode_audio] waiting before write.\n");
+      usleep (500);
+      continue;
     }
+
+    emul_avcodec_decode_audio_to (in_buf, in_size, mmapbuf);
+    break;
   }
 
   emul_codec_write_to_qemu (ctx->index, CODEC_DECODE_AUDIO, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-    ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-    len =
-                 emul_avcodec_decode_audio_from (ctx, frame_size_ptr, samples, mmapbuf);
-
-#if 0 
-    while (1) {
-      ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (wait) {
-        CODEC_LOG (DEBUG, "[decode_audio] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-
-      len =
-        emul_avcodec_decode_audio_from (ctx, frame_size_ptr, samples, mmapbuf);
-      break;
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[decode_audio] waiting after write.\n");
+      usleep (500);
+      continue;
     }
-#endif
-  } else {
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[decode_audio] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-
-      len =
-        emul_avcodec_decode_audio_from (ctx, frame_size_ptr, samples, mmapbuf);
-      break;
-    }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+
+    len =
+      emul_avcodec_decode_audio_from (ctx, frame_size_ptr, samples, mmapbuf);
+    break;
   }
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+#endif
+
+  ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &mem_offset);
+  emul_avcodec_decode_audio_to (in_buf, in_size, mmapbuf + mem_offset);
+
+  dev->mem_info.offset = mem_offset;
+  emul_codec_write_to_qemu (ctx->index, CODEC_DECODE_AUDIO, dev);
+
+  ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &mem_offset);
+  len =
+    emul_avcodec_decode_audio_from (ctx, frame_size_ptr, samples, mmapbuf + mem_offset);
+
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &mem_offset);
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
+
   return len;
 }
 
@@ -441,53 +389,35 @@ emul_avcodec_encode_video (CodecContext *ctx, uint8_t *out_buf,
     return -1;
   }
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    emul_avcodec_encode_video_to (in_buf, in_size, in_timestamp, mmapbuf);
-  } else {
-    ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
-
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[encode_video] waiting before write.\n");
-        usleep (500);
-        continue;
-      }
-
-      emul_avcodec_encode_video_to (in_buf, in_size, in_timestamp, mmapbuf);
-      break;
+//  ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
+#if 0
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[encode_video] waiting before write.\n");
+      usleep (500);
+      continue;
     }
+
+    emul_avcodec_encode_video_to (in_buf, in_size, in_timestamp, mmapbuf);
+    break;
   }
 
   emul_codec_write_to_qemu (ctx->index, CODEC_ENCODE_VIDEO, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-    while (1) {
-      ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (wait) {
-        CODEC_LOG (DEBUG, "[encode_video] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-
-      len = emul_avcodec_encode_video_from (out_buf, out_size, mmapbuf);
-      break;
-    }
-  } else {
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[encode_video] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-
-      len = emul_avcodec_encode_video_from (out_buf, out_size, mmapbuf);
-      break;
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[encode_video] waiting after write.\n");
+      usleep (500);
+      continue;
     }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+
+    len = emul_avcodec_encode_video_from (out_buf, out_size, mmapbuf);
+    break;
   }
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+#endif
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
   return len;
@@ -517,53 +447,34 @@ emul_avcodec_encode_audio (CodecContext *ctx, uint8_t *out_buf,
     return -1;
   }
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    emul_avcodec_encode_audio_to (out_size, in_size, in_buf, mmapbuf);
-  } else {
-    ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
-
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[encode_audio] waiting before write.\n");
-        usleep (500);
-        continue;
-      }
-
-      emul_avcodec_encode_audio_to (out_size, in_size, in_buf, mmapbuf);
-      break;
+//  ioctl (fd, CODEC_CMD_ADD_TASK_QUEUE, NULL);
+#if 0
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_TO_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[encode_audio] waiting before write.\n");
+      usleep (500);
+      continue;
     }
+
+    emul_avcodec_encode_audio_to (out_size, in_size, in_buf, mmapbuf);
+    break;
   }
 
   emul_codec_write_to_qemu (ctx->index, CODEC_ENCODE_AUDIO, dev);
 
-  if (dev->mem_info.type == CODEC_FIXED_DEVICE_MEM) {
-    int wait = 0;
-    while (1) {
-      ioctl (fd, CODEC_CMD_WAIT_TASK, &wait);
-      if (wait) {
-        CODEC_LOG (DEBUG, "[encode_audio] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-      len = emul_avcodec_encode_audio_from (out_buf, out_size, mmapbuf);
-      break;
+  while (1) {
+    ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
+    if (usable) {
+      CODEC_LOG (DEBUG, "[encode_audio] waiting after write.\n");
+      usleep (500);
+      continue;
     }
-
     len = emul_avcodec_encode_audio_from (out_buf, out_size, mmapbuf);
-  } else {
-    while (1) {
-      ioctl (fd, CODEC_CMD_COPY_FROM_DEVICE_MEM, &usable);
-      if (usable) {
-        CODEC_LOG (DEBUG, "[encode_audio] waiting after write.\n");
-        usleep (500);
-        continue;
-      }
-      len = emul_avcodec_encode_audio_from (out_buf, out_size, mmapbuf);
-      break;
-    }
-    ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+    break;
   }
+  ioctl (fd, CODEC_CMD_REMOVE_TASK_QUEUE, &copyback);
+#endif
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
   return len;
index 6c841a6..5d55fdd 100644 (file)
@@ -58,4 +58,6 @@ void emul_av_picture_copy (CodecContext *ctx, uint8_t *pict, uint32_t pict_size,
 
 void emul_codec_write_to_qemu (int ctx_index, int api_index, CodecDevice *dev);
 
+GstFlowReturn emul_buffer_alloc(GstPad *pad, guint64 offset, guint size, GstCaps *caps, GstBuffer **buf);
+
 #endif /* __GST_EMUL_API_H__ */
index 8bcdf88..c9e61a3 100644 (file)
@@ -31,7 +31,9 @@
 #include "gstemulapi2.h"
 
 void
-emul_avcodec_init_to (CodecContext *ctx, CodecElement *codec, uint8_t *device_buf)
+emul_avcodec_init_to (CodecContext *ctx,
+                      CodecElement *codec,
+                      uint8_t *device_buf)
 {
   int size = 0, codec_size;
 
@@ -81,7 +83,9 @@ emul_avcodec_init_to (CodecContext *ctx, CodecElement *codec, uint8_t *device_bu
 }
 
 int
-emul_avcodec_init_from (CodecContext *ctx, CodecElement *codec, uint8_t *device_buf)
+emul_avcodec_init_from (CodecContext *ctx,
+                        CodecElement *codec,
+                        uint8_t *device_buf)
 {
   int ret = 0, size = 0;
 
@@ -119,7 +123,9 @@ emul_avcodec_init_from (CodecContext *ctx, CodecElement *codec, uint8_t *device_
 }
 
 void
-emul_avcodec_decode_video_to (uint8_t *in_buf, int in_size, int idx, int64_t in_offset, uint8_t *device_buf)
+emul_avcodec_decode_video_to (uint8_t *in_buf, int in_size,
+                              int idx, int64_t in_offset,
+                              uint8_t *device_buf)
 {
   int size = 0;
 
@@ -143,10 +149,13 @@ emul_avcodec_decode_video_to (uint8_t *in_buf, int in_size, int idx, int64_t in_
   CODEC_LOG (DEBUG, "[decode_video] total: %d, inbuf size: %d\n", size, in_size);
 //  memcpy(device_buf, &size, sizeof(size));
   *(int *)device_buf = size;
+  CODEC_LOG (DEBUG, "[decode_video] leave\n");
 }
 
 int
-emul_avcodec_decode_video_from (CodecContext *ctx, int *got_picture_ptr, uint8_t *device_buf)
+emul_avcodec_decode_video_from (CodecContext *ctx,
+                                int *got_picture_ptr,
+                                uint8_t *device_buf)
 {
   int len = 0, size = 0;
 
@@ -160,13 +169,16 @@ emul_avcodec_decode_video_from (CodecContext *ctx, int *got_picture_ptr, uint8_t
   size += sizeof(*got_picture_ptr);
   memcpy (&ctx->video, (uint8_t *)device_buf + size, sizeof(ctx->video));
 //  ctx->video = *(VideoData *)(device_buf + size);
-  CODEC_LOG (DEBUG, "[decode_video] len: %d, have_date: %d\n", len, *got_picture_ptr);
+
+  CODEC_LOG (DEBUG, "[decode_video] len: %d, have_data: %d\n", len, *got_picture_ptr);
 
   return len;
 }
 
 void
-emul_avcodec_decode_audio_to (uint8_t *in_buf, int in_size, uint8_t *device_buf)
+emul_avcodec_decode_audio_to (uint8_t *in_buf,
+                              int in_size,
+                              uint8_t *device_buf)
 {
   int size = 0;
 
@@ -206,7 +218,7 @@ emul_avcodec_decode_audio_from (CodecContext *ctx, int *frame_size_ptr,
   size += sizeof(*frame_size_ptr);
   CODEC_LOG (DEBUG, "[decode_audio] len: %d, frame_size: %d\n",
           len, (*frame_size_ptr));
-#if 1 
+#if 1
   if (len > 0) {
     memcpy (samples,
       (uint8_t *)device_buf + size, FF_MAX_AUDIO_FRAME_SIZE);
@@ -241,8 +253,9 @@ emul_avcodec_encode_video_to (uint8_t *in_buf, int in_size,
 }
 
 int
-emul_avcodec_encode_video_from (uint8_t *out_buf, int out_size,
-                              uint8_t *device_buf)
+emul_avcodec_encode_video_from (uint8_t *out_buf,
+                                int out_size,
+                                uint8_t *device_buf)
 {
   int len, size;
 
@@ -278,7 +291,9 @@ emul_avcodec_encode_audio_to (int out_size, int in_size,
 }
 
 int
-emul_avcodec_encode_audio_from (uint8_t *out_buf, int out_size, uint8_t *device_buf)
+emul_avcodec_encode_audio_from (uint8_t *out_buf,
+                                int out_size,
+                                uint8_t *device_buf)
 {
   int len, size;
 
index a9e59f3..307afbd 100644 (file)
@@ -83,18 +83,16 @@ typedef struct _CodecIOParams {
   uint32_t  mem_type;
 } CodecIOParams;
 
-typedef struct _CodecDevMemInfo {
-  uint32_t  type;
+typedef struct _CodecDeviceMem {
   uint32_t  index;
   uint32_t  offset;
-} CodecDevMemInfo;
+} CodecDeviceMem;
 
 typedef struct _CodecDevice {
   int       fd;
   uint8_t   *buf;
   uint32_t  buf_size;
-//  sem_t     *sem;
-  CodecDevMemInfo mem_info;
+  CodecDeviceMem mem_info;
 } CodecDevice;
 
 typedef struct _CodecElement {
@@ -138,8 +136,8 @@ typedef struct _CodecContext {
 } CodecContext;
 
 enum CODEC_FUNC_TYPE {
-  CODEC_ELEMENT_INIT = 1,
-  CODEC_INIT,
+//  CODEC_ELEMENT_INIT = 1,
+  CODEC_INIT = 0,
   CODEC_DECODE_VIDEO,
   CODEC_ENCODE_VIDEO,
   CODEC_DECODE_AUDIO,
@@ -149,15 +147,17 @@ enum CODEC_FUNC_TYPE {
 };
 
 enum CODEC_IO_CMD {
-  CODEC_CMD_GET_DEVICE_MEM_INFO = 0,
-  CODEC_CMD_RELEASE_DEVICE_MEM,
-  CODEC_CMD_ADD_TASK_QUEUE = 3,
+//  CODEC_CMD_ACQUIRE_DEVICE_MEM = 0,
+  CODEC_CMD_RELEASE_DEVICE_MEM = 5,
   CODEC_CMD_REMOVE_TASK_QUEUE,
-  CODEC_CMD_COPY_FROM_DEVICE_MEM,
   CODEC_CMD_COPY_TO_DEVICE_MEM,
-  CODEC_CMD_WAIT_TASK, 
+  CODEC_CMD_COPY_FROM_DEVICE_MEM,
   CODEC_CMD_GET_VERSION = 20,
+  CODEC_CMD_GET_ELEMENT,
   CODEC_CMD_GET_CONTEXT_INDEX,
+  CODEC_CMD_SECURE_MEMORY = 30,
+  CODEC_CMD_RELEASE_MEMORY,
+  CODEC_CMD_COPY_FROM_DEVICE_MEM2,
 };
 
 enum CODEC_MEDIA_TYPE {
@@ -182,11 +182,6 @@ enum SAMPLT_FORMAT {
   SAMPLE_FMT_NB
 };
 
-enum CODEC_MEMORY_TYPE {
-  CODEC_FIXED_DEVICE_MEM = 0,
-  CODEC_SHARED_DEVICE_MEM,
-};
-
 /* Define codec types.
  * e.g. FFmpeg, x264, libvpx and etc.
  */
index 4b210e2..150e15b 100644 (file)
 
 static GStaticMutex gst_avcodec_mutex = G_STATIC_MUTEX_INIT;
 
+#define CODEC_DEVICE_MEM_SIZE 32 * 1024 * 1024
+
+gpointer device_mem;
+int device_fd;
+
 int
-gst_emul_codec_device_open (CodecDevice *dev)
+gst_emul_codec_device_open (CodecDevice *dev, int media_type)
 {
   int fd;
   void *mmapbuf;
@@ -60,23 +65,14 @@ gst_emul_codec_device_open (CodecDevice *dev)
   CODEC_LOG (INFO, "succeeded to open %s. %d.\n", CODEC_DEV, fd);
   dev->mem_info.index = dev->buf_size;
 
-  ioctl(fd, CODEC_CMD_GET_DEVICE_MEM_INFO, &dev->mem_info);
-#if 1 
-  dev->mem_info.type = CODEC_SHARED_DEVICE_MEM;
-  dev->mem_info.offset = 0;
-#endif
-
-  CODEC_LOG (INFO, "memory type: %s\n",
-  !dev->mem_info.type ? "FIXED" : "SHARED");
-
 #if 0
   CODEC_LOG("mem type: %d, index: %d, offset: %d\n",
     dev->mem_info.type, dev->mem_info.index, dev->mem_info.offset);
 #endif
   CODEC_LOG (DEBUG, "before mmap. buf_size: %d\n", dev->buf_size);
 
-  mmapbuf = mmap (NULL, dev->buf_size, PROT_READ | PROT_WRITE,
-                  MAP_SHARED, fd, dev->mem_info.offset);
+  mmapbuf = mmap (NULL, CODEC_DEVICE_MEM_SIZE, PROT_READ | PROT_WRITE,
+                  MAP_SHARED, fd, 0);
   if (mmapbuf == (void *)-1) {
     perror("Failed to map device memory of codec.");
     close(fd);
@@ -87,8 +83,11 @@ gst_emul_codec_device_open (CodecDevice *dev)
   CODEC_LOG (INFO, "succeeded to map device memory: %p.\n", mmapbuf);
   dev->fd = fd;
   dev->buf = mmapbuf;
-//  dev->sem = &codec_sem;
-//  CODEC_LOG (INFO, "sema: %p\n", dev->sem);
+
+//
+  device_mem = mmapbuf;
+  device_fd = fd;
+//
 
   CODEC_LOG (DEBUG, "leave: %s\n", __func__);
 
@@ -118,8 +117,8 @@ gst_emul_codec_device_close (CodecDevice *dev)
 //  GST_DEBUG("Release memory region of %s.\n", CODEC_DEV);
   CODEC_LOG (INFO, "Release memory region of %p.\n", mmapbuf);
 
-  if (munmap(mmapbuf, dev->buf_size) != 0) {
-    GST_ERROR("Failed to release memory region of %s.\n", CODEC_DEV);
+  if (munmap(mmapbuf, CODEC_DEVICE_MEM_SIZE) != 0) {
+    CODEC_LOG(ERR, "Failed to release memory region of %s.\n", CODEC_DEV);
   }
   dev->buf = NULL;
 
@@ -138,13 +137,15 @@ gst_emul_codec_device_close (CodecDevice *dev)
 }
 
 int
-gst_emul_avcodec_open (CodecContext *ctx, CodecElement *codec, CodecDevice *dev)
+gst_emul_avcodec_open (CodecContext *ctx,
+                      CodecElement *codec,
+                      CodecDevice *dev)
 {
   int ret;
 
   g_static_mutex_lock (&gst_avcodec_mutex);
 
-  if (gst_emul_codec_device_open (dev) < 0) {
+  if (gst_emul_codec_device_open (dev, codec->media_type) < 0) {
     perror("failed to open device.\n");
     return -1;
   }
index eec783f..141a268 100644 (file)
 #ifndef __GST_EMUL_DEV_H__
 #define __GST_EMUL_DEV_H__
 
-int gst_emul_codec_device_open (CodecDevice *dev);
+int gst_emul_codec_device_open (CodecDevice *dev, int media_type);
 int gst_emul_codec_device_close (CodecDevice *dev);
 
-int gst_emul_avcodec_open (CodecContext *ctx, CodecElement *codec, CodecDevice *dev);
+int gst_emul_avcodec_open (CodecContext *ctx,
+                          CodecElement *codec,
+                          CodecDevice *dev);
 int gst_emul_avcodec_close (CodecContext *ctx, CodecDevice *dev);
 #endif
index 02d651c..92ff1a2 100644 (file)
@@ -432,8 +432,8 @@ gst_emuldec_init (GstEmulDec *emuldec)
     CODEC_LOG (ERR, "failed to allocate memory.\n");
   }
 
-  emuldec->context->video.pix_fmt = PIX_FMT_NONE; 
-  emuldec->context->audio.sample_fmt = SAMPLE_FMT_NONE; 
+  emuldec->context->video.pix_fmt = PIX_FMT_NONE;
+  emuldec->context->audio.sample_fmt = SAMPLE_FMT_NONE;
   emuldec->dev = g_malloc0 (sizeof(CodecDevice));
   if (!emuldec->dev) {
     CODEC_LOG (ERR, "failed to allocate memory.\n");
@@ -723,6 +723,7 @@ gst_emuldec_open (GstEmulDec *emuldec)
     return FALSE;
   }
 
+#if 0
   switch (oclass->codec->media_type) {
   case AVMEDIA_TYPE_VIDEO:
     width = emuldec->context->video.width;
@@ -742,11 +743,13 @@ gst_emuldec_open (GstEmulDec *emuldec)
   }
 
   emuldec->dev->buf_size = gst_emul_align_size(buf_size);
+#endif
 
-  if (gst_emul_avcodec_open (emuldec->context, oclass->codec, emuldec->dev) < 0) {
+  if (gst_emul_avcodec_open (emuldec->context,
+                            oclass->codec, emuldec->dev) < 0) {
     gst_emuldec_close (emuldec);
-    GST_DEBUG_OBJECT (emuldec, "tzdec_%s: Failed to open codec",
-        oclass->codec->name);
+    GST_DEBUG_OBJECT (emuldec,
+      "tzdec_%s: Failed to open codec", oclass->codec->name);
   }
 
   emuldec->opened = TRUE;
@@ -915,6 +918,7 @@ new_aligned_buffer (gint size, GstCaps *caps)
   GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = g_malloc0 (size);
   GST_BUFFER_SIZE (buf) = size;
   GST_BUFFER_FREE_FUNC (buf) = g_free;
+
   if (caps) {
     gst_buffer_set_caps (buf, caps);
   }
@@ -940,6 +944,10 @@ get_output_buffer (GstEmulDec *emuldec, GstBuffer **outbuf)
   pict_size = gst_emul_avpicture_size (emuldec->context->video.pix_fmt,
     emuldec->context->video.width, emuldec->context->video.height);
 
+//
+  gst_pad_set_bufferalloc_function(GST_PAD_PEER(emuldec->srcpad), (GstPadBufferAllocFunction) emul_buffer_alloc);
+//
+
   ret = gst_pad_alloc_buffer_and_set_caps (emuldec->srcpad,
     GST_BUFFER_OFFSET_NONE, pict_size,
     GST_PAD_CAPS (emuldec->srcpad), outbuf);
@@ -961,7 +969,7 @@ get_output_buffer (GstEmulDec *emuldec, GstBuffer **outbuf)
   emul_av_picture_copy (emuldec->context, GST_BUFFER_DATA (*outbuf),
     GST_BUFFER_SIZE (*outbuf), emuldec->dev);
 
-#if 0 
+#if 0
   GST_BUFFER_DATA (*outbuf) = emuldec->dev->buf;
 #endif
 
@@ -1217,7 +1225,7 @@ gst_emuldec_audio_frame (GstEmulDec *emuldec, CodecElement *codec,
       (int16_t *) GST_BUFFER_DATA (*outbuf), &have_data,
       data, size, emuldec->dev);
 
-#if 0 
+#if 0
   GST_BUFFER_DATA (*outbuf) =
     (uint8_t *)emuldec->dev->buf +
     sizeof(emuldec->context->audio.channel_layout) +
index 050f2e6..70adaa0 100644 (file)
@@ -171,8 +171,8 @@ gst_emul_codectype_to_video_caps (CodecContext *ctx, const char *name,
 {
   GstCaps *caps;
 
-  GST_DEBUG ("context: %p, codec: %s, encode: %d, codec: %p",
-      ctx, name, encode, codec);
+  GST_DEBUG ("context: %p, codec: %s, encode: %d, pixel format: %d",
+      ctx, name, encode, ctx->video.pix_fmt);
 
   if (ctx) {
     caps = gst_emul_pixfmt_to_caps (ctx->video.pix_fmt, ctx, name);