diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2012-08-21 18:23:05 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2012-08-21 18:23:05 +0900 |
commit | a363cbd696a08e0dc9609cea4cac567419923aa2 (patch) | |
tree | 88d61d7ad0f13af43da6f12cbb6b2785b92fe90a | |
parent | 698cf9b745c56f9f47bd1a68d5c6df1ea728e065 (diff) | |
download | libmm-camcorder-a363cbd696a08e0dc9609cea4cac567419923aa2.tar.gz libmm-camcorder-a363cbd696a08e0dc9609cea4cac567419923aa2.tar.bz2 libmm-camcorder-a363cbd696a08e0dc9609cea4cac567419923aa2.zip |
2.0 init
41 files changed, 4751 insertions, 5248 deletions
diff --git a/config.guess b/config.guess deleted file mode 100755 index 40eaed4..0000000 --- a/config.guess +++ /dev/null @@ -1,1517 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-05-11' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include <sys/param.h> -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.sub b/config.sub deleted file mode 100755 index 30fdca8..0000000 --- a/config.sub +++ /dev/null @@ -1,1760 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-03-23' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/configure.ac b/configure.ac index e15e812..0746944 100644 --- a/configure.ac +++ b/configure.ac @@ -85,6 +85,9 @@ PKG_CHECK_MODULES(CAMSRCJPEGENC, camsrcjpegenc) AC_SUBST(CAMSRCJPEGENC_CFLAGS) AC_SUBST(CAMSRCJPEGENC_LIBS) +PKG_CHECK_MODULES(VCONF, vconf) +AC_SUBST(VCONF_CFLAGS) +AC_SUBST(VCONF_LIBS) # Checks for header files. AC_HEADER_STDC diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 7e8f67a..0000000 --- a/debian/changelog +++ /dev/null @@ -1,8 +0,0 @@ -libmm-camcorder (0.5.38-0) unstable; urgency=low - - * Initial release - * Git: pkgs/l/libmm-camcorder - * Tag: libmm-camcorder_0.5.38-0 - - -- Jeongmo Yang <jm80.yang@samsung.com> Wed, 08 Feb 2012 20:37:45 +0900 - diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 29564c4..0000000 --- a/debian/control +++ /dev/null @@ -1,27 +0,0 @@ -Source: libmm-camcorder -Section: libs -Priority: extra -Maintainer: Jeongmo Yang <jm80.yang@samsung.com>, JongHyuk Choi <jhchoi.choi@samsung.com>, Sangchul Lee <sc11.lee@samsung.com> -Uploaders: Seungbae Shin <seungbae.shin@samsung.com> -Build-Depends: debhelper (>= 5), autotools-dev, libmm-common-dev, libmm-common-internal-dev, libmm-log-dev, libexif-dev, libgstreamer-plugins-base0.10-dev, libmm-ta-dev, libmm-sound-dev, libmm-session-dev, libaudiosessionmgr-dev (>=0.1.1), libcamsrcjpegenc-dev, libsndfile1-dev -Standards-Version: 3.7.2 -Homepage: N/A - -Package: libmm-camcorder-dev -Section: libdevel -Architecture: any -Depends: libmm-camcorder (= ${Source-Version}), libmm-common-dev, libmm-log-sdk-dev, libexif-dev, libgstreamer-plugins-base0.10-sdk-dev, libmm-ta-sdk-dev, libmm-sound-sdk-dev, libmm-session-sdk-dev, libaudiosessionmgr-sdk-dev (>=0.1.1) -XB-Generate-Docs: yes -Description: camcorder development library - -Package: libmm-camcorder -Section: libs -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends},libmm-common, libmm-log, libexif12, libgstreamer-plugins-base0.10-0, libmm-ta, libmm-sound-0, libmm-session-0, libaudiosessionmgr-0 (>=0.1.1), libcamsrcjpegenc, libsndfile1 -Description: camcorder library - -Package: libmm-camcorder-dbg -Section: debug -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, libmm-camcorder (= ${Source-Version}) -Description: Camcorder Debug Library (unstripped) diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 2db5a49..0000000 --- a/debian/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - -Contact: Jeongmo Yang <jm80.yang@samsung.com> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index ca882bb..0000000 --- a/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/sbin diff --git a/debian/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 --- a/debian/docs +++ /dev/null diff --git a/debian/libmm-camcorder-dev.install.in b/debian/libmm-camcorder-dev.install.in deleted file mode 100644 index d211184..0000000 --- a/debian/libmm-camcorder-dev.install.in +++ /dev/null @@ -1,5 +0,0 @@ -# if your module creates shared libraries -@PREFIX@/include/mmf/* -@PREFIX@/lib/*.*a -@PREFIX@/lib/pkgconfig/* - diff --git a/debian/libmm-camcorder.install.in b/debian/libmm-camcorder.install.in deleted file mode 100644 index 43c7eb7..0000000 --- a/debian/libmm-camcorder.install.in +++ /dev/null @@ -1,5 +0,0 @@ -# if your module, creates shared libraries -@PREFIX@/lib/*.so* -@PREFIX@/bin/* -@PREFIX@/share/sounds/mm-camcorder/* - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 30ec259..0000000 --- a/debian/rules +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_GNU_OS) - -CFLAGS = -Wall -g -LDFLAGS ?= -PREFIX ?= /usr - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif - -# architecture is not arm -ifneq (, $(findstring arm, $(DEB_HOST_ARCH))) - # do something here for arm architecture - OPTION= --enable-aquila -else - # do something here - OPTION= --enable-aquila --enable-sdk -endif -CFLAGS += -fPIC -LDFLAGS +=-Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,-z,defs -Wl,--hash-style=both - -# shared library versions, option 1 -version=2.0.5 -major=2 -# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so -#version=`ls src/.libs/lib*.so.* | \ -# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` -#major=`ls src/.libs/lib*.so.* | \ -# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` - -config.status: - dh_testdir - ./autogen.sh - # Add here commands to configure the package. - ./configure --prefix=/usr $(OPTION) --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS) -DGST_EXT_TIME_ANALYSIS" LDFLAGS="$(LDFLAGS)" - - -build: build-stamp -build-stamp: config.status - dh_testdir - - # Add here commands to compile the package. - $(MAKE) - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ - sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \ - done - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) distclean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess config.guess -endif - - for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ - rm -f $${f%.in}; \ - done - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/tmp - $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_installexamples - dh_install --sourcedir=debian/tmp -# dh_installmenu -# dh_installdebconf -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit -# dh_installcron -# dh_installinfo - dh_installman - dh_link - dh_strip --dbg-package=libmm-camcorder-dbg - dh_compress - dh_fixperms -# dh_perl -# dh_python - dh_makeshlibs - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 20f8a20..b786cb1 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,42 +1,40 @@ Name: libmm-camcorder -Summary: camcorder library -Version: 0.5.38 -Release: 2 -Group: Libraries +Summary: Camera and recorder library +Version: 0.6.8 +Release: 0 +Group: libs License: Apache-2.0 Source0: %{name}-%{version}.tar.gz +Requires(post): /usr/bin/vconftool Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(mm-common) -BuildRequires: pkgconfig(sndfile) BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(libexif) BuildRequires: pkgconfig(mmutil-imgp) -BuildRequires: pkgconfig(elementary) -BuildRequires: pkgconfig(appcore-efl) -BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(mm-log) BuildRequires: pkgconfig(gstreamer-plugins-base-0.10) BuildRequires: pkgconfig(mm-ta) +BuildRequires: pkgconfig(sndfile) BuildRequires: pkgconfig(mm-session) BuildRequires: pkgconfig(audio-session-mgr) -BuildRequires: pkgconfig(gstreamer-floatcast-0.10) -BuildRequires: pkgconfig(gstreamer-check-0.10) BuildRequires: pkgconfig(camsrcjpegenc) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(vconf) BuildRequires: gst-plugins-base-devel %description -camcorder library. +Camera and recorder library. %package devel -Summary: camcorder development library +Summary: Camera and recorder development library Group: libdevel Version: %{version} Requires: %{name} = %{version}-%{release} %description devel -camcorder development library. +Camera and recorder development library. %prep @@ -44,24 +42,31 @@ camcorder development library. %build +export CFLAGS+=" -DGST_EXT_TIME_ANALYSIS" ./autogen.sh %configure --disable-static make %{?jobs:-j%jobs} %install +rm -rf %{buildroot} %make_install -%post -p /sbin/ldconfig +%post +/sbin/ldconfig + +vconftool set -t int memory/camera/state 0 -i -u 5000 %postun -p /sbin/ldconfig %files +%defattr(-,root,root,-) %{_bindir}/* %{_libdir}/*.so.* /usr/share/sounds/mm-camcorder/* %files devel +%defattr(-,root,root,-) %{_includedir}/mmf/mm_camcorder.h %{_libdir}/pkgconfig/mm-camcorder.pc %{_libdir}/*.so diff --git a/sounds/capture_shutter_01.wav b/sounds/capture_shutter_01.wav Binary files differindex 3752fc4..cc46565 100644 --- a/sounds/capture_shutter_01.wav +++ b/sounds/capture_shutter_01.wav diff --git a/sounds/capture_shutter_02.wav b/sounds/capture_shutter_02.wav Binary files differindex 41af197..cc46565 100644 --- a/sounds/capture_shutter_02.wav +++ b/sounds/capture_shutter_02.wav diff --git a/sounds/recording_start_01.wav b/sounds/recording_start_01.wav Binary files differindex 5f89edd..82cf30a 100644 --- a/sounds/recording_start_01.wav +++ b/sounds/recording_start_01.wav diff --git a/sounds/recording_stop_01.wav b/sounds/recording_stop_01.wav Binary files differindex 5f89edd..0346d4a 100644 --- a/sounds/recording_stop_01.wav +++ b/sounds/recording_stop_01.wav diff --git a/src/Makefile.am b/src/Makefile.am index dfaa6ba..6631a03 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,6 +44,7 @@ libmmfcamcorder_la_CFLAGS = -I$(srcdir)/include \ $(MMSOUND_CFLAGS) \ $(SNDFILE_CFLAGS) \ $(CAMSRCJPEGENC_CFLAGS) \ + $(VCONF_CFLAGS) \ $(AUDIOSESSIONMGR_CFLAGS) libmmfcamcorder_la_LIBADD = \ @@ -58,6 +59,7 @@ libmmfcamcorder_la_LIBADD = \ $(MMSOUND_LIBS) \ $(SNDFILE_LIBS) \ $(CAMSRCJPEGENC_LIBS) \ + $(VCONF_LIBS) \ $(AUDIOSESSIONMGR_LIBS) libmmfcamcorder_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x010 -DMMF_DEBUG_PREFIX=\"MMF-CAMCORDER\" -D_INTERNAL_SESSION_MANAGER_ diff --git a/src/include/mm_camcorder.h b/src/include/mm_camcorder.h index a3f2f73..2b3de94 100644 --- a/src/include/mm_camcorder.h +++ b/src/include/mm_camcorder.h @@ -351,6 +351,10 @@ <td>Target filename. Only used in Audio/Video recording. This is not used for capturing.</td> </tr> <tr> + <td>#MMCAM_TARGET_MAX_SIZE</td> + <td>Maximum size of recording file(Kbyte). If the size of file reaches this value.</td> + </tr> + <tr> <td>#MMCAM_TARGET_TIME_LIMIT</td> <td>Time limit of recording file. If the elapsed time of recording reaches this value.</td> </tr> @@ -680,6 +684,11 @@ extern "C" { #define MMCAM_AUDIO_VOLUME "audio-volume" /** + * Disable Audio stream when record. + */ +#define MMCAM_AUDIO_DISABLE "audio-disable" + +/** * Set audio input route * @remarks Deprecated. This will be removed soon. * @see MMAudioRoutePolicy (in mm_types.h) @@ -693,6 +702,21 @@ extern "C" { #define MMCAM_CAMERA_FORMAT "camera-format" /** + * Slow motion rate when video recording + * @remarks Deprecated + */ +#define MMCAM_CAMERA_SLOW_MOTION_RATE "camera-slow-motion-rate" + +/** + * Motion rate when video recording + * @remarks This should be bigger than 0(zero). + * Default value is 1 and it's for normal video recording. + * If the value is smaller than 1, recorded file will be played slower, + * otherwise, recorded file will be played faster. + */ +#define MMCAM_CAMERA_RECORDING_MOTION_RATE "camera-recording-motion-rate" + +/** * Frames per second. This is an integer field * */ @@ -811,6 +835,12 @@ extern "C" { #define MMCAM_CAMERA_ROTATION "camera-rotation" /** + * HDR(High Dynamic Range) Capture mode + * @see MMCamcorderHDRMode + */ +#define MMCAM_CAMERA_HDR_CAPTURE "camera-hdr-capture" + +/** * Bitrate of Audio Encoder */ #define MMCAM_AUDIO_ENCODER_BITRATE "audio-encoder-bitrate" @@ -921,6 +951,12 @@ extern "C" { #define MMCAM_DISPLAY_SURFACE "display-surface" /** + * Mode of display. + * @see MMDisplayModeType (in mm_types.h) + */ +#define MMCAM_DISPLAY_MODE "display-mode" + +/** * X position of display rectangle. * This is only available when #MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI. * @see MMCamcorderGeometryMethod @@ -1087,9 +1123,50 @@ extern "C" { #define MMCAM_RECOMMEND_DISPLAY_ROTATION "recommend-display-rotation" /** - * Rotation angle of video input stream and display for video recording. + * Recommend width of camera preview. + * This attribute can be used with #mm_camcorder_get_attribute_info and #MMCamcorderPreviewType. + * @see mm_camcorder_get_attribute_info, MMCamcorderPreviewType + */ +#define MMCAM_RECOMMEND_CAMERA_WIDTH "recommend-camera-width" + +/** + * Recommend height of camera preview + * This attribute can be used with #mm_camcorder_get_attribute_info and #MMCamcorderPreviewType. + * @see mm_camcorder_get_attribute_info, MMCamcorderPreviewType */ -#define MMCAM_CAMCORDER_ROTATION "camcorder-rotation" +#define MMCAM_RECOMMEND_CAMERA_HEIGHT "recommend-camera-height" + +/** + * Horizontal Flip of video input stream. + */ +#define MMCAM_CAMERA_FLIP_HORIZONTAL "camera-flip-horizontal" + +/** + * Vertical Flip of video input stream. + */ +#define MMCAM_CAMERA_FLIP_VERTICAL "camera-flip-vertical" + +/** + * X coordinate of Face zoom. + */ +#define MMCAM_CAMERA_FACE_ZOOM_X "camera-face-zoom-x" + +/** + * Y coordinate of Face zoom. + */ +#define MMCAM_CAMERA_FACE_ZOOM_Y "camera-face-zoom-y" + +/** + * Zoom level of Face zoom. + */ +#define MMCAM_CAMERA_FACE_ZOOM_LEVEL "camera-face-zoom-level" + +/** + * Mode of Face zoom. + * @see MMCamcorderFaceZoomMode + */ +#define MMCAM_CAMERA_FACE_ZOOM_MODE "camera-face-zoom-mode" + /*======================================================================================= | ENUM DEFINITIONS | @@ -1290,6 +1367,16 @@ enum MMCamcorderWDRMode { /** + * An enumeration for HDR capture mode + */ +enum MMCamcorderHDRMode { + MM_CAMCORDER_HDR_OFF = 0, /**< HDR OFF */ + MM_CAMCORDER_HDR_ON, /**< HDR ON and no original data - capture callback will be come once */ + MM_CAMCORDER_HDR_ON_AND_ORIGINAL, /**< HDR ON and original data - capture callback will be come twice(1st:Original, 2nd:HDR) */ +}; + + +/** * An enumeration for Anti-handshake mode . */ enum MMCamcorderAHSMode { @@ -1362,6 +1449,23 @@ enum MMCamcorderDetectMode { }; +/** + * An enumeration for Face zoom mode. + */ +enum MMCamcorderFaceZoomMode { + MM_CAMCORDER_FACE_ZOOM_MODE_OFF = 0, /**< turn face zoom off */ + MM_CAMCORDER_FACE_ZOOM_MODE_ON, /**< turn face zoom on */ +}; + +/** + * An enumeration for recommended preview resolution. + */ +enum MMCamcorderPreviewType { + MM_CAMCORDER_PREVIEW_TYPE_NORMAL = 0, /**< normal ratio like 4:3 */ + MM_CAMCORDER_PREVIEW_TYPE_WIDE, /**< wide ratio like 16:9 */ +}; + + /********************************** * Attribute info * **********************************/ @@ -1374,8 +1478,6 @@ typedef enum{ MM_CAM_ATTRS_TYPE_DOUBLE, /**< Double type attribute */ MM_CAM_ATTRS_TYPE_STRING, /**< UTF-8 String type attribute */ MM_CAM_ATTRS_TYPE_DATA, /**< Pointer type attribute */ - MM_CAM_ATTRS_TYPE_ARRAY, /**< Array type attribute */ - MM_CAM_ATTRS_TYPE_RANGE, /**< Range type attribute */ }MMCamAttrsType; @@ -1514,9 +1616,27 @@ typedef struct { /** * Report structure of recording file */ -typedef struct MMCamRecordingReport { +typedef struct { char *recording_filename; /**< File name of stored recording file. Please free after using. */ -}MMCamRecordingReport; /**< report structure definition of recording file */ +} MMCamRecordingReport; /**< report structure definition of recording file */ + + +/** + * Face detect defailed information + */ +typedef struct _MMCamFaceInfo { + int id; /**< id of each face */ + int score; /**< score of each face */ + MMRectType rect; /**< area of face */ +} MMCamFaceInfo; + +/** + * Face detect information + */ +typedef struct _MMCamFaceDetectInfo { + int num_of_faces; /**< number of detected faces */ + MMCamFaceInfo *face_info; /**< face information, this should be freed after use it. */ +} MMCamFaceDetectInfo; /*======================================================================================= diff --git a/src/include/mm_camcorder_attribute.h b/src/include/mm_camcorder_attribute.h index 8a499e5..bcb5b67 100644 --- a/src/include/mm_camcorder_attribute.h +++ b/src/include/mm_camcorder_attribute.h @@ -77,7 +77,7 @@ typedef enum MM_CAM_FILTER_HUE, MM_CAM_FILTER_SHARPNESS, /* 20 */ MM_CAM_CAMERA_FORMAT, - MM_CAM_CAMERA_SLOW_MOTION_FPS, + MM_CAM_CAMERA_RECORDING_MOTION_RATE, MM_CAM_CAMERA_FPS, MM_CAM_CAMERA_WIDTH, MM_CAM_CAMERA_HEIGHT, @@ -120,7 +120,6 @@ typedef enum MM_CAM_DISPLAY_SCALE, MM_CAM_DISPLAY_GEOMETRY_METHOD, MM_CAM_TARGET_FILENAME, - MM_CAM_TARGET_MAX_SIZE, MM_CAM_TARGET_TIME_LIMIT, MM_CAM_TAG_ENABLE, MM_CAM_TAG_IMAGE_DESCRIPTION, @@ -155,7 +154,17 @@ typedef enum MM_CAM_CAPTURED_SCREENNAIL, MM_CAM_CAPTURE_SOUND_ENABLE, MM_CAM_RECOMMEND_DISPLAY_ROTATION, - MM_CAM_CAMCORDER_ROTATION, /* 100 */ + MM_CAM_CAMERA_FLIP_HORIZONTAL, + MM_CAM_CAMERA_FLIP_VERTICAL, + MM_CAM_CAMERA_HDR_CAPTURE, + MM_CAM_DISPLAY_MODE, + MM_CAM_CAMERA_FACE_ZOOM_X, + MM_CAM_CAMERA_FACE_ZOOM_Y, + MM_CAM_CAMERA_FACE_ZOOM_LEVEL, + MM_CAM_CAMERA_FACE_ZOOM_MODE, + MM_CAM_AUDIO_DISABLE, + MM_CAM_RECOMMEND_CAMERA_WIDTH, /* 110 */ + MM_CAM_RECOMMEND_CAMERA_HEIGHT, MM_CAM_NUM }MMCamcorderAttrsID; @@ -172,10 +181,15 @@ typedef struct { char *name; int value_type; int flags; - void* default_value; + union { + void *value_void; + char *value_string; + int value_int; + double value_double; + } default_value; /* default value */ MMCamAttrsValidType validity_type; - int validity_value1; /* can be int min, int *array, double *array, or cast to double min. */ - int validity_value2; /* can be int max, int count, int count, or cast to double max. */ + int validity_value1; /* can be int min, int *array, double *array, or cast to double min. */ + int validity_value2; /* can be int max, int count, int count, or cast to double max. */ mmf_cam_commit_func_t attr_commit; } mm_cam_attr_construct_info; @@ -298,7 +312,9 @@ bool _mmcamcorder_commit_capture_break_cont_shot(MMHandleType handle, int attr_i bool _mmcamcorder_commit_capture_count(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_audio_volume(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_audio_input_route(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_fps(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_width(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_height(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value); @@ -310,12 +326,14 @@ bool _mmcamcorder_commit_camera_wdr(MMHandleType handle, int attr_idx, const mmf bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_hold_af_after_capturing(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_camera_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_image_encoder_quality(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_target_filename(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_filter(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_filter_scene_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_filter_flip(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_display_rotation(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_display_visible(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_display_geometry_method(MMHandleType handle, int attr_idx, const mmf_value_t *value); @@ -323,16 +341,15 @@ bool _mmcamcorder_commit_display_rect(MMHandleType handle, int attr_idx, const m bool _mmcamcorder_commit_display_scale(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_strobe(MMHandleType handle, int attr_idx, const mmf_value_t *value); bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const mmf_value_t *value); -bool _mmcamcorder_commit_camcorder_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_camera_flip_horizontal(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_camera_flip_vertical(MMHandleType handle, int attr_idx, const mmf_value_t *value); +bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value); /** * This function initialize effect setting. * * @param[in] handle Handle of camcorder. - * @return bool - * @remarks - * @see - * + * @return bool Success on TRUE or return FALSE */ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle); @@ -340,10 +357,7 @@ bool _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle); * This function removes writable flag from pre-defined attributes. * * @param[in] handle Handle of camcorder. - * @return void - * @remarks - * @see - * + * @return int Success on MM_ERROR_NONE or return ERROR with error code */ int _mmcamcorder_lock_readonly_attributes(MMHandleType handle); @@ -351,13 +365,19 @@ int _mmcamcorder_lock_readonly_attributes(MMHandleType handle); * This function disable pre-defined attributes. * * @param[in] handle Handle of camcorder. - * @return void - * @remarks - * @see - * + * @return int Success on MM_ERROR_NONE or return ERROR with error code */ int _mmcamcorder_set_disabled_attributes(MMHandleType handle); +/** + * check whether supported or not + * + * @param[in] handle Handle of camcorder. + * @param[in] attr_index index of attribute to check. + * @return bool TRUE if supported or FALSE + */ +bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index); + #ifdef __cplusplus } #endif diff --git a/src/include/mm_camcorder_gstcommon.h b/src/include/mm_camcorder_gstcommon.h index 7ba1605..7b10601 100644 --- a/src/include/mm_camcorder_gstcommon.h +++ b/src/include/mm_camcorder_gstcommon.h @@ -165,8 +165,6 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle); /* plug-in related */ void _mmcamcorder_negosig_handler(GstElement *videosrc, MMHandleType handle); -bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate); -bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate); /* etc */ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element *VideosinkElement); @@ -176,6 +174,11 @@ int _mmcamcorder_get_eos_message(MMHandleType handle); void _mmcamcorder_remove_element_handle(MMHandleType handle, int first_elem, int last_elem); int _mmcamcorder_check_audiocodec_fileformat_compatibility(MMHandleType handle); int _mmcamcorder_check_videocodec_fileformat_compatibility(MMHandleType handle); +bool _mmcamcorder_set_display_rotation(MMHandleType handle, int display_rotate); +bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate); +bool _mmcamcorder_set_videosrc_hflip(MMHandleType handle, int hflip); +bool _mmcamcorder_set_videosrc_vflip(MMHandleType handle, int vflip); +bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake); #ifdef __cplusplus } diff --git a/src/include/mm_camcorder_internal.h b/src/include/mm_camcorder_internal.h index c887273..c008e14 100644 --- a/src/include/mm_camcorder_internal.h +++ b/src/include/mm_camcorder_internal.h @@ -190,6 +190,16 @@ extern "C" { #define _MMCAMCORDER_STATE_CHECK_INTERVAL 5000 /* checking interval */ /** + * Default videosink type + */ +#define _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE "VideosinkElementX" + +/** + * Default recording motion rate + */ +#define _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE 1.0 + +/** * Total level count of manual focus */ #define _MMFCAMCORDER_FOCUS_TOTAL_LEVEL 8 @@ -201,12 +211,22 @@ extern "C" { /** * Minimum integer value */ -#define _MMCAMCORDER_MIN_INT (-2147483648) +#define _MMCAMCORDER_MIN_INT (INT_MIN) + +/** + * Maximum integer value + */ +#define _MMCAMCORDER_MAX_INT (INT_MAX) + +/** + * Minimum double value + */ +#define _MMCAMCORDER_MIN_DOUBLE (DBL_MIN) /** * Maximum integer value */ -#define _MMCAMCORDER_MAX_INT (2147483647) +#define _MMCAMCORDER_MAX_DOUBLE (DBL_MAX) /** * Audio timestamp margin (msec) @@ -295,6 +315,7 @@ extern "C" { #define MM_CAMCORDER_AUTO_EXPOSURE_NUM 9 /**< Number of Auto exposure type */ #define MM_CAMCORDER_WDR_NUM 3 /**< Number of wide dynamic range */ #define MM_CAMCORDER_AHS_NUM 4 /**< Number of anti-handshake */ +#define MM_CAMCORDER_HDR_CAPTURE_NUM 3 /**< Number of HDR capture mode */ #define MM_CAMCORDER_GEOMETRY_METHOD_NUM 4 /**< Number of geometry method */ #define MM_CAMCORDER_TAG_ORT_NUM 8 /**< Number of tag orientation */ #define MM_CAMCORDER_STROBE_MODE_NUM 8 /**< Number of strobe mode type */ @@ -443,7 +464,6 @@ typedef enum { } _MMCamcorderStateChange; - /*======================================================================================= | STRUCTURE DEFINITIONS | ========================================================================================*/ @@ -503,37 +523,38 @@ typedef struct { * MMCamcorder Sub Context */ typedef struct { - bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */ - bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */ - int element_num; /**< count of element */ - int cam_stability_count; /**< camsensor stability count. the count of frame will drop */ - GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */ - GstClockTime pause_time; /** amount of time while pipeline is in PAUSE state.*/ - GstClockTime stillshot_time; /** pipeline time of capturing moment*/ - gboolean is_slow; - gboolean error_occurs; - gboolean ferror_send; /** file write/seek error **/ - guint ferror_count; /** file write/seek error count **/ + bool isMaxsizePausing; /**< Because of size limit, pipeline is paused. */ + bool isMaxtimePausing; /**< Because of time limit, pipeline is paused. */ + int element_num; /**< count of element */ + int cam_stability_count; /**< camsensor stability count. the count of frame will drop */ + GstClockTime pipeline_time; /**< current time of Gstreamer Pipeline */ + GstClockTime pause_time; /**< amount of time while pipeline is in PAUSE state.*/ + GstClockTime stillshot_time; /**< pipeline time of capturing moment*/ + gboolean is_modified_rate; /**< whether recording motion rate is modified or not */ + gboolean error_occurs; /**< flag for error */ + int error_code; /**< error code for internal gstreamer error */ + gboolean ferror_send; /**< file write/seek error **/ + guint ferror_count; /**< file write/seek error count **/ GstClockTime previous_slot_time; - int display_interval; /** This value is set as 'GST_SECOND / display FPS' */ - gboolean bget_eos; /** Whether getting EOS */ - gboolean bencbin_capture; /** Use Encodebin for capturing */ - gboolean now_continuous_af; /** whether continuous af starts */ + int display_interval; /**< This value is set as 'GST_SECOND / display FPS' */ + gboolean bget_eos; /**< Whether getting EOS */ + gboolean bencbin_capture; /**< Use Encodebin for capturing */ + gboolean audio_disable; /**< whether audio is disabled or not when record */ /* For dropping video frame when start recording */ - int drop_vframe; /**< When this value is bigger than zero and pass_first_vframe is zero, MSL will drop video frame though cam_stability count is bigger then zero. */ - int pass_first_vframe; /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */ + int drop_vframe; /**< When this value is bigger than zero and pass_first_vframe is zero, MSL will drop video frame though cam_stability count is bigger then zero. */ + int pass_first_vframe; /**< When this value is bigger than zero, MSL won't drop video frame though "drop_vframe" is bigger then zero. */ /* INI information */ - unsigned int fourcc; /**< Get fourcc value of camera INI file */ - void *info; /**< extra information for camcorder */ + unsigned int fourcc; /**< Get fourcc value of camera INI file */ + void *info; /**< extra information for camcorder */ - _MMCamcorderGstElement *element; /**< array of Gstreamer element */ - _MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */ + _MMCamcorderGstElement *element; /**< array of Gstreamer element */ + _MMCamcorderKPIMeasure kpi; /**< information related with performance measurement */ - type_element *VideosinkElement; /**< configure data of videosink element */ - gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */ - gboolean internal_encode; /**< whether use internal encoding function */ + type_element *VideosinkElement; /**< configure data of videosink element */ + gboolean SensorEncodedCapture; /**< whether camera sensor support encoded image capture */ + gboolean internal_encode; /**< whether use internal encoding function */ } _MMCamcorderSubContext; /** @@ -575,15 +596,18 @@ typedef struct mmf_camcorder { int (*command)(MMHandleType, int); /**< camcorder's command */ /* etc */ - _MMCamcorderMTSafe mtsafe; /**< Thread safe */ - _MMCamcorderCommand cmd; /**< information for command loop */ - int sync_state_change; /**< Change framework state synchronously */ + _MMCamcorderMTSafe mtsafe; /**< Thread safe */ + _MMCamcorderCommand cmd; /**< information for command loop */ + int sync_state_change; /**< Change framework state synchronously */ int quick_device_close; - int state_change_by_system; /**< MSL changes its state by itself because of system(ASM,MDM..) **/ - int asm_event_code; /**< event code of audio session manager */ - pthread_mutex_t sound_lock; /**< Capture sound mutex */ - pthread_cond_t sound_cond; /**< Capture sound cond */ - int use_zero_copy_format; /**< Whether use zero copy format for camera input */ + int state_change_by_system; /**< MSL changes its state by itself because of system(ASM,MDM..) **/ + int asm_event_code; /**< event code of audio session manager */ + pthread_mutex_t sound_lock; /**< Capture sound mutex */ + pthread_cond_t sound_cond; /**< Capture sound cond */ + int use_zero_copy_format; /**< Whether use zero copy format for camera input */ + + _MMCamcorderInfoConverting caminfo_convert[CAMINFO_CONVERT_NUM]; /**< converting structure of camera info */ + _MMCamcorderEnumConvert enum_conv[ENUM_CONVERT_NUM]; /**< enum converting list that is modified by ini info */ int reserved[4]; /**< reserved */ } mmf_camcorder_t; @@ -996,6 +1020,22 @@ int _mmcamcorder_set_functions(MMHandleType handle, int type); gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpointer data); /** + * This function is callback function of main pipeline. + * Once this function is registered with certain pipeline using gst_bus_set_sync_handler(), + * this callback will be called every time when there is upcomming message from pipeline. + * Basically, this function is used as sync error handling function, now. + * + * @param[in] bus pointer of buf that called this function. + * @param[in] message callback message from pipeline. + * @param[in] data user data. + * @return This function returns true on success, or false value with error + * @remarks + * @see __mmcamcorder_create_preview_pipeline() + * + */ +GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data); + +/** * This function create main pipeline according to type. * * @param[in] handle Handle of camcorder context. diff --git a/src/include/mm_camcorder_platform.h b/src/include/mm_camcorder_platform.h index 171a9f4..3ba54a9 100644 --- a/src/include/mm_camcorder_platform.h +++ b/src/include/mm_camcorder_platform.h @@ -142,6 +142,9 @@ extern "C" { */ #define _MMCAMCORDER_SENSOR_ENUM_NONE -255 +/* camera information related */ +#define CAMINFO_CONVERT_NUM 40 + /*======================================================================================= | ENUM DEFINITIONS | @@ -162,6 +165,20 @@ typedef enum { MM_CAMCONVERT_TYPE_USER, /* user define */ } MMCamConvertingType; +typedef enum { + ENUM_CONVERT_WHITE_BALANCE = 0, + ENUM_CONVERT_COLOR_TONE, + ENUM_CONVERT_ISO, + ENUM_CONVERT_PROGRAM_MODE, + ENUM_CONVERT_FOCUS_MODE, + ENUM_CONVERT_AF_RANGE, + ENUM_CONVERT_EXPOSURE_MODE, + ENUM_CONVERT_STROBE_MODE, + ENUM_CONVERT_WDR, + ENUM_CONVERT_ANTI_HAND_SHAKE, + ENUM_CONVERT_NUM +} MMCamConvertingEnum; + /*======================================================================================= | STRUCTURE DEFINITIONS | ========================================================================================*/ @@ -204,8 +221,8 @@ typedef struct { /*======================================================================================= | GLOBAL FUNCTION PROTOTYPES | ========================================================================================*/ -int _mmcamcorder_convert_msl_to_sensor(int attr_idx, int mslval); -int _mmcamcorder_convert_sensor_to_msl(int attr_idx, int sensval); +int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int mslval); +int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int sensval); int _mmcamcorder_set_converted_value(MMHandleType handle, _MMCamcorderEnumConvert *convert); int _mmcamcorder_init_convert_table(MMHandleType handle); diff --git a/src/include/mm_camcorder_sound.h b/src/include/mm_camcorder_sound.h index 199f27c..f193e5b 100644 --- a/src/include/mm_camcorder_sound.h +++ b/src/include/mm_camcorder_sound.h @@ -25,6 +25,7 @@ /*======================================================================================= | INCLUDE FILES | ========================================================================================*/ +#include <pulse/pulseaudio.h> #ifdef __cplusplus extern "C" { @@ -51,7 +52,6 @@ extern "C" { typedef enum { _MMCAMCORDER_SOUND_STATE_NONE, _MMCAMCORDER_SOUND_STATE_INIT, - _MMCAMCORDER_SOUND_STATE_PREPARE, _MMCAMCORDER_SOUND_STATE_PLAYING, } _MMCamcorderSoundState; @@ -62,21 +62,30 @@ typedef enum { * Structure of sound info */ typedef struct __SOUND_INFO { - SF_INFO sfinfo; - SNDFILE *infile; - short *pcm_buf; - int pcm_size; - char *filename; - + /* PCM */ MMSoundPcmHandle_t handle; + mm_sound_device_out active_out_backup; - int thread_run; - pthread_t thread; + /* mutex and cond */ pthread_mutex_t play_mutex; pthread_cond_t play_cond; pthread_mutex_t open_mutex; pthread_cond_t open_cond; - system_audio_route_t route_policy_backup; + + /* pulse audio */ + pa_threaded_mainloop *pulse_mainloop; + pa_context *pulse_context; + +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /* sound file */ + SF_INFO sfinfo; + SNDFILE *infile; + char *filename; + pa_stream *sample_stream; + pa_sample_spec sample_spec; + size_t sample_length; + pa_channel_map channel_map; +#endif _MMCamcorderSoundState state; } SOUND_INFO; @@ -89,11 +98,15 @@ typedef struct __SOUND_INFO { /*======================================================================================= | GLOBAL FUNCTION PROTOTYPES | ========================================================================================*/ +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename); -gboolean _mmcamcorder_sound_prepare(MMHandleType handle); +#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ +gboolean _mmcamcorder_sound_init(MMHandleType handle); +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ gboolean _mmcamcorder_sound_play(MMHandleType handle); gboolean _mmcamcorder_sound_finalize(MMHandleType handle); +gboolean _mmcamcorder_sound_capture_play_cb(gpointer data); void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync); #ifdef __cplusplus diff --git a/src/include/mm_camcorder_stillshot.h b/src/include/mm_camcorder_stillshot.h index 525237a..2e4ab6e 100644 --- a/src/include/mm_camcorder_stillshot.h +++ b/src/include/mm_camcorder_stillshot.h @@ -66,6 +66,9 @@ typedef struct { int width; /**< Width of capture image */ int height; /**< Height of capture image */ int interval; /**< Capture interval */ + int preview_format; /**< Preview format */ + int hdr_capture_mode; /**< HDR Capture mode */ + gboolean played_capture_sound; /**< whether play capture sound when capture starts */ } _MMCamcorderImageInfo; /*======================================================================================= @@ -119,12 +122,11 @@ int _mmcamcorder_image_command(MMHandleType handle, int command); int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int capture_height); /* Function for capture */ -int __mmcamcorder_set_exif_basic_info(MMHandleType handle); +int __mmcamcorder_set_exif_basic_info(MMHandleType handle, MMCamcorderCaptureDataType *capture_data); void __mmcamcorder_init_stillshot_info(MMHandleType handle); void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstBuffer *buffer); void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest); gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureDataType *original, MMCamcorderCaptureDataType *thumbnail); -gboolean __mmcamcorder_capture_send_msg(MMHandleType handle, int type, int count); gboolean __mmcamcorder_set_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest, MMCamcorderCaptureDataType *thumbnail); #ifdef __cplusplus diff --git a/src/include/mm_camcorder_util.h b/src/include/mm_camcorder_util.h index c9df689..6198759 100644 --- a/src/include/mm_camcorder_util.h +++ b/src/include/mm_camcorder_util.h @@ -144,6 +144,16 @@ do { \ ((gchar)(((fourcc)>>16)&0xff)), \ ((gchar)(((fourcc)>>24)&0xff)) +#define MMCAM_SEND_MESSAGE(handle, msg_id, msg_code) \ +{\ + _MMCamcorderMsgItem msg;\ + msg.id = msg_id;\ + msg.param.code = msg_code;\ + _mmcam_dbg_log("msg id : %x, code : %x", msg_id, msg_code);\ + _mmcamcroder_send_message((MMHandleType)handle, &msg);\ +} + + /*======================================================================================= | ENUM DEFINITIONS | ========================================================================================*/ @@ -188,6 +198,59 @@ typedef struct { MMMessageParamType param; /**< message parameter */ } _MMCamcorderMsgItem; +/** + * Structure of zero copy image buffer + */ +#define SCMN_IMGB_MAX_PLANE (4) + +/* image buffer definition *************************************************** + + +------------------------------------------+ --- + | | ^ + | a[], p[] | | + | +---------------------------+ --- | | + | | | ^ | | + | |<---------- w[] ---------->| | | | + | | | | | | + | | | | + | | | h[] | e[] + | | | | + | | | | | | + | | | | | | + | | | v | | + | +---------------------------+ --- | | + | | v + +------------------------------------------+ --- + + |<----------------- s[] ------------------>| +*/ + +typedef struct +{ + /* width of each image plane */ + int w[SCMN_IMGB_MAX_PLANE]; + /* height of each image plane */ + int h[SCMN_IMGB_MAX_PLANE]; + /* stride of each image plane */ + int s[SCMN_IMGB_MAX_PLANE]; + /* elevation of each image plane */ + int e[SCMN_IMGB_MAX_PLANE]; + /* user space address of each image plane */ + void *a[SCMN_IMGB_MAX_PLANE]; + /* physical address of each image plane, if needs */ + void *p[SCMN_IMGB_MAX_PLANE]; + /* color space type of image */ + int cs; + /* left postion, if needs */ + int x; + /* top position, if needs */ + int y; + /* to align memory */ + int __dummy2; + /* arbitrary data */ + int data[16]; +} SCMN_IMGB; + /*======================================================================================= | CONSTANT DEFINITIONS | ========================================================================================*/ diff --git a/src/include/mm_camcorder_videorec.h b/src/include/mm_camcorder_videorec.h index e5018d5..31a7e05 100644 --- a/src/include/mm_camcorder_videorec.h +++ b/src/include/mm_camcorder_videorec.h @@ -52,7 +52,7 @@ extern "C" { typedef struct { gboolean b_commiting; /**< Is it commiting now? */ char *filename; /**< recorded filename */ - gint multiple_fps; /**< fps for high speed recording(slow motion recording) */ + double record_timestamp_ratio; /**< timestamp ratio of video recording for slow motion recording */ guint64 video_frame_count; /**< current video frame */ guint64 audio_frame_count; /**< current audio frame */ guint64 filesize; /**< current file size */ @@ -132,6 +132,19 @@ int _mmcamcorder_video_command(MMHandleType handle, int command); */ int _mmcamcorder_video_handle_eos(MMHandleType handle); +/** + * This function is called for captured image data while video recording. + * + * @param[in] element GStreamer element that calls this. + * @param[in] buffer1 Main image buffer. + * @param[in] buffer2 Thumbnail image buffer. + * @param[in] buffer3 Screennail image buffer for postview. + * @param[in] u_data user data. + * @return void + * @remarks + */ +void _mmcamcorder_video_snapshot_capture_cb(GstElement *element, GstBuffer *buffer1, GstBuffer *buffer2, GstBuffer *buffer3, gpointer u_data); + #ifdef __cplusplus } #endif diff --git a/src/mm_camcorder_attribute.c b/src/mm_camcorder_attribute.c index f9df6d7..7725e55 100644 --- a/src/mm_camcorder_attribute.c +++ b/src/mm_camcorder_attribute.c @@ -29,27 +29,18 @@ #include <gst/interfaces/cameracontrol.h> #include <gst/interfaces/xoverlay.h> +/*----------------------------------------------------------------------- +| MACRO DEFINITIONS: | +-----------------------------------------------------------------------*/ +#define MMCAMCORDER_DEFAULT_CAMERA_WIDTH 640 +#define MMCAMCORDER_DEFAULT_CAMERA_HEIGHT 480 /*--------------------------------------------------------------------------------------- | GLOBAL VARIABLE DEFINITIONS for internal | ---------------------------------------------------------------------------------------*/ -int video_input_rotation[] = {MM_VIDEO_INPUT_ROTATION_NONE, - MM_VIDEO_INPUT_ROTATION_90, - MM_VIDEO_INPUT_ROTATION_180, - MM_VIDEO_INPUT_ROTATION_270, - MM_VIDEO_INPUT_ROTATION_FLIP_HORZ, - MM_VIDEO_INPUT_ROTATION_FLIP_VERT}; - int depth[] = {MM_CAMCORDER_AUDIO_FORMAT_PCM_U8, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE}; -int rotation[] = {MM_DISPLAY_ROTATION_NONE, - MM_DISPLAY_ROTATION_90, - MM_DISPLAY_ROTATION_180, - MM_DISPLAY_ROTATION_270, - MM_DISPLAY_ROTATION_FLIP_HORZ, - MM_DISPLAY_ROTATION_FLIP_VERT}; - int visible_values[] = { 0, 1 }; /*0: off, 1:on*/ int strobe_mode[] = {MM_CAMCORDER_STROBE_MODE_OFF, @@ -83,7 +74,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "mode", /* Name */ MMF_VALUE_TYPE_INT, /* Type */ MM_ATTRS_FLAG_RW, /* Flag */ - (void*)MM_CAMCORDER_MODE_IMAGE, /* Default value */ + {(void*)MM_CAMCORDER_MODE_IMAGE}, /* Default value */ MM_ATTRS_VALID_TYPE_INT_RANGE, /* Validity type */ MM_CAMCORDER_MODE_IMAGE, /* Validity val1 (min, *array,...) */ MM_CAMCORDER_MODE_VIDEO, /* Validity val2 (max, count, ...) */ @@ -95,7 +86,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-device", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_AUDIO_DEVICE_MIC, + {(void*)MM_AUDIO_DEVICE_MIC}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, MM_AUDIO_DEVICE_NUM-1, @@ -107,7 +98,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-device", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_VIDEO_DEVICE_NONE, + {(void*)MM_VIDEO_DEVICE_NONE}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_VIDEO_DEVICE_NONE, MM_VIDEO_DEVICE_NUM-1, @@ -119,7 +110,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-encoder", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_AUDIO_CODEC_AMR, + {(void*)MM_AUDIO_CODEC_AMR}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)NULL, 0, @@ -131,7 +122,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "video-encoder", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_VIDEO_CODEC_MPEG4, + {(void*)MM_VIDEO_CODEC_MPEG4}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)NULL, 0, @@ -143,7 +134,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "image-encoder", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_IMAGE_CODEC_JPEG, + {(void*)MM_IMAGE_CODEC_JPEG}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)NULL, 0, @@ -155,7 +146,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "file-format", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_FILE_FORMAT_MP4, + {(void*)MM_FILE_FORMAT_MP4}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)NULL, 0, @@ -167,7 +158,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-device-name", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - (void*)NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -179,7 +170,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-samplerate", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)8000, + {(void*)8000}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -191,7 +182,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-format", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE, + {(void*)MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)depth, ARRAY_SIZE(depth), @@ -203,7 +194,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-channel", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)2, + {(void*)2}, MM_ATTRS_VALID_TYPE_INT_RANGE, 1, 2, @@ -215,7 +206,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-volume", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)1, + {(void*)1}, MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, 0, 10.0, @@ -227,7 +218,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-input-route", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING, + {(void*)MM_AUDIOROUTE_USE_EXTERNAL_SETTING}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_AUDIOROUTE_USE_EXTERNAL_SETTING, MM_AUDIOROUTE_CAPTURE_STEREOMIC_ONLY, @@ -239,7 +230,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-scene-mode", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -251,7 +242,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-brightness", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)1, + {(void*)1}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -263,7 +254,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-contrast", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -275,7 +266,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-wb", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -287,7 +278,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-color-tone", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -299,7 +290,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-saturation", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -311,7 +302,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-hue", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -323,7 +314,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "filter-sharpness", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -335,7 +326,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-format", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_PIXEL_FORMAT_YUYV, + {(void*)MM_PIXEL_FORMAT_YUYV}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -343,15 +334,15 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ }, //22 { - MM_CAM_CAMERA_SLOW_MOTION_FPS, - "camera-slow-motion-fps", - MMF_VALUE_TYPE_INT, + MM_CAM_CAMERA_RECORDING_MOTION_RATE, + "camera-recording-motion-rate", + MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, - MM_ATTRS_VALID_TYPE_INT_RANGE, + {(void*)1}, + MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, 0, - _MMCAMCORDER_MAX_INT, - NULL, + _MMCAMCORDER_MAX_DOUBLE, + _mmcamcorder_commit_camera_recording_motion_rate, }, //23 { @@ -359,7 +350,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-fps", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)30, + {(void*)30}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -371,7 +362,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-width", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)320, + {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -383,7 +374,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-height", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)240, + {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -395,7 +386,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-digital-zoom", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)10, + {(void*)10}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -407,7 +398,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-optical-zoom", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -419,7 +410,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-focus-mode", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_CAMCORDER_FOCUS_MODE_NONE, + {(void*)MM_CAMCORDER_FOCUS_MODE_NONE}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -431,7 +422,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-af-scan-range", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -443,7 +434,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-exposure-mode", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -455,7 +446,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-exposure-value", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -467,7 +458,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-f-number", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -479,7 +470,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-shutter-speed", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -491,7 +482,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-iso", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -503,7 +494,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-wdr", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -515,7 +506,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-anti-handshake", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -527,7 +518,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-fps-auto", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)FALSE, + {(void*)FALSE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -539,7 +530,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-hold-af-after-capturing", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -551,7 +542,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-delay-attr-setting", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)FALSE, + {(void*)FALSE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -563,7 +554,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "audio-encoder-bitrate", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -575,7 +566,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "video-encoder-bitrate", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -587,7 +578,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "image-encoder-quality", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)95, + {(void*)95}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -599,7 +590,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-format", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_PIXEL_FORMAT_ENCODED, + {(void*)MM_PIXEL_FORMAT_ENCODED}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -611,7 +602,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-width", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)1600, + {(void*)1600}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -623,7 +614,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-height", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)1200, + {(void*)1200}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -635,7 +626,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-count", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)1, + {(void*)1}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -647,7 +638,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-interval", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -659,7 +650,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-break-cont-shot", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)FALSE, + {(void*)FALSE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -671,7 +662,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-handle", MMF_VALUE_TYPE_DATA, MM_ATTRS_FLAG_RW, - (void*)NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -683,7 +674,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-device", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_DISPLAY_DEVICE_MAINLCD, + {(void*)MM_DISPLAY_DEVICE_MAINLCD}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -695,7 +686,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-surface", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_DISPLAY_SURFACE_X, + {(void*)MM_DISPLAY_SURFACE_X}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -707,7 +698,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-rect-x", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -719,7 +710,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-rect-y", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -731,7 +722,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-rect-width", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -743,7 +734,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-rect-height", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -755,7 +746,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-src-x", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -767,7 +758,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-src-y", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -779,7 +770,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-src-width", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -791,7 +782,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-src-height", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -803,10 +794,10 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-rotation", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_DISPLAY_ROTATION_NONE, - MM_ATTRS_VALID_TYPE_INT_ARRAY, - (int)rotation, - ARRAY_SIZE(rotation), + {(void*)MM_DISPLAY_ROTATION_NONE}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + MM_DISPLAY_ROTATION_NONE, + MM_DISPLAY_ROTATION_270, _mmcamcorder_commit_display_rotation, }, //61 @@ -815,7 +806,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-visible", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)1, + {(void*)1}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)visible_values, ARRAY_SIZE(visible_values), @@ -827,7 +818,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-scale", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_DISPLAY_SCALE_DEFAULT, MM_DISPLAY_SCALE_TRIPLE_LENGTH, @@ -839,7 +830,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "display-geometry-method", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_DISPLAY_METHOD_LETTER_BOX, MM_DISPLAY_METHOD_CUSTOM_ROI, @@ -851,31 +842,19 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "target-filename", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - (void*)"/tmp/CAM-NONAME", + {(void*)"/tmp/CAM-NONAME"}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, _mmcamcorder_commit_target_filename, }, - //65 - { - MM_CAM_TARGET_MAX_SIZE, - "target-max-size", - MMF_VALUE_TYPE_INT, - MM_ATTRS_FLAG_RW, - (void*)0, - MM_ATTRS_VALID_TYPE_INT_RANGE, - 0, - _MMCAMCORDER_MAX_INT, - NULL, - }, //66 { MM_CAM_TARGET_TIME_LIMIT, "target-time-limit", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -887,8 +866,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-enable", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, -// (void*)tag_enable_values[0], - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -900,7 +878,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-image-description", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - (void*)NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -912,8 +890,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-orientation", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, -// (void*)tag_orientation_values[0], - (void*)1, + {(void*)1}, MM_ATTRS_VALID_TYPE_INT_ARRAY, (int)tag_orientation_values, ARRAY_SIZE(tag_orientation_values), @@ -925,7 +902,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-software", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - (void*)NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -937,7 +914,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-latitude", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, -360, 360, @@ -949,7 +926,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-longitude", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, -360, 360, @@ -961,7 +938,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-altitude", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, -999999, 999999, @@ -973,7 +950,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "strobe-control", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -985,7 +962,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "strobe-capabilities", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -997,10 +974,10 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "strobe-mode", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, - (int)strobe_mode, - ARRAY_SIZE(strobe_mode), + 0, + 0, _mmcamcorder_commit_strobe, }, //77 @@ -1009,7 +986,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "detect-mode", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -1021,7 +998,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "detect-number", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -1033,7 +1010,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "detect-focus-select", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -1045,7 +1022,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "detect-select-number", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, -1, @@ -1057,7 +1034,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "detect-status", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_ARRAY, 0, 0, @@ -1069,7 +1046,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-zero-systemlag", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)FALSE, + {(void*)FALSE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -1081,7 +1058,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-af-touch-x", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -1093,7 +1070,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-af-touch-y", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -1105,7 +1082,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-af-touch-width", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -1117,7 +1094,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-af-touch-height", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, _MMCAMCORDER_MAX_INT, @@ -1129,7 +1106,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-focal-length", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_DOUBLE_RANGE, 0, 1000, @@ -1141,10 +1118,10 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "recommend-preview-format-for-capture", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_PIXEL_FORMAT_YUYV, + {(void*)MM_PIXEL_FORMAT_YUYV}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_PIXEL_FORMAT_NV12, - MM_PIXEL_FORMAT_ENCODED, + MM_PIXEL_FORMAT_ITLV_JPEG_UYVY, NULL, }, //89 @@ -1153,10 +1130,10 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "recommend-preview-format-for-recording", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_PIXEL_FORMAT_NV12, + {(void*)MM_PIXEL_FORMAT_NV12}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_PIXEL_FORMAT_NV12, - MM_PIXEL_FORMAT_ENCODED, + MM_PIXEL_FORMAT_ITLV_JPEG_UYVY, NULL, }, //90 @@ -1165,7 +1142,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-thumbnail", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)TRUE, + {(void*)TRUE}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -1177,7 +1154,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-gps-enable", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)TRUE, + {(void*)TRUE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -1189,7 +1166,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-gps-time-stamp", MMF_VALUE_TYPE_DOUBLE, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -1201,7 +1178,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-gps-date-stamp", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -1213,7 +1190,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "tag-gps-processing-method", MMF_VALUE_TYPE_STRING, MM_ATTRS_FLAG_RW, - NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -1225,10 +1202,10 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "camera-rotation", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_VIDEO_INPUT_ROTATION_NONE, - MM_ATTRS_VALID_TYPE_INT_ARRAY, - (int)video_input_rotation, - ARRAY_SIZE(video_input_rotation), + {(void*)MM_VIDEO_INPUT_ROTATION_NONE}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + MM_VIDEO_INPUT_ROTATION_NONE, + MM_VIDEO_INPUT_ROTATION_270, _mmcamcorder_commit_camera_rotate, }, //96 @@ -1237,7 +1214,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "enable-converted-stream-callback", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)0, + {(void*)0}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -1249,7 +1226,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "captured-screennail", MMF_VALUE_TYPE_DATA, MM_ATTRS_FLAG_RW, - (void*)NULL, + {(void*)NULL}, MM_ATTRS_VALID_TYPE_NONE, 0, 0, @@ -1261,7 +1238,7 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "capture-sound-enable", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)FALSE, + {(void*)TRUE}, MM_ATTRS_VALID_TYPE_INT_RANGE, 0, 1, @@ -1273,23 +1250,143 @@ mm_cam_attr_construct_info cam_attrs_const_info[] ={ "recommend-display-rotation", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_DISPLAY_ROTATION_270, + {(void*)MM_DISPLAY_ROTATION_270}, MM_ATTRS_VALID_TYPE_INT_RANGE, MM_DISPLAY_ROTATION_NONE, - MM_DISPLAY_ROTATION_FLIP_VERT, + MM_DISPLAY_ROTATION_270, NULL, }, - //100 + //101 { - MM_CAM_CAMCORDER_ROTATION, - "camcorder-rotation", + MM_CAM_CAMERA_FLIP_HORIZONTAL, + "camera-flip-horizontal", MMF_VALUE_TYPE_INT, MM_ATTRS_FLAG_RW, - (void*)MM_VIDEO_INPUT_ROTATION_NONE, + {(void*)FALSE}, MM_ATTRS_VALID_TYPE_INT_RANGE, - MM_VIDEO_INPUT_ROTATION_NONE, - MM_VIDEO_INPUT_ROTATION_270, - _mmcamcorder_commit_camcorder_rotate, + FALSE, + TRUE, + _mmcamcorder_commit_camera_flip_horizontal, + }, + //102 + { + MM_CAM_CAMERA_FLIP_VERTICAL, + "camera-flip-vertical", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)FALSE}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + FALSE, + TRUE, + _mmcamcorder_commit_camera_flip_vertical, + }, + //103 + { + MM_CAM_CAMERA_HDR_CAPTURE, + "camera-hdr-capture", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)FALSE}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + 0, + 0, + _mmcamcorder_commit_camera_hdr_capture, + }, + //104 + { + MM_CAM_DISPLAY_MODE, + "display-mode", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)MM_DISPLAY_MODE_DEFAULT}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + 0, + 0, + _mmcamcorder_commit_display_mode, + }, + //105 + { + MM_CAM_CAMERA_FACE_ZOOM_X, + "camera-face-zoom-x", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + 0, + _MMCAMCORDER_MAX_INT, + _mmcamcorder_commit_camera_face_zoom, + }, + //106 + { + MM_CAM_CAMERA_FACE_ZOOM_Y, + "camera-face-zoom-y", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + 0, + _MMCAMCORDER_MAX_INT, + _mmcamcorder_commit_camera_face_zoom, + }, + //107 + { + MM_CAM_CAMERA_FACE_ZOOM_LEVEL, + "camera-face-zoom-level", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)0}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + 0, + -1, + NULL, + }, + //108 + { + MM_CAM_CAMERA_FACE_ZOOM_MODE, + "camera-face-zoom-mode", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)FALSE}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + 0, + 0, + _mmcamcorder_commit_camera_face_zoom, + }, + //109 + { + MM_CAM_AUDIO_DISABLE, + "audio-disable", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)FALSE}, + MM_ATTRS_VALID_TYPE_INT_RANGE, + FALSE, + TRUE, + _mmcamcorder_commit_audio_disable, + }, + //110 + { + MM_CAM_RECOMMEND_CAMERA_WIDTH, + "recommend-camera-width", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)MMCAMCORDER_DEFAULT_CAMERA_WIDTH}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + 0, + 0, + NULL, + }, + //111 + { + MM_CAM_RECOMMEND_CAMERA_HEIGHT, + "recommend-camera-height", + MMF_VALUE_TYPE_INT, + MM_ATTRS_FLAG_RW, + {(void*)MMCAMCORDER_DEFAULT_CAMERA_HEIGHT}, + MM_ATTRS_VALID_TYPE_INT_ARRAY, + 0, + 0, + NULL, }, }; @@ -1319,6 +1416,7 @@ static int readonly_attributes[] = { static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, int height); static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height); static int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle); +static int __mmcamcorder_release_conf_valid_info(MMHandleType handle); static bool __mmcamcorder_attrs_is_supported(MMHandleType handle, int idx); static int __mmcamcorder_check_valid_pair(MMHandleType handle, char **err_attr_name, const char *attribute_name, va_list var_args); @@ -1336,57 +1434,51 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) _mmcam_dbg_log( "" ); MMHandleType attrs = 0; - mmf_attrs_construct_info_t * attrs_const_info = NULL; + mmf_attrs_construct_info_t *attrs_const_info = NULL; int attr_count = 0; int idx; - + /* Create attribute constructor */ - _mmcam_dbg_log( "start" ); - //set runtime values to 'cam_attrs_const_info' - { - cam_attrs_const_info[MM_CAM_CAMERA_DEVICE].default_value = (void*)info->videodev_type; - } + _mmcam_dbg_log("start"); + /* set runtime values to 'cam_attrs_const_info' */ + cam_attrs_const_info[MM_CAM_CAMERA_DEVICE].default_value.value_int = info->videodev_type; - //alloc 'mmf_attrs_construct_info_t' - attr_count = ARRAY_SIZE( cam_attrs_const_info ); + /* alloc 'mmf_attrs_construct_info_t' */ + attr_count = ARRAY_SIZE(cam_attrs_const_info); attrs_const_info = malloc(attr_count * sizeof(mmf_attrs_construct_info_t)); - if (!attrs_const_info) - { - _mmcam_dbg_err( "Fail to alloc constructor." ); + if (!attrs_const_info) { + _mmcam_dbg_err("Fail to alloc constructor."); return 0; } - for (idx = 0; idx < attr_count; idx++) - { - //attribute order check. - if (idx != cam_attrs_const_info[idx].attrid) //This should be same. - { - _mmcam_dbg_err( "Please check attributes order. Is the idx same with enum val?" ); + for (idx = 0 ; idx < attr_count ; idx++) { + /* attribute order check. This should be same. */ + if (idx != cam_attrs_const_info[idx].attrid) { + _mmcam_dbg_err("Please check attributes order. Is the idx same with enum val?"); return 0; } attrs_const_info[idx].name = cam_attrs_const_info[idx].name; attrs_const_info[idx].value_type = cam_attrs_const_info[idx].value_type; attrs_const_info[idx].flags = cam_attrs_const_info[idx].flags; - attrs_const_info[idx].default_value = cam_attrs_const_info[idx].default_value; + attrs_const_info[idx].default_value = cam_attrs_const_info[idx].default_value.value_void; } /* Camcorder Attributes */ - _mmcam_dbg_log( "Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count); + _mmcam_dbg_log("Create Camcorder Attributes[%p, %d]", attrs_const_info, attr_count); - attrs = mmf_attrs_new_from_data( "Camcorder_Attributes", - attrs_const_info, - attr_count, - _mmcamcorder_commit_camcorder_attrs, - (void*)handle ); + attrs = mmf_attrs_new_from_data("Camcorder_Attributes", + attrs_const_info, + attr_count, + _mmcamcorder_commit_camcorder_attrs, + (void *)handle); free(attrs_const_info); attrs_const_info = NULL; - if( attrs == 0 ) - { - _mmcam_dbg_err( "Fail to alloc attribute handle" ); + if (attrs == 0) { + _mmcam_dbg_err("Fail to alloc attribute handle"); return 0; } @@ -1402,18 +1494,34 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) switch (cam_attrs_const_info[idx].validity_type) { case MM_ATTRS_VALID_TYPE_INT_ARRAY: - if ((cam_attrs_const_info[idx].validity_value1) &&(cam_attrs_const_info[idx].validity_value2 > 0)) - mmf_attrs_set_valid_array (attrs, idx, (const int*)(cam_attrs_const_info[idx].validity_value1), cam_attrs_const_info[idx].validity_value2); + if (cam_attrs_const_info[idx].validity_value1 && + cam_attrs_const_info[idx].validity_value2 > 0) { + mmf_attrs_set_valid_array(attrs, idx, + (const int *)(cam_attrs_const_info[idx].validity_value1), + cam_attrs_const_info[idx].validity_value2, + (int)(cam_attrs_const_info[idx].default_value.value_int)); + } break; case MM_ATTRS_VALID_TYPE_INT_RANGE: - mmf_attrs_set_valid_range (attrs, idx, cam_attrs_const_info[idx].validity_value1, cam_attrs_const_info[idx].validity_value2); + mmf_attrs_set_valid_range(attrs, idx, + cam_attrs_const_info[idx].validity_value1, + cam_attrs_const_info[idx].validity_value2, + (int)(cam_attrs_const_info[idx].default_value.value_int)); break; case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: - if ((cam_attrs_const_info[idx].validity_value1) &&(cam_attrs_const_info[idx].validity_value2 > 0)) - mmf_attrs_set_valid_double_array (attrs, idx, (const double*)(cam_attrs_const_info[idx].validity_value1), cam_attrs_const_info[idx].validity_value2); + if (cam_attrs_const_info[idx].validity_value1 && + cam_attrs_const_info[idx].validity_value2 > 0) { + mmf_attrs_set_valid_double_array(attrs, idx, + (const double *)(cam_attrs_const_info[idx].validity_value1), + cam_attrs_const_info[idx].validity_value2, + (double)(cam_attrs_const_info[idx].default_value.value_double)); + } break; case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: - mmf_attrs_set_valid_double_range (attrs, idx, (double)cam_attrs_const_info[idx].validity_value1, (double)cam_attrs_const_info[idx].validity_value2); + mmf_attrs_set_valid_double_range(attrs, idx, + (double)(cam_attrs_const_info[idx].validity_value1), + (double)(cam_attrs_const_info[idx].validity_value2), + (double)(cam_attrs_const_info[idx].default_value.value_double)); break; case MM_ATTRS_VALID_TYPE_NONE: break; @@ -1424,6 +1532,8 @@ _mmcamcorder_alloc_attribute( MMHandleType handle, MMCamPreset *info ) } } + __mmcamcorder_release_conf_valid_info(handle); + return attrs; } @@ -1496,7 +1606,7 @@ _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCa mmf_return_val_if_fail( attr_name, MM_ERROR_CAMCORDER_INVALID_ARGUMENT ); mmf_return_val_if_fail( info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT ); - attrs = MMF_CAMCORDER_ATTRS(handle); + attrs = MMF_CAMCORDER_ATTRS(handle); mmf_return_val_if_fail( attrs, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); ret = mm_attrs_get_info_by_name(attrs, attr_name, (MMAttrsInfo*)&attrinfo); @@ -1513,22 +1623,22 @@ _mmcamcorder_get_attribute_info(MMHandleType handle, const char *attr_name, MMCa case MM_ATTRS_VALID_TYPE_INT_ARRAY: info->int_array.array = attrinfo.int_array.array; info->int_array.count = attrinfo.int_array.count; - info->int_array.def = 0; + info->int_array.def = attrinfo.int_array.dval; break; case MM_ATTRS_VALID_TYPE_INT_RANGE: info->int_range.min = attrinfo.int_range.min; info->int_range.max = attrinfo.int_range.max; - info->int_range.def = 0; + info->int_range.def = attrinfo.int_range.dval; break; case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: info->double_array.array = attrinfo.double_array.array; info->double_array.count = attrinfo.double_array.count; - info->double_array.def = 0; + info->double_array.def = attrinfo.double_array.dval; break; case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: info->double_range.min = attrinfo.double_range.min; info->double_range.max = attrinfo.double_range.max; - info->double_range.def = 0; + info->double_range.def = attrinfo.double_range.dval; break; case MM_ATTRS_VALID_TYPE_NONE: break; @@ -1592,10 +1702,8 @@ _mmcamcorder_commit_camcorder_attrs (int attr_idx, const char *attr_name, const } -int -__mmcamcorder_set_conf_to_valid_info(MMHandleType handle) +int __mmcamcorder_set_conf_to_valid_info(MMHandleType handle) { - //mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle); int *format = NULL; int total_count = 0; @@ -1623,6 +1731,50 @@ __mmcamcorder_set_conf_to_valid_info(MMHandleType handle) } +int __mmcamcorder_release_conf_valid_info(MMHandleType handle) +{ + int *allocated_memory = NULL; + + _mmcam_dbg_log("START"); + + /* Audio encoder info */ + allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1); + if (allocated_memory) { + free(allocated_memory); + cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value1 = (int)NULL; + cam_attrs_const_info[MM_CAM_AUDIO_ENCODER].validity_value2 = (int)0; + } + + /* Video encoder info */ + allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1); + if (allocated_memory) { + free(allocated_memory); + cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value1 = (int)NULL; + cam_attrs_const_info[MM_CAM_VIDEO_ENCODER].validity_value2 = (int)0; + } + + /* Image encoder info */ + allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1); + if (allocated_memory) { + free(allocated_memory); + cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value1 = (int)NULL; + cam_attrs_const_info[MM_CAM_IMAGE_ENCODER].validity_value2 = (int)0; + } + + /* File format info */ + allocated_memory = (int*)(cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1); + if (allocated_memory) { + free(allocated_memory); + cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value1 = (int)NULL; + cam_attrs_const_info[MM_CAM_FILE_FORMAT].validity_value2 = (int)0; + } + + _mmcam_dbg_log("DONE"); + + return MM_ERROR_NONE; +} + + bool _mmcamcorder_commit_capture_width (MMHandleType handle, int attr_idx, const mmf_value_t *value) { MMHandleType attr = 0; @@ -1633,13 +1785,8 @@ bool _mmcamcorder_commit_capture_width (MMHandleType handle, int attr_idx, const _mmcam_dbg_log("(%d)", attr_idx); - current_state = _mmcamcorder_get_state( handle); - - if( !_mmcamcorder_is_state_changing(handle) - && ( current_state == MM_CAMCORDER_STATE_NULL - || current_state == MM_CAMCORDER_STATE_READY - || current_state == MM_CAMCORDER_STATE_PREPARE ) ) - { + current_state = _mmcamcorder_get_state(handle); + if (current_state <= MM_CAMCORDER_STATE_PREPARE) { int flags = MM_ATTRS_FLAG_NONE; int capture_width, capture_height; MMCamAttrsInfo info; @@ -1647,8 +1794,7 @@ bool _mmcamcorder_commit_capture_width (MMHandleType handle, int attr_idx, const mm_camcorder_get_attribute_info(handle, MMCAM_CAPTURE_HEIGHT, &info); flags = info.flag; - if (!(flags & MM_ATTRS_FLAG_MODIFIED)) - { + if (!(flags & MM_ATTRS_FLAG_MODIFIED)) { mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_HEIGHT, &capture_height, NULL); capture_width = value->value.i_val; @@ -1657,9 +1803,7 @@ bool _mmcamcorder_commit_capture_width (MMHandleType handle, int attr_idx, const } return TRUE; - } - else - { + } else { _mmcam_dbg_log("Capture resolution can't be set.(state=%d)", current_state); return FALSE; } @@ -1670,22 +1814,18 @@ bool _mmcamcorder_commit_capture_height (MMHandleType handle, int attr_idx, cons { int current_state = MM_CAMCORDER_STATE_NONE; - current_state = _mmcamcorder_get_state( handle); + current_state = _mmcamcorder_get_state(handle); - if( current_state == MM_CAMCORDER_STATE_NULL - || current_state == MM_CAMCORDER_STATE_READY - || current_state == MM_CAMCORDER_STATE_PREPARE ) - { + if (current_state <= MM_CAMCORDER_STATE_PREPARE) { int capture_width, capture_height; mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_WIDTH, &capture_width, NULL); capture_height = value->value.i_val; return __mmcamcorder_set_capture_resolution(handle, capture_width, capture_height); - } - else - { + } else { _mmcam_dbg_log("Capture resolution can't be set.(state=%d)", current_state); + return FALSE; } } @@ -1703,11 +1843,11 @@ bool _mmcamcorder_commit_capture_break_cont_shot (MMHandleType handle, int attr_ char* videosrc_name = NULL; - _mmcamcorder_conf_get_element( hcamcorder->conf_main, - CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, - "VideosrcElement", - &VideosrcElement ); - _mmcamcorder_conf_get_value_element_name( VideosrcElement, &videosrc_name ); + _mmcamcorder_conf_get_element(hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT, + "VideosrcElement", + &VideosrcElement ); + _mmcamcorder_conf_get_value_element_name(VideosrcElement, &videosrc_name); sc = MMF_CAMCORDER_SUBCONTEXT(handle); if (!sc) @@ -1759,14 +1899,12 @@ bool _mmcamcorder_commit_capture_count (MMHandleType handle, int attr_idx, const if (mode == MM_CAMCORDER_MODE_IMAGE) { if (cap_count > 1) { __ta__("_mmcamcorder_sound_init", +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE ret = _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND); +#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ + ret = _mmcamcorder_sound_init(handle); +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ ); - if (ret == TRUE) { - __ta__("_mmcamcorder_sound_prepare", - ret = _mmcamcorder_sound_prepare(handle); - ); - _mmcam_dbg_log("sound prepare [%d]", ret); - } } else if (cap_count == 1) { __ta__("_mmcamcorder_sound_finalize", ret = _mmcamcorder_sound_finalize(handle); @@ -1812,7 +1950,7 @@ bool _mmcamcorder_commit_audio_volume (MMHandleType handle, int attr_idx, const MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_AUDIOSRC_VOL].gst, "volume", mslNewVal); } } - + _mmcam_dbg_log("Commit : volume(%f)", mslNewVal); bret = TRUE; } @@ -1821,8 +1959,8 @@ bool _mmcamcorder_commit_audio_volume (MMHandleType handle, int attr_idx, const _mmcam_dbg_log("Commit : nothing to commit. status(%d)", current_state); bret = TRUE; } - return bret; + return bret; } @@ -1833,6 +1971,41 @@ bool _mmcamcorder_commit_camera_fps (MMHandleType handle, int attr_idx, const mm } +bool _mmcamcorder_commit_camera_recording_motion_rate(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + int current_state = MM_CAMCORDER_STATE_NONE; + _MMCamcorderSubContext *sc = NULL; + + mmf_return_val_if_fail(handle, TRUE); + + current_state = _mmcamcorder_get_state(handle); + + if (current_state > MM_CAMCORDER_STATE_PREPARE) { + _mmcam_dbg_warn("invalid state %d", current_state); + return FALSE; + } + + /* Verify recording motion rate */ + if (value->value.d_val > 0.0) { + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + /* set is_slow flag */ + if (value->value.d_val != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { + sc->is_modified_rate = TRUE; + } else { + sc->is_modified_rate = FALSE; + } + + _mmcam_dbg_log("Set slow motion rate %lf", value->value.d_val); + return TRUE; + } else { + _mmcam_dbg_warn("Failed to set recording motion rate %lf", value->value.d_val); + return FALSE; + } +} + + bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const mmf_value_t *value) { MMHandleType attr = 0; @@ -1844,9 +2017,9 @@ bool _mmcamcorder_commit_camera_width (MMHandleType handle, int attr_idx, const _mmcam_dbg_log("Width(%d)", value->value.i_val); - current_state = _mmcamcorder_get_state( handle); + current_state = _mmcamcorder_get_state(handle); - if ((current_state > MM_CAMCORDER_STATE_READY) || _mmcamcorder_is_state_changing( handle ) ) { + if (current_state > MM_CAMCORDER_STATE_READY) { _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state); return FALSE; } else { @@ -1879,7 +2052,7 @@ bool _mmcamcorder_commit_camera_height (MMHandleType handle, int attr_idx, const _mmcam_dbg_log("Height(%d)", value->value.i_val); current_state = _mmcamcorder_get_state( handle); - if ( (current_state > MM_CAMCORDER_STATE_READY) || _mmcamcorder_is_state_changing( handle )) { + if (current_state > MM_CAMCORDER_STATE_READY) { _mmcam_dbg_log("Resolution can't be changed.(state=%d)", current_state); return FALSE; } else { @@ -1961,9 +2134,14 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c _mmcam_dbg_log("Focus mode(%d)", value->value.i_val); - current_state = _mmcamcorder_get_state( handle); + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } - if (current_state < MM_CAMCORDER_STATE_READY) { + current_state = _mmcamcorder_get_state(handle); + if (current_state < MM_CAMCORDER_STATE_NULL) { _mmcam_dbg_log("Focus mode will be changed later.(state=%d)", current_state); return TRUE; } @@ -1976,13 +2154,13 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_log("Can't cast Video source into camera control."); - return TRUE; + return TRUE; } - + control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); mslVal = value->value.i_val; - mode = _mmcamcorder_convert_msl_to_sensor( attr_idx, mslVal ); + mode = _mmcamcorder_convert_msl_to_sensor( handle, attr_idx, mslVal ); mm_camcorder_get_attribute_info(handle, MMCAM_CAMERA_AF_SCAN_RANGE, &info); flags = info.flag; @@ -1997,7 +2175,7 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c if( gst_camera_control_set_focus( control, mode, cur_focus_range ) ) { MMTA_ACUM_ITEM_END(" gst_camera_control_set_focus", 0); - //_mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal ); + _mmcam_dbg_log( "Succeed in setting AF mode[%d]", mslVal ); return TRUE; } else @@ -2008,7 +2186,7 @@ bool _mmcamcorder_commit_camera_focus_mode (MMHandleType handle, int attr_idx, c } else { - //_mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal ); + _mmcam_dbg_log( "No need to set AF mode. Current[%d]", mslVal ); return TRUE; } } @@ -2043,13 +2221,17 @@ bool _mmcamcorder_commit_camera_af_scan_range (MMHandleType handle, int attr_idx _mmcam_dbg_log("(%d)", attr_idx); - current_state = _mmcamcorder_get_state( handle); + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } mslVal = value->value.i_val; - newVal = _mmcamcorder_convert_msl_to_sensor( attr_idx, mslVal ); + newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal); - if( current_state < MM_CAMCORDER_STATE_PREPARE ) - { + current_state = _mmcamcorder_get_state(handle); + if (current_state < MM_CAMCORDER_STATE_PREPARE) { _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } @@ -2059,13 +2241,13 @@ bool _mmcamcorder_commit_camera_af_scan_range (MMHandleType handle, int attr_idx if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_log("Can't cast Video source into camera control."); - return TRUE; + return TRUE; } - + control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &msl_mode, NULL); - converted_mode = _mmcamcorder_convert_msl_to_sensor( MM_CAM_CAMERA_FOCUS_MODE, msl_mode ); + converted_mode = _mmcamcorder_convert_msl_to_sensor( handle, MM_CAM_CAMERA_FOCUS_MODE, msl_mode ); if( gst_camera_control_get_focus( control, &cur_focus_mode, &cur_focus_range ) ) { @@ -2288,8 +2470,13 @@ bool _mmcamcorder_commit_camera_capture_mode (MMHandleType handle, int attr_idx, if (!sc) return TRUE; - current_state = _mmcamcorder_get_state( handle); + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } + current_state = _mmcamcorder_get_state( handle); if (current_state < MM_CAMCORDER_STATE_READY) { return TRUE; } @@ -2305,16 +2492,16 @@ bool _mmcamcorder_commit_camera_capture_mode (MMHandleType handle, int attr_idx, } else if (attr_idx == MM_CAM_CAMERA_ISO) { exposure_type = GST_CAMERA_CONTROL_ISO; mslVal1 = ivalue; - newVal1 = _mmcamcorder_convert_msl_to_sensor(attr_idx, mslVal1); + newVal1 = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal1); check_scene_mode = TRUE; } else if (attr_idx == MM_CAM_CAMERA_EXPOSURE_MODE) { exposure_type = GST_CAMERA_CONTROL_EXPOSURE_MODE; mslVal1 = ivalue; - newVal1 = _mmcamcorder_convert_msl_to_sensor(attr_idx, mslVal1); + newVal1 = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslVal1); } else if (attr_idx == MM_CAM_CAMERA_EXPOSURE_VALUE) { exposure_type = GST_CAMERA_CONTROL_EXPOSURE_VALUE; mslVal1 = newVal1 = MM_CAMCORDER_GET_NUMERATOR( ivalue ); - mslVal2 = newVal2 = MM_CAMCORDER_GET_DENOMINATOR( ivalue ); + mslVal2 = newVal2 = MM_CAMCORDER_GET_DENOMINATOR( ivalue ); } if (check_scene_mode) { @@ -2363,60 +2550,61 @@ bool _mmcamcorder_commit_camera_capture_mode (MMHandleType handle, int attr_idx, bool _mmcamcorder_commit_camera_wdr (MMHandleType handle, int attr_idx, const mmf_value_t *value) { GstCameraControl *control = NULL; - int mslVal = value->value.i_val; - int newVal = _mmcamcorder_convert_msl_to_sensor( MM_CAM_CAMERA_WDR, mslVal); + int mslVal = 0; + int newVal = 0; int cur_value = 0; _MMCamcorderSubContext *sc = NULL; int current_state = MM_CAMCORDER_STATE_NONE; - sc = MMF_CAMCORDER_SUBCONTEXT(handle); - if (!sc) + mmf_return_val_if_fail(handle && value, FALSE); + + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); return TRUE; + } + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + /* check current state */ current_state = _mmcamcorder_get_state( handle); - if (current_state < MM_CAMCORDER_STATE_PREPARE) { _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; - } + } - if( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ) - { - if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) - { + if (current_state == MM_CAMCORDER_STATE_CAPTURING) { + _mmcam_dbg_warn("Can not set WDR while CAPTURING"); + return FALSE; + } + + mslVal = value->value.i_val; + newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_WDR, mslVal); + + if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_log("Can't cast Video source into camera control."); return TRUE; } - - control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ); - if( gst_camera_control_get_wdr( control, &cur_value ) ) - { - if( newVal != cur_value ) - { - if( gst_camera_control_set_wdr( control, newVal ) ) - { - //_mmcam_dbg_log( "Success - set wdr[%d]", mslVal ); + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + if (gst_camera_control_get_wdr(control, &cur_value)) { + if (newVal != cur_value) { + if (gst_camera_control_set_wdr(control, newVal)) { + _mmcam_dbg_log( "Success - set wdr[%d]", mslVal ); return TRUE; + } else { + _mmcam_dbg_warn("Failed to set WDR. NewVal[%d],CurVal[%d]", newVal, cur_value); } - else - { - _mmcam_dbg_warn( "Failed to set WDR. NewVal[%d],CurVal[%d]", newVal, cur_value ); - } - } - else - { - //_mmcam_dbg_log( "No need to set new WDR. Current[%d]", mslVal ); + } else { + _mmcam_dbg_log( "No need to set new WDR. Current[%d]", mslVal ); return TRUE; } - } - else - { + } else { _mmcam_dbg_warn( "Failed to get WDR." ); } - } - else - { + } else { _mmcam_dbg_log("pointer of video src is null"); } @@ -2424,67 +2612,26 @@ bool _mmcamcorder_commit_camera_wdr (MMHandleType handle, int attr_idx, const mm } -bool _mmcamcorder_commit_camera_anti_handshake (MMHandleType handle, int attr_idx, const mmf_value_t *value) +bool _mmcamcorder_commit_camera_anti_handshake(MMHandleType handle, int attr_idx, const mmf_value_t *value) { - GstCameraControl *control = NULL; - int mslVal = value->value.i_val; - int newVal = _mmcamcorder_convert_msl_to_sensor(MM_CAM_CAMERA_ANTI_HANDSHAKE, mslVal); - int cur_value = 0; - _MMCamcorderSubContext *sc = NULL; int current_state = MM_CAMCORDER_STATE_NONE; - sc = MMF_CAMCORDER_SUBCONTEXT(handle); - if (!sc) + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); return TRUE; + } - current_state = _mmcamcorder_get_state( handle); - + current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_READY) { _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; - } - - if (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) - { - if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) - { - _mmcam_dbg_log("Can't cast Video source into camera control."); - return TRUE; - } - - control = GST_CAMERA_CONTROL (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); - - if( gst_camera_control_get_ahs( control, &cur_value ) ) - { - if( newVal != cur_value ) - { - if (gst_camera_control_set_ahs(control, newVal)) - { - //_mmcam_dbg_log("Succeed in operating anti-handshake."); - return TRUE; - } - else - { - _mmcam_dbg_warn("Failed to operate anti-handshake. value[%d]", newVal); - } - } - else - { - //_mmcam_dbg_log( "No need to set new Anti-Handshake. Current[%d]", mslVal ); - return TRUE; - } - } - else - { - _mmcam_dbg_warn( "Failed to get Anti-Handshake." ); - } - } - else - { - _mmcam_dbg_warn("pointer of video src is null"); + } else if (current_state > MM_CAMCORDER_STATE_PREPARE) { + _mmcam_dbg_err("Invaild state (state %d)", current_state); + return FALSE; } - return FALSE; + return _mmcamcorder_set_videosrc_anti_shake(handle, value->value.i_val); } @@ -2520,18 +2667,16 @@ bool _mmcamcorder_commit_camera_hold_af_after_capturing (MMHandleType handle, in bool _mmcamcorder_commit_camera_rotate (MMHandleType handle, int attr_idx, const mmf_value_t *value) { int current_state = MM_CAMCORDER_STATE_NONE; - gboolean bstate_changing = FALSE; _mmcam_dbg_log("rotate(%d)", value->value.i_val); current_state = _mmcamcorder_get_state( handle); - bstate_changing = _mmcamcorder_is_state_changing( handle); - if ((current_state > MM_CAMCORDER_STATE_READY) || bstate_changing ) { - _mmcam_dbg_err("camera rotation setting failed.(state=%d, is_state_changing(%d))", current_state, bstate_changing); + if (current_state > MM_CAMCORDER_STATE_READY) { + _mmcam_dbg_err("camera rotation setting failed.(state=%d, is_state_changing(%d))", current_state); return FALSE; } else { - return _mmcamcorder_set_videosrc_rotation( handle, value->value.i_val ); + return _mmcamcorder_set_videosrc_rotation(handle, value->value.i_val); } } @@ -2621,11 +2766,15 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va if (!sc) return TRUE; - current_state = _mmcamcorder_get_state(handle); + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } - //status check + current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE) { - //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); + _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } @@ -2679,7 +2828,7 @@ bool _mmcamcorder_commit_filter (MMHandleType handle, int attr_idx, const mmf_va } } - newVal = _mmcamcorder_convert_msl_to_sensor(attr_idx, mslNewVal); + newVal = _mmcamcorder_convert_msl_to_sensor(handle, attr_idx, mslNewVal); if (newVal == _MMCAMCORDER_SENSOR_ENUM_NONE) return FALSE; @@ -2749,7 +2898,7 @@ bool _mmcamcorder_commit_filter_scene_mode (MMHandleType handle, int attr_idx, c { GstCameraControl *control = NULL; int mslVal = value->value.i_val; - int newVal = _mmcamcorder_convert_msl_to_sensor( MM_CAM_FILTER_SCENE_MODE, mslVal ); + int newVal = _mmcamcorder_convert_msl_to_sensor( handle, MM_CAM_FILTER_SCENE_MODE, mslVal ); int cur_program_mode = MM_CAMCORDER_SCENE_MODE_NORMAL; _MMCamcorderSubContext *sc = NULL; int current_state = MM_CAMCORDER_STATE_NONE; @@ -2758,8 +2907,13 @@ bool _mmcamcorder_commit_filter_scene_mode (MMHandleType handle, int attr_idx, c if (!sc) return TRUE; - current_state = _mmcamcorder_get_state( handle); - + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } + + current_state = _mmcamcorder_get_state(handle); if (current_state < MM_CAMCORDER_STATE_PREPARE) { _mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; @@ -2827,21 +2981,111 @@ bool _mmcamcorder_commit_filter_flip (MMHandleType handle, int attr_idx, const m } -bool _mmcamcorder_commit_camcorder_rotate(MMHandleType handle, int attr_idx, const mmf_value_t *value) +bool _mmcamcorder_commit_camera_face_zoom(MMHandleType handle, int attr_idx, const mmf_value_t *value) { + int ret = 0; int current_state = MM_CAMCORDER_STATE_NONE; - gboolean bstate_changing = FALSE; - _mmcam_dbg_log("camcorder-rotation(%d)", value->value.i_val); - current_state = _mmcamcorder_get_state( handle); - bstate_changing = _mmcamcorder_is_state_changing( handle); + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + GstCameraControl *control = NULL; + _MMCamcorderSubContext *sc = NULL; - if ((current_state > MM_CAMCORDER_STATE_PREPARE) || bstate_changing ) { - _mmcam_dbg_err("camcorder-rotation setting failed.(state=%d, is_state_changing(%d))", current_state, bstate_changing); - return FALSE; + mmf_return_val_if_fail(hcamcorder, FALSE); + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + /* these are only available after camera preview is started */ + current_state = _mmcamcorder_get_state(handle); + if (current_state >= MM_CAMCORDER_STATE_PREPARE && + hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int x = 0; + int y = 0; + int zoom_level = 0; + int preview_width = 0; + int preview_height = 0; + + switch (attr_idx) { + case MM_CAM_CAMERA_FACE_ZOOM_X: + /* check x coordinate of face zoom */ + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_WIDTH, &preview_width, + NULL); + /* x coordinate should be smaller than width of preview */ + if (value->value.i_val < preview_width) { + _mmcam_dbg_log("set face zoom x %d done", value->value.i_val); + ret = TRUE; + } else { + _mmcam_dbg_err("invalid face zoom x %d", value->value.i_val); + ret = FALSE; + } + break; + case MM_CAM_CAMERA_FACE_ZOOM_Y: + /* check y coordinate of face zoom */ + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_WIDTH, &preview_height, + NULL); + /* y coordinate should be smaller than height of preview */ + if (value->value.i_val < preview_height) { + _mmcam_dbg_log("set face zoom y %d done", value->value.i_val); + ret = TRUE; + } else { + _mmcam_dbg_err("invalid face zoom y %d", value->value.i_val); + ret = FALSE; + } + break; + case MM_CAM_CAMERA_FACE_ZOOM_MODE: + if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_ON) { + int face_detect_mode = MM_CAMCORDER_DETECT_MODE_OFF; + + /* start face zoom */ + /* get x,y coordinate and zoom level */ + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_FACE_ZOOM_X, &x, + MMCAM_CAMERA_FACE_ZOOM_Y, &y, + MMCAM_CAMERA_FACE_ZOOM_LEVEL, &zoom_level, + MMCAM_DETECT_MODE, &face_detect_mode, + NULL); + + if (face_detect_mode == MM_CAMCORDER_DETECT_MODE_ON) { + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ); + __ta__(" gst_camera_control_start_face_zoom", + ret = gst_camera_control_start_face_zoom(control, x, y, zoom_level); + ); + } else { + _mmcam_dbg_err("face detect is OFF... could not start face zoom"); + ret = FALSE; + } + } else if (value->value.i_val == MM_CAMCORDER_FACE_ZOOM_MODE_OFF) { + /* stop face zoom */ + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ); + __ta__(" gst_camera_control_stop_face_zoom", + ret = gst_camera_control_stop_face_zoom(control); + ); + } else { + /* should not be reached here */ + _mmcam_dbg_err("unknown command [%d]", value->value.i_val); + ret = FALSE; + } + + if (!ret) { + _mmcam_dbg_err("face zoom[%d] failed", value->value.i_val); + ret = FALSE; + } else { + _mmcam_dbg_log(""); + ret = TRUE; + } + break; + default: + _mmcam_dbg_warn("should not be reached here. attr_idx %d", attr_idx); + break; + } } else { - return TRUE; + _mmcam_dbg_err("invalid state[%d] or mode[%d]", current_state, hcamcorder->type); + ret = FALSE; } + + return ret; } @@ -2853,44 +3097,81 @@ bool _mmcamcorder_commit_audio_input_route (MMHandleType handle, int attr_idx, c } -bool _mmcamcorder_commit_display_handle (MMHandleType handle, int attr_idx, const mmf_value_t *value) +bool _mmcamcorder_commit_audio_disable(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + int current_state = MM_CAMCORDER_STATE_NONE; + + current_state = _mmcamcorder_get_state(handle); + if (current_state > MM_CAMCORDER_STATE_PREPARE) { + _mmcam_dbg_warn("Can NOT Disable AUDIO. invalid state %s", current_state); + return FALSE; + } else { + _mmcam_dbg_log("Disable AUDIO when Recording"); + return TRUE; + } +} + + +bool _mmcamcorder_commit_display_handle(MMHandleType handle, int attr_idx, const mmf_value_t *value) { _MMCamcorderSubContext *sc = NULL; + char *videosink_name = NULL; - char* videosink_name = NULL; + mmf_return_val_if_fail(handle, TRUE); sc = MMF_CAMCORDER_SUBCONTEXT(handle); - if (!sc) - return TRUE; + mmf_return_val_if_fail(sc, TRUE); - if( sc ) - { - _mmcamcorder_conf_get_value_element_name( sc->VideosinkElement, &videosink_name ); - _mmcam_dbg_log( "Commit : videosinkname[%s]", videosink_name ); - - if( !strcmp( videosink_name, "xvimagesink" ) || !strcmp( videosink_name, "xvimagesink" ) ) - { - if( sc->element ) - { - if( sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst ) - { - _mmcam_dbg_log( "Commit : Set XID[%x]", *(int*)(value->value.p_val) ); - gst_x_overlay_set_xwindow_id( GST_X_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(value->value.p_val) ); - } + _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); + + _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name); + + if (sc->element && sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) { + void *p_handle = value->value.p_val; + + if (p_handle) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink")) { + _mmcam_dbg_log("Commit : Set XID[%x]", *(int*)(p_handle)); + gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst), *(int*)(p_handle)); + } else if (!strcmp(videosink_name, "evasimagesink")) { + _mmcam_dbg_log("Commit : Set evas object [%p]", p_handle); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "evas-object", p_handle); + } else { + _mmcam_dbg_log("Commit : Nothing to commit with this element[%s]", videosink_name); } - } - else - { - _mmcam_dbg_log( "Commit : Nothing to commit with this element[%s]", videosink_name ); + } else { + _mmcam_dbg_warn("Display handle is NULL. Nothing to do."); } } - else - { - _mmcam_dbg_log( "Commit : Nothing to commit with this attribute(MM_CAMCORDER_DISPLAY_HANDLE)" ); - } - + return TRUE; +} + +bool _mmcamcorder_commit_display_mode(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + _MMCamcorderSubContext *sc = NULL; + char *videosink_name = NULL; + + mmf_return_val_if_fail(handle, TRUE); + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + _mmcamcorder_conf_get_value_element_name(sc->VideosinkElement, &videosink_name); + + _mmcam_dbg_log("Commit : videosinkname[%s]", videosink_name); + + if (sc->element && sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst) { + if (!strcmp(videosink_name, "xvimagesink")) { + _mmcam_dbg_log("Commit : display mode [%d]", value->value.i_val); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "display-mode", value->value.i_val); + } else { + _mmcam_dbg_log("Commit : This element [%s] does not support display mode", videosink_name); + } + } + + return TRUE; } @@ -3274,61 +3555,52 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va mslVal = value->value.i_val; - switch( attr_idx ) - { - case MM_CAM_STROBE_CONTROL: - strobe_type = GST_CAMERA_CONTROL_STROBE_CONTROL; - newVal = _mmcamcorder_convert_msl_to_sensor( MM_CAM_STROBE_CONTROL, mslVal); - break; - case MM_CAM_STROBE_CAPABILITIES: - strobe_type = GST_CAMERA_CONTROL_STROBE_CAPABILITIES; - newVal = mslVal; - break; - case MM_CAM_STROBE_MODE: - strobe_type = GST_CAMERA_CONTROL_STROBE_MODE; - newVal = _mmcamcorder_convert_msl_to_sensor( MM_CAM_STROBE_MODE, mslVal); - break; - default: - { - _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); - return FALSE; + switch (attr_idx) { + case MM_CAM_STROBE_CONTROL: + strobe_type = GST_CAMERA_CONTROL_STROBE_CONTROL; + newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_CONTROL, mslVal); + break; + case MM_CAM_STROBE_CAPABILITIES: + strobe_type = GST_CAMERA_CONTROL_STROBE_CAPABILITIES; + newVal = mslVal; + break; + case MM_CAM_STROBE_MODE: + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", mslVal); + return TRUE; } + + strobe_type = GST_CAMERA_CONTROL_STROBE_MODE; + newVal = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_STROBE_MODE, mslVal); + break; + default: + _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); + return FALSE; } GstCameraControl *control = NULL; - if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) - { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_err("Can't cast Video source into camera control."); - bret = FALSE; - } - else - { - control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ); + bret = FALSE; + } else { + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); - if( gst_camera_control_get_strobe( control, strobe_type, &cur_value ) ) - { - if( newVal != cur_value ) - { - if( gst_camera_control_set_strobe( control, strobe_type, newVal ) ) - { - _mmcam_dbg_log( "Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal ); + if (gst_camera_control_get_strobe(control, strobe_type, &cur_value)) { + if (newVal != cur_value) { + if (gst_camera_control_set_strobe(control, strobe_type, newVal)) { + _mmcam_dbg_log("Succeed in setting strobe. Type[%d],value[%d]", strobe_type, mslVal); bret = TRUE; - } - else - { - _mmcam_dbg_warn( "Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal ); + } else { + _mmcam_dbg_warn("Set strobe failed. Type[%d],value[%d]", strobe_type, mslVal); bret = FALSE; } - } - else - { - _mmcam_dbg_log( "No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal ); + } else { + _mmcam_dbg_log("No need to set strobe. Type[%d],value[%d]", strobe_type, mslVal); bret = TRUE; } - } - else - { - _mmcam_dbg_warn( "Failed to get strobe. Type[%d]", strobe_type ); + } else { + _mmcam_dbg_warn("Failed to get strobe. Type[%d]", strobe_type); bret = FALSE; } } @@ -3337,90 +3609,165 @@ bool _mmcamcorder_commit_strobe (MMHandleType handle, int attr_idx, const mmf_va } -bool _mmcamcorder_commit_detect (MMHandleType handle, int attr_idx, const mmf_value_t *value) +bool _mmcamcorder_commit_camera_flip_horizontal(MMHandleType handle, int attr_idx, const mmf_value_t *value) { - bool bret = FALSE; - _MMCamcorderSubContext* sc = NULL; - int detect_type, mslVal, newVal, curVal; + int current_state = MM_CAMCORDER_STATE_NONE; + + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + _mmcam_dbg_log("Commit : flip horizontal %d", value->value.i_val); + + /* state check */ + current_state = _mmcamcorder_get_state(handle); + if (current_state > MM_CAMCORDER_STATE_READY) { + _mmcam_dbg_err("Can not set camera FLIP horizontal at state %d", current_state); + return FALSE; + } else if (current_state < MM_CAMCORDER_STATE_READY) { + _mmcam_dbg_log("Pipeline is not created yet. This will be set when create pipeline."); + return TRUE; + } + + return _mmcamcorder_set_videosrc_hflip(handle, value->value.i_val); +} + + +bool _mmcamcorder_commit_camera_flip_vertical(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + int current_state = MM_CAMCORDER_STATE_NONE; + + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + _mmcam_dbg_log("Commit : flip vertical %d", value->value.i_val); + + /* state check */ + current_state = _mmcamcorder_get_state(handle); + if (current_state > MM_CAMCORDER_STATE_READY) { + _mmcam_dbg_err("Can not set camera FLIP vertical at state %d", current_state); + return FALSE; + } else if (current_state < MM_CAMCORDER_STATE_READY) { + _mmcam_dbg_log("Pipeline is not created yet. This will be set when create pipeline."); + return TRUE; + } + + return _mmcamcorder_set_videosrc_vflip(handle, value->value.i_val); +} + + +bool _mmcamcorder_commit_camera_hdr_capture(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + int current_state = MM_CAMCORDER_STATE_NONE; + + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + _mmcam_dbg_log("Commit : HDR Capture %d", value->value.i_val); + + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", value->value.i_val); + return TRUE; + } + + /* state check */ + current_state = _mmcamcorder_get_state(handle); + if (current_state > MM_CAMCORDER_STATE_PREPARE) { + _mmcam_dbg_err("can NOT set HDR capture at state %d", current_state); + return FALSE; + } + + return TRUE; +} + + +bool _mmcamcorder_commit_detect(MMHandleType handle, int attr_idx, const mmf_value_t *value) +{ + bool bret = FALSE; + _MMCamcorderSubContext *sc = NULL; + int detect_type = GST_CAMERA_CONTROL_FACE_DETECT_MODE; + int set_value = 0; + int current_value = 0; + int current_state = MM_CAMCORDER_STATE_NONE; GstCameraControl *control = NULL; - int current_state = MM_CAMCORDER_STATE_NONE; - sc = MMF_CAMCORDER_SUBCONTEXT( handle ); - if (!sc) + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + if (!sc) { return TRUE; + } - _mmcam_dbg_log( "Commit : detect attribute(%d)", attr_idx); + _mmcam_dbg_log("Commit : detect attribute(%d)", attr_idx); - //status check + /* state check */ current_state = _mmcamcorder_get_state( handle); - if (current_state < MM_CAMCORDER_STATE_READY) { //_mmcam_dbg_log("It doesn't need to change dynamically.(state=%d)", current_state); return TRUE; } - - switch( attr_idx ) - { - case MM_CAM_DETECT_MODE: - detect_type = GST_CAMERA_CONTROL_FACE_DETECT_MODE; - break; - case MM_CAM_DETECT_NUMBER: - detect_type = GST_CAMERA_CONTROL_FACE_DETECT_NUMBER; - break; - case MM_CAM_DETECT_FOCUS_SELECT: - detect_type = GST_CAMERA_CONTROL_FACE_FOCUS_SELECT; - break; - case MM_CAM_DETECT_SELECT_NUMBER: - detect_type = GST_CAMERA_CONTROL_FACE_SELECT_NUMBER; - break; - case MM_CAM_DETECT_STATUS: - detect_type = GST_CAMERA_CONTROL_FACE_DETECT_STATUS; - break; - default: - { - _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); - bret = FALSE; - return bret; + + set_value = value->value.i_val; + + switch (attr_idx) { + case MM_CAM_DETECT_MODE: + /* check whether set or not */ + if (!_mmcamcorder_check_supported_attribute(handle, attr_idx)) { + _mmcam_dbg_log("skip set value %d", set_value); + return TRUE; } - } - mslVal = value->value.i_val; - newVal = _mmcamcorder_convert_msl_to_sensor( attr_idx, mslVal ); - + detect_type = GST_CAMERA_CONTROL_FACE_DETECT_MODE; + break; + case MM_CAM_DETECT_NUMBER: + detect_type = GST_CAMERA_CONTROL_FACE_DETECT_NUMBER; + break; + case MM_CAM_DETECT_FOCUS_SELECT: + detect_type = GST_CAMERA_CONTROL_FACE_FOCUS_SELECT; + break; + case MM_CAM_DETECT_SELECT_NUMBER: + detect_type = GST_CAMERA_CONTROL_FACE_SELECT_NUMBER; + break; + case MM_CAM_DETECT_STATUS: + detect_type = GST_CAMERA_CONTROL_FACE_DETECT_STATUS; + break; + default: + _mmcam_dbg_err("Commit : strobe attribute(attr_idx(%d) is out of range)", attr_idx); + return FALSE; + } - if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) - { + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_err("Can't cast Video source into camera control."); bret = FALSE; - } - else - { - control = GST_CAMERA_CONTROL( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst ); + } else { + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); - if( gst_camera_control_get_detect( control, detect_type, &curVal ) ) - { - if( curVal == newVal ) - { - _mmcam_dbg_log( "No need to set detect. Type[%d],value[%d]", detect_type, mslVal ); + if (gst_camera_control_get_detect(control, detect_type, ¤t_value)) { + if (current_value == set_value) { + _mmcam_dbg_log("No need to set detect(same). Type[%d],value[%d]", detect_type, set_value); bret = TRUE; - } - else - { - if( !gst_camera_control_set_detect( control, detect_type, newVal ) ) - { - _mmcam_dbg_warn( "Set detect failed. Type[%d],value[%d]", detect_type, mslVal ); + } else { + if (!gst_camera_control_set_detect(control, detect_type, set_value)) { + _mmcam_dbg_warn("Set detect failed. Type[%d],value[%d]", + detect_type, set_value); bret = FALSE; - } - else - { - _mmcam_dbg_log( "Set detect success. Type[%d],value[%d]", detect_type, mslVal ); + } else { + _mmcam_dbg_log("Set detect success. Type[%d],value[%d]", + detect_type, set_value); bret = TRUE; } } - } - else - { - _mmcam_dbg_warn( "Get detect failed. Type[%d]", detect_type ); + } else { + _mmcam_dbg_warn("Get detect failed. Type[%d]", detect_type); bret = FALSE; } } @@ -3475,29 +3822,14 @@ _mmcamcorder_set_attribute_to_camsensor(MMHandleType handle) int attr_idxs_default[] = { MM_CAM_CAMERA_DIGITAL_ZOOM , MM_CAM_CAMERA_OPTICAL_ZOOM - , MM_CAM_CAMERA_FOCUS_MODE - , MM_CAM_CAMERA_AF_SCAN_RANGE , MM_CAM_CAMERA_EXPOSURE_MODE - , MM_CAM_CAMERA_EXPOSURE_VALUE - , MM_CAM_CAMERA_F_NUMBER - , MM_CAM_CAMERA_SHUTTER_SPEED , MM_CAM_CAMERA_WDR - , MM_CAM_CAMERA_ANTI_HANDSHAKE - , MM_CAM_CAMERA_FPS_AUTO , MM_CAM_CAMERA_HOLD_AF_AFTER_CAPTURING , MM_CAM_FILTER_CONTRAST , MM_CAM_FILTER_COLOR_TONE , MM_CAM_FILTER_HUE - , MM_CAM_STROBE_CONTROL , MM_CAM_STROBE_MODE , MM_CAM_DETECT_MODE - , MM_CAM_DETECT_NUMBER - , MM_CAM_DETECT_FOCUS_SELECT - , MM_CAM_DETECT_SELECT_NUMBER - , MM_CAM_CAMERA_AF_TOUCH_X - , MM_CAM_CAMERA_AF_TOUCH_Y - , MM_CAM_CAMERA_AF_TOUCH_WIDTH - , MM_CAM_CAMERA_AF_TOUCH_HEIGHT }; int attr_idxs_extra[] = { @@ -3605,10 +3937,10 @@ int _mmcamcorder_set_disabled_attributes(MMHandleType handle) _mmcam_dbg_log(""); /* add gst_param */ - _mmcamcorder_conf_get_value_string_array( hcamcorder->conf_main, - CONFIGURE_CATEGORY_MAIN_GENERAL, - "DisabledAttributes", - &disabled_attr ); + _mmcamcorder_conf_get_value_string_array(hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_GENERAL, + "DisabledAttributes", + &disabled_attr); if (disabled_attr != NULL && disabled_attr->value) { cnt_str = disabled_attr->count; for (i = 0; i < cnt_str; i++) { @@ -3662,44 +3994,38 @@ static bool __mmcamcorder_set_capture_resolution(MMHandleType handle, int width, static bool __mmcamcorder_set_camera_resolution(MMHandleType handle, int width, int height) { - mmf_camcorder_t *hcamcorder= MMF_CAMCORDER(handle); - int fps, slow_fps; + int fps = 0; + double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; + + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; GstCaps *caps = NULL; - int set_width, set_height; - + + mmf_return_val_if_fail(hcamcorder, FALSE); + sc = MMF_CAMCORDER_SUBCONTEXT(handle); - if (!sc) - return TRUE; + mmf_return_val_if_fail(sc, TRUE); - mm_camcorder_get_attributes(handle, NULL, - MMCAM_CAMERA_FPS, &fps, - "camera-slow-motion-fps", &slow_fps, - NULL); + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_FPS, &fps, + MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate, + NULL); if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO) { - if(slow_fps > 0) { - sc->is_slow = TRUE; + if(motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps); } else { - sc->is_slow = FALSE; MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0); } - } else { - sc->is_slow = FALSE; } - set_width = width; - set_height = height; - - caps = gst_caps_new_simple( "video/x-raw-yuv", - "format", GST_TYPE_FOURCC, sc->fourcc, - "width", G_TYPE_INT, set_width, - "height", G_TYPE_INT, set_height, - "framerate", GST_TYPE_FRACTION, (sc->is_slow ? slow_fps : fps), 1, - NULL - ); - MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps); + caps = gst_caps_new_simple("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, sc->fourcc, + "width", G_TYPE_INT, width, + "height", G_TYPE_INT, height, + "framerate", GST_TYPE_FRACTION, fps, 1, + NULL); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps); gst_caps_unref(caps); return TRUE; @@ -3803,14 +4129,6 @@ __mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const va_arg ((var_args), void*); /* data */ va_arg ((var_args), int); /* size */ break; - case MM_ATTRS_TYPE_ARRAY: - va_arg ((var_args), void*); /* array */ - va_arg ((var_args), int); /* length */ - break; - case MM_ATTRS_TYPE_RANGE: - va_arg ((var_args), int); /* min */ - va_arg ((var_args), int); /* max */ - break; case MM_ATTRS_TYPE_INVALID: default: _mmcam_dbg_err( "Not supported attribute type(%d, name:%s)", attr_type, name); @@ -3873,6 +4191,11 @@ __mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; } + + if (err_name) { + free(err_name); + err_name = NULL; + } } } @@ -3880,3 +4203,50 @@ __mmcamcorder_check_valid_pair( MMHandleType handle, char **err_attr_name, const return MM_ERROR_NONE; } + + +bool _mmcamcorder_check_supported_attribute(MMHandleType handle, int attr_index) +{ + MMAttrsInfo info; + + if ((void *)handle == NULL) { + _mmcam_dbg_warn("handle %p is NULL", handle); + return FALSE; + } + + memset(&info, 0x0, sizeof(MMAttrsInfo)); + + mm_attrs_get_info(MMF_CAMCORDER_ATTRS(handle), attr_index, &info); + + switch (info.validity_type) { + case MM_ATTRS_VALID_TYPE_INT_ARRAY: + _mmcam_dbg_log("int array count %d", info.int_array.count) + if (info.int_array.count <= 1) { + return FALSE; + } + break; + case MM_ATTRS_VALID_TYPE_INT_RANGE: + _mmcam_dbg_log("int range min %d, max %d",info.int_range.min, info.int_range.max); + if (info.int_range.min >= info.int_range.max) { + return FALSE; + } + break; + case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: + _mmcam_dbg_log("double array count %d", info.double_array.count) + if (info.double_array.count <= 1) { + return FALSE; + } + break; + case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: + _mmcam_dbg_log("double range min %lf, max %lf",info.int_range.min, info.int_range.max); + if (info.double_range.min >= info.double_range.max) { + return FALSE; + } + break; + default: + _mmcam_dbg_warn("invalid type %d", info.validity_type); + return FALSE; + } + + return TRUE; +} diff --git a/src/mm_camcorder_audiorec.c b/src/mm_camcorder_audiorec.c index b810fe7..f137853 100644 --- a/src/mm_camcorder_audiorec.c +++ b/src/mm_camcorder_audiorec.c @@ -57,7 +57,6 @@ static void __mmcamcorder_audiorec_pad_added_cb(GstElement *element, GstPad *pad | GLOBAL FUNCTION DEFINITIONS: | ---------------------------------------------------------------------------------------*/ - static int __mmcamcorder_create_audiop_with_encodebin(MMHandleType handle) { int err = MM_ERROR_NONE; @@ -911,6 +910,7 @@ static gboolean __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstBuffer *buf guint64 buffer_size = 0; guint64 trailer_size = 0; char *filename = NULL; + unsigned int remained_time = 0; _MMCamcorderSubContext *sc = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data); @@ -949,7 +949,9 @@ static gboolean __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstBuffer *buf } /* get trailer size */ - if (info->fileformat == MM_FILE_FORMAT_3GP || info->fileformat == MM_FILE_FORMAT_MP4) { + if (info->fileformat == MM_FILE_FORMAT_3GP || + info->fileformat == MM_FILE_FORMAT_MP4 || + info->fileformat == MM_FILE_FORMAT_AAC) { MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size); /*_mmcam_dbg_log("trailer_size %d", trailer_size);*/ } else { @@ -1014,6 +1016,12 @@ static gboolean __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstBuffer *buf rec_pipe_time = GST_TIME_AS_MSECONDS(GST_BUFFER_TIMESTAMP(buffer)); + if (info->max_time > 0 && info->max_time < (remained_time + rec_pipe_time)) { + remained_time = info->max_time - rec_pipe_time; + } + + /*_mmcam_dbg_log("remained time : %u", remained_time);*/ + /* check recording time limit and send recording status message */ if (info->max_time > 0 && rec_pipe_time > info->max_time) { _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \ @@ -1040,6 +1048,7 @@ static gboolean __mmcamcorder_audio_dataprobe_record(GstPad *pad, GstBuffer *buf msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; msg.param.recording_status.elapsed = (unsigned int)rec_pipe_time; msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); + msg.param.recording_status.remained_time = remained_time; _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); return TRUE; diff --git a/src/mm_camcorder_configure.c b/src/mm_camcorder_configure.c index ae4e205..e2817ce 100644 --- a/src/mm_camcorder_configure.c +++ b/src/mm_camcorder_configure.c @@ -19,11 +19,9 @@ * */ -/*=========================================================================================== -| | -| INCLUDE FILES | -| | -========================================================================================== */ +/*======================================================================================= +| INCLUDE FILES | +=======================================================================================*/ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -32,19 +30,19 @@ #include "mm_camcorder_internal.h" #include "mm_camcorder_configure.h" -/*--------------------------------------------------------------------------- -| MACRO DEFINITIONS: | ----------------------------------------------------------------------------*/ -#define CONFIGURE_PATH "/opt/etc" -#define CONFIGURE_PATH_RETRY "/usr/etc" +/*----------------------------------------------------------------------- +| MACRO DEFINITIONS: | +-----------------------------------------------------------------------*/ +#define CONFIGURE_PATH "/usr/etc" +#define CONFIGURE_PATH_RETRY "/opt/etc" -/*--------------------------------------------------------------------------- -| GLOBAL VARIABLE DEFINITIONS | ----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------- +| GLOBAL VARIABLE DEFINITIONS | +-----------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------- -| LOCAL VARIABLE DEFINITIONS | ----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------- +| LOCAL VARIABLE DEFINITIONS | +-----------------------------------------------------------------------*/ static int conf_main_category_size[CONFIGURE_CATEGORY_MAIN_NUM] = { 0, }; static int conf_ctrl_category_size[CONFIGURE_CATEGORY_CTRL_NUM] = { 0, }; @@ -699,6 +697,7 @@ static conf_info_table conf_main_audio_input_table[] = { */ static conf_info_table conf_main_video_output_table[] = { { "DisplayDevice", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, + { "DisplayMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, { "Videosink", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, { "VideosinkElementX", CONFIGURE_VALUE_ELEMENT, {(type_element*)&_videosink_element_x_default} }, { "VideosinkElementEvas", CONFIGURE_VALUE_ELEMENT, {(type_element*)&_videosink_element_evas_default} }, @@ -715,6 +714,7 @@ static conf_info_table conf_main_capture_table[] = { { "UseEncodebin", CONFIGURE_VALUE_INT, {0} }, { "UseCaptureMode", CONFIGURE_VALUE_INT, {0} }, { "VideoscaleElement", CONFIGURE_VALUE_ELEMENT, {(type_element*)&_videoscale_element_default} }, + { "PlayCaptureSound", CONFIGURE_VALUE_INT, {1} }, }; /* @@ -825,6 +825,7 @@ static conf_info_table conf_ctrl_camera_table[] = { { "RecommendDisplayRotation", CONFIGURE_VALUE_INT, {3} }, { "RecommendPreviewFormatCapture", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_YUYV} }, { "RecommendPreviewFormatRecord", CONFIGURE_VALUE_INT, {MM_PIXEL_FORMAT_NV12} }, + { "RecommendPreviewResolution", CONFIGURE_VALUE_INT_PAIR_ARRAY, {NULL} }, }; /* @@ -868,6 +869,8 @@ static conf_info_table conf_ctrl_photograph_table[] = { { "ISO", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, { "ProgramMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, { "AntiHandshake", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, + { "FaceZoomMode", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, + { "FaceZoomLevel", CONFIGURE_VALUE_INT_RANGE, {NULL} }, }; /* @@ -878,6 +881,7 @@ static conf_info_table conf_ctrl_capture_table[] = { { "JpegQuality", CONFIGURE_VALUE_INT_RANGE, {NULL} }, { "MultishotNumber", CONFIGURE_VALUE_INT_RANGE, {NULL} }, { "SensorEncodedCapture", CONFIGURE_VALUE_INT, {1} }, + { "SupportHDR", CONFIGURE_VALUE_INT_ARRAY, {NULL} }, }; /* @@ -898,16 +902,14 @@ get_new_string( char* src_string ) return strdup(src_string); } -void -_mmcamcorder_conf_init( int type, camera_conf** configure_info ) +void _mmcamcorder_conf_init(int type, camera_conf** configure_info) { int i = 0; - int info_table_size = sizeof( conf_info_table ); - - _mmcam_dbg_log( "Entered..." ); + int info_table_size = sizeof(conf_info_table); - if( type == CONFIGURE_TYPE_MAIN ) - { + _mmcam_dbg_log("Entered..."); + + if (type == CONFIGURE_TYPE_MAIN) { conf_main_info_table[CONFIGURE_CATEGORY_MAIN_GENERAL] = conf_main_general_table; conf_main_info_table[CONFIGURE_CATEGORY_MAIN_VIDEO_INPUT] = conf_main_video_input_table; conf_main_info_table[CONFIGURE_CATEGORY_MAIN_AUDIO_INPUT] = conf_main_audio_input_table; @@ -932,13 +934,10 @@ _mmcamcorder_conf_init( int type, camera_conf** configure_info ) (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_MAIN_NUM ); - for( i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++ ) - { + for (i = 0 ; i < CONFIGURE_CATEGORY_MAIN_NUM ; i++) { (*configure_info)->info[i] = NULL; } - } - else - { + } else { conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_CAMERA] = conf_ctrl_camera_table; conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_STROBE] = conf_ctrl_strobe_table; conf_ctrl_info_table[CONFIGURE_CATEGORY_CTRL_EFFECT] = conf_ctrl_effect_table; @@ -955,14 +954,14 @@ _mmcamcorder_conf_init( int type, camera_conf** configure_info ) (*configure_info)->info = (conf_info**)g_malloc0( sizeof( conf_info* ) * CONFIGURE_CATEGORY_CTRL_NUM ); - for( i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++ ) - { - (*configure_info)->info[i] = NULL; + for (i = 0 ; i < CONFIGURE_CATEGORY_CTRL_NUM ; i++) { + (*configure_info)->info[i] = NULL; } } - - _mmcam_dbg_log( "Done." ); + _mmcam_dbg_log("Done."); + + return; } @@ -1146,6 +1145,7 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info ) if( count_details == 0 ) { _mmcam_dbg_warn( "category %s has no detail value... skip this category...", category_name ); + SAFE_FREE(category_name); continue; } @@ -1244,10 +1244,7 @@ _mmcamcorder_conf_parse_info( int type, FILE* fd, camera_conf** configure_info ) } } - if( category_name ) - { - SAFE_FREE( category_name ); - } + SAFE_FREE(category_name); } //(*configure_info) = new_conf; @@ -3235,42 +3232,37 @@ _mmcamcorder_get_available_format(MMHandleType handle, int conf_category, int ** configure_info = hcamcorder->conf_main; - if( configure_info->info[conf_category] ) - { - int count = configure_info->info[conf_category]->count; - conf_info* info = configure_info->info[conf_category]; + if (configure_info->info[conf_category]) { int i = 0; int fmt = 0; - char* name = NULL; + char *name = NULL; + int count = configure_info->info[conf_category]->count; + conf_info *info = configure_info->info[conf_category]; _mmcam_dbg_log("count[%d], info[%p]", count, info); - if ((count <= 0) || (!info)) - { + if (count <= 0 || !info) { return total_count; } arr = (int*) g_malloc0(count * sizeof(int)); - for( i = 0 ; i < count ; i++ ) - { - if( info->detail_info[i] == NULL ) - { + for (i = 0 ; i < count ; i++) { + if (info->detail_info[i] == NULL) { continue; } - + name = ((type_element*)(info->detail_info[i]))->name; - - if ((fmt = _mmcamcorder_get_format(handle, conf_category, name)) >= 0) - { + fmt = _mmcamcorder_get_format(handle, conf_category, name); + if (fmt >= 0) { arr[total_count++] = fmt; } + _mmcam_dbg_log("name:%s, fmt:%d", name, fmt); } } - + *format = arr; return total_count; } - diff --git a/src/mm_camcorder_exifinfo.c b/src/mm_camcorder_exifinfo.c index a1a2f2e..f3e01fc 100644 --- a/src/mm_camcorder_exifinfo.c +++ b/src/mm_camcorder_exifinfo.c @@ -33,9 +33,14 @@ #include <mm_error.h> #include <glib.h> -#define MM_EXIFINFO_USE_BINARY_EXIFDATA 1 -#define JPEG_MAX_SIZE 20000000 -#define JPEG_THUMBNAIL_MAX_SIZE (128*1024) +#define MM_EXIFINFO_USE_BINARY_EXIFDATA 1 +#define JPEG_MAX_SIZE 20000000 +#define JPEG_THUMBNAIL_MAX_SIZE (128*1024) +#define JPEG_DATA_OFFSET 2 +#define EXIF_MARKER_SOI_LENGTH 2 +#define EXIF_MARKER_APP1_LENGTH 2 +#define EXIF_APP1_LENGTH 2 + #if MM_EXIFINFO_USE_BINARY_EXIFDATA /** * Exif Binary Data. @@ -524,24 +529,17 @@ int mm_exif_mnote_set_add_entry (ExifData *exif, MnoteSamsungTag tag, int index, int mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info, void *jpeg, int jpeg_len) { - FILE *fp = NULL; - unsigned long offset_jpeg_start; - unsigned short head[2]={0,}; - unsigned short head_len=0; - unsigned char *eb = NULL; - unsigned int ebs; + FILE *fp = NULL; + unsigned short head[2] = {0,}; + unsigned short head_len = 0; + unsigned char *eb = NULL; + unsigned int ebs; mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__); eb = info->data; ebs = info->size; - /*get DQT*/ - offset_jpeg_start = _exif_get_jpeg_marker_offset (jpeg, jpeg_len, 0xffdb); - if (offset_jpeg_start == 0) { - return -1; - } - /*create file*/ fp = fopen (filename, "wb"); if (!fp) { @@ -554,19 +552,19 @@ mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info, void *jp _exif_set_uint16 (0, &head[1], 0xffe1); /*set header length*/ _exif_set_uint16 (0, &head_len, (unsigned short)(ebs + 2)); - + if(head[0]==0 || head[1]==0 || head_len==0) { mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__); fclose (fp); return -1; } - - fwrite (&head[0], 1, 2, fp); /*SOI marker*/ - fwrite (&head[1], 1, 2, fp); /*APP1 marker*/ - fwrite (&head_len, 1, 2, fp); /*length of APP1*/ - fwrite (eb, 1, ebs, fp); /*EXIF*/ - fwrite (jpeg + offset_jpeg_start, 1, jpeg_len - offset_jpeg_start, fp); /*IMAGE*/ + + fwrite (&head[0], 1, EXIF_MARKER_SOI_LENGTH, fp); /*SOI marker*/ + fwrite (&head[1], 1, EXIF_MARKER_APP1_LENGTH, fp); /*APP1 marker*/ + fwrite (&head_len, 1, EXIF_APP1_LENGTH, fp); /*length of APP1*/ + fwrite (eb, 1, ebs, fp); /*EXIF*/ + fwrite (jpeg + JPEG_DATA_OFFSET, 1, jpeg_len - JPEG_DATA_OFFSET, fp); /*IMAGE*/ fclose (fp); @@ -576,15 +574,15 @@ mm_exif_write_exif_jpeg_to_file (char *filename, mm_exif_info_t *info, void *jp int mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_info_t *info, void *jpeg, unsigned int jpeg_len) { + unsigned short head[2] = {0,}; + unsigned short head_len = 0; + unsigned char *eb = NULL; + unsigned int ebs; + /*output*/ - unsigned char *m = NULL; - int m_len = 0; - /**/ - unsigned long offset_jpeg_start; - unsigned short head[2]={0,}; - unsigned short head_len=0; - unsigned char *eb = NULL; - unsigned int ebs; + unsigned char *m = NULL; + int m_len = 0; + mmf_debug (MMF_DEBUG_LOG,"[%05d][%s]\n", __LINE__, __func__); if(info==NULL || jpeg==NULL) @@ -601,15 +599,10 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf eb = info->data; ebs = info->size; - /*get DQT*/ - offset_jpeg_start = _exif_get_jpeg_marker_offset (jpeg, (int)jpeg_len, 0xffdb); - if (offset_jpeg_start == 0) { - return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; - } /*length of output image*/ /*SOI + APP1 + length of APP1 + length of EXIF + IMAGE*/ - m_len = 2 + 2 + 2 + ebs + (jpeg_len - offset_jpeg_start); + m_len = EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs + (jpeg_len - JPEG_DATA_OFFSET); /*alloc output image*/ m = malloc (m_len); if (!m) { @@ -622,17 +615,30 @@ mm_exif_write_exif_jpeg_to_memory (void **mem, unsigned int *length, mm_exif_inf _exif_set_uint16 (0, &head[1], 0xffe1); /*set header length*/ _exif_set_uint16 (0, &head_len, (unsigned short)(ebs + 2)); - if(head[0]==0 || head[1]==0 || head_len==0) - { + if (head[0] == 0 || head[1] == 0 || head_len == 0) { mmf_debug (MMF_DEBUG_ERROR,"[%05d][%s]setting error\n", __LINE__, __func__); free(m); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; - } - memcpy (m, &head[0], 2); /*SOI marker*/ - memcpy (m + 2, &head[1], 2); /*APP1 marker*/ - memcpy (m + 2 + 2, &head_len, 2); /*length of APP1*/ - memcpy (m + 2 + 2 + 2, eb, ebs); /*EXIF*/ - memcpy (m + 2 + 2 + 2 + ebs, jpeg + offset_jpeg_start, jpeg_len - offset_jpeg_start); /*IMAGE*/ + } + + /* Complete JPEG+EXIF */ + /*SOI marker*/ + memcpy(m, &head[0], EXIF_MARKER_SOI_LENGTH); + /*APP1 marker*/ + memcpy(m + EXIF_MARKER_SOI_LENGTH, + &head[1], EXIF_MARKER_APP1_LENGTH); + /*length of APP1*/ + memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH, + &head_len, EXIF_APP1_LENGTH); + /*EXIF*/ + memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH, + eb, ebs); + /*IMAGE*/ + memcpy(m + EXIF_MARKER_SOI_LENGTH + EXIF_MARKER_APP1_LENGTH + EXIF_APP1_LENGTH + ebs, + jpeg + JPEG_DATA_OFFSET, jpeg_len - JPEG_DATA_OFFSET); + + mmf_debug(MMF_DEBUG_LOG,"[%05d][%s] JPEG+EXIF Copy DONE(original:%d, copied:%d)\n", + __LINE__, __func__, jpeg_len, jpeg_len - JPEG_DATA_OFFSET); /*set ouput param*/ *mem = m; diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index b631caf..178f60d 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -40,7 +40,7 @@ gboolean audiocodec_fileformat_compatibility_table[MM_AUDIO_CODEC_NUM][MM_FILE_F /*G723.1*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /*MP3*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /*OGG*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, -/*AAC*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, +/*AAC*/ { 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /*WMA*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /*MMF*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, /*ADPCM*/ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, @@ -155,14 +155,16 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle) { int err = MM_ERROR_NONE; int rotate = 0; + int hflip = 0; + int vflip = 0; int fps = 0; - int slow_fps = 0; int hold_af = 0; int UseVideoscale = 0; int PictureFormat = 0; int codectype = 0; int capture_width = 0; int capture_height = 0; + int anti_shake = 0; char *videosrc_name = NULL; char *err_name = NULL; @@ -205,8 +207,10 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle) err = mm_camcorder_get_attributes(handle, &err_name, MMCAM_CAMERA_FORMAT, &PictureFormat, MMCAM_CAMERA_FPS, &fps, - "camera-slow-motion-fps", &slow_fps, MMCAM_CAMERA_ROTATION, &rotate, + MMCAM_CAMERA_FLIP_HORIZONTAL, &hflip, + MMCAM_CAMERA_FLIP_VERTICAL, &vflip, + MMCAM_CAMERA_ANTI_HANDSHAKE, &anti_shake, MMCAM_CAPTURE_WIDTH, &capture_width, MMCAM_CAPTURE_HEIGHT, &capture_height, MMCAM_IMAGE_ENCODER, &codectype, @@ -241,10 +245,17 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle) _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSRC_FILT, "capsfilter", "videosrc_filter", element_list, err); ); - sc->is_slow = FALSE; + /* init high-speed-fps */ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", 0); + + /* set capture size and flip setting which were set before mm_camcorder_realize */ MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-width", capture_width); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-height", capture_height); + _mmcamcorder_set_videosrc_hflip(handle, hflip); + _mmcamcorder_set_videosrc_vflip(handle, vflip); + + /* set VDIS mode if available */ + _mmcamcorder_set_videosrc_anti_shake(handle, anti_shake); if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO) { _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, @@ -299,8 +310,7 @@ int _mmcamcorder_create_videosrc_bin(MMHandleType handle) caps = NULL; } - if (slow_fps > 0) { - sc->is_slow = TRUE; + if (sc->is_modified_rate) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "high-speed-fps", fps); } } @@ -676,7 +686,8 @@ int _mmcamcorder_create_videosink_bin(MMHandleType handle) _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_CLS, "fimcconvert", NULL, element_list, err); ); - if (rotate < MM_DISPLAY_ROTATION_FLIP_HORZ) { + if (rotate > MM_VIDEO_INPUT_ROTATION_NONE && + rotate < MM_VIDEO_INPUT_ROTATION_NUM) { set_rotate = rotate * 90; } else { set_rotate = 0; @@ -752,9 +763,8 @@ int _mmcamcorder_create_videosink_bin(MMHandleType handle) _MMCAMCORDER_ELEMENT_MAKE(sc, _MMCAMCORDER_VIDEOSINK_SINK, videosink_name, NULL, element_list, err); ); - if (!strcmp(videosink_name, "xvimagesink") || - !strcmp(videosink_name, "ximagesink") || - !strcmp(videosink_name, "evasimagesink")) { + if (!strcmp(videosink_name, "xvimagesink") || !strcmp(videosink_name, "ximagesink") || + !strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) { if (_mmcamcorder_videosink_window_set(handle, sc->VideosinkElement) != MM_ERROR_NONE) { _mmcam_dbg_err("_mmcamcorder_videosink_window_set error"); err = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; @@ -956,7 +966,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle) } } - if (sc->is_slow == FALSE) { + if (sc->audio_disable == FALSE) { if (profile == MM_CAMCORDER_MODE_AUDIO || profile == MM_CAMCORDER_MODE_VIDEO) { int use_aenc_queue =0; @@ -1066,7 +1076,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle) _mmcamcorder_conf_set_value_element_property(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, VideoencElement); } - if (sc->is_slow == FALSE) { + if (sc->audio_disable == FALSE) { if (profile == MM_CAMCORDER_MODE_AUDIO || profile == MM_CAMCORDER_MODE_VIDEO) { /* audio encoder attribute setting */ if (a_bitrate > 0) { @@ -1120,7 +1130,7 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle) gst_object_unref(pad); pad = NULL; - if (sc->is_slow == FALSE) { + if (sc->audio_disable == FALSE) { pad = gst_element_get_request_pad(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "audio"); if (gst_element_add_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, gst_ghost_pad_new("audio_sink0", pad)) < 0) { gst_object_unref(pad); @@ -1414,9 +1424,14 @@ int _mmcamcorder_create_preview_pipeline(MMHandleType handle) gst_object_unref(sinkpad); sinkpad = NULL; - /* Register message callback */ bus = gst_pipeline_get_bus(GST_PIPELINE(sc->element[_MMCAMCORDER_MAIN_PIPE].gst)); - hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, _mmcamcorder_pipeline_cb_message, hcamcorder); + + /* Register message callback */ + hcamcorder->pipeline_cb_event_id = gst_bus_add_watch(bus, _mmcamcorder_pipeline_cb_message, (gpointer)hcamcorder); + + /* set sync handler */ + gst_bus_set_sync_handler(bus, _mmcamcorder_pipeline_bus_sync_callback, (gpointer)hcamcorder); + gst_object_unref(bus); bus = NULL; @@ -1478,8 +1493,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi int visible = 0; int rotation = MM_DISPLAY_ROTATION_NONE; int rotation_degree = 0; - int display_device = MM_DISPLAY_DEVICE_MAINLCD; - int display_mode = 0; + int display_mode = MM_DISPLAY_MODE_DEFAULT; int display_geometry_method = MM_DISPLAY_METHOD_LETTER_BOX; int origin_size = 0; int zoom_attr = 0; @@ -1515,7 +1529,7 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi MMCAM_DISPLAY_ROTATION, &rotation, MMCAM_DISPLAY_VISIBLE, &visible, MMCAM_DISPLAY_HANDLE, (void**)&overlay, &size, - MMCAM_DISPLAY_DEVICE, &display_device, + MMCAM_DISPLAY_MODE, &display_mode, MMCAM_DISPLAY_GEOMETRY_METHOD, &display_geometry_method, MMCAM_DISPLAY_SCALE, &zoom_attr, NULL); @@ -1537,13 +1551,14 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi _mmcam_dbg_log("xid = %lu )", xid); gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(vsink), xid); } else { - _mmcam_dbg_warn( "Set xid as 0.. but, it's not recommended." ); + _mmcam_dbg_warn("Handle is NULL. Set xid as 0.. but, it's not recommended."); gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(vsink), 0); } _mmcam_dbg_log("%s set: display_geometry_method[%d],origin-size[%d],visible[%d],rotate[enum:%d]", videosink_name, display_geometry_method, origin_size, visible, rotation); - } else if (!strcmp(videosink_name, "evasimagesink")) { + } else if (!strcmp(videosink_name, "evasimagesink") || !strcmp(videosink_name, "evaspixmapsink")) { + _mmcam_dbg_log("videosink : %s, handle : %p", videosink_name, overlay); if (overlay) { MMCAMCORDER_G_OBJECT_SET( vsink, "evas-object", overlay ); } else { @@ -1555,24 +1570,29 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi } /* Set attribute */ - if (!strcmp(videosink_name, "xvimagesink")) { - switch (rotation) { - case MM_DISPLAY_ROTATION_NONE : - rotation_degree = 0; - break; - case MM_DISPLAY_ROTATION_90 : - rotation_degree = 1; - break; - case MM_DISPLAY_ROTATION_180 : - rotation_degree = 2; - break; - case MM_DISPLAY_ROTATION_270 : - rotation_degree = 3; - break; - default: - _mmcam_dbg_warn("Unsupported rotation value. set as default(0)."); - rotation_degree = 0; - break; + if (!strcmp(videosink_name, "xvimagesink") || + !strcmp(videosink_name, "evaspixmapsink")) { + + if (!strcmp(videosink_name, "xvimagesink")) { + switch (rotation) { + case MM_DISPLAY_ROTATION_NONE : + rotation_degree = 0; + break; + case MM_DISPLAY_ROTATION_90 : + rotation_degree = 1; + break; + case MM_DISPLAY_ROTATION_180 : + rotation_degree = 2; + break; + case MM_DISPLAY_ROTATION_270 : + rotation_degree = 3; + break; + default: + _mmcam_dbg_warn("Unsupported rotation value. set as default(0)."); + rotation_degree = 0; + break; + } + MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation_degree); } switch (zoom_attr) { @@ -1591,25 +1611,9 @@ int _mmcamcorder_videosink_window_set(MMHandleType handle, type_element* Videosi break; } - switch (display_device) { - case MM_DISPLAY_DEVICE_TVOUT: - display_mode = 2; - break; - case MM_DISPLAY_DEVICE_MAINLCD_AND_TVOUT: - display_mode = 1; - break; - case MM_DISPLAY_DEVICE_MAINLCD: - case MM_DISPLAY_DEVICE_SUBLCD: - case MM_DISPLAY_DEVICE_MAINLCD_AND_SUBLCD: - default: - display_mode = 3; - break; - } - MMCAMCORDER_G_OBJECT_SET(vsink, "display-geometry-method", display_geometry_method); MMCAMCORDER_G_OBJECT_SET(vsink, "display-mode", display_mode); MMCAMCORDER_G_OBJECT_SET(vsink, "visible", visible); - MMCAMCORDER_G_OBJECT_SET(vsink, "rotate", rotation_degree); MMCAMCORDER_G_OBJECT_SET(vsink, "zoom", zoom_level); if (display_geometry_method == MM_DISPLAY_METHOD_CUSTOM_ROI) { @@ -1781,6 +1785,7 @@ static gboolean __mmcamcorder_video_dataprobe_vsink(GstPad *pad, GstBuffer *buff int state = MM_CAMCORDER_STATE_NULL; unsigned int fourcc = 0; MMCamcorderVideoStreamDataType stream; + void *standard_data = NULL; state = _mmcamcorder_get_state((MMHandleType)hcamcorder); if (state < MM_CAMCORDER_STATE_PREPARE) { @@ -1812,15 +1817,46 @@ static gboolean __mmcamcorder_video_dataprobe_vsink(GstPad *pad, GstBuffer *buff return TRUE; } - stream.data = (void *)GST_BUFFER_DATA(buffer); stream.length = GST_BUFFER_SIZE(buffer); stream.timestamp = (unsigned int)(GST_BUFFER_TIMESTAMP(buffer)/1000000); /* nano sec -> mili sec */ + /* make normal buffer for user handling when use zero copy format && NV12 */ + if ((stream.format == MM_PIXEL_FORMAT_NV12 || stream.format == MM_PIXEL_FORMAT_I420) && + hcamcorder->use_zero_copy_format && + GST_BUFFER_MALLOCDATA(buffer)) { + standard_data = (void *)malloc(stream.length); + if (standard_data) { + int size_y = stream.width * stream.height; + SCMN_IMGB *scmn_imgb = (SCMN_IMGB *)GST_BUFFER_MALLOCDATA(buffer); + + memcpy(standard_data, scmn_imgb->a[0], size_y); + + if (stream.format == MM_PIXEL_FORMAT_NV12) { + memcpy(standard_data + size_y, scmn_imgb->a[1], size_y >> 1); + } else { + memcpy(standard_data + size_y, scmn_imgb->a[1], size_y >> 2); + memcpy(standard_data + size_y + (size_y >> 2), scmn_imgb->a[2], size_y >> 2); + } + } else { + _mmcam_dbg_warn("mem allocate failed. skip stream callback..."); + return TRUE; + } + + stream.data = standard_data; + } else { + stream.data = (void *)GST_BUFFER_DATA(buffer); + } + _MMCAMCORDER_LOCK_VSTREAM_CALLBACK(hcamcorder); if (hcamcorder->vstream_cb) { hcamcorder->vstream_cb(&stream, hcamcorder->vstream_cb_param); } _MMCAMCORDER_UNLOCK_VSTREAM_CALLBACK(hcamcorder); + + if (standard_data) { + free(standard_data); + standard_data = NULL; + } } return TRUE; @@ -1829,10 +1865,6 @@ static gboolean __mmcamcorder_video_dataprobe_vsink(GstPad *pad, GstBuffer *buff static gboolean __mmcamcorder_video_dataprobe_vsink_drop_by_time(GstPad *pad, GstBuffer *buffer, gpointer u_data) { - static GstClockTime next_time = 0; - static GstClockTime current_time = 0; - GstClockTime interval = 30 * GST_MSECOND; //30ms(about 33 fps) - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data); _MMCamcorderSubContext *sc = NULL; @@ -1851,21 +1883,7 @@ static gboolean __mmcamcorder_video_dataprobe_vsink_drop_by_time(GstPad *pad, Gs return FALSE; } - if (sc->is_slow) { - if (GST_BUFFER_TIMESTAMP(buffer) < current_time) { - next_time = 0; - } - current_time = GST_BUFFER_TIMESTAMP(buffer); - - if (current_time >= next_time) { - next_time = current_time + interval; - return TRUE; - } else { - return FALSE; - } - } else { - return TRUE; - } + return TRUE; } @@ -2103,8 +2121,6 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate int set_height = 0; int set_rotate = 0; int fps = 0; - int slow_fps = 0; - int set_fps = 0; gboolean do_set_caps = FALSE; GstCaps *caps = NULL; @@ -2134,7 +2150,6 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate MMCAM_CAMERA_WIDTH, &width, MMCAM_CAMERA_HEIGHT, &height, MMCAM_CAMERA_FPS, &fps, - "camera-slow-motion-fps", &slow_fps, NULL); _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl, @@ -2146,13 +2161,7 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate return FALSE; } - /* Define width, height, rotate and flip in caps */ - if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA1) { - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", 1); - } else { - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", 0); - } - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hflip", 0); + /* Define width, height and rotate in caps */ /* This will be applied when rotate is 0, 90, 180, 270 if rear camera. This will be applied when rotate is 0, 180 if front camera. */ @@ -2173,22 +2182,8 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate } else { set_width = width; set_height = height; - - if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_FLIP_HORZ) { - set_rotate = 0; - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hflip", 1); - } else if (videosrc_rotate == MM_VIDEO_INPUT_ROTATION_FLIP_VERT) { - set_rotate = 0; - if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA1) { - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", 0); - } else { - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", 1); - } - } } - set_fps = sc->is_slow ? slow_fps : fps; - MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", &caps); if (caps) { GstStructure *structure = NULL; @@ -2205,7 +2200,7 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate gst_structure_get_int(structure, "fps", &caps_fps); gst_structure_get_int(structure, "rotate", &caps_rotate); if (set_width == caps_width && set_height == caps_height && - set_rotate == caps_rotate && set_fps == caps_fps) { + set_rotate == caps_rotate && fps == caps_fps) { _mmcam_dbg_log("No need to replace caps."); } else { _mmcam_dbg_log("something is different. set new one..."); @@ -2228,7 +2223,7 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate "format", GST_TYPE_FOURCC, sc->fourcc, "width", G_TYPE_INT, set_width, "height", G_TYPE_INT, set_height, - "framerate", GST_TYPE_FRACTION, set_fps, 1, + "framerate", GST_TYPE_FRACTION, fps, 1, "rotate", G_TYPE_INT, set_rotate, NULL); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "caps", caps); @@ -2236,8 +2231,147 @@ bool _mmcamcorder_set_videosrc_rotation(MMHandleType handle, int videosrc_rotate caps = NULL; _mmcam_dbg_log("vidoesrc new caps set. format[%c%c%c%c],width[%d],height[%d],fps[%d],rotate[%d]", (sc->fourcc), (sc->fourcc)>>8, (sc->fourcc)>>16, (sc->fourcc)>>24, - set_width, set_height, set_fps, set_rotate); + set_width, set_height, fps, set_rotate); + } + + return TRUE; +} + + +bool _mmcamcorder_set_videosrc_hflip(MMHandleType handle, int hflip) +{ + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + _MMCamcorderSubContext *sc = NULL; + type_int_array *input_index = NULL; + + mmf_return_val_if_fail(hcamcorder, FALSE); + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + mmf_return_val_if_fail(sc, TRUE); + + _mmcam_dbg_log("Set Horizontal FLIP %d", hflip); + + if (sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + _mmcamcorder_conf_get_value_int_array(hcamcorder->conf_ctrl, + CONFIGURE_CATEGORY_CTRL_CAMERA, + "InputIndex", + &input_index ); + + if (input_index->default_value == MM_VIDEO_DEVICE_CAMERA1) { + /* set reverse value because mirror effect of front camera */ + hflip = !hflip; + } + + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hflip", hflip); + } else { + _mmcam_dbg_warn("element is NULL"); + return FALSE; + } + + return TRUE; +} + + +bool _mmcamcorder_set_videosrc_vflip(MMHandleType handle, int vflip) +{ + mmf_camcorder_t *hcamcorder = NULL; + _MMCamcorderSubContext *sc = NULL; + + hcamcorder = MMF_CAMCORDER(handle); + if (hcamcorder == NULL) { + _mmcam_dbg_warn("handle is NULL"); + return FALSE; + } + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + if (sc == NULL) { + return TRUE; + } + + _mmcam_dbg_log("Set Vertical FLIP %d", vflip); + + if (sc->element && sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst) { + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "vflip", vflip); + } else { + _mmcam_dbg_warn("element is NULL"); + return FALSE; } return TRUE; } + + +bool _mmcamcorder_set_videosrc_anti_shake(MMHandleType handle, int anti_shake) +{ + GstCameraControl *control = NULL; + _MMCamcorderSubContext *sc = NULL; + GstElement *v_src = NULL; + + int set_value = 0; + int current_value = 0; + + sc = MMF_CAMCORDER_SUBCONTEXT(handle); + if (!sc) { + _mmcam_dbg_log("not initialized"); + return TRUE; + } + + v_src = sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst; + + if (!v_src) { + _mmcam_dbg_warn("videosrc element is NULL"); + return FALSE; + } + + set_value = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_ANTI_HANDSHAKE, anti_shake); + + /* check property of videosrc element - support VDIS */ + if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(v_src)), "enable-vdis-mode")) { + int camera_width = 0; + int camera_height = 0; + + /* VDIS mode only supports 720p and 1080p */ + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_WIDTH, &camera_width, + MMCAM_CAMERA_HEIGHT, &camera_height, + NULL); + if (camera_width >= 1280 && camera_height >= 720) { + _mmcam_dbg_log("preview size %dx%d, vdis mode %d", + camera_width, camera_height, set_value); + /* set vdis mode */ + g_object_set(G_OBJECT(v_src), + "enable-vdis-mode", set_value, + NULL); + return TRUE; + } else { + _mmcam_dbg_warn("invalid preview size %dx%d", + camera_width, camera_height, set_value); + return FALSE; + } + } + + /* set anti-shake with camera control */ + if (!GST_IS_CAMERA_CONTROL(v_src)) { + _mmcam_dbg_warn("Can't cast Video source into camera control."); + return FALSE; + } + + control = GST_CAMERA_CONTROL(v_src); + if (gst_camera_control_get_ahs(control, ¤t_value)) { + if (set_value != current_value) { + if (gst_camera_control_set_ahs(control, set_value)) { + _mmcam_dbg_log("Succeed in operating anti-handshake."); + return TRUE; + } else { + _mmcam_dbg_warn("Failed to operate anti-handshake. value[%d]", set_value); + } + } else { + _mmcam_dbg_log("No need to set new Anti-Handshake. Current[%d]", anti_shake); + return TRUE; + } + } else { + _mmcam_dbg_warn("Failed to get Anti-Handshake."); + } + + return FALSE; +} diff --git a/src/mm_camcorder_internal.c b/src/mm_camcorder_internal.c index 50528e9..70e3298 100644 --- a/src/mm_camcorder_internal.c +++ b/src/mm_camcorder_internal.c @@ -39,6 +39,7 @@ #include <mm_session.h> #include <mm_session_private.h> #include <audio-session-manager.h> +#include <vconf.h> /*--------------------------------------------------------------------------------------- | GLOBAL VARIABLE DEFINITIONS for internal | @@ -47,9 +48,9 @@ /*--------------------------------------------------------------------------------------- | LOCAL VARIABLE DEFINITIONS for internal | ---------------------------------------------------------------------------------------*/ - -//#define _MMCAM_USING_CAPTUREMODE -#define __MMCAMCORDER_CMD_ITERATE_MAX 3 +#define __MMCAMCORDER_CMD_ITERATE_MAX 3 +#define __MMCAMCORDER_SECURITY_HANDLE_DEFAULT -1 +#define __MMCAMCORDER_SET_GST_STATE_TIMEOUT 5 /*--------------------------------------------------------------------------------------- | LOCAL FUNCTION PROTOTYPES: | @@ -74,7 +75,6 @@ ASM_cb_result_t _mmcamcorder_asm_callback(int handle, ASM_event_sources_t event_ static gboolean __mmcamcorder_set_attr_to_camsensor_cb(gpointer data); - /*======================================================================================= | FUNCTION DEFINITIONS | =======================================================================================*/ @@ -92,6 +92,7 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) int rcmd_fmt_capture = MM_PIXEL_FORMAT_YUYV; int rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12; int rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270; + int play_capture_sound = TRUE; char *err_attr_name = NULL; char *ConfCtrlFile = NULL; mmf_camcorder_t *hcamcorder = NULL; @@ -99,7 +100,8 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) _mmcam_dbg_log("Entered"); - mmf_return_val_if_fail( handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT ); + mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); + mmf_return_val_if_fail(info, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); /* Create mmf_camcorder_t handle and initialize every variable */ hcamcorder = (mmf_camcorder_t *)malloc(sizeof(mmf_camcorder_t)); @@ -107,10 +109,10 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) memset(hcamcorder, 0x00, sizeof(mmf_camcorder_t)); /* init values */ - hcamcorder->type=0; - hcamcorder->state=MM_CAMCORDER_STATE_NULL; - hcamcorder->sub_context=NULL; - hcamcorder->target_state=MM_CAMCORDER_STATE_NULL; + hcamcorder->type = 0; + hcamcorder->state = MM_CAMCORDER_STATE_NONE; + hcamcorder->sub_context = NULL; + hcamcorder->target_state = MM_CAMCORDER_STATE_NULL; /* thread - for g_mutex_new() */ if (!g_thread_supported()) { @@ -265,11 +267,6 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) } /* Get recommend preview format and display rotation from INI */ - rcmd_fmt_capture = MM_PIXEL_FORMAT_YUYV; - rcmd_fmt_recording = MM_PIXEL_FORMAT_NV12; - rcmd_dpy_rotation = MM_DISPLAY_ROTATION_270; - err_attr_name = NULL; - _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAMERA, "RecommendPreviewFormatCapture", @@ -285,13 +282,19 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) "RecommendDisplayRotation", &rcmd_dpy_rotation); - _mmcam_dbg_log("Recommend prv[capture:%d,recording:%d], rot[%d]", - rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation); + _mmcamcorder_conf_get_value_int(hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_CAPTURE, + "PlayCaptureSound", + &play_capture_sound); + + _mmcam_dbg_log("Recommend preview rot[capture:%d,recording:%d], dpy rot[%d], play capture sound[%d]", + rcmd_fmt_capture, rcmd_fmt_recording, rcmd_dpy_rotation, play_capture_sound); ret = mm_camcorder_set_attributes((MMHandleType)hcamcorder, &err_attr_name, MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, rcmd_fmt_capture, MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING, rcmd_fmt_recording, MMCAM_RECOMMEND_DISPLAY_ROTATION, rcmd_dpy_rotation, + "capture-sound-enable", play_capture_sound, NULL); if (ret != MM_ERROR_NONE) { _mmcam_dbg_err( "Set %s FAILED.", err_attr_name ); @@ -309,7 +312,6 @@ int _mmcamcorder_create(MMHandleType *handle, MMCamPreset *info) "UseZeroCopyFormat", &(hcamcorder->use_zero_copy_format)); _mmcam_dbg_log("UseZeroCopyFormat : %d", hcamcorder->use_zero_copy_format); - /* Make some attributes as read-only type */ __ta__( " _mmcamcorder_lock_readonly_attributes", @@ -385,8 +387,8 @@ int _mmcamcorder_destroy(MMHandleType handle) int asm_session_type = ASM_EVENT_EXCLUSIVE_MMCAMCORDER; int sessionType = MM_SESSION_TYPE_SHARE; int errorcode = MM_ERROR_NONE; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _MMCamcorderMsgItem msg; _mmcam_dbg_log(""); @@ -537,18 +539,12 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _ERR_CAMCORDER_CMD_PRECON: - /*send message*/ if (hcamcorder) { - _mmcam_dbg_err("Destroy fail (%d, %d)", hcamcorder->type, state); - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); - } else { - _mmcam_dbg_err("Destroy fail (%d)", state); + _mmcam_dbg_err("Destroy fail (type %d, state %d)", hcamcorder->type, state); } + _mmcam_dbg_err("Destroy fail (ret %x)", ret); + return ret; } @@ -562,9 +558,10 @@ int _mmcamcorder_realize(MMHandleType handle) int sessionType = MM_SESSION_TYPE_EXCLUSIVE; int errorcode = MM_ERROR_NONE; int display_surface_type = MM_DISPLAY_SURFACE_X; + double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; char *videosink_element_type = NULL; char *videosink_name = NULL; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -602,8 +599,13 @@ int _mmcamcorder_realize(MMHandleType handle) goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } + mm_camcorder_get_attributes(handle, NULL, + MMCAM_MODE, &hcamcorder->type, + MMCAM_DISPLAY_SURFACE, &display_surface_type, + MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate, + NULL); + /* Get profile mode */ - mm_camcorder_get_attributes(handle, NULL, MMCAM_MODE, &hcamcorder->type, NULL); _mmcam_dbg_log("Profile mode set is (%d)", hcamcorder->type); /* Check and register ASM */ @@ -645,7 +647,10 @@ int _mmcamcorder_realize(MMHandleType handle) } /* Set basic configure information */ - mm_camcorder_get_attributes(handle, NULL, MMCAM_DISPLAY_SURFACE, &display_surface_type, NULL); + if (motion_rate != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { + hcamcorder->sub_context->is_modified_rate = TRUE; + } + switch (display_surface_type) { case MM_DISPLAY_SURFACE_X: videosink_element_type = strdup("VideosinkElementX"); @@ -663,18 +668,29 @@ int _mmcamcorder_realize(MMHandleType handle) videosink_element_type = strdup("VideosinkElementX"); break; } - _mmcamcorder_conf_get_element(hcamcorder->conf_main, - CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, - videosink_element_type, - &hcamcorder->sub_context->VideosinkElement ); - _mmcamcorder_conf_get_value_element_name( hcamcorder->sub_context->VideosinkElement, &videosink_name ); - _mmcam_dbg_log( "Videosink name : %s", videosink_name ); + /* check string of videosink element */ if (videosink_element_type) { + _mmcamcorder_conf_get_element(hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, + videosink_element_type, + &hcamcorder->sub_context->VideosinkElement ); + free(videosink_element_type); videosink_element_type = NULL; + } else { + _mmcam_dbg_warn("strdup failed(display_surface_type %d). Use default X type", + display_surface_type); + + _mmcamcorder_conf_get_element(hcamcorder->conf_main, + CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, + _MMCAMCORDER_DEFAULT_VIDEOSINK_TYPE, + &hcamcorder->sub_context->VideosinkElement ); } + _mmcamcorder_conf_get_value_element_name(hcamcorder->sub_context->VideosinkElement, &videosink_name); + _mmcam_dbg_log("Videosink name : %s", videosink_name); + _mmcamcorder_conf_get_value_int(hcamcorder->conf_ctrl, CONFIGURE_CATEGORY_CTRL_CAPTURE, "SensorEncodedCapture", @@ -685,7 +701,14 @@ int _mmcamcorder_realize(MMHandleType handle) __ta__(" _mmcamcorder_create_pipeline", ret = _mmcamcorder_create_pipeline(handle, hcamcorder->type); ); - if(ret<0) { + if (ret != MM_ERROR_NONE) { + /* check internal error of gstreamer */ + if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) { + ret = hcamcorder->sub_context->error_code; + _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + } + + /* release sub context */ _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context); hcamcorder->sub_context = NULL; goto _ERR_CAMCORDER_CMD; @@ -693,8 +716,7 @@ int _mmcamcorder_realize(MMHandleType handle) /* set command function */ ret = _mmcamcorder_set_functions(handle, hcamcorder->type); - - if(ret<0) { + if (ret != MM_ERROR_NONE) { _mmcamcorder_destroy_pipeline(handle, hcamcorder->type); _mmcamcorder_dealloc_subcontext(hcamcorder->sub_context); hcamcorder->sub_context = NULL; @@ -702,6 +724,19 @@ int _mmcamcorder_realize(MMHandleType handle) } _mmcamcorder_set_state(handle, state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_OPEN); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_OPEN); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -714,14 +749,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _ERR_CAMCORDER_CMD_PRECON: - /* send message */ - _mmcam_dbg_err("Realize fail (%d, %d, %x)", hcamcorder->type, state, ret); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Realize fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -736,7 +765,7 @@ int _mmcamcorder_unrealize(MMHandleType handle) int sessionType = MM_SESSION_TYPE_SHARE; int asm_session_type = ASM_EVENT_NONE; ASM_resource_t mm_resource = ASM_RESOURCE_NONE; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -786,36 +815,52 @@ int _mmcamcorder_unrealize(MMHandleType handle) hcamcorder->command = NULL; - if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) { - _mmcam_dbg_err("_mm_session_util_read_type Fail\n"); - } - - if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) { - asm_session_type = ASM_EVENT_NONE; - mm_resource = ASM_RESOURCE_NONE; - asm_session_type = __mmcamcorder_asm_get_event_type( sessionType ); + /* check who calls unrealize. it's no need to set ASM state if caller is ASM */ + if (hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_ASM) { + if (MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType)) { + _mmcam_dbg_err("_mm_session_util_read_type Fail\n"); + } - switch (hcamcorder->type) { - case MM_CAMCORDER_MODE_VIDEO: - mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER; - break; - case MM_CAMCORDER_MODE_AUDIO: + if ((sessionType != MM_SESSION_TYPE_CALL) && (sessionType != MM_SESSION_TYPE_VIDEOCALL)) { + asm_session_type = ASM_EVENT_NONE; mm_resource = ASM_RESOURCE_NONE; - break; - case MM_CAMCORDER_MODE_IMAGE: - default: - mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY; - break; - } + asm_session_type = __mmcamcorder_asm_get_event_type(sessionType); - /* Call session is not ended here */ - if (!ASM_set_sound_state(hcamcorder->asm_handle, asm_session_type, - ASM_STATE_STOP, mm_resource, &ret)) { - _mmcam_dbg_err("Set state to playing failed 0x%X\n", ret); + switch (hcamcorder->type) { + case MM_CAMCORDER_MODE_VIDEO: + mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY | ASM_RESOURCE_HW_ENCODER; + break; + case MM_CAMCORDER_MODE_AUDIO: + mm_resource = ASM_RESOURCE_NONE; + break; + case MM_CAMCORDER_MODE_IMAGE: + default: + mm_resource = ASM_RESOURCE_CAMERA | ASM_RESOURCE_VIDEO_OVERLAY; + break; + } + + /* Call session is not ended here */ + if (!ASM_set_sound_state(hcamcorder->asm_handle, asm_session_type, + ASM_STATE_STOP, mm_resource, &ret)) { + _mmcam_dbg_err("Set state to playing failed 0x%X\n", ret); + } } } _mmcamcorder_set_state(handle, state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_NULL); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_NULL); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -825,13 +870,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Unrealize fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Unrealize fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -842,7 +882,7 @@ int _mmcamcorder_start(MMHandleType handle) int state = MM_CAMCORDER_STATE_NONE; int state_FROM = MM_CAMCORDER_STATE_READY; int state_TO =MM_CAMCORDER_STATE_PREPARE; - _MMCamcorderMsgItem msg; + _MMCamcorderSubContext *sc = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); @@ -877,6 +917,9 @@ int _mmcamcorder_start(MMHandleType handle) goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } + /* initialize error code */ + hcamcorder->sub_context->error_code = MM_ERROR_NONE; + /* set async state */ ret = _mmcamcorder_set_async_state(handle, state_TO); if (ret != MM_ERROR_NONE) { @@ -892,7 +935,18 @@ int _mmcamcorder_start(MMHandleType handle) _mmcamcorder_set_state(handle, state_TO); if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + _mmcamcorder_set_attribute_to_camsensor(handle); + + /* check camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + + /* set camera state to vconf key */ + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_PREVIEW); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_PREVIEW); } _MMCAMCORDER_UNLOCK_CMD(hcamcorder); @@ -907,14 +961,16 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _ERR_CAMCORDER_CMD_PRECON: - /* send message */ - _mmcam_dbg_err("Start fail (%d, %d)", hcamcorder->type, state); + /* check internal error of gstreamer */ + if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) { + ret = hcamcorder->sub_context->error_code; + hcamcorder->sub_context->error_code = MM_ERROR_NONE; - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + } + + _mmcam_dbg_err("Start fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -926,7 +982,7 @@ int _mmcamcorder_stop(MMHandleType handle) int state_FROM = MM_CAMCORDER_STATE_PREPARE; int state_TO = MM_CAMCORDER_STATE_READY; int frame_rate = 0; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -967,6 +1023,20 @@ int _mmcamcorder_stop(MMHandleType handle) __ta__(__tafmt__("MM_CAM_006:: Frame per sec : %d", frame_rate), ;); _mmcamcorder_set_state(handle, state_TO); + + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* check camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + + /* set camera state to vconf key */ + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_OPEN); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_OPEN); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -980,13 +1050,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Stop fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Stop fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -997,10 +1062,10 @@ int _mmcamcorder_capture_start(MMHandleType handle) int ret = MM_ERROR_NONE; int state = MM_CAMCORDER_STATE_NONE; int state_FROM = MM_CAMCORDER_STATE_PREPARE; + int state_FROM2 = MM_CAMCORDER_STATE_RECORDING; int state_TO = MM_CAMCORDER_STATE_CAPTURING; char *err_name = NULL; - _MMCamcorderMsgItem msg; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1018,7 +1083,7 @@ int _mmcamcorder_capture_start(MMHandleType handle) } state = _mmcamcorder_get_state(handle); - if (state != state_FROM) { + if (state != state_FROM && state != state_FROM2) { _mmcam_dbg_err("Wrong state(%d)", state); ret = MM_ERROR_CAMCORDER_INVALID_STATE; goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; @@ -1036,7 +1101,10 @@ int _mmcamcorder_capture_start(MMHandleType handle) goto _ERR_CAMCORDER_CMD; } - _mmcamcorder_set_state(handle, state_TO); + /* Do not change state when recording snapshot capture */ + if (state == state_FROM) { + _mmcamcorder_set_state(handle, state_TO); + } /* Init break continuous shot attr */ mm_camcorder_set_attributes(handle, &err_name, "capture-break-cont-shot", 0, NULL); @@ -1054,13 +1122,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Capture start fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Capture start fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1071,7 +1134,6 @@ int _mmcamcorder_capture_stop(MMHandleType handle) int state = MM_CAMCORDER_STATE_NONE; int state_FROM = MM_CAMCORDER_STATE_CAPTURING; int state_TO = MM_CAMCORDER_STATE_PREPARE; - _MMCamcorderMsgItem msg; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1109,21 +1171,10 @@ int _mmcamcorder_capture_stop(MMHandleType handle) _mmcamcorder_set_state(handle, state_TO); - /* Set strobe mode - strobe mode can not be set to driver while captuing */ -{ - __ta__("Set strobe mode after capture", - mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle); - if (attr) { - mmf_attribute_set_modified(&(attr->items[MM_CAM_STROBE_MODE])); - if (mmf_attrs_commit((MMHandleType) attr) == -1) { - _mmcam_dbg_warn("Failed to set strobe mode"); - } - } - ); -} - _MMCAMCORDER_UNLOCK_CMD(hcamcorder); + MMTA_ACUM_ITEM_END("Real First Capture Start", FALSE); + return MM_ERROR_NONE; _ERR_CAMCORDER_CMD: @@ -1135,13 +1186,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Capture stop fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Capture stop fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1153,7 +1199,7 @@ int _mmcamcorder_record(MMHandleType handle) int state_FROM1 = MM_CAMCORDER_STATE_PREPARE; int state_FROM2 = MM_CAMCORDER_STATE_PAUSED; int state_TO = MM_CAMCORDER_STATE_RECORDING; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1177,6 +1223,9 @@ int _mmcamcorder_record(MMHandleType handle) goto _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK; } + /* initialize error code */ + hcamcorder->sub_context->error_code = MM_ERROR_NONE; + /* set async state */ ret = _mmcamcorder_set_async_state(handle, state_TO); if (ret != MM_ERROR_NONE) { @@ -1190,6 +1239,19 @@ int _mmcamcorder_record(MMHandleType handle) } _mmcamcorder_set_state(handle, state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_RECORDING); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_RECORDING); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -1202,14 +1264,16 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _MMCAMCORDER_UNLOCK_CMD(hcamcorder); _ERR_CAMCORDER_CMD_PRECON: - /* send message */ - _mmcam_dbg_err("Record fail (%d, %d)", hcamcorder->type, state); + /* check internal error of gstreamer */ + if (hcamcorder->sub_context->error_code != MM_ERROR_NONE) { + ret = hcamcorder->sub_context->error_code; + hcamcorder->sub_context->error_code = MM_ERROR_NONE; - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_log("gstreamer error is occurred. return it %x", ret); + } + + _mmcam_dbg_err("Record fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1221,7 +1285,7 @@ int _mmcamcorder_pause(MMHandleType handle) int state = MM_CAMCORDER_STATE_NONE; int state_FROM = MM_CAMCORDER_STATE_RECORDING; int state_TO = MM_CAMCORDER_STATE_PAUSED; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1258,6 +1322,19 @@ int _mmcamcorder_pause(MMHandleType handle) } _mmcamcorder_set_state(handle, state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_RECORDING_PAUSE); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_RECORDING_PAUSE); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -1271,13 +1348,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Pause fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Pause fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1290,7 +1362,7 @@ int _mmcamcorder_commit(MMHandleType handle) int state_FROM1 = MM_CAMCORDER_STATE_RECORDING; int state_FROM2 = MM_CAMCORDER_STATE_PAUSED; int state_TO = MM_CAMCORDER_STATE_PREPARE; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1327,6 +1399,19 @@ int _mmcamcorder_commit(MMHandleType handle) } _mmcamcorder_set_state(handle,state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_PREVIEW); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_PREVIEW); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -1340,13 +1425,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Commit fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Commit fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1359,7 +1439,7 @@ int _mmcamcorder_cancel(MMHandleType handle) int state_FROM1 = MM_CAMCORDER_STATE_RECORDING; int state_FROM2 = MM_CAMCORDER_STATE_PAUSED; int state_TO = MM_CAMCORDER_STATE_PREPARE; - _MMCamcorderMsgItem msg; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _mmcam_dbg_log(""); @@ -1396,6 +1476,19 @@ int _mmcamcorder_cancel(MMHandleType handle) } _mmcamcorder_set_state(handle, state_TO); + + /* set camera state to vconf key */ + if (hcamcorder->type != MM_CAMCORDER_MODE_AUDIO) { + int vconf_camera_state = 0; + + /* get current camera state of vconf key */ + vconf_get_int(VCONFKEY_CAMERA_STATE, &vconf_camera_state); + vconf_set_int(VCONFKEY_CAMERA_STATE, VCONFKEY_CAMERA_STATE_PREVIEW); + + _mmcam_dbg_log("VCONFKEY_CAMERA_STATE prev %d -> cur %d", + vconf_camera_state, VCONFKEY_CAMERA_STATE_PREVIEW); + } + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); return MM_ERROR_NONE; @@ -1409,13 +1502,8 @@ _ERR_CAMCORDER_CMD_PRECON_AFTER_LOCK: _ERR_CAMCORDER_CMD_PRECON: /* send message */ - _mmcam_dbg_err("Cancel fail (%d, %d)", hcamcorder->type, state); - - msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; - msg.param.state.previous = state; - msg.param.state.current = state; - msg.param.state.code = ret; - _mmcamcroder_send_message(handle, &msg); + _mmcam_dbg_err("Cancel fail (type %d, state %d, ret %x)", + hcamcorder->type, state, ret); return ret; } @@ -1550,12 +1638,14 @@ int _mmcamcorder_get_current_state(MMHandleType handle) int _mmcamcorder_init_focusing(MMHandleType handle) { - int ret = 0; + int ret = TRUE; int state = MM_CAMCORDER_STATE_NONE; int focus_mode = MM_CAMCORDER_FOCUS_MODE_NONE; int af_range = MM_CAMCORDER_AUTO_FOCUS_NORMAL; int sensor_focus_mode = 0; int sensor_af_range = 0; + int current_focus_mode = 0; + int current_af_range = 0; mmf_camcorder_t *hcamcorder = NULL; _MMCamcorderSubContext *sc = NULL; mmf_attrs_t *attr = NULL; @@ -1603,10 +1693,18 @@ int _mmcamcorder_init_focusing(MMHandleType handle) MMCAM_CAMERA_FOCUS_MODE, &focus_mode, MMCAM_CAMERA_AF_SCAN_RANGE, &af_range, NULL); - sensor_af_range = _mmcamcorder_convert_msl_to_sensor(MM_CAM_CAMERA_AF_SCAN_RANGE, af_range); - sensor_focus_mode = _mmcamcorder_convert_msl_to_sensor(MM_CAM_CAMERA_FOCUS_MODE, focus_mode); + sensor_af_range = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_AF_SCAN_RANGE, af_range); + sensor_focus_mode = _mmcamcorder_convert_msl_to_sensor(handle, MM_CAM_CAMERA_FOCUS_MODE, focus_mode); - ret = gst_camera_control_set_focus(control, sensor_focus_mode, sensor_af_range); + gst_camera_control_get_focus(control, ¤t_focus_mode, ¤t_af_range); + + if (current_focus_mode != sensor_focus_mode || + current_af_range != sensor_af_range) { + ret = gst_camera_control_set_focus(control, sensor_focus_mode, sensor_af_range); + } else { + _mmcam_dbg_log("No need to init FOCUS [mode:%d, range:%d]", focus_mode, af_range ); + ret = TRUE; + } _MMCAMCORDER_UNLOCK_CMD(hcamcorder); @@ -1724,7 +1822,6 @@ int _mmcamcorder_adjust_manual_focus(MMHandleType handle, int direction) int _mmcamcorder_adjust_auto_focus(MMHandleType handle) { - int af_mode = MM_CAMCORDER_FOCUS_MODE_AUTO; gboolean ret; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); GstCameraControl *control = NULL; @@ -1745,11 +1842,6 @@ int _mmcamcorder_adjust_auto_focus(MMHandleType handle) /* Start AF */ ret = gst_camera_control_start_auto_focus(control); if (ret) { - mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &af_mode, NULL); - if (af_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS) { - sc->now_continuous_af = TRUE; - _mmcam_dbg_log("Set now_continuous_af as TRUE"); - } _mmcam_dbg_log("Auto focusing start success."); return MM_ERROR_NONE; } else { @@ -1793,8 +1885,6 @@ int _mmcamcorder_stop_focusing(MMHandleType handle) control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); ret = gst_camera_control_stop_auto_focus(control); - sc->now_continuous_af = FALSE; - _mmcam_dbg_log("Set now_continuous_af as FALSE"); _MMCAMCORDER_UNLOCK_CMD(hcamcorder); @@ -1953,6 +2043,7 @@ void _mmcamcorder_set_state(MMHandleType handle, int state) msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM; msg.param.state.code = hcamcorder->asm_event_code; break; + case _MMCAMCORDER_STATE_CHANGE_NORMAL: default: msg.id = MM_MESSAGE_CAMCORDER_STATE_CHANGED; msg.param.state.code = MM_ERROR_NONE; @@ -2144,10 +2235,10 @@ _MMCamcorderSubContext *_mmcamcorder_alloc_subcontext(int type) } sc->fourcc = 0x80000000; - sc->cam_stability_count = 0; - sc->drop_vframe = 0; - sc->pass_first_vframe = 0; + sc->drop_vframe = 0; + sc->pass_first_vframe = 0; + sc->is_modified_rate = FALSE; return sc; } @@ -2338,6 +2429,91 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi msg.id = MM_MESSAGE_CAMCORDER_FOCUS_CHANGED; msg.param.code = focus_state; _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + } else if (gst_structure_has_name(message->structure, "camerasrc-HDR")) { + int progress = 0; + int status = 0; + + gst_structure_get_int(message->structure, "progress", &progress); + gst_structure_get_int(message->structure, "status", &status); + _mmcam_dbg_log("HDR progress %d percent, status %d", progress, status); + + msg.id = MM_MESSAGE_CAMCORDER_HDR_PROGRESS; + msg.param.code = progress; + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + } else if (gst_structure_has_name(message->structure, "camerasrc-FD")) { + int i = 0; + GValue *g_value = NULL; + GstCameraControlFaceDetectInfo *fd_info = NULL; + MMCamFaceDetectInfo *cam_fd_info = NULL; + + g_value = gst_structure_get_value(message->structure, "face-info"); + if (g_value) { + fd_info = (GstCameraControlFaceDetectInfo *)g_value_get_pointer(g_value); + } + + if (fd_info == NULL) { + _mmcam_dbg_warn("fd_info is NULL"); + return TRUE; + } + + cam_fd_info = (MMCamFaceDetectInfo *)malloc(sizeof(MMCamFaceDetectInfo)); + if (cam_fd_info == NULL) { + _mmcam_dbg_warn("cam_fd_info alloc failed"); + + free(fd_info); + fd_info = NULL; + + return TRUE; + } + + /* set total face count */ + cam_fd_info->num_of_faces = fd_info->num_of_faces; + + if (cam_fd_info->num_of_faces > 0) { + cam_fd_info->face_info = (MMCamFaceInfo *)malloc(sizeof(MMCamFaceInfo) * cam_fd_info->num_of_faces); + if (cam_fd_info->face_info) { + /* set information of each face */ + for (i = 0 ; i < fd_info->num_of_faces ; i++) { + cam_fd_info->face_info[i].id = fd_info->face_info[i].id; + cam_fd_info->face_info[i].score = fd_info->face_info[i].score; + cam_fd_info->face_info[i].rect.x = fd_info->face_info[i].rect.x; + cam_fd_info->face_info[i].rect.y = fd_info->face_info[i].rect.y; + cam_fd_info->face_info[i].rect.width = fd_info->face_info[i].rect.width; + cam_fd_info->face_info[i].rect.height = fd_info->face_info[i].rect.height; + /* + _mmcam_dbg_log("id %d, score %d, [%d,%d,%dx%d]", + fd_info->face_info[i].id, + fd_info->face_info[i].score, + fd_info->face_info[i].rect.x, + fd_info->face_info[i].rect.y, + fd_info->face_info[i].rect.width, + fd_info->face_info[i].rect.height); + */ + } + } else { + _mmcam_dbg_warn("MMCamFaceInfo alloc failed"); + + /* free allocated memory that is not sent */ + free(cam_fd_info); + cam_fd_info = NULL; + } + } else { + cam_fd_info->face_info = NULL; + } + + if (cam_fd_info) { + /* send message - cam_fd_info should be freed by application */ + msg.id = MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO; + msg.param.data = cam_fd_info; + msg.param.size = sizeof(MMCamFaceDetectInfo); + msg.param.code = 0; + + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + } + + /* free fd_info allocated by plugin */ + free(fd_info); + fd_info = NULL; } break; case GST_MESSAGE_SEGMENT_START: @@ -2370,6 +2546,101 @@ gboolean _mmcamcorder_pipeline_cb_message(GstBus *bus, GstMessage *message, gpoi } +GstBusSyncReply _mmcamcorder_pipeline_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data) +{ + GstElement *element = NULL; + GError *err = NULL; + gchar *debug_info = NULL; + + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data); + _MMCamcorderSubContext *sc = NULL; + + mmf_return_val_if_fail(hcamcorder, GST_BUS_PASS); + mmf_return_val_if_fail(message, GST_BUS_PASS); + + sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); + mmf_return_val_if_fail(sc, GST_BUS_PASS); + + sc->error_code = MM_ERROR_NONE; + + if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) { + /* parse error message */ + gst_message_parse_error(message, &err, &debug_info); + + if (!err) { + _mmcam_dbg_warn("failed to parse error message"); + return GST_BUS_PASS; + } + + if (debug_info) { + _mmcam_dbg_err("GST ERROR : %s", debug_info); + g_free(debug_info); + debug_info = NULL; + } + + /* set videosrc element to compare */ + element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + + /* check domain[RESOURCE] and element[VIDEOSRC] */ + if (err->domain == GST_RESOURCE_ERROR && + GST_ELEMENT_CAST(message->src) == element) { + switch (err->code) { + case GST_RESOURCE_ERROR_BUSY: + _mmcam_dbg_err("Camera device [busy]"); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_BUSY; + break; + case GST_RESOURCE_ERROR_OPEN_READ_WRITE: + case GST_RESOURCE_ERROR_OPEN_WRITE: + _mmcam_dbg_err("Camera device [open failed]"); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_OPEN; + break; + case GST_RESOURCE_ERROR_OPEN_READ: + _mmcam_dbg_err("Camera device [register trouble]"); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE; + break; + case GST_RESOURCE_ERROR_NOT_FOUND: + _mmcam_dbg_err("Camera device [device not found]"); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND; + break; + case GST_RESOURCE_ERROR_TOO_LAZY: + _mmcam_dbg_err("Camera device [timeout]"); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_TIMEOUT; + break; + case GST_RESOURCE_ERROR_SETTINGS: + _mmcam_dbg_err("Camera device [not supported]"); + sc->error_code = MM_ERROR_CAMCORDER_NOT_SUPPORTED; + break; + case GST_RESOURCE_ERROR_FAILED: + _mmcam_dbg_err("Camera device [working failed]."); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE_IO; + break; + default: + _mmcam_dbg_err("Camera device [General(%d)]", err->code); + sc->error_code = MM_ERROR_CAMCORDER_DEVICE; + break; + } + + sc->error_occurs = TRUE; + } + + g_error_free(err); + + /* store error code and drop this message if cmd is running */ + if (sc->error_code != MM_ERROR_NONE) { + if (!_MMCAMCORDER_TRYLOCK_CMD(hcamcorder)) { + _mmcam_dbg_err("cmd is running and will be returned with this error %x", + sc->error_code); + return GST_BUS_DROP; + } + + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); + } + } + + return GST_BUS_PASS; +} + + static int __mmcamcorder_asm_get_event_type(int sessionType) { switch (sessionType) { @@ -2521,11 +2792,11 @@ int _mmcamcorder_create_pipeline(MMHandleType handle, int type) } } } - +#ifdef _MMCAMCORDER_GET_DEVICE_INFO if (!_mmcamcorder_get_device_info(handle)) { _mmcam_dbg_err("Getting device information error!!"); } - +#endif _mmcam_dbg_log("ret[%x]", ret); return ret; } @@ -2638,7 +2909,7 @@ int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstSt GstState pipeline_state = GST_STATE_VOID_PENDING; GstStateChangeReturn setChangeReturn = GST_STATE_CHANGE_FAILURE; GstStateChangeReturn getChangeReturn = GST_STATE_CHANGE_FAILURE; - GstClockTime get_timeout = 3 * GST_SECOND; + GstClockTime get_timeout = __MMCAMCORDER_SET_GST_STATE_TIMEOUT * GST_SECOND; mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -2648,6 +2919,8 @@ int _mmcamcorder_gst_set_state (MMHandleType handle, GstElement *pipeline, GstSt for (k = 0; k < _MMCAMCORDER_STATE_SET_COUNT; k++) { setChangeReturn = gst_element_set_state(pipeline, target_state); + _mmcam_dbg_log("gst_element_set_state[%d] return %d", + target_state, setChangeReturn); if (setChangeReturn != GST_STATE_CHANGE_FAILURE) { getChangeReturn = gst_element_get_state(pipeline, &pipeline_state, NULL, get_timeout); switch (getChangeReturn) { @@ -3069,7 +3342,7 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderMsgItem msg; gchar *msg_src_element; - _MMCamcorderSubContext *sc = NULL; + _MMCamcorderSubContext *sc = NULL; return_val_if_fail(hcamcorder, FALSE); return_val_if_fail(error, FALSE); @@ -3115,11 +3388,13 @@ static gboolean __mmcamcorder_handle_gst_error(MMHandleType handle, GstMessage * g_quark_to_string (error->domain), error->message, error->code, msg.param.code); } +#ifdef _MMCAMCORDER_SKIP_GST_FLOW_ERROR /* Check whether send this error to application */ if (msg.param.code == MM_ERROR_CAMCORDER_GST_FLOW_ERROR) { _mmcam_dbg_log("We got the error. But skip it."); return TRUE; } +#endif /* _MMCAMCORDER_SKIP_GST_FLOW_ERROR */ /* post error to application */ sc->error_occurs = TRUE; @@ -3207,7 +3482,7 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; - GstElement *element =NULL; + GstElement *element = NULL; mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); @@ -3217,34 +3492,6 @@ static gint __mmcamcorder_gst_handle_resource_error(MMHandleType handle, int cod _mmcam_dbg_log(""); /* Specific plugin */ - /* video source */ - element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); - if (GST_ELEMENT_CAST(message->src) == element) { - switch (code) { - case GST_RESOURCE_ERROR_BUSY: - _mmcam_dbg_err("Video device [busy]"); - return MM_ERROR_CAMCORDER_DEVICE_BUSY; - case GST_RESOURCE_ERROR_FAILED: - _mmcam_dbg_err("Video device [working failed]."); - return MM_ERROR_CAMCORDER_DEVICE_IO; - case GST_RESOURCE_ERROR_TOO_LAZY: - _mmcam_dbg_err("Video device [timeout]"); - return MM_ERROR_CAMCORDER_DEVICE_TIMEOUT; - case GST_RESOURCE_ERROR_OPEN_READ: - _mmcam_dbg_err("Video device [open failed]"); - return MM_ERROR_CAMCORDER_DEVICE_OPEN; - case GST_RESOURCE_ERROR_SETTINGS: - _mmcam_dbg_err("Video device [Not supported]"); - return MM_ERROR_CAMCORDER_NOT_SUPPORTED; - case GST_RESOURCE_ERROR_NOT_FOUND: - _mmcam_dbg_err("Video device [Register trouble]"); - return MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE; - default: - _mmcam_dbg_err("Video device [General(%d)]", code); - return MM_ERROR_CAMCORDER_DEVICE; - } - } - /* video sink */ element = GST_ELEMENT_CAST(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst); if (GST_ELEMENT_CAST(message->src) == element) { diff --git a/src/mm_camcorder_platform.c b/src/mm_camcorder_platform.c index 3497ab5..94cc532 100644 --- a/src/mm_camcorder_platform.c +++ b/src/mm_camcorder_platform.c @@ -162,15 +162,6 @@ _MMCamcorderEnumConvert _mmcamcorder_enum_conv_ahs = "AntiHandshake" }; -static int __enum_conv_picture_format[MM_PIXEL_FORMAT_NUM]; - -_MMCamcorderEnumConvert _mmcamcorder_enum_conv_picture_format = -{ - MM_PIXEL_FORMAT_NUM, - __enum_conv_picture_format, - CONFIGURE_CATEGORY_CTRL_CAMERA, - "PictureFormat" -}; static int __enum_conv_vid_dev[MM_VIDEO_DEVICE_NUM] = { @@ -187,6 +178,26 @@ _MMCamcorderEnumConvert _mmcamcorder_enum_conv_vid_dev = NULL }; +static int __enum_conv_hdr_capture[MM_CAMCORDER_HDR_CAPTURE_NUM]; + +_MMCamcorderEnumConvert _mmcamcorder_enum_conv_hdr_capture = +{ + MM_CAMCORDER_HDR_CAPTURE_NUM, + __enum_conv_hdr_capture, + CONFIGURE_CATEGORY_CTRL_CAPTURE, + "SupportHDR" +}; + +static int __enum_conv_detect_mode[MM_CAMCORDER_DETECT_MODE_NUM]; + +_MMCamcorderEnumConvert _mmcamcorder_enum_conv_detect_mode = +{ + MM_CAMCORDER_DETECT_MODE_NUM, + __enum_conv_detect_mode, + CONFIGURE_CATEGORY_CTRL_DETECT, + "DetectMode" +}; + /** * Matching table of caminfo index with category enum of attribute. @@ -207,6 +218,15 @@ static _MMCamcorderInfoConverting g_display_info[] = { { CONFIGURE_TYPE_MAIN, CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, + MM_CAM_DISPLAY_MODE, + MM_CAMCORDER_ATTR_NONE, + "DisplayMode", + MM_CAMCONVERT_TYPE_INT_ARRAY, + NULL, + }, + { + CONFIGURE_TYPE_MAIN, + CONFIGURE_CATEGORY_MAIN_VIDEO_OUTPUT, MM_CAM_DISPLAY_SURFACE, MM_CAMCORDER_ATTR_NONE, "Videosink", @@ -215,7 +235,7 @@ static _MMCamcorderInfoConverting g_display_info[] = { }, }; -static _MMCamcorderInfoConverting g_caminfo_convert[] = { +static _MMCamcorderInfoConverting g_caminfo_convert[CAMINFO_CONVERT_NUM] = { { CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_CAMERA, @@ -252,7 +272,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY, NULL, }, - { + { /* 5 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_CAMERA, MM_CAM_CAMERA_FPS, @@ -297,7 +317,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_ARRAY, &_mmcamcorder_enum_conv_strobe_mode, }, - { + { /* 10 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_EFFECT, MM_CAM_FILTER_BRIGHTNESS, @@ -342,7 +362,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_RANGE, NULL, }, - { + { /* 15 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_EFFECT, MM_CAM_FILTER_WB, @@ -387,7 +407,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_RANGE, NULL, }, - { + { /* 20 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH, MM_CAM_CAMERA_FOCUS_MODE, @@ -432,7 +452,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_ARRAY, NULL, }, - { + { /* 25 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH, MM_CAM_CAMERA_SHUTTER_SPEED, @@ -477,7 +497,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_ARRAY, NULL, }, - { + { /* 30 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_CAPTURE, MM_CAM_IMAGE_ENCODER_QUALITY, @@ -497,12 +517,21 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { }, { CONFIGURE_TYPE_CTRL, + CONFIGURE_CATEGORY_CTRL_CAPTURE, + MM_CAM_CAMERA_HDR_CAPTURE, + MM_CAMCORDER_ATTR_NONE, + "SupportHDR", + MM_CAMCONVERT_TYPE_INT_ARRAY, + &_mmcamcorder_enum_conv_hdr_capture, + }, + { + CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_DETECT, MM_CAM_DETECT_MODE, MM_CAMCORDER_ATTR_NONE, "DetectMode", MM_CAMCONVERT_TYPE_INT_ARRAY, - NULL, + &_mmcamcorder_enum_conv_detect_mode, }, { CONFIGURE_TYPE_CTRL, @@ -513,7 +542,7 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_RANGE, NULL, }, - { + { /* 35 */ CONFIGURE_TYPE_CTRL, CONFIGURE_CATEGORY_CTRL_DETECT, MM_CAM_DETECT_FOCUS_SELECT, @@ -540,6 +569,33 @@ static _MMCamcorderInfoConverting g_caminfo_convert[] = { MM_CAMCONVERT_TYPE_INT_ARRAY, NULL, }, + { + CONFIGURE_TYPE_CTRL, + CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH, + MM_CAM_CAMERA_FACE_ZOOM_MODE, + MM_CAMCORDER_ATTR_NONE, + "FaceZoomMode", + MM_CAMCONVERT_TYPE_INT_ARRAY, + NULL, + }, + { + CONFIGURE_TYPE_CTRL, + CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH, + MM_CAM_CAMERA_FACE_ZOOM_LEVEL, + MM_CAMCORDER_ATTR_NONE, + "FaceZoomLevel", + MM_CAMCONVERT_TYPE_INT_RANGE, + NULL, + }, + { /* 40 */ + CONFIGURE_TYPE_CTRL, + CONFIGURE_CATEGORY_CTRL_CAMERA, + MM_CAM_RECOMMEND_CAMERA_WIDTH, + MM_CAM_RECOMMEND_CAMERA_HEIGHT, + "RecommendPreviewResolution", + MM_CAMCONVERT_TYPE_INT_PAIR_ARRAY, + NULL, + }, }; /*--------------------------------------------------------------------------- @@ -558,16 +614,19 @@ static int __mmcamcorder_get_valid_array(int * original_array, int original_cou | GLOBAL FUNCTION DEFINITIONS: | ---------------------------------------------------------------------------*/ //convert MSL value to sensor value -int _mmcamcorder_convert_msl_to_sensor( int attr_idx, int mslval ) +int _mmcamcorder_convert_msl_to_sensor(MMHandleType handle, int attr_idx, int mslval) { + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderInfoConverting *info = NULL; int i =0; int size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting); + mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); + //_mmcam_dbg_log("attr_idx(%d), mslval(%d)", attr_idx, mslval); - info = g_caminfo_convert; - + info = hcamcorder->caminfo_convert; + for (i = 0; i < size; i++) { if (info[i].attr_idx == attr_idx) @@ -601,18 +660,21 @@ int _mmcamcorder_convert_msl_to_sensor( int attr_idx, int mslval ) } _mmcam_dbg_warn("There is no category to match. Just return the original value."); + return mslval; } //convert sensor value to MSL value -int _mmcamcorder_convert_sensor_to_msl(int attr_idx, int sensval) +int _mmcamcorder_convert_sensor_to_msl(MMHandleType handle, int attr_idx, int sensval) { + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + _MMCamcorderInfoConverting *info = NULL; int i = 0, j = 0; int size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting); - - _MMCamcorderInfoConverting *info = NULL; - info = g_caminfo_convert; + mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); + + info = hcamcorder->caminfo_convert; for( i = 0 ; i < size ; i++ ) { @@ -697,15 +759,18 @@ __mmcamcorder_get_valid_array(int * original_array, int original_count, int ** v int _mmcamcorder_init_attr_from_configure(MMHandleType handle) { - _MMCamcorderInfoConverting *info = NULL; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + _MMCamcorderInfoConverting *info = NULL; int table_size = 0; int ret = MM_ERROR_NONE; + mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); + _mmcam_dbg_log(""); /* Initialize attribute related to camera control */ - info = g_caminfo_convert; + info = hcamcorder->caminfo_convert; table_size = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting); ret = __mmcamcorder_set_info_to_attr( handle, info, table_size ); if( ret != MM_ERROR_NONE ) @@ -814,8 +879,8 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting info[i].main_key, info[i].sub_key1, iarray, iarray_size, idefault); */ - mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY); - mmf_attrs_set_valid_array (attrs, info[i].attr_idx, iarray, iarray_size); + mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY); + mmf_attrs_set_valid_array(attrs, info[i].attr_idx, iarray, iarray_size, idefault); } ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, idefault); @@ -841,7 +906,7 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting //_mmcam_dbg_log("INT Range. m:%d, s:%d, min=%d, max=%d", info[i].main_key, info[i].sub_key1, irange->min, irange->max); mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_RANGE); - mmf_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max); + mmf_attrs_set_valid_range(attrs, info[i].attr_idx, irange->min, irange->max, irange->default_value); ret = mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, irange->default_value); } @@ -883,10 +948,16 @@ __mmcamcorder_set_info_to_attr( MMHandleType handle, _MMCamcorderInfoConverting if( pair_array && pair_array->count > 0 ) { - mmf_attrs_set_valid_type (attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY); - mmf_attrs_set_valid_array (attrs, info[i].attr_idx, pair_array->value[0], pair_array->count); - mmf_attrs_set_valid_type (attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY); - mmf_attrs_set_valid_array (attrs, info[i].attr_idx_pair, pair_array->value[1], pair_array->count); + mmf_attrs_set_valid_type(attrs, info[i].attr_idx, MM_ATTRS_VALID_TYPE_INT_ARRAY); + mmf_attrs_set_valid_array(attrs, info[i].attr_idx, + pair_array->value[0], + pair_array->count, + pair_array->default_value[0]); + mmf_attrs_set_valid_type(attrs, info[i].attr_idx_pair, MM_ATTRS_VALID_TYPE_INT_ARRAY); + mmf_attrs_set_valid_array(attrs, info[i].attr_idx_pair, + pair_array->value[1], + pair_array->count, + pair_array->default_value[1]); mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx, pair_array->default_value[0]); mm_attrs_set_int(MMF_CAMCORDER_ATTRS(hcamcorder), info[i].attr_idx_pair, pair_array->default_value[1]); @@ -933,22 +1004,77 @@ int _mmcamcorder_set_converted_value(MMHandleType handle, _MMCamcorderEnumConver int _mmcamcorder_init_convert_table(MMHandleType handle) { - mmf_return_val_if_fail(handle, MM_ERROR_CAMCORDER_NOT_INITIALIZED); - - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_whitebalance); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_colortone); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_iso); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_prgrm); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_focus_mode); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_focus_type); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_ae_type); -// _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_pcolor_mode); -// _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_flip); -// _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_pcolor); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_strobe_mode); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_wdr_ctrl); - _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_ahs); -// _mmcamcorder_set_converted_value(handle, &_mmcamcorder_enum_conv_picture_format); + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); + int enum_conv_size = sizeof(_MMCamcorderEnumConvert); + int caminfo_conv_size = sizeof(g_caminfo_convert); + int caminfo_conv_length = sizeof(g_caminfo_convert) / sizeof(_MMCamcorderInfoConverting); + int i = 0; + + mmf_return_val_if_fail(hcamcorder, MM_ERROR_CAMCORDER_NOT_INITIALIZED); + + /* copy default conv data into memory of handle */ + memcpy(&(hcamcorder->caminfo_convert), &g_caminfo_convert, caminfo_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE]), &_mmcamcorder_enum_conv_whitebalance, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]), &_mmcamcorder_enum_conv_colortone, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ISO]), &_mmcamcorder_enum_conv_iso, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE]), &_mmcamcorder_enum_conv_prgrm, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE]), &_mmcamcorder_enum_conv_focus_mode, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE]), &_mmcamcorder_enum_conv_focus_type, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]), &_mmcamcorder_enum_conv_ae_type, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]), &_mmcamcorder_enum_conv_strobe_mode, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_WDR]), &_mmcamcorder_enum_conv_wdr_ctrl, enum_conv_size); + memcpy(&(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]), &_mmcamcorder_enum_conv_ahs, enum_conv_size); + + /* set ini info to conv data */ + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ISO])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_WDR])); + _mmcamcorder_set_converted_value(handle, &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE])); + + /* set modified conv data to handle */ + for (i = 0 ; i < caminfo_conv_length ; i++) { + if (hcamcorder->caminfo_convert[i].type == CONFIGURE_TYPE_CTRL) { + switch (hcamcorder->caminfo_convert[i].category) { + case CONFIGURE_CATEGORY_CTRL_STROBE: + if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "StrobeMode")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_STROBE_MODE]); + } + break; + case CONFIGURE_CATEGORY_CTRL_EFFECT: + if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WhiteBalance")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WHITE_BALANCE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ColorTone")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_COLOR_TONE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "WDR")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_WDR]); + } + break; + case CONFIGURE_CATEGORY_CTRL_PHOTOGRAPH: + if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "FocusMode")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_FOCUS_MODE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AFType")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_AF_RANGE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AEType")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_EXPOSURE_MODE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ISO")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ISO]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "ProgramMode")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_PROGRAM_MODE]); + } else if (!strcmp(hcamcorder->caminfo_convert[i].keyword, "AntiHandshake")) { + hcamcorder->caminfo_convert[i].enum_convert = &(hcamcorder->enum_conv[ENUM_CONVERT_ANTI_HAND_SHAKE]); + } + break; + default: + break; + } + } + } return MM_ERROR_NONE; } diff --git a/src/mm_camcorder_sound.c b/src/mm_camcorder_sound.c index c582349..3780c35 100644 --- a/src/mm_camcorder_sound.c +++ b/src/mm_camcorder_sound.c @@ -35,87 +35,176 @@ /*--------------------------------------------------------------------------------------- | LOCAL VARIABLE DEFINITIONS for internal | ---------------------------------------------------------------------------------------*/ -#define BLOCK_SIZE 2048 +#define SAMPLE_SOUND_NAME "camera-shutter" +#define SAMPLE_SOUND_VOLUME 65535 +#define SAMPLE_SOUND_RATE 44100 +#define DEFAULT_ACTIVE_DEVICE -1 /*--------------------------------------------------------------------------------------- | LOCAL FUNCTION PROTOTYPES: | ---------------------------------------------------------------------------------------*/ -static gboolean __prepare_buffer(SOUND_INFO *info, char *filename); -static gboolean __cleanup_buffer(SOUND_INFO *info); -static void *__sound_open_thread_func(void *data); -static void *__sound_write_thread_func(void *data); static void __solo_sound_callback(void *data); -static gboolean __prepare_buffer(SOUND_INFO *info, char *filename) + +static void __pulseaudio_context_state_cb(pa_context *pulse_context, void *user_data) { - mmf_return_val_if_fail(info, FALSE); - mmf_return_val_if_fail(filename, FALSE); + int state = 0; + SOUND_INFO *info = NULL; - info->infile = sf_open(filename, SFM_READ, &info->sfinfo); - if (!(info->infile)) { - _mmcam_dbg_err("failed to open file [%s]", filename); - return FALSE; - } + mmf_return_if_fail(user_data); - _mmcam_dbg_log("SOUND: frame = %lld", info->sfinfo.frames); - _mmcam_dbg_log("SOUND: sameplerate = %d", info->sfinfo.samplerate); - _mmcam_dbg_log("SOUND: channel = %d", info->sfinfo.channels); - _mmcam_dbg_log("SOUND: format = 0x%x", info->sfinfo.format); - - info->pcm_size = info->sfinfo.frames * info->sfinfo.channels * 2; - info->pcm_buf = (short *)malloc(info->pcm_size); - if (info->pcm_buf == NULL) { - _mmcam_dbg_err("pcm_buf malloc failed"); - sf_close(info->infile); - info->infile = NULL; - return FALSE; + info = (SOUND_INFO *)user_data; + + state = pa_context_get_state(pulse_context); + switch (state) { + case PA_CONTEXT_READY: + _mmcam_dbg_log("pulseaudio context READY"); + if (info->pulse_context == pulse_context) { + /* Signal */ + _mmcam_dbg_log("pulseaudio send signal"); + pa_threaded_mainloop_signal(info->pulse_mainloop, 0); + } + break; + case PA_CONTEXT_TERMINATED: + if (info->pulse_context == pulse_context) { + /* Signal */ + _mmcam_dbg_log("Context terminated : pulseaudio send signal"); + pa_threaded_mainloop_signal(info->pulse_mainloop, 0); + } + break; + case PA_CONTEXT_UNCONNECTED: + case PA_CONTEXT_CONNECTING: + case PA_CONTEXT_AUTHORIZING: + case PA_CONTEXT_SETTING_NAME: + case PA_CONTEXT_FAILED: + default: + _mmcam_dbg_log("pulseaudio context %p, state %d", + pulse_context, state); + break; } - sf_read_short(info->infile, info->pcm_buf, info->pcm_size); - return TRUE; + return; } - -static gboolean __cleanup_buffer(SOUND_INFO *info) +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE +static void __pulseaudio_stream_write_cb(pa_stream *stream, size_t length, void *user_data) { - mmf_return_val_if_fail(info, FALSE); + sf_count_t read_length; + short *data; + SOUND_INFO *info = NULL; - if (info->infile) { - sf_close(info->infile); - info->infile = NULL; - } + mmf_return_if_fail(user_data); - if (info->pcm_buf) { - free(info->pcm_buf); - info->pcm_buf = NULL; + info = (SOUND_INFO *)user_data; + + _mmcam_dbg_log("START"); + + data = pa_xmalloc(length); + + read_length = (sf_count_t)(length/pa_frame_size(&(info->sample_spec))); + + if ((sf_readf_short(info->infile, data, read_length)) != read_length) { + pa_xfree(data); + return; } - _mmcam_dbg_log("Done"); + pa_stream_write(stream, data, length, pa_xfree, 0, PA_SEEK_RELATIVE); - return TRUE; + info->sample_length -= length; + + if (info->sample_length <= 0) { + pa_stream_set_write_callback(info->sample_stream, NULL, NULL); + pa_stream_finish_upload(info->sample_stream); + + pa_threaded_mainloop_signal(info->pulse_mainloop, 0); + _mmcam_dbg_log("send signal DONE"); + } + + _mmcam_dbg_log("DONE read_length %d", read_length); } -static void *__sound_open_thread_func(void *data) +static void __pulseaudio_remove_sample_finish_cb(pa_context *pulse_context, int success, void *user_data) +{ + SOUND_INFO *info = NULL; + + mmf_return_if_fail(user_data); + + info = (SOUND_INFO *)user_data; + + _mmcam_dbg_log("START"); + + pa_threaded_mainloop_signal(info->pulse_mainloop, 0); + + _mmcam_dbg_log("DONE"); +} +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ + +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE +gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename) +#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ +gboolean _mmcamcorder_sound_init(MMHandleType handle) +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ { int ret = 0; - system_audio_route_t route = SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY; + int sound_enable = TRUE; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); SOUND_INFO *info = NULL; - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data); + mm_sound_device_in device_in; + mm_sound_device_out device_out; + pa_mainloop_api *api = NULL; - mmf_return_val_if_fail(hcamcorder, NULL); + mmf_return_val_if_fail(hcamcorder, FALSE); - MMTA_ACUM_ITEM_BEGIN(" __sound_open_thread_func", FALSE); + /* check sound play enable */ + ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, + "capture-sound-enable", &sound_enable, + NULL); + if (ret == MM_ERROR_NONE) { + _mmcam_dbg_log("Capture sound enable %d", sound_enable); + if (sound_enable == FALSE) { + return TRUE; + } + } else { + _mmcam_dbg_warn("capture-sound-enable get FAILED.[%x]", ret); + } info = &(hcamcorder->snd_info); - __ta__(" __prepare_buffer", - ret = __prepare_buffer(info, info->filename); - ); - if (ret == FALSE) { - goto EXIT_FUNC; + pthread_mutex_lock(&(info->open_mutex)); + + if (info->state > _MMCAMCORDER_SOUND_STATE_NONE) { + _mmcam_dbg_warn("already initialized [%d]", info->state); + pthread_mutex_unlock(&(info->open_mutex)); + return FALSE; + } + +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + if (info->filename) { + free(info->filename); + info->filename = NULL; } + info->filename = strdup(filename); + if (info->filename == NULL) { + _mmcam_dbg_err("strdup failed"); + return FALSE; + } +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ + + pthread_mutex_init(&(info->play_mutex), NULL); + pthread_cond_init(&(info->play_cond), NULL); + +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /* read sample */ + memset (&(info->sfinfo), 0, sizeof(SF_INFO)); + info->infile = sf_open(info->filename, SFM_READ, &(info->sfinfo)); + if (!(info->infile)) { + _mmcam_dbg_err("Failed to open sound file"); + goto SOUND_INIT_ERROR; + } + + /* open PCM handle and set session */ __ta__(" mm_sound_pcm_play_open", ret = mm_sound_pcm_play_open_ex(&(info->handle), info->sfinfo.samplerate, (info->sfinfo.channels == 1) ? MMSOUND_PCM_MONO : MMSOUND_PCM_STEREO, @@ -124,213 +213,213 @@ static void *__sound_open_thread_func(void *data) if (ret < 0) { /* error */ _mmcam_dbg_err("mm_sound_pcm_play_open failed [%x]", ret); - __cleanup_buffer(info); - goto EXIT_FUNC; - } else { - /* success */ - info->state = _MMCAMCORDER_SOUND_STATE_PREPARE; - _mmcam_dbg_log("mm_sound_pcm_play_open succeeded. state [%d]", info->state); + goto SOUND_INIT_ERROR; } - - ret = mm_sound_route_get_system_policy(&route); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_route_get_system_policy failed [%x]", ret); - goto POLICY_ERROR; +#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ + /* open PCM handle and set session */ + __ta__(" mm_sound_pcm_play_open", + ret = mm_sound_pcm_play_open_ex(&(info->handle), SAMPLE_SOUND_RATE, + MMSOUND_PCM_STEREO, MMSOUND_PCM_S16_LE, + VOLUME_TYPE_FIXED, ASM_EVENT_EXCLUSIVE_MMSOUND); + ); + if (ret < 0) { + /* error */ + _mmcam_dbg_err("mm_sound_pcm_play_open failed [%x]", ret); + goto SOUND_INIT_ERROR; } - - _mmcam_dbg_log("current policy [%d]", route); - - if (route != SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY) { - ret = mm_sound_route_set_system_policy(SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("mm_sound_route_set_system_policy failed [%x]", ret); - goto POLICY_ERROR; - } - - info->route_policy_backup = route; +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ + + _mmcam_dbg_log("mm_sound_pcm_play_open done"); + + /** + * Init Pulseaudio thread + */ + /* create pulseaudio mainloop */ + info->pulse_mainloop = pa_threaded_mainloop_new(); + ret = pa_threaded_mainloop_start(info->pulse_mainloop); + + /* lock pulseaudio thread */ + pa_threaded_mainloop_lock(info->pulse_mainloop); + /* get pulseaudio api */ + api = pa_threaded_mainloop_get_api(info->pulse_mainloop); + /* create pulseaudio context */ + info->pulse_context = pa_context_new(api, NULL); + /* set pulseaudio context callback */ + pa_context_set_state_callback(info->pulse_context, __pulseaudio_context_state_cb, info); + + if (pa_context_connect(info->pulse_context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) { + _mmcam_dbg_err("pa_context_connect error"); } -EXIT_FUNC: - pthread_cond_signal(&(info->open_cond)); - pthread_mutex_unlock(&(info->open_mutex)); - - _mmcam_dbg_log("Done"); - - MMTA_ACUM_ITEM_END(" __sound_open_thread_func", FALSE); - - return NULL; - -POLICY_ERROR: - pthread_mutex_unlock(&(info->open_mutex)); - _mmcamcorder_sound_finalize((MMHandleType)hcamcorder); - - return NULL; -} + /* wait READY state of pulse context */ + while (TRUE) { + pa_context_state_t state = pa_context_get_state(info->pulse_context); + _mmcam_dbg_log("pa context state is now %d", state); -static void *__sound_write_thread_func(void *data) -{ - int ret = 0; - int bytes_to_write = 0; - int remain_bytes = 0; - system_audio_route_t route = SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY; - char *buffer_to_write = NULL; - SOUND_INFO *info = NULL; - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data); + if (!PA_CONTEXT_IS_GOOD (state)) { + _mmcam_dbg_log("connection failed"); + break; + } - mmf_return_val_if_fail(hcamcorder, NULL); + if (state == PA_CONTEXT_READY) { + _mmcam_dbg_log("pa context READY"); + break; + } - info = &(hcamcorder->snd_info); + /* Wait until the context is ready */ + _mmcam_dbg_log("waiting.................."); + pa_threaded_mainloop_wait(info->pulse_mainloop); + _mmcam_dbg_log("waiting DONE. check again..."); + } - _mmcam_dbg_log("RUN sound write thread"); + /* unlock pulseaudio thread */ + pa_threaded_mainloop_unlock(info->pulse_mainloop); - pthread_mutex_lock(&(info->play_mutex)); +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /** + * Upload sample + */ + if (pa_sndfile_read_sample_spec(info->infile, &(info->sample_spec)) < 0) { + _mmcam_dbg_err("Failed to determine sample specification from file"); + goto SOUND_INIT_ERROR; + } - do { - pthread_cond_wait(&(info->play_cond), &(info->play_mutex)); + info->sample_spec.format = PA_SAMPLE_S16LE; - _mmcam_dbg_log("Signal received. Play sound."); + if (pa_sndfile_read_channel_map(info->infile, &(info->channel_map)) < 0) { + pa_channel_map_init_extend(&(info->channel_map), info->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT); - if (info->thread_run == FALSE) { - _mmcam_dbg_log("Exit thread command is detected"); - break; + if (info->sample_spec.channels > 2) { + _mmcam_dbg_warn("Failed to determine sample specification from file"); } + } - ret = mm_sound_route_get_system_policy(&route); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("get_system_policy failed [%x]. skip sound play.", ret); - break; - } - - _mmcam_dbg_log("current policy [%d]", route); - - if (route != SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY) { - ret = mm_sound_route_set_system_policy(SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("set_system_policy failed. skip sound play."); - break; - } + info->sample_length = (size_t)info->sfinfo.frames * pa_frame_size(&(info->sample_spec)); - info->route_policy_backup = route; - } + pa_threaded_mainloop_lock(info->pulse_mainloop); - buffer_to_write = (char *)info->pcm_buf; - remain_bytes = info->pcm_size; - bytes_to_write = 0; + /* prepare uploading */ + info->sample_stream = pa_stream_new(info->pulse_context, SAMPLE_SOUND_NAME, &(info->sample_spec), NULL); + /* set stream write callback */ + pa_stream_set_write_callback(info->sample_stream, __pulseaudio_stream_write_cb, info); + /* upload sample (ASYNC) */ + pa_stream_connect_upload(info->sample_stream, info->sample_length); + /* wait for upload completion */ + pa_threaded_mainloop_wait(info->pulse_mainloop); - while (remain_bytes) { - bytes_to_write = (remain_bytes >= BLOCK_SIZE) ? BLOCK_SIZE : remain_bytes; - ret = mm_sound_pcm_play_write(info->handle, buffer_to_write, bytes_to_write); - if (ret != bytes_to_write) { - _mmcam_dbg_err("pcm write error [%x]", ret); - } - remain_bytes -= bytes_to_write; - buffer_to_write += bytes_to_write; - } - } while (TRUE); + pa_threaded_mainloop_unlock (info->pulse_mainloop); +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - pthread_mutex_unlock(&(info->play_mutex)); + /* backup current route */ + info->active_out_backup = DEFAULT_ACTIVE_DEVICE; - _mmcam_dbg_log("END sound write thread"); + ret = mm_sound_get_active_device(&device_in, &device_out); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret); + goto SOUND_INIT_ERROR; + } - return NULL; -} + _mmcam_dbg_log("current out [%x]", device_out); + if (device_out != MM_SOUND_DEVICE_OUT_SPEAKER) { + ret = mm_sound_set_active_route (MM_SOUND_ROUTE_OUT_SPEAKER); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret); + goto SOUND_INIT_ERROR; + } + info->active_out_backup = device_out; + } -gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename) -{ - int ret = 0; - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - SOUND_INFO *info = NULL; + info->state = _MMCAMCORDER_SOUND_STATE_INIT; - mmf_return_val_if_fail(hcamcorder, FALSE); + _mmcam_dbg_log("init DONE"); - info = &(hcamcorder->snd_info); + pthread_mutex_unlock(&(info->open_mutex)); - pthread_mutex_lock(&(info->open_mutex)); + return TRUE; - if (info->state > _MMCAMCORDER_SOUND_STATE_NONE) { - _mmcam_dbg_warn("already initialized [%d]", info->state); - pthread_mutex_unlock(&(info->open_mutex)); - return FALSE; - } +SOUND_INIT_ERROR: +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /** + * Release allocated resources + */ if (info->filename) { free(info->filename); info->filename = NULL; } +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ + + /* remove pulse mainloop */ + if (info->pulse_mainloop) { + /* remove pulse context */ + if (info->pulse_context) { +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /* remove uploaded sample */ + if (info->sample_stream) { + pa_threaded_mainloop_lock(info->pulse_mainloop); + + /* Remove sample (ASYNC) */ + pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info)); + + /* Wait for async operation */ + pa_threaded_mainloop_wait(info->pulse_mainloop); + } +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - info->filename = strdup(filename); - if (info->filename == NULL) { - _mmcam_dbg_err("strdup failed"); - ret = FALSE; - } else { - pthread_mutex_init(&(info->play_mutex), NULL); - pthread_cond_init(&(info->play_cond), NULL); - if (pthread_create(&(info->thread), NULL, __sound_write_thread_func, (void *)handle) == 0) { - info->thread_run = TRUE; - info->state = _MMCAMCORDER_SOUND_STATE_INIT; - info->route_policy_backup = -1; - _mmcam_dbg_log("write thread created"); - ret = TRUE; - } else { - _mmcam_dbg_err("failed to create write thread"); - free(info->filename); - info->filename = NULL; - ret = FALSE; + /* Make sure we don't get any further callbacks */ + pa_context_set_state_callback(info->pulse_context, NULL, NULL); + + pa_context_disconnect(info->pulse_context); + pa_context_unref(info->pulse_context); + info->pulse_context = NULL; } + + pa_threaded_mainloop_stop(info->pulse_mainloop); + pa_threaded_mainloop_free(info->pulse_mainloop); + info->pulse_mainloop = NULL; } + /* remove mutex and cond */ + pthread_mutex_destroy(&(info->play_mutex)); + pthread_cond_destroy(&(info->play_cond)); + pthread_mutex_unlock(&(info->open_mutex)); - return ret; + return FALSE; } -gboolean _mmcamcorder_sound_prepare(MMHandleType handle) +gboolean _mmcamcorder_sound_play(MMHandleType handle) { - int ret = FALSE; - pthread_t open_thread; + int ret = 0; + int sound_enable = TRUE; + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); SOUND_INFO *info = NULL; + pa_operation *pulse_op = NULL; mmf_return_val_if_fail(hcamcorder, FALSE); - info = &(hcamcorder->snd_info); - - pthread_mutex_lock(&(info->open_mutex)); - - if (info->state == _MMCAMCORDER_SOUND_STATE_INIT) { - if (pthread_create(&open_thread, NULL, __sound_open_thread_func, (void *)handle) == 0) { - _mmcam_dbg_log("open thread created"); - ret = TRUE; - } else { - _mmcam_dbg_err("failed to create open thread"); - ret = FALSE; - pthread_mutex_unlock(&(info->open_mutex)); + /* check sound play enable */ + ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, + "capture-sound-enable", &sound_enable, + NULL); + if (ret == MM_ERROR_NONE) { + _mmcam_dbg_log("Capture sound enable %d", sound_enable); + if (sound_enable == FALSE) { + return TRUE; } } else { - _mmcam_dbg_warn("Wrong state [%d]", info->state); - ret = FALSE; - pthread_mutex_unlock(&(info->open_mutex)); + _mmcam_dbg_warn("capture-sound-enable get FAILED.[%x]", ret); } - return ret; -} - - -gboolean _mmcamcorder_sound_play(MMHandleType handle) -{ - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - SOUND_INFO *info = NULL; - - mmf_return_val_if_fail(hcamcorder, FALSE); - info = &(hcamcorder->snd_info); pthread_mutex_lock(&(info->open_mutex)); - if (info->state < _MMCAMCORDER_SOUND_STATE_PREPARE) { + if (info->state < _MMCAMCORDER_SOUND_STATE_INIT) { _mmcam_dbg_log("not initialized state:[%d]", info->state); pthread_mutex_unlock(&(info->open_mutex)); return FALSE; @@ -338,9 +427,18 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle) _mmcam_dbg_log("Play start"); - pthread_mutex_lock(&(info->play_mutex)); - pthread_cond_signal(&(info->play_cond)); - pthread_mutex_unlock(&(info->play_mutex)); + __ta__(" pa_context_play_sample", + pulse_op = pa_context_play_sample(info->pulse_context, + SAMPLE_SOUND_NAME, + NULL, + SAMPLE_SOUND_VOLUME, + NULL, + NULL); + ); + if (pulse_op) { + pa_operation_unref(pulse_op); + pulse_op = NULL; + } pthread_mutex_unlock(&(info->open_mutex)); @@ -354,58 +452,123 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); SOUND_INFO *info = NULL; + mm_sound_device_in device_in; + mm_sound_device_out device_out; + int ret = 0; mmf_return_val_if_fail(hcamcorder, FALSE); info = &(hcamcorder->snd_info); + _mmcam_dbg_err("START"); + pthread_mutex_lock(&(info->open_mutex)); if (info->state < _MMCAMCORDER_SOUND_STATE_INIT) { _mmcam_dbg_warn("not initialized"); pthread_mutex_unlock(&(info->open_mutex)); - return FALSE; + return TRUE; } - info->thread_run = 0; - pthread_cond_signal(&(info->play_cond)); + /** + * Restore route + */ + _mmcam_dbg_log("restore route"); + if (info->active_out_backup != DEFAULT_ACTIVE_DEVICE) { + ret = mm_sound_get_active_device(&device_in, &device_out); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_get_active_device failed [%x]. skip sound play.", ret); + } - if (info->thread) { - _mmcam_dbg_log("wait for sound write thread join"); - pthread_join(info->thread, NULL); - _mmcam_dbg_log("join done"); + _mmcam_dbg_log("current out [%x]", device_out); + + if (device_out != info->active_out_backup) { + ret = mm_sound_set_active_route (info->active_out_backup); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_err("mm_sound_set_active_route failed [%x]. skip sound play.", ret); + } + } } - if (info->state == _MMCAMCORDER_SOUND_STATE_PREPARE) { - _mmcam_dbg_log("restore route policy [%d]", info->route_policy_backup); +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE + /** + * Remove sample + */ + _mmcam_dbg_log("remove sample"); - if (info->route_policy_backup != -1) { - mm_sound_route_set_system_policy(info->route_policy_backup); - } + pa_threaded_mainloop_lock(info->pulse_mainloop); - mm_sound_pcm_play_close(info->handle); - __cleanup_buffer(info); - } + /* Remove sample (ASYNC) */ + pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info)); + /* Wait for async operation */ + pa_threaded_mainloop_wait(info->pulse_mainloop); + + pa_threaded_mainloop_unlock(info->pulse_mainloop); +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ + + /** + * Release pulseaudio thread + */ + _mmcam_dbg_log("release pulseaudio thread"); + + pa_threaded_mainloop_lock(info->pulse_mainloop); + + pa_context_disconnect(info->pulse_context); + + /* Make sure we don't get any further callbacks */ + pa_context_set_state_callback(info->pulse_context, NULL, NULL); + + pa_context_unref(info->pulse_context); + info->pulse_context = NULL; + + pa_threaded_mainloop_unlock(info->pulse_mainloop); + + pa_threaded_mainloop_stop(info->pulse_mainloop); + pa_threaded_mainloop_free(info->pulse_mainloop); + info->pulse_mainloop = NULL; + +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE if (info->filename) { free(info->filename); info->filename = NULL; } +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ info->state = _MMCAMCORDER_SOUND_STATE_NONE; - info->route_policy_backup = -1; + info->active_out_backup = DEFAULT_ACTIVE_DEVICE; + /* release mutex and cond */ + _mmcam_dbg_log("release play_mutex/cond"); pthread_mutex_destroy(&(info->play_mutex)); pthread_cond_destroy(&(info->play_cond)); + /* close PCM */ + mm_sound_pcm_play_close(info->handle); + info->handle = 0; + pthread_mutex_unlock(&(info->open_mutex)); - _mmcam_dbg_log("Done"); + _mmcam_dbg_err("DONE"); return TRUE; } +gboolean _mmcamcorder_sound_capture_play_cb(gpointer data) +{ + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(data); + + mmf_return_val_if_fail(hcamcorder, FALSE); + + _mmcam_dbg_log("Capture sound PLAY in idle callback"); + + _mmcamcorder_sound_solo_play((MMHandleType)hcamcorder, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE); + + return FALSE; +} + + void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gboolean sync) { mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); @@ -414,7 +577,7 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo int ret = 0; int sound_enable = TRUE; - mmf_return_if_fail( filepath ); + mmf_return_if_fail(filepath && hcamcorder); _mmcam_dbg_log( "START" ); @@ -422,8 +585,8 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo "capture-sound-enable", &sound_enable, NULL); if (ret == MM_ERROR_NONE) { + _mmcam_dbg_log("Capture sound enable %d", sound_enable); if (sound_enable == FALSE) { - _mmcam_dbg_log("Capture sound DISABLED."); return; } } else { @@ -436,10 +599,10 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo return; } - MMTA_ACUM_ITEM_BEGIN("CAPTURE SOUND:mm_sound_play_loud_solo_sound", FALSE); - + __ta__("CAPTURE SOUND:mm_sound_play_loud_solo_sound", ret = mm_sound_play_loud_solo_sound(filepath, VOLUME_TYPE_FIXED, __solo_sound_callback, (void*)hcamcorder, &sound_handle); + ); if (ret != MM_ERROR_NONE) { _mmcam_dbg_err( "Capture sound play FAILED.[%x]", ret ); } else { @@ -453,6 +616,8 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo _mmcam_dbg_log("Wait for signal"); + MMTA_ACUM_ITEM_BEGIN("CAPTURE SOUND:wait sound play finish", FALSE); + if (!pthread_cond_timedwait(&(hcamcorder->sound_cond), &(hcamcorder->sound_lock), &timeout)) { _mmcam_dbg_log("signal received."); } else { @@ -461,11 +626,11 @@ void _mmcamcorder_sound_solo_play(MMHandleType handle, const char* filepath, gbo mm_sound_stop_sound(sound_handle); } } + + MMTA_ACUM_ITEM_END("CAPTURE SOUND:wait sound play finish", FALSE); } } - MMTA_ACUM_ITEM_END("CAPTURE SOUND:mm_sound_play_loud_solo_sound", FALSE); - pthread_mutex_unlock(&(hcamcorder->sound_lock)); _mmcam_dbg_log("DONE"); diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index f6ef4fe..e75a400 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -101,7 +101,6 @@ int _mmcamcorder_add_stillshot_pipeline(MMHandleType handle) CONFIGURE_CATEGORY_MAIN_CAPTURE, "UseEncodebin", &sc->bencbin_capture); - if (sc->bencbin_capture) { _mmcam_dbg_log("Using Encodebin for capturing"); __ta__(" _mmcamcorder_create_encodesink_bin", @@ -225,7 +224,7 @@ void _mmcamcorder_destroy_image_pipeline(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_if_fail(sc && sc->element); - + _mmcam_dbg_log(""); if (sc->element[_MMCAMCORDER_MAIN_PIPE].gst) { @@ -267,6 +266,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) int cap_format = MM_PIXEL_FORMAT_NV12; int cap_jpeg_quality = 0; int image_encoder = MM_IMAGE_CODEC_JPEG; + int strobe_mode = MM_CAMCORDER_STROBE_MODE_OFF; unsigned int cap_fourcc = 0; char *err_name = NULL; @@ -314,24 +314,28 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* set capture flag */ info->capturing = TRUE; - ret = mm_camcorder_get_attributes(handle, &err_name, - MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality, - MMCAM_IMAGE_ENCODER, &image_encoder, - MMCAM_CAMERA_WIDTH, &width, - MMCAM_CAMERA_HEIGHT, &height, - MMCAM_CAMERA_FPS, &fps, - MMCAM_CAPTURE_FORMAT, &cap_format, - MMCAM_CAPTURE_WIDTH, &info->width, - MMCAM_CAPTURE_HEIGHT, &info->height, - MMCAM_CAPTURE_COUNT, &info->count, - MMCAM_CAPTURE_INTERVAL, &info->interval, - NULL); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret); - SAFE_FREE (err_name); - goto cmd_error; - } - + mm_camcorder_get_attributes(handle, &err_name, + MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality, + MMCAM_IMAGE_ENCODER, &image_encoder, + MMCAM_CAMERA_WIDTH, &width, + MMCAM_CAMERA_HEIGHT, &height, + MMCAM_CAMERA_FORMAT, &info->preview_format, + MMCAM_CAMERA_FPS, &fps, + MMCAM_CAMERA_HDR_CAPTURE, &info->hdr_capture_mode, + MMCAM_CAPTURE_FORMAT, &cap_format, + MMCAM_CAPTURE_WIDTH, &info->width, + MMCAM_CAPTURE_HEIGHT, &info->height, + MMCAM_CAPTURE_COUNT, &info->count, + MMCAM_CAPTURE_INTERVAL, &info->interval, + MMCAM_STROBE_MODE, &strobe_mode, + NULL); + if (err_name) { + _mmcam_dbg_warn("get_attributes err %s", err_name); + free(err_name); + err_name = NULL; + } + + /* check capture count */ if (info->count < 1) { _mmcam_dbg_err("capture count[%d] is invalid", info->count); ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; @@ -347,8 +351,8 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) info->capture_cur_count = 0; info->capture_send_count = 0; - _mmcam_dbg_log("videosource(%dx%d), capture(%dx%d), count(%d)", - width, height, info->width, info->height, info->count); + _mmcam_dbg_log("videosource(%dx%d), capture(%dx%d), count(%d), hdr_capture_mode(%d)", + width, height, info->width, info->height, info->count, info->hdr_capture_mode); sc->internal_encode = FALSE; @@ -371,7 +375,11 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) } cap_fourcc = _mmcamcorder_get_fourcc(raw_capture_format, image_encoder, hcamcorder->use_zero_copy_format); - sc->internal_encode = TRUE; + + /* no need to encode internally if ITLV format */ + if (raw_capture_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { + sc->internal_encode = TRUE; + } _mmcam_dbg_log("MSL JPEG Capture"); } @@ -390,6 +398,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-interval", info->interval); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", info->count); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", cap_jpeg_quality); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hdr-capture", info->hdr_capture_mode); if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_err("Can't cast Video source into camera control."); @@ -457,8 +466,18 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) } /* Play capture sound here if single capture */ - if (info->type == _MMCamcorder_SINGLE_SHOT) { - _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE); + if ((info->type == _MMCamcorder_SINGLE_SHOT && + (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY || strobe_mode == MM_CAMCORDER_STROBE_MODE_OFF)) || + info->hdr_capture_mode) { + __ta__(" g_idle_add:_mmcamcorder_sound_capture_play_cb", + g_idle_add(_mmcamcorder_sound_capture_play_cb, (gpointer)hcamcorder); + ); + + /* set flag */ + info->played_capture_sound = TRUE; + } else { + /* set flag */ + info->played_capture_sound = FALSE; } cmd_error: @@ -528,17 +547,7 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) if (!strcmp(videosrc_name, "avsysvideosrc") || !strcmp(videosrc_name, "camerasrc")) { _mmcam_dbg_log("Capture Preview start : avsysvideosrc - No need to set new caps."); - ret = mm_camcorder_get_attributes(handle, &err_name, - MMCAM_CAMERA_FPS_AUTO, &fps_auto, - NULL); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret); - SAFE_FREE (err_name); - goto cmd_error; - } - - MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto); - + /* just set capture stop command if current state is CAPTURING */ if (_mmcamcorder_get_state(handle) == MM_CAMCORDER_STATE_CAPTURING) { if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { _mmcam_dbg_err("Can't cast Video source into camera control."); @@ -553,6 +562,25 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) if (info->type == _MMCamcorder_SINGLE_SHOT) { MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); } + } else { + int focus_mode = 0; + + /* This case is starting of preview */ + ret = mm_camcorder_get_attributes(handle, &err_name, + MMCAM_CAMERA_FPS_AUTO, &fps_auto, + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + NULL); + if (ret != MM_ERROR_NONE) { + _mmcam_dbg_warn("Get attrs fail. (%s:%x)", err_name, ret); + SAFE_FREE (err_name); + } + + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto); + + /* set focus mode */ + mm_camcorder_set_attributes(handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, focus_mode, + NULL); } } else { /* check if resolution need to rollback */ @@ -622,12 +650,26 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) if (!strcmp(videosrc_name, "avsysvideosrc") || !strcmp(videosrc_name, "camerasrc")) { int try_count = 0; - __ta__( " Wait preview frame after capture", - while (current_framecount >= sc->kpi.video_framecount && - try_count++ < _MMCAMCORDER_CAPTURE_STOP_CHECK_COUNT) { - usleep(_MMCAMCORDER_CAPTURE_STOP_CHECK_INTERVAL); + if (info->preview_format != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { + mmf_attrs_t *attr = (mmf_attrs_t *)MMF_CAMCORDER_ATTRS(handle); + + /* Set strobe mode - strobe mode can not be set to driver while captuing */ + if (attr) { + __ta__(" Set strobe mode after capture", + mmf_attribute_set_modified(&(attr->items[MM_CAM_STROBE_MODE])); + if (mmf_attrs_commit((MMHandleType) attr) == -1) { + _mmcam_dbg_warn("Failed to set strobe mode"); + } + ); + } + + __ta__(" Wait preview frame after capture", + while (current_framecount >= sc->kpi.video_framecount && + try_count++ < _MMCAMCORDER_CAPTURE_STOP_CHECK_COUNT) { + usleep(_MMCAMCORDER_CAPTURE_STOP_CHECK_INTERVAL); + } + ); } - ); if (info->type == _MMCamcorder_MULTI_SHOT) { MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); @@ -664,14 +706,12 @@ int _mmcamcorder_image_cmd_preview_start(MMHandleType handle) mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_COUNT, &cap_count, NULL); if (cap_count > 1) { __ta__("_mmcamcorder_sound_init", +#ifdef _MMCAMCORDER_UPLOAD_SAMPLE sound_ret = _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND); +#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ + sound_ret = _mmcamcorder_sound_init(handle); +#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ ); - if (sound_ret) { - __ta__("_mmcamcorder_sound_prepare", - sound_ret = _mmcamcorder_sound_prepare(handle); - ); - _mmcam_dbg_log("sound prepare [%d]", sound_ret); - } } } @@ -828,6 +868,9 @@ int _mmcamcorder_image_cmd_capture_with_encbin(MMHandleType handle) } } + /* set jpeg quality */ + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_IENC].gst, "quality", cap_jpeg_quality); + if (need_change) { _mmcam_dbg_log("Need to change resolution"); @@ -875,6 +918,12 @@ int _mmcamcorder_image_cmd_capture_with_encbin(MMHandleType handle) /* Play capture sound here if single capture */ if (info->type == _MMCamcorder_SINGLE_SHOT) { _mmcamcorder_sound_solo_play(handle, _MMCAMCORDER_FILEPATH_CAPTURE_SND, FALSE); + + /* set flag */ + info->played_capture_sound = TRUE; + } else { + /* set flag */ + info->played_capture_sound = FALSE; } cmd_error: @@ -1173,8 +1222,6 @@ int _mmcamcorder_image_command(MMHandleType handle, int command) void __mmcamcorder_init_stillshot_info (MMHandleType handle) { - int type = _MMCamcorder_SINGLE_SHOT; - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; _MMCamcorderImageInfo *info = NULL; @@ -1185,20 +1232,17 @@ void __mmcamcorder_init_stillshot_info (MMHandleType handle) mmf_return_if_fail(sc && sc->info); info = sc->info; - type = info->type; - _mmcam_dbg_log("capture type[%d], capture send count[%d]", type, info->capture_send_count); + _mmcam_dbg_log("capture type[%d], capture send count[%d]", info->type, info->capture_send_count); - if (type ==_MMCamcorder_SINGLE_SHOT || info->capture_send_count == info->count) { + if (info->type ==_MMCamcorder_SINGLE_SHOT || info->capture_send_count == info->count) { info->capture_cur_count = 0; info->capture_send_count = 0; info->multi_shot_stop = TRUE; info->next_shot_time = 0; - info->type = _MMCamcorder_SINGLE_SHOT; /* capturing flag set to FALSE here */ info->capturing = FALSE; - MMTA_ACUM_ITEM_END("Real First Capture Start", FALSE); } return; @@ -1227,7 +1271,9 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap } /* exif 090227 */ + __ta__(" mm_exif_create_exif_info", ret = mm_exif_create_exif_info(&(hcamcorder->exif_info)); + ); if (hcamcorder->exif_info == NULL || ret != MM_ERROR_NONE) { _MMCamcorderMsgItem msg; @@ -1241,8 +1287,8 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap /* add basic exif info */ _mmcam_dbg_log("add basic exif info"); - __ta__(" __mmcamcorder_set_exif_basic_info", - ret = __mmcamcorder_set_exif_basic_info(handle); + __ta__(" __mmcamcorder_set_exif_basic_info", + ret = __mmcamcorder_set_exif_basic_info(handle, original); ); if (ret != MM_ERROR_NONE) { _MMCamcorderMsgItem msg; @@ -1265,7 +1311,7 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap thumbnail->data, thumbnail->width, thumbnail->height); /* add thumbnail exif info */ - __ta__(" mm_exif_add_thumbnail_info", + __ta__(" mm_exif_add_thumbnail_info", ret = mm_exif_add_thumbnail_info(hcamcorder->exif_info, thumbnail->data,thumbnail->width, thumbnail->height, thumbnail->length); ); if (ret != MM_ERROR_NONE) { @@ -1284,8 +1330,9 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap } /* write jpeg with exif */ + __ta__(" mm_exif_write_exif_jpeg_to_memory", ret = mm_exif_write_exif_jpeg_to_memory(&original->data, &original->length ,hcamcorder->exif_info, data, datalen); - + ); if (ret != MM_ERROR_NONE) { _MMCamcorderMsgItem msg; @@ -1297,7 +1344,9 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap } /* destroy exif info */ + __ta__(" mm_exif_destory_exif_info", mm_exif_destory_exif_info(hcamcorder->exif_info); + ); hcamcorder->exif_info = NULL; _mmcam_dbg_log("END"); @@ -1310,32 +1359,6 @@ gboolean __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCap } -gboolean __mmcamcorder_capture_send_msg(MMHandleType handle, int type, int count) -{ - mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); - _MMCamcorderImageInfo *info = NULL; - _MMCamcorderSubContext *sc = NULL; - _MMCamcorderMsgItem msg; - - mmf_return_val_if_fail(hcamcorder, FALSE); - - sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); - mmf_return_val_if_fail(sc && sc->info, FALSE); - - info = sc->info; - - _mmcam_dbg_log("type [%d], capture count [%d]", type, count); - - msg.id = MM_MESSAGE_CAMCORDER_CAPTURED; - msg.param.code = count; - - _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); - - _mmcam_dbg_log("END"); - return TRUE; -} - - void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstBuffer *buffer) { GstCaps *caps = NULL; @@ -1361,9 +1384,9 @@ void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capt gst_structure_get_int(structure, "height", &capture_data->height); capture_data->length = GST_BUFFER_SIZE(buffer); - _mmcam_dbg_err("buffer data[%p],size[%dx%d],length[%d],format[%d]", - capture_data->data, capture_data->width, capture_data->height, - capture_data->length, capture_data->format); + _mmcam_dbg_warn("buffer data[%p],size[%dx%d],length[%d],format[%d]", + capture_data->data, capture_data->width, capture_data->height, + capture_data->length, capture_data->format); gst_caps_unref(caps); caps = NULL; @@ -1433,13 +1456,19 @@ void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureData _mmcam_dbg_log(""); + __ta__( " GetAttr:MMCAM_TAG_ENABLE", mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_ENABLE, &tag_enable, NULL); - MMCAMCORDER_G_OBJECT_GET (sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif); + ); + __ta__( " GetProp:\"provide-exif\"", + MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "provide-exif", &provide_exif); + ); /* if dest->data is allocated in MSL, release it */ if (tag_enable && !provide_exif) { if (dest->data) { + __ta__( " Free data", free(dest->data); + ); dest->length = 0; dest->data = NULL; _mmcam_dbg_log("Jpeg is released!"); @@ -1458,11 +1487,9 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe int pixtype = MM_PIXEL_FORMAT_INVALID; int pixtype_sub = MM_PIXEL_FORMAT_INVALID; int codectype = MM_IMAGE_CODEC_JPEG; - int type = _MMCamcorder_SINGLE_SHOT; int attr_index = 0; int count = 0; int stop_cont_shot = 0; - gboolean send_msg = FALSE; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data); _MMCamcorderImageInfo *info = NULL; @@ -1475,7 +1502,6 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe mmf_attribute_t *item = NULL; void *encoded_data = NULL; - char *err_attr_name = NULL; mmf_return_if_fail(hcamcorder); @@ -1488,30 +1514,69 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe MMTA_ACUM_ITEM_BEGIN(" MSL capture callback", FALSE); + /* check command lock to block capture callback if capture start API is not returned */ + _MMCAMCORDER_LOCK_CMD(hcamcorder); + _MMCAMCORDER_UNLOCK_CMD(hcamcorder); + _mmcam_dbg_log("command LOCK OK"); + /* check capture state */ if (info->type == _MMCamcorder_MULTI_SHOT && info->capture_send_count > 0) { mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, "capture-break-cont-shot", &stop_cont_shot, NULL); if (stop_cont_shot == TRUE) { _mmcam_dbg_warn("capture stop command already come. skip this..."); MMTA_ACUM_ITEM_END( " MSL capture callback", FALSE ); - goto error; + + /*free GstBuffer*/ + if (buffer1) { + gst_buffer_unref(buffer1); + } + if (buffer2) { + gst_buffer_unref(buffer2); + } + if (buffer3) { + gst_buffer_unref(buffer3); + } + + return; } } if (!info->capturing) { _mmcam_dbg_err("It's Not capturing now."); - goto error; + + /*free GstBuffer*/ + if (buffer1) { + gst_buffer_unref(buffer1); + } + if (buffer2) { + gst_buffer_unref(buffer2); + } + if (buffer3) { + gst_buffer_unref(buffer3); + } + + return; } - /* play capture sound here if multi capture */ + /* play capture sound here if multi capture + or preview format is ITLV(because of AF and flash control in plugin) */ if (info->type == _MMCamcorder_MULTI_SHOT) { + __ta__(" _mmcamcorder_sound_play", _mmcamcorder_sound_play((MMHandleType)hcamcorder); + ); + } else if (!info->played_capture_sound) { + __ta__(" g_idle_add:_mmcamcorder_sound_capture_play_cb", + g_idle_add(_mmcamcorder_sound_capture_play_cb, (gpointer)hcamcorder); + ); } /* Prepare main, thumbnail buffer */ pixtype = _mmcamcorder_get_pixel_format(buffer1); if (pixtype == MM_PIXEL_FORMAT_INVALID) { _mmcam_dbg_err("Unsupported pixel type"); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); + goto error; } @@ -1520,26 +1585,29 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype, buffer1); } else { _mmcam_dbg_err("buffer1 has wrong pointer. (buffer1=%p)",buffer1); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); + goto error; } /* Encode JPEG */ if (sc->internal_encode) { int capture_quality = 0; - ret = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_attr_name, - MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality, - NULL); - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_err("Get attribute failed[%s][%x]", err_attr_name, ret); - SAFE_FREE(err_attr_name); - goto error; - } + mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, + MMCAM_IMAGE_ENCODER_QUALITY, &capture_quality, + NULL); + _mmcam_dbg_log("capture_quality %d", capture_quality); __ta__(" _mmcamcorder_encode_jpeg", ret = _mmcamcorder_encode_jpeg(GST_BUFFER_DATA(buffer1), dest.width, dest.height, pixtype, dest.length, capture_quality, &(dest.data), &(dest.length)); ); - if (ret == FALSE) { + if (!ret) { + _mmcam_dbg_err("_mmcamcorder_encode_jpeg failed"); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); + goto error; } @@ -1549,9 +1617,9 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe /* Thumbnail image buffer */ if (buffer2 && GST_BUFFER_DATA(buffer2) && (GST_BUFFER_SIZE(buffer2) !=0)) { - pixtype_sub = _mmcamcorder_get_pixel_format(buffer2); _mmcam_dbg_log("Thumnail (buffer2=%p)",buffer2); + pixtype_sub = _mmcamcorder_get_pixel_format(buffer2); __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_sub, buffer2); } else { _mmcam_dbg_log("buffer2 has wrong pointer. Not Error. (buffer2=%p)",buffer2); @@ -1576,21 +1644,15 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe _mmcam_dbg_log("buffer3 has wrong pointer. Not Error. (buffer3=%p)",buffer3); } - mmf_attrs_commit_err((MMHandleType)attrs, &err_attr_name); + /* commit screennail data */ + mmf_attrs_commit_err((MMHandleType)attrs, NULL); /* Set extra data for jpeg */ if (dest.format == MM_PIXEL_FORMAT_ENCODED) { - int err = 0; - char *err_attr_name = NULL; - - err = mm_camcorder_get_attributes((MMHandleType)hcamcorder, &err_attr_name, - MMCAM_IMAGE_ENCODER, &codectype, - NULL); - if (err != MM_ERROR_NONE) { - _mmcam_dbg_warn("Getting codectype failed. (%s:%x)", err_attr_name, err); - SAFE_FREE (err_attr_name); - goto error; - } + mm_camcorder_get_attributes((MMHandleType)hcamcorder, NULL, + MMCAM_IMAGE_ENCODER, &codectype, + NULL); + _mmcam_dbg_log("codectype %d", codectype); switch (codectype) { case MM_IMAGE_CODEC_JPEG: @@ -1601,11 +1663,17 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe ); if (!ret) { _mmcam_dbg_err("Error on setting extra data to jpeg"); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); + goto error; } break; default: _mmcam_dbg_err("The codectype is not supported. (%d)", codectype); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INTERNAL); + goto error; } } @@ -1625,14 +1693,27 @@ static void __mmcamcorder_image_capture_cb(GstElement *element, GstBuffer *buffe _mmcam_dbg_log("APPLICATION CALLBACK END"); } else { _mmcam_dbg_err("Capture callback is NULL."); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_ERROR, MM_ERROR_CAMCORDER_INVALID_ARGUMENT); + goto err_release_exif; } - /* Set send msg flag and capture count */ - send_msg = TRUE; - type = info->type; + /* Set capture count */ count = ++(info->capture_send_count); + /* Send CAPTURED message and count - capture success */ + if (info->hdr_capture_mode != MM_CAMCORDER_HDR_ON_AND_ORIGINAL) { + MMTA_ACUM_ITEM_BEGIN(" CAPTURED MESSAGE DELAY", FALSE); + + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_CAPTURED, count); + } else if (info->hdr_capture_mode == MM_CAMCORDER_HDR_ON_AND_ORIGINAL && count == 2) { + MMTA_ACUM_ITEM_BEGIN(" CAPTURED MESSAGE DELAY", FALSE); + + /* send captured message only once in HDR and Original Capture mode */ + MMCAM_SEND_MESSAGE(hcamcorder, MM_MESSAGE_CAMCORDER_CAPTURED, 1); + } + err_release_exif: _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(hcamcorder); @@ -1645,11 +1726,9 @@ err_release_exif: error: /* Check end condition and set proper value */ - __mmcamcorder_init_stillshot_info((MMHandleType)hcamcorder); - - /* send captured message if no problem */ - if (send_msg) { - __mmcamcorder_capture_send_msg((MMHandleType)hcamcorder, type, count); + if (info->hdr_capture_mode != MM_CAMCORDER_HDR_ON_AND_ORIGINAL || + (info->hdr_capture_mode == MM_CAMCORDER_HDR_ON_AND_ORIGINAL && count == 2)) { + __mmcamcorder_init_stillshot_info((MMHandleType)hcamcorder); } /* release internal allocated data */ @@ -1730,7 +1809,7 @@ int _mmcamcorder_set_resize_property(MMHandleType handle, int capture_width, int } -int __mmcamcorder_set_exif_basic_info(MMHandleType handle) +int __mmcamcorder_set_exif_basic_info(MMHandleType handle, MMCamcorderCaptureDataType *capture_data) { int ret = MM_ERROR_NONE; int value; @@ -1742,7 +1821,9 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) double f_longitude = INVALID_GPS_VALUE; double f_altitude = INVALID_GPS_VALUE; char *str_value = NULL; +#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */ char *maker = NULL; +#endif char *user_comment = NULL; char *err_name = NULL; ExifData *ed = NULL; @@ -1752,7 +1833,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) static ExifLong elong[10]; GstCameraControl *control = NULL; - GstCameraControlExifInfo avsys_exif_info = {0,}; + GstCameraControlExifInfo avsys_exif_info; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); _MMCamcorderSubContext *sc = NULL; @@ -1764,15 +1845,18 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) sc = MMF_CAMCORDER_SUBCONTEXT(handle); mmf_return_val_if_fail(sc && sc->element, MM_ERROR_CAMCORDER_NOT_INITIALIZED); + CLEAR(avsys_exif_info); + if (!GST_IS_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst)) { - _mmcam_dbg_err("Can't cast Video source into camera control. Just return true."); - return MM_ERROR_NONE; + _mmcam_dbg_err("Can't cast Video source into camera control. Skip camera control values..."); + } else { + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + /* get device information */ + __ta__(" gst_camera_control_get_exif_info", + gst_camera_control_get_exif_info(control, &avsys_exif_info); + ); } - control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); - /* get device information */ - gst_camera_control_get_exif_info(control, &avsys_exif_info); - /* get ExifData from exif info */ ed = mm_exif_get_exif_from_info(hcamcorder->exif_info); if (ed == NULL || ed->ifd == NULL) { @@ -1793,7 +1877,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) } /*1. EXIF_TAG_IMAGE_WIDTH */ /*EXIF_TAG_PIXEL_X_DIMENSION*/ - mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_WIDTH, &value, NULL); + value = capture_data->width; exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order(ed), value); ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, @@ -1810,7 +1894,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) _mmcam_dbg_log("width[%d]", value); /*2. EXIF_TAG_IMAGE_LENGTH*/ /*EXIF_TAG_PIXEL_Y_DIMENSION*/ - mm_camcorder_get_attributes(handle, NULL, MMCAM_CAPTURE_HEIGHT, &value, NULL); + value = capture_data->height; exif_set_long((unsigned char *)&elong[cntl], exif_data_get_byte_order (ed), value); ret = mm_exif_set_add_entry(ed, EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, @@ -1879,7 +1963,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) free(b); } - +#ifdef WRITE_EXIF_MAKER_INFO /* FIXME */ /*5. EXIF_TAG_MAKE */ maker = strdup(MM_MAKER_NAME); if (maker) { @@ -1912,7 +1996,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) } else { _mmcam_dbg_warn("failed to get model name"); } - +#endif /*6. EXIF_TAG_IMAGE_DESCRIPTION */ mm_camcorder_get_attributes(handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &str_value, &str_val_len, NULL); _mmcam_dbg_log("desctiption [%s]", str_value); @@ -1932,7 +2016,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) /*7. EXIF_TAG_SOFTWARE*/ /* - { + if (control != NULL) { char software[50] = {0,}; unsigned int len = 0; @@ -1980,20 +2064,24 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) } /*9. EXIF_TAG_COLOR_SPACE */ - exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.colorspace); - ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COLOR_SPACE, - EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); - if (ret != MM_ERROR_NONE) { - EXIF_SET_ERR(ret, EXIF_TAG_COLOR_SPACE); + if (control != NULL) { + exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed), avsys_exif_info.colorspace); + ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COLOR_SPACE, + EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); + if (ret != MM_ERROR_NONE) { + EXIF_SET_ERR(ret, EXIF_TAG_COLOR_SPACE); + } } /*10. EXIF_TAG_COMPONENTS_CONFIGURATION */ - config = avsys_exif_info.component_configuration; - _mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ",config); - ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, - EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&config); - if (ret != MM_ERROR_NONE) { - EXIF_SET_ERR(ret, EXIF_TAG_COMPONENTS_CONFIGURATION); + if (control != NULL) { + config = avsys_exif_info.component_configuration; + _mmcam_dbg_log("EXIF_TAG_COMPONENTS_CONFIGURATION [%4x] ",config); + ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, + EXIF_FORMAT_UNDEFINED, 4, (unsigned char *)&config); + if (ret != MM_ERROR_NONE) { + EXIF_SET_ERR(ret, EXIF_TAG_COMPONENTS_CONFIGURATION); + } } /*11. EXIF_TAG_COMPRESSED_BITS_PER_PIXEL */ @@ -2001,6 +2089,7 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) /*12. EXIF_TAG_DATE_TIME_ORIGINAL */ /*13. EXIF_TAG_DATE_TIME_DIGITIZED*/ + /*14. EXIF_TAG_EXPOSURE_TIME*/ if (avsys_exif_info.exposure_time_numerator && avsys_exif_info.exposure_time_denominator) { unsigned char *b = NULL; @@ -2212,23 +2301,27 @@ int __mmcamcorder_set_exif_basic_info(MMHandleType handle) /* defualt : none */ /*24. EXIF_TAG_METERING_MODE */ - exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed),avsys_exif_info.metering_mode); - _mmcam_dbg_log("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode); - ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE, - EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); - if (ret != MM_ERROR_NONE) { - EXIF_SET_ERR(ret, EXIF_TAG_METERING_MODE); + if (control != NULL) { + exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order(ed),avsys_exif_info.metering_mode); + _mmcam_dbg_log("EXIF_TAG_METERING_MODE [%d]", avsys_exif_info.metering_mode); + ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_METERING_MODE, + EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); + if (ret != MM_ERROR_NONE) { + EXIF_SET_ERR(ret, EXIF_TAG_METERING_MODE); + } } /*25. EXIF_TAG_LIGHT_SOURCE*/ /*26. EXIF_TAG_FLASH*/ - exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order (ed),avsys_exif_info.flash); - _mmcam_dbg_log("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash); - ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, - EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); - if (ret != MM_ERROR_NONE) { - EXIF_SET_ERR(ret, EXIF_TAG_FLASH); + if (control != NULL) { + exif_set_short((unsigned char *)&eshort[cnts], exif_data_get_byte_order (ed),avsys_exif_info.flash); + _mmcam_dbg_log("EXIF_TAG_FLASH [%d]", avsys_exif_info.flash); + ret = mm_exif_set_add_entry(ed, EXIF_IFD_EXIF, EXIF_TAG_FLASH, + EXIF_FORMAT_SHORT, 1, (unsigned char *)&eshort[cnts++]); + if (ret != MM_ERROR_NONE) { + EXIF_SET_ERR(ret, EXIF_TAG_FLASH); + } } /*27. EXIF_TAG_FOCAL_LENGTH*/ diff --git a/src/mm_camcorder_util.c b/src/mm_camcorder_util.c index 688cc31..1024e8a 100644 --- a/src/mm_camcorder_util.c +++ b/src/mm_camcorder_util.c @@ -570,33 +570,54 @@ void _mmcamcorder_element_release_noti(gpointer data, GObject *where_the_object_ gboolean _mmcamcroder_msg_callback(void *data) { - _MMCamcorderMsgItem * item = (_MMCamcorderMsgItem*)data; - mmf_camcorder_t *hcamcorder= NULL; + _MMCamcorderMsgItem *item = (_MMCamcorderMsgItem*)data; + mmf_camcorder_t *hcamcorder = NULL; mmf_return_val_if_fail( item, FALSE ); - + hcamcorder = MMF_CAMCORDER(item->handle); mmf_return_val_if_fail( hcamcorder, FALSE ); -// _mmcam_dbg_log("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item); + /*_mmcam_dbg_log("msg id:%x, msg_cb:%p, msg_data:%p, item:%p", item->id, hcamcorder->msg_cb, hcamcorder->msg_data, item);*/ - _MMCAMCORDER_LOCK_MESSAGE_CALLBACK( hcamcorder ); + _MMCAMCORDER_LOCK_MESSAGE_CALLBACK(hcamcorder); + + /* check delay of CAPTURED message */ + if (item->id == MM_MESSAGE_CAMCORDER_CAPTURED) { + MMTA_ACUM_ITEM_END(" CAPTURED MESSAGE DELAY", FALSE); + } if ((hcamcorder) && (hcamcorder->msg_cb)) { hcamcorder->msg_cb(item->id, (MMMessageParamType*)(&(item->param)), hcamcorder->msg_cb_param); } - _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK( hcamcorder ); + _MMCAMCORDER_UNLOCK_MESSAGE_CALLBACK(hcamcorder); _MMCAMCORDER_LOCK((MMHandleType)hcamcorder); - - if (hcamcorder->msg_data) + + if (hcamcorder->msg_data) { hcamcorder->msg_data = g_list_remove(hcamcorder->msg_data, item); + } - SAFE_FREE(item); + /* release allocated memory */ + if (item->id == MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO) { + MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)item->param.data; + if (cam_fd_info) { + SAFE_FREE(cam_fd_info->face_info); + free(cam_fd_info); + cam_fd_info = NULL; + } + + item->param.data = NULL; + item->param.size = 0; + } + + free(item); + item = NULL; _MMCAMCORDER_UNLOCK((MMHandleType)hcamcorder); - return FALSE; //For not being called again + /* For not being called again */ + return FALSE; } @@ -696,6 +717,12 @@ _mmcamcroder_remove_message_all(MMHandleType handle) hcamcorder->msg_data = NULL; } + /* remove idle function for playing capture sound */ + do { + ret = g_idle_remove_by_data(hcamcorder); + _mmcam_dbg_log("remove idle function for playing capture sound. ret[%d]", ret); + } while (ret); + _MMCAMCORDER_UNLOCK(handle); return; @@ -837,9 +864,17 @@ unsigned int _mmcamcorder_get_fourcc(int pixtype, int codectype, int use_zero_co fourcc = GST_MAKE_FOURCC ('J', 'P', 'E', 'G'); } break; + /*FIXME*/ + case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY: + fourcc = GST_MAKE_FOURCC('I','T','L','V'); + break; default: - _mmcam_dbg_log("Not proper pixel type. Set default."); - fourcc = GST_MAKE_FOURCC ('S', '4', '2', '0'); + _mmcam_dbg_log("Not proper pixel type[%d]. Set default - I420", pixtype); + if (use_zero_copy_format) { + fourcc = GST_MAKE_FOURCC ('S', '4', '2', '0'); + } else { + fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); + } break; } @@ -895,6 +930,10 @@ int _mmcamcorder_get_pixtype(unsigned int fourcc) case GST_MAKE_FOURCC ('P', 'N', 'G', ' '): pixtype = MM_PIXEL_FORMAT_ENCODED; break; + /*FIXME*/ + case GST_MAKE_FOURCC ('I', 'T', 'L', 'V'): + pixtype = MM_PIXEL_FORMAT_ITLV_JPEG_UYVY; + break; default: _mmcam_dbg_log("Not supported fourcc type(%x)", fourcc); pixtype = MM_PIXEL_FORMAT_INVALID; diff --git a/src/mm_camcorder_videorec.c b/src/mm_camcorder_videorec.c index 631f389..f0897a4 100644 --- a/src/mm_camcorder_videorec.c +++ b/src/mm_camcorder_videorec.c @@ -22,6 +22,7 @@ /*======================================================================================= | INCLUDE FILES | =======================================================================================*/ +#include <gst/interfaces/cameracontrol.h> #include "mm_camcorder_internal.h" #include "mm_camcorder_videorec.h" @@ -45,7 +46,7 @@ static gboolean __mmcamcorder_audio_dataprobe_check(GstPad *pad, GstBuffer *buffer, gpointer u_data); static gboolean __mmcamcorder_video_dataprobe_record(GstPad *pad, GstBuffer *buffer, gpointer u_data); static gboolean __mmcamcorder_audioque_dataprobe(GstPad *pad, GstBuffer *buffer, gpointer u_data); -static gboolean __mmcamcorder_video_dataprobe_slow(GstPad *pad, GstBuffer *buffer, gpointer u_data); +static gboolean __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad, GstBuffer *buffer, gpointer u_data); static gboolean __mmcamcorder_audio_dataprobe_audio_mute(GstPad *pad, GstBuffer *buffer, gpointer u_data); static gboolean __mmcamcorder_add_locationinfo(MMHandleType handle, int fileformat); static gboolean __mmcamcorder_add_locationinfo_mp4(MMHandleType handle); @@ -60,6 +61,7 @@ static gboolean __mmcamcorder_eventprobe_monitor(GstPad *pad, GstEvent *event, g int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) { int err = MM_ERROR_NONE; + int audio_disable = FALSE; char* gst_element_rsink_name = NULL; GstPad *srcpad = NULL; @@ -91,7 +93,20 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) goto pipeline_creation_error; } - if (sc->is_slow == FALSE) { + /* get audio disable */ + mm_camcorder_get_attributes(handle, NULL, + MMCAM_AUDIO_DISABLE, &audio_disable, + NULL); + + if (sc->is_modified_rate || audio_disable) { + sc->audio_disable = TRUE; + } else { + sc->audio_disable = FALSE; + } + _mmcam_dbg_log("AUDIO DISABLE : %d (is_modified_rate %d, audio_disable %d)", + sc->audio_disable, sc->is_modified_rate, audio_disable); + + if (sc->audio_disable == FALSE) { /* Sub pipeline */ __ta__(" __mmcamcorder_create_audiosrc_bin", err = _mmcamcorder_create_audiosrc_bin((MMHandleType)hcamcorder); @@ -119,7 +134,7 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "video_sink0"); _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error); - if (sc->is_slow == FALSE) { + if (sc->audio_disable == FALSE) { srcpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_AUDIOSRC_BIN].gst, "src"); sinkpad = gst_element_get_static_pad (sc->element[_MMCAMCORDER_ENCSINK_BIN].gst, "audio_sink0"); _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error); @@ -137,7 +152,7 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) /* set data probe function for audio */ - if (sc->is_slow == FALSE) { + if (sc->audio_disable == FALSE) { sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "sink"); MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC, __mmcamcorder_audioque_dataprobe, hcamcorder); @@ -168,10 +183,10 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) srcpad = NULL; } - if (sc->is_slow) { + if (sc->audio_disable) { sinkpad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_VENC].gst, "sink"); MMCAMCORDER_ADD_BUFFER_PROBE(sinkpad, _MMCAMCORDER_HANDLER_VIDEOREC, - __mmcamcorder_video_dataprobe_slow, hcamcorder); + __mmcamcorder_video_dataprobe_audio_disable, hcamcorder); gst_object_unref(sinkpad); sinkpad = NULL; } @@ -190,6 +205,11 @@ int _mmcamcorder_add_recorder_pipeline(MMHandleType handle) srcpad = NULL; } + MMCAMCORDER_SIGNAL_CONNECT(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, + _MMCAMCORDER_HANDLER_VIDEOREC, "still-capture", + G_CALLBACK(_mmcamcorder_video_snapshot_capture_cb), + hcamcorder); + return MM_ERROR_NONE; pipeline_creation_error: @@ -387,11 +407,11 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) int size = 0; int fileformat = 0; int ret = MM_ERROR_NONE; + double motion_rate = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; char *temp_filename = NULL; char *err_name = NULL; gint fps = 0; - gint slow_fps = 0; GstElement *pipeline = NULL; GstPad *pad = NULL; @@ -423,7 +443,6 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) /* Recording */ _mmcam_dbg_log("Record Start"); - ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED); if (ret != MM_ERROR_NONE) { goto _ERR_CAMCORDER_VIDEO_COMMAND; @@ -444,7 +463,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) ret = mm_camcorder_get_attributes(handle, &err_name, MMCAM_CAMERA_FPS, &fps, - "camera-slow-motion-fps", &slow_fps, + MMCAM_CAMERA_RECORDING_MOTION_RATE, &motion_rate, MMCAM_FILE_FORMAT, &fileformat, MMCAM_TARGET_FILENAME, &temp_filename, &size, MMCAM_TARGET_TIME_LIMIT, &imax_time, @@ -463,10 +482,13 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) info->max_time = ((guint64)imax_time) * 1000; /* to millisecond */ } - if (sc->is_slow) { - info->multiple_fps = fps/slow_fps; - _mmcam_dbg_log("high speed recording fps:%d,slow_fps:%d,multiple_fps:%d", - fps, slow_fps, info->multiple_fps); + if (sc->is_modified_rate) { + info->record_timestamp_ratio = (_MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE/motion_rate); + _mmcam_dbg_log("high speed recording fps:%d, slow_rate:%f, timestamp_ratio:%f", + fps, motion_rate, info->record_timestamp_ratio); + } else { + info->record_timestamp_ratio = _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE; + _mmcam_dbg_log("normal recording"); } MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", TRUE); @@ -568,7 +590,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) } for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) { - if (sc->is_slow) { + if (sc->audio_disable) { /* check only video frame */ if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) { break; @@ -613,11 +635,6 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE); - if (sc->now_continuous_af) { - sc->now_continuous_af = FALSE; - _mmcam_dbg_log("Set now_continuous_af as FALSE when CANCEL recording"); - } - __ta__(" _MMCamcorder_CMD_CANCEL:GST_STATE_READY", ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_READY); ); @@ -669,7 +686,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) } for (count = 0 ; count <= _MMCAMCORDER_RETRIAL_COUNT ; count++) { - if (sc->is_slow) { + if (sc->audio_disable) { /* check only video frame */ if (info->video_frame_count >= _MMCAMCORDER_MINIMUM_FRAME) { break; @@ -705,11 +722,6 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "hold-af-after-capturing", FALSE); - if (sc->now_continuous_af) { - sc->now_continuous_af = FALSE; - _mmcam_dbg_log("Set now_continuous_af as FALSE when COMMIT recording"); - } - if (sc->error_occurs) { GstPad *video= NULL; GstPad *audio = NULL; @@ -729,7 +741,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) _mmcam_dbg_err("Sending EOS video encoder src pad : %d", ret); gst_object_unref(video); - if (!sc->is_slow) { + if (sc->audio_disable == FALSE) { audio = gst_element_get_static_pad(sc->element[_MMCAMCORDER_ENCSINK_AENC].gst, "src"); gst_pad_push_event (audio, gst_event_new_flush_start()); gst_pad_push_event (audio, gst_event_new_flush_stop()); @@ -774,6 +786,7 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) case _MMCamcorder_CMD_PREVIEW_START: { int fps_auto = 0; + int focus_mode = 0; _mmcamcorder_vframe_stablize((MMHandleType)hcamcorder); @@ -781,10 +794,18 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) sc->display_interval = 0; sc->previous_slot_time = 0; - mm_camcorder_get_attributes(handle, NULL, MMCAM_CAMERA_FPS_AUTO, &fps_auto, NULL); + mm_camcorder_get_attributes(handle, NULL, + MMCAM_CAMERA_FPS_AUTO, &fps_auto, + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + NULL); MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "fps-auto", fps_auto); + /* set focus mode */ + mm_camcorder_set_attributes(handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, focus_mode, + NULL); + __ta__(" _MMCamcorder_CMD_PREVIEW_START:GST_STATE_PLAYING", ret =_mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING); ); @@ -811,6 +832,24 @@ int _mmcamcorder_video_command(MMHandleType handle, int command) } break; + case _MMCamcorder_CMD_CAPTURE: + { + int cap_jpeg_quality = 0; + + GstCameraControl *control = NULL; + + ret = mm_camcorder_get_attributes(handle, &err_name, + MMCAM_IMAGE_ENCODER_QUALITY, &cap_jpeg_quality, + NULL); + + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-fourcc", GST_MAKE_FOURCC('J','P','E','G')); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-count", 1); + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "capture-jpg-quality", cap_jpeg_quality); + + control = GST_CAMERA_CONTROL(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst); + gst_camera_control_set_capture_command(control, GST_CAMERA_CONTROL_CAPTURE_COMMAND_START); + break; + } default: ret = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; goto _ERR_CAMCORDER_VIDEO_COMMAND; @@ -833,10 +872,6 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) { int ret = MM_ERROR_NONE; int enabletag = 0; - int camcorder_rotate = MM_VIDEO_INPUT_ROTATION_NONE; - int camera_rotate = MM_VIDEO_INPUT_ROTATION_NONE; - int display_rotate = MM_DISPLAY_ROTATION_NONE; - guint64 file_size = 0; GstPad *pad = NULL; GstElement *pipeline = NULL; @@ -865,12 +900,16 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", FALSE); MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", TRUE); + mm_camcorder_get_attributes(handle, NULL, + MMCAM_TAG_ENABLE, &enabletag, + NULL); + _mmcam_dbg_log("Set state of pipeline as PAUSED"); __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_PAUSED", ret = _mmcamcorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED); ); if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:GST_STATE_PAUSED failed. error[%x]", ret); + _mmcam_dbg_warn("_MMCamcorder_CMD_COMMIT:GST_STATE_READY or PAUSED failed. error[%x]", ret); } MMCAMCORDER_G_OBJECT_SET( sc->element[_MMCAMCORDER_VIDEOSINK_QUE].gst, "empty-buffers", FALSE); @@ -893,30 +932,20 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) } } - /* Recovering camera-rotation and display-rotation when start recording */ - if (camcorder_rotate != camera_rotate && - camera_rotate < MM_VIDEO_INPUT_ROTATION_FLIP_HORZ) { - _mmcamcorder_set_videosrc_rotation(handle, camera_rotate); - _mmcamcorder_set_display_rotation(handle, display_rotate); - _mmcam_dbg_log("## Recovering camcorder rotation is done. camcorder_rotate=%d, camera_rotate=%d, display_rotate=%d", - camcorder_rotate,camera_rotate,display_rotate); - } else { - _mmcam_dbg_log("## No need to recover camcorder rotation. camcorder_rotate=%d, camera_rotate=%d, display_rotate=%d", - camcorder_rotate,camera_rotate,display_rotate); - - /* Flush EOS event to avoid pending pipeline */ - pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink"); - gst_pad_push_event(pad, gst_event_new_flush_start()); - gst_pad_push_event(pad, gst_event_new_flush_stop()); - gst_object_unref(pad); - pad = NULL; - - pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "src"); - gst_pad_push_event(pad, gst_event_new_flush_start()); - gst_pad_push_event(pad, gst_event_new_flush_stop()); - gst_object_unref(pad); - pad = NULL; - } + _mmcam_dbg_log("## Flush EOS event"); + + /* Flush EOS event to avoid pending pipeline */ + pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSINK_SINK].gst, "sink"); + gst_pad_push_event(pad, gst_event_new_flush_start()); + gst_pad_push_event(pad, gst_event_new_flush_stop()); + gst_object_unref(pad); + pad = NULL; + + pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_SRC].gst, "src"); + gst_pad_push_event(pad, gst_event_new_flush_start()); + gst_pad_push_event(pad, gst_event_new_flush_stop()); + gst_object_unref(pad); + pad = NULL; _mmcam_dbg_log("Set state as PLAYING"); __ta__(" _MMCamcorder_CMD_COMMIT:GST_STATE_PLAYING", @@ -974,6 +1003,158 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) return TRUE; } + +void _mmcamcorder_video_snapshot_capture_cb(GstElement *element, GstBuffer *buffer1, GstBuffer *buffer2, GstBuffer *buffer3, gpointer u_data) +{ + int ret = MM_ERROR_NONE; + int pixtype = MM_PIXEL_FORMAT_INVALID; + int pixtype_sub = MM_PIXEL_FORMAT_INVALID; + int attr_index = 0; + + mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data); + _MMCamcorderVideoInfo *info = NULL; + _MMCamcorderSubContext *sc = NULL; + _MMCamcorderMsgItem msg; + MMCamcorderCaptureDataType dest = {0,}; + MMCamcorderCaptureDataType thumb = {0,}; + MMCamcorderCaptureDataType scrnail = {0,}; + + mmf_attrs_t *attrs = NULL; + mmf_attribute_t *item = NULL; + + char *err_attr_name = NULL; + + mmf_return_if_fail(hcamcorder); + + sc = MMF_CAMCORDER_SUBCONTEXT(hcamcorder); + mmf_return_if_fail(sc && sc->info); + + info = sc->info; + + _mmcam_dbg_err("START"); + + MMTA_ACUM_ITEM_BEGIN(" VideoSnapshot:MSL capture callback", FALSE); + + /* Prepare main, thumbnail buffer */ + pixtype = _mmcamcorder_get_pixel_format(buffer1); + if (pixtype == MM_PIXEL_FORMAT_INVALID) { + _mmcam_dbg_err("Unsupported pixel type"); + msg.id = MM_MESSAGE_CAMCORDER_ERROR; + msg.param.code = MM_ERROR_CAMCORDER_INTERNAL; + goto error; + } + + /* Main image buffer */ + if (buffer1 && GST_BUFFER_DATA(buffer1) && (GST_BUFFER_SIZE(buffer1) > 0)) { + __mmcamcorder_get_capture_data_from_buffer(&dest, pixtype, buffer1); + } else { + _mmcam_dbg_err("buffer1 has wrong pointer. (buffer1=%p)",buffer1); + msg.id = MM_MESSAGE_CAMCORDER_ERROR; + msg.param.code = MM_ERROR_CAMCORDER_INTERNAL; + goto error; + } + + /* Thumbnail image buffer */ + if (buffer2 && GST_BUFFER_DATA(buffer2) && (GST_BUFFER_SIZE(buffer2) > 0)) { + pixtype_sub = _mmcamcorder_get_pixel_format(buffer2); + _mmcam_dbg_log("Thumnail (buffer2=%p)",buffer2); + + __mmcamcorder_get_capture_data_from_buffer(&thumb, pixtype_sub, buffer2); + } else { + _mmcam_dbg_log("buffer2 has wrong pointer. Not Error. (buffer2=%p)",buffer2); + } + + /* Screennail image buffer */ + attrs = (mmf_attrs_t*)MMF_CAMCORDER_ATTRS(hcamcorder); + mm_attrs_get_index((MMHandleType)attrs, "captured-screennail", &attr_index); + item = &attrs->items[attr_index]; + + if (buffer3 && GST_BUFFER_DATA(buffer3) && GST_BUFFER_SIZE(buffer3) != 0) { + _mmcam_dbg_log("Screennail (buffer3=%p,size=%d)", buffer3, GST_BUFFER_SIZE(buffer3)); + + pixtype_sub = _mmcamcorder_get_pixel_format(buffer3); + __mmcamcorder_get_capture_data_from_buffer(&scrnail, pixtype_sub, buffer3); + + /* Set screennail attribute for application */ + mmf_attribute_set_data(item, &scrnail, sizeof(scrnail)); + } else { + mmf_attribute_set_data(item, NULL, 0); + + _mmcam_dbg_log("buffer3 has wrong pointer. Not Error. (buffer3=%p)",buffer3); + } + + mmf_attrs_commit_err((MMHandleType)attrs, &err_attr_name); + + /* Set extra data for jpeg */ + if (dest.format == MM_PIXEL_FORMAT_ENCODED) { + __ta__( " VideoSnapshot:__mmcamcorder_set_jpeg_data", + ret = __mmcamcorder_set_jpeg_data((MMHandleType)hcamcorder, &dest, &thumb); + ); + if (!ret) { + _mmcam_dbg_err("Error on setting extra data to jpeg"); + msg.id = MM_MESSAGE_CAMCORDER_ERROR; + msg.param.code = MM_ERROR_CAMCORDER_INTERNAL; + goto error; + } + } + + /* Handle Capture Callback */ + _MMCAMCORDER_LOCK_VCAPTURE_CALLBACK(hcamcorder); + + if (hcamcorder->vcapture_cb) { + _mmcam_dbg_log("APPLICATION CALLBACK START"); + MMTA_ACUM_ITEM_BEGIN(" VideoSnapshot:Application capture callback", 0); + if (thumb.data) { + ret = hcamcorder->vcapture_cb(&dest, &thumb, hcamcorder->vcapture_cb_param); + } else { + ret = hcamcorder->vcapture_cb(&dest, NULL, hcamcorder->vcapture_cb_param); + } + MMTA_ACUM_ITEM_END(" VideoSnapshot:Application capture callback", 0); + _mmcam_dbg_log("APPLICATION CALLBACK END"); + } else { + _mmcam_dbg_err("Capture callback is NULL."); + msg.id = MM_MESSAGE_CAMCORDER_ERROR; + msg.param.code = MM_ERROR_CAMCORDER_INVALID_ARGUMENT; + goto err_release_exif; + } + + /* send video snapshot captured message */ + msg.id = MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED; + msg.param.code = 1; + +err_release_exif: + _MMCAMCORDER_UNLOCK_VCAPTURE_CALLBACK(hcamcorder); + + /* Release jpeg data */ + if (pixtype == MM_PIXEL_FORMAT_ENCODED) { + __ta__( " VideoSnapshot:__mmcamcorder_release_jpeg_data", + __mmcamcorder_release_jpeg_data((MMHandleType)hcamcorder, &dest); + ); + } + +error: + /* send message - captured or error with error code */ + _mmcam_dbg_log("msg id : %x, code : %x", msg.id, msg.param.code); + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + + /*free GstBuffer*/ + if (buffer1) { + gst_buffer_unref(buffer1); + } + if (buffer2) { + gst_buffer_unref(buffer2); + } + if (buffer3) { + gst_buffer_unref(buffer3); + } + + MMTA_ACUM_ITEM_END(" VideoSnapshot:MSL capture callback", FALSE); + + _mmcam_dbg_err("END"); + + return; +} + /** * This function is record video data probing function. * If this function is linked with certain pad by gst_pad_add_buffer_probe(), @@ -1091,17 +1272,6 @@ static gboolean __mmcamcorder_video_dataprobe_record(GstPad *pad, GstBuffer *buf buffer_size = GST_BUFFER_SIZE(buffer); - if (sc->now_continuous_af) { - _mmcam_dbg_log("Start continuous AF when START recording"); - __ta__(" _MMCamcorder_CMD_RECORD:START CAF", - ret = _mmcamcorder_adjust_auto_focus((MMHandleType)hcamcorder); - ); - sc->now_continuous_af = FALSE; - if (ret != MM_ERROR_NONE) { - _mmcam_dbg_warn("Failed continuous AF when START recording"); - } - } - /* get trailer size */ if (info->fileformat == MM_FILE_FORMAT_3GP || info->fileformat == MM_FILE_FORMAT_MP4) { MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size); @@ -1139,8 +1309,13 @@ static gboolean __mmcamcorder_video_dataprobe_record(GstPad *pad, GstBuffer *buf default: /* succeeded to get free space */ /* check free space for recording */ /* get queued buffer size */ - MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size); - MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size); + if (sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst) { + MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_AENC_QUE].gst, "current-level-bytes", &aq_size); + } + if (sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst) { + MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_VENC_QUE].gst, "current-level-bytes", &vq_size); + } + queued_buffer = aq_size + vq_size; /* check free space */ @@ -1170,11 +1345,12 @@ static gboolean __mmcamcorder_video_dataprobe_record(GstPad *pad, GstBuffer *buf } -static gboolean __mmcamcorder_video_dataprobe_slow(GstPad *pad, GstBuffer *buffer, gpointer u_data) +static gboolean __mmcamcorder_video_dataprobe_audio_disable(GstPad *pad, GstBuffer *buffer, gpointer u_data) { - guint min_fps = 15; guint64 trailer_size = 0; + guint64 rec_pipe_time = 0; static guint count = 0; + unsigned int remained_time = 0; GstClockTime b_time; @@ -1191,25 +1367,53 @@ static gboolean __mmcamcorder_video_dataprobe_slow(GstPad *pad, GstBuffer *buffe mmf_return_val_if_fail(sc->info, TRUE); info = sc->info; - count %= min_fps; + b_time = GST_BUFFER_TIMESTAMP(buffer); - if (!count) { - if (info->fileformat == MM_FILE_FORMAT_3GP || info->fileformat == MM_FILE_FORMAT_MP4) { - MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size); - } else { - trailer_size = 0; + rec_pipe_time = GST_TIME_AS_MSECONDS(b_time); + + if (info->fileformat == MM_FILE_FORMAT_3GP || info->fileformat == MM_FILE_FORMAT_MP4) { + MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_ENCSINK_MUX].gst, "expected-trailer-size", &trailer_size); + } else { + trailer_size = 0; + } + + /* check max time */ + if (info->max_time > 0 && rec_pipe_time > info->max_time) { + _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \ + rec_pipe_time, info->max_time); + + if (!sc->isMaxtimePausing) { + MMCAMCORDER_G_OBJECT_SET(sc->element[_MMCAMCORDER_ENCSINK_ENCBIN].gst, "block", TRUE); + + sc->isMaxtimePausing = TRUE; + + msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; + msg.param.recording_status.elapsed = (unsigned int)rec_pipe_time; + msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); + msg.param.recording_status.remained_time = 0; + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + + msg.id = MM_MESSAGE_CAMCORDER_TIME_LIMIT; + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); } - msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; - msg.param.recording_status.elapsed = (unsigned int)GST_TIME_AS_MSECONDS(b_time); - msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); - _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); + return FALSE; + } + + if (info->max_time > 0 && info->max_time < (remained_time + rec_pipe_time)) { + remained_time = info->max_time - rec_pipe_time; } - count++; + msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; + msg.param.recording_status.elapsed = (unsigned int)rec_pipe_time; + msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); + msg.param.recording_status.remained_time = remained_time; + _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); - GST_BUFFER_TIMESTAMP(buffer) = b_time * (info->multiple_fps); + if (info->record_timestamp_ratio != _MMCAMCORDER_DEFAULT_RECORDING_MOTION_RATE) { + GST_BUFFER_TIMESTAMP(buffer) = b_time * (info->record_timestamp_ratio); + } return TRUE; } @@ -1224,6 +1428,7 @@ static gboolean __mmcamcorder_audioque_dataprobe(GstPad *pad, GstBuffer *buffer, GstElement *pipeline = NULL; mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(u_data); _MMCamcorderVideoInfo *info = NULL; + unsigned int remained_time = 0; mmf_return_val_if_fail(buffer, FALSE); mmf_return_val_if_fail(hcamcorder, TRUE); @@ -1249,6 +1454,10 @@ static gboolean __mmcamcorder_audioque_dataprobe(GstPad *pad, GstBuffer *buffer, trailer_size = 0; } + if (info->max_time > 0 && info->max_time < (remained_time + rec_pipe_time)) { + remained_time = info->max_time - rec_pipe_time; + } + if (info->max_time > 0 && rec_pipe_time > info->max_time) { _mmcam_dbg_warn("Current time : [%" G_GUINT64_FORMAT "], Maximum time : [%" G_GUINT64_FORMAT "]", \ rec_pipe_time, info->max_time); @@ -1261,6 +1470,7 @@ static gboolean __mmcamcorder_audioque_dataprobe(GstPad *pad, GstBuffer *buffer, msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; msg.param.recording_status.elapsed = (unsigned int)rec_pipe_time; msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); + msg.param.recording_status.remained_time = 0; _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); msg.id = MM_MESSAGE_CAMCORDER_TIME_LIMIT; @@ -1276,6 +1486,7 @@ static gboolean __mmcamcorder_audioque_dataprobe(GstPad *pad, GstBuffer *buffer, msg.id = MM_MESSAGE_CAMCORDER_RECORDING_STATUS; msg.param.recording_status.elapsed = (unsigned int)rec_pipe_time; msg.param.recording_status.filesize = (unsigned int)((info->filesize + trailer_size) >> 10); + msg.param.recording_status.remained_time = remained_time; _mmcamcroder_send_message((MMHandleType)hcamcorder, &msg); return TRUE; diff --git a/test/Makefile.am b/test/Makefile.am index 0c18a31..c6859b0 100755 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -9,6 +9,7 @@ mm_camcorder_testsuite_CFLAGS = -I$(srcdir)/../src/include \ $(MMTA_CFLAGS)\ $(MM_SOUND_CFLAGS) + ############################################ #mm_camcorder_testsuite_CFLAGS += -DAPPSRC_TEST ############################################ diff --git a/test/mm_camcorder_samplecode.c b/test/mm_camcorder_samplecode.c new file mode 100644 index 0000000..85cbf44 --- /dev/null +++ b/test/mm_camcorder_samplecode.c @@ -0,0 +1,1116 @@ +/* + * mm_camcorder_samsplecode + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Jeongmo Yang <jm80.yang@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @mm_camcorder_samplecode.c + * + * @description + * This file contains usage example of mm_camcorder API. + * + * @author SoYeon Kang<soyeon.kang @samsung.com> + * Wonhyung Cho<wh01.cho@samsung.com> + */ + +/* =========================================================================================== +EDIT HISTORY FOR MODULE + This section contains comments describing changes made to the module. + Notice that changes are listed in reverse chronological order. +when who what, where, why +--------- -------------------- ---------------------------------------------------------- +07/07/10 wh01.cho@samsung.com Created +*/ + + +/*=========================================================================================== +| | +| INCLUDE FILES | +| | +========================================================================================== */ +#include <stdio.h> +#include <stdlib.h> +#include <glib.h> + +#include <mm_camcorder.h> + +#include <appcore-efl.h> + +#include <Elementary.h> +#include <Ecore_X.h> + +/*--------------------------------------------------------------------------- +| GLOBAL VARIABLE DEFINITIONS: | +---------------------------------------------------------------------------*/ + +GIOChannel *stdin_channel; +int g_current_state; + +MMHandleType hcam = 0; +unsigned int elapsed_time = 0; +int stillshot_count = 0; + +void * overlay = NULL; + +struct appdata +{ + Evas *evas; + Ecore_Evas *ee; + Evas_Object *win_main; + + Evas_Object *layout_main; /* layout widget based on EDJ */ + Ecore_X_Window xid; + + /* add more variables here */ +}; + +int r; +struct appdata ad; + + +/*--------------------------------------------------------------------------- +| LOCAL CONSTANT DEFINITIONS: | +---------------------------------------------------------------------------*/ +#define MAX_STRING_LEN 256 // maximum length of string +#define TARGET_FILENAME "/root/av.mp4" + +/*--------------------------------------------------------------------------- +| LOCAL DATA TYPE DEFINITIONS: | +---------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| LOCAL VARIABLE DEFINITIONS: | +---------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| LOCAL FUNCTION PROTOTYPES: | +---------------------------------------------------------------------------*/ +/* Application Body */ +int main(int argc, char **argv); +static gboolean cmd_input(GIOChannel *channel); +static void main_menu(gchar buf); +static gboolean mode_change(); +static void menu(); + + +/* Start and finish */ +static gboolean msg_callback(int message, void *msg_param, void *user_param); +static gboolean initialize_image_capture(); +static gboolean initialize_video_capture(); //A/V recording +static gboolean initialize_audio_capture(); //audio only recording +static gboolean uninitialize_camcorder(); + + +/* Sample functions */ +static gboolean capturing_picture(); +static gboolean record_and_save_video_file(); +static gboolean record_and_cancel_video_file(); +static gboolean record_pause_and_resume_recording(); +static gboolean get_state_of_camcorder(); +static gboolean start_autofocus(); +static gboolean filename_setting(); +static gboolean set_video_stream_callback(); + + +/* APPFWK functions*/ +int app_init(void *data); +int app_exit(void *data); +int app_start(void *data); +int app_stop(void *data); +int idler_exit_cb(void *data); + + +/*--------------------------------------------------------------------------- +| LOCAL FUNCTION DEFINITIONS: | +---------------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------------- +| Sample Functions: | +---------------------------------------------------------------------------*/ +static int +camcordertest_video_capture_cb(MMCamcorderCaptureDataType *src, MMCamcorderCaptureDataType *thumb, void *preview) +{ + int nret = 0; + char m_filename[MAX_STRING_LEN]; + FILE* fp=NULL; + + snprintf(m_filename, MAX_STRING_LEN, "./stillshot_%03d.jpg", stillshot_count++); + + printf("filename : %s\n", m_filename); + + fp=fopen(m_filename, "w+"); + if(fp==NULL) + { + printf("FileOPEN error!!\n"); + return FALSE; + } + else + { + printf("open success\n\n"); + if(fwrite(src->data, src->length, 1, fp )!=1) + { + printf("File write error!!\n"); + return FALSE; + } + printf("write success\n"); + } + fclose(fp); + printf("Capture done!\n"); + + return TRUE; +} + + +static int +camcordertest_video_stream_cb(MMCamcorderVideoStreamDataType *stream, void *user_param) +{ + int nret = 0; + + printf("stream cb is called(%p, %d, %d)\n", stream->data, stream->width, stream->height); + + return TRUE; +} + + +static gboolean msg_callback(int message, void *msg_param, void *user_param) +{ + MMHandleType hcamcorder = (MMHandleType)user_param; + MMMessageParamType *param = (MMMessageParamType *) msg_param; + int err = 0; + + switch (message) { + case MM_MESSAGE_CAMCORDER_ERROR: + printf("MM_MESSAGE_CAMCORDER_ERROR : code = %x\n", param->code); + break; + case MM_MESSAGE_CAMCORDER_STATE_CHANGED: + g_current_state = param->state.current; + break; + + case MM_MESSAGE_CAMCORDER_CAPTURED: + { + //Get mode of camcorder + int mode = 0; + err = mm_camcorder_get_attributes(hcamcorder, NULL, + MMCAM_MODE, &mode, + NULL); + + if (mode == MM_CAMCORDER_MODE_IMAGE) + { + printf("Stillshot Captured!!(number=%d)\n", param->code); //If you start multi shot, 'param->code' will give you the order of the pictrues. + + err = mm_camcorder_capture_stop(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_capture_start = %x\n", err); + return FALSE; + } + } + else + { + //Audio/Video recording + MMCamRecordingReport* report ; + + if (param) + report = (MMCamRecordingReport*)(param->data); + else + return FALSE; + + printf("Recording Complete(filename=%s)\n", report->recording_filename); + + //You have to release 'recording_filename' and 'MMCamRecordingReport' structure. + if (report->recording_filename) + free(report->recording_filename); + + if (report) + free(report); + } + } + break; + case MM_MESSAGE_CAMCORDER_RECORDING_STATUS: + { + unsigned int elapsed; + elapsed = param->recording_status.elapsed / 1000; + if (elapsed_time != elapsed) { + unsigned int temp_time; + int hour, minute, second; + elapsed_time = elapsed; + temp_time = elapsed; + hour = temp_time / 3600; + temp_time = elapsed % 3600; + minute = temp_time / 60; + second = temp_time % 60; + printf("Current Time - %d:%d:%d\n", hour, minute, second); + } + } + break; + case MM_MESSAGE_CAMCORDER_MAX_SIZE: + { + printf("Reach Size limitation.\n"); + + /* After reaching max size, Camcorder starts to drop all buffers that it receives. + You have to call mm_camcorder_commit() to finish recording. */ + err = mm_camcorder_commit(hcamcorder); + + if (err < 0) + { + printf("Save recording mm_camcorder_commit = %x\n", err); + } + } + break; + case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE: + { + printf("There is no space in storage.\n"); + + /* If there is no free space to save recording frame, Camcorder starts to drop all buffers that it receives. + You have to call mm_camcorder_commit() to finish recording. */ + err = mm_camcorder_commit(hcamcorder); + + if (err < 0) + { + printf("Save recording mm_camcorder_commit = %x\n", err); + } + } + break; + case MM_MESSAGE_CAMCORDER_TIME_LIMIT: + { + printf("Reach time limitation.\n"); + + /* After reaching time limit, Camcorder starts to drop all buffers that it receives. + You have to call mm_camcorder_commit() to finish recording. */ + err = mm_camcorder_commit(hcamcorder); + + if (err < 0) + { + printf("Save recording mm_camcorder_commit = %x\n", err); + } + } + break; + case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED: + { + printf( "Focus State changed. State:[%d]\n", param->code ); + } + break; + default: + break; + } + + return TRUE; +} + +static gboolean initialize_image_capture() +{ + int err; + MMCamPreset cam_info; + char *err_attr_name = NULL; + void * hdisplay = NULL; + int hsize = 0; + + cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0; + /* If you want to turn front camera on, disable upper line and enable below one.*/ +// cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA1; + + err = mm_camcorder_create(&hcam, &cam_info); + + if (err != MM_ERROR_NONE) + { + printf("Fail to call mm_camcorder_create = %x\n", err); + return FALSE; + } + + mm_camcorder_set_message_callback(hcam, (MMMessageCallback)msg_callback, (void*)hcam); + mm_camcorder_set_video_capture_callback(hcam, (mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, (void*)hcam); + + hdisplay = &ad.xid; + hsize = sizeof(ad.xid); + + /* camcorder attribute setting */ + err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name, + MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE, + MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG, + MMCAM_CAMERA_WIDTH, 640, + MMCAM_CAMERA_HEIGHT, 480, + MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_YUYV, + MMCAM_CAMERA_FPS, 30, + MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270, + MMCAM_DISPLAY_HANDLE, (void*) hdisplay, hsize, + MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED, + MMCAM_CAPTURE_WIDTH, 640, + MMCAM_CAPTURE_HEIGHT, 480, + NULL); + + if (err < 0) + { + printf("Set attrs fail. (%s:%x)\n", err_attr_name, err); + if (err_attr_name) { + free(err_attr_name); + err_attr_name = NULL; + return FALSE; + } + } + + err = mm_camcorder_realize(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_realize = %x\n", err); + return FALSE; + } + + /* start camcorder */ + err = mm_camcorder_start(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_start = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean initialize_video_capture() //A/V recording +{ + int err; + MMCamPreset cam_info; + char *err_attr_name = NULL; + void * hdisplay = NULL; + int hsize = 0; + + cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0; + /* If you want to turn front camera on, disable upper line and enable below one.*/ +// cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA1; + + err = mm_camcorder_create(&hcam, &cam_info); + + if (err != MM_ERROR_NONE) + { + printf("Fail to call mm_camcorder_create = %x\n", err); + return FALSE; + } + + mm_camcorder_set_message_callback(hcam, (MMMessageCallback)msg_callback, hcam); + + hdisplay = &ad.xid; + hsize = sizeof(ad.xid); + + /* camcorder attribute setting */ + err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name, + MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO, + MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC, + MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC, + MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_MPEG4, + MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP, + MMCAM_CAMERA_WIDTH, 1280, + MMCAM_CAMERA_HEIGHT, 720, + MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_NV12, + MMCAM_CAMERA_FPS, 30, + MMCAM_AUDIO_SAMPLERATE, 44100, + MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE, + MMCAM_AUDIO_CHANNEL, 2, + MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL, + MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270, + MMCAM_DISPLAY_HANDLE, (void*) hdisplay, hsize, + MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME), + NULL); + + if (err < 0) + { + printf("Set attrs fail. (%s:%x)\n", err_attr_name, err); + if (err_attr_name) { + free(err_attr_name); + err_attr_name = NULL; + return FALSE; + } + } + + err = mm_camcorder_realize(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_realize = %x\n", err); + return FALSE; + } + + /* start camcorder */ + err = mm_camcorder_start(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_start = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean initialize_audio_capture() //audio only recording +{ + int err; + MMCamPreset cam_info; + char *err_attr_name = NULL; + void * hdisplay = NULL; + int hsize = 0; + + cam_info.videodev_type = MM_VIDEO_DEVICE_NONE; + + err = mm_camcorder_create(&hcam, &cam_info); + + if (err != MM_ERROR_NONE) + { + printf("Fail to call mm_camcorder_create = %x\n", err); + return FALSE; + } + + mm_camcorder_set_message_callback(hcam, (MMMessageCallback)msg_callback, (void*)hcam); + + hdisplay = &ad.xid; + hsize = sizeof(ad.xid); + + /* camcorder attribute setting */ + err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name, + MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO, + MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC, + MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC, + MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP, + MMCAM_AUDIO_SAMPLERATE, 44100, + MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE, + MMCAM_AUDIO_CHANNEL, 2, + MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL, + MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME), + MMCAM_TARGET_TIME_LIMIT, 360000, + NULL); + + if (err < 0) + { + printf("Set attrs fail. (%s:%x)\n", err_attr_name, err); + if (err_attr_name) { + free(err_attr_name); + err_attr_name = NULL; + return FALSE; + } + } + + err = mm_camcorder_realize(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_realize = %x\n", err); + return FALSE; + } + + /* start camcorder */ + err = mm_camcorder_start(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_start = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean uninitialize_camcorder() +{ + int err; + + err = mm_camcorder_stop(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_stop = %x\n", err); + return FALSE; + } + + err = mm_camcorder_unrealize(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_unrealize = %x\n", err); + return FALSE; + } + + err = mm_camcorder_destroy(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_destroy = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean capturing_picture() +{ + int err; + + err = mm_camcorder_capture_start(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_capture_start = %x\n", err); + return FALSE; + } + + //mm_camcorder_capture_stop should be called after getting MM_MESSAGE_CAMCORDER_CAPTURED message. + sleep(3); + + return TRUE; +} + + +static gboolean record_and_save_video_file() +{ + int err; + + /* Start recording */ + err = mm_camcorder_record(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_record = %x\n", err); + return FALSE; + } + + sleep(5); + + /* Save file */ + err = mm_camcorder_commit(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_commit = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean record_and_cancel_video_file() +{ + int err; + + /* Start recording */ + err = mm_camcorder_record(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_record = %x\n", err); + return FALSE; + } + + sleep(5); + + /* Cancel recording */ + err = mm_camcorder_cancel(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_cancel = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean record_pause_and_resume_recording() +{ + int err; + + /* Start recording */ + err = mm_camcorder_record(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_record = %x\n", err); + return FALSE; + } + + sleep(5); + + /* Pause */ + err = mm_camcorder_pause(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_pause = %x\n", err); + return FALSE; + } + + sleep(3); + + /* Resume */ + err = mm_camcorder_record(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_record = %x\n", err); + return FALSE; + } + + sleep(3); + + /* Save file */ + err = mm_camcorder_commit(hcam); + if (err < 0) + { + printf("Fail to call mm_camcorder_commit = %x\n", err); + return FALSE; + } + + return TRUE; +} + + +static gboolean get_state_of_camcorder() +{ + MMCamcorderStateType state; + + mm_camcorder_get_state(hcam, &state); + printf("Current status is %d\n", state); + + return TRUE; +} + + +static gboolean start_autofocus() +{ + int err; + char * err_attr_name = NULL; + + /* Set focus mode to 'AUTO' and scan range to 'AF Normal' */ + err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name, + MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO, + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NORMAL, + NULL); + + if (err < 0) + { + printf("Set attrs fail. (%s:%x)\n", err_attr_name, err); + if (err_attr_name) { + free(err_attr_name); + err_attr_name = NULL; + return FALSE; + } + } + + mm_camcorder_start_focusing(hcam); + printf("Waiting for adjusting focus\n"); + + /*Waiting for 'MM_MESSAGE_CAMCORDER_FOCUS_CHANGED' */ + sleep(3); + + return TRUE; +} + +static gboolean filename_setting() +{ + int err; + char * new_filename = "new_name.mp4"; + + /* camcorder attribute setting */ + err = mm_camcorder_set_attributes((MMHandleType)hcam, NULL, + MMCAM_TARGET_FILENAME, new_filename, strlen(new_filename), + NULL); + + printf("New file name (%s)\n", new_filename); + + sleep(3); + + return TRUE; +} + + +static gboolean set_video_stream_callback() +{ + mm_camcorder_set_video_stream_callback(hcam, (mm_camcorder_video_stream_callback)camcordertest_video_stream_cb, (void*)hcam); + + sleep(10); + + return TRUE; +} + + +/*--------------------------------------------------------------------------- +| APPFWK Functions: | +---------------------------------------------------------------------------*/ +int app_init(void *data) +{ + struct appdata *ad = data; + + printf("Function : %s", __func__); + + appcore_measure_start("app_init"); + + ad->win_main = appcore_efl_get_main_window(); + if(ad->win_main == NULL) { + printf("ad->win_main(%p)", ad->win_main); + return (-1); + } + + ad->evas = evas_object_evas_get(ad->win_main); + + ad->layout_main = appcore_efl_load_edj(ad->win_main, "/usr/share/edje/cam_testsuite.edj", "main"); + if(ad->layout_main == NULL) { + printf("ad->layout_main(%p)", ad->layout_main); + return (-1); + } + +// appcore_set_font_name(_("vera")); + + + evas_object_layer_set(ad->win_main, 0); + + evas_object_move(ad->win_main, 0, 0); + evas_object_resize(ad->win_main, 800, 480); + + elm_win_rotation_set(ad->win_main, 270); + elm_win_fullscreen_set(ad->win_main, 1); + + evas_object_color_set(ad->win_main, 0,0,0,0); + elm_win_transparent_set(ad->win_main, 1); + + if(!(ad->xid)) + { + if(ad->win_main ) + ad->xid = elm_win_xwindow_get(ad->win_main); + } + + evas_object_show(ad->win_main); + + // + { + int bret; + bret = mode_change(); + + if(!bret) + { + printf("\t mode_change() fail. Exit from the application.\n"); + } + menu(); + } + appcore_measure_time("app_init"); + + return 0; +} + + +int app_exit(void *data) +{ + printf("Function : %s", __func__); + + return 0; +} + + +int app_start(void *data) +{ + printf("Function : %s", __func__); + + appcore_measure_start("app_start"); + + appcore_measure_time("app_start"); + + return 0; +} + + +int app_stop(void *data) +{ + printf("Function : %s", __func__); + + appcore_measure_start("app_stop"); + + appcore_measure_time("app_stop"); + + return 0; +} + + +static int app_procedure(int event, void *event_param, void *user_param) { + switch (event) { + case APPCORE_EVENT_CREATE: // initialize and create first view + { + app_init(user_param); + return 1; + } + + case APPCORE_EVENT_START: // if necessary to speed up launching time, add deferred initialization which is not relevant to first view's drawing + { + app_start(user_param); + return 1; + } + + case APPCORE_EVENT_STOP: // add necessary code when a multi-tasking supported application enters from the FG (on the TOP of screen) to the BG (on the LOW of screen) + { + app_stop(user_param); // // this event is received when a multi-tasking supported application enters from top screen to background if user clicks "HOME" key + return 1; + } + + case APPCORE_EVENT_RESUME: // add necessary code when a multi-tasking supported application enters from the BG (on the LOW of screen) to the FG (on the TOP of screen) + { +// app_resume(user_param); + return 1; + } + case APPCORE_EVENT_TERMINATE: // free allocated resources before application exits + { + app_exit(user_param); + return 1; + } + case APPCORE_EVENT_LOW_BATTERY: // free allocated resources before application exits + { + return 1; /* 1 means this event is processed in user, 0 or -1 means this event is processed with system default behavior(application terminate) */ + } + case APPCORE_EVENT_LANG_CHANGE: // update internalization according to language change + { + return 1; + } + default: + break; + } + return 0; + +} + + +int idler_exit_cb(void *data) +{ +// ecore_x_window_hide(ad->xid); + elm_exit(); + + return 0; +} + + +static inline void flush_stdin() +{ + int ch; + while((ch=getchar()) != EOF && ch != '\n'); +} + + +static void menu() +{ + int mode = 0; + int err = 0; + //Get mode of camcorder + err = mm_camcorder_get_attributes(hcam, NULL, + MMCAM_MODE, &mode, + NULL); + + if (mode == MM_CAMCORDER_MODE_IMAGE) + { + printf("\nmm-camcorder Sample Application\n"); + printf("\t=======================================\n"); + printf("\t '1' Capture image \n"); + printf("\t '5' Get state \n"); + printf("\t '6' Start Auto-focus \n"); + printf("\t '8' Set video stream callback \n"); + printf("\t 'b' back.\n"); + printf("\t=======================================\n"); + } + else if (mode == MM_CAMCORDER_MODE_VIDEO) + { + printf("\nmm-camcorder Sample Application\n"); + printf("\t=======================================\n"); + printf("\t '2' Record and Save video file \n"); + printf("\t '3' Record and Cancel video file \n"); + printf("\t '4' Record, Pause and Resume recording \n"); + printf("\t '5' Get state \n"); + printf("\t '6' Start Auto-focus \n"); + printf("\t '7' Filename setting(only for recording) \n"); + printf("\t 'b' back.\n"); + printf("\t=======================================\n"); + } + else + { + printf("\nmm-camcorder Sample Application\n"); + printf("\t=======================================\n"); + printf("\t '2' Record and Save video file \n"); + printf("\t '3' Record and Cancel video file \n"); + printf("\t '4' Record, Pause and Resume recording \n"); + printf("\t '5' Get state \n"); + printf("\t '7' Filename setting(only for recording) \n"); + printf("\t 'b' back.\n"); + printf("\t=======================================\n"); + } + + return; +} + + +static gboolean mode_change() +{ + char media_type = '\0'; + bool check= FALSE; + + while(!check) + { + printf("\t=============================\n"); + printf("\t 'i' Image.\n"); + printf("\t 'v' Video.\n"); + printf("\t 'a' Audio.\n"); + printf("\t 'q' Exit.\n"); + printf("\t=============================\n"); + printf("\t Enter the media type:\n\t"); + + while ((media_type=getchar()) == '\n'); + + switch(media_type) + { + case 'i': + printf("\t=============image================\n"); + + if (!initialize_image_capture()) + { + printf("Fail to call initialize_image_capture\n"); + goto _EXIT; + } + check = TRUE; + break; + case 'v': + printf("\t=============video================\n"); + + if (!initialize_video_capture()) + { + printf("Fail to call initialize_video_capture\n"); + goto _EXIT; + } + check = TRUE; + break; + case 'a': + printf("\t==============audio===============\n"); + + if (!initialize_audio_capture()) + { + printf("Fail to call initialize_audio_capture\n"); + goto _EXIT; + } + + check = TRUE; + break; + case 'q': + printf("\t Quit Camcorder Sample Code!!\n"); + goto _EXIT; + default: + printf("\t Invalid media type(%d)\n", media_type); + continue; + } + } + + ecore_x_sync(); + + return TRUE; + +_EXIT: + ecore_timer_add(0.1, idler_exit_cb, NULL); + return FALSE; +} + + +static void command(gchar buf) +{ + switch(buf) + { + case '1' : // Capture image + { + capturing_picture(); + } + break; + case '2' : // Record and Save video file + { + record_and_save_video_file(); + } + break; + case '3' : // Record and Cancel video file + { + record_and_cancel_video_file(); + } + break; + case '4' : // Record, Pause and Resume recording + { + record_pause_and_resume_recording(); + } + break; + case '5' : // Get state + { + get_state_of_camcorder(); + } + break; + case '6' : // Start Auto-focus + { + start_autofocus(); + } + break; + case '7' : // Filename setting(only for recording) + { + filename_setting(); + } + break; + case '8' : // Set video stream callback + { + set_video_stream_callback(); + } + break; + case 'b' : // back + if (!uninitialize_camcorder()) + { + printf("Fail to call uninitialize_camcorder\n"); + return; + } + + mode_change(); + break; + default: + printf("\t Invalid input \n"); + break; + } + +} + + +static gboolean cmd_input(GIOChannel *channel) +{ + gchar buf[256]; + gsize read; + + g_io_channel_read(channel, buf, MAX_STRING_LEN, &read); + buf[read] = '\0'; + g_strstrip(buf); + + command(buf[0]); + + menu(); + return TRUE; +} + + +int main(int argc, char **argv) +{ + int bret = 0; + if (!g_thread_supported ()) + g_thread_init (NULL); + + stdin_channel = g_io_channel_unix_new (0);/* read from stdin */ + g_io_add_watch (stdin_channel, G_IO_IN, (GIOFunc)cmd_input, NULL); + + appcore_measure_link_load_time("camera", NULL); + + memset(&ad, 0x0, sizeof(struct appdata)); + + bret = appcore_efl_main("camera", argc, argv, app_procedure, 0, &ad /* user_param, if needed */ ); + + printf("Main loop quit\n"); + + printf("\t Exit from the application.\n"); + + return 0; +} + + +/*EOF*/ diff --git a/test/mm_camcorder_testsuite.c b/test/mm_camcorder_testsuite.c index 57e7eb6..f1362ee 100644 --- a/test/mm_camcorder_testsuite.c +++ b/test/mm_camcorder_testsuite.c @@ -140,7 +140,7 @@ static GTimer *timer = NULL; #define IMAGE_ENC_QUALITY 85 // quality of jpeg #define IMAGE_CAPTURE_COUNT_STILL 1 // the number of still-shot #define IMAGE_CAPTURE_COUNT_MULTI 3 // default the number of multi-shot -#define IMAGE_CAPTURE_COUNT_INTERVAL 500 // mili seconds +#define IMAGE_CAPTURE_COUNT_INTERVAL 100 // mili seconds #define MAX_FILE_SIZE_FOR_MMS (250 * 1024) @@ -162,8 +162,9 @@ static GTimer *timer = NULL; #define AUDIO_SOURCE_FORMAT MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE #define AUDIO_SOURCE_CHANNEL_AAC 2 #define AUDIO_SOURCE_CHANNEL_AMR 1 +#define VIDEO_ENCODE_BITRATE 3000000 /* bps */ -#define DEFAULT_CAM_DEVICE MM_VIDEO_DEVICE_CAMERA1 +#define DEFAULT_CAM_DEVICE MM_VIDEO_DEVICE_CAMERA1 /* * D E B U G M E S S A G E @@ -224,15 +225,15 @@ GTimeVal result; * Enumerations for command */ #define SENSOR_WHITEBALANCE_NUM 10 -#define SENSOR_COLOR_TONE_NUM 27 -#define SENSOR_FLIP_NUM 3 +#define SENSOR_COLOR_TONE_NUM 27 +#define SENSOR_FLIP_NUM 3 #define SENSOR_PROGRAM_MODE_NUM 15 -#define SENSOR_FOCUS_NUM 5 -#define SENSOR_INPUT_ROTATION 6 -#define SENSOR_AF_SCAN_NUM 4 -#define SENSOR_ISO_NUM 8 -#define SENSOR_EXPOSURE_NUM 9 -#define SENSOR_IMAGE_FORMAT 9 +#define SENSOR_FOCUS_NUM 6 +#define SENSOR_INPUT_ROTATION 4 +#define SENSOR_AF_SCAN_NUM 4 +#define SENSOR_ISO_NUM 8 +#define SENSOR_EXPOSURE_NUM 9 +#define SENSOR_IMAGE_FORMAT 9 /*--------------------------------------------------------------------------- @@ -253,21 +254,21 @@ enum MENU_STATE_NUM, }; -/*--------------------------------------------------------------------------- -| LOCAL DATA TYPE DEFINITIONS: | ----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------- +| LOCAL DATA TYPE DEFINITIONS: | +-----------------------------------------------------------------------*/ typedef struct _cam_handle { MMHandleType camcorder; - int mode; /* image(capture)/video(recording) mode */ - bool isMultishot; - int stillshot_count; /* total stillshot count */ - int multishot_count; /* total multishot count */ - char *stillshot_filename; /* stored filename of stillshot */ - char *multishot_filename; /* stored filename of multishot */ - int menu_state; - int fps; - bool isMute; + int mode; /* image(capture)/video(recording) mode */ + bool isMultishot; /* flag for multishot mode */ + int stillshot_count; /* total stillshot count */ + int multishot_count; /* total multishot count */ + char *stillshot_filename; /* stored filename of stillshot */ + char *multishot_filename; /* stored filename of multishot */ + int menu_state; + int fps; + bool isMute; unsigned int elapsed_time; } cam_handle_t; @@ -356,6 +357,7 @@ char *focus_mode[SENSOR_FOCUS_NUM] = { "Auto", "Manual", "Touch Auto", + "Continuous Auto", }; char *camera_rotation[SENSOR_INPUT_ROTATION] = { @@ -363,8 +365,6 @@ char *camera_rotation[SENSOR_INPUT_ROTATION] = { "90", "180", "270", - "Flip Horizontal", - "Flip Vertical", }; char *af_scan[SENSOR_AF_SCAN_NUM] = { @@ -409,6 +409,17 @@ char *image_fmt[SENSOR_IMAGE_FORMAT] = { "YV12", }; +char *face_zoom_mode[] = { + "Face Zoom OFF", + "Face Zoom ON", +}; + +char *display_mode[] = { + "Default", + "Primary Video ON and Secondary Video Full Screen", + "Primary Video OFF and Secondary Video Full Screen", +}; + char *output_mode[] = { "Letter Box mode", "Original Size mode", @@ -422,8 +433,6 @@ char *rotate_mode[] = { "90", "180", "270", - "Flip Horizontal", - "Flip Vertical", }; char* strobe_mode[] = { @@ -448,6 +457,12 @@ char *wdr_mode[] = { "WDR AUTO", }; +char *hdr_mode[] = { + "HDR OFF", + "HDR ON", + "HDR ON and Original", +}; + char *ahs_mode[] = { "Anti-handshake OFF", "Anti-handshake ON", @@ -519,6 +534,7 @@ static int camcordertest_video_stream_cb(MMCamcorderVideoStreamDataType *stream, video_stream_cb_cnt++; printf("video_stream cb is called ( data:%p, format:%d, length:%d, width:%d, height:%d, timestamp:%d)\n", stream->data, stream->format, stream->length, stream->width, stream->height, stream->timestamp); } + return TRUE; } @@ -531,20 +547,19 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt FILE *fp = NULL; MMCamcorderCaptureDataType *scrnl = NULL; - debug_msg_t("hcamcorder->isMultishot=%d =>1: MULTI, 0: STILL",hcamcorder->isMultishot); - if (main == NULL) { warn_msg_t("Capture callback : Main image buffer is NULL!!!"); return FALSE; } - if (hcamcorder->isMultishot == TRUE) { - snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->multishot_filename,hcamcorder->multishot_count++); + if (hcamcorder->isMultishot) { + snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->multishot_filename,hcamcorder->multishot_count++); } else { - snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->stillshot_filename,hcamcorder->stillshot_count++); + snprintf(m_filename, CAPTURE_FILENAME_LEN, "%s%03d.jpg", hcamcorder->stillshot_filename,hcamcorder->stillshot_count++); } - debug_msg_t("filename : %s", m_filename); + debug_msg_t("hcamcorder->isMultishot=%d =>1: MULTI, 0: STILL, filename : %s", + hcamcorder->isMultishot, m_filename); if (main->format != MM_PIXEL_FORMAT_ENCODED) { unsigned int dst_size = 0; @@ -576,7 +591,8 @@ camcordertest_video_capture_cb(MMCamcorderCaptureDataType *main, MMCamcorderCapt free(dst); dst = NULL; - } else { + } else if (!hcamcorder->isMultishot) { + printf("MM_PIXEL_FORMAT_ENCODED main->data=%p main->length=%d, main->width=%d, main->heigtht=%d \n", main->data, main->length, main->width, main->height); @@ -658,16 +674,8 @@ static gboolean test_idle_capture_start() { int err; - if (!hcamcorder->isMultishot) - { - camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_ENCODED); - camcordertest_set_attr_int(MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG); - } - else - { -// camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_I420); - camcordertest_set_attr_int("capture-format", MM_PIXEL_FORMAT_YUYV); - } + camcordertest_set_attr_int(MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED); + camcordertest_set_attr_int(MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG); g_timer_reset(timer); err = mm_camcorder_capture_start(hcamcorder->camcorder); @@ -756,24 +764,21 @@ int camcordertest_get_attr_valid_intarray(char * attr_name, int ** array, int *c { if (hcamcorder->camcorder) { - debug_msg_t("camcordertest_get_attr_valid_intarray((%s),(%p, %p))", attr_name, array, count); + debug_msg_t("camcordertest_get_attr_valid_intarray(%s)", attr_name); err = mm_camcorder_get_attribute_info(hcamcorder->camcorder, attr_name, &info); - - if (err < 0) - { - err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!", err); + if (err != MM_ERROR_NONE) { + err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!", err); return FALSE; - } - else - { - if (info.type == MM_CAM_ATTRS_TYPE_INT) - if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY) - { + } else { + if (info.type == MM_CAM_ATTRS_TYPE_INT) { + if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY) { *array = info.int_array.array; *count = info.int_array.count; + debug_msg_t("INT ARRAY - default value : %d", info.int_array.def); return TRUE; } + } err_msg_t("camcordertest_get_attr_valid_intarray : Type mismatched!!"); return FALSE; @@ -797,24 +802,21 @@ int camcordertest_get_attr_valid_intrange(char * attr_name, int *min, int *max) { if (hcamcorder->camcorder) { - debug_msg_t("camcordertest_get_attr_valid_intarray((%s),(%p, %p))", attr_name, min, max); + debug_msg_t("camcordertest_get_attr_valid_intrange(%s)", attr_name); err = mm_camcorder_get_attribute_info(hcamcorder->camcorder, attr_name, &info); - - if (err < 0) - { + if (err != MM_ERROR_NONE) { err_msg_t("camcordertest_get_attr_valid_intarray : Error(%x)!!", err); return FALSE; - } - else - { - if (info.type == MM_CAM_ATTRS_TYPE_INT) - if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE) - { + } else { + if (info.type == MM_CAM_ATTRS_TYPE_INT) { + if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_RANGE) { *min = info.int_range.min; *max = info.int_range.max; + debug_msg_t("INT RANGE - default : %d", info.int_range.def); return TRUE; } + } err_msg_t("camcordertest_get_attr_valid_intarray : Type mismatched!!"); return FALSE; @@ -874,11 +876,13 @@ static void print_menu() g_print("\t 'p' Pause Recording\n"); g_print("\t 'c' Cancel\n"); g_print("\t 's' Save\n"); + g_print("\t 'n' Capture video snapshot\n"); } else if(mmcamcorder_print_state == MM_CAMCORDER_STATE_PAUSED) { g_print("\t 'r' Resume Recording\n"); g_print("\t 'c' Cancel\n"); g_print("\t 's' Save\n"); + g_print("\t 'n' Capture video snapshot\n"); } g_print("\t=======================================\n"); } @@ -922,10 +926,12 @@ static void print_menu() g_print("\t '9' Shutter speed \n"); g_print("\t 'i' ISO \n"); g_print("\t 'r' Rotate camera input \n"); + g_print("\t 'f' Flip camera input \n"); g_print("\t 'j' Jpeg quality \n"); g_print("\t 'p' Picture format \n"); g_print("\t >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n"); g_print("\t 'v' Visible \n"); + g_print("\t 'n' Display mode \n"); g_print("\t 'o' Output mode \n"); g_print("\t 'y' Rotate display \n"); g_print("\t 'g' Brightness \n"); @@ -939,8 +945,8 @@ static void print_menu() g_print("\t 'e' EV program mode \n"); g_print("\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc.]\n"); g_print("\t 'z' Strobe (Flash) \n"); - g_print("\t 'x' Capture mode (Still/Multishot)\n"); - g_print("\t 'f' Face detection \n"); + g_print("\t 'x' Capture mode (Still/Multishot/HDR)\n"); + g_print("\t 'l' Face detection \n"); g_print("\t 'k' Anti-handshake \n"); g_print("\t 'u' Touch AF area \n"); g_print("\t 'm' Stream callback function \n"); @@ -962,9 +968,11 @@ static void print_menu() g_print("\t '8' F number \n"); g_print("\t 'i' ISO \n"); g_print("\t 'r' Rotate camera input \n"); + g_print("\t 'f' Flip camera input \n"); g_print("\t 'p' FPS \n"); g_print("\t >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n"); g_print("\t 'v' Visible \n"); + g_print("\t 'n' Display mode \n"); g_print("\t 'o' Output mode \n"); g_print("\t 'y' Rotate display \n"); g_print("\t 'g' Brightness \n"); @@ -976,7 +984,7 @@ static void print_menu() g_print("\t 't' Color tone \n"); g_print("\t 'd' WDR \n"); g_print("\t >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> [etc.]\n"); - g_print("\t 'x' High speed recording\n"); + g_print("\t 'x' Recording motion rate\n"); g_print("\t 'u' Mute \n"); g_print("\t 'z' Strobe (Flash) \n"); g_print("\t 'k' Anti-handshake \n"); @@ -1007,21 +1015,22 @@ static void main_menu(gchar buf) switch(buf) { case '1' : //Capture if(hcamcorder->isMultishot) { + int interval = 0; + flush_stdin(); + printf("\ninput interval(ms) \n"); + scanf("%d", &interval); err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAPTURE_WIDTH, 640, - MMCAM_CAPTURE_HEIGHT, 480, - MMCAM_CAPTURE_COUNT, multishot_num, - MMCAM_CAPTURE_INTERVAL, IMAGE_CAPTURE_COUNT_INTERVAL, - NULL); - if (err < 0) { + MMCAM_CAPTURE_INTERVAL, interval, + NULL); + if (err != MM_ERROR_NONE) { err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err); SAFE_FREE (err_attr_name); - } + } } else { err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL, - NULL); - if (err < 0) { + MMCAM_CAPTURE_COUNT, IMAGE_CAPTURE_COUNT_STILL, + NULL); + if (err != MM_ERROR_NONE) { err_msg_t("Attribute setting fail : (%s:%x)", err_attr_name, err); SAFE_FREE (err_attr_name); } @@ -1047,8 +1056,8 @@ static void main_menu(gchar buf) default: g_print("\t Invalid input \n"); - break; - } + break; + } } else if (hcamcorder->mode == MODE_VIDEO) { @@ -1071,8 +1080,6 @@ static void main_menu(gchar buf) MMCAM_CAMERA_AF_TOUCH_HEIGHT, 30, NULL ); - mm_camcorder_start_focusing(hcamcorder->camcorder); - g_timer_reset(timer); err = mm_camcorder_record(hcamcorder->camcorder); @@ -1145,6 +1152,10 @@ static void main_menu(gchar buf) mmcamcorder_print_state = MM_CAMCORDER_STATE_PREPARE; break; + case 'n' : /* Capture video snapshot */ + err = mm_camcorder_capture_start(hcamcorder->camcorder); + break; + default : g_print("\t Invalid input \n"); break; @@ -1244,13 +1255,13 @@ static void setting_menu(gchar buf) int min = 0; int max = 0; int width_count = 0; - int heigh_count = 0; + int height_count = 0; int i=0; int count = 0; int value = 0; int* array = NULL; int *width_array = NULL; - int *heigh_array = NULL; + int *height_array = NULL; char *err_attr_name = NULL; cam_xypair_t input_pair; int err = MM_ERROR_NONE; @@ -1263,12 +1274,31 @@ static void setting_menu(gchar buf) switch(buf) { /* Camera setting */ case '1' : // Setting > Capture Resolution setting + /* check recommend preview resolution */ + camcordertest_get_attr_valid_intarray(MMCAM_RECOMMEND_CAMERA_WIDTH, &width_array, &width_count); + camcordertest_get_attr_valid_intarray(MMCAM_RECOMMEND_CAMERA_HEIGHT, &height_array, &height_count); + if(width_count != height_count) { + err_msg_t("System has wrong information!!\n"); + } else if (width_count == 0) { + g_print("MMCAM_RECOMMEND_CAMERA_WIDTH/HEIGHT Not supported!!\n"); + } else { + g_print("\n - MMCAM_RECOMMEND_CAMERA_WIDTH and HEIGHT (count %d) -\n", width_count); + g_print("\t NORMAL ratio : %dx%d\n", + width_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL], height_array[MM_CAMCORDER_PREVIEW_TYPE_NORMAL]); + if (width_count >= 2) { + g_print("\t WIDE ratio : %dx%d\n\n", + width_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE], height_array[MM_CAMCORDER_PREVIEW_TYPE_WIDE]); + } else { + g_print("\t There is ONLY NORMAL resolution\n\n"); + } + } + g_print("*Select the resolution!\n"); camcordertest_get_attr_valid_intarray("capture-width", &width_array, &width_count); - camcordertest_get_attr_valid_intarray("capture-height", &heigh_array, &heigh_count); + camcordertest_get_attr_valid_intarray("capture-height", &height_array, &height_count); - if(width_count != heigh_count) { - err_msg_t("System has wrong information!!"); + if(width_count != height_count) { + err_msg_t("System has wrong information!!\n"); } else if (width_count == 0) { g_print("Not supported!!\n"); } else { @@ -1276,7 +1306,7 @@ static void setting_menu(gchar buf) flush_stdin(); for ( i = 0; i < width_count; i++) { - g_print("\t %d. %d*%d\n", i+1, width_array[i], heigh_array[i]); + g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]); } scanf("%d",&index); @@ -1285,7 +1315,7 @@ static void setting_menu(gchar buf) input_pair.attr_subcat_x = "capture-width"; input_pair.attr_subcat_y = "capture-height"; input_pair.x = width_array[index-1]; - input_pair.y = heigh_array[index-1]; + input_pair.y = height_array[index-1]; bret = camcordertest_set_attr_xypair(input_pair); } } @@ -1430,26 +1460,55 @@ static void setting_menu(gchar buf) break; case 'r' : // Setting > Rotate camera input when recording - g_print("*Rotate camera input when recording !\n"); - camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_ROTATION, &array, &count); + g_print("*Rotate camera input\n"); + camcordertest_get_attr_valid_intrange(MMCAM_CAMERA_ROTATION, &min, &max); - if(count <= 0) { + if(min >= max) { g_print("Not supported !! \n"); } else { - g_print("\n Select Rotate angle of camera \n"); flush_stdin(); - for ( i = 0; i < count; i++) { - g_print("\t %d. %s\n", array[i], camera_rotation[array[i]]); + for (i = min ; i <= max ; i++) { + g_print("\t %d. %s\n", i, camera_rotation[i]); } scanf("%d",&index); - bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index); CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); + bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index); CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); } break; + case 'f' : // Setting > Flip camera input + flush_stdin(); + g_print("*Flip camera input\n"); + g_print(" 1. Flip HORIZONTAL TRUE\n"); + g_print(" 2. Flip HORIZONTAL FALSE\n"); + g_print(" 3. Flip VERTICAL TRUE\n"); + g_print(" 4. Flip VERTICAL FALSE\n"); + + scanf("%d", &index); + + CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); + CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); + + switch (index) { + case 1: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_HORIZONTAL, TRUE); + break; + case 2: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_HORIZONTAL, FALSE); + break; + case 3: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_VERTICAL, TRUE); + break; + case 4: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_VERTICAL, FALSE); + break; + } + + CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); + CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); + break; + case 'j' : // Setting > Jpeg quality g_print("*Jpeg quality !\n"); camcordertest_get_attr_valid_intrange("image-encoder-quality", &min, &max); @@ -1503,6 +1562,23 @@ static void setting_menu(gchar buf) } break; + case 'n' : // Setting > Display mode + g_print("* Display mode!\n"); + camcordertest_get_attr_valid_intarray(MMCAM_DISPLAY_MODE, &array, &count); + + if (count <= 0 || count > 255) { + g_print("Not supported !! \n"); + } else { + flush_stdin(); + g_print("\n Select Display mode\n"); + for (i = 0 ; i < count ; i++) { + g_print("\t %d. %s\n", array[i], display_mode[array[i]]); + } + scanf("%d",&index); + bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, index); + } + break; + case 'o' : // Setting > Output mode g_print("* Output mode!\n"); camcordertest_get_attr_valid_intrange("display-geometry-method", &min, &max); @@ -1521,18 +1597,16 @@ static void setting_menu(gchar buf) break; case 'y' : // Setting > Rotate Display - camcordertest_get_attr_valid_intarray( MMCAM_DISPLAY_ROTATION, &array, &count ); + camcordertest_get_attr_valid_intrange(MMCAM_DISPLAY_ROTATION, &min, &max); - if( count <= 0 || count > 256 ) { + if( min > max ) { g_print("Not supported !! \n"); } else { flush_stdin(); - g_print("\n Select Rotation mode\n"); - for ( i = 0; i < count; i++) { - g_print("\t %d. %s\n", array[i], rotate_mode[array[i]]); - } + g_print("\n Select Rotate mode(%d ~ %d)\n", min, max); + g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t1. 270\n\n"); scanf("%d",&index); - bret = camcordertest_set_attr_int( MMCAM_DISPLAY_ROTATION, index ); + bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, index); } break; @@ -1695,15 +1769,20 @@ static void setting_menu(gchar buf) case 'x' : // Setting > Capture mode ,Muitishot? g_print("*Select Capture mode!\n"); flush_stdin(); - g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode \n"); + g_print(" \n\t1. Stillshot mode\n\t2. Multishot mode\n\t3. HDR capture\n"); scanf("%d",&index); - if(index == 1) { + switch (index) { + case 1: g_print("stillshot mode selected and capture callback is set!!!!\n"); hcamcorder->isMultishot = FALSE; - } else if (index == 2) { + camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0); + break; + case 2: g_print("Multilshot mode selected!!\n"); + camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, 0); + index = 0; min = 0; max = 0; @@ -1718,17 +1797,39 @@ static void setting_menu(gchar buf) scanf("%d",&index); if( index >= min && index <= max ) { multishot_num = index; + mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, + MMCAM_CAPTURE_COUNT, multishot_num, + NULL); hcamcorder->isMultishot = TRUE; } else { g_print("Wrong input value, Multishot setting failed!!\n"); } } - } else { + break; + case 3: + g_print("HDR Capture mode selected\n"); + hcamcorder->isMultishot = FALSE; + + camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_HDR_CAPTURE, &array, &count); + if(count <= 0) { + g_print("Not supported !! \n"); + } else { + g_print("\nSelect HDR capture mode\n"); + flush_stdin(); + for ( i = 0; i < count; i++) { + g_print("\t %d. %s\n", array[i], hdr_mode[array[i]]); + } + scanf("%d",&index); + bret = camcordertest_set_attr_int(MMCAM_CAMERA_HDR_CAPTURE, index); + } + break; + default: g_print("Wrong input, select again!!\n"); + break; } break; - case 'f' : // Setting > Face detection setting + case 'l' : // Setting > Face detection setting //hcamcorder->menu_state = MENU_STATE_SETTING_DETECTION; g_print("* Face detect mode !\n"); @@ -1812,7 +1913,27 @@ static void setting_menu(gchar buf) break; case 'm' : // Setting > Stream callback function - g_print("Not supported !! \n"); + g_print("\n Select Stream Callback Function\n"); + g_print("\t 1. Set Video Stream Callback \n"); + g_print("\t 2. Unset Video Stream Callback \n"); + flush_stdin(); + scanf("%d", &index); + if(index == 1) { + video_stream_cb_cnt = 0; + error_num = mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, (mm_camcorder_video_stream_callback)camcordertest_video_stream_cb, (void*)hcamcorder->camcorder); + if( error_num == MM_ERROR_NONE ) { + g_print("\n Setting Success\n"); + } else { + g_print("\n Setting Failure\n"); + } + } else if(index == 2) { + mm_camcorder_set_video_stream_callback(hcamcorder->camcorder, NULL, (void*)hcamcorder->camcorder); + video_stream_cb_cnt = 0; + audio_stream_cb_cnt = 0; + g_print("\n Unset stream callback success\n"); + } else { + g_print("\t Invalid input \n"); + } break; case 'b' : // back @@ -1833,9 +1954,9 @@ static void setting_menu(gchar buf) g_print("*Select resolution!\n"); camcordertest_get_attr_valid_intarray("camera-width", &width_array, &width_count); - camcordertest_get_attr_valid_intarray("camera-height", &heigh_array, &heigh_count); + camcordertest_get_attr_valid_intarray("camera-height", &height_array, &height_count); - if(width_count != heigh_count) { + if(width_count != height_count) { err_msg_t("System has wrong information!!"); } else if(width_count == 0) { g_print("Not supported !! \n"); @@ -1843,7 +1964,7 @@ static void setting_menu(gchar buf) g_print("\n Select the resolution \n"); flush_stdin(); for ( i = 0; i < width_count; i++) { - g_print("\t %d. %d*%d\n", i+1, width_array[i], heigh_array[i]); + g_print("\t %d. %d*%d\n", i+1, width_array[i], height_array[i]); } scanf("%d",&index); @@ -1856,7 +1977,7 @@ static void setting_menu(gchar buf) input_pair.attr_subcat_x = "camera-width"; input_pair.attr_subcat_y = "camera-height"; input_pair.x = width_array[index-1]; - input_pair.y = heigh_array[index-1]; + input_pair.y = height_array[index-1]; bret = camcordertest_set_attr_xypair(input_pair); @@ -1988,29 +2109,57 @@ static void setting_menu(gchar buf) break; case 'r' : // Setting > Rotate camera input when recording - g_print("*Rotate camera input !\n"); - camcordertest_get_attr_valid_intarray(MMCAM_CAMERA_ROTATION, &array, &count); + g_print("*Rotate camera input when recording !\n"); + camcordertest_get_attr_valid_intrange(MMCAM_CAMERA_ROTATION, &min, &max); - if(count <= 0) { + if(min > max) { g_print("Not supported !! \n"); } else { - g_print("\n Select Rotate angle of camera (Do Not use it for recording test !!) \n"); flush_stdin(); - for ( i = 0; i < count; i++) { - g_print("\t %d. %s\n", array[i], camera_rotation[array[i]]); + for (i = min ; i <= max ; i++) { + g_print("\t %d. %s\n", i, camera_rotation[i]); } scanf("%d",&index); - CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); - bret = camcordertest_set_attr_int(MMCAM_CAMERA_ROTATION, index); - CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); } break; + case 'f' : // Setting > Flip camera input + flush_stdin(); + g_print("*Flip camera input\n"); + g_print(" 1. Flip HORIZONTAL TRUE\n"); + g_print(" 2. Flip HORIZONTAL FALSE\n"); + g_print(" 3. Flip VERTICAL TRUE\n"); + g_print(" 4. Flip VERTICAL FALSE\n"); + + scanf("%d", &index); + + CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); + CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); + + switch (index) { + case 1: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_HORIZONTAL, TRUE); + break; + case 2: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_HORIZONTAL, FALSE); + break; + case 3: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_VERTICAL, TRUE); + break; + case 4: + camcordertest_set_attr_int(MMCAM_CAMERA_FLIP_VERTICAL, FALSE); + break; + } + + CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); + CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); + break; + case 'p' : // Setting > FPS g_print("* FPS !\n"); @@ -2061,6 +2210,23 @@ static void setting_menu(gchar buf) } break; + case 'n' : // Setting > Display mode + g_print("* Display mode!\n"); + camcordertest_get_attr_valid_intarray(MMCAM_DISPLAY_MODE, &array, &count); + + if (count <= 0 || count > 255) { + g_print("Not supported !! \n"); + } else { + flush_stdin(); + g_print("\n Select Display mode\n"); + for (i = 0 ; i < count ; i++) { + g_print( "%d. %s\n", i, display_mode[i] ); + } + scanf("%d",&index); + bret = camcordertest_set_attr_int(MMCAM_DISPLAY_MODE, index); + } + break; + case 'o' : // Setting > Output mode g_print("* Output mode!\n"); camcordertest_get_attr_valid_intrange("display-geometry-method", &min, &max); @@ -2079,18 +2245,16 @@ static void setting_menu(gchar buf) break; case 'y' : // Setting > Rotate Display - camcordertest_get_attr_valid_intarray( MMCAM_DISPLAY_ROTATION, &array, &count ); + camcordertest_get_attr_valid_intrange(MMCAM_DISPLAY_ROTATION, &min, &max); - if( count <= 0 || count > 256 ) { + if( min > max ) { g_print("Not supported !! \n"); } else { flush_stdin(); - g_print("\n Select Rotation mode\n"); - for ( i = 0; i < count; i++) { - g_print("\t %d. %s\n", array[i], rotate_mode[array[i]]); - } + g_print("\n Select Rotate mode(%d ~ %d)\n", min, max); + g_print("\t0. 0\n\t1. 90\n\t2. 180\n\t1. 270\n\n"); scanf("%d",&index); - bret = camcordertest_set_attr_int( MMCAM_DISPLAY_ROTATION, index ); + bret = camcordertest_set_attr_int(MMCAM_DISPLAY_ROTATION, index); } break; @@ -2217,66 +2381,25 @@ static void setting_menu(gchar buf) break; /* ext. setting */ - case 'x' : // Setting > High Speed + case 'x' : // Setting > Recording motion rate { - static int backup_width = 0; - static int backup_height = 0; + double set_rate; - g_print("\n Select High Speed Recording mode\n"); - g_print("\t 1. High Speed Recording mode ON\n"); - g_print("\t 2. High Speed Recording mode OFF \n"); + g_print("\n Set Recording motion rate (double, should be bigger than zero)\n"); flush_stdin(); - scanf("%d",&index); - if (index == 1) { - mm_camcorder_get_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAMERA_WIDTH, &backup_width, - MMCAM_CAMERA_HEIGHT, &backup_height, - NULL); - - CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); + scanf("%lf", &set_rate); + if (set_rate > 0) { err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAMERA_WIDTH, 320, - MMCAM_CAMERA_HEIGHT, 240, - MMCAM_CAMERA_FPS, 120, - "camera-slow-motion-fps", 30, + MMCAM_CAMERA_RECORDING_MOTION_RATE, set_rate, NULL); if (err != MM_ERROR_NONE) { - warn_msg_t("High speed recording. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err); + warn_msg_t("Recording motion rate. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err); SAFE_FREE(err_attr_name); } - CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); - - } else if(index == 2) { - CHECK_MM_ERROR(mm_camcorder_stop(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_unrealize(hcamcorder->camcorder)); - - if (backup_width && backup_height) { - err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAMERA_WIDTH, backup_width, - MMCAM_CAMERA_HEIGHT, backup_height, - NULL); - if (err != MM_ERROR_NONE) { - warn_msg_t("get_attributes fail. (%s:%x)", err_attr_name, err); - SAFE_FREE (err_attr_name); - } - } - - err = mm_camcorder_set_attributes(hcamcorder->camcorder, &err_attr_name, - MMCAM_CAMERA_FPS, SRC_VIDEO_FRAME_RATE_30, - "camera-slow-motion-fps", 0, - NULL); - if (err != MM_ERROR_NONE) { - warn_msg_t("Normal speed recording. mm_camcorder_set_attributes fail. (%s:%x)", err_attr_name, err); - SAFE_FREE (err_attr_name); - } - - CHECK_MM_ERROR(mm_camcorder_realize(hcamcorder->camcorder)); - CHECK_MM_ERROR(mm_camcorder_start(hcamcorder->camcorder)); + g_print("\tset recording motion rate %lf\n", set_rate); } else { g_print("Wrong input, Try again!!\n"); } @@ -2526,7 +2649,6 @@ static gboolean init(int type) "tag-gps-time-stamp", 72815.5436243543, "tag-gps-date-stamp", "2010:09:20", 10, "tag-gps-processing-method", "GPS NETWORK HYBRID ARE ALL FINE.", 32, - "capture-sound-enable", TRUE, NULL ); if (err != MM_ERROR_NONE) { @@ -2552,18 +2674,19 @@ static gboolean init(int type) err = mm_camcorder_set_attributes( (MMHandleType)cam_handle, &err_attr_name, MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO, MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC, - MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR, - MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_H264, + MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC, + MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_MPEG4, + MMCAM_VIDEO_ENCODER_BITRATE, VIDEO_ENCODE_BITRATE, MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP, MMCAM_CAMERA_FORMAT, preview_format, MMCAM_CAMERA_FPS, SRC_VIDEO_FRAME_RATE_30, MMCAM_CAMERA_FPS_AUTO, 0, "camera-delay-attr-setting", TRUE, MMCAM_CAMERA_ROTATION, MM_VIDEO_INPUT_ROTATION_NONE, - MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AMR, + MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AAC, MMCAM_AUDIO_FORMAT, AUDIO_SOURCE_FORMAT, - MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AMR, - MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL, + MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AAC, + //MMCAM_AUDIO_DISABLE, TRUE, MMCAM_TAG_ENABLE, 1, MMCAM_TAG_LATITUDE, 37.25796666, MMCAM_TAG_LONGITUDE, 127.05332222, @@ -2576,7 +2699,7 @@ static gboolean init(int type) MMCAM_DISPLAY_RECT_HEIGHT, 640, MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270, MMCAM_TARGET_FILENAME, TARGET_FILENAME_VIDEO, size, - "capture-sound-enable", TRUE, + MMCAM_TARGET_TIME_LIMIT, 360000, NULL ); if (err != MM_ERROR_NONE) { @@ -2584,6 +2707,8 @@ static gboolean init(int type) SAFE_FREE (err_attr_name); goto ERROR; } + + mm_camcorder_set_video_capture_callback(hcamcorder->camcorder, (mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, hcamcorder); // mm_camcorder_set_audio_stream_callback(hcamcorder->camcorder, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcamcorder->camcorder); } @@ -2598,18 +2723,16 @@ static gboolean init(int type) err = mm_camcorder_set_attributes( hcamcorder->camcorder, &err_attr_name, MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO, MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC, - MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR, - MMCAM_FILE_FORMAT, MM_FILE_FORMAT_AMR, - MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AMR, + MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC, + MMCAM_FILE_FORMAT, MM_FILE_FORMAT_AAC, + MMCAM_AUDIO_SAMPLERATE, AUDIO_SOURCE_SAMPLERATE_AAC, MMCAM_AUDIO_FORMAT, AUDIO_SOURCE_FORMAT, - MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AMR, - MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL, + MMCAM_AUDIO_CHANNEL, AUDIO_SOURCE_CHANNEL_AAC, MMCAM_TARGET_FILENAME, TARGET_FILENAME_AUDIO, size, MMCAM_TARGET_TIME_LIMIT, 360000, NULL); - if (err < 0) - { + if (err < 0) { warn_msg_t("Init fail. (%s:%x)", err_attr_name, err); SAFE_FREE (err_attr_name); goto ERROR; @@ -2682,16 +2805,12 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param) { if (hcamcorder->mode == MODE_IMAGE) { - time_msg_t("Stillshot capture : %12.6lf s", g_timer_elapsed(timer, NULL)); - - g_print("*******************************************************\n"); - g_print("[Camcorder Testsuite] Camcorder Stillshot Captured!!\n"); - g_print("*******************************************************\n"); + time_msg_t("Stillshot capture : %12.6lf s", g_timer_elapsed(timer, NULL)); if (hcamcorder->isMultishot) //multishot { - g_print("[CamcorderApp] Camcorder Captured(Capture Count=%d)\n", param->code); - + //g_print("[CamcorderApp] Camcorder Captured(Capture Count=%d)\n", param->code); + if (param->code >= multishot_num) { get_me_out(); @@ -2751,7 +2870,7 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param) temp_time = elapsed % 3600; minute = temp_time / 60; second = temp_time % 60; - debug_msg_t("Current Time - %d:%d:%d", hour, minute, second); + debug_msg_t("Current Time - %d:%d:%d, remained %u ms", hour, minute, second, param->recording_status.remained_time); } } break; @@ -2790,6 +2909,47 @@ static gboolean msg_callback(int message, void *msg_param, void *user_param) g_print( "Focus State changed. State:[%d]\n", param->code ); } break; + case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO: + { + static int info_count = 0; + MMCamFaceDetectInfo *cam_fd_info = NULL; + + cam_fd_info = (MMCamFaceDetectInfo *)(param->data); + + if (cam_fd_info) { + int i = 0; + + g_print("\tface detect num %d, pointer %p\n", cam_fd_info->num_of_faces, cam_fd_info); + + for (i = 0 ; i < cam_fd_info->num_of_faces ; i++) { + g_print("\t\t[%2d][score %d] position %d,%d %dx%d\n", + cam_fd_info->face_info[i].id, + cam_fd_info->face_info[i].score, + cam_fd_info->face_info[i].rect.x, + cam_fd_info->face_info[i].rect.y, + cam_fd_info->face_info[i].rect.width, + cam_fd_info->face_info[i].rect.height); + } + + if (info_count == 0) { + mm_camcorder_set_attributes(hcamcorder->camcorder, NULL, + MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_ON, + MMCAM_CAMERA_FACE_ZOOM_X, cam_fd_info->face_info[0].rect.x + (cam_fd_info->face_info[0].rect.width>>1), + MMCAM_CAMERA_FACE_ZOOM_Y, cam_fd_info->face_info[0].rect.y + (cam_fd_info->face_info[0].rect.height>>1), + MMCAM_CAMERA_FACE_ZOOM_LEVEL, 0, + NULL); + info_count = 1; + g_print("\n\t##### START FACE ZOOM [%d,%d] #####\n", cam_fd_info->face_info[0].rect.x, cam_fd_info->face_info[0].rect.y); + } else if (info_count++ == 90) { + mm_camcorder_set_attributes(hcamcorder->camcorder, NULL, + MMCAM_CAMERA_FACE_ZOOM_MODE, MM_CAMCORDER_FACE_ZOOM_MODE_OFF, + NULL); + g_print("\n\t##### STOP FACE ZOOM #####\n"); + info_count = -60; + } + } + } + break; default: g_print("Message %x received\n", message); break; @@ -2985,6 +3145,18 @@ static gboolean mode_change() return -1; } + /* start focusing if TOUCH AUTO or AUTO mode*/ + { + int focus_mode; + mm_camcorder_get_attributes(hcamcorder->camcorder, NULL, + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + NULL); + if (focus_mode == MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO || + focus_mode == MM_CAMCORDER_FOCUS_MODE_AUTO) { + mm_camcorder_start_focusing(hcamcorder->camcorder); + } + } + g_get_current_time(¤t); timersub(¤t, &previous, &result); time_msg_t("Camera Starting Time : %ld.%lds", result.tv_sec, result.tv_usec); |