From: Younghwan Ahn Date: Wed, 29 Aug 2012 08:37:48 +0000 (+0900) Subject: 2.0 beta init X-Git-Tag: 2.0_alpha~1 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fmultimedia%2Fgst-plugins-ext0.10.git;a=commitdiff_plain;h=db1353b9eae09053197c1dcccdabd2ed0233a7cd 2.0 beta init --- diff --git a/Makefile.am b/Makefile.am index e15e0c5..3115751 100755 --- a/Makefile.am +++ b/Makefile.am @@ -5,10 +5,6 @@ aclocaldir = $(datadir)/aclocal SUBDIRS = common -if GST_EXT_USE_EXT_PIFFDEMUX -#SUBDIRS += piffdemux -endif - if GST_EXT_USE_EXT_ENCODEBIN SUBDIRS += encodebin endif @@ -45,10 +41,6 @@ endif DIST_SUBDIRS = common -if GST_EXT_USE_EXT_PIFFDEMUX -#DIST_SUBDIRS += piffdemux -endif - if GST_EXT_USE_EXT_ENCODEBIN DIST_SUBDIRS += encodebin endif diff --git a/compile b/compile deleted file mode 100755 index 1b1d232..0000000 --- a/compile +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2005-05-14.22 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program 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, 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. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: 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 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 ." - -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 /* 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 - - 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 - #include - - 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 - 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' /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 - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # 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 < -# include -#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 - 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 -# 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 < 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.h.in b/config.h.in deleted file mode 100644 index be0c437..0000000 --- a/config.h.in +++ /dev/null @@ -1,68 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define the version */ -#undef GST_PLUGIN_VERSION - -/* Define the release version */ -#undef GST_PLUGIN_VERSION_RELEASE - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION diff --git a/configure.ac b/configure.ac index e525018..316d441 100755 --- a/configure.ac +++ b/configure.ac @@ -305,18 +305,6 @@ AC_ARG_ENABLE(ext-audiotp, AC_HELP_STRING([--enable-ext-audiotp], [using audiotp [GST_EXT_USE_EXT_AUDIOTP=yes]) AM_CONDITIONAL(GST_EXT_USE_EXT_AUDIOTP, test "x$GST_EXT_USE_EXT_AUDIOTP" = "xyes") -dnl use ext-piffdemux -------------------------------------------------------------------------- -AC_ARG_ENABLE(ext-piffdemux, AC_HELP_STRING([--enable-ext-piffdemux], [using piffdemux]), -[ - case "${enableval}" in - yes) GST_EXT_USE_EXT_PIFFDEMUX=yes ;; - no) GST_EXT_USE_EXT_PIFFDEMUX=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-ext-piffdemux) ;; - esac - ], - [GST_EXT_USE_EXT_PIFFDEMUX=yes]) -AM_CONDITIONAL(GST_EXT_USE_EXT_PIFFDEMUX, test "x$GST_EXT_USE_EXT_PIFFDEMUX" = "xyes") - dnl use ext-ssdemux -------------------------------------------------------------------------- AC_ARG_ENABLE(ext-ssdemux, AC_HELP_STRING([--enable-ext-ssdemux], [using ssdemux]), [ @@ -348,8 +336,6 @@ drmsrc/Makefile drmsrc/src/Makefile audiotp/Makefile audiotp/src/Makefile -piffdemux/Makefile -piffdemux/src/Makefile ssdemux/Makefile ssdemux/src/Makefile ) diff --git a/piffdemux/Makefile.am b/piffdemux/Makefile.am deleted file mode 100755 index 308a09c..0000000 --- a/piffdemux/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src diff --git a/piffdemux/src/Makefile.am b/piffdemux/src/Makefile.am deleted file mode 100755 index c51b0a8..0000000 --- a/piffdemux/src/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ - -plugin_LTLIBRARIES = libgstpiff.la - -libgstpiffincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/ - -libgstpiff_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) - -libgstpiff_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) \ - -lgstriff-@GST_MAJORMINOR@ \ - -lgstaudio-@GST_MAJORMINOR@ \ - -lgsttag-@GST_MAJORMINOR@ \ - -lgstpbutils-@GST_MAJORMINOR@ \ - $(GST_BASE_LIBS) $(GST_LIBS) $(ZLIB_LIBS) - -libgstpiff_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS} - -libgstpiff_la_SOURCES = piff-plugin.c \ - piffdemux.c \ - piffdemux_types.c \ - piffdemux_dump.c - -libgstpiff_la_LIBTOOLFLAGS = --tag=disable-static - -noinst_HEADERS = \ - piffatomparser.h \ - piffdemux_types.h \ - piffdemux_dump.h \ - piffdemux_fourcc.h \ - piffpalette.h - -libgstpiffinclude_HEADERS = piffcommon.h - -Android.mk: Makefile.am $(BUILT_SOURCES) - androgenizer \ - -:PROJECT libgstpiff -:SHARED libgstpiff \ - -:TAGS eng debug \ - -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ - -:SOURCES $(libgstpiff_la_SOURCES) \ - -:CFLAGS $(DEFS) $(DEFAULT_INCLUDES) $(CPPFLAGS) $(libgstpiff_la_CFLAGS) \ - -:LDFLAGS $(libgstpiff_la_LDFLAGS) \ - $(libgstpiff_la_LIBADD) \ - -ldl \ - -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ - LOCAL_MODULE_PATH:='$$(TARGET_OUT)/lib/gstreamer-0.10' \ - > $@ diff --git a/piffdemux/src/piff-plugin.c b/piffdemux/src/piff-plugin.c deleted file mode 100755 index 8afff31..0000000 --- a/piffdemux/src/piff-plugin.c +++ /dev/null @@ -1,23 +0,0 @@ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -//#include "gst/gst-i18n-plugin.h" -#include "piffdemux.h" -#include - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "piffdemux", GST_RANK_PRIMARY, GST_TYPE_PIFFDEMUX)) - return FALSE; - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "piffdemux", - "ISO base media file format support (PIFF)", - plugin_init, VERSION, "Proprietary", "Samsung Electronics Co", "http://www.samsung.com"); diff --git a/piffdemux/src/piffatomparser.h b/piffdemux/src/piffatomparser.h deleted file mode 100755 index f90d5db..0000000 --- a/piffdemux/src/piffatomparser.h +++ /dev/null @@ -1,139 +0,0 @@ -/* GStreamer QuickTime atom parser - * Copyright (C) 2009 Tim-Philipp Müller - * Copyright (C) <2009> STEricsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef QT_ATOM_PARSER_H -#define QT_ATOM_PARSER_H - -#include - -/* our inlined version of GstByteReader */ - -static inline gboolean -piff_atom_parser_has_remaining (GstByteReader * parser, guint64 bytes_needed) -{ - return G_LIKELY (parser->size >= bytes_needed) && - G_LIKELY ((parser->size - bytes_needed) >= parser->byte); -} - -static inline gboolean -piff_atom_parser_has_chunks (GstByteReader * parser, guint32 n_chunks, - guint32 chunk_size) -{ - /* assumption: n_chunks and chunk_size are 32-bit, we cast to 64-bit here - * to avoid overflows, to handle e.g. (guint32)-1 * size correctly */ - return piff_atom_parser_has_remaining (parser, (guint64) n_chunks * chunk_size); -} - -static inline gboolean -piff_atom_parser_peek_sub (GstByteReader * parser, guint offset, guint size, - GstByteReader * sub) -{ - *sub = *parser; - - if (G_UNLIKELY (!gst_byte_reader_skip (sub, offset))) - return FALSE; - - return (gst_byte_reader_get_remaining (sub) >= size); -} - -static inline gboolean -piff_atom_parser_skipn_and_get_uint32 (GstByteReader * parser, - guint bytes_to_skip, guint32 * val) -{ - if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < (bytes_to_skip + 4))) - return FALSE; - - gst_byte_reader_skip_unchecked (parser, bytes_to_skip); - *val = gst_byte_reader_get_uint32_be_unchecked (parser); - return TRUE; -} - -/* off_size must be either 4 or 8 */ -static inline gboolean -piff_atom_parser_get_offset (GstByteReader * parser, guint off_size, - guint64 * val) -{ - if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < off_size)) - return FALSE; - - if (off_size == sizeof (guint64)) { - *val = gst_byte_reader_get_uint64_be_unchecked (parser); - } else { - *val = gst_byte_reader_get_uint32_be_unchecked (parser); - } - return TRUE; -} - -/* off_size must be either 4 or 8 */ -static inline guint64 -piff_atom_parser_get_offset_unchecked (GstByteReader * parser, guint off_size) -{ - if (off_size == sizeof (guint64)) { - return gst_byte_reader_get_uint64_be_unchecked (parser); - } else { - return gst_byte_reader_get_uint32_be_unchecked (parser); - } -} - -/* size must be from 1 to 4 */ -static inline guint32 -piff_atom_parser_get_uint_with_size_unchecked (GstByteReader * parser, - guint size) -{ - switch (size) { - case 1: - return gst_byte_reader_get_uint8_unchecked (parser); - case 2: - return gst_byte_reader_get_uint16_be_unchecked (parser); - case 3: - return gst_byte_reader_get_uint24_be_unchecked (parser); - case 4: - return gst_byte_reader_get_uint32_be_unchecked (parser); - default: - g_assert_not_reached (); - gst_byte_reader_skip_unchecked (parser, size); - break; - } - return 0; -} - -static inline gboolean -piff_atom_parser_get_fourcc (GstByteReader * parser, guint32 * fourcc) -{ - guint32 f_be; - - if (G_UNLIKELY (gst_byte_reader_get_remaining (parser) < 4)) - return FALSE; - - f_be = gst_byte_reader_get_uint32_be_unchecked (parser); - *fourcc = GUINT32_SWAP_LE_BE (f_be); - return TRUE; -} - -static inline guint32 -piff_atom_parser_get_fourcc_unchecked (GstByteReader * parser) -{ - guint32 fourcc; - - fourcc = gst_byte_reader_get_uint32_be_unchecked (parser); - return GUINT32_SWAP_LE_BE (fourcc); -} - -#endif /* QT_ATOM_PARSER_H */ diff --git a/piffdemux/src/piffcommon.h b/piffdemux/src/piffcommon.h deleted file mode 100755 index e24a19c..0000000 --- a/piffdemux/src/piffcommon.h +++ /dev/null @@ -1,29 +0,0 @@ - -#ifndef __GST_PIFFCOMMON_H__ -#define __GST_PIFFCOMMON_H__ - -G_BEGIN_DECLS - -typedef struct _piff_fragment_longtime_info_t -{ - guint64 ts; - guint64 duration; -}piff_fragment_longtime_info; - -typedef struct _piff_fragment_time_info_t -{ - guint32 ts; - guint32 duration; -}piff_fragment_time_info; - -typedef struct _live_param_t -{ - gboolean is_eos; /* is live session ended */ - guint count; /* fragment parameters count */ - gchar *media_type; - piff_fragment_time_info *info; - piff_fragment_longtime_info *long_info; -}piff_live_param_t; -G_END_DECLS - -#endif /* __GST_PIFFPALETTE_H__ */ diff --git a/piffdemux/src/piffdemux.c b/piffdemux/src/piffdemux.c deleted file mode 100755 index d8d78ce..0000000 --- a/piffdemux/src/piffdemux.c +++ /dev/null @@ -1,3083 +0,0 @@ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "piffdemux.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PIFF_DEFAULT_TRACKID -1 -#define PIFF_DEFAULT_FOURCC 0 -#define PIFF_DEFAULT_TIMESCALE 10000000 -#define PIFF_DEFAULT_DURATION -1 -#define PIFF_DEFAULT_START_TS 0 -#define PIFF_DEFAULT_START_TS 0 - -#define PIFF_DEFAULT_WIDTH 16 -#define PIFF_DEFAULT_HEIGHT 16 -#define PIFF_DEFAULT_BPS 16 - -#undef DEC_OUT_FRAME_DUMP - -#ifdef DEC_OUT_FRAME_DUMP -#include -FILE *piffdump = NULL; -#endif - -#define PIFFDEMUX_RB16(x) ((((const unsigned char*)(x))[0] << 8) | ((const unsigned char*)(x))[1]) -/* max. size considered 'sane' for non-mdat atoms */ -#define PIFFDEMUX_MAX_ATOM_SIZE (25*1024*1024) - -/* if the sample index is larger than this, something is likely wrong */ -#define PIFFDEMUX_MAX_SAMPLE_INDEX_SIZE (50*1024*1024) - -GST_DEBUG_CATEGORY (piffdemux_debug); - -typedef struct _PiffDemuxSegment PiffDemuxSegment; -typedef struct _PiffDemuxSample PiffDemuxSample; -typedef struct _PiffDemuxSubSampleEncryption PiffDemuxSubSampleEncryption; -typedef struct _PiffDemuxSubSampleEntryInfo PiffDemuxSubSampleEntryInfo; - -enum -{ - PROR_PIFF_0, - PROP_PIFF_MEDIA_CAPS, - PROP_PIFF_MEDIA_TIMESCALE, - PROP_PIFF_MEDIA_DURATION, - PROP_PIFF_MEDIA_START_TIMESTAMP, - PROP_PIFF_IS_LIVE, - PROP_PIFF_LOOKAHEAD_COUNT, - PROP_PIFF_AVG_FRAME_DUR, -}; - -enum -{ - SIGNAL_LIVE_PARAM, - LAST_SIGNAL -}; - -static guint gst_piffdemux_signals[LAST_SIGNAL] = { 0 }; - -struct _PiffDemuxSubSampleEntryInfo -{ - guint16 LenofClearData; - guint32 LenofEncryptData; -}; - -struct _PiffDemuxSubSampleEncryption -{ - guint16 n_entries; - PiffDemuxSubSampleEntryInfo *sub_entry; -}; - -struct _PiffDemuxSample -{ - guint32 size; - gint32 pts_offset; /* Add this value to timestamp to get the pts */ - guint64 offset; - guint64 timestamp; /* DTS In mov time */ - guint32 duration; /* In mov time */ - gboolean keyframe; /* TRUE when this packet is a keyframe */ - guint8 *iv; /* initialization vector for decryption*/ - PiffDemuxSubSampleEncryption *sub_encry; -}; - -/* timestamp is the DTS */ -#define PIFFSAMPLE_DTS(stream,sample) gst_util_uint64_scale ((sample)->timestamp,\ - GST_SECOND, (stream)->timescale) -/* timestamp + offset is the PTS */ -#define PIFFSAMPLE_PTS(stream,sample) gst_util_uint64_scale ((sample)->timestamp + \ - (sample)->pts_offset, GST_SECOND, (stream)->timescale) -/* timestamp + duration - dts is the duration */ -#define PIFFSAMPLE_DUR_DTS(stream,sample,dts) (gst_util_uint64_scale ((sample)->timestamp + \ - (sample)->duration, GST_SECOND, (stream)->timescale) - (dts)); -/* timestamp + offset + duration - pts is the duration */ -#define PIFFSAMPLE_DUR_PTS(stream,sample,pts) (gst_util_uint64_scale ((sample)->timestamp + \ - (sample)->pts_offset + (sample)->duration, GST_SECOND, (stream)->timescale) - (pts)); - -#define PIFFSAMPLE_KEYFRAME(stream,sample) ((sample)->keyframe); - -typedef char uuid_t[16]; - -static const uuid_t tfxd_uuid = { 0x6d, 0x1d, 0x9b, 0x05, - 0x42, 0xd5, 0x44, 0xe6, - 0x80, 0xe2, 0x14, 0x1d, - 0xaf, 0xf7, 0x57, 0xb2 }; - -static const uuid_t tfrf_uuid = { 0xd4, 0x80, 0x7e, 0xf2, - 0xca, 0x39, 0x46, 0x95, - 0x8e, 0x54, 0x26, 0xcb, - 0x9e, 0x46, 0xa7, 0x9f }; - -static const uuid_t encrypt_uuid = { 0xa2, 0x39, 0x4f, 0x52, - 0x5a, 0x9b, 0x4f, 0x14, - 0xa2, 0x44, 0x6c, 0x42, - 0x7c, 0x64, 0x8d, 0xf4 }; - -#define SE_OVERRIDE_TE_FLAGS 0x000001 -#define SE_USE_SUBSAMPLE_ENCRYPTION 0x000002 - -typedef enum -{ - UUID_UNKNOWN = -1, - UUID_TFXD, - UUID_TFRF, - UUID_SAMPLE_ENCRYPT, -}uuid_type_t; - -struct _PiffDemuxSegment -{ - /* global time and duration, all gst time */ - guint64 time; - guint64 stop_time; - guint64 duration; - /* media time of trak, all gst time */ - guint64 media_start; - guint64 media_stop; - gdouble rate; -}; - - -struct _PiffDemuxStream -{ - /* stream type */ - guint32 subtype; - GstCaps *caps; - guint32 fourcc; - - /* duration/scale */ - guint64 duration; /* in timescale */ - guint32 timescale; - - /* our samples */ - guint32 n_samples; - PiffDemuxSample *samples; - guint32 min_duration; /* duration in timescale of first sample, used for figuring out - the framerate, in timescale units */ - - /* if we use chunks or samples */ - gboolean sampled; - guint padding; - - /* when a discontinuity is pending */ - gboolean discont; - - /* list of buffers to push first */ - GSList *buffers; - - /* buffer needs some custom processing, e.g. subtitles */ - gboolean need_process; - - /* current position */ - guint32 segment_index; - guint32 sample_index; - guint64 time_position; /* in gst time */ - - /* the Gst segment we are processing out, used for clipping */ - GstSegment segment; - - /* last GstFlowReturn */ - GstFlowReturn last_ret; - - - /* quicktime segments */ - guint32 n_segments; - PiffDemuxSegment *segments; - guint32 from_sample; - guint32 to_sample; - - gboolean sent_eos; - GstTagList *pending_tags; - gboolean send_global_tags; - - GstEvent *pending_event; - - gboolean sent_nsevent; - - guint64 start_ts; - - guint64 avg_dur; /* average frame duration */ -}; - - -enum PiffDemuxState -{ - PIFFDEMUX_STATE_INITIAL, /* Initial state (haven't got the header yet) */ - PIFFDEMUX_STATE_HEADER, /* Parsing the header */ - PIFFDEMUX_STATE_MOVIE, /* Parsing/Playing the media data */ - PIFFDEMUX_STATE_BUFFER_MDAT /* Buffering the mdat atom */ -}; - - -static GNode *piffdemux_tree_get_child_by_type (GNode * node, guint32 fourcc); -static GNode *piffdemux_tree_get_child_by_type_full (GNode * node, - guint32 fourcc, GstByteReader * parser); -static GNode *piffdemux_tree_get_sibling_by_type (GNode * node, guint32 fourcc); -static GNode *piffdemux_tree_get_sibling_by_type_full (GNode * node, - guint32 fourcc, GstByteReader * parser); - -static GstStaticPadTemplate gst_piffdemux_sink_template = - GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("application/x-piff") - ); - -static GstStaticPadTemplate gst_piffdemux_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -GST_BOILERPLATE (GstPiffDemux, gst_piffdemux, GstPiffDemux, GST_TYPE_ELEMENT); - -static void gst_piffdemux_dispose (GObject * object); - -static GstStateChangeReturn gst_piffdemux_change_state (GstElement * element, - GstStateChange transition); -static void -gst_piffdemux_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void -gst_piffdemux_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static GstFlowReturn gst_piffdemux_chain (GstPad * sinkpad, GstBuffer * inbuf); -static gboolean gst_piffdemux_handle_sink_event (GstPad * pad, GstEvent * event); -static gboolean piffdemux_parse_node (GstPiffDemux * piffdemux, GNode * node, const guint8 * buffer, guint length); -static gboolean piffdemux_parse_sample_encryption(GstPiffDemux * piffdemux, GstByteReader *sample_encrypt, PiffDemuxStream * stream); -static gboolean piffdemux_parse_mfhd (GstPiffDemux * piffdemux, GstByteReader * mfhd); -static gboolean gst_piffdemux_handle_src_event (GstPad * pad, GstEvent * event); -static const GstQueryType *gst_piffdemux_get_src_query_types (GstPad * pad); -static gboolean gst_piffdemux_handle_src_query (GstPad * pad, GstQuery * query); - - -static gboolean -ConvertH264_MetaDCI_to_3GPPDCI(unsigned char *dci_meta_buf, unsigned int dci_meta_size, unsigned char **dci_3gpp_buf, unsigned int *dci_3gpp_size); -void -__gst_piffdemux_marshal_BOOLEAN__OBJECT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data); - -static void -gst_piffdemux_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_piffdemux_sink_template)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_piffdemux_src_template)); - gst_element_class_set_details_simple (element_class, "PIFF demuxer", - "Codec/Parser", - "Parser for PIFF file format", - "naveen ch "); - - GST_DEBUG_CATEGORY_INIT (piffdemux_debug, "piffdemux", 0, "piffdemux plugin"); -} - -static void -gst_piffdemux_class_init (GstPiffDemuxClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->dispose = gst_piffdemux_dispose; - gobject_class->set_property = gst_piffdemux_set_property; - gobject_class->get_property = gst_piffdemux_get_property; - - gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_piffdemux_change_state); - - g_object_class_install_property (gobject_class, PROP_PIFF_MEDIA_CAPS, - g_param_spec_boxed ("caps", "Caps", - "The allowed caps for the src pad", GST_TYPE_CAPS, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - /* timescale of media to be set by application */ - g_object_class_install_property (gobject_class, PROP_PIFF_MEDIA_TIMESCALE, - g_param_spec_uint64 ("timescale", "media timescale", - "media timescale in PIFF Manifest", 0, G_MAXUINT64, - PIFF_DEFAULT_TIMESCALE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_PIFF_MEDIA_DURATION, - g_param_spec_int64 ("duration", "Duration of media", - "Total duration of the content", -1, G_MAXINT64, - PIFF_DEFAULT_DURATION, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_PIFF_MEDIA_START_TIMESTAMP, - g_param_spec_uint64 ("start-ts", "expected start timestamp", - "expected start timestamp to avoid reset", 0, G_MAXUINT64, - PIFF_DEFAULT_START_TS, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_PIFF_IS_LIVE, - g_param_spec_boolean ("is-live", "Is presentation is Live or VOD", - "If Presentation is Live (true) else VOD (false)", - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_PIFF_LOOKAHEAD_COUNT, - g_param_spec_uint ("lookahead-count", "Lookahead count value", - "Look ahead count used in case of Live presentation", 0, G_MAXUINT, - 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, PROP_PIFF_AVG_FRAME_DUR, - g_param_spec_uint64 ("frame-dur", "Average frame duration", - "Average frame duration", 0, G_MAXUINT64, - G_MAXUINT64, - G_PARAM_READABLE)); - - gst_piffdemux_signals[SIGNAL_LIVE_PARAM] = - g_signal_new ("live-param", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GstPiffDemuxClass, live_param), NULL, NULL, - g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - -} - -static void -gst_piffdemux_init (GstPiffDemux * piffdemux, GstPiffDemuxClass * klass) -{ - /* sink pad */ - piffdemux->sinkpad = gst_pad_new_from_static_template (&gst_piffdemux_sink_template, "sink"); - gst_pad_set_chain_function (piffdemux->sinkpad, gst_piffdemux_chain); - gst_pad_set_event_function (piffdemux->sinkpad, gst_piffdemux_handle_sink_event); - gst_element_add_pad (GST_ELEMENT_CAST (piffdemux), piffdemux->sinkpad); - - /* source pad */ - piffdemux->srcpad = gst_pad_new_from_static_template (&gst_piffdemux_src_template, "src"); - gst_pad_set_event_function (piffdemux->srcpad, gst_piffdemux_handle_src_event); - gst_pad_use_fixed_caps (piffdemux->srcpad); - gst_pad_set_query_type_function (piffdemux->srcpad, gst_piffdemux_get_src_query_types); - gst_pad_set_query_function (piffdemux->srcpad, gst_piffdemux_handle_src_query); - gst_element_add_pad (GST_ELEMENT_CAST (piffdemux), piffdemux->srcpad); - - piffdemux->stream = g_new0 (PiffDemuxStream, 1); - piffdemux->stream->fourcc = PIFF_DEFAULT_FOURCC; - piffdemux->stream->timescale = PIFF_DEFAULT_TIMESCALE; - piffdemux->stream->duration = PIFF_DEFAULT_DURATION; - piffdemux->stream->caps = NULL; - piffdemux->stream->discont = TRUE; - piffdemux->stream->need_process = FALSE; - piffdemux->stream->segment_index = -1; - piffdemux->stream->time_position = 0; - piffdemux->stream->sample_index = -1; - piffdemux->stream->last_ret = GST_FLOW_OK; - piffdemux->stream->sent_nsevent = FALSE; - piffdemux->stream->start_ts = PIFF_DEFAULT_START_TS; - piffdemux->stream->avg_dur = -1; - - piffdemux->state = PIFFDEMUX_STATE_INITIAL; - piffdemux->neededbytes = 16; - piffdemux->todrop = 0; - piffdemux->adapter = gst_adapter_new (); - piffdemux->offset = 0; - piffdemux->first_mdat = -1; - piffdemux->mdatoffset = GST_CLOCK_TIME_NONE; - piffdemux->mdatbuffer = NULL; - piffdemux->moof_rcvd = FALSE; - piffdemux->is_live = FALSE; - piffdemux->lookahead_cnt = 0; - -#ifdef DEC_OUT_FRAME_DUMP - piffdump = fopen ("/opt/media/piff_out_dump.dmp", "w+"); - if (piffdump == NULL) - { - g_print ("\nNot able to create frame dump file\n"); - } -#endif - - gst_segment_init (&piffdemux->segment, GST_FORMAT_TIME); -} - -static void -gst_piffdemux_dispose (GObject * object) -{ - GstPiffDemux *piffdemux = GST_PIFFDEMUX (object); - - if (piffdemux->adapter) { - g_object_unref (G_OBJECT (piffdemux->adapter)); - piffdemux->adapter = NULL; - } - -#ifdef DEC_OUT_FRAME_DUMP - { - fclose (piffdump); - piffdump = NULL; - } -#endif - G_OBJECT_CLASS (parent_class)->dispose (object); -} - - -static void -gst_piffdemux_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GstPiffDemux *piffdemux = GST_PIFFDEMUX (object); - - switch (prop_id) { - case PROP_PIFF_MEDIA_CAPS: { - if (piffdemux->stream->caps) - gst_caps_unref(piffdemux->stream->caps); - piffdemux->stream->caps = gst_caps_copy (gst_value_get_caps (value)); - GST_DEBUG_OBJECT (piffdemux, "stream caps = %s", gst_caps_to_string(piffdemux->stream->caps)); - if (!gst_pad_set_caps(piffdemux->srcpad, piffdemux->stream->caps)) { - GST_ERROR_OBJECT (piffdemux, "not able to set caps..."); - } - break; - } - case PROP_PIFF_MEDIA_TIMESCALE: - piffdemux->stream->timescale = g_value_get_uint64(value); - break; - case PROP_PIFF_MEDIA_DURATION: - piffdemux->stream->duration = g_value_get_int64(value); - break; - case PROP_PIFF_MEDIA_START_TIMESTAMP: - piffdemux->stream->start_ts = g_value_get_uint64(value); - GST_INFO_OBJECT (piffdemux, "start_ts = %"GST_TIME_FORMAT, GST_TIME_ARGS(piffdemux->stream->start_ts)); - break; - case PROP_PIFF_IS_LIVE: - piffdemux->is_live = g_value_get_boolean(value); - break; - case PROP_PIFF_LOOKAHEAD_COUNT: - piffdemux->lookahead_cnt = g_value_get_uint(value); - GST_DEBUG_OBJECT (piffdemux, "Look ahead count = %d", piffdemux->lookahead_cnt); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static void -gst_piffdemux_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GstPiffDemux *piffdemux = GST_PIFFDEMUX (object); - - switch (prop_id) { - case PROP_PIFF_MEDIA_CAPS: - gst_value_set_caps (value, piffdemux->stream->caps); - break; - case PROP_PIFF_MEDIA_TIMESCALE: - g_value_set_uint64 (value, piffdemux->stream->timescale); - break; - case PROP_PIFF_MEDIA_DURATION: - g_value_set_int64 (value, piffdemux->stream->duration); - break; - case PROP_PIFF_MEDIA_START_TIMESTAMP: - g_value_set_uint64 (value, piffdemux->stream->start_ts); - break; - case PROP_PIFF_IS_LIVE: - g_value_set_boolean(value, piffdemux->is_live); - break; - case PROP_PIFF_LOOKAHEAD_COUNT: - g_value_set_uint (value, piffdemux->lookahead_cnt); - break; - case PROP_PIFF_AVG_FRAME_DUR: - g_value_set_uint64 (value, piffdemux->stream->avg_dur); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static void -gst_piffdemux_post_no_playable_stream_error (GstPiffDemux * piffdemux) -{ - if (piffdemux->posted_redirect) { - GST_ELEMENT_ERROR (piffdemux, STREAM, DEMUX, - ("This file contains no playable streams."), - ("no known streams found, a redirect message has been posted")); - } else { - GST_ELEMENT_ERROR (piffdemux, STREAM, DEMUX, - ("This file contains no playable streams."), - ("no known streams found")); - } - -} - -static gboolean -gst_piffdemux_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value, - GstFormat dest_format, gint64 * dest_value) -{ - gboolean res = TRUE; - PiffDemuxStream *stream = gst_pad_get_element_private (pad); - GstPiffDemux *piffdemux = GST_PIFFDEMUX (gst_pad_get_parent (pad)); - - if (stream->subtype != FOURCC_vide) { - res = FALSE; - goto done; - } - - switch (src_format) { - case GST_FORMAT_TIME: - switch (dest_format) { - case GST_FORMAT_BYTES:{ - - break; - } - default: - res = FALSE; - break; - } - break; - case GST_FORMAT_BYTES: - switch (dest_format) { - case GST_FORMAT_TIME:{ - - break; - } - default: - res = FALSE; - break; - } - break; - default: - res = FALSE; - } - -done: - gst_object_unref (piffdemux); - - return res; -} - -static const GstQueryType * -gst_piffdemux_get_src_query_types (GstPad * pad) -{ - static const GstQueryType src_types[] = { - GST_QUERY_POSITION, - GST_QUERY_DURATION, - GST_QUERY_CONVERT, - GST_QUERY_FORMATS, - GST_QUERY_SEEKING, - 0 - }; - - return src_types; -} - -static gboolean -gst_piffdemux_get_duration (GstPiffDemux * piffdemux, gint64 * duration) -{ - gboolean res = TRUE; - - *duration = GST_CLOCK_TIME_NONE; - - if (piffdemux->stream->duration != 0) { - if (piffdemux->stream->duration != G_MAXINT64 && piffdemux->stream->timescale != 0) { - *duration = gst_util_uint64_scale (piffdemux->stream->duration, - GST_SECOND, piffdemux->stream->timescale); - } - } - return res; -} - -static gboolean -gst_piffdemux_handle_src_query (GstPad * pad, GstQuery * query) -{ - gboolean res = FALSE; - GstPiffDemux *piffdemux = GST_PIFFDEMUX (gst_pad_get_parent (pad)); - - GST_LOG_OBJECT (pad, "%s query", GST_QUERY_TYPE_NAME (query)); - - switch (GST_QUERY_TYPE (query)) { - case GST_QUERY_POSITION: - GST_ERROR ("Querying POSITION from piffdemux...."); - if (GST_CLOCK_TIME_IS_VALID (piffdemux->segment.last_stop)) { - gst_query_set_position (query, GST_FORMAT_TIME, - piffdemux->segment.last_stop); - res = TRUE; - } - break; - case GST_QUERY_DURATION:{ - GstFormat fmt; - GST_ERROR ("Querying DURATION from piffdemux...."); - - gst_query_parse_duration (query, &fmt, NULL); - if (fmt == GST_FORMAT_TIME) { - gint64 duration = -1; - - gst_piffdemux_get_duration (piffdemux, &duration); - if (duration > 0) { - gst_query_set_duration (query, GST_FORMAT_TIME, duration); - res = TRUE; - } - } - break; - } - case GST_QUERY_CONVERT:{ - GstFormat src_fmt, dest_fmt; - gint64 src_value, dest_value = 0; - - gst_query_parse_convert (query, &src_fmt, &src_value, &dest_fmt, NULL); - - res = gst_piffdemux_src_convert (pad, - src_fmt, src_value, dest_fmt, &dest_value); - if (res) { - gst_query_set_convert (query, src_fmt, src_value, dest_fmt, dest_value); - res = TRUE; - } - break; - } - case GST_QUERY_FORMATS: - gst_query_set_formats (query, 2, GST_FORMAT_TIME, GST_FORMAT_BYTES); - res = TRUE; - break; - case GST_QUERY_SEEKING:{ - - break; - } - default: - res = gst_pad_query_default (pad, query); - break; - } - - gst_object_unref (piffdemux); - - return res; -} - - -static void -gst_piffdemux_push_tags (GstPiffDemux * piffdemux, PiffDemuxStream * stream) -{ - if (G_UNLIKELY (stream->pending_tags)) { - GST_DEBUG_OBJECT (piffdemux, "Sending tags %" GST_PTR_FORMAT, - stream->pending_tags); - gst_pad_push_event (piffdemux->srcpad, - gst_event_new_tag (stream->pending_tags)); - stream->pending_tags = NULL; - } - - if (G_UNLIKELY (stream->send_global_tags && piffdemux->tag_list)) { - GST_DEBUG_OBJECT (piffdemux, "Sending global tags %" GST_PTR_FORMAT, - piffdemux->tag_list); - gst_pad_push_event (piffdemux->srcpad, - gst_event_new_tag (gst_tag_list_copy (piffdemux->tag_list))); - stream->send_global_tags = FALSE; - } -} - - -static void -gst_piffdemux_push_event (GstPiffDemux * piffdemux, GstEvent * event) -{ - GstEventType etype = GST_EVENT_TYPE (event); - - GST_DEBUG_OBJECT (piffdemux, "pushing %s event on source pad", - GST_EVENT_TYPE_NAME (event)); - - if (piffdemux->stream->sent_eos) { - GST_INFO_OBJECT (piffdemux, "already sent eos"); - return; - } - - if (!gst_pad_push_event (piffdemux->srcpad, event)) { - GST_ERROR_OBJECT (piffdemux, "error in sending event to srcpad..."); - } - - if (etype == GST_EVENT_EOS) - piffdemux->stream->sent_eos = TRUE; -} - - -/* find the segment for @time_position for @stream - * - * Returns -1 if the segment cannot be found. - */ -static guint32 -gst_piffdemux_find_segment (GstPiffDemux * piffdemux, PiffDemuxStream * stream, - guint64 time_position) -{ - gint i; - guint32 seg_idx; - - GST_LOG_OBJECT (piffdemux, "finding segment for %" GST_TIME_FORMAT, - GST_TIME_ARGS (time_position)); - - /* find segment corresponding to time_position if we are looking - * for a segment. */ - seg_idx = -1; - for (i = 0; i < stream->n_segments; i++) { - PiffDemuxSegment *segment = &stream->segments[i]; - - GST_LOG_OBJECT (piffdemux, - "looking at segment %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT, - GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->stop_time)); - - /* For the last segment we include stop_time in the last segment */ - if (i < stream->n_segments - 1) { - if (segment->time <= time_position && time_position < segment->stop_time) { - GST_LOG_OBJECT (piffdemux, "segment %d matches", i); - seg_idx = i; - break; - } - } else { - if (segment->time <= time_position && time_position <= segment->stop_time) { - GST_LOG_OBJECT (piffdemux, "segment %d matches", i); - seg_idx = i; - break; - } - } - } - return seg_idx; -} - - -static gboolean -gst_piffdemux_handle_src_event (GstPad * pad, GstEvent * event) -{ - gboolean res = TRUE; - GstPiffDemux *piffdemux = GST_PIFFDEMUX (gst_pad_get_parent (pad)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_QOS: - case GST_EVENT_NAVIGATION: - res = FALSE; - gst_event_unref (event); - break; - case GST_EVENT_SEEK: - default: - res = gst_pad_event_default (pad, event); - break; - } - - gst_object_unref (piffdemux); - - return res; -} - - -static void -gst_piffdemux_move_stream (GstPiffDemux * piffdemux, PiffDemuxStream * str, - guint32 index) -{ - /* no change needed */ - if (index == str->sample_index) - return; - - GST_DEBUG_OBJECT (piffdemux, "moving to sample %u of %u", index, - str->n_samples); - - /* position changed, we have a discont */ - str->sample_index = index; - /* Each time we move in the stream we store the position where we are - * starting from */ - str->from_sample = index; - str->discont = TRUE; -} - -// TODO: need to check more on this below function -/* stream/index return sample that is min/max w.r.t. byte position, - * time is min/max w.r.t. time of samples, - * the latter need not be time of the former sample */ -static void -gst_piffdemux_find_sample (GstPiffDemux * piffdemux, gint64 byte_pos, gboolean fw, - gboolean set, PiffDemuxStream ** _stream, gint * _index, gint64 * _time) -{ - gint i, index; - gint64 time, min_time; - PiffDemuxStream *stream; - PiffDemuxStream *str = piffdemux->stream; - gint inc; - gboolean set_sample; - - min_time = -1; - stream = NULL; - index = -1; - - set_sample = !set; - if (fw) { - i = 0; - inc = 1; - } else { - i = str->n_samples - 1; - inc = -1; - } - - for (; (i >= 0) && (i < str->n_samples); i += inc) { - if (str->samples[i].size && - ((fw && (str->samples[i].offset >= byte_pos)) || - (!fw && - (str->samples[i].offset + str->samples[i].size <= - byte_pos)))) { - /* move stream to first available sample */ - if (set) { - gst_piffdemux_move_stream (piffdemux, str, i); - set_sample = TRUE; - } - /* determine min/max time */ - time = str->samples[i].timestamp + str->samples[i].pts_offset; - time = gst_util_uint64_scale (time, GST_SECOND, str->timescale); - if (min_time == -1 || (!fw && time > min_time) || - (fw && time < min_time)) { - min_time = time; - } - index = i; - break; - } - } - /* no sample for this stream, mark eos */ - if (!set_sample) - gst_piffdemux_move_stream (piffdemux, str, str->n_samples); - - if (_time) - *_time = min_time; - if (_stream) - *_stream = str; - if (_index) - *_index = index; -} - - -static gboolean -gst_piffdemux_handle_sink_event (GstPad * sinkpad, GstEvent * event) -{ - GstPiffDemux *demux = GST_PIFFDEMUX (GST_PAD_PARENT (sinkpad)); - gboolean res; - - GST_LOG_OBJECT (demux, "handling %s event", GST_EVENT_TYPE_NAME (event)); - - switch (GST_EVENT_TYPE (event)) { - case GST_EVENT_NEWSEGMENT: - { - GstFormat format; - gdouble rate, arate; - gint64 start, stop, time, offset = 0; - PiffDemuxStream *stream; - gint idx; - gboolean update; - GstSegment segment; - - /* some debug output */ - gst_segment_init (&segment, GST_FORMAT_UNDEFINED); - gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format, - &start, &stop, &time); - gst_segment_set_newsegment_full (&segment, update, rate, arate, format, - start, stop, time); - GST_ERROR_OBJECT (demux, - "received format %d newsegment %" GST_SEGMENT_FORMAT, format, - &segment); - - /* chain will send initial newsegment after pads have been added */ - if (demux->state != PIFFDEMUX_STATE_MOVIE ) { - GST_DEBUG_OBJECT (demux, "still starting, eating event"); - goto exit; - } - - /* we only expect a BYTE segment, e.g. following a seek */ - if (format == GST_FORMAT_BYTES) { - if (start > 0) { - gint64 requested_seek_time; - guint64 seek_offset; - - offset = start; - - GST_OBJECT_LOCK (demux); - requested_seek_time = demux->requested_seek_time; - seek_offset = demux->seek_offset; - demux->requested_seek_time = -1; - demux->seek_offset = -1; - GST_OBJECT_UNLOCK (demux); - - if (offset == seek_offset) { - start = requested_seek_time; - } else { - gst_piffdemux_find_sample (demux, start, TRUE, FALSE, NULL, NULL, - &start); - start = MAX (start, 0); - } - } - if (stop > 0) { - gst_piffdemux_find_sample (demux, stop, FALSE, FALSE, NULL, NULL, - &stop); - /* keyframe seeking should already arrange for start >= stop, - * but make sure in other rare cases */ - stop = MAX (stop, start); - } - } -#if 0 - else if (format == GST_FORMAT_TIME) { - // Supporting TIME_FORMAT for new_segment - //gst_piffdemux_push_event (demux,event); - PiffDemuxStream *stream = NULL; - int i = -1; - - demux->neededbytes = 16; - demux->state = PIFFDEMUX_STATE_INITIAL; - demux->offset = 0; - - /* Figure out which stream this is packet belongs to */ - for (i = 0; i < demux->n_streams; i++) { - stream = demux->streams[i]; - stream->last_ts = start; - stream->discont = TRUE; - stream->sample_index = stream->n_samples; - } - - /* accept upstream's notion of segment and distribute along */ - gst_segment_set_newsegment_full (&demux->segment, update, rate, arate, - GST_FORMAT_TIME, start, stop, start); - GST_ERROR_OBJECT (demux, "Pushing newseg update %d, rate %g, " - "applied rate %g, format %d, start %" GST_TIME_FORMAT ", " - "stop %" GST_TIME_FORMAT, update, rate, arate, GST_FORMAT_TIME, - GST_TIME_ARGS (start), GST_TIME_ARGS (stop)); - - gst_piffdemux_push_event (demux, - gst_event_new_new_segment_full (update, rate, arate, GST_FORMAT_TIME, start, stop, start)); - - /* clear leftover in current segment, if any */ - gst_adapter_clear (demux->adapter); - - goto exit; - } -#endif - else { - GST_DEBUG_OBJECT (demux, "unsupported segment format, ignoring"); - goto exit; - } - - /* accept upstream's notion of segment and distribute along */ - gst_segment_set_newsegment_full (&demux->segment, update, rate, arate, - GST_FORMAT_TIME, start, stop, start); - GST_ERROR_OBJECT (demux, "Pushing newseg update %d, rate %g, " - "applied rate %g, format %d, start %" GST_TIME_FORMAT ", " - "stop %" GST_TIME_FORMAT, update, rate, arate, GST_FORMAT_TIME, - GST_TIME_ARGS (start), GST_TIME_ARGS (stop)); - - gst_piffdemux_push_event (demux, - gst_event_new_new_segment_full (update, rate, arate, GST_FORMAT_TIME, - start, stop, start)); - - /* clear leftover in current segment, if any */ - gst_adapter_clear (demux->adapter); - /* set up streaming thread */ - gst_piffdemux_find_sample (demux, offset, TRUE, TRUE, &stream, &idx, NULL); - demux->offset = offset; - if (stream) { - demux->todrop = stream->samples[idx].offset - offset; - demux->neededbytes = demux->todrop + stream->samples[idx].size; - } else { - /* set up for EOS */ - demux->neededbytes = -1; - demux->todrop = 0; - } - exit: - gst_event_unref (event); - res = TRUE; - goto drop; - break; - } - case GST_EVENT_FLUSH_STOP: - { - /* clean up, force EOS if no more info follows */ - gst_adapter_clear (demux->adapter); - demux->offset = 0; - demux->neededbytes = -1; - /* reset flow return, e.g. following seek */ - demux->stream->last_ret = GST_FLOW_OK; - demux->stream->sent_eos = FALSE; - break; - } - case GST_EVENT_EOS: - break; - default: - break; - } - - res = gst_pad_event_default (demux->sinkpad, event); - -drop: - return res; -} - - -static void -gst_piffdemux_stream_free (GstPiffDemux * piffdemux, PiffDemuxStream * stream) -{ - while (stream->buffers) { - gst_buffer_unref (GST_BUFFER_CAST (stream->buffers->data)); - stream->buffers = g_slist_delete_link (stream->buffers, stream->buffers); - } - g_free (stream->samples); - if (stream->caps) - gst_caps_unref (stream->caps); - g_free (stream->segments); - if (stream->pending_tags) - gst_tag_list_free (stream->pending_tags); - g_free (stream); -} - - -static GstStateChangeReturn -gst_piffdemux_change_state (GstElement * element, GstStateChange transition) -{ - GstPiffDemux *piffdemux = GST_PIFFDEMUX (element); - GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE; - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; - default: - break; - } - - result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PAUSED_TO_READY:{ - piffdemux->state = PIFFDEMUX_STATE_INITIAL; - piffdemux->neededbytes = 16; - piffdemux->todrop = 0; - piffdemux->posted_redirect = FALSE; - piffdemux->offset = 0; - piffdemux->first_mdat = -1; - piffdemux->mdatoffset = GST_CLOCK_TIME_NONE; - if (piffdemux->mdatbuffer) - gst_buffer_unref (piffdemux->mdatbuffer); - piffdemux->mdatbuffer = NULL; - if (piffdemux->tag_list) - gst_tag_list_free (piffdemux->tag_list); - piffdemux->tag_list = NULL; - gst_adapter_clear (piffdemux->adapter); - gst_segment_init (&piffdemux->segment, GST_FORMAT_TIME); - break; - } - default: - break; - } - - return result; -} - -static void -piffdemux_post_global_tags (GstPiffDemux * piffdemux) -{ - if (piffdemux->tag_list) { - /* all header tags ready and parsed, push them */ - GST_INFO_OBJECT (piffdemux, "posting global tags: %" GST_PTR_FORMAT, - piffdemux->tag_list); - /* post now, send event on pads later */ - gst_element_post_message (GST_ELEMENT (piffdemux), - gst_message_new_tag (GST_OBJECT (piffdemux), - gst_tag_list_copy (piffdemux->tag_list))); - } -} - - -/* caller verifies at least 8 bytes in buf */ -static void -extract_initial_length_and_fourcc (const guint8 * data, guint size, - guint64 * plength, guint32 * pfourcc) -{ - guint64 length; - guint32 fourcc; - - length = PIFF_UINT32 (data); - GST_DEBUG ("length 0x%08" G_GINT64_MODIFIER "x", length); - fourcc = PIFF_FOURCC (data + 4); - GST_DEBUG ("atom type %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); - - if (length == 0) { - length = G_MAXUINT32; - } else if (length == 1 && size >= 16) { - /* this means we have an extended size, which is the 64 bit value of - * the next 8 bytes */ - length = PIFF_UINT64 (data + 8); - GST_DEBUG ("length 0x%08" G_GINT64_MODIFIER "x", length); - } - - if (plength) - *plength = length; - if (pfourcc) - *pfourcc = fourcc; -} - -static gboolean -piffdemux_update_sample_offset (GstPiffDemux * piffdemu, PiffDemuxStream * stream, gint64 uuid_offset) -{ - PiffDemuxSample *sample; - gint i; - - sample = stream->samples ; - for (i = 0; i < stream->n_samples; i++) - { - sample->offset = sample->offset + uuid_offset; - sample++; - } - return TRUE; -} - -static uuid_type_t -piffdemux_get_uuid_type(GstPiffDemux * piffdemux, GstByteReader *uuid_data, gint64 *uuid_offset) -{ - uuid_type_t uuid_type = UUID_UNKNOWN; - guint32 box_len = 0; - guint64 box_long_len = 0; - gchar uuid[16] = {0,}; - int i = 0; - - if (!gst_byte_reader_get_uint32_be (uuid_data, &box_len)) - goto invalid_uuid; - - /* Skipping fourcc */ - if (!gst_byte_reader_skip (uuid_data, 4)) - goto invalid_uuid; - - if (box_len == 1) - { - GST_WARNING ("TfxdBoxLongLength field is present..."); - if (!gst_byte_reader_get_uint64_be (uuid_data, &box_long_len)) - goto invalid_uuid; - GST_DEBUG ("tfxd long length = %llu", box_long_len); - - *uuid_offset = box_long_len; - } - else - { - GST_DEBUG ("Box Len = %d", box_len); - *uuid_offset = box_len; - } - - //g_print ("\n\n\n 0x"); - for (i = 0; i < sizeof (uuid); i++) - { - if (!gst_byte_reader_get_uint8 (uuid_data, &(uuid[i]))) - goto invalid_uuid; - //g_print ("%02x", uuid[i]); - } - //g_print ("\n\n\n"); - - if (!memcmp(uuid, tfxd_uuid, sizeof (uuid_t))) - { - GST_INFO ("Found TFXD box"); - return UUID_TFXD; - } - else if (!memcmp(uuid, tfrf_uuid, sizeof (uuid_t))) - { - GST_INFO ("Found TFRF box"); - return UUID_TFRF; - } - else if (!memcmp(uuid, encrypt_uuid, sizeof (uuid_t))) - { - GST_INFO ("Found sample encryption box"); - return UUID_SAMPLE_ENCRYPT; - } - else - { - GST_WARNING ("Not an valid UUID box.."); - goto invalid_uuid; - } - return uuid_type; - -invalid_uuid: - GST_ERROR ("Error in parsing UUID atom..."); - return UUID_UNKNOWN; -} - -static gboolean -piffdemux_parse_sample_encryption(GstPiffDemux * piffdemux, GstByteReader *sample_encrypt, PiffDemuxStream * stream) -{ - guint32 flags = 0; - guint32 sample_count = 0; - guint32 i = 0; - guint32 algo_id; - guint8 iv_size = 0; - - if (!gst_byte_reader_skip (sample_encrypt, 1) || - !gst_byte_reader_get_uint24_be (sample_encrypt, &flags)) - goto invalid_encryption; - - if (flags & SE_OVERRIDE_TE_FLAGS) { - /* get algorithm id */ - if (!gst_byte_reader_get_uint32_be (sample_encrypt, &algo_id)) - goto invalid_encryption; - - /* get IV size */ - if (!gst_byte_reader_get_uint8 (sample_encrypt, &iv_size)) - goto invalid_encryption; - - // TODO: need to add reading of KID - } else { - GST_INFO_OBJECT (piffdemux, "Override flags are not present... taking default IV_Size = 8"); - iv_size = 8; - } - - /* Get sample count*/ - if (!gst_byte_reader_get_uint32_be (sample_encrypt, &sample_count)) - goto invalid_encryption; - - GST_INFO_OBJECT (piffdemux, "Sample count = %d", sample_count); - - if (sample_count != stream->n_samples) { - GST_ERROR_OBJECT (piffdemux, "Not all samples has IV vectors... Don't know how to handle. sample_cnt = %d and stream->n_samples = %d", - sample_count, stream->n_samples); - goto invalid_encryption; - } - - for (i = 0; i < stream->n_samples; i++) { - guint8 iv_idx = iv_size; - - /* resetting entire IV array */ - stream->samples[i].iv = (guint8 *)malloc (iv_size); - if (NULL == stream->samples[i].iv) { - GST_ERROR ("Failed to allocate memory...\n"); - goto invalid_encryption; - } - - memset (stream->samples[i].iv, 0x00, iv_size); - - iv_idx = 0; - while (iv_idx < iv_size) { - /* get IV byte */ - if (!gst_byte_reader_get_uint8 (sample_encrypt, &(stream->samples[i].iv[iv_idx]))) - goto invalid_encryption; - - iv_idx++; - } - -#ifdef DEBUG_IV - { - guint8 tmp_idx = 0; - g_print ("sample[%d] : 0x ", i); - - while (tmp_idx < iv_size ) { - g_print ("%02x ", stream->samples[i].iv[tmp_idx]); - tmp_idx++; - } - g_print ("\n"); - } -#endif - - if (flags & SE_USE_SUBSAMPLE_ENCRYPTION) { - guint16 n_entries; - guint16 n_idx; - - /* NumberofEntries in SubSampleEncryption */ - if (!gst_byte_reader_get_uint16_be (sample_encrypt, &n_entries)) - goto invalid_encryption; - - stream->samples[i].sub_encry = (PiffDemuxSubSampleEncryption *)malloc (sizeof (PiffDemuxSubSampleEncryption)); - if (NULL == stream->samples[i].sub_encry) { - GST_ERROR ("Failed to allocate memory...\n"); - goto invalid_encryption; - } - - stream->samples[i].sub_encry->sub_entry = g_try_new0 (PiffDemuxSubSampleEntryInfo, n_entries); - if (NULL == stream->samples[i].sub_encry->sub_entry) - { - GST_ERROR_OBJECT (piffdemux, "Failed to allocate memory..."); - goto invalid_encryption; - } - - stream->samples[i].sub_encry->n_entries = n_entries; - - GST_DEBUG_OBJECT (piffdemux,"No. of subsample entries = %d", stream->samples[i].sub_encry->n_entries); - - for (n_idx = 0; n_idx < n_entries; n_idx++) { - if (!gst_byte_reader_get_uint16_be (sample_encrypt, &(stream->samples[i].sub_encry->sub_entry[n_idx].LenofClearData))) - goto invalid_encryption; - - GST_DEBUG_OBJECT (piffdemux,"entry[%d] and lengthofClearData = %d", n_idx, stream->samples[i].sub_encry->sub_entry[n_idx].LenofClearData); - - if (!gst_byte_reader_get_uint32_be (sample_encrypt, &(stream->samples[i].sub_encry->sub_entry[n_idx].LenofEncryptData))) - goto invalid_encryption; - - GST_DEBUG_OBJECT (piffdemux,"entry[%d] and lengthofEncryptData = %d", n_idx, stream->samples[i].sub_encry->sub_entry[n_idx].LenofEncryptData); - } - } - } - - return TRUE; - -invalid_encryption: - { - GST_WARNING_OBJECT (piffdemux, "invalid sample encryption header"); - return FALSE; - } -} - - -static gboolean -piffdemux_parse_trun (GstPiffDemux * piffdemux, GstByteReader * trun, - PiffDemuxStream * stream, guint32 d_sample_duration, guint32 d_sample_size, - guint32 d_sample_flags, gint64 moof_offset, gint64 moof_length, - gint64 * base_offset, gint64 * running_offset) -{ - guint64 timestamp; - gint32 data_offset = 0; - guint32 flags = 0, first_flags = 0, samples_count = 0; - gint i; - guint8 *data; - guint entry_size, dur_offset, size_offset, flags_offset = 0, ct_offset = 0; - PiffDemuxSample *sample; - gboolean ismv = FALSE; - guint64 total_duration = 0; - - GST_LOG_OBJECT (piffdemux, "parsing trun stream ; " - "default dur %d, size %d, flags 0x%x, base offset %" G_GINT64_FORMAT, - d_sample_duration, d_sample_size, d_sample_flags, - *base_offset); - - //Resetting the samples - stream->n_samples = 0; - - if (!gst_byte_reader_skip (trun, 1) || - !gst_byte_reader_get_uint24_be (trun, &flags)) - goto fail; - - if (!gst_byte_reader_get_uint32_be (trun, &samples_count)) - goto fail; - - if (flags & TR_DATA_OFFSET) { - /* note this is really signed */ - if (!gst_byte_reader_get_int32_be (trun, &data_offset)) - goto fail; - GST_LOG_OBJECT (piffdemux, "trun data offset %d", data_offset); - /* default base offset = first byte of moof */ - if (*base_offset == -1) { - GST_LOG_OBJECT (piffdemux, "base_offset at moof and moof_offset = %"G_GINT64_FORMAT, moof_offset); - *base_offset = moof_offset; - } - *running_offset = *base_offset + data_offset; - } else { - /* if no offset at all, that would mean data starts at moof start, - * which is a bit wrong and is ismv crappy way, so compensate - * assuming data is in mdat following moof */ - if (*base_offset == -1) { - *base_offset = moof_offset + moof_length + 8; - GST_LOG_OBJECT (piffdemux, "base_offset assumed in mdat after moof"); - ismv = TRUE; - } - if (*running_offset == -1) - *running_offset = *base_offset; - } - - GST_LOG_OBJECT (piffdemux, "running offset now %" G_GINT64_FORMAT, - *running_offset); - GST_LOG_OBJECT (piffdemux, "trun offset %d, flags 0x%x, entries %d", - data_offset, flags, samples_count); - - if (flags & TR_FIRST_SAMPLE_FLAGS) { - if (G_UNLIKELY (flags & TR_SAMPLE_FLAGS)) { - GST_DEBUG_OBJECT (piffdemux, - "invalid flags; SAMPLE and FIRST_SAMPLE present, discarding latter"); - flags ^= TR_FIRST_SAMPLE_FLAGS; - } else { - if (!gst_byte_reader_get_uint32_be (trun, &first_flags)) - goto fail; - GST_LOG_OBJECT (piffdemux, "first flags: 0x%x", first_flags); - } - } - - /* FIXME ? spec says other bits should also be checked to determine - * entry size (and prefix size for that matter) */ - entry_size = 0; - dur_offset = size_offset = 0; - if (flags & TR_SAMPLE_DURATION) { - GST_LOG_OBJECT (piffdemux, "entry duration present"); - dur_offset = entry_size; - entry_size += 4; - } - if (flags & TR_SAMPLE_SIZE) { - GST_LOG_OBJECT (piffdemux, "entry size present"); - size_offset = entry_size; - entry_size += 4; - } - if (flags & TR_SAMPLE_FLAGS) { - GST_LOG_OBJECT (piffdemux, "entry flags present"); - flags_offset = entry_size; - entry_size += 4; - } - if (flags & TR_COMPOSITION_TIME_OFFSETS) { - GST_LOG_OBJECT (piffdemux, "entry ct offset present"); - ct_offset = entry_size; - entry_size += 4; - } - - if (!piff_atom_parser_has_chunks (trun, samples_count, entry_size)) - goto fail; - data = (guint8 *) gst_byte_reader_peek_data_unchecked (trun); - - if (stream->n_samples >= - PIFFDEMUX_MAX_SAMPLE_INDEX_SIZE / sizeof (PiffDemuxSample)) - goto index_too_big; - - GST_DEBUG_OBJECT (piffdemux, "allocating n_samples %u * %u (%.2f MB)", - stream->n_samples, (guint) sizeof (PiffDemuxSample), - stream->n_samples * sizeof (PiffDemuxSample) / (1024.0 * 1024.0)); - - /* create a new array of samples if it's the first sample parsed */ - if (stream->n_samples == 0) - stream->samples = g_try_new0 (PiffDemuxSample, samples_count); - /* or try to reallocate it with space enough to insert the new samples */ - else - stream->samples = g_try_renew (PiffDemuxSample, stream->samples, - stream->n_samples + samples_count); - if (stream->samples == NULL) - goto out_of_memory; - - if (G_UNLIKELY (stream->n_samples == 0)) { - /* the timestamp of the first sample is also provided by the tfra entry - * but we shouldn't rely on it as it is at the end of files */ - timestamp = 0; - } else { - /* subsequent fragments extend stream */ - timestamp = - stream->samples[stream->n_samples - 1].timestamp + - stream->samples[stream->n_samples - 1].duration; - } - sample = stream->samples + stream->n_samples; - for (i = 0; i < samples_count; i++) { - guint32 dur, size, sflags, ct; - - /* first read sample data */ - if (flags & TR_SAMPLE_DURATION) { - dur = PIFF_UINT32 (data + dur_offset); - } else { - dur = d_sample_duration; - } - if (flags & TR_SAMPLE_SIZE) { - size = PIFF_UINT32 (data + size_offset); - } else { - size = d_sample_size; - } - - GST_DEBUG_OBJECT(piffdemux,"Size of sample %d is %d", i, size); - - if (flags & TR_FIRST_SAMPLE_FLAGS) { - if (i == 0) { - sflags = first_flags; - } else { - sflags = d_sample_flags; - } - } else if (flags & TR_SAMPLE_FLAGS) { - sflags = PIFF_UINT32 (data + flags_offset); - } else { - sflags = d_sample_flags; - } - if (flags & TR_COMPOSITION_TIME_OFFSETS) { - ct = PIFF_UINT32 (data + ct_offset); - } else { - ct = 0; - } - data += entry_size; - - /* fill the sample information */ - sample->offset = *running_offset; - sample->pts_offset = ct; - sample->size = size; - sample->timestamp = timestamp; - sample->duration = dur; - /* sample-is-difference-sample */ - /* ismv seems to use 0x40 for keyframe, 0xc0 for non-keyframe, - * now idea how it relates to bitfield other than massive LE/BE confusion */ - sample->keyframe = ismv ? ((sflags & 0xff) == 0x40) : !(sflags & 0x10000); - sample->iv = NULL; - sample->sub_encry = NULL; - - stream->samples[i] = *sample; - - *running_offset += size; - timestamp += dur; - sample++; - - /* calculate total duration of the present fragment */ - total_duration += gst_util_uint64_scale (dur, GST_SECOND, stream->timescale); - } - - stream->sample_index = 0; - - stream->n_samples += samples_count; - - /* calculate avg fps based on avg frame duration */ - stream->avg_dur = total_duration/samples_count; - g_print ("total dur = %"GST_TIME_FORMAT", avg_dur = %"GST_TIME_FORMAT"count = %d\n", - GST_TIME_ARGS(total_duration), GST_TIME_ARGS(stream->avg_dur), samples_count); - - return TRUE; - -fail: - { - GST_WARNING_OBJECT (piffdemux, "failed to parse trun"); - return FALSE; - } -out_of_memory: - { - GST_WARNING_OBJECT (piffdemux, "failed to allocate %d samples", - stream->n_samples); - return FALSE; - } -index_too_big: - { - GST_WARNING_OBJECT (piffdemux, "not allocating index of %d samples, would " - "be larger than %uMB (broken file?)", stream->n_samples, - PIFFDEMUX_MAX_SAMPLE_INDEX_SIZE >> 20); - return FALSE; - } -} - -static gboolean -piffdemux_parse_mfhd (GstPiffDemux * piffdemux, GstByteReader * mfhd) -{ - guint32 seq_num = 0; - - if (!gst_byte_reader_skip (mfhd, 4)) - goto invalid_mfhd; - - if (!gst_byte_reader_get_uint32_be (mfhd, &seq_num)) - goto invalid_mfhd; - - GST_DEBUG_OBJECT (piffdemux, "sequence number present in mfhd = %d", seq_num); - - return TRUE; - -invalid_mfhd: - { - GST_WARNING_OBJECT (piffdemux, "invalid movie fragment header"); - return FALSE; - } -} - - -static gboolean -piffdemux_parse_tfhd (GstPiffDemux * piffdemux, GstByteReader * tfhd, - guint32 * default_sample_duration, - guint32 * default_sample_size, guint32 * default_sample_flags, - gint64 * base_offset) -{ - guint32 flags = 0; - guint32 track_id = 0; - - if (!gst_byte_reader_skip (tfhd, 1) || - !gst_byte_reader_get_uint24_be (tfhd, &flags)) - goto invalid_track; - - if (!gst_byte_reader_get_uint32_be (tfhd, &track_id)) - goto invalid_track; - - GST_DEBUG_OBJECT (piffdemux, "trackID = %d", track_id); - - if (flags & TF_BASE_DATA_OFFSET) { - if (!gst_byte_reader_get_uint64_be (tfhd, (guint64 *) base_offset)) - goto invalid_track; - GST_DEBUG ("BaseData Offset = %"G_GUINT64_FORMAT, base_offset); - } - - /* FIXME: Handle TF_SAMPLE_DESCRIPTION_INDEX properly */ - if (flags & TF_SAMPLE_DESCRIPTION_INDEX) - if (!gst_byte_reader_skip (tfhd, 4)) - goto invalid_track; - - if (flags & TF_DEFAULT_SAMPLE_DURATION) - if (!gst_byte_reader_get_uint32_be (tfhd, default_sample_duration)) - goto invalid_track; - - if (flags & TF_DEFAULT_SAMPLE_SIZE) - if (!gst_byte_reader_get_uint32_be (tfhd, default_sample_size)) - goto invalid_track; - - if (flags & TF_DEFAULT_SAMPLE_FLAGS) - if (!gst_byte_reader_get_uint32_be (tfhd, default_sample_flags)) - goto invalid_track; - - return TRUE; - -invalid_track: - { - GST_WARNING_OBJECT (piffdemux, "invalid track fragment header"); - return FALSE; - } -} - -static gboolean -piffdemux_parse_tfxd (GstPiffDemux * piffdemux, PiffDemuxStream *stream,GstByteReader * tfxd) -{ - guint8 version = 0; - - // TODO: In my opinion, tfxd will be mainly useful when lookahead count = 0. In this case, based on this duration, next fragment timstamp can be calculted.. Need to test this using our server - - if (!gst_byte_reader_get_uint8 (tfxd, &version)) - goto invalid_tfxd; - - if (!gst_byte_reader_skip (tfxd, 3)) - goto invalid_tfxd; - - if (!piffdemux->lookahead_cnt) { - piffdemux->param = (piff_live_param_t *)malloc (sizeof (piff_live_param_t)); - if (NULL == piffdemux->param) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - return FALSE; - } - piffdemux->param->count = 1; - piffdemux->param->long_info = NULL; - piffdemux->param->info = NULL; - piffdemux->param->is_eos = FALSE; - - // TODO: presentation will be ended based on timeout in souphttpsrc in lookaheadcnt = 0 case - } - - if (version == 1) { - guint64 duration = 0; - guint64 timestamp = 0; - - GST_LOG_OBJECT (piffdemux, "Time and Duration are in 64-bit format..."); - if (!gst_byte_reader_get_uint64_be (tfxd, ×tamp)) - goto invalid_tfxd; - if (!gst_byte_reader_get_uint64_be (tfxd, &duration)) - goto invalid_tfxd; - - GST_DEBUG_OBJECT (piffdemux, "tfxd : absolute timestamp = %"G_GUINT64_FORMAT" and duration of fragment = %"G_GUINT64_FORMAT, - timestamp, duration); - - if (!piffdemux->lookahead_cnt) { - piffdemux->param->long_info = (piff_fragment_longtime_info *)malloc (piffdemux->param->count * sizeof (piff_fragment_longtime_info)); - if (NULL == piffdemux->param->long_info) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - return FALSE; - } - - /* Calculate next fragment's timestamp using current fragment's timestamp + duration */ - piffdemux->param->long_info->duration = GST_CLOCK_TIME_NONE; - piffdemux->param->long_info->ts = timestamp +duration; - } - } else if (version == 0) { - guint32 duration = 0; - guint32 timestamp = 0; - GST_LOG_OBJECT (piffdemux, "Time and Duration are in 32-bit format..."); - - if (!gst_byte_reader_get_uint32_be (tfxd, ×tamp)) - goto invalid_tfxd; - - if (!gst_byte_reader_get_uint32_be (tfxd, &duration)) - goto invalid_tfxd; - - GST_DEBUG_OBJECT (piffdemux, "tfxd : absolute timestamp = %"G_GUINT32_FORMAT" and duration of fragment = %"G_GUINT32_FORMAT, - timestamp, duration); - - if (!piffdemux->lookahead_cnt) { - piffdemux->param->info = (piff_fragment_time_info *)malloc (piffdemux->param->count * sizeof (piff_fragment_time_info)); - if (NULL == piffdemux->param->info) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - return FALSE; - } - /* Calculate next fragment's timestamp using current fragment's timestamp + duration */ - piffdemux->param->info->duration = GST_CLOCK_TIME_NONE; - piffdemux->param->info->ts = timestamp +duration; - } - } else { - GST_ERROR_OBJECT (piffdemux, "Invalid Version in tfxd..."); - return FALSE; - } - - if (!piffdemux->lookahead_cnt) { - GST_DEBUG_OBJECT (piffdemux, "Emitting live-param signal..."); - g_signal_emit (piffdemux, gst_piffdemux_signals[SIGNAL_LIVE_PARAM], 0, piffdemux->param); - } - - return TRUE; - -invalid_tfxd: - GST_ERROR ("Invalid TFXD atom..."); - return FALSE; -} - - -static gboolean -piffdemux_parse_tfrf (GstPiffDemux * piffdemux, PiffDemuxStream *stream,GstByteReader * tfrf) -{ - guint8 version = 0; - guint8 frag_cnt = 0; - guint8 i = 0; - - /* Getting version info */ - if (!gst_byte_reader_get_uint8 (tfrf, &version)) - goto invalid_tfrf; - - /* skipping reserved flags */ - if (!gst_byte_reader_skip (tfrf, 3)) - goto invalid_tfrf; - - if (!gst_byte_reader_get_uint8 (tfrf, &frag_cnt)) - goto invalid_tfrf; - - GST_INFO_OBJECT (piffdemux, "Subsequent fragments info count = %d", frag_cnt); - - piffdemux->param = (piff_live_param_t *)malloc(sizeof (piff_live_param_t)); - if (NULL == piffdemux->param) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - return FALSE; - } - - piffdemux->param->count = frag_cnt; - piffdemux->param->long_info = NULL; - piffdemux->param->info = NULL; - piffdemux->param->is_eos = FALSE; - - // TODO: Duration and timestamp values need to be posted to msl using g_signal_emit - - if (version == 1) { - guint64 duration = 0; - guint64 timestamp = 0; - GST_LOG_OBJECT (piffdemux, "Time and Duration are in 64-bit format..."); - - piffdemux->param->long_info = (piff_fragment_longtime_info *)malloc (piffdemux->param->count * sizeof (piff_fragment_longtime_info)); - if (NULL == piffdemux->param->long_info) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - return FALSE; - } - - for (i = 0; i < frag_cnt; i++) { - if (!gst_byte_reader_get_uint64_be (tfrf, ×tamp)) - goto invalid_tfrf; - if (!gst_byte_reader_get_uint64_be (tfrf, &duration)) - goto invalid_tfrf; - GST_DEBUG_OBJECT (piffdemux, "tfrf long: absolute timestamp = %"G_GUINT64_FORMAT" and duration of fragment = %"G_GUINT64_FORMAT"\n", - timestamp, duration); - (piffdemux->param->long_info[i]).ts = timestamp; - (piffdemux->param->long_info[i]).duration = duration; - } - } else if (version == 0) { - guint32 duration = 0; - guint32 timestamp = 0; - GST_LOG_OBJECT (piffdemux, "Time and Duration are in 32-bit format..."); - - piffdemux->param->info = (piff_fragment_time_info *)malloc (piffdemux->param->count * sizeof (piff_fragment_time_info)); - if (NULL == piffdemux->param->info) { - GST_ERROR ("Memory not available...\n"); - return FALSE; - } - - for (i = 0; i < frag_cnt; i++) { - if (!gst_byte_reader_get_uint32_be (tfrf, ×tamp)) - goto invalid_tfrf; - if (!gst_byte_reader_get_uint32_be (tfrf, &duration)) - goto invalid_tfrf; - - GST_DEBUG_OBJECT (piffdemux, "tfrf int: absolute timestamp = %"G_GUINT32_FORMAT" and duration of fragment = %"G_GUINT32_FORMAT, - timestamp, duration); - (piffdemux->param->info[i]).ts = timestamp; - (piffdemux->param->info[i]).duration = duration; - } - } else { - GST_ERROR_OBJECT (piffdemux, "Invalid Version in tfrf..."); - return FALSE; - } - - g_print ("Signalling from TFRF box..\n"); - g_signal_emit (piffdemux, gst_piffdemux_signals[SIGNAL_LIVE_PARAM], 0, piffdemux->param); - - return TRUE; - -invalid_tfrf: - GST_ERROR_OBJECT (piffdemux, "Invalid TFRF atom..."); - return FALSE; -} - - -static gboolean -piffdemux_parse_moof (GstPiffDemux * piffdemux, const guint8 * buffer, guint length, - guint64 moof_offset, PiffDemuxStream * stream) -{ - GNode *moof_node, *mfhd_node, *traf_node, *tfhd_node, *trun_node, *uuid_node; - GstByteReader mfhd_data, trun_data, tfhd_data, uuid_data; - guint32 ds_size = 0, ds_duration = 0, ds_flags = 0; - gint64 base_offset, running_offset; - gint64 uuid_offset = 0; - gboolean found_tfxd = FALSE; - gboolean found_tfrf = FALSE; - - /* NOTE @stream ignored */ - - moof_node = g_node_new ((guint8 *) buffer); - piffdemux_parse_node (piffdemux, moof_node, buffer, length); - //piffdemux_node_dump (piffdemux, moof_node); - - /* unknown base_offset to start with */ - base_offset = running_offset = -1; - - mfhd_node = piffdemux_tree_get_child_by_type_full (moof_node, FOURCC_mfhd, &mfhd_data); - if (!mfhd_node) - goto missing_mfhd; - - if (!piffdemux_parse_mfhd (piffdemux, &mfhd_data)) - goto missing_mfhd; - - traf_node = piffdemux_tree_get_child_by_type (moof_node, FOURCC_traf); - while (traf_node) { - /* Fragment Header node */ - tfhd_node = - piffdemux_tree_get_child_by_type_full (traf_node, FOURCC_tfhd, - &tfhd_data); - if (!tfhd_node) - goto missing_tfhd; - if (!piffdemux_parse_tfhd (piffdemux, &tfhd_data, &ds_duration, - &ds_size, &ds_flags, &base_offset)) - goto missing_tfhd; - - if (G_UNLIKELY (base_offset < -1)) - goto lost_offset; - - /* Track Run node */ - trun_node = - piffdemux_tree_get_child_by_type_full (traf_node, FOURCC_trun, - &trun_data); - while (trun_node) { - piffdemux_parse_trun (piffdemux, &trun_data, stream, - ds_duration, ds_size, ds_flags, moof_offset, length, &base_offset, - &running_offset); - /* iterate all siblings */ - trun_node = piffdemux_tree_get_sibling_by_type_full (trun_node, FOURCC_trun, - &trun_data); - } - - uuid_node = piffdemux_tree_get_child_by_type (traf_node, FOURCC_uuid); - while (uuid_node) { - uuid_type_t uuid_type; - guint8 *buffer = (guint8 *) uuid_node->data; - - gst_byte_reader_init (&uuid_data, buffer, PIFF_UINT32 (buffer)); - - uuid_type = piffdemux_get_uuid_type (piffdemux, &uuid_data, &uuid_offset); - - if ((UUID_TFXD == uuid_type) && piffdemux->is_live) { - // TODO: Dont know, why we should not consider tfxd offset...if we use tfxd offset also, not working.. PIFF doc does not say anything :( - found_tfxd = TRUE; - if (!piffdemux_parse_tfxd (piffdemux, stream, &uuid_data)) - goto fail; - } else if ((UUID_TFRF == uuid_type) && piffdemux->is_live && piffdemux->lookahead_cnt) { - found_tfrf = TRUE; - if (!piffdemux_parse_tfrf (piffdemux, stream, &uuid_data)) - goto fail; - piffdemux_update_sample_offset (piffdemux, stream, uuid_offset); - running_offset += uuid_offset; - } else if (UUID_SAMPLE_ENCRYPT == uuid_type) { - if (!piffdemux_parse_sample_encryption (piffdemux, &uuid_data, stream)) - goto fail; - } else { - GST_WARNING_OBJECT (piffdemux, "Ignoring Wrong UUID..."); - } - - /* iterate all siblings */ - uuid_node = piffdemux_tree_get_sibling_by_type (uuid_node, FOURCC_uuid); - } - - if (piffdemux->is_live) { - if (!found_tfxd) { - GST_ERROR_OBJECT (piffdemux, "TFXD box is not present for live stream"); - goto fail; - } - - if (!found_tfrf && piffdemux->lookahead_cnt) { - /* when lookahead count is non-zero in manifest & if tfrf box is not present., means EOS */ - GST_INFO_OBJECT (piffdemux, "Reached Endof Live presentation.."); - - piffdemux->param = (piff_live_param_t *)malloc (sizeof (piff_live_param_t)); - if (NULL == piffdemux->param) { - GST_ERROR_OBJECT (piffdemux, "Memory not available...\n"); - goto fail; - } - piffdemux->param->count = 0; - piffdemux->param->long_info = NULL; - piffdemux->param->info = NULL; - piffdemux->param->is_eos = TRUE; /* marking EOS */ - g_signal_emit (piffdemux, gst_piffdemux_signals[SIGNAL_LIVE_PARAM], 0, piffdemux->param); - } - } - - /* if no new base_offset provided for next traf, - * base is end of current traf */ - base_offset = running_offset; - running_offset = -1; - - /* iterate all siblings */ - traf_node = piffdemux_tree_get_sibling_by_type (traf_node, FOURCC_traf); - } - g_node_destroy (moof_node); - return TRUE; - -missing_mfhd: - { - GST_DEBUG_OBJECT (piffdemux, "missing mfhd box"); - goto fail; - } - -missing_tfhd: - { - GST_DEBUG_OBJECT (piffdemux, "missing tfhd box"); - goto fail; - } -lost_offset: - { - GST_DEBUG_OBJECT (piffdemux, "lost offset"); - goto fail; - } -fail: - { - g_node_destroy (moof_node); - - GST_ELEMENT_ERROR (piffdemux, STREAM, DEMUX, - ("This file is corrupt and cannot be played."), (NULL)); - - return FALSE; - } -} - - -/* activate the given segment number @seg_idx of @stream at time @offset. - * @offset is an absolute global position over all the segments. - * - * This will push out a NEWSEGMENT event with the right values and - * position the stream index to the first decodable sample before - * @offset. - */ -static gboolean -gst_piffdemux_activate_segment (GstPiffDemux * piffdemux, PiffDemuxStream * stream, - guint32 seg_idx, guint64 offset) -{ - GstEvent *event; - PiffDemuxSegment *segment; - guint64 seg_time; - guint64 start, stop, time; - gdouble rate; - - GST_LOG_OBJECT (piffdemux, "activate segment %d, offset %" G_GUINT64_FORMAT, - seg_idx, offset); - - /* update the current segment */ - stream->segment_index = seg_idx; - - /* get the segment */ - segment = &stream->segments[seg_idx]; - - if (G_UNLIKELY (offset < segment->time)) { - GST_WARNING_OBJECT (piffdemux, "offset < segment->time %" G_GUINT64_FORMAT, - segment->time); - return FALSE; - } - - /* segment lies beyond total indicated duration */ - if (G_UNLIKELY (piffdemux->segment.duration != -1 && - segment->time > piffdemux->segment.duration)) { - GST_WARNING_OBJECT (piffdemux, "file duration %" G_GINT64_FORMAT - " < segment->time %" G_GUINT64_FORMAT, piffdemux->segment.duration, - segment->time); - return FALSE; - } - - /* get time in this segment */ - seg_time = offset - segment->time; - - GST_LOG_OBJECT (piffdemux, "seg_time %" GST_TIME_FORMAT, - GST_TIME_ARGS (seg_time)); - - if (G_UNLIKELY (seg_time > segment->duration)) { - GST_LOG_OBJECT (piffdemux, "seg_time > segment->duration %" GST_TIME_FORMAT, - GST_TIME_ARGS (segment->duration)); - return FALSE; - } - - /* piffdemux->segment.stop is in outside-time-realm, whereas - * segment->media_stop is in track-time-realm. - * - * In order to compare the two, we need to bring segment.stop - * into the track-time-realm */ - - stop = piffdemux->segment.stop; - if (stop == -1) - stop = piffdemux->segment.duration; - if (stop == -1) - stop = segment->media_stop; - else - stop = - MIN (segment->media_stop, stop - segment->time + segment->media_start); - - if (piffdemux->segment.rate >= 0) { - start = MIN (segment->media_start + seg_time, stop); - time = offset; - } else { - if (segment->media_start >= piffdemux->segment.start) { - start = segment->media_start; - time = segment->time; - } else { - start = piffdemux->segment.start; - time = segment->time + (piffdemux->segment.start - segment->media_start); - } - - start = MAX (segment->media_start, piffdemux->segment.start); - stop = MIN (segment->media_start + seg_time, stop); - } - - GST_DEBUG_OBJECT (piffdemux, "newsegment %d from %" GST_TIME_FORMAT - " to %" GST_TIME_FORMAT ", time %" GST_TIME_FORMAT, seg_idx, - GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (time)); - - /* combine global rate with that of the segment */ - rate = segment->rate * piffdemux->segment.rate; - - /* update the segment values used for clipping */ - gst_segment_init (&stream->segment, GST_FORMAT_TIME); - gst_segment_set_newsegment (&stream->segment, FALSE, rate, GST_FORMAT_TIME, - start, stop, time); - - /* now prepare and send the segment */ - event = gst_event_new_new_segment (FALSE, rate, GST_FORMAT_TIME, - start, stop, time); - gst_pad_push_event (piffdemux->srcpad, event); - /* assume we can send more data now */ - stream->last_ret = GST_FLOW_OK; - /* clear to send tags on this pad now */ - gst_piffdemux_push_tags (piffdemux, stream); - - return TRUE; -} - - -/* prepare to get the current sample of @stream, getting essential values. - * - * This function will also prepare and send the segment when needed. - * - * Return FALSE if the stream is EOS. - */ -static gboolean -gst_piffdemux_prepare_current_sample (GstPiffDemux * piffdemux, - PiffDemuxStream * stream, guint64 * offset, guint * size, guint64 * timestamp, - guint64 * duration, gboolean * keyframe) -{ - PiffDemuxSample *sample; - guint64 time_position; - guint32 seg_idx; - - g_return_val_if_fail (stream != NULL, FALSE); - - time_position = stream->time_position; - if (G_UNLIKELY (time_position == -1)) - goto eos; - - seg_idx = stream->segment_index; - if (G_UNLIKELY (seg_idx == -1)) { - /* find segment corresponding to time_position if we are looking - * for a segment. */ - seg_idx = gst_piffdemux_find_segment (piffdemux, stream, time_position); - - /* nothing found, we're really eos */ - if (seg_idx == -1) - goto eos; - } - - /* different segment, activate it, sample_index will be set. */ - if (G_UNLIKELY (stream->segment_index != seg_idx)) - gst_piffdemux_activate_segment (piffdemux, stream, seg_idx, time_position); - - GST_LOG_OBJECT (piffdemux, "segment active, index = %u of %u", - stream->sample_index, stream->n_samples); - - if (G_UNLIKELY (stream->sample_index >= stream->n_samples)) - goto eos; - - - /* now get the info for the sample we're at */ - sample = &stream->samples[stream->sample_index]; - - *timestamp = PIFFSAMPLE_PTS (stream, sample); - *offset = sample->offset; - *size = sample->size; - *duration = PIFFSAMPLE_DUR_PTS (stream, sample, *timestamp); - *keyframe = PIFFSAMPLE_KEYFRAME (stream, sample); - - return TRUE; - - /* special cases */ -eos: - { - stream->time_position = -1; - return FALSE; - } -} - -/* the input buffer metadata must be writable, - * but time/duration etc not yet set and need not be preserved */ -static GstBuffer * -gst_piffdemux_process_buffer (GstPiffDemux * piffdemux, PiffDemuxStream * stream, - GstBuffer * buf) -{ - guint8 *data; - guint size, nsize = 0; - gchar *str; - - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - if (G_UNLIKELY (stream->subtype != FOURCC_text)) { - return buf; - } - - if (G_LIKELY (size >= 2)) { - nsize = GST_READ_UINT16_BE (data); - nsize = MIN (nsize, size - 2); - } - - GST_LOG_OBJECT (piffdemux, "3GPP timed text subtitle: %d/%d", nsize, size); - - /* takes care of UTF-8 validation or UTF-16 recognition, - * no other encoding expected */ - str = gst_tag_freeform_string_to_utf8 ((gchar *) data + 2, nsize, NULL); - if (str) { - gst_buffer_unref (buf); - buf = gst_buffer_new (); - GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = (guint8 *) str; - GST_BUFFER_SIZE (buf) = strlen (str); - } else { - /* may be 0-size subtitle, which is also sent to keep pipeline going */ - GST_BUFFER_DATA (buf) = data + 2; - GST_BUFFER_SIZE (buf) = nsize; - } - - /* FIXME ? convert optional subsequent style info to markup */ - - return buf; -} - -/* Sets a buffer's attributes properly and pushes it downstream. - * Also checks for additional actions and custom processing that may - * need to be done first. - */ -static gboolean -gst_piffdemux_decorate_and_push_buffer (GstPiffDemux * piffdemux, - PiffDemuxStream * stream, GstBuffer * buf, - guint64 timestamp, guint64 duration, gboolean keyframe, guint64 position, - guint64 byte_position) -{ - GstFlowReturn ret = GST_FLOW_OK; - - if (!stream->caps) { - GST_WARNING_OBJECT (piffdemux, "caps are empty...creat any caps"); - stream->caps = gst_caps_new_any(); - if (!stream->caps) { - GST_ERROR_OBJECT (piffdemux, "failed to create caps..."); - ret = GST_FLOW_ERROR; - goto exit; - } - } - - /* position reporting */ - if (piffdemux->segment.rate >= 0) { - // TODO: Segment fault is coming here for Audio stream.. need to check - gst_segment_set_last_stop (&piffdemux->segment, GST_FORMAT_TIME, position); - //gst_piffdemux_sync_streams (piffdemux); - } - - /* send out pending buffers */ - while (stream->buffers) { - GstBuffer *buffer = (GstBuffer *) stream->buffers->data; - - if (G_UNLIKELY (stream->discont)) { - GST_LOG_OBJECT (piffdemux, "marking discont buffer"); - GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT); - stream->discont = FALSE; - } - gst_buffer_set_caps (buffer, stream->caps); - - gst_pad_push (piffdemux->srcpad, buffer); - - stream->buffers = g_slist_delete_link (stream->buffers, stream->buffers); - } - - /* we're going to modify the metadata */ - buf = gst_buffer_make_metadata_writable (buf); - - /* for subtitle processing */ - if (G_UNLIKELY (stream->need_process)) - buf = gst_piffdemux_process_buffer (piffdemux, stream, buf); - - GST_BUFFER_TIMESTAMP (buf) = timestamp; - GST_BUFFER_DURATION (buf) = duration; - GST_BUFFER_OFFSET (buf) = -1; - GST_BUFFER_OFFSET_END (buf) = -1; - - if (G_UNLIKELY (stream->padding)) { - GST_BUFFER_DATA (buf) += stream->padding; - GST_BUFFER_SIZE (buf) -= stream->padding; - } - - if (G_UNLIKELY (buf == NULL)) - goto exit; - - if (G_UNLIKELY (stream->discont)) { - GST_LOG_OBJECT (piffdemux, "marking discont buffer"); - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT); - stream->discont = FALSE; - } - - if (!keyframe) - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); - - //g_print ("\n\npad caps : %s\n\n", gst_caps_to_string (gst_pad_get_caps (stream->pad))); - - //gst_buffer_set_caps (buf, stream->caps); // commenting to avoid caps by setting properties - - - // TODO: need to see how resolution switch will work - gst_buffer_set_caps (buf, stream->caps); - - GST_LOG_OBJECT (piffdemux, - "Pushing buffer of size = %d with time %" GST_TIME_FORMAT ", duration %" - GST_TIME_FORMAT, GST_BUFFER_SIZE(buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), - GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); - -#ifdef DEC_OUT_FRAME_DUMP - { - int written = 0; - written = fwrite (GST_BUFFER_DATA (buf), sizeof (unsigned char), GST_BUFFER_SIZE (buf), piffdump); - g_print ("PIFFDEMUX: written = %d\n", written); - fflush (piffdump); - } -#endif - - ret = gst_pad_push (piffdemux->srcpad, buf); - -exit: - return ret; -} - - -/* - * next_entry_size - * - * Returns the size of the first entry at the current offset. - * If -1, there are none (which means EOS or empty file). - */ -static guint64 -next_entry_size (GstPiffDemux * demux) -{ - PiffDemuxStream *stream = demux->stream; - PiffDemuxSample *sample; - - GST_LOG_OBJECT (demux, "Finding entry at offset %" G_GUINT64_FORMAT, - demux->offset); - - GST_DEBUG_OBJECT (demux, "demux->sample_index = %d", stream->sample_index); - - if (stream->sample_index == -1) - stream->sample_index = 0; - - if (stream->sample_index >= stream->n_samples) { - GST_LOG_OBJECT (demux, "stream %d samples exhausted n_samples = %d", - stream->sample_index, stream->n_samples); - return -1; - } - - sample = &stream->samples[stream->sample_index]; - - GST_LOG_OBJECT (demux, - "Checking Stream %d (sample_index:%d / offset:%" G_GUINT64_FORMAT - " / size:%" G_GUINT32_FORMAT ")", stream->sample_index, stream->sample_index, - sample->offset, sample->size); - - GST_LOG_OBJECT (demux, "stream : demux->offset :%"G_GUINT64_FORMAT, demux->offset); - - stream = demux->stream; - sample = &stream->samples[stream->sample_index]; - - if (sample->offset >= demux->offset) { - demux->todrop = sample->offset - demux->offset; - return sample->size + demux->todrop; - } - - GST_DEBUG_OBJECT (demux, - "There wasn't any entry at offset %" G_GUINT64_FORMAT, demux->offset); - return -1; -} - -static void -gst_piffdemux_post_progress (GstPiffDemux * demux, gint num, gint denom) -{ - gint perc = (gint) ((gdouble) num * 100.0 / (gdouble) denom); - - gst_element_post_message (GST_ELEMENT_CAST (demux), - gst_message_new_element (GST_OBJECT_CAST (demux), - gst_structure_new ("progress", "percent", G_TYPE_INT, perc, NULL))); -} - -static gboolean -piffdemux_seek_offset (GstPiffDemux * demux, guint64 offset) -{ - GstEvent *event; - gboolean res = 0; - - GST_DEBUG_OBJECT (demux, "Seeking to %" G_GUINT64_FORMAT, offset); - - event = - gst_event_new_seek (1.0, GST_FORMAT_BYTES, - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, GST_SEEK_TYPE_SET, offset, - GST_SEEK_TYPE_NONE, -1); - - res = gst_pad_push_event (demux->sinkpad, event); - - return res; -} - -static GstFlowReturn -gst_piffdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) -{ - GstPiffDemux *demux; - GstFlowReturn ret = GST_FLOW_OK; - demux = GST_PIFFDEMUX (gst_pad_get_parent (sinkpad)); - - gst_adapter_push (demux->adapter, inbuf); - - /* we never really mean to buffer that much */ - if (demux->neededbytes == -1) - goto eos; - - GST_DEBUG_OBJECT (demux, "pushing in inbuf %p, neededbytes:%u, available:%u", - inbuf, demux->neededbytes, gst_adapter_available (demux->adapter)); - - while (((gst_adapter_available (demux->adapter)) >= demux->neededbytes) && - (ret == GST_FLOW_OK)) { - - GST_DEBUG_OBJECT (demux, - "state:%d , demux->neededbytes:%d, demux->offset:%" G_GUINT64_FORMAT, - demux->state, demux->neededbytes, demux->offset); - - switch (demux->state) { - case PIFFDEMUX_STATE_INITIAL:{ - const guint8 *data; - guint32 fourcc; - guint64 size; - - data = gst_adapter_peek (demux->adapter, demux->neededbytes); - - /* get fourcc/length, set neededbytes */ - extract_initial_length_and_fourcc ((guint8 *) data, demux->neededbytes, - &size, &fourcc); - GST_DEBUG_OBJECT (demux, "Peeking found [%" GST_FOURCC_FORMAT "] " - "size: %" G_GUINT64_FORMAT, GST_FOURCC_ARGS (fourcc), size); - if (size == 0) { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, - ("This file is invalid and cannot be played."), - ("initial atom '%" GST_FOURCC_FORMAT "' has empty length", - GST_FOURCC_ARGS (fourcc))); - - ret = GST_FLOW_ERROR; - break; - } - - if (fourcc == FOURCC_mdat) { - if (demux->moof_rcvd) { - /* we have the headers, start playback */ - demux->state = PIFFDEMUX_STATE_MOVIE; - demux->neededbytes = next_entry_size (demux); - demux->mdatleft = size; - - /* Only post, event on pads is done after newsegment */ - piffdemux_post_global_tags (demux); - } else { - GST_ERROR_OBJECT (demux, "mdata received before moof.. not handled"); - goto unknown_stream; - } - } else if (G_UNLIKELY (size > PIFFDEMUX_MAX_ATOM_SIZE)) { - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, - ("This file is invalid and cannot be played."), - ("atom %" GST_FOURCC_FORMAT " has bogus size %" G_GUINT64_FORMAT, - GST_FOURCC_ARGS (fourcc), size)); - ret = GST_FLOW_ERROR; - break; - } else { - demux->neededbytes = size; - demux->state = PIFFDEMUX_STATE_HEADER; - } - break; - } - case PIFFDEMUX_STATE_HEADER:{ - const guint8 *data; - guint32 fourcc; - - GST_DEBUG_OBJECT (demux, "In header"); - - data = gst_adapter_peek (demux->adapter, demux->neededbytes); - - /* parse the header */ - extract_initial_length_and_fourcc (data, demux->neededbytes, NULL, - &fourcc); - if (fourcc == FOURCC_moof) { - GST_DEBUG_OBJECT (demux, "Parsing [moof]"); - if (!piffdemux_parse_moof (demux, data, demux->neededbytes, - demux->offset, demux->stream)) { - ret = GST_FLOW_ERROR; - goto done; - } - demux->moof_rcvd = TRUE; - } else { - GST_WARNING_OBJECT (demux, - "Unknown fourcc while parsing header : %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (fourcc)); - /* Let's jump that one and go back to initial state */ - } - - if (demux->mdatbuffer) { - /* the mdat was before the header */ - GST_DEBUG_OBJECT (demux, "We have mdatbuffer:%p", - demux->mdatbuffer); - gst_adapter_clear (demux->adapter); - demux->mdatbuffer = NULL; - demux->offset = demux->mdatoffset; - demux->neededbytes = next_entry_size (demux); - demux->state = PIFFDEMUX_STATE_MOVIE; - demux->mdatleft = gst_adapter_available (demux->adapter); - - /* Only post, event on pads is done after newsegment */ - piffdemux_post_global_tags (demux); - } else { - GST_DEBUG_OBJECT (demux, "Carrying on normally"); - gst_adapter_flush (demux->adapter, demux->neededbytes); - demux->offset += demux->neededbytes; - demux->neededbytes = 16; - demux->state = PIFFDEMUX_STATE_INITIAL; - } - - break; - } - case PIFFDEMUX_STATE_BUFFER_MDAT:{ - GstBuffer *buf; - - GST_DEBUG_OBJECT (demux, "Got our buffer at offset %" G_GUINT64_FORMAT, - demux->offset); - buf = gst_adapter_take_buffer (demux->adapter, demux->neededbytes); - GST_DEBUG_OBJECT (demux, "mdatbuffer starts with %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (PIFF_FOURCC (GST_BUFFER_DATA (buf) + 4))); - if (demux->mdatbuffer) - demux->mdatbuffer = gst_buffer_join (demux->mdatbuffer, buf); - else - demux->mdatbuffer = buf; - demux->offset += demux->neededbytes; - demux->neededbytes = 16; - demux->state = PIFFDEMUX_STATE_INITIAL; - gst_piffdemux_post_progress (demux, 1, 1); - - break; - } - case PIFFDEMUX_STATE_MOVIE:{ - GstBuffer *outbuf; - PiffDemuxStream *stream = demux->stream; - PiffDemuxSample *sample; - guint64 timestamp, duration, position; - gboolean keyframe; - - GST_DEBUG_OBJECT (demux, - "BEGIN // in MOVIE for offset %" G_GUINT64_FORMAT, demux->offset); - - if (demux->fragmented) { - GST_DEBUG_OBJECT (demux, "mdat remaining %" G_GUINT64_FORMAT, - demux->mdatleft); - if (G_LIKELY (demux->todrop < demux->mdatleft)) { - /* if needed data starts within this atom, - * then it should not exceed this atom */ - if (G_UNLIKELY (demux->neededbytes > demux->mdatleft)) { - - GST_ELEMENT_ERROR (demux, STREAM, DEMUX, - ("This file is invalid and cannot be played."), - ("sample data crosses atom boundary")); - - ret = GST_FLOW_ERROR; - break; - } - demux->mdatleft -= demux->neededbytes; - } else { - GST_DEBUG_OBJECT (demux, "data atom emptied; resuming atom scan"); - /* so we are dropping more than left in this atom */ - demux->todrop -= demux->mdatleft; - demux->neededbytes -= demux->mdatleft; - demux->mdatleft = 0; - /* need to resume atom parsing so we do not miss any other pieces */ - demux->state = PIFFDEMUX_STATE_INITIAL; - demux->neededbytes = 16; - break; - } - } - - if (demux->todrop) { - GST_LOG_OBJECT (demux, "Dropping %d bytes", demux->todrop); - gst_adapter_flush (demux->adapter, demux->todrop); - demux->neededbytes -= demux->todrop; - demux->offset += demux->todrop; - } - - if ( !stream->sent_nsevent) { - //TODO: better to parse sink event function and send that new_segment -#if 1 - demux->pending_newsegment = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, - demux->stream->start_ts, -1, demux->stream->start_ts); -#else - demux->pending_newsegment = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, - 0, gst_util_uint64_scale (stream->duration, GST_SECOND, stream->timescale), 0); -#endif - - GST_INFO_OBJECT (demux, "New segment event : start = %"GST_TIME_FORMAT", stop = %" GST_TIME_FORMAT, - GST_TIME_ARGS (demux->stream->start_ts), GST_TIME_ARGS(gst_util_uint64_scale (stream->duration, GST_SECOND, stream->timescale))); - - if (!gst_pad_push_event (demux->srcpad, demux->pending_newsegment)) { - GST_ERROR_OBJECT (demux, "failding to send new segment..."); - goto newsegment_error; - } - stream->sent_nsevent = TRUE; - } - - /* Put data in a buffer, set timestamps, caps, ... */ - outbuf = gst_adapter_take_buffer (demux->adapter, demux->neededbytes); - - GST_DEBUG_OBJECT (demux, "Taken %d size buffer from adapter...", outbuf ? GST_BUFFER_SIZE (outbuf) : 0); - GST_DEBUG_OBJECT (demux, "stream : %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (stream->fourcc)); - - g_return_val_if_fail (outbuf != NULL, GST_FLOW_ERROR); - - sample = &stream->samples[stream->sample_index]; - - GST_DEBUG_OBJECT (demux, "start_ts = %"GST_TIME_FORMAT" ts : %"GST_TIME_FORMAT" ts = %llu, pts_offset = %u, scale = %d\n", - GST_TIME_ARGS(stream->start_ts),GST_TIME_ARGS(sample->timestamp), sample->timestamp, - sample->pts_offset,stream->timescale); - - position = PIFFSAMPLE_DTS (stream, sample); - timestamp = PIFFSAMPLE_PTS (stream, sample) + stream->start_ts; // Adding to avoid resetting of timestamp - duration = PIFFSAMPLE_DUR_DTS (stream, sample, position); - keyframe = PIFFSAMPLE_KEYFRAME (stream, sample); - - ret = gst_piffdemux_decorate_and_push_buffer (demux, stream, outbuf, - timestamp, duration, keyframe, position, demux->offset); - - stream->sample_index++; - - /* update current offset and figure out size of next buffer */ - GST_LOG_OBJECT (demux, "increasing offset %" G_GUINT64_FORMAT " by %u", - demux->offset, demux->neededbytes); - demux->offset += demux->neededbytes; - GST_LOG_OBJECT (demux, "offset is now %" G_GUINT64_FORMAT, - demux->offset); - - if ((demux->neededbytes = next_entry_size (demux)) == -1) { - GST_DEBUG_OBJECT (demux, "finished parsing mdat, need to search next moof atom"); - demux->neededbytes = 16; - demux->state = PIFFDEMUX_STATE_INITIAL; - GST_DEBUG ("\n\n Storing %s last_ts %"GST_TIME_FORMAT"\n\n", stream->subtype == FOURCC_vide ? "video" : "audio", GST_TIME_ARGS(timestamp)); - stream->start_ts = timestamp + duration; - //goto eos; - } - break; - } - default: - goto invalid_state; - } - } - - /* when buffering movie data, at least show user something is happening */ - if (ret == GST_FLOW_OK && demux->state == PIFFDEMUX_STATE_BUFFER_MDAT && - gst_adapter_available (demux->adapter) <= demux->neededbytes) { - gst_piffdemux_post_progress (demux, gst_adapter_available (demux->adapter), - demux->neededbytes); - } -done: - gst_object_unref (demux); - - return ret; - - /* ERRORS */ -unknown_stream: - { - GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL), ("unknown stream found")); - ret = GST_FLOW_ERROR; - goto done; - } -eos: - { - GST_DEBUG_OBJECT (demux, "no next entry, EOS"); - ret = GST_FLOW_UNEXPECTED; - goto done; - } -invalid_state: - { - GST_ELEMENT_ERROR (demux, STREAM, FAILED, - (NULL), ("piffdemuxer invalid state %d", demux->state)); - ret = GST_FLOW_ERROR; - goto done; - } -newsegment_error: - { - GST_ELEMENT_ERROR (demux, STREAM, FAILED, - (NULL), ("could not send newsegment event")); - ret = GST_FLOW_ERROR; - goto done; - } -} - -static gboolean -piffdemux_parse_container (GstPiffDemux * piffdemux, GNode * node, const guint8 * buf, - const guint8 * end) -{ - while (G_UNLIKELY (buf < end)) { - GNode *child; - guint32 len; - - if (G_UNLIKELY (buf + 4 > end)) { - GST_LOG_OBJECT (piffdemux, "buffer overrun"); - break; - } - len = PIFF_UINT32 (buf); - if (G_UNLIKELY (len == 0)) { - GST_LOG_OBJECT (piffdemux, "empty container"); - break; - } - if (G_UNLIKELY (len < 8)) { - GST_WARNING_OBJECT (piffdemux, "length too short (%d < 8)", len); - break; - } - if (G_UNLIKELY (len > (end - buf))) { - GST_WARNING_OBJECT (piffdemux, "length too long (%d > %d)", len, - (gint) (end - buf)); - break; - } - - child = g_node_new ((guint8 *) buf); - g_node_append (node, child); - GST_LOG_OBJECT (piffdemux, "adding new node of len %d", len); - piffdemux_parse_node (piffdemux, child, buf, len); - - buf += len; - } - return TRUE; -} - - -static gboolean -piffdemux_parse_node (GstPiffDemux * piffdemux, GNode * node, const guint8 * buffer, - guint length) -{ - guint32 fourcc = 0; - guint32 node_length = 0; - const PiffNodeType *type; - const guint8 *end; - - GST_LOG_OBJECT (piffdemux, "piffdemux_parse buffer %p length %u", buffer, length); - - if (G_UNLIKELY (length < 8)) - goto not_enough_data; - - node_length = PIFF_UINT32 (buffer); - fourcc = PIFF_FOURCC (buffer + 4); - - /* ignore empty nodes */ - if (G_UNLIKELY (fourcc == 0 || node_length == 8)) - return TRUE; - - type = piffdemux_type_get (fourcc); - - end = buffer + length; - - GST_LOG_OBJECT (piffdemux, - "parsing '%" GST_FOURCC_FORMAT "', length=%u, name '%s'", - GST_FOURCC_ARGS (fourcc), node_length, type->name); - - if (node_length > length) - goto broken_atom_size; - - if (type->flags & PIFF_FLAG_CONTAINER) { - piffdemux_parse_container (piffdemux, node, buffer + 8, end); - } - GST_LOG_OBJECT (piffdemux, "parsed '%" GST_FOURCC_FORMAT "'", - GST_FOURCC_ARGS (fourcc)); - return TRUE; - -/* ERRORS */ -not_enough_data: - { - - GST_ELEMENT_ERROR (piffdemux, STREAM, DEMUX, - ("This file is corrupt and cannot be played."), - ("Not enough data for an atom header, got only %u bytes", length)); - - return FALSE; - } -broken_atom_size: - { - GST_ELEMENT_ERROR (piffdemux, STREAM, DEMUX, - ("This file is corrupt and cannot be played."), - ("Atom '%" GST_FOURCC_FORMAT "' has size of %u bytes, but we have only " - "%u bytes available.", GST_FOURCC_ARGS (fourcc), node_length, - length)); - - return FALSE; - } -} - - -static GNode * -piffdemux_tree_get_child_by_type (GNode * node, guint32 fourcc) -{ - GNode *child; - guint8 *buffer; - guint32 child_fourcc; - - for (child = g_node_first_child (node); child; - child = g_node_next_sibling (child)) { - buffer = (guint8 *) child->data; - - child_fourcc = PIFF_FOURCC (buffer + 4); - - if (G_UNLIKELY (child_fourcc == fourcc)) { - return child; - } - } - return NULL; -} - -static GNode * -piffdemux_tree_get_child_by_type_full (GNode * node, guint32 fourcc, - GstByteReader * parser) -{ - GNode *child; - guint8 *buffer; - guint32 child_fourcc, child_len; - - for (child = g_node_first_child (node); child; - child = g_node_next_sibling (child)) { - buffer = (guint8 *) child->data; - - child_len = PIFF_UINT32 (buffer); - child_fourcc = PIFF_FOURCC (buffer + 4); - - if (G_UNLIKELY (child_fourcc == fourcc)) { - if (G_UNLIKELY (child_len < (4 + 4))) - return NULL; - /* FIXME: must verify if atom length < parent atom length */ - gst_byte_reader_init (parser, buffer + (4 + 4), child_len - (4 + 4)); - return child; - } - } - return NULL; -} - -static GNode * -piffdemux_tree_get_sibling_by_type_full (GNode * node, guint32 fourcc, - GstByteReader * parser) -{ - GNode *child; - guint8 *buffer; - guint32 child_fourcc, child_len; - - for (child = g_node_next_sibling (node); child; - child = g_node_next_sibling (child)) { - buffer = (guint8 *) child->data; - - child_fourcc = PIFF_FOURCC (buffer + 4); - - if (child_fourcc == fourcc) { - if (parser) { - child_len = PIFF_UINT32 (buffer); - if (G_UNLIKELY (child_len < (4 + 4))) - return NULL; - /* FIXME: must verify if atom length < parent atom length */ - gst_byte_reader_init (parser, buffer + (4 + 4), child_len - (4 + 4)); - } - return child; - } - } - return NULL; -} - -static GNode * -piffdemux_tree_get_sibling_by_type (GNode * node, guint32 fourcc) -{ - return piffdemux_tree_get_sibling_by_type_full (node, fourcc, NULL); -} - -#define _codec(name) \ - do { \ - if (codec_name) { \ - *codec_name = g_strdup (name); \ - } \ - } while (0) - -void -gst_piffdemux_set_video_params (GstPiffDemux * piffdemux, guint fourcc, - guint width, guint height, - guint fps_n, guint fps_d, unsigned char *codec_data, unsigned int codec_data_len) -{ - GstCaps *caps = NULL; - GstBuffer *dci = NULL; - - if (codec_data && codec_data_len) { - dci = gst_buffer_new_and_alloc (codec_data_len); - if (!dci) { - GST_ERROR_OBJECT (piffdemux, "failed to create codec data buffer..."); - } else { - memcpy (GST_BUFFER_DATA(dci), codec_data, codec_data_len); - } - } - - switch (fourcc) { - - case GST_MAKE_FOURCC ('a', 'v', 'c', '1'): - caps = gst_caps_new_simple ("video/x-h264", - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", GST_TYPE_FRACTION, fps_n, fps_d, - "stream-format", G_TYPE_STRING, "avc", - "alignment", G_TYPE_STRING, "au", - "codec_data", GST_TYPE_BUFFER, dci, - NULL); - break; - - case FOURCC_ovc1: - caps = gst_caps_new_simple ("video/x-wmv", - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", GST_TYPE_FRACTION, fps_n, fps_d, - "wmvversion", G_TYPE_INT, 3, - "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('W', 'V', 'C', '1'), - "codec_data", GST_TYPE_BUFFER, dci, - NULL); - break; - - default: { - char *s; - s = g_strdup_printf ("video/x-gst-fourcc-%" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (fourcc)); - caps = gst_caps_new_simple (s, - "width", G_TYPE_INT, width, - "height", G_TYPE_INT, height, - "framerate", GST_TYPE_FRACTION, fps_n, fps_d, - "codec_data", GST_TYPE_BUFFER, dci, - NULL); - break; - } - } - - piffdemux->stream->caps = caps; - GST_INFO_OBJECT (piffdemux, "prepared video caps : %s", gst_caps_to_string(caps)); -} - -void -gst_piffdemux_set_audio_params (GstPiffDemux * piffdemux, guint fourcc, - guint sampling_rate, guint bps, guint channels, unsigned char *codec_data, unsigned int codec_data_len) -{ - GstCaps *caps = NULL; - GstBuffer *dci = NULL; - - if (codec_data && codec_data_len) { - dci = gst_buffer_new_and_alloc (codec_data_len); - if (!dci) { - GST_ERROR_OBJECT (piffdemux, "failed to create codec data buffer..."); - } else { - memcpy (GST_BUFFER_DATA(dci), codec_data, codec_data_len); - } - } - - switch (fourcc) { - - case GST_MAKE_FOURCC ('m', 'p', '4', 'a'): - caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 4, - "framed", G_TYPE_BOOLEAN, TRUE, - "stream-format", G_TYPE_STRING, "raw", - "rate", G_TYPE_INT, (int) sampling_rate, - "channels", G_TYPE_INT, channels, - NULL); - break; - - case FOURCC_owma: - caps = gst_caps_new_simple ("audio/x-wma", - "rate", G_TYPE_INT, (int) sampling_rate, - "channels", G_TYPE_INT, channels, - NULL); - break; - - default: { - char *s; - s = g_strdup_printf ("audio/x-gst-fourcc-%" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (fourcc)); - caps = gst_caps_new_simple (s, - "rate", G_TYPE_INT, (int) sampling_rate, - "channels", G_TYPE_INT, channels, - NULL); - break; - } - } - - piffdemux->stream->caps = caps; - GST_INFO_OBJECT (piffdemux, "prepared audio caps : %s", gst_caps_to_string(caps)); - -} - -#define g_marshal_value_peek_object(v) g_value_get_object (v) - -void -__gst_piffdemux_marshal_BOOLEAN__OBJECT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT) (gpointer data1, - gpointer arg_1, - gpointer data2); - register GMarshalFunc_BOOLEAN__OBJECT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 2); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__OBJECT) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_object (param_values + 1), - data2); - - g_value_set_boolean (return_value, v_return); -} - -#define PIFFDEMUX_SPSPPS_LENGTH_SIZE 2 - -static gboolean -ConvertH264_MetaDCI_to_3GPPDCI(unsigned char *dci_meta_buf, unsigned int dci_meta_size, unsigned char **dci_3gpp_buf, unsigned int *dci_3gpp_size) -{ - unsigned short unit_size = 0; - unsigned int total_size = 0; - unsigned char unit_nb = 0; - unsigned char sps_done = 0; - const unsigned char *extradata = NULL; - unsigned int h264_nal_length_size = 0; - unsigned char *out = NULL; - //g_print ("\n\nConvertH264_MetaDCI_to_3GPPDCI Entering.............\n"); - - /* nothing to filter */ - if ((dci_meta_buf == NULL) || (dci_meta_size < 6)) - { - GST_ERROR ("Insufficient codec data...\n"); - return FALSE; - } - - /* Removing unnecessary info in meta data */ - extradata = (unsigned char *)dci_meta_buf + 4; - - /* retrieve Length of Length*/ - h264_nal_length_size = (*extradata++ & 0x03) + 1; - - GST_LOG ("Length Of Length is %d\n", h264_nal_length_size); - if (h264_nal_length_size == 3) - { - GST_ERROR ("LengthOfLength is WRONG...\n"); - return FALSE; - } - - /* retrieve sps and pps unit(s) */ - unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */ - GST_LOG ("No. of SPS units = %u\n", unit_nb); - - if (!unit_nb) - { - GST_ERROR ("SPS is not present....\n"); - return FALSE; - } - - while (unit_nb--) - { - /* get SPS/PPS data Length*/ - unit_size = PIFFDEMUX_RB16(extradata); - - GST_LOG ("SPS size = %d", unit_size); - - /* Extra 4 bytes for adding size of the packet */ - total_size += unit_size + h264_nal_length_size; - - /* Check if SPS/PPS Data Length crossed buffer Length */ - if ((extradata + 2 + unit_size) > (dci_meta_buf + dci_meta_size)) - { - GST_ERROR ("SPS Length is wrong in DCI...\n"); - return FALSE; - } - out = realloc(out, total_size); - if (!out) - { - GST_ERROR ("realloc FAILED...\n"); - return FALSE; - } - /* Copy length of SPS header */ - // tmp = (unsigned int *)(out + total_size - unit_size - h264_nal_length_size); - // *tmp = unit_size; - (out + total_size - unit_size - h264_nal_length_size)[0] = 0; - (out + total_size - unit_size - h264_nal_length_size)[1] = 0; - (out + total_size - unit_size - h264_nal_length_size)[2] = 0; - (out + total_size - unit_size - h264_nal_length_size)[3] = (unsigned char)unit_size; - - // memcpy(out + total_size - unit_size - h264_nal_length_size, &unit_size, h264_nal_length_size); - //g_print ("out[0] = %02x, out[1] = %02x, out[2] = %02x = out[3] = %02x\n", - // out[total_size - unit_size - h264_nal_length_size], out[total_size - unit_size - h264_nal_length_size+1], - // out[total_size - unit_size - h264_nal_length_size + 2], out[total_size - unit_size - h264_nal_length_size + 3]); - - /* Copy SPS/PPS Length and data */ - memcpy(out + total_size - unit_size, extradata + PIFFDEMUX_SPSPPS_LENGTH_SIZE, unit_size); - - extradata += (PIFFDEMUX_SPSPPS_LENGTH_SIZE + unit_size); - - if (!unit_nb && !sps_done++) - { - /* Completed reading SPS data, now read PPS data */ - unit_nb = *extradata++; /* number of pps unit(s) */ - GST_DEBUG ("No. of PPS units = %d\n", unit_nb); - } - } - - *dci_3gpp_buf = malloc (total_size); - if (NULL == *dci_3gpp_buf) - { - GST_ERROR ("Memory Allocation FAILED...\n"); - free (out); - return FALSE; - } - - memcpy(*dci_3gpp_buf, out, total_size); - *dci_3gpp_size = total_size; - - GST_DEBUG ("SPS_PPS size = %d\n", total_size); - - if (out) - { - free(out); - } - return TRUE; - } - diff --git a/piffdemux/src/piffdemux.h b/piffdemux/src/piffdemux.h deleted file mode 100755 index d23926b..0000000 --- a/piffdemux/src/piffdemux.h +++ /dev/null @@ -1,125 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_PIFFDEMUX_H__ -#define __GST_PIFFDEMUX_H__ - -#include -#include -#include "piffcommon.h" - -G_BEGIN_DECLS - -GST_DEBUG_CATEGORY_EXTERN (piffdemux_debug); -#define GST_CAT_DEFAULT piffdemux_debug - -#define GST_TYPE_PIFFDEMUX \ - (gst_piffdemux_get_type()) -#define GST_PIFFDEMUX(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PIFFDEMUX,GstPiffDemux)) -#define GST_PIFFDEMUX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PIFFDEMUX,GstPiffDemuxClass)) -#define GST_IS_PIFFDEMUX(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PIFFDEMUX)) -#define GST_IS_PIFFDEMUX_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PIFFDEMUX)) - -#define GST_PIFFDEMUX_CAST(obj) ((GstPiffDemux *)(obj)) - -/* piffdemux produces these for atoms it cannot parse */ -#define GST_PIFF_DEMUX_PRIVATE_TAG "private-piff-tag" -#define GST_PIFF_DEMUX_CLASSIFICATION_TAG "classification" - -#define GST_PIFFDEMUX_MAX_STREAMS 8 - -typedef struct _GstPiffDemux GstPiffDemux; -typedef struct _GstPiffDemuxClass GstPiffDemuxClass; -typedef struct _PiffDemuxStream PiffDemuxStream; - -struct _GstPiffDemux { - GstElement element; - - /* pads */ - GstPad *sinkpad; - GstPad *srcpad; - - PiffDemuxStream *stream; - - guint32 timescale; - gint64 duration; - - gboolean fragmented; - - guint64 moof_offset; - - gint state; - - gboolean posted_redirect; - - /* push based variables */ - guint neededbytes; - guint todrop; - GstAdapter *adapter; - GstBuffer *mdatbuffer; - guint64 mdatleft; - - /* offset of the media data (i.e.: Size of header) */ - guint64 offset; - /* offset of the mdat atom */ - guint64 mdatoffset; - guint64 first_mdat; - - GstTagList *tag_list; - - /* configured playback region */ - GstSegment segment; - gboolean segment_running; - GstEvent *pending_newsegment; - - /* gst index support */ - GstIndex *element_index; - gint index_id; - - gint64 requested_seek_time; - guint64 seek_offset; - gboolean moof_rcvd; - - /* live specific params */ - piff_live_param_t *param; - guint lookahead_cnt; - gboolean is_live; -}; - -struct _GstPiffDemuxClass { - GstElementClass parent_class; - void (*live_param) (GstPiffDemux *piff, const piff_live_param_t *param); -}; - -GType gst_piffdemux_get_type (void); - -/* prepares video caps based on input params */ -void gst_piffdemux_set_video_params (GstPiffDemux * piffdemux, guint fourcc, guint width, guint height, guint fps_n, guint fps_d, unsigned char *codec_data, unsigned int codec_data_len); -/* prepares audio caps based on input params */ -void gst_piffdemux_set_audio_params (GstPiffDemux * piffdemux, guint fourcc, - guint sampling_rate, guint bps, guint channels, unsigned char *codec_data, unsigned int codec_data_len); -G_END_DECLS - -#endif /* __GST_PIFFDEMUX_H__ */ - diff --git a/piffdemux/src/piffdemux_dump.c b/piffdemux/src/piffdemux_dump.c deleted file mode 100755 index b2d55f7..0000000 --- a/piffdemux/src/piffdemux_dump.c +++ /dev/null @@ -1,325 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * Copyright (C) 2009 Tim-Philipp Müller - * Copyright (C) <2009> STEricsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "piffdemux_types.h" -#include "piffdemux_dump.h" - -#include "piffatomparser.h" - -#include - -#define GET_UINT8(data) gst_byte_reader_get_uint8_unchecked(data) -#define GET_UINT16(data) gst_byte_reader_get_uint16_be_unchecked(data) -#define GET_UINT32(data) gst_byte_reader_get_uint32_be_unchecked(data) -#define GET_UINT64(data) gst_byte_reader_get_uint64_be_unchecked(data) -#define GET_FP32(data) (gst_byte_reader_get_uint32_be_unchecked(data)/65536.0) -#define GET_FP16(data) (gst_byte_reader_get_uint16_be_unchecked(data)/256.0) -#define GET_FOURCC(data) piff_atom_parser_get_fourcc_unchecked(data) - -gboolean -piffdemux_dump_vmhd (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - if (!piff_atom_parser_has_remaining (data, 4 + 4)) - return FALSE; - - GST_LOG ("%*s version/flags: %08x", depth, "", GET_UINT32 (data)); - GST_LOG ("%*s mode/color: %08x", depth, "", GET_UINT32 (data)); - return TRUE; -} - - -gboolean -piffdemux_dump_mfro (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - if (!piff_atom_parser_has_remaining (data, 4)) - return FALSE; - - GST_LOG ("%*s size: %d", depth, "", GET_UINT32 (data)); - return TRUE; -} - -gboolean -piffdemux_dump_tfra (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - guint64 time = 0, moof_offset = 0; - guint32 len = 0, num_entries = 0, ver_flags = 0, track_id = 0, i; - guint value_size, traf_size, trun_size, sample_size; - - if (!gst_byte_reader_get_uint32_be (data, &ver_flags)) - return FALSE; - - GST_LOG ("%*s version/flags: %08x", depth, "", ver_flags); - - if (!gst_byte_reader_get_uint32_be (data, &track_id) || - gst_byte_reader_get_uint32_be (data, &len) || - gst_byte_reader_get_uint32_be (data, &num_entries)) - return FALSE; - - GST_LOG ("%*s track ID: %u", depth, "", track_id); - GST_LOG ("%*s length: 0x%x", depth, "", len); - GST_LOG ("%*s n entries: %u", depth, "", num_entries); - - value_size = ((ver_flags >> 24) == 1) ? sizeof (guint64) : sizeof (guint32); - sample_size = (len & 3) + 1; - trun_size = ((len & 12) >> 2) + 1; - traf_size = ((len & 48) >> 4) + 1; - - if (!piff_atom_parser_has_chunks (data, num_entries, - value_size + value_size + traf_size + trun_size + sample_size)) - return FALSE; - - for (i = 0; i < num_entries; i++) { - piff_atom_parser_get_offset (data, value_size, &time); - piff_atom_parser_get_offset (data, value_size, &moof_offset); - GST_LOG ("%*s time: %" G_GUINT64_FORMAT, depth, "", time); - GST_LOG ("%*s moof_offset: %" G_GUINT64_FORMAT, - depth, "", moof_offset); - GST_LOG ("%*s traf_number: %u", depth, "", - piff_atom_parser_get_uint_with_size_unchecked (data, traf_size)); - GST_LOG ("%*s trun_number: %u", depth, "", - piff_atom_parser_get_uint_with_size_unchecked (data, trun_size)); - GST_LOG ("%*s sample_number: %u", depth, "", - piff_atom_parser_get_uint_with_size_unchecked (data, sample_size)); - } - - return TRUE; -} - -gboolean -piffdemux_dump_tfhd (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - guint32 flags = 0, n = 0, track_id = 0; - guint64 base_data_offset = 0; - - if (!gst_byte_reader_skip (data, 1) || - !gst_byte_reader_get_uint24_be (data, &flags)) - return FALSE; - GST_LOG ("%*s flags: %08x", depth, "", flags); - - if (!gst_byte_reader_get_uint32_be (data, &track_id)) - return FALSE; - GST_LOG ("%*s track_id: %u", depth, "", track_id); - - if (flags & TF_BASE_DATA_OFFSET) { - if (!gst_byte_reader_get_uint64_be (data, &base_data_offset)) - return FALSE; - GST_LOG ("%*s base-data-offset: %" G_GUINT64_FORMAT, - depth, "", base_data_offset); - } - - if (flags & TF_SAMPLE_DESCRIPTION_INDEX) { - if (!gst_byte_reader_get_uint32_be (data, &n)) - return FALSE; - GST_LOG ("%*s sample-description-index: %u", depth, "", n); - } - - if (flags & TF_DEFAULT_SAMPLE_DURATION) { - if (!gst_byte_reader_get_uint32_be (data, &n)) - return FALSE; - GST_LOG ("%*s default-sample-duration: %u", depth, "", n); - } - - if (flags & TF_DEFAULT_SAMPLE_SIZE) { - if (!gst_byte_reader_get_uint32_be (data, &n)) - return FALSE; - GST_LOG ("%*s default-sample-size: %u", depth, "", n); - } - - if (flags & TF_DEFAULT_SAMPLE_FLAGS) { - if (!gst_byte_reader_get_uint32_be (data, &n)) - return FALSE; - GST_LOG ("%*s default-sample-flags: %u", depth, "", n); - } - - GST_LOG ("%*s duration-is-empty: %s", depth, "", - flags & TF_DURATION_IS_EMPTY ? "yes" : "no"); - - return TRUE; -} - -gboolean -piffdemux_dump_trun (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - guint32 flags = 0, samples_count = 0, data_offset = 0, first_sample_flags = 0; - guint32 sample_duration = 0, sample_size = 0, sample_flags = - 0, composition_time_offsets = 0; - int i = 0; - - if (!gst_byte_reader_skip (data, 1) || - !gst_byte_reader_get_uint24_be (data, &flags)) - return FALSE; - - GST_LOG ("%*s flags: %08x", depth, "", flags); - - if (!gst_byte_reader_get_uint32_be (data, &samples_count)) - return FALSE; - GST_LOG ("%*s samples_count: %u", depth, "", samples_count); - - if (flags & TR_DATA_OFFSET) { - if (!gst_byte_reader_get_uint32_be (data, &data_offset)) - return FALSE; - GST_LOG ("%*s data-offset: %u", depth, "", data_offset); - } - - if (flags & TR_FIRST_SAMPLE_FLAGS) { - if (!gst_byte_reader_get_uint32_be (data, &first_sample_flags)) - return FALSE; - GST_LOG ("%*s first-sample-flags: %u", depth, "", first_sample_flags); - } - - for (i = 0; i < samples_count; i++) { - if (flags & TR_SAMPLE_DURATION) { - if (!gst_byte_reader_get_uint32_be (data, &sample_duration)) - return FALSE; - GST_LOG ("%*s sample-duration: %u", depth, "", sample_duration); - } - - if (flags & TR_SAMPLE_SIZE) { - if (!gst_byte_reader_get_uint32_be (data, &sample_size)) - return FALSE; - GST_LOG ("%*s sample-size: %u", depth, "", sample_size); - } - - if (flags & TR_SAMPLE_FLAGS) { - if (!gst_byte_reader_get_uint32_be (data, &sample_flags)) - return FALSE; - GST_LOG ("%*s sample-flags: %u", depth, "", sample_flags); - } - - if (flags & TR_COMPOSITION_TIME_OFFSETS) { - if (!gst_byte_reader_get_uint32_be (data, &composition_time_offsets)) - return FALSE; - GST_LOG ("%*s composition_time_offsets: %u", depth, "", - composition_time_offsets); - } - } - - return TRUE; -} - -gboolean -piffdemux_dump_trex (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - if (!piff_atom_parser_has_remaining (data, 4 + 4 + 4 + 4 + 4 + 4)) - return FALSE; - - GST_LOG ("%*s version/flags: %08x", depth, "", GET_UINT32 (data)); - GST_LOG ("%*s track ID: %08x", depth, "", GET_UINT32 (data)); - GST_LOG ("%*s default sample desc. index: %08x", depth, "", - GET_UINT32 (data)); - GST_LOG ("%*s default sample duration: %08x", depth, "", - GET_UINT32 (data)); - GST_LOG ("%*s default sample size: %08x", depth, "", - GET_UINT32 (data)); - GST_LOG ("%*s default sample flags: %08x", depth, "", - GET_UINT32 (data)); - - return TRUE; -} - - -gboolean -piffdemux_dump_sdtp (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - guint32 version; - guint8 val; - guint i = 1; - - version = GET_UINT32 (data); - GST_LOG ("%*s version/flags: %08x", depth, "", version); - - /* the sample_count is specified in the stsz or stz2 box. - * the information for a sample is stored in a single byte, - * so we read until there are no remaining bytes */ - while (piff_atom_parser_has_remaining (data, 1)) { - val = GET_UINT8 (data); - GST_LOG ("%*s sample number: %d", depth, "", i); - GST_LOG ("%*s sample_depends_on: %d", depth, "", - ((guint16) (val)) & 0x3); - GST_LOG ("%*s sample_is_depended_on: %d", depth, "", - ((guint16) (val >> 2)) & 0x3); - GST_LOG ("%*s sample_has_redundancy: %d", depth, "", - ((guint16) (val >> 4)) & 0x3); - ++i; - } - return TRUE; -} - -gboolean -piffdemux_dump_unknown (GstPiffDemux * piffdemux, GstByteReader * data, int depth) -{ - int len; - - len = gst_byte_reader_get_remaining (data); - GST_LOG ("%*s length: %d", depth, "", len); - - GST_MEMDUMP_OBJECT (piffdemux, "unknown atom data", - gst_byte_reader_peek_data_unchecked (data), len); - return TRUE; -} - -static gboolean -piffdemux_node_dump_foreach (GNode * node, gpointer piffdemux) -{ - GstByteReader parser; - guint8 *buffer = (guint8 *) node->data; /* FIXME: move to byte reader */ - guint32 node_length; - guint32 fourcc; - const PiffNodeType *type; - int depth; - - node_length = GST_READ_UINT32_BE (buffer); - fourcc = GST_READ_UINT32_LE (buffer + 4); - - g_warn_if_fail (node_length >= 8); - - gst_byte_reader_init (&parser, buffer + 8, node_length - 8); - - type = piffdemux_type_get (fourcc); - - depth = (g_node_depth (node) - 1) * 2; - GST_LOG ("%*s'%" GST_FOURCC_FORMAT "', [%d], %s", - depth, "", GST_FOURCC_ARGS (fourcc), node_length, type->name); - - if (type->dump) { - gboolean ret; - - ret = type->dump (GST_PIFFDEMUX_CAST (piffdemux), &parser, depth); - - if (!ret) { - GST_WARNING ("%*s not enough data parsing atom %" GST_FOURCC_FORMAT, - depth, "", GST_FOURCC_ARGS (fourcc)); - } - } - - return FALSE; -} - -gboolean -piffdemux_node_dump (GstPiffDemux * piffdemux, GNode * node) -{ - if (__gst_debug_min < GST_LEVEL_LOG) - return TRUE; - - g_node_traverse (node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, - piffdemux_node_dump_foreach, piffdemux); - return TRUE; -} diff --git a/piffdemux/src/piffdemux_dump.h b/piffdemux/src/piffdemux_dump.h deleted file mode 100755 index 5f34b50..0000000 --- a/piffdemux/src/piffdemux_dump.h +++ /dev/null @@ -1,49 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * Copyright (C) <2009> STEricsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_PIFFDEMUX_DUMP_H__ -#define __GST_PIFFDEMUX_DUMP_H__ - -#include -#include - -G_BEGIN_DECLS - -gboolean piffdemux_dump_vmhd (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_mfro (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_tfra (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_tfhd (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_trun (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_trex (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_sdtp (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); -gboolean piffdemux_dump_unknown (GstPiffDemux * piffdemux, GstByteReader * data, - int depth); - -gboolean piffdemux_node_dump (GstPiffDemux * piffdemux, GNode * node); - -G_END_DECLS -#endif /* __GST_PIFFDEMUX_DUMP_H__ */ diff --git a/piffdemux/src/piffdemux_fourcc.h b/piffdemux/src/piffdemux_fourcc.h deleted file mode 100755 index 7ce7a7a..0000000 --- a/piffdemux/src/piffdemux_fourcc.h +++ /dev/null @@ -1,86 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GST_QTDEMUX_FOURCC_H__ -#define __GST_QTDEMUX_FOURCC_H__ - -#include - -G_BEGIN_DECLS - - -#define FOURCC_vide GST_MAKE_FOURCC('v','i','d','e') -#define FOURCC_soun GST_MAKE_FOURCC('s','o','u','n') -#define FOURCC_subp GST_MAKE_FOURCC('s','u','b','p') -#define FOURCC_hint GST_MAKE_FOURCC('h','i','n','t') -#define FOURCC_mp4a GST_MAKE_FOURCC('m','p','4','a') -#define FOURCC_mp4v GST_MAKE_FOURCC('m','p','4','v') -#define FOURCC_MP4V GST_MAKE_FOURCC('M','P','4','V') -#define FOURCC_fmp4 GST_MAKE_FOURCC('f','m','p','4') -#define FOURCC_FMP4 GST_MAKE_FOURCC('F','M','P','4') - -#define FOURCC_meta GST_MAKE_FOURCC('m','e','t','a') - -#define FOURCC_____ GST_MAKE_FOURCC('-','-','-','-') - -#define FOURCC_free GST_MAKE_FOURCC('f','r','e','e') - -#define FOURCC_drms GST_MAKE_FOURCC('d','r','m','s') -#define FOURCC_drmi GST_MAKE_FOURCC('d','r','m','i') -#define FOURCC_avc1 GST_MAKE_FOURCC('a','v','c','1') -#define FOURCC_avcC GST_MAKE_FOURCC('a','v','c','C') - -#define FOURCC_ulaw GST_MAKE_FOURCC('u','l','a','w') -#define FOURCC_alaw GST_MAKE_FOURCC('a','l','a','w') - -#define FOURCC_raw_ GST_MAKE_FOURCC('r','a','w',' ') - -#define FOURCC_alac GST_MAKE_FOURCC('a','l','a','c') -#define FOURCC_samr GST_MAKE_FOURCC('s','a','m','r') -#define FOURCC_sawb GST_MAKE_FOURCC('s','a','w','b') -#define FOURCC_mdat GST_MAKE_FOURCC('m','d','a','t') -#define FOURCC_in24 GST_MAKE_FOURCC('i','n','2','4') - -#define FOURCC_text GST_MAKE_FOURCC('t','e','x','t') -#define FOURCC_tx3g GST_MAKE_FOURCC('t','x','3','g') -#define FOURCC_mp4s GST_MAKE_FOURCC('m','p','4','s') -#define FOURCC_uuid GST_MAKE_FOURCC('u','u','i','d') - -/* Fragmented MP4 */ - -#define FOURCC_mfhd GST_MAKE_FOURCC('m','f','h','d') -#define FOURCC_mfra GST_MAKE_FOURCC('m','f','r','a') -#define FOURCC_mfro GST_MAKE_FOURCC('m','f','r','o') -#define FOURCC_moof GST_MAKE_FOURCC('m','o','o','f') -#define FOURCC_mvex GST_MAKE_FOURCC('m','v','e','x') -#define FOURCC_sdtp GST_MAKE_FOURCC('s','d','t','p') -#define FOURCC_tfhd GST_MAKE_FOURCC('t','f','h','d') -#define FOURCC_tfxd GST_MAKE_FOURCC('t','f','x','d') -#define FOURCC_tfra GST_MAKE_FOURCC('t','f','r','a') -#define FOURCC_traf GST_MAKE_FOURCC('t','r','a','f') -#define FOURCC_trex GST_MAKE_FOURCC('t','r','e','x') -#define FOURCC_trun GST_MAKE_FOURCC('t','r','u','n') -#define FOURCC_ovc1 GST_MAKE_FOURCC('o','v','c','1') -#define FOURCC_owma GST_MAKE_FOURCC('o','w','m','a') -#define FOURCC_uuid GST_MAKE_FOURCC('u','u','i','d') -#define FOURCC_tfrf GST_MAKE_FOURCC('t','f','r','f') - -G_END_DECLS - -#endif /* __GST_QTDEMUX_FOURCC_H__ */ diff --git a/piffdemux/src/piffdemux_types.c b/piffdemux/src/piffdemux_types.c deleted file mode 100755 index 2fa8ea8..0000000 --- a/piffdemux/src/piffdemux_types.c +++ /dev/null @@ -1,76 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "piffdemux_types.h" -#include "piffdemux_dump.h" -#include "piffdemux_fourcc.h" - -static const PiffNodeType piff_node_types[] = { - {FOURCC_vide, "video media", 0}, - {FOURCC_hint, "hint", 0,}, - {FOURCC_mp4a, "mp4a", 0,}, - {FOURCC_mp4v, "mp4v", 0,}, - {FOURCC_alac, "alac", 0,}, - {FOURCC_meta, "meta", 0, piffdemux_dump_unknown}, - {FOURCC_____, "----", PIFF_FLAG_CONTAINER,}, - {FOURCC_free, "free", 0,}, - {FOURCC_mfra, "movie fragment random access", - PIFF_FLAG_CONTAINER,}, - {FOURCC_tfra, "track fragment random access", 0, - piffdemux_dump_tfra}, - {FOURCC_mfro, "movie fragment random access offset", 0, - piffdemux_dump_mfro}, - {FOURCC_moof, "movie fragment", PIFF_FLAG_CONTAINER,}, - {FOURCC_mfhd, "movie fragment header", 0,}, - {FOURCC_traf, "track fragment", PIFF_FLAG_CONTAINER,}, - {FOURCC_tfhd, "track fragment header", 0, - piffdemux_dump_tfhd}, - {FOURCC_sdtp, "independent and disposable samples", 0, - piffdemux_dump_sdtp}, - {FOURCC_trun, "track fragment run", 0, piffdemux_dump_trun}, - {FOURCC_mdat, "moovie data", 0, piffdemux_dump_unknown}, - {FOURCC_trex, "moovie data", 0, piffdemux_dump_trex}, - {FOURCC_mvex, "mvex", PIFF_FLAG_CONTAINER,}, - {FOURCC_ovc1, "ovc1", 0}, - {FOURCC_owma, "owma", 0}, - {FOURCC_tfxd, "tfxd", 0}, - {FOURCC_tfrf, "tfrf", 0}, - {FOURCC_uuid, "uuid", 0}, - - {0, "unknown", 0,}, -}; - -static const int n_piff_node_types = - sizeof (piff_node_types) / sizeof (piff_node_types[0]); - -const PiffNodeType * -piffdemux_type_get (guint32 fourcc) -{ - int i; - - for (i = 0; i < n_piff_node_types; i++) { - if (G_UNLIKELY (piff_node_types[i].fourcc == fourcc)) - return piff_node_types + i; - } - - GST_WARNING ("unknown QuickTime node type %" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (fourcc)); - - return piff_node_types + n_piff_node_types - 1; -} diff --git a/piffdemux/src/piffdemux_types.h b/piffdemux/src/piffdemux_types.h deleted file mode 100755 index 2c94887..0000000 --- a/piffdemux/src/piffdemux_types.h +++ /dev/null @@ -1,67 +0,0 @@ - -#ifndef __GST_PIFFDEMUX_TYPES_H__ -#define __GST_PIFFDEMUX_TYPES_H__ - -#include -#include - -#include "piffdemux.h" - -G_BEGIN_DECLS - -typedef gboolean (*PiffDumpFunc) (GstPiffDemux * piffdemux, GstByteReader * data, int depth); - -typedef struct _PiffNodeType PiffNodeType; - -#define PIFF_UINT32(a) (GST_READ_UINT32_BE(a)) -#define PIFF_UINT24(a) (GST_READ_UINT32_BE(a) >> 8) -#define PIFF_UINT16(a) (GST_READ_UINT16_BE(a)) -#define PIFF_UINT8(a) (GST_READ_UINT8(a)) -#define PIFF_FP32(a) ((GST_READ_UINT32_BE(a))/65536.0) -#define PIFF_SFP32(a) (((gint)(GST_READ_UINT32_BE(a)))/65536.0) -#define PIFF_FP16(a) ((GST_READ_UINT16_BE(a))/256.0) -#define PIFF_FOURCC(a) (GST_READ_UINT32_LE(a)) -#define PIFF_UINT64(a) ((((guint64)PIFF_UINT32(a))<<32)|PIFF_UINT32(((guint8 *)a)+4)) - -typedef enum { - PIFF_FLAG_NONE = (0), - PIFF_FLAG_CONTAINER = (1 << 0) -} PiffFlags; - -struct _PiffNodeType { - guint32 fourcc; - const gchar *name; - PiffFlags flags; - PiffDumpFunc dump; -}; - -enum TfFlags -{ - TF_BASE_DATA_OFFSET = 0x000001, /* base-data-offset-present */ - TF_SAMPLE_DESCRIPTION_INDEX = 0x000002, /* sample-description-index-present */ - TF_DEFAULT_SAMPLE_DURATION = 0x000008, /* default-sample-duration-present */ - TF_DEFAULT_SAMPLE_SIZE = 0x000010, /* default-sample-size-present */ - TF_DEFAULT_SAMPLE_FLAGS = 0x000020, /* default-sample-flags-present */ - TF_DURATION_IS_EMPTY = 0x100000 /* duration-is-empty */ -}; - -enum TrFlags -{ - TR_DATA_OFFSET = 0x000001, /* data-offset-present */ - TR_FIRST_SAMPLE_FLAGS = 0x000004, /* first-sample-flags-present */ - TR_SAMPLE_DURATION = 0x000100, /* sample-duration-present */ - TR_SAMPLE_SIZE = 0x000200, /* sample-size-present */ - TR_SAMPLE_FLAGS = 0x000400, /* sample-flags-present */ - TR_COMPOSITION_TIME_OFFSETS = 0x000800 /* sample-composition-time-offsets-presents */ -}; - -enum SEFlags -{ - SE_OVERRIDE_TE_FLAGS = 0x000001, /* override existing track encryption parameters */ - SE_USE_SUBSAMPLE_ENCRYPTION = 0x000002, /* Use SubSample Encryption */ -}; -const PiffNodeType *piffdemux_type_get (guint32 fourcc); - -G_END_DECLS - -#endif /* __GST_PIFFDEMUX_TYPES_H__ */ diff --git a/piffdemux/src/piffpalette.h b/piffdemux/src/piffpalette.h deleted file mode 100755 index d3b4552..0000000 --- a/piffdemux/src/piffpalette.h +++ /dev/null @@ -1,137 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#ifndef __GST_PIFFPALLETE_H__ -#define __GST_PIFFPALLETE_H__ - -#include - -G_BEGIN_DECLS - -static const guint32 ff_piff_default_palette_2[2] = { - 0xffffff, 0x000000 -}; - -static const guint32 ff_piff_default_palette_4[4] = { - 0x93655e, 0xffffff, 0xdfd0ab, 0x000000 -}; - -static const guint32 ff_piff_default_palette_16[16] = { - 0xfffbff, 0xefd9bb, 0xe8c9b1, 0x93655e, - 0xfcdee8, 0x9d8891, 0xffffff, 0xffffff, - 0xffffff, 0x474837, 0x7a5e55, 0xdfd0ab, - 0xfffbf9, 0xe8cac5, 0x8a7c77, 0x000000 -}; -static const guint32 ff_piff_default_palette_256[256] = { - 0xFFFFFF, 0xFFFFCC, 0xFFFF99, 0xFFFF66, 0xFFFF33, 0xFFFF00, - 0xFFCCFF, 0xFFCCCC, 0xFFCC99, 0xFFCC66, 0xFFCC33, 0xFFCC00, - 0xFF99FF, 0xFF99CC, 0xFF9999, 0xFF9966, 0xFF9933, 0xFF9900, - 0xFF66FF, 0xFF66CC, 0xFF6699, 0xFF6666, 0xFF6633, 0xFF6600, - 0xFF33FF, 0xFF33CC, 0xFF3399, 0xFF3366, 0xFF3333, 0xFF3300, - 0xFF00FF, 0xFF00CC, 0xFF0099, 0xFF0066, 0xFF0033, 0xFF0000, - 0xCCFFFF, 0xCCFFCC, 0xCCFF99, 0xCCFF66, 0xCCFF33, 0xCCFF00, - 0xCCCCFF, 0xCCCCCC, 0xCCCC99, 0xCCCC66, 0xCCCC33, 0xCCCC00, - 0xCC99FF, 0xCC99CC, 0xCC9999, 0xCC9966, 0xCC9933, 0xCC9900, - 0xCC66FF, 0xCC66CC, 0xCC6699, 0xCC6666, 0xCC6633, 0xCC6600, - 0xCC33FF, 0xCC33CC, 0xCC3399, 0xCC3366, 0xCC3333, 0xCC3300, - 0xCC00FF, 0xCC00CC, 0xCC0099, 0xCC0066, 0xCC0033, 0xCC0000, - 0x99FFFF, 0x99FFCC, 0x99FF99, 0x99FF66, 0x99FF33, 0x99FF00, - 0x99CCFF, 0x99CCCC, 0x99CC99, 0x99CC66, 0x99CC33, 0x99CC00, - 0x9999FF, 0x9999CC, 0x999999, 0x999966, 0x999933, 0x999900, - 0x9966FF, 0x9966CC, 0x996699, 0x996666, 0x996633, 0x996600, - 0x9933FF, 0x9933CC, 0x993399, 0x993366, 0x993333, 0x993300, - 0x9900FF, 0x9900CC, 0x990099, 0x990066, 0x990033, 0x990000, - 0x66FFFF, 0x66FFCC, 0x66FF99, 0x66FF66, 0x66FF33, 0x66FF00, - 0x66CCFF, 0x66CCCC, 0x66CC99, 0x66CC66, 0x66CC33, 0x66CC00, - 0x6699FF, 0x6699CC, 0x669999, 0x669966, 0x669933, 0x669900, - 0x6666FF, 0x6666CC, 0x666699, 0x666666, 0x666633, 0x666600, - 0x6633FF, 0x6633CC, 0x663399, 0x663366, 0x663333, 0x663300, - 0x6600FF, 0x6600CC, 0x660099, 0x660066, 0x660033, 0x660000, - 0x33FFFF, 0x33FFCC, 0x33FF99, 0x33FF66, 0x33FF33, 0x33FF00, - 0x33CCFF, 0x33CCCC, 0x33CC99, 0x33CC66, 0x33CC33, 0x33CC00, - 0x3399FF, 0x3399CC, 0x339999, 0x339966, 0x339933, 0x339900, - 0x3366FF, 0x3366CC, 0x336699, 0x336666, 0x336633, 0x336600, - 0x3333FF, 0x3333CC, 0x333399, 0x333366, 0x333333, 0x333300, - 0x3300FF, 0x3300CC, 0x330099, 0x330066, 0x330033, 0x330000, - 0x00FFFF, 0x00FFCC, 0x00FF99, 0x00FF66, 0x00FF33, 0x00FF00, - 0x00CCFF, 0x00CCCC, 0x00CC99, 0x00CC66, 0x00CC33, 0x00CC00, - 0x0099FF, 0x0099CC, 0x009999, 0x009966, 0x009933, 0x009900, - 0x0066FF, 0x0066CC, 0x006699, 0x006666, 0x006633, 0x006600, - 0x0033FF, 0x0033CC, 0x003399, 0x003366, 0x003333, 0x003300, - 0x0000FF, 0x0000CC, 0x000099, 0x000066, 0x000033, 0xEE0000, - 0xDD0000, 0xBB0000, 0xAA0000, 0x880000, 0x770000, 0x550000, - 0x440000, 0x220000, 0x110000, 0x00EE00, 0x00DD00, 0x00BB00, - 0x00AA00, 0x008800, 0x007700, 0x005500, 0x004400, 0x002200, - 0x001100, 0x0000EE, 0x0000DD, 0x0000BB, 0x0000AA, 0x000088, - 0x000077, 0x000055, 0x000044, 0x000022, 0x000011, 0xEEEEEE, - 0xDDDDDD, 0xBBBBBB, 0xAAAAAA, 0x888888, 0x777777, 0x555555, - 0x444444, 0x222222, 0x111111, 0x000000 -}; - -static const guint32 ff_piff_grayscale_palette_16[16] = { - 0xffffff, 0xeeeeee, 0xdddddd, 0xcccccc, - 0xbbbbbb, 0xaaaaaa, 0x999999, 0x888888, - 0x777777, 0x666666, 0x555555, 0x444444, - 0x333333, 0x222222, 0x111111, 0x000000 -}; - -static const guint32 ff_piff_grayscale_palette_256[256] = { - 0xffffff, 0xfefefe, 0xfdfdfd, 0xfcfcfc, 0xfbfbfb, 0xfafafa, 0xf9f9f9, - 0xf8f8f8, 0xf7f7f7, 0xf6f6f6, 0xf5f5f5, 0xf4f4f4, 0xf3f3f3, 0xf2f2f2, - 0xf1f1f1, 0xf0f0f0, 0xefefef, 0xeeeeee, 0xededed, 0xececec, 0xebebeb, - 0xeaeaea, 0xe9e9e9, 0xe8e8e8, 0xe7e7e7, 0xe6e6e6, 0xe5e5e5, 0xe4e4e4, - 0xe3e3e3, 0xe2e2e2, 0xe1e1e1, 0xe0e0e0, 0xdfdfdf, 0xdedede, 0xdddddd, - 0xdcdcdc, 0xdbdbdb, 0xdadada, 0xd9d9d9, 0xd8d8d8, 0xd7d7d7, 0xd6d6d6, - 0xd5d5d5, 0xd4d4d4, 0xd3d3d3, 0xd2d2d2, 0xd1d1d1, 0xd0d0d0, 0xcfcfcf, - 0xcecece, 0xcdcdcd, 0xcccccc, 0xcbcbcb, 0xcacaca, 0xc9c9c9, 0xc8c8c8, - 0xc7c7c7, 0xc6c6c6, 0xc5c5c5, 0xc4c4c4, 0xc3c3c3, 0xc2c2c2, 0xc1c1c1, - 0xc0c0c0, 0xbfbfbf, 0xbebebe, 0xbdbdbd, 0xbcbcbc, 0xbbbbbb, 0xbababa, - 0xb9b9b9, 0xb8b8b8, 0xb7b7b7, 0xb6b6b6, 0xb5b5b5, 0xb4b4b4, 0xb3b3b3, - 0xb2b2b2, 0xb1b1b1, 0xb0b0b0, 0xafafaf, 0xaeaeae, 0xadadad, 0xacacac, - 0xababab, 0xaaaaaa, 0xa9a9a9, 0xa8a8a8, 0xa7a7a7, 0xa6a6a6, 0xa5a5a5, - 0xa4a4a4, 0xa3a3a3, 0xa2a2a2, 0xa1a1a1, 0xa0a0a0, 0x9f9f9f, 0x9e9e9e, - 0x9d9d9d, 0x9c9c9c, 0x9b9b9b, 0x9a9a9a, 0x999999, 0x989898, 0x979797, - 0x969696, 0x959595, 0x949494, 0x939393, 0x929292, 0x919191, 0x909090, - 0x8f8f8f, 0x8e8e8e, 0x8d8d8d, 0x8c8c8c, 0x8b8b8b, 0x8a8a8a, 0x898989, - 0x888888, 0x878787, 0x868686, 0x858585, 0x848484, 0x838383, 0x828282, - 0x818181, 0x808080, 0x7f7f7f, 0x7e7e7e, 0x7d7d7d, 0x7c7c7c, 0x7b7b7b, - 0x7a7a7a, 0x797979, 0x787878, 0x777777, 0x767676, 0x757575, 0x747474, - 0x737373, 0x727272, 0x717171, 0x707070, 0x6f6f6f, 0x6e6e6e, 0x6d6d6d, - 0x6c6c6c, 0x6b6b6b, 0x6a6a6a, 0x696969, 0x686868, 0x676767, 0x666666, - 0x656565, 0x646464, 0x636363, 0x626262, 0x616161, 0x606060, 0x5f5f5f, - 0x5e5e5e, 0x5d5d5d, 0x5c5c5c, 0x5b5b5b, 0x5a5a5a, 0x595959, 0x585858, - 0x575757, 0x565656, 0x555555, 0x545454, 0x535353, 0x525252, 0x515151, - 0x505050, 0x4f4f4f, 0x4e4e4e, 0x4d4d4d, 0x4c4c4c, 0x4b4b4b, 0x4a4a4a, - 0x494949, 0x484848, 0x474747, 0x464646, 0x454545, 0x444444, 0x434343, - 0x424242, 0x414141, 0x404040, 0x3f3f3f, 0x3e3e3e, 0x3d3d3d, 0x3c3c3c, - 0x3b3b3b, 0x3a3a3a, 0x393939, 0x383838, 0x373737, 0x363636, 0x353535, - 0x343434, 0x333333, 0x323232, 0x313131, 0x303030, 0x2f2f2f, 0x2e2e2e, - 0x2d2d2d, 0x2c2c2c, 0x2b2b2b, 0x2a2a2a, 0x292929, 0x282828, 0x272727, - 0x262626, 0x252525, 0x242424, 0x232323, 0x222222, 0x212121, 0x202020, - 0x1f1f1f, 0x1e1e1e, 0x1d1d1d, 0x1c1c1c, 0x1b1b1b, 0x1a1a1a, 0x191919, - 0x181818, 0x171717, 0x161616, 0x151515, 0x141414, 0x131313, 0x121212, - 0x111111, 0x101010, 0x0f0f0f, 0x0e0e0e, 0x0d0d0d, 0x0c0c0c, 0x0b0b0b, - 0x0a0a0a, 0x090909, 0x080808, 0x070707, 0x060606, 0x050505, 0x040404, - 0x030303, 0x020202, 0x010101, 0x000000 -}; - -G_END_DECLS - -#endif /* __GST_PIFFPALETTE_H__ */