--- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/src/Makefile.in +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/src/Makefile.in @@ -0,0 +1,547 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libmp4_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = plugins/bmp/src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libmp4_la_DEPENDENCIES = $(top_builddir)/libfaad/libfaad.la \ + $(top_builddir)/common/mp4ff/libmp4ff.la +am_libmp4_la_OBJECTS = libmp4_la-libmp4.lo libmp4_la-mp4_utils.lo \ + libmp4_la-aac_utils.lo +libmp4_la_OBJECTS = $(am_libmp4_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/libmp4_la-aac_utils.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libmp4_la-libmp4.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libmp4_la-mp4_utils.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libmp4_la_SOURCES) +DIST_SOURCES = $(libmp4_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BMP_CFLAGS = @BMP_CFLAGS@ +BMP_LIBS = @BMP_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +HAVE_BMP_FALSE = @HAVE_BMP_FALSE@ +HAVE_BMP_TRUE = @HAVE_BMP_TRUE@ +HAVE_MPEG4IP_PLUG_FALSE = @HAVE_MPEG4IP_PLUG_FALSE@ +HAVE_MPEG4IP_PLUG_TRUE = @HAVE_MPEG4IP_PLUG_TRUE@ +HAVE_XMMS_FALSE = @HAVE_XMMS_FALSE@ +HAVE_XMMS_TRUE = @HAVE_XMMS_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MP4FF_LIBS = @MP4FF_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RPMBUILD = @RPMBUILD@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ +WITH_MP4V2_TRUE = @WITH_MP4V2_TRUE@ +XMMS_CONFIG = @XMMS_CONFIG@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = `pkg-config --variable=input_plugin_dir bmp` +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +lib_LTLIBRARIES = libmp4.la +libmp4_la_CFLAGS = `pkg-config --cflags bmp` -Wall \ + -I$(top_srcdir)/include -I$(top_srcdir)/common/mp4ff + +libmp4_la_LIBADD = $(top_builddir)/libfaad/libfaad.la \ + $(top_builddir)/common/mp4ff/libmp4ff.la + +libmp4_la_LDFLAGS = -module -avoid-version `pkg-config --libs bmp` -lpthread +libmp4_la_SOURCES = libmp4.c mp4_utils.c aac_utils.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/bmp/src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/bmp/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libmp4.la: $(libmp4_la_OBJECTS) $(libmp4_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libmp4_la_LDFLAGS) $(libmp4_la_OBJECTS) $(libmp4_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmp4_la-aac_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmp4_la-libmp4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmp4_la-mp4_utils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libmp4_la-libmp4.o: libmp4.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-libmp4.o -MD -MP -MF "$(DEPDIR)/libmp4_la-libmp4.Tpo" -c -o libmp4_la-libmp4.o `test -f 'libmp4.c' || echo '$(srcdir)/'`libmp4.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-libmp4.Tpo" "$(DEPDIR)/libmp4_la-libmp4.Po"; else rm -f "$(DEPDIR)/libmp4_la-libmp4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libmp4.c' object='libmp4_la-libmp4.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-libmp4.Po' tmpdepfile='$(DEPDIR)/libmp4_la-libmp4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-libmp4.o `test -f 'libmp4.c' || echo '$(srcdir)/'`libmp4.c + +libmp4_la-libmp4.obj: libmp4.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-libmp4.obj -MD -MP -MF "$(DEPDIR)/libmp4_la-libmp4.Tpo" -c -o libmp4_la-libmp4.obj `if test -f 'libmp4.c'; then $(CYGPATH_W) 'libmp4.c'; else $(CYGPATH_W) '$(srcdir)/libmp4.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-libmp4.Tpo" "$(DEPDIR)/libmp4_la-libmp4.Po"; else rm -f "$(DEPDIR)/libmp4_la-libmp4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libmp4.c' object='libmp4_la-libmp4.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-libmp4.Po' tmpdepfile='$(DEPDIR)/libmp4_la-libmp4.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-libmp4.obj `if test -f 'libmp4.c'; then $(CYGPATH_W) 'libmp4.c'; else $(CYGPATH_W) '$(srcdir)/libmp4.c'; fi` + +libmp4_la-libmp4.lo: libmp4.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-libmp4.lo -MD -MP -MF "$(DEPDIR)/libmp4_la-libmp4.Tpo" -c -o libmp4_la-libmp4.lo `test -f 'libmp4.c' || echo '$(srcdir)/'`libmp4.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-libmp4.Tpo" "$(DEPDIR)/libmp4_la-libmp4.Plo"; else rm -f "$(DEPDIR)/libmp4_la-libmp4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libmp4.c' object='libmp4_la-libmp4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-libmp4.Plo' tmpdepfile='$(DEPDIR)/libmp4_la-libmp4.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-libmp4.lo `test -f 'libmp4.c' || echo '$(srcdir)/'`libmp4.c + +libmp4_la-mp4_utils.o: mp4_utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-mp4_utils.o -MD -MP -MF "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" -c -o libmp4_la-mp4_utils.o `test -f 'mp4_utils.c' || echo '$(srcdir)/'`mp4_utils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" "$(DEPDIR)/libmp4_la-mp4_utils.Po"; else rm -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mp4_utils.c' object='libmp4_la-mp4_utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-mp4_utils.Po' tmpdepfile='$(DEPDIR)/libmp4_la-mp4_utils.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-mp4_utils.o `test -f 'mp4_utils.c' || echo '$(srcdir)/'`mp4_utils.c + +libmp4_la-mp4_utils.obj: mp4_utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-mp4_utils.obj -MD -MP -MF "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" -c -o libmp4_la-mp4_utils.obj `if test -f 'mp4_utils.c'; then $(CYGPATH_W) 'mp4_utils.c'; else $(CYGPATH_W) '$(srcdir)/mp4_utils.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" "$(DEPDIR)/libmp4_la-mp4_utils.Po"; else rm -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mp4_utils.c' object='libmp4_la-mp4_utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-mp4_utils.Po' tmpdepfile='$(DEPDIR)/libmp4_la-mp4_utils.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-mp4_utils.obj `if test -f 'mp4_utils.c'; then $(CYGPATH_W) 'mp4_utils.c'; else $(CYGPATH_W) '$(srcdir)/mp4_utils.c'; fi` + +libmp4_la-mp4_utils.lo: mp4_utils.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-mp4_utils.lo -MD -MP -MF "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" -c -o libmp4_la-mp4_utils.lo `test -f 'mp4_utils.c' || echo '$(srcdir)/'`mp4_utils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo" "$(DEPDIR)/libmp4_la-mp4_utils.Plo"; else rm -f "$(DEPDIR)/libmp4_la-mp4_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mp4_utils.c' object='libmp4_la-mp4_utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-mp4_utils.Plo' tmpdepfile='$(DEPDIR)/libmp4_la-mp4_utils.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-mp4_utils.lo `test -f 'mp4_utils.c' || echo '$(srcdir)/'`mp4_utils.c + +libmp4_la-aac_utils.o: aac_utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-aac_utils.o -MD -MP -MF "$(DEPDIR)/libmp4_la-aac_utils.Tpo" -c -o libmp4_la-aac_utils.o `test -f 'aac_utils.c' || echo '$(srcdir)/'`aac_utils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo" "$(DEPDIR)/libmp4_la-aac_utils.Po"; else rm -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aac_utils.c' object='libmp4_la-aac_utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-aac_utils.Po' tmpdepfile='$(DEPDIR)/libmp4_la-aac_utils.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-aac_utils.o `test -f 'aac_utils.c' || echo '$(srcdir)/'`aac_utils.c + +libmp4_la-aac_utils.obj: aac_utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-aac_utils.obj -MD -MP -MF "$(DEPDIR)/libmp4_la-aac_utils.Tpo" -c -o libmp4_la-aac_utils.obj `if test -f 'aac_utils.c'; then $(CYGPATH_W) 'aac_utils.c'; else $(CYGPATH_W) '$(srcdir)/aac_utils.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo" "$(DEPDIR)/libmp4_la-aac_utils.Po"; else rm -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aac_utils.c' object='libmp4_la-aac_utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-aac_utils.Po' tmpdepfile='$(DEPDIR)/libmp4_la-aac_utils.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-aac_utils.obj `if test -f 'aac_utils.c'; then $(CYGPATH_W) 'aac_utils.c'; else $(CYGPATH_W) '$(srcdir)/aac_utils.c'; fi` + +libmp4_la-aac_utils.lo: aac_utils.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -MT libmp4_la-aac_utils.lo -MD -MP -MF "$(DEPDIR)/libmp4_la-aac_utils.Tpo" -c -o libmp4_la-aac_utils.lo `test -f 'aac_utils.c' || echo '$(srcdir)/'`aac_utils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo" "$(DEPDIR)/libmp4_la-aac_utils.Plo"; else rm -f "$(DEPDIR)/libmp4_la-aac_utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aac_utils.c' object='libmp4_la-aac_utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libmp4_la-aac_utils.Plo' tmpdepfile='$(DEPDIR)/libmp4_la-aac_utils.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmp4_la_CFLAGS) $(CFLAGS) -c -o libmp4_la-aac_utils.lo `test -f 'aac_utils.c' || echo '$(srcdir)/'`aac_utils.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/src/Makefile.am +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/src/Makefile.am @@ -0,0 +1,12 @@ +libdir = `pkg-config --variable=input_plugin_dir bmp` +lib_LTLIBRARIES = libmp4.la + +libmp4_la_CFLAGS = `pkg-config --cflags bmp` -Wall \ + -I$(top_srcdir)/include -I$(top_srcdir)/common/mp4ff + +libmp4_la_LIBADD = $(top_builddir)/libfaad/libfaad.la \ + $(top_builddir)/common/mp4ff/libmp4ff.la + +libmp4_la_LDFLAGS = -module -avoid-version `pkg-config --libs bmp` -lpthread + +libmp4_la_SOURCES = libmp4.c mp4_utils.c aac_utils.c --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/src/aac_utils.c +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/src/aac_utils.c @@ -0,0 +1,103 @@ +/* + * + * utils for AAC informations +*/ +#include +#include +#include + + +#define ADTS_HEADER_SIZE 8 +#define SEEK_TABLE_CHUNK 60 +#define MPEG4_TYPE 0 +#define MPEG2_TYPE 1 + +// Read ADTS header, the file descriptor must be at +// the begining of the aac frame not at the id3tag + +int getAacInfo(FILE *fd) +{ + unsigned char header[ADTS_HEADER_SIZE]; + unsigned int id; + unsigned long originPosition; + + originPosition = ftell(fd); + if(fread(header, 1, ADTS_HEADER_SIZE, fd) != ADTS_HEADER_SIZE){ + fseek(fd, originPosition, SEEK_SET); + return(-1); + } + if(!((header[0]==0xFF)&&((header[1]& 0xF6)==0xF0))){ + printf("Bad header\n"); + return(-1); + } + id = header[1]&0x08; + if(id==0){//MPEG-4 AAC + fseek(fd, originPosition, SEEK_SET); + return(MPEG4_TYPE); + }else{ + fseek(fd, originPosition, SEEK_SET); + return(MPEG2_TYPE); + } + fseek(fd, originPosition, SEEK_SET); + return(-1); +} + +// as AAC is VBR we need to check all ADTS header +// to enable seeking... +// there is no other solution +void checkADTSForSeeking(FILE *fd, + unsigned long **seekTable, + unsigned long *seekTableLength) +{ + unsigned long originPosition; + unsigned long position; + unsigned char header[ADTS_HEADER_SIZE]; + unsigned int frameCount, frameLength, frameInsec; + unsigned int id=0, seconds=0; + + originPosition = ftell(fd); + + for(frameCount=0,frameInsec=0;; frameCount++,frameInsec++){ + position = ftell(fd); + if(fread(header, 1, ADTS_HEADER_SIZE, fd)!=ADTS_HEADER_SIZE){ + break; + } + if(!strncmp(header, "ID3", 3)){ + break; + } + if(!((header[0]==0xFF)&&((header[1]& 0xF6)==0xF0))){ + printf("error : Bad 1st header, file may be corrupt !\n"); + break; + } + if(!frameCount){ + id=header[1]&0x08; + if(((*seekTable) = malloc(SEEK_TABLE_CHUNK * sizeof(unsigned long)))==0){ + printf("malloc error\n"); + return; + } + (*seekTableLength) = SEEK_TABLE_CHUNK; + } + + //if(id==0){//MPEG-4 + //frameLength = ((unsigned int)header[4]<<5)|((unsigned int)header[5]>>3); + //}else{//MPEG-2 + frameLength = (((unsigned int)header[3]&0x3)<<11)|((unsigned int)header[4]<<3)|(header[5]>>5); + //} + if(frameInsec==43){//??? + frameInsec=0; + } + if(frameInsec==0){ + if(seconds == (*seekTableLength)){ + (*seekTable) = realloc((*seekTable), (seconds+SEEK_TABLE_CHUNK)*sizeof(unsigned long)); + (*seekTableLength) = seconds+SEEK_TABLE_CHUNK; + } + (*seekTable)[seconds] = position; + seconds++; + } + if(fseek(fd, frameLength-ADTS_HEADER_SIZE, SEEK_CUR)==-1){ + break; + } + } + (*seekTableLength) = seconds; + fseek(fd, originPosition, SEEK_SET); +} --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/src/libmp4.c +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/src/libmp4.c @@ -0,0 +1,579 @@ +/* + * MP4/AAC decoder for xmms + * + * OPTIONNAL need + * -------------- + * libid3 (3.8.x - www.id3.org) +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "faad.h" +#include "mp4ff.h" + +#define MP4_DESCRIPTION "MP4 & MPEG2/4-AAC audio player - 1.2.x" +#define MP4_VERSION "ver. 0.5-faad2-version - 22 August 2004" +#define MP4_ABOUT "Written by ciberfred" +#define BUFFER_SIZE FAAD_MIN_STREAMSIZE*64 + +static void mp4_init(void); +static void mp4_about(void); +static void mp4_play(char *); +static void mp4_stop(void); +static void mp4_pause(short); +static void mp4_seek(int); +static int mp4_getTime(void); +static void mp4_cleanup(void); +static void mp4_getSongTitle(char *, char **, int *); +static void mp4_getSongInfo(char *); +static int mp4_isFile(char *); +static void* mp4Decode(void *); + +InputPlugin mp4_ip = + { + 0, // handle + 0, // filename + MP4_DESCRIPTION, + mp4_init, + mp4_about, + 0, // configuration + mp4_isFile, + 0, //scandir + mp4_play, + mp4_stop, + mp4_pause, + mp4_seek, + 0, // set equalizer + mp4_getTime, + 0, // get volume + 0, + mp4_cleanup, + 0, // obsolete + 0, // send visualisation data + 0, // set player window info + 0, // set song title text + mp4_getSongTitle, // get song title text + mp4_getSongInfo, // info box + 0, // to output plugin + }; + +typedef struct _mp4cfg{ + gshort file_type; +#define FILE_UNKNOW 0 +#define FILE_MP4 1 +#define FILE_AAC 2 +} Mp4Config; + +static Mp4Config mp4cfg; +static gboolean bPlaying = FALSE; +static pthread_t decodeThread; +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +static int seekPosition = -1; + +// Functions from mp4_utils.c +extern int getAACTrack(mp4ff_t *infile); +extern mp4ff_callback_t *getMP4FF_cb(FILE *mp4file); +extern char *getMP4title(mp4ff_t *infile, char *filename); +extern void getMP4info(char* filename, FILE *mp4file); + +InputPlugin *get_iplugin_info(void) +{ + return(&mp4_ip); +} + +static void mp4_init(void) +{ + memset(&decodeThread, 0, sizeof(pthread_t)); + mp4cfg.file_type = FILE_UNKNOW; + seekPosition = -1; + return; +} + +static void mp4_play(char *filename) +{ + bPlaying = TRUE; + pthread_create(&decodeThread, 0, mp4Decode, g_strdup(filename)); + return; +} + +static void mp4_stop(void) +{ + if(bPlaying){ + bPlaying = FALSE; + pthread_join(decodeThread, NULL); + memset(&decodeThread, 0, sizeof(pthread_t)); + mp4_ip.output->close_audio(); + } +} + +static int mp4_isFile(char *filename) +{ + if(filename){ + gchar* extention; + + extention = strrchr(filename, '.'); + if(extention && + (!strncasecmp(extention, ".mp4", 4) || // official extention + !strncasecmp(extention, ".m4a", 4) || // Apple mp4 extention + !strncasecmp(extention, ".aac", 4) // old MPEG2/4-AAC extention + )){ + return (1); + } + } + return(0); +} + +static void mp4_about(void) +{ + static GtkWidget *aboutbox; + + if(aboutbox!=NULL) + return; + aboutbox = xmms_show_message("About MP4 AAC player plugin", + "libfaad2-" FAAD2_VERSION "\n" + "plugin version: " MP4_VERSION "\n" + MP4_ABOUT, + "Ok", FALSE, NULL, NULL); + gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy", + GTK_SIGNAL_FUNC(gtk_widget_destroyed), + &aboutbox); +} + +static void mp4_pause(short flag) +{ + mp4_ip.output->pause(flag); +} + +static void mp4_seek(int time) +{ + seekPosition = time; + while(bPlaying && seekPosition!=-1) + xmms_usleep(10000); +} + +static int mp4_getTime(void) +{ + if(!bPlaying) + return (-1); + else + return (mp4_ip.output->output_time()); +} + +static void mp4_cleanup(void) +{ +} + +void mp4_get_file_type(FILE *mp4file) +{ + unsigned char header[10] = {0}; + + fseek(mp4file, 0, SEEK_SET); + fread(header, 1, 8, mp4file); + if(header[4]=='f' && + header[5]=='t' && + header[6]=='y' && + header[7]=='p'){ + mp4cfg.file_type = FILE_MP4; + }else{ + mp4cfg.file_type = FILE_AAC; + } +} + +static void mp4_getSongTitle(char *filename, char **title, int *len) { + FILE* mp4file; + + (*title) = NULL; + (*len) = -1; + + if((mp4file = fopen(filename, "rb"))){ + mp4_get_file_type(mp4file); + fseek(mp4file, 0, SEEK_SET); + if(mp4cfg.file_type == FILE_MP4){ + mp4ff_callback_t* mp4cb; + mp4ff_t* infile; + gint mp4track; + + mp4cb = getMP4FF_cb(mp4file); + if ((infile = mp4ff_open_read_metaonly(mp4cb)) && + ((mp4track = getAACTrack(infile)) >= 0)){ + (*title) = getMP4title(infile, filename); + + double track_duration = mp4ff_get_track_duration(infile, mp4track); + unsigned long time_scale = mp4ff_time_scale(infile, mp4track); + unsigned long length = (track_duration * 1000 / time_scale); + (*len) = length; + } + if(infile) mp4ff_close(infile); + if(mp4cb) g_free(mp4cb); + } + else{ + // Check AAC ID3 tag... + } + fclose(mp4file); + } +} + +static void mp4_getSongInfo(char *filename) +{ + FILE* mp4file; + if((mp4file = fopen(filename, "rb"))){ + if (mp4cfg.file_type == FILE_UNKNOW) + mp4_get_file_type(mp4file); + fseek(mp4file, 0, SEEK_SET); + if(mp4cfg.file_type == FILE_MP4) + getMP4info(filename, mp4file); + else if(mp4cfg.file_type == FILE_AAC) + /* + * check the id3tagv2 + */ + ; + fclose(mp4file); + } +} + +static void *mp4Decode(void *args) +{ + FILE* mp4file; + + pthread_mutex_lock(&mutex); + seekPosition = -1; + bPlaying = TRUE; + + if(!(mp4file = fopen(args, "rb"))){ + g_print("MP4!AAC - Can't open file\n"); + g_free(args); + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + + } + mp4_get_file_type(mp4file); + fseek(mp4file, 0, SEEK_SET); + if(mp4cfg.file_type == FILE_MP4){// We are reading a MP4 file + mp4ff_callback_t* mp4cb; + mp4ff_t* infile; + gint mp4track; + + mp4cb = getMP4FF_cb(mp4file); + if(!(infile = mp4ff_open_read(mp4cb))){ + g_print("MP4 - Can't open file\n"); + goto end; + } + + if((mp4track = getAACTrack(infile)) < 0){ + /* + * TODO: check here for others Audio format..... + * + */ + g_print("Unsupported Audio track type\n"); + g_free(args); + fclose(mp4file); + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + }else{ + faacDecHandle decoder; + unsigned char *buffer = NULL; + guint bufferSize = 0; + gulong samplerate; + guchar channels; + //guint avgBitrate; + //MP4Duration duration; + int msDuration; + int numSamples; + int sampleID = 0; + unsigned int framesize; + mp4AudioSpecificConfig mp4ASC; + gchar *xmmstitle; + + decoder = faacDecOpen(); + mp4ff_get_decoder_config(infile, mp4track, &buffer, &bufferSize); + if(faacDecInit2(decoder, buffer, bufferSize, &samplerate, &channels)<0){ + goto end; + } + if(buffer){ + framesize = 1024; + if(faacDecAudioSpecificConfig(buffer, bufferSize, &mp4ASC) >= 0){ + if(mp4ASC.frameLengthFlag == 1) framesize = 960; + if(mp4ASC.sbr_present_flag == 1) framesize *= 2; + } + g_free(buffer); + } + if(channels == 0){ + g_print("Number of Channels not supported\n"); + goto end; + } + + //duration = MP4GetTrackDuration(mp4file, mp4track); + //msDuration = MP4ConvertFromTrackDuration(mp4file, mp4track, + // duration,MP4_MSECS_TIME_SCALE); + + //msDuration = mp4ff_get_track_duration(infile, mp4track); + //printf("%d\n", msDuration); + + //numSamples = MP4GetTrackNumberOfSamples(mp4file, mp4track); + numSamples = mp4ff_num_samples(infile, mp4track); + { + float f = 1024.0; + if(mp4ASC.sbr_present_flag == 1) + f = f * 2.0; + msDuration = ((float)numSamples*(float)(f-1.0)/ + (float)samplerate)*1000; + } + xmmstitle = getMP4title(infile, args); + mp4_ip.output->open_audio(FMT_S16_NE, samplerate, channels); + mp4_ip.output->flush(0); + mp4_ip.set_info(xmmstitle, msDuration, -1, samplerate/1000, channels); + g_print("MP4 - %d channels @ %ld Hz\n", channels, samplerate); + + while(bPlaying){ + void* sampleBuffer; + faacDecFrameInfo frameInfo; + gint rc; + + if(seekPosition!=-1){ + /* + duration = MP4ConvertToTrackDuration(mp4file, + mp4track, + seekPosition*1000, + MP4_MSECS_TIME_SCALE); + sampleID = MP4GetSampleIdFromTime(mp4file, mp4track, duration, 0); + */ + float f = 1024.0; + if(mp4ASC.sbr_present_flag == 1) + f = f * 2.0; + sampleID = (float)seekPosition*(float)samplerate/(float)(f-1.0); + mp4_ip.output->flush(seekPosition*1000); + seekPosition = -1; + } + buffer=NULL; + bufferSize=0; + rc = mp4ff_read_sample(infile, mp4track, sampleID++, + &buffer, &bufferSize); + //g_print("%d/%d\n", sampleID-1, numSamples); + if((rc==0) || (buffer== NULL)){ + g_print("MP4: read error\n"); + sampleBuffer = NULL; + sampleID=0; + mp4_ip.output->buffer_free(); + goto end; + }else{ + sampleBuffer = faacDecDecode(decoder, &frameInfo, buffer, bufferSize); + if(frameInfo.error > 0){ + g_print("MP4: %s\n", + faacDecGetErrorMessage(frameInfo.error)); + goto end; + } + if(buffer){ + g_free(buffer); buffer=NULL; bufferSize=0; + } + while(bPlaying && mp4_ip.output->buffer_free()written_time(), + FMT_S16_NE, + channels, + frameInfo.samples<<1, + sampleBuffer); + mp4_ip.output->write_audio(sampleBuffer, frameInfo.samples<<1); + if(sampleID > numSamples){ + break; + } + } + while(bPlaying && mp4_ip.output->buffer_playing() && mp4_ip.output->buffer_free()){ + xmms_usleep(10000); + } +end: + mp4_ip.output->close_audio(); + g_free(args); + faacDecClose(decoder); + if(infile) mp4ff_close(infile); + if(mp4cb) g_free(mp4cb); + bPlaying = FALSE; + fclose(mp4file); + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + }else{ + // WE ARE READING AN AAC FILE + FILE *file = NULL; + faacDecHandle decoder = 0; + guchar *buffer = 0; + gulong bufferconsumed = 0; + gulong samplerate = 0; + guchar channels; + gulong buffervalid = 0; + TitleInput* input; + gchar *temp = g_strdup(args); + gchar *ext = strrchr(temp, '.'); + gchar *xmmstitle = NULL; + faacDecConfigurationPtr config; + + if((file = fopen(args, "rb")) == 0){ + g_print("AAC: can't find file %s\n", args); + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + if((decoder = faacDecOpen()) == NULL){ + g_print("AAC: Open Decoder Error\n"); + fclose(file); + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + config = faacDecGetCurrentConfiguration(decoder); + config->useOldADTSFormat = 0; + faacDecSetConfiguration(decoder, config); + if((buffer = g_malloc(BUFFER_SIZE)) == NULL){ + g_print("AAC: error g_malloc\n"); + fclose(file); + bPlaying = FALSE; + faacDecClose(decoder); + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + if((buffervalid = fread(buffer, 1, BUFFER_SIZE, file))==0){ + g_print("AAC: Error reading file\n"); + g_free(buffer); + fclose(file); + bPlaying = FALSE; + faacDecClose(decoder); + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + XMMS_NEW_TITLEINPUT(input); + input->file_name = g_basename(temp); + input->file_ext = ext ? ext+1 : NULL; + input->file_path = temp; + if(!strncmp(buffer, "ID3", 3)){ + gint size = 0; + + fseek(file, 0, SEEK_SET); + size = (buffer[6]<<21) | (buffer[7]<<14) | (buffer[8]<<7) | buffer[9]; + size+=10; + fread(buffer, 1, size, file); + buffervalid = fread(buffer, 1, BUFFER_SIZE, file); + } + xmmstitle = xmms_get_titlestring(xmms_get_gentitle_format(), input); + if(xmmstitle == NULL) + xmmstitle = g_strdup(input->file_name); + if(temp) g_free(temp); + if(input->performer) g_free(input->performer); + if(input->album_name) g_free(input->album_name); + if(input->track_name) g_free(input->track_name); + if(input->genre) g_free(input->genre); + g_free(input); + bufferconsumed = faacDecInit(decoder, + buffer, + buffervalid, + &samplerate, + &channels); + if(mp4_ip.output->open_audio(FMT_S16_NE,samplerate,channels) == FALSE){ + g_print("AAC: Output Error\n"); + g_free(buffer); buffer=0; + faacDecClose(decoder); + fclose(file); + mp4_ip.output->close_audio(); + /* + if(positionTable){ + g_free(positionTable); positionTable=0; + } + */ + g_free(xmmstitle); + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + } + //if(bSeek){ + //mp4_ip.set_info(xmmstitle, lenght*1000, -1, samplerate, channels); + //}else{ + mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels); + //} + mp4_ip.output->flush(0); + + while(bPlaying && buffervalid > 0){ + faacDecFrameInfo finfo; + unsigned long samplesdecoded; + char* sample_buffer = NULL; + /* + if(bSeek && seekPosition!=-1){ + fseek(file, positionTable[seekPosition], SEEK_SET); + bufferconsumed=0; + buffervalid = fread(buffer, 1, BUFFER_SIZE, file); + aac_ip.output->flush(seekPosition*1000); + seekPosition=-1; + } + */ + if(bufferconsumed > 0){ + memmove(buffer, &buffer[bufferconsumed], buffervalid-bufferconsumed); + buffervalid -= bufferconsumed; + buffervalid += fread(&buffer[buffervalid], 1, + BUFFER_SIZE-buffervalid, file); + bufferconsumed = 0; + } + sample_buffer = faacDecDecode(decoder, &finfo, buffer, buffervalid); + if(finfo.error){ + config = faacDecGetCurrentConfiguration(decoder); + if(config->useOldADTSFormat != 1){ + faacDecClose(decoder); + decoder = faacDecOpen(); + config = faacDecGetCurrentConfiguration(decoder); + config->useOldADTSFormat = 1; + faacDecSetConfiguration(decoder, config); + finfo.bytesconsumed=0; + finfo.samples = 0; + faacDecInit(decoder, + buffer, + buffervalid, + &samplerate, + &channels); + }else{ + g_print("FAAD2 Warning %s\n", faacDecGetErrorMessage(finfo.error)); + buffervalid = 0; + } + } + bufferconsumed += finfo.bytesconsumed; + samplesdecoded = finfo.samples; + if((samplesdecoded<=0) && !sample_buffer){ + g_print("AAC: error sample decoding\n"); + continue; + } + while(bPlaying && mp4_ip.output->buffer_free() < (samplesdecoded<<1)){ + xmms_usleep(10000); + } + mp4_ip.add_vis_pcm(mp4_ip.output->written_time(), + FMT_S16_LE, channels, + samplesdecoded<<1, sample_buffer); + mp4_ip.output->write_audio(sample_buffer, samplesdecoded<<1); + } + while(bPlaying && mp4_ip.output->buffer_playing()){ + xmms_usleep(10000); + } + mp4_ip.output->buffer_free(); + mp4_ip.output->close_audio(); + bPlaying = FALSE; + g_free(buffer); + faacDecClose(decoder); + g_free(xmmstitle); + fclose(file); + seekPosition = -1; + /* + if(positionTable){ + g_free(positionTable); positionTable=0; + } + */ + bPlaying = FALSE; + pthread_mutex_unlock(&mutex); + pthread_exit(NULL); + + } +} --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/src/mp4_utils.c +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/src/mp4_utils.c @@ -0,0 +1,469 @@ +/* + * some functions for MP4 files +*/ + +#include "mp4ff.h" +#include "faad.h" + +#include +#include +#include +#include +#include +#include +#include + +const char *mp4AudioNames[]= + { + "MPEG-1 Audio Layers 1,2 or 3", + "MPEG-2 low biterate (MPEG-1 extension) - MP3", + "MPEG-2 AAC Main Profile", + "MPEG-2 AAC Low Complexity profile", + "MPEG-2 AAC SSR profile", + "MPEG-4 audio (MPEG-4 AAC)", + 0 + }; + +/* MPEG-4 Audio types from 14496-3 Table 1.5.1 (from mp4.h)*/ +const char *mpeg4AudioNames[]= + { + "!!!!MPEG-4 Audio track Invalid !!!!!!!", + "MPEG-4 AAC Main profile", + "MPEG-4 AAC Low Complexity profile", + "MPEG-4 AAC SSR profile", + "MPEG-4 AAC Long Term Prediction profile", + "MPEG-4 AAC Scalable", + "MPEG-4 CELP", + "MPEG-4 HVXC", + "MPEG-4 Text To Speech", + "MPEG-4 Main Synthetic profile", + "MPEG-4 Wavetable Synthesis profile", + "MPEG-4 MIDI Profile", + "MPEG-4 Algorithmic Synthesis and Audio FX profile" + }; + +static GtkWidget *mp4_info_dialog = NULL; + +/* + * find AAC track +*/ + +int getAACTrack(mp4ff_t *infile) +{ + int i, rc; + int numTracks = mp4ff_total_tracks(infile); + + printf("total-tracks: %d\n", numTracks); + for(i=0; iread = read_callback; + mp4cb->seek = seek_callback; + mp4cb->user_data = mp4file; + return mp4cb; +} + +/* + * Function to display an info box for an mp4 file. + * This code is based heavily on fileinfo.c from the xmms mpg123 + * plugin, and the info box layout mimics that plugin. +*/ +void create_mp4_info_dialog (char *filename, FILE *mp4file, mp4ff_t *infile, gint mp4track) +{ + char *window_title, *value, *value2; + static GtkWidget *filename_entry, *title_entry, *artist_entry, *album_entry; + static GtkWidget *genre_entry, *year_entry, *track_entry, *comment_entry; + static GtkWidget *mp4_info_label; + + if (!mp4_info_dialog) + { + GtkWidget *dialog_vbox1, *vbox1, *hbox2, *hbox3, *hbox4; + GtkWidget *frame2, *frame3, *table1, *dialog_action_area1; + GtkWidget *filename_label, *title_label, *artist_label, *album_label; + GtkWidget *genre_label, *year_label, *track_label, *comment_label; + GtkWidget *close_button; + + mp4_info_dialog = gtk_dialog_new (); + gtk_object_set_data (GTK_OBJECT (mp4_info_dialog), "mp4_info_dialog", mp4_info_dialog); + gtk_window_set_policy (GTK_WINDOW (mp4_info_dialog), TRUE, TRUE, FALSE); + gtk_signal_connect(GTK_OBJECT (mp4_info_dialog), "destroy", + gtk_widget_destroyed, &mp4_info_dialog); + + dialog_vbox1 = GTK_DIALOG (mp4_info_dialog)->vbox; + gtk_object_set_data (GTK_OBJECT (mp4_info_dialog), "dialog_vbox1", dialog_vbox1); + gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox1), 3); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (hbox2); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "hbox2", hbox2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox2, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox2), 3); + + filename_label = gtk_label_new ("Filename: "); + gtk_widget_ref (filename_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "filename_label", filename_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox2), filename_label, FALSE, FALSE, 0); + + filename_entry = gtk_entry_new (); + gtk_widget_ref (filename_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "filename_entry", filename_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox2), filename_entry, TRUE, TRUE, 0); + gtk_entry_set_editable (GTK_ENTRY (filename_entry), FALSE); + + hbox3 = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (hbox3); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "hbox3", hbox3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox3, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox3), 3); + + frame2 = gtk_frame_new ("Tag Info: "); + gtk_widget_ref (frame2); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "frame2", frame2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox3), frame2, TRUE, TRUE, 0); + + table1 = gtk_table_new (6, 2, FALSE); + gtk_widget_ref (table1); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "table1", table1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_container_add (GTK_CONTAINER (frame2), table1); + gtk_container_set_border_width (GTK_CONTAINER (table1), 5); + + comment_label = gtk_label_new ("Comment: "); + gtk_widget_ref (comment_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "comment_label", comment_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), comment_label, 0, 1, 5, 6, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (comment_label), 1, 0.5); + + genre_label = gtk_label_new ("Genre: "); + gtk_widget_ref (genre_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "genre_label", genre_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), genre_label, 0, 1, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (genre_label), 1, 0.5); + + album_label = gtk_label_new ("Album: "); + gtk_widget_ref (album_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "album_label", album_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), album_label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (album_label), 1, 0.5); + + title_label = gtk_label_new ("Title: "); + gtk_widget_ref (title_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "title_label", title_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), title_label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (title_label), 1, 0.5); + + artist_label = gtk_label_new ("Artist: "); + gtk_widget_ref (artist_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "artist_label", artist_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), artist_label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (artist_label), 1, 0.5); + + year_label = gtk_label_new ("Year: "); + gtk_widget_ref (year_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "year_label", year_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), year_label, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND), 0, 0); + gtk_misc_set_alignment (GTK_MISC (year_label), 1, 0.5); + + hbox4 = gtk_hbox_new (FALSE, 0); + gtk_widget_ref (hbox4); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "hbox4", hbox4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), hbox4, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + year_entry = gtk_entry_new (); + gtk_widget_ref (year_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "year_entry", year_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox4), year_entry, FALSE, FALSE, 0); + gtk_widget_set_usize (year_entry, 60, -2); + gtk_entry_set_editable (GTK_ENTRY (year_entry), FALSE); + + track_label = gtk_label_new (" Track: "); + gtk_widget_ref (track_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "track_label", track_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox4), track_label, FALSE, FALSE, 0); + gtk_misc_set_alignment (GTK_MISC (track_label), 1, 0.5); + + track_entry = gtk_entry_new (); + gtk_widget_ref (track_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "track_entry", track_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox4), track_entry, FALSE, FALSE, 0); + gtk_widget_set_usize (track_entry, 60, -2); + gtk_entry_set_editable (GTK_ENTRY (track_entry), FALSE); + + title_entry = gtk_entry_new (); + gtk_widget_ref (title_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "title_entry", title_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), title_entry, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_editable (GTK_ENTRY (title_entry), FALSE); + + artist_entry = gtk_entry_new (); + gtk_widget_ref (artist_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "artist_entry", artist_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), artist_entry, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_editable (GTK_ENTRY (artist_entry), FALSE); + + album_entry = gtk_entry_new (); + gtk_widget_ref (album_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "album_entry", album_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), album_entry, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_editable (GTK_ENTRY (album_entry), FALSE); + + genre_entry = gtk_entry_new (); + gtk_widget_ref (genre_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "genre_entry", genre_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), genre_entry, 1, 2, 4, 5, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_editable (GTK_ENTRY (genre_entry), FALSE); + + comment_entry = gtk_entry_new (); + gtk_widget_ref (comment_entry); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "comment_entry", comment_entry, + (GtkDestroyNotify) gtk_widget_unref); + gtk_table_attach (GTK_TABLE (table1), comment_entry, 1, 2, 5, 6, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_entry_set_editable (GTK_ENTRY (comment_entry), FALSE); + + frame3 = gtk_frame_new ("MP4 Info: "); + gtk_widget_ref (frame3); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "frame3", frame3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (hbox3), frame3, FALSE, TRUE, 0); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_ref (vbox1); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "vbox1", vbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_container_add (GTK_CONTAINER (frame3), vbox1); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5); + + mp4_info_label = gtk_label_new (""); + gtk_widget_ref (mp4_info_label); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "mp4_info_label", mp4_info_label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (vbox1), mp4_info_label, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (mp4_info_label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (mp4_info_label), 0, 0); + + dialog_action_area1 = GTK_DIALOG (mp4_info_dialog)->action_area; + gtk_object_set_data (GTK_OBJECT (mp4_info_dialog), "dialog_action_area1", dialog_action_area1); + gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 4); + + close_button = gtk_button_new_with_label ("Close"); + gtk_widget_ref (close_button); + gtk_object_set_data_full (GTK_OBJECT (mp4_info_dialog), "close_button", close_button, + (GtkDestroyNotify) gtk_widget_unref); + gtk_box_pack_start (GTK_BOX (dialog_action_area1), close_button, FALSE, FALSE, 0); + + gtk_signal_connect_object (GTK_OBJECT (close_button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (mp4_info_dialog)); + + } + + window_title = g_strdup_printf("File Info - %s", g_basename(filename)); + gtk_window_set_title (GTK_WINDOW (mp4_info_dialog), window_title); + g_free(window_title); + + gtk_entry_set_text (GTK_ENTRY (filename_entry), filename); + + gtk_entry_set_text (GTK_ENTRY (title_entry), ""); + gtk_entry_set_text (GTK_ENTRY (artist_entry), ""); + gtk_entry_set_text (GTK_ENTRY (album_entry), ""); + gtk_entry_set_text (GTK_ENTRY (year_entry), ""); + gtk_entry_set_text (GTK_ENTRY (track_entry), ""); + gtk_entry_set_text (GTK_ENTRY (genre_entry), ""); + gtk_entry_set_text (GTK_ENTRY (comment_entry), ""); + + if ((mp4ff_meta_get_title(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(title_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_artist(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(artist_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_album(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(album_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_date(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(year_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_track(infile, &value)) && value != NULL) { + if ((mp4ff_meta_get_totaltracks(infile, &value2)) && value2 != NULL) { + char *tmp = g_strdup_printf("%s of %s", value, value2); + g_free(value2); + g_free(value); + value = tmp; + } + gtk_entry_set_text (GTK_ENTRY(track_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_genre(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(genre_entry), value); + g_free(value); + } + if ((mp4ff_meta_get_comment(infile, &value)) && value != NULL) { + gtk_entry_set_text (GTK_ENTRY(comment_entry), value); + g_free(value); + } + + // Get the length of the track. + double track_duration = mp4ff_get_track_duration(infile, mp4track); + unsigned long time_scale = mp4ff_time_scale(infile, mp4track); + unsigned long length = (track_duration / time_scale); + int min = length / 60; + int sec = length % 60; + + // Get other info about the track. + unsigned long bitrate = mp4ff_get_avg_bitrate(infile, mp4track) / 1000; + unsigned long samplerate = mp4ff_get_sample_rate(infile, mp4track); + unsigned long channels = mp4ff_get_channel_count(infile, mp4track); + unsigned long audio_type = mp4ff_get_audio_type(infile, mp4track); + fseek(mp4file, 0, SEEK_END); + int filesize = ftell(mp4file) / 1024; + + value = g_strdup_printf("Length: %d:%d\nAvg. Bitrate: %ld kbps\nSample Rate: %ld Hz\nChannels: %ld\nAudio Type: %ld\nFile Size: %d KB", min, sec, bitrate, samplerate, channels, audio_type, filesize); + gtk_label_set_text (GTK_LABEL(mp4_info_label), value); + g_free(value); + + gtk_widget_show_all(mp4_info_dialog); +} + + +void getMP4info(char* filename, FILE* mp4file) +{ + mp4ff_callback_t* mp4cb; + mp4ff_t* infile; + gint mp4track; + + mp4cb = getMP4FF_cb(mp4file); + if ((infile = mp4ff_open_read_metaonly(mp4cb)) && + ((mp4track = getAACTrack(infile)) >= 0)){ + create_mp4_info_dialog (filename, mp4file, infile, mp4track); + } + if(infile) mp4ff_close(infile); + if(mp4cb) g_free(mp4cb); +} + +/* Get the xmms titlestring for the file based on metadata. +The following code was adapted from the gtkpod project, specifically +mp4file.c (C) Jorg Schuler, but written to use the mp4ff library. The +mpg123 input plugin for xmms was used as a guide for this function. + --Jason Arroyo, 2004 */ +char *getMP4title(mp4ff_t *infile, char *filename) { + char *ret=NULL; + gchar *value, *path, *temp; + + TitleInput *input; + XMMS_NEW_TITLEINPUT(input); + + // Fill in the TitleInput with the relevant data + // from the mp4 file that can be used to display the title. + mp4ff_meta_get_title(infile, &input->track_name); + mp4ff_meta_get_artist(infile, &input->performer); + mp4ff_meta_get_album(infile, &input->album_name); + if (mp4ff_meta_get_track(infile, &value) && value != NULL) { + input->track_number = atoi(value); + g_free(value); + } + if (mp4ff_meta_get_date(infile, &value) && value != NULL) { + input->year = atoi(value); + g_free(value); + } + mp4ff_meta_get_genre(infile, &input->genre); + mp4ff_meta_get_comment(infile, &input->comment); + input->file_name = g_strdup(g_basename(filename)); + path = g_strdup(filename); + temp = strrchr(path, '.'); + if (temp != NULL) {++temp;} + input->file_ext = g_strdup_printf("%s", temp); + temp = strrchr(path, '/'); + if (temp) {*temp = '\0';} + input->file_path = g_strdup_printf("%s/", path); + + // Use the default xmms title format to format the + // title from the above info. + ret = xmms_get_titlestring(xmms_get_gentitle_format(), input); + + g_free(input->track_name); + g_free(input->performer); + g_free(input->album_name); + g_free(input->genre); + g_free(input->comment); + g_free(input->file_name); + g_free(input->file_ext); + g_free(input->file_path); + g_free(input); + g_free(path); + + return ret; +} --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/Makefile.in +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/Makefile.in @@ -0,0 +1,467 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = plugins/bmp +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + AUTHORS ChangeLog INSTALL NEWS TODO +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BMP_CFLAGS = @BMP_CFLAGS@ +BMP_LIBS = @BMP_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +HAVE_BMP_FALSE = @HAVE_BMP_FALSE@ +HAVE_BMP_TRUE = @HAVE_BMP_TRUE@ +HAVE_MPEG4IP_PLUG_FALSE = @HAVE_MPEG4IP_PLUG_FALSE@ +HAVE_MPEG4IP_PLUG_TRUE = @HAVE_MPEG4IP_PLUG_TRUE@ +HAVE_XMMS_FALSE = @HAVE_XMMS_FALSE@ +HAVE_XMMS_TRUE = @HAVE_XMMS_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MP4FF_LIBS = @MP4FF_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RPMBUILD = @RPMBUILD@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ +WITH_MP4V2_TRUE = @WITH_MP4V2_TRUE@ +XMMS_CONFIG = @XMMS_CONFIG@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = src +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/bmp/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/bmp/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/ChangeLog +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/ChangeLog @@ -0,0 +1,43 @@ +22 August 2004: + * move from libmp4v2 to libmp4ff + +1 December 2003: + * remove aac plug and merge the aac part with the mp4 part + so now 2 plugins in one :) + +4 juillet 2003: + * package the plugin for faad2 + * upgrade code to libfaad2-2.0 API + * version 0.5 + +15 juin 2003: + * better configuration code + (choose automaticaly at compile time) + * installation must be set by root + * version 0.4 + +15 mai 2003: + * update configure script to be better + * version 0.3 + +01 Novembre 2002: + * check automake/autoconf/libtool for plugin, now 'make install' work + * handle seeking + * configuration box created (thanks glade !) + * handle aac informations + * modification to a better infobox (thanks angain glade !) + * version 0.2 ready to public :) + +25 Aout 2002: + * gtk-1.2.x info file with some 'static' useful ID3 info + * title show in xmms correctly + * version 0.1 ready to public :) + +20 Aout 2002: + * everything... + * work with faad2lib-1.1, id3lib-3.8.0 (glibc-2.2.5, gcc-2.95.3) + i think the minimum required but need testing... + * playlist working + * handle id3tag, the plugin work :) + * new maintener : ciberfred + --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/INSTALL +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/INSTALL @@ -0,0 +1,2 @@ +the installation of this plugin is provide by the faad2 package. +add to configure time the option '--with-xmms' and the plugin will be build \ No newline at end of file --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/TODO +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/TODO @@ -0,0 +1,6 @@ +TODO: + + * handle AAC info such as MPEG-AAC type, header (ADTS/ADIF),... + * seeking... but it will certainly an option because it need + a reading of whole file.... + * any suggestions ... send me somes messages about it :) --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/AUTHORS +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/AUTHORS @@ -0,0 +1,3 @@ +xmms-mp4 plugin for xmms-1.2.x + +re-coded by ciberfred from scratch --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/Makefile.am +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = src + --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/README +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/README @@ -0,0 +1,23 @@ + xmms-mp4 plugin v0.5 + (dynamic version) + "a mp4/aac audio player for xmms" + coded by ciberfred from france + ------------- + +This source code allow to xmms to read .mp4/.m4a/.aac files + +About. + This plugin is a merge between aac and mp4 plugin. so now you could read +all new and old files encoded with different encoder and different format +(for the aac part). This is possible since the libfaad2 allow to read +old aac ADTS format. + +For any informations about this plugin contact me at : + +mail : frederic.fondriest@laposte.net +ICQ : 17293220 +aac plugin homepage (and more) : http://fondriest.frederic.free.fr/realisations/ +IRC : irc.eu.freenode.net (#lamip) + +-- +Frederic Fondriest --- vlc-0.8.6.release.d.orig/extras/faad2/plugins/bmp/NEWS +++ vlc-0.8.6.release.d/extras/faad2/plugins/bmp/NEWS @@ -0,0 +1,21 @@ +22 Aout 2004 +------------ +modification du system de compilation, passage de libmp4v2 a libmp4ff +en static, libfaad en dynamique. + +1 Decembre 2003 +--------------- +merge du plugin aac et du plugin mp4. modification des script du projet faad +le plugin ne doit pas etre construit en meme temps que le projet + +4 Juillet 2003 +-------------- +integration du plugin xmms-aac dans le projet faad2 version 2.x + +15 aout 2002 +------------ + +Recodage en entier du plugin aac +me contacter par mail a : + +frederic.fondriest@laposte.net --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_root.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_root.cpp @@ -0,0 +1,123 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4RootAtom::MP4RootAtom() + : MP4Atom(NULL) +{ + ExpectChildAtom("ftyp", Required, OnlyOne); + ExpectChildAtom("moov", Required, OnlyOne); + ExpectChildAtom("mdat", Optional, Many); + ExpectChildAtom("free", Optional, Many); + ExpectChildAtom("skip", Optional, Many); + ExpectChildAtom("udta", Optional, Many); + ExpectChildAtom("moof", Optional, Many); +} + +void MP4RootAtom::BeginWrite(bool use64) +{ + // only call under MP4Create() control + WriteAtomType("ftyp", OnlyOne); + + m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits()); +} + +void MP4RootAtom::Write() +{ + // no-op +} + +void MP4RootAtom::FinishWrite(bool use64) +{ + // finish writing last mdat atom + u_int32_t mdatIndex = GetLastMdatIndex(); + m_pChildAtoms[mdatIndex]->FinishWrite(m_pFile->Use64Bits()); + + // write all atoms after last mdat + u_int32_t size = m_pChildAtoms.Size(); + for (u_int32_t i = mdatIndex + 1; i < size; i++) { + m_pChildAtoms[i]->Write(); + } +} + +void MP4RootAtom::BeginOptimalWrite() +{ + WriteAtomType("ftyp", OnlyOne); + WriteAtomType("moov", OnlyOne); + WriteAtomType("udta", Many); + + m_pChildAtoms[GetLastMdatIndex()]->BeginWrite(m_pFile->Use64Bits()); +} + +void MP4RootAtom::FinishOptimalWrite() +{ + // finish writing mdat + m_pChildAtoms[GetLastMdatIndex()]->FinishWrite(m_pFile->Use64Bits()); + + // find moov atom + u_int32_t size = m_pChildAtoms.Size(); + MP4Atom* pMoovAtom = NULL; + + u_int32_t i; + for (i = 0; i < size; i++) { + if (!strcmp("moov", m_pChildAtoms[i]->GetType())) { + pMoovAtom = m_pChildAtoms[i]; + break; + } + } + ASSERT(i < size); + + // rewrite moov so that updated chunkOffsets are written to disk + m_pFile->SetPosition(pMoovAtom->GetStart()); + u_int64_t oldSize = pMoovAtom->GetSize(); + + pMoovAtom->Write(); + + // sanity check + u_int64_t newSize = pMoovAtom->GetSize(); + ASSERT(oldSize == newSize); +} + +u_int32_t MP4RootAtom::GetLastMdatIndex() +{ + for (int32_t i = m_pChildAtoms.Size() - 1; i >= 0; i--) { + if (!strcmp("mdat", m_pChildAtoms[i]->GetType())) { + return i; + } + } + ASSERT(false); + return (u_int32_t)-1; +} + +void MP4RootAtom::WriteAtomType(const char* type, bool onlyOne) +{ + u_int32_t size = m_pChildAtoms.Size(); + + for (u_int32_t i = 0; i < size; i++) { + if (!strcmp(type, m_pChildAtoms[i]->GetType())) { + m_pChildAtoms[i]->Write(); + if (onlyOne) { + break; + } + } + } +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_treftype.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_treftype.cpp @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrefTypeAtom::MP4TrefTypeAtom(const char* type) + : MP4Atom(type) +{ + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + pCount->SetImplicit(); + AddProperty(pCount); /* 0 */ + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); /* 1 */ + + pTable->AddProperty( /* 1, 0 */ + new MP4Integer32Property("trackId")); +} + +void MP4TrefTypeAtom::Read() +{ + // table entry count computed from atom size + ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false); + ((MP4Integer32Property*)m_pProperties[0])->SetValue(m_size / 4); + ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true); + + MP4Atom::Read(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/COPYING +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/COPYING @@ -0,0 +1,471 @@ + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_hdlr.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_hdlr.cpp @@ -0,0 +1,64 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4HdlrAtom::MP4HdlrAtom() + : MP4Atom("hdlr") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddReserved("reserved1", 4); /* 2 */ + MP4StringProperty* pProp = new MP4StringProperty("handlerType"); + pProp->SetFixedLength(4); + AddProperty(pProp); /* 3 */ + AddReserved("reserved2", 12); /* 4 */ + AddProperty( /* 5 */ + new MP4StringProperty("name")); +} + +// There is a spec incompatiblity between QT and MP4 +// QT says name field is a counted string +// MP4 says name field is a null terminated string +// Here we attempt to make all things work +void MP4HdlrAtom::Read() +{ + // read all the properties but the "name" field + ReadProperties(0, 5); + + // take a peek at the next byte + u_int8_t strLength; + m_pFile->PeekBytes(&strLength, 1); + + // if the value matches the remaining atom length + if (m_pFile->GetPosition() + strLength + 1 == GetEnd()) { + // read a counted string + MP4StringProperty* pNameProp = + (MP4StringProperty*)m_pProperties[5]; + pNameProp->SetCountedFormat(true); + ReadProperties(5); + pNameProp->SetCountedFormat(false); + } else { + // read a null terminated string + ReadProperties(5); + } + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_sdp.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_sdp.cpp @@ -0,0 +1,53 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4SdpAtom::MP4SdpAtom() : MP4Atom("sdp ") +{ + AddProperty( + new MP4StringProperty("sdpText")); +} + +void MP4SdpAtom::Read() +{ + // read sdp string, length is implicit in size of atom + u_int64_t size = GetEnd() - m_pFile->GetPosition(); + char* data = (char*)MP4Malloc(size + 1); + m_pFile->ReadBytes((u_int8_t*)data, size); + data[size] = '\0'; + ((MP4StringProperty*)m_pProperties[0])->SetValue(data); + MP4Free(data); +} + +void MP4SdpAtom::Write() +{ + // since length of string is implicit in size of atom + // we need to handle this specially, and not write the terminating \0 + MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[0]; + const char* sdpText = pSdp->GetValue(); + if (sdpText) { + pSdp->SetFixedLength(strlen(sdpText)); + } + MP4Atom::Write(); + pSdp->SetFixedLength(0); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stsd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stsd.cpp @@ -0,0 +1,61 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +MP4StsdAtom::MP4StsdAtom() + : MP4Atom("stsd") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + pCount->SetReadOnly(); + AddProperty(pCount); + + ExpectChildAtom("mp4a", Optional, Many); + ExpectChildAtom("enca", Optional, Many); + ExpectChildAtom("mp4s", Optional, Many); + ExpectChildAtom("mp4v", Optional, Many); + ExpectChildAtom("encv", Optional, Many); + ExpectChildAtom("rtp ", Optional, Many); +} + +void MP4StsdAtom::Read() +{ + /* do the usual read */ + MP4Atom::Read(); + + // check that number of children == entryCount + MP4Integer32Property* pCount = + (MP4Integer32Property*)m_pProperties[2]; + + if (m_pChildAtoms.Size() != pCount->GetValue()) { + VERBOSE_READ(GetVerbosity(), + printf("Warning: stsd inconsistency with number of entries")); + + /* fix it */ + pCount->SetReadOnly(false); + pCount->SetValue(m_pChildAtoms.Size()); + pCount->SetReadOnly(true); + } +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/rtphint.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/rtphint.cpp @@ -0,0 +1,1357 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +/* rtp hint track operations */ + +MP4RtpHintTrack::MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom) + : MP4Track(pFile, pTrakAtom) +{ + m_pRefTrack = NULL; + + m_pRtpMapProperty = NULL; + m_pPayloadNumberProperty = NULL; + m_pMaxPacketSizeProperty = NULL; + m_pSnroProperty = NULL; + m_pTsroProperty = NULL; + + m_pReadHint = NULL; + m_pReadHintSample = NULL; + m_readHintSampleSize = 0; + + m_pWriteHint = NULL; + m_writeHintId = MP4_INVALID_SAMPLE_ID; + m_writePacketId = 0; + + m_pTrpy = NULL; + m_pNump = NULL; + m_pTpyl = NULL; + m_pMaxr = NULL; + m_pDmed = NULL; + m_pDimm = NULL; + m_pPmax = NULL; + m_pDmax = NULL; + + m_pMaxPdu = NULL; + m_pAvgPdu = NULL; + m_pMaxBitRate = NULL; + m_pAvgBitRate = NULL; + + m_thisSec = 0; + m_bytesThisSec = 0; + m_bytesThisHint = 0; + m_bytesThisPacket = 0; +} + +MP4RtpHintTrack::~MP4RtpHintTrack() +{ + delete m_pReadHint; + delete m_pReadHintSample; + delete m_pWriteHint; +} + +void MP4RtpHintTrack::InitRefTrack() +{ + if (m_pRefTrack == NULL) { + MP4Integer32Property* pRefTrackIdProperty = NULL; + m_pTrakAtom->FindProperty( + "trak.tref.hint.entries[0].trackId", + (MP4Property**)&pRefTrackIdProperty); + ASSERT(pRefTrackIdProperty); + + m_pRefTrack = m_pFile->GetTrack(pRefTrackIdProperty->GetValue()); + } +} + +void MP4RtpHintTrack::InitRtpStart() +{ + struct timeval tv; + gettimeofday(&tv, NULL); + srandom((tv.tv_usec << 12) | (tv.tv_sec & 0xFFF)); + + ASSERT(m_pTrakAtom); + + m_pTrakAtom->FindProperty( + "trak.udta.hnti.rtp .snro.offset", + (MP4Property**)&m_pSnroProperty); + + if (m_pSnroProperty) { + m_rtpSequenceStart = m_pSnroProperty->GetValue(); + } else { + m_rtpSequenceStart = random(); + } + + m_pTrakAtom->FindProperty( + "trak.udta.hnti.rtp .tsro.offset", + (MP4Property**)&m_pTsroProperty); + + if (m_pTsroProperty) { + m_rtpTimestampStart = m_pTsroProperty->GetValue(); + } else { + m_rtpTimestampStart = random(); + } +} + +void MP4RtpHintTrack::ReadHint( + MP4SampleId hintSampleId, + u_int16_t* pNumPackets) +{ + if (m_pRefTrack == NULL) { + InitRefTrack(); + InitRtpStart(); + } + + // dispose of any old hint + delete m_pReadHint; + m_pReadHint = NULL; + delete m_pReadHintSample; + m_pReadHintSample = NULL; + m_readHintSampleSize = 0; + + // read the desired hint sample into memory + ReadSample( + hintSampleId, + &m_pReadHintSample, + &m_readHintSampleSize, + &m_readHintTimestamp); + + m_pFile->EnableMemoryBuffer(m_pReadHintSample, m_readHintSampleSize); + + m_pReadHint = new MP4RtpHint(this); + m_pReadHint->Read(m_pFile); + + m_pFile->DisableMemoryBuffer(); + + if (pNumPackets) { + *pNumPackets = GetHintNumberOfPackets(); + } +} + +u_int16_t MP4RtpHintTrack::GetHintNumberOfPackets() +{ + if (m_pReadHint == NULL) { + throw new MP4Error("no hint has been read", + "MP4GetRtpHintNumberOfPackets"); + } + return m_pReadHint->GetNumberOfPackets(); +} + +bool MP4RtpHintTrack::GetPacketBFrame(u_int16_t packetIndex) +{ + if (m_pReadHint == NULL) { + throw new MP4Error("no hint has been read", + "MP4GetRtpPacketBFrame"); + } + MP4RtpPacket* pPacket = + m_pReadHint->GetPacket(packetIndex); + + return pPacket->IsBFrame(); +} + +u_int16_t MP4RtpHintTrack::GetPacketTransmitOffset(u_int16_t packetIndex) +{ + if (m_pReadHint == NULL) { + throw new MP4Error("no hint has been read", + "MP4GetRtpPacketTransmitOffset"); + } + + MP4RtpPacket* pPacket = + m_pReadHint->GetPacket(packetIndex); + + return pPacket->GetTransmitOffset(); +} + +void MP4RtpHintTrack::ReadPacket( + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc, + bool addHeader, + bool addPayload) +{ + if (m_pReadHint == NULL) { + throw new MP4Error("no hint has been read", + "MP4ReadRtpPacket"); + } + if (!addHeader && !addPayload) { + throw new MP4Error("no data requested", + "MP4ReadRtpPacket"); + } + + MP4RtpPacket* pPacket = + m_pReadHint->GetPacket(packetIndex); + + *pNumBytes = 0; + if (addHeader) { + *pNumBytes += 12; + } + if (addPayload) { + *pNumBytes += pPacket->GetDataSize(); + } + + // if needed, allocate the packet memory + bool buffer_malloc = false; + + if (*ppBytes == NULL) { + *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); + buffer_malloc = true; + } + + try { + u_int8_t* pDest = *ppBytes; + + if (addHeader) { + *pDest++ = + 0x80 | (pPacket->GetPBit() << 5) | (pPacket->GetXBit() << 4); + + *pDest++ = + (pPacket->GetMBit() << 7) | pPacket->GetPayload(); + + *((u_int16_t*)pDest) = + htons(m_rtpSequenceStart + pPacket->GetSequenceNumber()); + pDest += 2; + + *((u_int32_t*)pDest) = + htonl(m_rtpTimestampStart + (u_int32_t)m_readHintTimestamp); + pDest += 4; + + *((u_int32_t*)pDest) = + htonl(ssrc); + pDest += 4; + } + + if (addPayload) { + pPacket->GetData(pDest); + } + } + catch (MP4Error* e) { + if (buffer_malloc) { + MP4Free(*ppBytes); + *ppBytes = NULL; + } + throw e; + } + + VERBOSE_READ_HINT(m_pFile->GetVerbosity(), + printf("ReadPacket: %u ", packetIndex); + MP4HexDump(*ppBytes, *pNumBytes);); +} + +MP4Timestamp MP4RtpHintTrack::GetRtpTimestampStart() +{ + if (m_pRefTrack == NULL) { + InitRefTrack(); + InitRtpStart(); + } + + return m_rtpTimestampStart; +} + +void MP4RtpHintTrack::SetRtpTimestampStart(MP4Timestamp start) +{ + if (!m_pTsroProperty) { + MP4Atom* pTsroAtom = + m_pFile->AddDescendantAtoms(m_pTrakAtom, "udta.hnti.rtp .tsro"); + + ASSERT(pTsroAtom); + + pTsroAtom->FindProperty("offset", + (MP4Property**)&m_pTsroProperty); + + ASSERT(m_pTsroProperty); + } + + m_pTsroProperty->SetValue(start); + m_rtpTimestampStart = start; +} + +void MP4RtpHintTrack::InitPayload() +{ + ASSERT(m_pTrakAtom); + + if (m_pRtpMapProperty == NULL) { + m_pTrakAtom->FindProperty( + "trak.udta.hinf.payt.rtpMap", + (MP4Property**)&m_pRtpMapProperty); + } + + if (m_pPayloadNumberProperty == NULL) { + m_pTrakAtom->FindProperty( + "trak.udta.hinf.payt.payloadNumber", + (MP4Property**)&m_pPayloadNumberProperty); + } + + if (m_pMaxPacketSizeProperty == NULL) { + m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsd.rtp .maxPacketSize", + (MP4Property**)&m_pMaxPacketSizeProperty); + } +} + +void MP4RtpHintTrack::GetPayload( + char** ppPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t* pMaxPayloadSize, + char **ppEncodingParams) +{ + InitPayload(); + + if (ppPayloadName || ppEncodingParams) { + if (ppPayloadName) + *ppPayloadName = NULL; + if (ppEncodingParams) + *ppEncodingParams = NULL; + if (m_pRtpMapProperty) { + const char* pRtpMap = m_pRtpMapProperty->GetValue(); + char* pSlash = strchr(pRtpMap, '/'); + + u_int32_t length; + if (pSlash) { + length = pSlash - pRtpMap; + } else { + length = strlen(pRtpMap); + } + + if (ppPayloadName) { + *ppPayloadName = (char*)MP4Calloc(length + 1); + strncpy(*ppPayloadName, pRtpMap, length); + } + if (pSlash && ppEncodingParams) { + pSlash = strchr(pSlash, '/'); + if (pSlash != NULL) { + pSlash++; + if (pSlash != '\0') { + length = strlen(pRtpMap) - (pSlash - pRtpMap); + *ppEncodingParams = (char *)MP4Calloc(length + 1); + strncpy(*ppEncodingParams, pSlash, length); + } + } + } + } + } + + if (pPayloadNumber) { + if (m_pPayloadNumberProperty) { + *pPayloadNumber = m_pPayloadNumberProperty->GetValue(); + } else { + *pPayloadNumber = 0; + } + } + + if (pMaxPayloadSize) { + if (m_pMaxPacketSizeProperty) { + *pMaxPayloadSize = m_pMaxPacketSizeProperty->GetValue(); + } else { + *pMaxPayloadSize = 0; + } + } +} + +void MP4RtpHintTrack::SetPayload( + const char* payloadName, + u_int8_t payloadNumber, + u_int16_t maxPayloadSize, + const char *encoding_parms, + bool include_rtp_map, + bool include_mpeg4_esid) +{ + InitRefTrack(); + InitPayload(); + + ASSERT(m_pRtpMapProperty); + ASSERT(m_pPayloadNumberProperty); + ASSERT(m_pMaxPacketSizeProperty); + + size_t len = strlen(payloadName) + 16; + if (encoding_parms != NULL) { + size_t temp = strlen(encoding_parms); + if (temp == 0) { + encoding_parms = NULL; + } else { + len += temp; + } + } + + char* rtpMapBuf = (char*)MP4Malloc(len); + sprintf(rtpMapBuf, "%s/%u%c%s", + payloadName, + GetTimeScale(), + encoding_parms != NULL ? '/' : '\0', + encoding_parms == NULL ? "" : encoding_parms); + m_pRtpMapProperty->SetValue(rtpMapBuf); + + m_pPayloadNumberProperty->SetValue(payloadNumber); + + if (maxPayloadSize == 0) { + maxPayloadSize = 1460; + } + m_pMaxPacketSizeProperty->SetValue(maxPayloadSize); + + // set sdp media type + const char* sdpMediaType; + if (!strcmp(m_pRefTrack->GetType(), MP4_AUDIO_TRACK_TYPE)) { + sdpMediaType = "audio"; + } else if (!strcmp(m_pRefTrack->GetType(), MP4_VIDEO_TRACK_TYPE)) { + sdpMediaType = "video"; + } else { + sdpMediaType = "application"; + } + + char* sdpBuf = (char*)MP4Malloc( + strlen(sdpMediaType) + strlen(rtpMapBuf) + 256); + uint32_t buflen; + buflen = sprintf(sdpBuf, + "m=%s 0 RTP/AVP %u\015\012" + "a=control:trackID=%u\015\012", + sdpMediaType, payloadNumber, + m_trackId); + if (include_rtp_map) { + buflen += sprintf(sdpBuf + buflen, + "a=rtpmap:%u %s\015\012", + payloadNumber, rtpMapBuf); + } + if (include_mpeg4_esid) { + sprintf(sdpBuf + buflen, + "a=mpeg4-esid:%u\015\012", + m_pRefTrack->GetId()); + } + + MP4StringProperty* pSdpProperty = NULL; + m_pTrakAtom->FindProperty("trak.udta.hnti.sdp .sdpText", + (MP4Property**)&pSdpProperty); + ASSERT(pSdpProperty); + pSdpProperty->SetValue(sdpBuf); + + // cleanup + MP4Free(rtpMapBuf); + MP4Free(sdpBuf); +} + +void MP4RtpHintTrack::AddHint(bool isBFrame, u_int32_t timestampOffset) +{ + // on first hint, need to lookup the reference track + if (m_writeHintId == MP4_INVALID_SAMPLE_ID) { + InitRefTrack(); + InitStats(); + } + + if (m_pWriteHint) { + throw new MP4Error("unwritten hint is still pending", "MP4AddRtpHint"); + } + + m_pWriteHint = new MP4RtpHint(this); + m_pWriteHint->SetBFrame(isBFrame); + m_pWriteHint->SetTimestampOffset(timestampOffset); + + m_bytesThisHint = 0; + m_writeHintId++; +} + +void MP4RtpHintTrack::AddPacket(bool setMbit, int32_t transmitOffset) +{ + if (m_pWriteHint == NULL) { + throw new MP4Error("no hint pending", "MP4RtpAddPacket"); + } + + MP4RtpPacket* pPacket = m_pWriteHint->AddPacket(); + + ASSERT(m_pPayloadNumberProperty); + + pPacket->Set( + m_pPayloadNumberProperty->GetValue(), + m_writePacketId++, + setMbit); + pPacket->SetTransmitOffset(transmitOffset); + + m_bytesThisHint += 12; + if (m_bytesThisPacket > m_pPmax->GetValue()) { + m_pPmax->SetValue(m_bytesThisPacket); + } + m_bytesThisPacket = 12; + m_pNump->IncrementValue(); + m_pTrpy->IncrementValue(12); // RTP packet header size +} + +void MP4RtpHintTrack::AddImmediateData( + const u_int8_t* pBytes, + u_int32_t numBytes) +{ + if (m_pWriteHint == NULL) { + throw new MP4Error("no hint pending", "MP4RtpAddImmediateData"); + } + + MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); + if (pPacket == NULL) { + throw new MP4Error("no packet pending", "MP4RtpAddImmediateData"); + } + + if (pBytes == NULL || numBytes == 0) { + throw new MP4Error("no data", + "AddImmediateData"); + } + if (numBytes > 14) { + throw new MP4Error("data size is larger than 14 bytes", + "AddImmediateData"); + } + + MP4RtpImmediateData* pData = new MP4RtpImmediateData(pPacket); + pData->Set(pBytes, numBytes); + + pPacket->AddData(pData); + + m_bytesThisHint += numBytes; + m_bytesThisPacket += numBytes; + m_pDimm->IncrementValue(numBytes); + m_pTpyl->IncrementValue(numBytes); + m_pTrpy->IncrementValue(numBytes); +} + +void MP4RtpHintTrack::AddSampleData( + MP4SampleId sampleId, + u_int32_t dataOffset, + u_int32_t dataLength) +{ + if (m_pWriteHint == NULL) { + throw new MP4Error("no hint pending", "MP4RtpAddSampleData"); + } + + MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); + if (pPacket == NULL) { + throw new MP4Error("no packet pending", "MP4RtpAddSampleData"); + } + + MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket); + + pData->SetReferenceSample(sampleId, dataOffset, dataLength); + + pPacket->AddData(pData); + + m_bytesThisHint += dataLength; + m_bytesThisPacket += dataLength; + m_pDmed->IncrementValue(dataLength); + m_pTpyl->IncrementValue(dataLength); + m_pTrpy->IncrementValue(dataLength); +} + +void MP4RtpHintTrack::AddESConfigurationPacket() +{ + if (m_pWriteHint == NULL) { + throw new MP4Error("no hint pending", + "MP4RtpAddESConfigurationPacket"); + } + + u_int8_t* pConfig = NULL; + u_int32_t configSize = 0; + + m_pFile->GetTrackESConfiguration(m_pRefTrack->GetId(), + &pConfig, &configSize); + + if (pConfig == NULL) { + return; + } + + ASSERT(m_pMaxPacketSizeProperty); + + if (configSize > m_pMaxPacketSizeProperty->GetValue()) { + throw new MP4Error("ES configuration is too large for RTP payload", + "MP4RtpAddESConfigurationPacket"); + } + + AddPacket(false); + + MP4RtpPacket* pPacket = m_pWriteHint->GetCurrentPacket(); + ASSERT(pPacket); + + // This is ugly! + // To get the ES configuration data somewhere known + // we create a sample data reference that points to + // this hint track (not the media track) + // and this sample of the hint track + // the offset into this sample is filled in during the write process + MP4RtpSampleData* pData = new MP4RtpSampleData(pPacket); + + pData->SetEmbeddedImmediate(m_writeSampleId, pConfig, configSize); + + pPacket->AddData(pData); + + m_bytesThisHint += configSize; + m_bytesThisPacket += configSize; + m_pTpyl->IncrementValue(configSize); + m_pTrpy->IncrementValue(configSize); +} + +void MP4RtpHintTrack::WriteHint(MP4Duration duration, bool isSyncSample) +{ + if (m_pWriteHint == NULL) { + throw new MP4Error("no hint pending", "MP4WriteRtpHint"); + } + + u_int8_t* pBytes; + u_int64_t numBytes; + + m_pFile->EnableMemoryBuffer(); + + m_pWriteHint->Write(m_pFile); + + m_pFile->DisableMemoryBuffer(&pBytes, &numBytes); + + WriteSample(pBytes, numBytes, duration, 0, isSyncSample); + + MP4Free(pBytes); + + // update statistics + if (m_bytesThisPacket > m_pPmax->GetValue()) { + m_pPmax->SetValue(m_bytesThisPacket); + } + + if (duration > m_pDmax->GetValue()) { + m_pDmax->SetValue(duration); + } + + MP4Timestamp startTime; + + GetSampleTimes(m_writeHintId, &startTime, NULL); + + if (startTime < m_thisSec + GetTimeScale()) { + m_bytesThisSec += m_bytesThisHint; + } else { + if (m_bytesThisSec > m_pMaxr->GetValue()) { + m_pMaxr->SetValue(m_bytesThisSec); + } + m_thisSec = startTime - (startTime % GetTimeScale()); + m_bytesThisSec = m_bytesThisHint; + } + + // cleanup + delete m_pWriteHint; + m_pWriteHint = NULL; +} + +void MP4RtpHintTrack::FinishWrite() +{ + if (m_writeHintId != MP4_INVALID_SAMPLE_ID) { + m_pMaxPdu->SetValue(m_pPmax->GetValue()); + if (m_pNump->GetValue()) { + m_pAvgPdu->SetValue(m_pTrpy->GetValue() / m_pNump->GetValue()); + } + + m_pMaxBitRate->SetValue(m_pMaxr->GetValue() * 8); + if (GetDuration()) { + m_pAvgBitRate->SetValue( + m_pTrpy->GetValue() * 8 * GetTimeScale() / GetDuration()); + } + } + + MP4Track::FinishWrite(); +} + +void MP4RtpHintTrack::InitStats() +{ + MP4Atom* pHinfAtom = m_pTrakAtom->FindAtom("trak.udta.hinf"); + + ASSERT(pHinfAtom); + + pHinfAtom->FindProperty("hinf.trpy.bytes", (MP4Property**)&m_pTrpy); + pHinfAtom->FindProperty("hinf.nump.packets", (MP4Property**)&m_pNump); + pHinfAtom->FindProperty("hinf.tpyl.bytes", (MP4Property**)&m_pTpyl); + pHinfAtom->FindProperty("hinf.maxr.bytes", (MP4Property**)&m_pMaxr); + pHinfAtom->FindProperty("hinf.dmed.bytes", (MP4Property**)&m_pDmed); + pHinfAtom->FindProperty("hinf.dimm.bytes", (MP4Property**)&m_pDimm); + pHinfAtom->FindProperty("hinf.pmax.bytes", (MP4Property**)&m_pPmax); + pHinfAtom->FindProperty("hinf.dmax.milliSecs", (MP4Property**)&m_pDmax); + + MP4Atom* pHmhdAtom = m_pTrakAtom->FindAtom("trak.mdia.minf.hmhd"); + + ASSERT(pHmhdAtom); + + pHmhdAtom->FindProperty("hmhd.maxPduSize", (MP4Property**)&m_pMaxPdu); + pHmhdAtom->FindProperty("hmhd.avgPduSize", (MP4Property**)&m_pAvgPdu); + pHmhdAtom->FindProperty("hmhd.maxBitRate", (MP4Property**)&m_pMaxBitRate); + pHmhdAtom->FindProperty("hmhd.avgBitRate", (MP4Property**)&m_pAvgBitRate); + + MP4Integer32Property* pMaxrPeriod = NULL; + pHinfAtom->FindProperty("hinf.maxr.granularity", + (MP4Property**)&pMaxrPeriod); + if (pMaxrPeriod) { + pMaxrPeriod->SetValue(1000); // 1 second + } +} + + +MP4RtpHint::MP4RtpHint(MP4RtpHintTrack* pTrack) +{ + m_pTrack = pTrack; + + AddProperty( /* 0 */ + new MP4Integer16Property("packetCount")); + AddProperty( /* 1 */ + new MP4Integer16Property("reserved")); +} + +MP4RtpHint::~MP4RtpHint() +{ + for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) { + delete m_rtpPackets[i]; + } +} + +MP4RtpPacket* MP4RtpHint::AddPacket() +{ + MP4RtpPacket* pPacket = new MP4RtpPacket(this); + m_rtpPackets.Add(pPacket); + + // packetCount property + ((MP4Integer16Property*)m_pProperties[0])->IncrementValue(); + + pPacket->SetBFrame(m_isBFrame); + pPacket->SetTimestampOffset(m_timestampOffset); + + return pPacket; +} + +void MP4RtpHint::Read(MP4File* pFile) +{ + // call base class Read for required properties + MP4Container::Read(pFile); + + u_int16_t numPackets = + ((MP4Integer16Property*)m_pProperties[0])->GetValue(); + + for (u_int16_t i = 0; i < numPackets; i++) { + MP4RtpPacket* pPacket = new MP4RtpPacket(this); + + m_rtpPackets.Add(pPacket); + + pPacket->Read(pFile); + } + + VERBOSE_READ_HINT(pFile->GetVerbosity(), + printf("ReadHint:\n"); Dump(stdout, 10, false);); +} + +void MP4RtpHint::Write(MP4File* pFile) +{ + u_int64_t hintStartPos = pFile->GetPosition(); + + MP4Container::Write(pFile); + + u_int64_t packetStartPos = pFile->GetPosition(); + + u_int32_t i; + + // first write out packet (and data) entries + for (i = 0; i < m_rtpPackets.Size(); i++) { + m_rtpPackets[i]->Write(pFile); + } + + // now let packets write their extra data into the hint sample + for (i = 0; i < m_rtpPackets.Size(); i++) { + m_rtpPackets[i]->WriteEmbeddedData(pFile, hintStartPos); + } + + u_int64_t endPos = pFile->GetPosition(); + + pFile->SetPosition(packetStartPos); + + // finally rewrite the packet and data entries + // which now contain the correct offsets for the embedded data + for (i = 0; i < m_rtpPackets.Size(); i++) { + m_rtpPackets[i]->Write(pFile); + } + + pFile->SetPosition(endPos); + + VERBOSE_WRITE_HINT(pFile->GetVerbosity(), + printf("WriteRtpHint:\n"); Dump(stdout, 14, false)); +} + +void MP4RtpHint::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) +{ + MP4Container::Dump(pFile, indent, dumpImplicits); + + for (u_int32_t i = 0; i < m_rtpPackets.Size(); i++) { + Indent(pFile, indent); + fprintf(pFile, "RtpPacket: %u\n", i); + m_rtpPackets[i]->Dump(pFile, indent + 1, dumpImplicits); + } +} + +MP4RtpPacket::MP4RtpPacket(MP4RtpHint* pHint) +{ + m_pHint = pHint; + + AddProperty( /* 0 */ + new MP4Integer32Property("relativeXmitTime")); + AddProperty( /* 1 */ + new MP4BitfieldProperty("reserved1", 2)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("Pbit", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("Xbit", 1)); + AddProperty( /* 4 */ + new MP4BitfieldProperty("reserved2", 4)); + AddProperty( /* 5 */ + new MP4BitfieldProperty("Mbit", 1)); + AddProperty( /* 6 */ + new MP4BitfieldProperty("payloadType", 7)); + AddProperty( /* 7 */ + new MP4Integer16Property("sequenceNumber")); + AddProperty( /* 8 */ + new MP4BitfieldProperty("reserved3", 13)); + AddProperty( /* 9 */ + new MP4BitfieldProperty("extraFlag", 1)); + AddProperty( /* 10 */ + new MP4BitfieldProperty("bFrameFlag", 1)); + AddProperty( /* 11 */ + new MP4BitfieldProperty("repeatFlag", 1)); + AddProperty( /* 12 */ + new MP4Integer16Property("entryCount")); +} + +MP4RtpPacket::~MP4RtpPacket() +{ + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + delete m_rtpData[i]; + } +} + +void MP4RtpPacket::AddExtraProperties() +{ + AddProperty( /* 13 */ + new MP4Integer32Property("extraInformationLength")); + + // This is a bit of a hack, since the tlv entries are really defined + // as atoms but there is only one type defined now, rtpo, and getting + // our atom code hooked up here would be a major pain with little gain + + AddProperty( /* 14 */ + new MP4Integer32Property("tlvLength")); + AddProperty( /* 15 */ + new MP4StringProperty("tlvType")); + AddProperty( /* 16 */ + new MP4Integer32Property("timestampOffset")); + + ((MP4Integer32Property*)m_pProperties[13])->SetValue(16); + ((MP4Integer32Property*)m_pProperties[14])->SetValue(12); + ((MP4StringProperty*)m_pProperties[15])->SetFixedLength(4); + ((MP4StringProperty*)m_pProperties[15])->SetValue("rtpo"); +} + +void MP4RtpPacket::Read(MP4File* pFile) +{ + // call base class Read for required properties + MP4Container::Read(pFile); + + // read extra info if present + // we only support the rtpo field! + if (((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 1) { + ReadExtra(pFile); + } + + u_int16_t numDataEntries = + ((MP4Integer16Property*)m_pProperties[12])->GetValue(); + + // read data entries + for (u_int16_t i = 0; i < numDataEntries; i++) { + u_int8_t dataType; + pFile->PeekBytes(&dataType, 1); + + MP4RtpData* pData; + + switch (dataType) { + case 0: + pData = new MP4RtpNullData(this); + break; + case 1: + pData = new MP4RtpImmediateData(this); + break; + case 2: + pData = new MP4RtpSampleData(this); + break; + case 3: + pData = new MP4RtpSampleDescriptionData(this); + break; + default: + throw new MP4Error("unknown packet data entry type", + "MP4ReadHint"); + } + + m_rtpData.Add(pData); + + // read data entry's properties + pData->Read(pFile); + } +} + +void MP4RtpPacket::ReadExtra(MP4File* pFile) +{ + AddExtraProperties(); + + int32_t extraLength = (int32_t)pFile->ReadUInt32(); + + if (extraLength < 4) { + throw new MP4Error("bad packet extra info length", + "MP4RtpPacket::ReadExtra"); + } + extraLength -= 4; + + while (extraLength > 0) { + u_int32_t entryLength = pFile->ReadUInt32(); + u_int32_t entryTag = pFile->ReadUInt32(); + + if (entryLength < 8) { + throw new MP4Error("bad packet extra info entry length", + "MP4RtpPacket::ReadExtra"); + } + + if (entryTag == STRTOINT32("rtpo") && entryLength == 12) { + // read the rtp timestamp offset + m_pProperties[16]->Read(pFile); + } else { + // ignore it, LATER carry it along + pFile->SetPosition(pFile->GetPosition() + entryLength - 8); + } + + extraLength -= entryLength; + } + + if (extraLength < 0) { + throw new MP4Error("invalid packet extra info length", + "MP4RtpPacket::ReadExtra"); + } +} + +void MP4RtpPacket::Set(u_int8_t payloadNumber, + u_int32_t packetId, bool setMbit) +{ + ((MP4BitfieldProperty*)m_pProperties[5])->SetValue(setMbit); + ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(payloadNumber); + ((MP4Integer16Property*)m_pProperties[7])->SetValue(packetId); +} + +int32_t MP4RtpPacket::GetTransmitOffset() +{ + return ((MP4Integer32Property*)m_pProperties[0])->GetValue(); +} + +void MP4RtpPacket::SetTransmitOffset(int32_t transmitOffset) +{ + ((MP4Integer32Property*)m_pProperties[0])->SetValue(transmitOffset); +} + +bool MP4RtpPacket::GetPBit() +{ + return ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); +} + +bool MP4RtpPacket::GetXBit() +{ + return ((MP4BitfieldProperty*)m_pProperties[3])->GetValue(); +} + +bool MP4RtpPacket::GetMBit() +{ + return ((MP4BitfieldProperty*)m_pProperties[5])->GetValue(); +} + +u_int8_t MP4RtpPacket::GetPayload() +{ + return ((MP4BitfieldProperty*)m_pProperties[6])->GetValue(); +} + +u_int16_t MP4RtpPacket::GetSequenceNumber() +{ + return ((MP4Integer16Property*)m_pProperties[7])->GetValue(); +} + +bool MP4RtpPacket::IsBFrame() +{ + return ((MP4BitfieldProperty*)m_pProperties[10])->GetValue(); +} + +void MP4RtpPacket::SetBFrame(bool isBFrame) +{ + ((MP4BitfieldProperty*)m_pProperties[10])->SetValue(isBFrame); +} + +void MP4RtpPacket::SetTimestampOffset(u_int32_t timestampOffset) +{ + if (timestampOffset == 0) { + return; + } + + ASSERT(((MP4BitfieldProperty*)m_pProperties[9])->GetValue() == 0); + + // set X bit + ((MP4BitfieldProperty*)m_pProperties[9])->SetValue(1); + + AddExtraProperties(); + + ((MP4Integer32Property*)m_pProperties[16])->SetValue(timestampOffset); +} + +void MP4RtpPacket::AddData(MP4RtpData* pData) +{ + m_rtpData.Add(pData); + + // increment entry count property + ((MP4Integer16Property*)m_pProperties[12])->IncrementValue(); +} + +u_int32_t MP4RtpPacket::GetDataSize() +{ + u_int32_t totalDataSize = 0; + + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + totalDataSize += m_rtpData[i]->GetDataSize(); + } + + return totalDataSize; +} + +void MP4RtpPacket::GetData(u_int8_t* pDest) +{ + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + m_rtpData[i]->GetData(pDest); + pDest += m_rtpData[i]->GetDataSize(); + } +} + +void MP4RtpPacket::Write(MP4File* pFile) +{ + MP4Container::Write(pFile); + + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + m_rtpData[i]->Write(pFile); + } +} + +void MP4RtpPacket::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) +{ + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + m_rtpData[i]->WriteEmbeddedData(pFile, startPos); + } +} + +void MP4RtpPacket::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) +{ + MP4Container::Dump(pFile, indent, dumpImplicits); + + for (u_int32_t i = 0; i < m_rtpData.Size(); i++) { + Indent(pFile, indent); + fprintf(pFile, "RtpData: %u\n", i); + m_rtpData[i]->Dump(pFile, indent + 1, dumpImplicits); + } +} + +MP4RtpData::MP4RtpData(MP4RtpPacket* pPacket) +{ + m_pPacket = pPacket; + + AddProperty( /* 0 */ + new MP4Integer8Property("type")); +} + +MP4Track* MP4RtpData::FindTrackFromRefIndex(u_int8_t refIndex) +{ + MP4Track* pTrack; + + if (refIndex == (u_int8_t)-1) { + // ourselves + pTrack = GetPacket()->GetHint()->GetTrack(); + } else if (refIndex == 0) { + // our reference track + pTrack = GetPacket()->GetHint()->GetTrack()->GetRefTrack(); + } else { + // some other track + MP4RtpHintTrack* pHintTrack = + GetPacket()->GetHint()->GetTrack(); + + MP4Atom* pTrakAtom = pHintTrack->GetTrakAtom(); + ASSERT(pTrakAtom); + + MP4Integer32Property* pTrackIdProperty = NULL; + pTrakAtom->FindProperty( + "trak.tref.hint.entries", + (MP4Property**)&pTrackIdProperty); + ASSERT(pTrackIdProperty); + + u_int32_t refTrackId = + pTrackIdProperty->GetValue(refIndex - 1); + + pTrack = pHintTrack->GetFile()->GetTrack(refTrackId); + } + + return pTrack; +} + +MP4RtpNullData::MP4RtpNullData(MP4RtpPacket* pPacket) + : MP4RtpData(pPacket) +{ + ((MP4Integer8Property*)m_pProperties[0])->SetValue(0); + + AddProperty( /* 1 */ + new MP4BytesProperty("pad", 15)); + + ((MP4BytesProperty*)m_pProperties[1])->SetFixedSize(15); +} + +MP4RtpImmediateData::MP4RtpImmediateData(MP4RtpPacket* pPacket) + : MP4RtpData(pPacket) +{ + ((MP4Integer8Property*)m_pProperties[0])->SetValue(1); + + AddProperty( /* 1 */ + new MP4Integer8Property("count")); + AddProperty( /* 2 */ + new MP4BytesProperty("data", 14)); + + ((MP4BytesProperty*)m_pProperties[2])->SetFixedSize(14); +} + +void MP4RtpImmediateData::Set(const u_int8_t* pBytes, u_int8_t numBytes) +{ + ((MP4Integer8Property*)m_pProperties[1])->SetValue(numBytes); + ((MP4BytesProperty*)m_pProperties[2])->SetValue(pBytes, numBytes); +} + +u_int16_t MP4RtpImmediateData::GetDataSize() +{ + return ((MP4Integer8Property*)m_pProperties[1])->GetValue(); +} + +void MP4RtpImmediateData::GetData(u_int8_t* pDest) +{ + u_int8_t* pValue; + u_int32_t valueSize; + ((MP4BytesProperty*)m_pProperties[2])->GetValue(&pValue, &valueSize); + + memcpy(pDest, pValue, GetDataSize()); + MP4Free(pValue); +} + +MP4RtpSampleData::MP4RtpSampleData(MP4RtpPacket* pPacket) + : MP4RtpData(pPacket) +{ + ((MP4Integer8Property*)m_pProperties[0])->SetValue(2); + + AddProperty( /* 1 */ + new MP4Integer8Property("trackRefIndex")); + AddProperty( /* 2 */ + new MP4Integer16Property("length")); + AddProperty( /* 3 */ + new MP4Integer32Property("sampleNumber")); + AddProperty( /* 4 */ + new MP4Integer32Property("sampleOffset")); + AddProperty( /* 5 */ + new MP4Integer16Property("bytesPerBlock")); + AddProperty( /* 6 */ + new MP4Integer16Property("samplesPerBlock")); + + ((MP4Integer16Property*)m_pProperties[5])->SetValue(1); + ((MP4Integer16Property*)m_pProperties[6])->SetValue(1); + + m_pRefData = NULL; + m_pRefTrack = NULL; + m_refSampleId = MP4_INVALID_SAMPLE_ID; + m_refSampleOffset = 0; +} + +void MP4RtpSampleData::SetEmbeddedImmediate(MP4SampleId sampleId, + u_int8_t* pData, u_int16_t dataLength) +{ + ((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1); + ((MP4Integer16Property*)m_pProperties[2])->SetValue(dataLength); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId); + ((MP4Integer32Property*)m_pProperties[4])->SetValue(0); + m_pRefData = pData; +} + +void MP4RtpSampleData::SetReferenceSample( + MP4SampleId refSampleId, u_int32_t refSampleOffset, + u_int16_t sampleLength) +{ + ((MP4Integer8Property*)m_pProperties[1])->SetValue(0); + ((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(refSampleId); + ((MP4Integer32Property*)m_pProperties[4])->SetValue(refSampleOffset); +} + +void MP4RtpSampleData::SetEmbeddedSample( + MP4SampleId sampleId, MP4Track* pRefTrack, + MP4SampleId refSampleId, u_int32_t refSampleOffset, + u_int16_t sampleLength) +{ + ((MP4Integer8Property*)m_pProperties[1])->SetValue((u_int8_t)-1); + ((MP4Integer16Property*)m_pProperties[2])->SetValue(sampleLength); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleId); + ((MP4Integer32Property*)m_pProperties[4])->SetValue(0); + m_pRefTrack = pRefTrack; + m_refSampleId = refSampleId; + m_refSampleOffset = refSampleOffset; +} + +u_int16_t MP4RtpSampleData::GetDataSize() +{ + return ((MP4Integer16Property*)m_pProperties[2])->GetValue(); +} + +void MP4RtpSampleData::GetData(u_int8_t* pDest) +{ + u_int8_t trackRefIndex = + ((MP4Integer8Property*)m_pProperties[1])->GetValue(); + + MP4Track* pSampleTrack = + FindTrackFromRefIndex(trackRefIndex); + + pSampleTrack->ReadSampleFragment( + ((MP4Integer32Property*)m_pProperties[3])->GetValue(), // sampleId + ((MP4Integer32Property*)m_pProperties[4])->GetValue(), // sampleOffset + ((MP4Integer16Property*)m_pProperties[2])->GetValue(), // sampleLength + pDest); +} + +void MP4RtpSampleData::WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) +{ + // if not using embedded data, nothing to do + if (((MP4Integer8Property*)m_pProperties[1])->GetValue() != (u_int8_t)-1) { + return; + } + + // figure out the offset within this hint sample for this embedded data + u_int64_t offset = pFile->GetPosition() - startPos; + ASSERT(offset <= 0xFFFFFFFF); + ((MP4Integer32Property*)m_pProperties[4])->SetValue((u_int32_t)offset); + + u_int16_t length = ((MP4Integer16Property*)m_pProperties[2])->GetValue(); + + if (m_pRefData) { + pFile->WriteBytes(m_pRefData, length); + return; + } + + if (m_refSampleId != MP4_INVALID_SAMPLE_ID) { + u_int8_t* pSample = NULL; + u_int32_t sampleSize = 0; + + ASSERT(m_pRefTrack); + m_pRefTrack->ReadSample(m_refSampleId, &pSample, &sampleSize); + + ASSERT(m_refSampleOffset + length <= sampleSize); + + pFile->WriteBytes(&pSample[m_refSampleOffset], length); + + MP4Free(pSample); + return; + } +} + +MP4RtpSampleDescriptionData::MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket) + : MP4RtpData(pPacket) +{ + ((MP4Integer8Property*)m_pProperties[0])->SetValue(3); + + AddProperty( /* 1 */ + new MP4Integer8Property("trackRefIndex")); + AddProperty( /* 2 */ + new MP4Integer16Property("length")); + AddProperty( /* 3 */ + new MP4Integer32Property("sampleDescriptionIndex")); + AddProperty( /* 4 */ + new MP4Integer32Property("sampleDescriptionOffset")); + AddProperty( /* 5 */ + new MP4Integer32Property("reserved")); +} + +void MP4RtpSampleDescriptionData::Set(u_int32_t sampleDescrIndex, + u_int32_t offset, u_int16_t length) +{ + ((MP4Integer16Property*)m_pProperties[2])->SetValue(length); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(sampleDescrIndex); + ((MP4Integer32Property*)m_pProperties[4])->SetValue(offset); +} + +u_int16_t MP4RtpSampleDescriptionData::GetDataSize() +{ + return ((MP4Integer16Property*)m_pProperties[2])->GetValue(); +} + +void MP4RtpSampleDescriptionData::GetData(u_int8_t* pDest) +{ + // we start with the index into our track references + u_int8_t trackRefIndex = + ((MP4Integer8Property*)m_pProperties[1])->GetValue(); + + // from which we can find the track structure + MP4Track* pSampleTrack = + FindTrackFromRefIndex(trackRefIndex); + + // next find the desired atom in the track's sample description table + u_int32_t sampleDescrIndex = + ((MP4Integer32Property*)m_pProperties[3])->GetValue(); + + MP4Atom* pTrakAtom = + pSampleTrack->GetTrakAtom(); + + char sdName[64]; + sprintf(sdName, "trak.mdia.minf.stbl.stsd.*[%u]", sampleDescrIndex); + + MP4Atom* pSdAtom = + pTrakAtom->FindAtom(sdName); + + // bad reference + if (pSdAtom == NULL) { + throw new MP4Error("invalid sample description index", + "MP4RtpSampleDescriptionData::GetData"); + } + + // check validity of the upcoming copy + u_int16_t length = + ((MP4Integer16Property*)m_pProperties[2])->GetValue(); + u_int32_t offset = + ((MP4Integer32Property*)m_pProperties[4])->GetValue(); + + if (offset + length > pSdAtom->GetSize()) { + throw new MP4Error("offset and/or length are too large", + "MP4RtpSampleDescriptionData::GetData"); + } + + // now we use the raw file to get the desired bytes + + MP4File* pFile = GetPacket()->GetHint()->GetTrack()->GetFile(); + + u_int64_t orgPos = pFile->GetPosition(); + + // It's not entirely clear from the spec whether the offset is from + // the start of the sample descirption atom, or the start of the atom's + // data. I believe it is the former, but the commented out code will + // realize the latter interpretation if I turn out to be wrong. + u_int64_t dataPos = pSdAtom->GetStart(); + //u_int64_t dataPos = pSdAtom->GetEnd() - pSdAtom->GetSize(); + + pFile->SetPosition(dataPos + offset); + + pFile->ReadBytes(pDest, length); + + pFile->SetPosition(orgPos); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tmin.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tmin.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TminAtom::MP4TminAtom() + : MP4Atom("tmin") +{ + AddProperty( // min relative xmit time + new MP4Integer32Property("milliSecs")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v2_st60.vcproj +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v2_st60.vcproj @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_frma.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_frma.cpp @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Alix Marchandise-Franquet alix@cisco.com + * + * Add the OriginalFormatBox for ISMACrypt + * contains the original format of the data (i.e. decrypted format) + */ + +#include "mp4common.h" + +MP4FrmaAtom::MP4FrmaAtom() + : MP4Atom("frma") +{ + AddProperty( /* 0 */ + new MP4Integer32Property("data-format")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stts.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stts.cpp @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4SttsAtom::MP4SttsAtom() + : MP4Atom("stts") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("sampleCount")); + pTable->AddProperty( + new MP4Integer32Property("sampleDelta")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4util.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4util.cpp @@ -0,0 +1,238 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +void MP4Error::Print(FILE* pFile) +{ + fprintf(pFile, "MP4ERROR: "); + if (m_where) { + fprintf(pFile, "%s", m_where); + } + if (m_errstring) { + if (m_where) { + fprintf(pFile, ": "); + } + fprintf(pFile, "%s", m_errstring); + } + if (m_errno) { + if (m_where || m_errstring) { + fprintf(pFile, ": "); + } + fprintf(pFile, "%s", strerror(m_errno)); + } + fprintf(pFile, "\n"); +} + +void MP4HexDump( + u_int8_t* pBytes, u_int32_t numBytes, + FILE* pFile, u_int8_t indent) +{ + if (pFile == NULL) { + pFile = stdout; + } + Indent(pFile, indent); + fprintf(pFile, "<%u bytes> ", numBytes); + for (u_int32_t i = 0; i < numBytes; i++) { + if ((i % 16) == 0 && numBytes > 16) { + fprintf(pFile, "\n"); + Indent(pFile, indent); + } + fprintf(pFile, "%02x ", pBytes[i]); + } + fprintf(pFile, "\n"); +} + +bool MP4NameFirstMatches(const char* s1, const char* s2) +{ + if (s1 == NULL || *s1 == '\0' || s2 == NULL || *s2 == '\0') { + return false; + } + + if (*s2 == '*') { + return true; + } + + while (*s1 != '\0') { + if (*s2 == '\0' || strchr("[.", *s2)) { + break; + } + if (tolower(*s1) != tolower(*s2)) { + return false; + } + s1++; + s2++; + } + return true; +} + +bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex) +{ + if (s == NULL) { + return false; + } + + while (*s != '\0' && *s != '.') { + if (*s == '[') { + s++; + ASSERT(pIndex); + if (sscanf(s, "%u", pIndex) != 1) { + return false; + } + return true; + } + s++; + } + return false; +} + +char* MP4NameFirst(const char *s) +{ + if (s == NULL) { + return NULL; + } + + const char* end = s; + + while (*end != '\0' && *end != '.') { + end++; + } + + char* first = (char*)MP4Calloc((end - s) + 1); + + if (first) { + strncpy(first, s, end - s); + } + + return first; +} + +const char* MP4NameAfterFirst(const char *s) +{ + if (s == NULL) { + return NULL; + } + + while (*s != '\0') { + if (*s == '.') { + s++; + if (*s == '\0') { + return NULL; + } + return s; + } + s++; + } + return NULL; +} + +char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize) +{ + if (dataSize) { + ASSERT(pData); + } + + char* s = (char*)MP4Calloc((2 * dataSize) + 1); + + u_int32_t i, j; + for (i = 0, j = 0; i < dataSize; i++) { + sprintf(&s[j], "%02x", pData[i]); + j += 2; + } + + return s; /* N.B. caller is responsible for free'ing s */ +} + +char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize) +{ + if (dataSize) { + ASSERT(pData); + } + + static char encoding[64] = { + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', + 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', + 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', + 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' + }; + + char* s = (char*)MP4Calloc((((dataSize + 2) * 4) / 3) + 1); + + const u_int8_t* src = pData; + char* dest = s; + u_int32_t numGroups = dataSize / 3; + + for (u_int32_t i = 0; i < numGroups; i++) { + *dest++ = encoding[src[0] >> 2]; + *dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)]; + *dest++ = encoding[((src[1] & 0x0F) << 2) | (src[2] >> 6)]; + *dest++ = encoding[src[2] & 0x3F]; + src += 3; + } + + if (dataSize % 3 == 1) { + *dest++ = encoding[src[0] >> 2]; + *dest++ = encoding[((src[0] & 0x03) << 4)]; + *dest++ = '='; + *dest++ = '='; + } else if (dataSize % 3 == 2) { + *dest++ = encoding[src[0] >> 2]; + *dest++ = encoding[((src[0] & 0x03) << 4) | (src[1] >> 4)]; + *dest++ = encoding[((src[1] & 0x0F) << 2)]; + *dest++ = '='; + } + + return s; /* N.B. caller is responsible for free'ing s */ +} + +// log2 of value, rounded up +static u_int8_t ilog2(u_int64_t value) +{ + u_int64_t powerOf2 = 1; + for (u_int8_t i = 0; i < 64; i++) { + if (value <= powerOf2) { + return i; + } + powerOf2 <<= 1; + } + return 64; +} + +u_int64_t MP4ConvertTime(u_int64_t t, + u_int32_t oldTimeScale, u_int32_t newTimeScale) +{ + // avoid float point exception + if (oldTimeScale == 0) { + throw new MP4Error("division by zero", "MP4ConvertTime"); + } + + // check if we can safely use integer operations + if (ilog2(t) + ilog2(newTimeScale) <= 64) { + return (t * newTimeScale) / oldTimeScale; + } + + // final resort is to use floating point + double d = ((double)newTimeScale / (double)oldTimeScale) + 0.5; + d *= UINT64_TO_DOUBLE(t); + + return (u_int64_t)d; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_maxr.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_maxr.cpp @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MaxrAtom::MP4MaxrAtom() + : MP4Atom("maxr") +{ + AddProperty( + new MP4Integer32Property("granularity")); + AddProperty( + new MP4Integer32Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4array.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4array.h @@ -0,0 +1,130 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_ARRAY_INCLUDED__ +#define __MP4_ARRAY_INCLUDED__ + +typedef u_int32_t MP4ArrayIndex; + +class MP4Array { +public: + MP4Array() { + m_numElements = 0; + m_maxNumElements = 0; + } + + inline bool ValidIndex(MP4ArrayIndex index) { + if (m_numElements == 0 || index > m_numElements - 1) { + return false; + } + return true; + } + + inline MP4ArrayIndex Size(void) { + return m_numElements; + } + + inline MP4ArrayIndex MaxSize(void) { + return m_maxNumElements; + } + +protected: + MP4ArrayIndex m_numElements; + MP4ArrayIndex m_maxNumElements; +}; + +// macro to generate subclasses +// we use this as an alternative to templates +// due to the excessive compile time price of extensive template usage + +#define MP4ARRAY_DECL(name, type) \ + class name##Array : public MP4Array { \ + public: \ + name##Array() { \ + m_elements = NULL; \ + } \ + \ + ~name##Array() { \ + MP4Free(m_elements); \ + } \ + \ + inline void Add(type newElement) { \ + Insert(newElement, m_numElements); \ + } \ + \ + void Insert(type newElement, MP4ArrayIndex newIndex) { \ + if (newIndex > m_numElements) { \ + throw new MP4Error(ERANGE, "MP4Array::Insert"); \ + } \ + if (m_numElements == m_maxNumElements) { \ + m_maxNumElements = MAX(m_maxNumElements, 1) * 2; \ + m_elements = (type*)MP4Realloc(m_elements, \ + m_maxNumElements * sizeof(type)); \ + } \ + memmove(&m_elements[newIndex + 1], &m_elements[newIndex], \ + (m_numElements - newIndex) * sizeof(type)); \ + m_elements[newIndex] = newElement; \ + m_numElements++; \ + } \ + \ + void Delete(MP4ArrayIndex index) { \ + if (!ValidIndex(index)) { \ + throw new MP4Error(ERANGE, "MP4Array::Delete"); \ + } \ + memmove(&m_elements[index], &m_elements[index + 1], \ + (m_numElements - index) * sizeof(type)); \ + m_numElements--; \ + } \ + void Resize(MP4ArrayIndex newSize) { \ + m_numElements = newSize; \ + m_maxNumElements = newSize; \ + m_elements = (type*)MP4Realloc(m_elements, \ + m_maxNumElements * sizeof(type)); \ + } \ + \ + type& operator[](MP4ArrayIndex index) { \ + if (!ValidIndex(index)) { \ + throw new MP4Error(ERANGE, "MP4Array::[]"); \ + } \ + return m_elements[index]; \ + } \ + \ + protected: \ + type* m_elements; \ + }; + +MP4ARRAY_DECL(MP4Integer8, u_int8_t) + +MP4ARRAY_DECL(MP4Integer16, u_int16_t) + +MP4ARRAY_DECL(MP4Integer32, u_int32_t) + +MP4ARRAY_DECL(MP4Integer64, u_int64_t) + +MP4ARRAY_DECL(MP4Float32, float) + +MP4ARRAY_DECL(MP4Float64, double) + +MP4ARRAY_DECL(MP4String, char*) + +MP4ARRAY_DECL(MP4Bytes, u_int8_t*) + +#endif /* __MP4_ARRAY_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_rtp.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_rtp.cpp @@ -0,0 +1,147 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4RtpAtom::MP4RtpAtom() + : MP4Atom("rtp ") +{ + // The atom type "rtp " is used in two complete unrelated ways + // i.e. it's real two atoms with the same name + // To handle that we need to postpone property creation until + // we know who our parent atom is (stsd or hnti) which gives us + // the context info we need to know who we are +} + +void MP4RtpAtom::AddPropertiesStsdType() +{ + AddReserved("reserved1", 6); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer16Property("dataReferenceIndex")); + + AddProperty( /* 2 */ + new MP4Integer16Property("hintTrackVersion")); + AddProperty( /* 3 */ + new MP4Integer16Property("highestCompatibleVersion")); + AddProperty( /* 4 */ + new MP4Integer32Property("maxPacketSize")); + + ExpectChildAtom("tims", Required, OnlyOne); + ExpectChildAtom("tsro", Optional, OnlyOne); + ExpectChildAtom("snro", Optional, OnlyOne); +} + +void MP4RtpAtom::AddPropertiesHntiType() +{ + MP4StringProperty* pProp = + new MP4StringProperty("descriptionFormat"); + pProp->SetFixedLength(4); + AddProperty(pProp); /* 0 */ + + AddProperty( /* 1 */ + new MP4StringProperty("sdpText")); +} + +void MP4RtpAtom::Generate() +{ + if (!strcmp(m_pParentAtom->GetType(), "stsd")) { + AddPropertiesStsdType(); + GenerateStsdType(); + } else if (!strcmp(m_pParentAtom->GetType(), "hnti")) { + AddPropertiesHntiType(); + GenerateHntiType(); + } else { + VERBOSE_WARNING(m_pFile->GetVerbosity(), + printf("Warning: rtp atom in unexpected context, can not generate")); + } +} + +void MP4RtpAtom::GenerateStsdType() +{ + // generate children + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); + ((MP4Integer16Property*)m_pProperties[2])->SetValue(1); + ((MP4Integer16Property*)m_pProperties[3])->SetValue(1); +} + +void MP4RtpAtom::GenerateHntiType() +{ + MP4Atom::Generate(); + + ((MP4StringProperty*)m_pProperties[0])->SetValue("sdp "); +} + +void MP4RtpAtom::Read() +{ + if (!strcmp(m_pParentAtom->GetType(), "stsd")) { + AddPropertiesStsdType(); + ReadStsdType(); + } else if (!strcmp(m_pParentAtom->GetType(), "hnti")) { + AddPropertiesHntiType(); + ReadHntiType(); + } else { + VERBOSE_READ(m_pFile->GetVerbosity(), + printf("rtp atom in unexpected context, can not read")); + } + + Skip(); // to end of atom +} + +void MP4RtpAtom::ReadStsdType() +{ + MP4Atom::Read(); +} + +void MP4RtpAtom::ReadHntiType() +{ + ReadProperties(0, 1); + + // read sdp string, length is implicit in size of atom + u_int64_t size = GetEnd() - m_pFile->GetPosition(); + char* data = (char*)MP4Malloc(size + 1); + m_pFile->ReadBytes((u_int8_t*)data, size); + data[size] = '\0'; + ((MP4StringProperty*)m_pProperties[1])->SetValue(data); + MP4Free(data); +} + +void MP4RtpAtom::Write() +{ + if (!strcmp(m_pParentAtom->GetType(), "hnti")) { + WriteHntiType(); + } else { + MP4Atom::Write(); + } +} + +void MP4RtpAtom::WriteHntiType() +{ + // since length of string is implicit in size of atom + // we need to handle this specially, and not write the terminating \0 + MP4StringProperty* pSdp = (MP4StringProperty*)m_pProperties[1]; + pSdp->SetFixedLength(strlen(pSdp->GetValue())); + MP4Atom::Write(); + pSdp->SetFixedLength(0); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_esds.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_esds.cpp @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4EsdsAtom::MP4EsdsAtom() + : MP4Atom("esds") +{ + AddVersionAndFlags(); + AddProperty( + new MP4DescriptorProperty(NULL, + MP4ESDescrTag, 0, Required, OnlyOne)); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_ftyp.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_ftyp.cpp @@ -0,0 +1,71 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4FtypAtom::MP4FtypAtom() + : MP4Atom("ftyp") +{ + MP4StringProperty* pProp = new MP4StringProperty("majorBrand"); + pProp->SetFixedLength(4); + AddProperty(pProp); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer32Property("minorVersion")); + + MP4Integer32Property* pCount = + new MP4Integer32Property("compatibleBrandsCount"); + pCount->SetImplicit(); + AddProperty(pCount); /* 2 */ + + MP4TableProperty* pTable = + new MP4TableProperty("compatibleBrands", pCount); + AddProperty(pTable); /* 3 */ + + pProp = new MP4StringProperty("brand"); + pProp->SetFixedLength(4); + pTable->AddProperty(pProp); +} + +void MP4FtypAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4StringProperty*)m_pProperties[0])->SetValue("mp42"); + + MP4StringProperty* pBrandProperty = (MP4StringProperty*) + ((MP4TableProperty*)m_pProperties[3])->GetProperty(0); + ASSERT(pBrandProperty); + pBrandProperty->AddValue("mp42"); + pBrandProperty->AddValue("isom"); + ((MP4Integer32Property*)m_pProperties[2])->IncrementValue(); + ((MP4Integer32Property*)m_pProperties[2])->IncrementValue(); +} + +void MP4FtypAtom::Read() +{ + // table entry count computed from atom size + ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false); + ((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 8) / 4); + ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true); + + MP4Atom::Read(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_dmed.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_dmed.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DmedAtom::MP4DmedAtom() + : MP4Atom("dmed") +{ + AddProperty( // bytes sent from media data + new MP4Integer64Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_smhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_smhd.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4SmhdAtom::MP4SmhdAtom() + : MP4Atom("smhd") +{ + AddVersionAndFlags(); + AddReserved("reserved", 4); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4file_io.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4file_io.cpp @@ -0,0 +1,655 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +#ifdef HAVE_FPOS_T_POS +#define FPOS_TO_UINT64(x) ((u_int64_t)((x).__pos)) +#define UINT64_TO_FPOS(x, y) ((x).__pos = (y)) +#else +#define FPOS_TO_UINT64(x) ((u_int64_t)(x)) +#define UINT64_TO_FPOS(x, y) ((x) = (fpos)(y)) +#endif + +// MP4File low level IO support + +u_int64_t MP4File::GetPosition(FILE* pFile) +{ + if (m_memoryBuffer == NULL) { +#ifndef USE_FILE_CALLBACKS + fpos_t fpos; + if (pFile == NULL) { + ASSERT(m_pFile); + pFile = m_pFile; + } + + if (fgetpos(pFile, &fpos) < 0) { + throw new MP4Error(errno, "MP4GetPosition"); + } + return FPOS_TO_UINT64(fpos); +#else + + u_int64_t pos; + if ((pos = m_MP4fgetpos(m_userData)) < 0) { + throw new MP4Error(errno, "MP4GetPosition"); + } + return (u_int64_t)pos; +#endif + } else { + return m_memoryBufferPosition; + } +} + +void MP4File::SetPosition(u_int64_t pos, FILE* pFile) +{ + if (m_memoryBuffer == NULL) { +#ifndef USE_FILE_CALLBACKS + if (pFile == NULL) { + ASSERT(m_pFile); + pFile = m_pFile; + } + + fpos_t fpos; + VAR_TO_FPOS(fpos, pos); + if (fsetpos(pFile, &fpos) < 0) { + throw new MP4Error(errno, "MP4SetPosition"); + } +#else + if (m_MP4fsetpos(pos, m_userData) < 0) { + throw new MP4Error(errno, "MP4SetPosition"); + } +#endif + } else { + if (pos >= m_memoryBufferSize) { + // abort(); + throw new MP4Error("position out of range", "MP4SetPosition"); + } + m_memoryBufferPosition = pos; + } +} + +u_int64_t MP4File::GetSize() +{ + if (m_mode == 'w') { + // we're always positioned at the end of file in write mode + // except for short intervals in ReadSample and FinishWrite routines + // so we rely on the faster approach of GetPosition() + // instead of flushing to disk, and then stat'ing the file + m_fileSize = GetPosition(); + } // else read mode, fileSize was determined at Open() + + return m_fileSize; +} + +u_int32_t MP4File::ReadBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) +{ + // handle degenerate cases + if (numBytes == 0) { + return 0; + } + + ASSERT(pBytes); + WARNING(m_numReadBits > 0); + +#ifndef USE_FILE_CALLBACKS + if (pFile == NULL) { + pFile = m_pFile; + } + ASSERT(pFile); +#endif + + if (m_memoryBuffer == NULL) { +#ifndef USE_FILE_CALLBACKS + if (fread(pBytes, 1, numBytes, pFile) != numBytes) { + if (feof(pFile)) { + throw new MP4Error( + "not enough bytes, reached end-of-file", + "MP4ReadBytes"); + } else { +#else + if (m_MP4fread(pBytes, numBytes, m_userData) != numBytes) { + { +#endif + throw new MP4Error(errno, "MP4ReadBytes"); + } + } + } else { + if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) { + throw new MP4Error( + "not enough bytes, reached end-of-memory", + "MP4ReadBytes"); + } + memcpy(pBytes, &m_memoryBuffer[m_memoryBufferPosition], numBytes); + m_memoryBufferPosition += numBytes; + } + return numBytes; +} + +u_int32_t MP4File::PeekBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) +{ + u_int64_t pos = GetPosition(pFile); + ReadBytes(pBytes, numBytes, pFile); + SetPosition(pos, pFile); + return numBytes; +} + +void MP4File::EnableMemoryBuffer(u_int8_t* pBytes, u_int64_t numBytes) +{ + ASSERT(m_memoryBuffer == NULL); + + if (pBytes) { + m_memoryBuffer = pBytes; + m_memoryBufferSize = numBytes; + } else { + if (numBytes) { + m_memoryBufferSize = numBytes; + } else { + m_memoryBufferSize = 4096; + } + m_memoryBuffer = (u_int8_t*)MP4Malloc(m_memoryBufferSize); + } + m_memoryBufferPosition = 0; +} + +void MP4File::DisableMemoryBuffer(u_int8_t** ppBytes, u_int64_t* pNumBytes) +{ + ASSERT(m_memoryBuffer != NULL); + + if (ppBytes) { + *ppBytes = m_memoryBuffer; + } + if (pNumBytes) { + *pNumBytes = m_memoryBufferPosition; + } + + m_memoryBuffer = NULL; + m_memoryBufferSize = 0; + m_memoryBufferPosition = 0; +} + +void MP4File::WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile) +{ + ASSERT(m_numWriteBits == 0 || m_numWriteBits >= 8); + + if (pBytes == NULL || numBytes == 0) { + return; + } + + if (m_memoryBuffer == NULL) { +#ifndef USE_FILE_CALLBACKS + if (pFile == NULL) { + ASSERT(m_pFile); + pFile = m_pFile; + } + + u_int32_t rc = fwrite(pBytes, 1, numBytes, pFile); +#else + u_int32_t rc = m_MP4fwrite(pBytes, numBytes, m_userData); +#endif + if (rc != numBytes) { + throw new MP4Error(errno, "MP4WriteBytes"); + } + } else { + if (m_memoryBufferPosition + numBytes > m_memoryBufferSize) { + m_memoryBufferSize = 2 * (m_memoryBufferSize + numBytes); + m_memoryBuffer = (u_int8_t*) + MP4Realloc(m_memoryBuffer, m_memoryBufferSize); + } + memcpy(&m_memoryBuffer[m_memoryBufferPosition], pBytes, numBytes); + m_memoryBufferPosition += numBytes; + } +} + +u_int64_t MP4File::ReadUInt(u_int8_t size) +{ + switch (size) { + case 1: + return ReadUInt8(); + case 2: + return ReadUInt16(); + case 3: + return ReadUInt24(); + case 4: + return ReadUInt32(); + case 8: + return ReadUInt64(); + default: + ASSERT(false); + return 0; + } +} + +void MP4File::WriteUInt(u_int64_t value, u_int8_t size) +{ + switch (size) { + case 1: + WriteUInt8(value); + case 2: + WriteUInt16(value); + case 3: + WriteUInt24(value); + case 4: + WriteUInt32(value); + case 8: + WriteUInt64(value); + default: + ASSERT(false); + } +} + +u_int8_t MP4File::ReadUInt8() +{ + u_int8_t data; + ReadBytes(&data, 1); + return data; +} + +void MP4File::WriteUInt8(u_int8_t value) +{ + WriteBytes(&value, 1); +} + +u_int16_t MP4File::ReadUInt16() +{ + u_int8_t data[2]; + ReadBytes(&data[0], 2); + return ((data[0] << 8) | data[1]); +} + +void MP4File::WriteUInt16(u_int16_t value) +{ + u_int8_t data[2]; + data[0] = (value >> 8) & 0xFF; + data[1] = value & 0xFF; + WriteBytes(data, 2); +} + +u_int32_t MP4File::ReadUInt24() +{ + u_int8_t data[3]; + ReadBytes(&data[0], 3); + return ((data[0] << 16) | (data[1] << 8) | data[2]); +} + +void MP4File::WriteUInt24(u_int32_t value) +{ + u_int8_t data[3]; + data[0] = (value >> 16) & 0xFF; + data[1] = (value >> 8) & 0xFF; + data[2] = value & 0xFF; + WriteBytes(data, 3); +} + +u_int32_t MP4File::ReadUInt32() +{ + u_int8_t data[4]; + ReadBytes(&data[0], 4); + return ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]); +} + +void MP4File::WriteUInt32(u_int32_t value) +{ + u_int8_t data[4]; + data[0] = (value >> 24) & 0xFF; + data[1] = (value >> 16) & 0xFF; + data[2] = (value >> 8) & 0xFF; + data[3] = value & 0xFF; + WriteBytes(data, 4); +} + +u_int64_t MP4File::ReadUInt64() +{ + u_int8_t data[8]; + u_int64_t result = 0; + u_int64_t temp; + + ReadBytes(&data[0], 8); + + for (int i = 0; i < 8; i++) { + temp = data[i]; + result |= temp << ((7 - i) * 8); + } + return result; +} + +void MP4File::WriteUInt64(u_int64_t value) +{ + u_int8_t data[8]; + + for (int i = 7; i >= 0; i--) { + data[i] = value & 0xFF; + value >>= 8; + } + WriteBytes(data, 8); +} + +float MP4File::ReadFixed16() +{ + u_int8_t iPart = ReadUInt8(); + u_int8_t fPart = ReadUInt8(); + + return iPart + (((float)fPart) / 0x100); +} + +void MP4File::WriteFixed16(float value) +{ + if (value >= 0x100) { + throw new MP4Error(ERANGE, "MP4WriteFixed16"); + } + + u_int8_t iPart = (u_int8_t)value; + u_int8_t fPart = (u_int8_t)((value - iPart) * 0x100); + + WriteUInt8(iPart); + WriteUInt8(fPart); +} + +float MP4File::ReadFixed32() +{ + u_int16_t iPart = ReadUInt16(); + u_int16_t fPart = ReadUInt16(); + + return iPart + (((float)fPart) / 0x10000); +} + +void MP4File::WriteFixed32(float value) +{ + if (value >= 0x10000) { + throw new MP4Error(ERANGE, "MP4WriteFixed32"); + } + + u_int16_t iPart = (u_int16_t)value; + u_int16_t fPart = (u_int16_t)((value - iPart) * 0x10000); + + WriteUInt16(iPart); + WriteUInt16(fPart); +} + +float MP4File::ReadFloat() +{ + union { + float f; + u_int32_t i; + } u; + + u.i = ReadUInt32(); + return u.f; +} + +void MP4File::WriteFloat(float value) +{ + union { + float f; + u_int32_t i; + } u; + + u.f = value; + WriteUInt32(u.i); +} + +char* MP4File::ReadString() +{ + u_int32_t length = 0; + u_int32_t alloced = 64; + char* data = (char*)MP4Malloc(alloced); + + do { + if (length == alloced) { + data = (char*)MP4Realloc(data, alloced * 2); + } + ReadBytes((u_int8_t*)&data[length], 1); + length++; + } while (data[length - 1] != 0); + + data = (char*)MP4Realloc(data, length); + return data; +} + +void MP4File::WriteString(char* string) +{ + if (string == NULL) { + static u_int8_t zero = 0; + WriteBytes(&zero, 1); + } else { + WriteBytes((u_int8_t*)string, strlen(string) + 1); + } +} + +char* MP4File::ReadCountedString(u_int8_t charSize, bool allowExpandedCount) +{ + u_int32_t charLength; + if (allowExpandedCount) { + u_int8_t b; + charLength = 0; + do { + b = ReadUInt8(); + charLength += b; + } while (b == 255); + } else { + charLength = ReadUInt8(); + } + + u_int32_t byteLength = charLength * charSize; + char* data = (char*)MP4Malloc(byteLength + 1); + if (byteLength > 0) { + ReadBytes((u_int8_t*)data, byteLength); + } + data[byteLength] = '\0'; + return data; +} + +void MP4File::WriteCountedString(char* string, + u_int8_t charSize, bool allowExpandedCount) +{ + u_int32_t byteLength; + if (string) { + byteLength = strlen(string); + } else { + byteLength = 0; + } + u_int32_t charLength = byteLength / charSize; + + if (allowExpandedCount) { + while (charLength >= 0xFF) { + WriteUInt8(0xFF); + charLength -= 0xFF; + } + WriteUInt8(charLength); + } else { + if (charLength > 255) { + throw new MP4Error(ERANGE, "Length is %d", "MP4WriteCountedString", charLength); + } + WriteUInt8(charLength); + } + + if (byteLength > 0) { + WriteBytes((u_int8_t*)string, byteLength); + } +} + +u_int64_t MP4File::ReadBits(u_int8_t numBits) +{ + ASSERT(numBits > 0); + ASSERT(numBits <= 64); + + u_int64_t bits = 0; + + for (u_int8_t i = numBits; i > 0; i--) { + if (m_numReadBits == 0) { + ReadBytes(&m_bufReadBits, 1); + m_numReadBits = 8; + } + bits = (bits << 1) | ((m_bufReadBits >> (--m_numReadBits)) & 1); + } + + return bits; +} + +void MP4File::FlushReadBits() +{ + // eat any remaining bits in the read buffer + m_numReadBits = 0; +} + +void MP4File::WriteBits(u_int64_t bits, u_int8_t numBits) +{ + ASSERT(numBits <= 64); + + for (u_int8_t i = numBits; i > 0; i--) { + m_bufWriteBits |= + (((bits >> (i - 1)) & 1) << (8 - ++m_numWriteBits)); + + if (m_numWriteBits == 8) { + FlushWriteBits(); + } + } +} + +void MP4File::PadWriteBits(u_int8_t pad) +{ + if (m_numWriteBits) { + WriteBits(pad ? 0xFF : 0x00, 8 - m_numWriteBits); + } +} + +void MP4File::FlushWriteBits() +{ + if (m_numWriteBits > 0) { + WriteBytes(&m_bufWriteBits, 1); + m_numWriteBits = 0; + m_bufWriteBits = 0; + } +} + +u_int32_t MP4File::ReadMpegLength() +{ + u_int32_t length = 0; + u_int8_t numBytes = 0; + u_int8_t b; + + do { + b = ReadUInt8(); + length = (length << 7) | (b & 0x7F); + numBytes++; + } while ((b & 0x80) && numBytes < 4); + + return length; +} + +void MP4File::WriteMpegLength(u_int32_t value, bool compact) +{ + if (value > 0x0FFFFFFF) { + throw new MP4Error(ERANGE, "MP4WriteMpegLength"); + } + + int8_t numBytes; + + if (compact) { + if (value <= 0x7F) { + numBytes = 1; + } else if (value <= 0x3FFF) { + numBytes = 2; + } else if (value <= 0x1FFFFF) { + numBytes = 3; + } else { + numBytes = 4; + } + } else { + numBytes = 4; + } + + int8_t i = numBytes; + do { + i--; + u_int8_t b = (value >> (i * 7)) & 0x7F; + if (i > 0) { + b |= 0x80; + } + WriteUInt8(b); + } while (i > 0); +} + +#ifdef USE_FILE_CALLBACKS +u_int32_t MP4File::MP4fopen_cb(const char *pName, + const char *mode, void *userData) +{ + MP4File *myFile = (MP4File*)userData; + + myFile->m_pFile = fopen(pName, mode); + if (myFile->m_pFile == NULL) + return 0; + + return 1; +} + +void MP4File::MP4fclose_cb(void *userData) +{ + MP4File *myFile = (MP4File*)userData; + + fclose(myFile->m_pFile); + myFile->m_pFile = NULL; +} + +u_int32_t MP4File::MP4fread_cb(void *pBuffer, unsigned int nBytesToRead, + void *userData) +{ + MP4File *myFile = (MP4File*)userData; + + return fread(pBuffer, 1, nBytesToRead, myFile->m_pFile); +} + +u_int32_t MP4File::MP4fwrite_cb(void *pBuffer, unsigned int nBytesToWrite, + void *userData) +{ + MP4File *myFile = (MP4File*)userData; + + return fwrite(pBuffer, 1, nBytesToWrite, myFile->m_pFile); +} + +int64_t MP4File::MP4fgetpos_cb(void *userData) +{ + fpos_t fpos; + MP4File *myFile = (MP4File*)userData; + + if (fgetpos(myFile->m_pFile, &fpos) < 0) + return -1; + return FPOS_TO_UINT64(fpos); +} + +int32_t MP4File::MP4fsetpos_cb(u_int32_t pos, void *userData) +{ + fpos_t fpos; + MP4File *myFile = (MP4File*)userData; + + VAR_TO_FPOS(fpos, pos); + return fsetpos(myFile->m_pFile, &fpos); +} + +int64_t MP4File::MP4filesize_cb(void *userData) +{ + struct stat s; + MP4File *myFile = (MP4File*)userData; + + if (fstat(fileno(myFile->m_pFile), &s) < 0) + return -1; + return s.st_size; +} +#endif --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/Makefile.in +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/Makefile.in @@ -0,0 +1,812 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +SOURCES = $(libmp4v2_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = common/mp4v2 +DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in COPYING TODO +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libmp4v2_la_LIBADD = +am_libmp4v2_la_OBJECTS = atom_co64.lo atom_cprt.lo atom_ctts.lo \ + atom_dimm.lo atom_dinf.lo atom_dmax.lo atom_dmed.lo \ + atom_dref.lo atom_drep.lo atom_edts.lo atom_elst.lo \ + atom_enca.lo atom_encv.lo atom_esds.lo atom_free.lo \ + atom_frma.lo atom_ftyp.lo atom_hdlr.lo atom_hinf.lo \ + atom_hmhd.lo atom_hnti.lo atom_iKMS.lo atom_iSFM.lo \ + atom_iods.lo atom_maxr.lo atom_mdat.lo atom_mdhd.lo \ + atom_mdia.lo atom_meta.lo atom_mfhd.lo atom_minf.lo \ + atom_moof.lo atom_moov.lo atom_mp4a.lo atom_mp4s.lo \ + atom_mp4v.lo atom_mvex.lo atom_mvhd.lo atom_nmhd.lo \ + atom_nump.lo atom_payt.lo atom_pmax.lo atom_root.lo \ + atom_rtp.lo atom_schi.lo atom_schm.lo atom_sdp.lo atom_sinf.lo \ + atom_smhd.lo atom_snro.lo atom_stbl.lo atom_stco.lo \ + atom_stdp.lo atom_stsc.lo atom_stsd.lo atom_stsh.lo \ + atom_stss.lo atom_stsz.lo atom_stts.lo atom_tfhd.lo \ + atom_tims.lo atom_tkhd.lo atom_tmax.lo atom_tmin.lo \ + atom_tpyl.lo atom_traf.lo atom_trak.lo atom_tref.lo \ + atom_treftype.lo atom_trex.lo atom_trpy.lo atom_trun.lo \ + atom_tsro.lo atom_udta.lo atom_url.lo atom_urn.lo atom_vmhd.lo \ + descriptors.lo isma.lo mp4atom.lo mp4container.lo mp4.lo \ + mp4descriptor.lo mp4file.lo mp4file_io.lo mp4info.lo \ + mp4meta.lo mp4property.lo mp4track.lo mp4util.lo \ + ocidescriptors.lo odcommands.lo qosqualifiers.lo rtphint.lo +libmp4v2_la_OBJECTS = $(am_libmp4v2_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/atom_co64.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_cprt.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_ctts.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_dimm.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_dinf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_dmax.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_dmed.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_dref.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_drep.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_edts.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_elst.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_enca.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_encv.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_esds.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_free.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_frma.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_ftyp.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_hdlr.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_hinf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_hmhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_hnti.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_iKMS.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_iSFM.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_iods.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_maxr.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mdat.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mdhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mdia.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_meta.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mfhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_minf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_moof.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_moov.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mp4a.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mp4s.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mp4v.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mvex.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_mvhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_nmhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_nump.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_payt.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_pmax.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_root.Plo ./$(DEPDIR)/atom_rtp.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_schi.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_schm.Plo ./$(DEPDIR)/atom_sdp.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_sinf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_smhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_snro.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stbl.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stco.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stdp.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stsc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stsd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stsh.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stss.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stsz.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_stts.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tfhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tims.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tkhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tmax.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tmin.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tpyl.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_traf.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_trak.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tref.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_treftype.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_trex.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_trpy.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_trun.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_tsro.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_udta.Plo ./$(DEPDIR)/atom_url.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/atom_urn.Plo ./$(DEPDIR)/atom_vmhd.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/descriptors.Plo ./$(DEPDIR)/isma.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4.Plo ./$(DEPDIR)/mp4atom.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4container.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4descriptor.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4file.Plo ./$(DEPDIR)/mp4file_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4info.Plo ./$(DEPDIR)/mp4meta.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4property.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mp4track.Plo ./$(DEPDIR)/mp4util.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/ocidescriptors.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/odcommands.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/qosqualifiers.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/rtphint.Plo +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libmp4v2_la_SOURCES) +DIST_SOURCES = $(libmp4v2_la_SOURCES) +includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BMP_CFLAGS = @BMP_CFLAGS@ +BMP_LIBS = @BMP_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GTK_CONFIG = @GTK_CONFIG@ +HAVE_BMP_FALSE = @HAVE_BMP_FALSE@ +HAVE_BMP_TRUE = @HAVE_BMP_TRUE@ +HAVE_MPEG4IP_PLUG_FALSE = @HAVE_MPEG4IP_PLUG_FALSE@ +HAVE_MPEG4IP_PLUG_TRUE = @HAVE_MPEG4IP_PLUG_TRUE@ +HAVE_XMMS_FALSE = @HAVE_XMMS_FALSE@ +HAVE_XMMS_TRUE = @HAVE_XMMS_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MP4FF_LIBS = @MP4FF_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +RPMBUILD = @RPMBUILD@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WITH_MP4V2_FALSE = @WITH_MP4V2_FALSE@ +WITH_MP4V2_TRUE = @WITH_MP4V2_TRUE@ +XMMS_CONFIG = @XMMS_CONFIG@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +INCLUDES = -I$(top_srcdir)/include +AM_CXXFLAGS = -Wall +lib_LTLIBRARIES = libmp4v2.la +include_HEADERS = mp4.h mpeg4ip.h systems.h +libmp4v2_la_SOURCES = \ + atom_co64.cpp \ + atom_cprt.cpp \ + atom_ctts.cpp \ + atom_dimm.cpp \ + atom_dinf.cpp \ + atom_dmax.cpp \ + atom_dmed.cpp \ + atom_dref.cpp \ + atom_drep.cpp \ + atom_edts.cpp \ + atom_elst.cpp \ + atom_enca.cpp \ + atom_encv.cpp \ + atom_esds.cpp \ + atom_free.cpp \ + atom_frma.cpp \ + atom_ftyp.cpp \ + atom_hdlr.cpp \ + atom_hinf.cpp \ + atom_hmhd.cpp \ + atom_hnti.cpp \ + atom_iKMS.cpp \ + atom_iSFM.cpp \ + atom_iods.cpp \ + atom_maxr.cpp \ + atom_mdat.cpp \ + atom_mdhd.cpp \ + atom_mdia.cpp \ + atom_meta.cpp \ + atom_mfhd.cpp \ + atom_minf.cpp \ + atom_moof.cpp \ + atom_moov.cpp \ + atom_mp4a.cpp \ + atom_mp4s.cpp \ + atom_mp4v.cpp \ + atom_mvex.cpp \ + atom_mvhd.cpp \ + atom_nmhd.cpp \ + atom_nump.cpp \ + atom_payt.cpp \ + atom_pmax.cpp \ + atom_root.cpp \ + atom_rtp.cpp \ + atom_schi.cpp \ + atom_schm.cpp \ + atom_sdp.cpp \ + atom_sinf.cpp \ + atoms.h \ + atom_smhd.cpp \ + atom_snro.cpp \ + atom_stbl.cpp \ + atom_stco.cpp \ + atom_stdp.cpp \ + atom_stsc.cpp \ + atom_stsd.cpp \ + atom_stsh.cpp \ + atom_stss.cpp \ + atom_stsz.cpp \ + atom_stts.cpp \ + atom_tfhd.cpp \ + atom_tims.cpp \ + atom_tkhd.cpp \ + atom_tmax.cpp \ + atom_tmin.cpp \ + atom_tpyl.cpp \ + atom_traf.cpp \ + atom_trak.cpp \ + atom_tref.cpp \ + atom_treftype.cpp \ + atom_trex.cpp \ + atom_trpy.cpp \ + atom_trun.cpp \ + atom_tsro.cpp \ + atom_udta.cpp \ + atom_url.cpp \ + atom_urn.cpp \ + atom_vmhd.cpp \ + descriptors.cpp \ + descriptors.h \ + isma.cpp \ + mp4array.h \ + mp4atom.cpp \ + mp4atom.h \ + mp4common.h \ + mp4container.cpp \ + mp4container.h \ + mp4.h \ + mp4.cpp \ + mp4descriptor.cpp \ + mp4descriptor.h \ + mp4file.cpp \ + mp4file.h \ + mp4file_io.cpp \ + mp4info.cpp \ + mp4meta.cpp \ + mp4property.cpp \ + mp4property.h \ + mp4track.cpp \ + mp4track.h \ + mp4util.cpp \ + mp4util.h \ + ocidescriptors.cpp \ + ocidescriptors.h \ + odcommands.cpp \ + odcommands.h \ + qosqualifiers.cpp \ + qosqualifiers.h \ + rtphint.cpp \ + rtphint.h + +EXTRA_DIST = API_CHANGES \ + INTERNALS \ + libmp4v260.dsp \ + libmp4v2_st60.dsp \ + TODO + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu common/mp4v2/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu common/mp4v2/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libmp4v2.la: $(libmp4v2_la_OBJECTS) $(libmp4v2_la_DEPENDENCIES) + $(CXXLINK) -rpath $(libdir) $(libmp4v2_la_LDFLAGS) $(libmp4v2_la_OBJECTS) $(libmp4v2_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_co64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_cprt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ctts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dimm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dinf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dmax.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dmed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dref.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_drep.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_edts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_elst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_enca.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_encv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_esds.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_free.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_frma.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ftyp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hdlr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hinf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hmhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hnti.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_iKMS.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_iSFM.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_iods.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_maxr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mdia.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_meta.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mfhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_minf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_moof.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_moov.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4a.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4s.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4v.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mvex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mvhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_nmhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_nump.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_payt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_pmax.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_root.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_rtp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_schi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_schm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sdp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_sinf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_smhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_snro.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stbl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stco.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stdp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsh.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stss.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsz.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tfhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tims.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tkhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tmax.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tmin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tpyl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_traf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trak.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tref.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_treftype.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trex.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trpy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_trun.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tsro.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_udta.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_url.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_urn.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_vmhd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/descriptors.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isma.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4atom.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4container.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4descriptor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4file_io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4meta.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4property.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4track.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp4util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocidescriptors.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odcommands.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qosqualifiers.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtphint.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-includeHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/INTERNALS +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/INTERNALS @@ -0,0 +1,209 @@ +January 7, 2002 + +MP4V2 LIBRARY INTERNALS +======================= + +This document provides an overview of the interals of the mp4v2 library +to aid those who wish to modify and extend it. Before reading this document, +I recommend familiarizing yourself with the MP4 (or Quicktime) file format +standard and the mp4v2 library API. The API is described in a set of man pages +in mpeg4ip/doc/mp4v2, or if you prefer by looking at mp4.h. + +All the library code is written in C++, however the library API follows uses +C calling conventions hence is linkable by both C and C++ programs. The +library has been compiled and used on Linux, BSD, Windows, and Mac OS X. +Other than libc, the library has no external dependencies, and hence can +be used independently of the mpeg4ip package if desired. The library is +used for both real-time recording and playback in mpeg4ip, and its runtime +performance is up to those tasks. On the IA32 architecture compiled with gcc, +the stripped library is approximately 600 KB code and initialized data. + +It is useful to think of the mp4v2 library as consisting of four layers: +infrastructure, file format, generic tracks, and type specific track helpers. +A description of each layer follows, from the fundamental to the optional. + + +Infrastructure +============== + +The infrastructure layer provides basic file I/O, memory allocation, +error handling, string utilities, and protected arrays. The source files +for this layer are mp4file_io, mp4util, and mp4array. + +Note that the array classes uses preprocessor macros instead of C++ +templates. The rationale for this is to increase portability given the +sometimes incomplete support by some compilers for templates. + + +File Format +=========== + +The file format layer provides the translation from the on-disk MP4 file +format to in-memory C++ structures and back to disk. It is intended +to exactly match the MP4 specification in syntax and semantics. It +represents the majority of the code. + +There are three key structures at the file format layer: atoms, properties, +and descriptors. + +Atoms are the primary containers within an mp4 file. They can contain +any combination of properties, other atoms, or descriptors. + +The mp4atom files contain the base class for all the atoms, and provide +generic functions that cover most cases. However, each atom has it's own +subclass contained in file atom_.cpp, where is the four +letter name of the atom defined in the MP4 specification. Typically this +atom file just specifies the properties of the atom or the possible child +atoms in the case of a container atom. In more specialized cases the atom +specific file provides routines to initialize, read, or write the atom. + +Properties are the atomic pieces of information. The basic types of +properties are integers, floats, strings, and byte arrays. For integers +and floats there are subclasses that represent the different storage sizes, +e.g. 8, 16, 24, 32, and 64 bit integers. For strings, there is 1 property +class with a number of options regarding exact storage details, e.g. null +terminated, fixed length, counted. + +For implementation reasons, there are also two special properties, table +and descriptor, that are actually containers for groups of properties. +I.e by making these containers provide a property interface much code can +be written in a generic fashion. + +The mp4property files contain all the property related classes. + +Descriptors are containers that derive from the MPEG conventions and use +different encoding rules than the atoms derived from the QuickTime file +format. This means more use of bitfields and conditional existence with +an emphasis on bit efficiency at the cost of encoding/decoding complexity. +Descriptors can contain other descriptors and/or properties. + +The mp4descriptor files contain the generic base class for descriptors. +Also the mp4property files have a descriptor wrapper class that allows a +descriptor to behave as if it were a property. The specific descriptors +are implemented as subclasses of the base class descriptor in manner similar +to that of atoms. The descriptors, ocidescriptors, and qosqualifiers files +contain these implementations. + +Each atom/property/descriptor has a name closely related to that in the +MP4 specification. The difference being that the mp4v2 library doesn't +use '-' or '_' in property names and capitalizes the first letter of each +word, e.g. "thisIsAPropertyName". A complete name specifies the complete +container path. The names follow the C/C++ syntax for elements and array +indices. + +Examples are: + "moov.mvhd.duration" + "moov.trak[2].tkhd.duration" + "moov.trak[3].minf.mdia.stbl.stsz[101].sampleSize" + +Note "*" can be used as a wildcard for an atom name (only). This is most +useful when dealing with the stsd atom which contains child atoms with +various names, but shared property names. + +Note that internally when performance matters the code looks up a property +by name once, and then stores the returned pointer to the property class. + + +Generic Tracks +============== + +The two entities at this level are the mp4 file as a whole and the tracks +which are contained with it. The mp4file and mp4track files contain the +implementation. + +The critical work done by this layer is to map the collection of atoms, +properties, and descriptors that represent a media track into a useful, +and consistent set of operations. For example, reading or writing a media +sample of a track is a relatively simple operation from the library API +perspective. However there are numerous pieces of information in the mp4 +file that need to be properly used and updated to do this. This layer +handles all those details. + +Given familiarity with the mp4 spec, the code should be straight-forward. +What may not be immediately obvious are the functions to handle chunks of +media samples. These exist to allow optimization of the mp4 file layout by +reordering the chunks on disk to interleave the media sample chunks of +multiple tracks in time order. (See MP4Optimize API doc). + + +Type Specific Track Helpers +=========================== + +This specialized code goes beyond the meta-information about tracks in +the mp4 file to understanding and manipulating the information in the +track samples. There are currently two helpers in the library: +the MPEG-4 Systems Helper, and the RTP Hint Track Helper. + +The MPEG-4 Systems Helper is currently limited to creating the OD, BIFS, +and SDP information about a minimal audio/video scene consistent with +the Internet Streaming Media Alliance (ISMA) specifications. We will be +evaluating how best to generalize the library's helper functions for +MPEG-4 Systems without overburdening the implementation. The code for +this helper is found in the isma and odcommands files. + +The RTP Hint Track Helper is more extensive in its support. The hint +tracks contain the track packetization information needed to build +RTP packets for streaming. The library can construct RTP packets based +on the hint track making RTP based servers significantly easier to write. + +All code related to rtp hint tracks is in the rtphint files. It would also +be useful to look at test/mp4broadcaster and mpeg4ip/server/mp4creator for +examples of how this part of the library API can be used. + + +Library API +=========== + +The library API is defined and implemented in the mp4 files. The API uses +C linkage conventions, and the mp4.h file adapts itself according to whether +C or C++ is the compilation mode. + +All API calls are implemented in mp4.cpp and basically pass thru's to the +MP4File member functions. This ensures that the library has internal access +to the same functions as available via the API. All the calls in mp4.cpp use +C++ try/catch blocks to protect against any runtime errors in the library. +Upon error the library will print a diagnostic message if the verbostiy level +has MP4_DETAILS_ERROR set, and return a distinguished error value, typically +0 or -1. + +The test and util subdirectories contain useful examples of how to +use the library. Also the mp4creator and mp4live programs within +mpeg4ip demonstrate more complete usage of the library API. + + +Debugging +========= + +Since mp4 files are fairly complicated, extensive debugging support is +built into the library. Multi-level diagnostic messages are available +under the control of a verbosity bitmask described in the API. + +Also the library provides the MP4Dump() call which provides an ASCII +version of the mp4 file meta-information. The mp4dump utilitity is a +wrapper executable around this function. + +The mp4extract program is also provided in the utilities directory +which is useful for extracting a track from an mp4file and putting the +media data back into it's own file. It can also extract each sample of +a track into its own file it that is desired. + +When all else fails, mp4 files are amenable to debugging by direct +examination. Since the atom names are four letter ASCII codes finding +reference points in a hex dump is feasible. On UNIX, the od command +is your friend: "od -t x1z -A x [-j 0xXXXXXX] foo.mp4" will print +a hex and ASCII dump, with hex addresses, starting optionally from +a specified offset. The library diagnostic messages can provide +information on where the library is reading or writing. + + +General caveats +=============== + +The coding convention is to use the C++ throw operator whenever an +unrecoverable error occurs. This throw is caught at the API layer +in mp4.cpp and translated into an error value. + +Be careful about indices. Internally, we follow the C/C++ convention +to use zero-based indices. However the MP4 spec uses one-based indices +for things like samples and hence the library API uses this convention. + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/API_CHANGES +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/API_CHANGES @@ -0,0 +1,85 @@ +Changes from 0.9.4 to 0.9.5 +--------------------------- +Added + MP4GetTrackAudioMpeg4Type() + Returns MPEG-4 Audio type (e.g. AAC, CELP, HXVC, MIDI, etc.) + MP4ReadSampleFromTime() + Variant of MP4ReadSample() that uses time instead of sample id + (basically MP4GetSampleIdFromTime() + MP4ReadSample()) + MP4Info() + MP4FileInfo() + Returns summary info on tracks in file (from util/mp4info.cpp) + + The following functions add support for mp4 authoring/editting: + + MP4CloneTrack() + Make a copy of a specified track, without media samples + MP4CopyTrack() + Make a copy of a specified track, with or without media samples + MP4CopySample() + Make a copy of a specified media sample + + MP4AddTrackEdit() + Add a track edit list element + MP4DeleteTrackEdit() + Delete a track edit list element + MP4GetTrackNumberOfEdits() + Return the number of track edit list elements + MP4GetTrackEditTotalDuration() + Return the total duration of the track edit list + MP4GetTrackEditStart() + Return the edit start time for the edit list element + MP4GetTrackEditMediaStart() + Return the media start time for the edit list element + MP4SetTrackEditMediaStart() + Set the media start time for the edit list element + MP4GetTrackEditDuration() + Return the edit list element duration + MP4SetTrackEditDuration() + Set the edit list element duration + MP4GetTrackEditDwell() + Return the edit list element dwell parameter, see man page + MP4SetTrackEditDwell() + Set the edit list element dwell parameter, see man page + MP4ReadSampleFromEditTime() + Apply the edit list timeline to reading a sample + MP4GetSampleIdFromEditTime() + Return the sample id for a specified time on the edit list timeline + +Modified + MP4GetSampleIdFromTime() + Semantic change - now returns sample id corresponding + to specified time, not the sample id with the smallest positive + start time difference from the specified time. + + +Changes from 0.9.3 to 0.9.4 +--------------------------- +Added + MP4GetTrackVideoFrameRate() + Returns video frame rate (average rate if video is variable rate). + + MP4GetTrackBitRate() + Returns track average bit rate in bits-per-second. + +Changes from 0.9.2 to 0.9.3 +--------------------------- +Modified + MP4Optimize() + Second argument, newFileName, can now be NULL in which case + a temporary file is created for the results of the optimization. + Upon success, the existing file specified with the first argument + is overwritten with the optimized file. + + MP4GetNumberOfTracks() + MP4FindTrackId() + Both have a new optional argument, subType, with default value 0. + The subType can be specified for audio and video tracks to + match only a specific encoding type. See man page for more details. + +Added + MP4GetTrackVideoWidth() + Returns video width in pixels. See man page for caveat. + + MP4GetTrackVideoHeight() + Returns video height in pixels. See man page for caveat. --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/odcommands.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/odcommands.h @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __ODCOMMANDS_INCLUDED__ +#define __ODCOMMANDS_INCLUDED__ + +// OD stream command descriptors +const u_int8_t MP4ODUpdateODCommandTag = 0x01; +const u_int8_t MP4ODRemoveODCommandTag = 0x02; +const u_int8_t MP4ESUpdateODCommandTag = 0x03; +const u_int8_t MP4ESRemoveODCommandTag = 0x04; +const u_int8_t MP4IPMPUpdateODCommandTag = 0x05; +const u_int8_t MP4IPMPRemoveODCommandTag = 0x06; +const u_int8_t MP4ESRemoveRefODCommandTag = 0x07; + +class MP4ODUpdateDescriptor : public MP4Descriptor { +public: + MP4ODUpdateDescriptor(); +}; + +class MP4ODRemoveDescriptor : public MP4Descriptor { +public: + MP4ODRemoveDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4ESUpdateDescriptor : public MP4Descriptor { +public: + MP4ESUpdateDescriptor(); +}; + +class MP4ESRemoveDescriptor : public MP4Descriptor { +public: + MP4ESRemoveDescriptor(); +}; + +MP4Descriptor* CreateODCommand(u_int8_t tag); + +#endif /* __ODCOMMANDS_INCLUDED__ */ + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mp4a.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mp4a.cpp @@ -0,0 +1,59 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Mp4aAtom::MP4Mp4aAtom() + : MP4Atom("mp4a") +{ + AddReserved("reserved1", 6); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer16Property("dataReferenceIndex")); + + AddReserved("reserved2", 16); /* 2 */ + + AddProperty( /* 3 */ + new MP4Integer16Property("timeScale")); + + AddReserved("reserved3", 2); /* 4 */ + + ExpectChildAtom("esds", Required, OnlyOne); +} + +void MP4Mp4aAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); + + // property reserved2 has non-zero fixed values + static u_int8_t reserved2[16] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, + }; + m_pProperties[2]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[2])-> + SetValue(reserved2, sizeof(reserved2)); + m_pProperties[2]->SetReadOnly(true); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v2_cb.dsp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v2_cb.dsp @@ -0,0 +1,556 @@ +# Microsoft Developer Studio Project File - Name="libmp4v2_cb" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libmp4v2_cb - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libmp4v2_cb.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libmp4v2_cb.mak" CFG="libmp4v2_cb - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libmp4v2_cb - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libmp4v2_cb - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "libmp4v2_cb - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "CB_Release" +# PROP Intermediate_Dir "CB_Release" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O1 /I ".\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_FILE_CALLBACKS" /YX /FD /c +# ADD BASE RSC /l 0x413 /d "NDEBUG" +# ADD RSC /l 0x413 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libmp4v2_cb - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "CB_Debug" +# PROP Intermediate_Dir "CB_Debug" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_FILE_CALLBACKS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x413 /d "_DEBUG" +# ADD RSC /l 0x413 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libmp4v2_cb - Win32 Release" +# Name "libmp4v2_cb - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\atom_co64.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_cprt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ctts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dimm.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmed.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_drep.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_edts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_elst.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_enca.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_encv.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_esds.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_free.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_frma.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ftyp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hdlr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hnti.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iKMS.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iods.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iSFM.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_maxr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdat.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdia.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_meta.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_minf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moof.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moov.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4a.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4s.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4v.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nump.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_payt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_pmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_root.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_rtp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_schi.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_schm.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_sdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_sinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_smhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_snro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stbl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stco.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsc.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsh.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stss.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsz.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tims.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tkhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmin.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tpyl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_traf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trak.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_treftype.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trpy.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trun.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tsro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_udta.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_url.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_urn.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_vmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\descriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\isma.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4container.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file_io.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4info.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4meta.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4property.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4track.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4util.cpp +# End Source File +# Begin Source File + +SOURCE=.\need_for_win32.c +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\odcommands.cpp +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.cpp +# End Source File +# Begin Source File + +SOURCE=.\rtphint.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\acconfig.h +# End Source File +# Begin Source File + +SOURCE=.\atoms.h +# End Source File +# Begin Source File + +SOURCE=.\descriptors.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\mp4array.h +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.h +# End Source File +# Begin Source File + +SOURCE=.\mp4common.h +# End Source File +# Begin Source File + +SOURCE=.\mp4container.h +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.h +# End Source File +# Begin Source File + +SOURCE=.\mp4file.h +# End Source File +# Begin Source File + +SOURCE=.\mp4property.h +# End Source File +# Begin Source File + +SOURCE=.\mp4track.h +# End Source File +# Begin Source File + +SOURCE=.\mp4util.h +# End Source File +# Begin Source File + +SOURCE=.\mpeg4ip.h +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.h +# End Source File +# Begin Source File + +SOURCE=.\odcommands.h +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.h +# End Source File +# Begin Source File + +SOURCE=.\rtphint.h +# End Source File +# Begin Source File + +SOURCE=.\systems.h +# End Source File +# Begin Source File + +SOURCE=.\win32_ver.h +# End Source File +# End Group +# End Target +# End Project --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_dinf.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_dinf.cpp @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DinfAtom::MP4DinfAtom() + : MP4Atom("dinf") +{ + ExpectChildAtom("dref", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/isma.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/isma.cpp @@ -0,0 +1,886 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +static u_int8_t BifsV2Config[3] = { + 0x00, 0x00, 0x60 // IsCommandStream = 1, PixelMetric = 1 +}; + +void MP4File::MakeIsmaCompliant(bool addIsmaComplianceSdp) +{ + ProtectWriteOperation("MP4MakeIsmaCompliant"); + + if (m_useIsma) { + // already done + return; + } + m_useIsma = true; + + // find first audio and/or video tracks + + MP4TrackId audioTrackId = MP4_INVALID_TRACK_ID; + try { + audioTrackId = FindTrackId(0, MP4_AUDIO_TRACK_TYPE); + } + catch (MP4Error* e) { + delete e; + } + + MP4TrackId videoTrackId = MP4_INVALID_TRACK_ID; + try { + videoTrackId = FindTrackId(0, MP4_VIDEO_TRACK_TYPE); + } + catch (MP4Error* e) { + delete e; + } + + u_int64_t fileMsDuration = + ConvertFromMovieDuration(GetDuration(), MP4_MSECS_TIME_SCALE); + + // delete any existing OD track + if (m_odTrackId != MP4_INVALID_TRACK_ID) { + DeleteTrack(m_odTrackId); + } + + AddODTrack(); + SetODProfileLevel(0xFF); + + if (audioTrackId != MP4_INVALID_TRACK_ID) { + AddTrackToOd(audioTrackId); + } + + if (videoTrackId != MP4_INVALID_TRACK_ID) { + AddTrackToOd(videoTrackId); + } + + // delete any existing scene track + MP4TrackId sceneTrackId = MP4_INVALID_TRACK_ID; + try { + sceneTrackId = FindTrackId(0, MP4_SCENE_TRACK_TYPE); + } + catch (MP4Error *e) { + delete e; + } + if (sceneTrackId != MP4_INVALID_TRACK_ID) { + DeleteTrack(sceneTrackId); + } + + // add scene track + sceneTrackId = AddSceneTrack(); + SetSceneProfileLevel(0xFF); + SetGraphicsProfileLevel(0xFF); + SetTrackIntegerProperty(sceneTrackId, + "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", + MP4SystemsV2ObjectType); + + SetTrackESConfiguration(sceneTrackId, + BifsV2Config, sizeof(BifsV2Config)); + + u_int8_t* pBytes = NULL; + u_int64_t numBytes = 0; + + // write OD Update Command + CreateIsmaODUpdateCommandFromFileForFile( + m_odTrackId, + audioTrackId, + videoTrackId, + &pBytes, + &numBytes); + + WriteSample(m_odTrackId, pBytes, numBytes, fileMsDuration); + + MP4Free(pBytes); + pBytes = NULL; + + // write BIFS Scene Replace Command + CreateIsmaSceneCommand( + MP4_IS_VALID_TRACK_ID(audioTrackId), + MP4_IS_VALID_TRACK_ID(videoTrackId), + &pBytes, + &numBytes); + + WriteSample(sceneTrackId, pBytes, numBytes, fileMsDuration); + + MP4Free(pBytes); + pBytes = NULL; + + // add session level sdp + CreateIsmaIodFromFile( + m_odTrackId, + sceneTrackId, + audioTrackId, + videoTrackId, + &pBytes, + &numBytes); + + char* iodBase64 = MP4ToBase64(pBytes, numBytes); + + char* sdpBuf = (char*)MP4Calloc(strlen(iodBase64) + 256); + + if (addIsmaComplianceSdp) { + strcpy(sdpBuf, "a=isma-compliance:1,1.0,1\015\012"); + } + + sprintf(&sdpBuf[strlen(sdpBuf)], + "a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042\015\012", + iodBase64); + + SetSessionSdp(sdpBuf); + + VERBOSE_ISMA(GetVerbosity(), + printf("IOD SDP = %s\n", sdpBuf)); + + MP4Free(iodBase64); + iodBase64 = NULL; + MP4Free(pBytes); + pBytes = NULL; + MP4Free(sdpBuf); + sdpBuf = NULL; +} + +static void CloneIntegerProperty( + MP4Descriptor* pDest, + MP4DescriptorProperty* pSrc, + const char* name) +{ + MP4IntegerProperty* pGetProperty; + MP4IntegerProperty* pSetProperty; + + pSrc->FindProperty(name, (MP4Property**)&pGetProperty); + pDest->FindProperty(name, (MP4Property**)&pSetProperty); + + pSetProperty->SetValue(pGetProperty->GetValue()); +} + +void MP4File::CreateIsmaIodFromFile( + MP4TrackId odTrackId, + MP4TrackId sceneTrackId, + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes) +{ + MP4Descriptor* pIod = new MP4IODescriptor(); + pIod->SetTag(MP4IODescrTag); + pIod->Generate(); + + MP4Atom* pIodsAtom = FindAtom("moov.iods"); + ASSERT(pIodsAtom); + MP4DescriptorProperty* pSrcIod = + (MP4DescriptorProperty*)pIodsAtom->GetProperty(2); + + CloneIntegerProperty(pIod, pSrcIod, "objectDescriptorId"); + CloneIntegerProperty(pIod, pSrcIod, "ODProfileLevelId"); + CloneIntegerProperty(pIod, pSrcIod, "sceneProfileLevelId"); + CloneIntegerProperty(pIod, pSrcIod, "audioProfileLevelId"); + CloneIntegerProperty(pIod, pSrcIod, "visualProfileLevelId"); + CloneIntegerProperty(pIod, pSrcIod, "graphicsProfileLevelId"); + + // mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag + MP4DescriptorProperty* pEsProperty; + pIod->FindProperty("esIds", (MP4Property**)&pEsProperty); + pEsProperty->SetTags(MP4ESDescrTag); + + MP4IntegerProperty* pSetProperty; + MP4IntegerProperty* pSceneESID; + MP4IntegerProperty* pOdESID; + + // OD + MP4Descriptor* pOdEsd = + pEsProperty->AddDescriptor(MP4ESDescrTag); + pOdEsd->Generate(); + + pOdEsd->FindProperty("ESID", + (MP4Property**)&pOdESID); + + // we set the OD ESID to a non-zero unique value + pOdESID->SetValue(m_odTrackId); + + pOdEsd->FindProperty("URLFlag", + (MP4Property**)&pSetProperty); + pSetProperty->SetValue(1); + + u_int8_t* pBytes; + u_int64_t numBytes; + + CreateIsmaODUpdateCommandFromFileForStream( + audioTrackId, + videoTrackId, + &pBytes, + &numBytes); + + VERBOSE_ISMA(GetVerbosity(), + printf("OD data =\n"); MP4HexDump(pBytes, numBytes)); + + char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); + + char* urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64); + + sprintf(urlBuf, + "data:application/mpeg4-od-au;base64,%s", + odCmdBase64); + + MP4StringProperty* pUrlProperty; + pOdEsd->FindProperty("URL", + (MP4Property**)&pUrlProperty); + pUrlProperty->SetValue(urlBuf); + + VERBOSE_ISMA(GetVerbosity(), + printf("OD data URL = \042%s\042\n", urlBuf)); + + MP4Free(odCmdBase64); + odCmdBase64 = NULL; + MP4Free(pBytes); + pBytes = NULL; + MP4Free(urlBuf); + urlBuf = NULL; + + MP4DescriptorProperty* pSrcDcd = NULL; + + // HACK temporarily point to scene decoder config + FindProperty(MakeTrackName(odTrackId, + "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), + (MP4Property**)&pSrcDcd); + ASSERT(pSrcDcd); + MP4Property* pOrgOdEsdProperty = + pOdEsd->GetProperty(8); + pOdEsd->SetProperty(8, pSrcDcd); + + // bufferSizeDB needs to be set appropriately + MP4BitfieldProperty* pBufferSizeProperty = NULL; + pOdEsd->FindProperty("decConfigDescr.bufferSizeDB", + (MP4Property**)&pBufferSizeProperty); + ASSERT(pBufferSizeProperty); + pBufferSizeProperty->SetValue(numBytes); + + // SL config needs to change from 2 (file) to 1 (null) + pOdEsd->FindProperty("slConfigDescr.predefined", + (MP4Property**)&pSetProperty); + pSetProperty->SetValue(1); + + + // Scene + MP4Descriptor* pSceneEsd = + pEsProperty->AddDescriptor(MP4ESDescrTag); + pSceneEsd->Generate(); + + pSceneEsd->FindProperty("ESID", + (MP4Property**)&pSceneESID); + // we set the Scene ESID to a non-zero unique value + pSceneESID->SetValue(sceneTrackId); + + pSceneEsd->FindProperty("URLFlag", + (MP4Property**)&pSetProperty); + pSetProperty->SetValue(1); + + CreateIsmaSceneCommand( + MP4_IS_VALID_TRACK_ID(audioTrackId), + MP4_IS_VALID_TRACK_ID(videoTrackId), + &pBytes, + &numBytes); + + VERBOSE_ISMA(GetVerbosity(), + printf("Scene data =\n"); MP4HexDump(pBytes, numBytes)); + + char *sceneCmdBase64 = MP4ToBase64(pBytes, numBytes); + + urlBuf = (char*)MP4Malloc(strlen(sceneCmdBase64) + 64); + sprintf(urlBuf, + "data:application/mpeg4-bifs-au;base64,%s", + sceneCmdBase64); + + pSceneEsd->FindProperty("URL", + (MP4Property**)&pUrlProperty); + pUrlProperty->SetValue(urlBuf); + + VERBOSE_ISMA(GetVerbosity(), + printf("Scene data URL = \042%s\042\n", urlBuf)); + + MP4Free(sceneCmdBase64); + sceneCmdBase64 = NULL; + MP4Free(urlBuf); + urlBuf = NULL; + MP4Free(pBytes); + pBytes = NULL; + + // HACK temporarily point to scene decoder config + FindProperty(MakeTrackName(sceneTrackId, + "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr"), + (MP4Property**)&pSrcDcd); + ASSERT(pSrcDcd); + MP4Property* pOrgSceneEsdProperty = + pSceneEsd->GetProperty(8); + pSceneEsd->SetProperty(8, pSrcDcd); + + // bufferSizeDB needs to be set + pBufferSizeProperty = NULL; + pSceneEsd->FindProperty("decConfigDescr.bufferSizeDB", + (MP4Property**)&pBufferSizeProperty); + ASSERT(pBufferSizeProperty); + pBufferSizeProperty->SetValue(numBytes); + + // SL config needs to change from 2 (file) to 1 (null) + pSceneEsd->FindProperty("slConfigDescr.predefined", + (MP4Property**)&pSetProperty); + pSetProperty->SetValue(1); + + + // finally get the whole thing written to a memory + pIod->WriteToMemory(this, ppBytes, pNumBytes); + + + // now carefully replace esd properties before destroying + pOdEsd->SetProperty(8, pOrgOdEsdProperty); + pSceneEsd->SetProperty(8, pOrgSceneEsdProperty); + pSceneESID->SetValue(0); // restore 0 value + pOdESID->SetValue(0); + + delete pIod; + + VERBOSE_ISMA(GetVerbosity(), + printf("IOD data =\n"); MP4HexDump(*ppBytes, *pNumBytes)); +} + +void MP4File::CreateIsmaIodFromParams( + u_int8_t videoProfile, + u_int32_t videoBitrate, + u_int8_t* videoConfig, + u_int32_t videoConfigLength, + u_int8_t audioProfile, + u_int32_t audioBitrate, + u_int8_t* audioConfig, + u_int32_t audioConfigLength, + u_int8_t** ppIodBytes, + u_int64_t* pIodNumBytes) +{ + MP4IntegerProperty* pInt; + u_int8_t* pBytes = NULL; + u_int64_t numBytes; + + // Create the IOD + MP4Descriptor* pIod = new MP4IODescriptor(); + pIod->SetTag(MP4IODescrTag); + pIod->Generate(); + + // Set audio and video profileLevels + pIod->FindProperty("audioProfileLevelId", + (MP4Property**)&pInt); + pInt->SetValue(audioProfile); + + pIod->FindProperty("visualProfileLevelId", + (MP4Property**)&pInt); + pInt->SetValue(videoProfile); + + // Mutate esIds from MP4ESIDIncDescrTag to MP4ESDescrTag + MP4DescriptorProperty* pEsProperty; + pIod->FindProperty("esIds", (MP4Property**)&pEsProperty); + pEsProperty->SetTags(MP4ESDescrTag); + + // Add ES Descriptors + + // Scene + CreateIsmaSceneCommand( + (audioProfile != 0xFF), + (videoProfile != 0xFF), + &pBytes, + &numBytes); + + VERBOSE_ISMA(GetVerbosity(), + printf("Scene data =\n"); MP4HexDump(pBytes, numBytes)); + + char* sceneCmdBase64 = MP4ToBase64(pBytes, numBytes); + + char* urlBuf = + (char*)MP4Malloc(strlen(sceneCmdBase64) + 64); + sprintf(urlBuf, + "data:application/mpeg4-bifs-au;base64,%s", + sceneCmdBase64); + + VERBOSE_ISMA(GetVerbosity(), + printf("Scene data URL = \042%s\042\n", urlBuf)); + + /* MP4Descriptor* pSceneEsd = */ + CreateESD( + pEsProperty, + 201, // esid + MP4SystemsV2ObjectType, + MP4SceneDescriptionStreamType, + numBytes, // bufferSize + numBytes * 8, // bitrate + BifsV2Config, + sizeof(BifsV2Config), + urlBuf); + + MP4Free(sceneCmdBase64); + sceneCmdBase64 = NULL; + MP4Free(urlBuf); + urlBuf = NULL; + MP4Free(pBytes); + pBytes = NULL; + + // OD + + // Video + MP4DescriptorProperty* pVideoEsdProperty = + new MP4DescriptorProperty(); + pVideoEsdProperty->SetTags(MP4ESDescrTag); + + /* MP4Descriptor* pVideoEsd = */ + CreateESD( + pVideoEsdProperty, + 20, // esid + MP4_MPEG4_VIDEO_TYPE, + MP4VisualStreamType, + videoBitrate / 8, // bufferSize + videoBitrate, + videoConfig, + videoConfigLength, + NULL); + + // Audio + MP4DescriptorProperty* pAudioEsdProperty = + new MP4DescriptorProperty(); + pAudioEsdProperty->SetTags(MP4ESDescrTag); + + /* MP4Descriptor* pAudioEsd = */ + CreateESD( + pAudioEsdProperty, + 10, // esid + MP4_MPEG4_AUDIO_TYPE, + MP4AudioStreamType, + audioBitrate / 8, // bufferSize + audioBitrate, + audioConfig, + audioConfigLength, + NULL); + + CreateIsmaODUpdateCommandForStream( + pAudioEsdProperty, + pVideoEsdProperty, + &pBytes, + &numBytes); + + // cleanup temporary descriptor properties + delete pAudioEsdProperty; + delete pVideoEsdProperty; + + VERBOSE_ISMA(GetVerbosity(), + printf("OD data = %llu bytes\n", numBytes); MP4HexDump(pBytes, numBytes)); + + char* odCmdBase64 = MP4ToBase64(pBytes, numBytes); + + urlBuf = (char*)MP4Malloc(strlen(odCmdBase64) + 64); + + sprintf(urlBuf, + "data:application/mpeg4-od-au;base64,%s", + odCmdBase64); + + VERBOSE_ISMA(GetVerbosity(), + printf("OD data URL = \042%s\042\n", urlBuf)); + + /* MP4Descriptor* pOdEsd = */ + CreateESD( + pEsProperty, + 101, + MP4SystemsV1ObjectType, + MP4ObjectDescriptionStreamType, + numBytes, // bufferSize + numBytes * 8, // bitrate + NULL, // config + 0, // configLength + urlBuf); + + MP4Free(odCmdBase64); + odCmdBase64 = NULL; + MP4Free(pBytes); + pBytes = NULL; + MP4Free(urlBuf); + urlBuf = NULL; + + // finally get the whole thing written to a memory + pIod->WriteToMemory(this, ppIodBytes, pIodNumBytes); + + delete pIod; + + VERBOSE_ISMA(GetVerbosity(), + printf("IOD data =\n"); MP4HexDump(*ppIodBytes, *pIodNumBytes)); +} + +MP4Descriptor* MP4File::CreateESD( + MP4DescriptorProperty* pEsProperty, + u_int32_t esid, + u_int8_t objectType, + u_int8_t streamType, + u_int32_t bufferSize, + u_int32_t bitrate, + u_int8_t* pConfig, + u_int32_t configLength, + char* url) +{ + MP4IntegerProperty* pInt; + MP4StringProperty* pString; + MP4BytesProperty* pBytes; + MP4BitfieldProperty* pBits; + + MP4Descriptor* pEsd = + pEsProperty->AddDescriptor(MP4ESDescrTag); + pEsd->Generate(); + + pEsd->FindProperty("ESID", + (MP4Property**)&pInt); + pInt->SetValue(esid); + + pEsd->FindProperty("decConfigDescr.objectTypeId", + (MP4Property**)&pInt); + pInt->SetValue(objectType); + + pEsd->FindProperty("decConfigDescr.streamType", + (MP4Property**)&pInt); + pInt->SetValue(streamType); + + pEsd->FindProperty("decConfigDescr.bufferSizeDB", + (MP4Property**)&pInt); + pInt->SetValue(bufferSize); + + pEsd->FindProperty("decConfigDescr.maxBitrate", + (MP4Property**)&pInt); + pInt->SetValue(bitrate); + + pEsd->FindProperty("decConfigDescr.avgBitrate", + (MP4Property**)&pInt); + pInt->SetValue(bitrate); + + MP4DescriptorProperty* pConfigDescrProperty; + pEsd->FindProperty("decConfigDescr.decSpecificInfo", + (MP4Property**)&pConfigDescrProperty); + + MP4Descriptor* pConfigDescr = + pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag); + pConfigDescr->Generate(); + + pConfigDescrProperty->FindProperty("decSpecificInfo[0].info", + (MP4Property**)&pBytes); + pBytes->SetValue(pConfig, configLength); + + pEsd->FindProperty("slConfigDescr.predefined", + (MP4Property**)&pInt); + // changed 12/5/02 from plugfest to value 0 + pInt->SetValue(0); + + pEsd->FindProperty("slConfig.useAccessUnitEndFlag", + (MP4Property **)&pBits); + pBits->SetValue(1); + + if (url) { + pEsd->FindProperty("URLFlag", + (MP4Property**)&pInt); + pInt->SetValue(1); + + pEsd->FindProperty("URL", + (MP4Property**)&pString); + pString->SetValue(url); + } + + return pEsd; +} + +void MP4File::CreateIsmaODUpdateCommandFromFileForFile( + MP4TrackId odTrackId, + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes) +{ + MP4Descriptor* pCommand = CreateODCommand(MP4ODUpdateODCommandTag); + pCommand->Generate(); + + for (u_int8_t i = 0; i < 2; i++) { + MP4TrackId trackId; + u_int16_t odId; + + if (i == 0) { + trackId = audioTrackId; + odId = 10; + } else { + trackId = videoTrackId; + odId = 20; + } + + if (trackId == MP4_INVALID_TRACK_ID) { + continue; + } + + MP4DescriptorProperty* pOdDescrProperty = + (MP4DescriptorProperty*)(pCommand->GetProperty(0)); + + pOdDescrProperty->SetTags(MP4FileODescrTag); + + MP4Descriptor* pOd = + pOdDescrProperty->AddDescriptor(MP4FileODescrTag); + + pOd->Generate(); + + MP4BitfieldProperty* pOdIdProperty = NULL; + pOd->FindProperty("objectDescriptorId", + (MP4Property**)&pOdIdProperty); + pOdIdProperty->SetValue(odId); + + MP4DescriptorProperty* pEsIdsDescriptorProperty = NULL; + pOd->FindProperty("esIds", + (MP4Property**)&pEsIdsDescriptorProperty); + ASSERT(pEsIdsDescriptorProperty); + + pEsIdsDescriptorProperty->SetTags(MP4ESIDRefDescrTag); + + MP4Descriptor *pRefDescriptor = + pEsIdsDescriptorProperty->AddDescriptor(MP4ESIDRefDescrTag); + pRefDescriptor->Generate(); + + MP4Integer16Property* pRefIndexProperty = NULL; + pRefDescriptor->FindProperty("refIndex", + (MP4Property**)&pRefIndexProperty); + ASSERT(pRefIndexProperty); + + u_int32_t mpodIndex = FindTrackReference( + MakeTrackName(odTrackId, "tref.mpod"), trackId); + ASSERT(mpodIndex != 0); + + pRefIndexProperty->SetValue(mpodIndex); + } + + pCommand->WriteToMemory(this, ppBytes, pNumBytes); + + delete pCommand; +} + +void MP4File::CreateIsmaODUpdateCommandFromFileForStream( + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes) +{ + MP4DescriptorProperty* pAudioEsd = NULL; + MP4Integer8Property* pAudioSLConfigPredef = NULL; + MP4BitfieldProperty* pAudioAccessUnitEndFlag = NULL; + int oldAudioUnitEndFlagValue = 0; + MP4DescriptorProperty* pVideoEsd = NULL; + MP4Integer8Property* pVideoSLConfigPredef = NULL; + MP4BitfieldProperty* pVideoAccessUnitEndFlag = NULL; + int oldVideoUnitEndFlagValue = 0; + MP4IntegerProperty* pAudioEsdId = NULL; + MP4IntegerProperty* pVideoEsdId = NULL; + + if (audioTrackId != MP4_INVALID_TRACK_ID) { + // changed mp4a to * to handle enca case + MP4Atom* pEsdsAtom = + FindAtom(MakeTrackName(audioTrackId, + "mdia.minf.stbl.stsd.*.esds")); + ASSERT(pEsdsAtom); + + pAudioEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); + // ESID is 0 for file, stream needs to be non-ze + pAudioEsd->FindProperty("ESID", + (MP4Property**)&pAudioEsdId); + + ASSERT(pAudioEsdId); + pAudioEsdId->SetValue(audioTrackId); + + // SL config needs to change from 2 (file) to 1 (null) + pAudioEsd->FindProperty("slConfigDescr.predefined", + (MP4Property**)&pAudioSLConfigPredef); + ASSERT(pAudioSLConfigPredef); + pAudioSLConfigPredef->SetValue(0); + + pAudioEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", + (MP4Property **)&pAudioAccessUnitEndFlag); + oldAudioUnitEndFlagValue = + pAudioAccessUnitEndFlag->GetValue(); + pAudioAccessUnitEndFlag->SetValue(1); + } + + if (videoTrackId != MP4_INVALID_TRACK_ID) { + // changed mp4v to * to handle encv case + MP4Atom* pEsdsAtom = + FindAtom(MakeTrackName(videoTrackId, + "mdia.minf.stbl.stsd.*.esds")); + ASSERT(pEsdsAtom); + + pVideoEsd = (MP4DescriptorProperty*)(pEsdsAtom->GetProperty(2)); + pVideoEsd->FindProperty("ESID", + (MP4Property**)&pVideoEsdId); + + ASSERT(pVideoEsdId); + pVideoEsdId->SetValue(videoTrackId); + + // SL config needs to change from 2 (file) to 1 (null) + pVideoEsd->FindProperty("slConfigDescr.predefined", + (MP4Property**)&pVideoSLConfigPredef); + ASSERT(pVideoSLConfigPredef); + pVideoSLConfigPredef->SetValue(0); + + pVideoEsd->FindProperty("slConfigDescr.useAccessUnitEndFlag", + (MP4Property **)&pVideoAccessUnitEndFlag); + oldVideoUnitEndFlagValue = + pVideoAccessUnitEndFlag->GetValue(); + pVideoAccessUnitEndFlag->SetValue(1); + } + + CreateIsmaODUpdateCommandForStream( + pAudioEsd, pVideoEsd, ppBytes, pNumBytes); + VERBOSE_ISMA(GetVerbosity(), + printf("After CreateImsaODUpdateCommandForStream len %llu =\n", *pNumBytes); MP4HexDump(*ppBytes, *pNumBytes)); + // return SL config values to 2 (file) + // return ESID values to 0 + if (pAudioSLConfigPredef) { + pAudioSLConfigPredef->SetValue(2); + } + if (pAudioEsdId) { + pAudioEsdId->SetValue(0); + } + if (pAudioAccessUnitEndFlag) { + pAudioAccessUnitEndFlag->SetValue(oldAudioUnitEndFlagValue ); + } + if (pVideoEsdId) { + pVideoEsdId->SetValue(0); + } + if (pVideoSLConfigPredef) { + pVideoSLConfigPredef->SetValue(2); + } + if (pVideoAccessUnitEndFlag) { + pVideoAccessUnitEndFlag->SetValue(oldVideoUnitEndFlagValue ); + } +} + +void MP4File::CreateIsmaODUpdateCommandForStream( + MP4DescriptorProperty* pAudioEsdProperty, + MP4DescriptorProperty* pVideoEsdProperty, + u_int8_t** ppBytes, + u_int64_t* pNumBytes) +{ + MP4Descriptor* pAudioOd = NULL; + MP4Descriptor* pVideoOd = NULL; + + MP4Descriptor* pCommand = + CreateODCommand(MP4ODUpdateODCommandTag); + pCommand->Generate(); + + for (u_int8_t i = 0; i < 2; i++) { + u_int16_t odId; + MP4DescriptorProperty* pEsdProperty = NULL; + + if (i == 0) { + odId = 10; + pEsdProperty = pAudioEsdProperty; + } else { + odId = 20; + pEsdProperty = pVideoEsdProperty; + } + + if (pEsdProperty == NULL) { + continue; + } + + MP4DescriptorProperty* pOdDescrProperty = + (MP4DescriptorProperty*)(pCommand->GetProperty(0)); + + pOdDescrProperty->SetTags(MP4ODescrTag); + + MP4Descriptor* pOd = + pOdDescrProperty->AddDescriptor(MP4ODescrTag); + pOd->Generate(); + + if (i == 0) { + pAudioOd = pOd; + } else { + pVideoOd = pOd; + } + + MP4BitfieldProperty* pOdIdProperty = NULL; + pOd->FindProperty("objectDescriptorId", + (MP4Property**)&pOdIdProperty); + pOdIdProperty->SetValue(odId); + + delete (MP4DescriptorProperty*)pOd->GetProperty(4); + pOd->SetProperty(4, pEsdProperty); + } + + // serialize OD command + pCommand->WriteToMemory(this, ppBytes, pNumBytes); + + // detach from esd descriptor params + if (pAudioOd) { + pAudioOd->SetProperty(4, NULL); + } + if (pVideoOd) { + pVideoOd->SetProperty(4, NULL); + } + + // then destroy + delete pCommand; +} + +void MP4File::CreateIsmaSceneCommand( + bool hasAudio, + bool hasVideo, + u_int8_t** ppBytes, + u_int64_t* pNumBytes) +{ + // from ISMA 1.0 Tech Spec Appendix E + static u_int8_t bifsAudioOnly[] = { + 0xC0, 0x10, 0x12, + 0x81, 0x30, 0x2A, 0x05, 0x6D, 0xC0 + }; + static u_int8_t bifsVideoOnly[] = { + 0xC0, 0x10, 0x12, + 0x61, 0x04, + 0x1F, 0xC0, 0x00, 0x00, + 0x1F, 0xC0, 0x00, 0x00, + 0x44, 0x28, 0x22, 0x82, 0x9F, 0x80 + }; + static u_int8_t bifsAudioVideo[] = { + 0xC0, 0x10, 0x12, + 0x81, 0x30, 0x2A, 0x05, 0x6D, 0x26, + 0x10, 0x41, 0xFC, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, + 0x04, 0x42, 0x82, 0x28, 0x29, 0xF8 + }; + + if (hasAudio && hasVideo) { + *pNumBytes = sizeof(bifsAudioVideo); + *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); + memcpy(*ppBytes, bifsAudioVideo, sizeof(bifsAudioVideo)); + + } else if (hasAudio) { + *pNumBytes = sizeof(bifsAudioOnly); + *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); + memcpy(*ppBytes, bifsAudioOnly, sizeof(bifsAudioOnly)); + + } else if (hasVideo) { + *pNumBytes = sizeof(bifsVideoOnly); + *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); + memcpy(*ppBytes, bifsVideoOnly, sizeof(bifsVideoOnly)); + } else { + *pNumBytes = 0; + *ppBytes = NULL; + } +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_co64.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_co64.cpp @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Co64Atom::MP4Co64Atom() + : MP4Atom("co64") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer64Property("chunkOffset")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4.h @@ -0,0 +1,1006 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#ifndef __MP4_INCLUDED__ +#define __MP4_INCLUDED__ + +/* include system and project specific headers */ +#include + +#include /* to define float HUGE_VAL and/or NAN */ +#ifndef NAN +#define NAN HUGE_VAL +#endif + +#ifdef __cplusplus +/* exploit C++ ability of default values for function parameters */ +#define DEFAULT(x) =x +#else +#define DEFAULT(x) +#endif + +/* MP4 API types */ +typedef void* MP4FileHandle; +typedef u_int32_t MP4TrackId; +typedef u_int32_t MP4SampleId; +typedef u_int64_t MP4Timestamp; +typedef u_int64_t MP4Duration; +typedef u_int32_t MP4EditId; + +/* Invalid values for API types */ +#define MP4_INVALID_FILE_HANDLE ((MP4FileHandle)NULL) +#define MP4_INVALID_TRACK_ID ((MP4TrackId)0) +#define MP4_INVALID_SAMPLE_ID ((MP4SampleId)0) +#define MP4_INVALID_TIMESTAMP ((MP4Timestamp)-1) +#define MP4_INVALID_DURATION ((MP4Duration)-1) +#define MP4_INVALID_EDIT_ID ((MP4EditId)0) + +/* Macros to test for API type validity */ +#define MP4_IS_VALID_FILE_HANDLE(x) ((x) != MP4_INVALID_FILE_HANDLE) +#define MP4_IS_VALID_TRACK_ID(x) ((x) != MP4_INVALID_TRACK_ID) +#define MP4_IS_VALID_SAMPLE_ID(x) ((x) != MP4_INVALID_SAMPLE_ID) +#define MP4_IS_VALID_TIMESTAMP(x) ((x) != MP4_INVALID_TIMESTAMP) +#define MP4_IS_VALID_DURATION(x) ((x) != MP4_INVALID_DURATION) +#define MP4_IS_VALID_EDIT_ID(x) ((x) != MP4_INVALID_EDIT_ID) + +/* MP4 verbosity levels - e.g. MP4SetVerbosity() */ +#define MP4_DETAILS_ALL 0xFFFFFFFF +#define MP4_DETAILS_ERROR 0x00000001 +#define MP4_DETAILS_WARNING 0x00000002 +#define MP4_DETAILS_READ 0x00000004 +#define MP4_DETAILS_WRITE 0x00000008 +#define MP4_DETAILS_FIND 0x00000010 +#define MP4_DETAILS_TABLE 0x00000020 +#define MP4_DETAILS_SAMPLE 0x00000040 +#define MP4_DETAILS_HINT 0x00000080 +#define MP4_DETAILS_ISMA 0x00000100 +#define MP4_DETAILS_EDIT 0x00000200 + +#define MP4_DETAILS_READ_ALL \ + (MP4_DETAILS_READ | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) +#define MP4_DETAILS_WRITE_ALL \ + (MP4_DETAILS_WRITE | MP4_DETAILS_TABLE | MP4_DETAILS_SAMPLE) + +/* + * MP4 Known track type names - e.g. MP4GetNumberOfTracks(type) + * + * Note this first group of track types should be created + * via the MP4AddTrack() functions, and not MP4AddTrack(type) + */ +#define MP4_OD_TRACK_TYPE "odsm" +#define MP4_SCENE_TRACK_TYPE "sdsm" +#define MP4_AUDIO_TRACK_TYPE "soun" +#define MP4_VIDEO_TRACK_TYPE "vide" +#define MP4_HINT_TRACK_TYPE "hint" +/* + * This second set of track types should be created + * via MP4AddSystemsTrack(type) + */ +#define MP4_CLOCK_TRACK_TYPE "crsm" +#define MP4_MPEG7_TRACK_TYPE "m7sm" +#define MP4_OCI_TRACK_TYPE "ocsm" +#define MP4_IPMP_TRACK_TYPE "ipsm" +#define MP4_MPEGJ_TRACK_TYPE "mjsm" + +#define MP4_IS_VIDEO_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_VIDEO_TRACK_TYPE)) + +#define MP4_IS_AUDIO_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_AUDIO_TRACK_TYPE)) + +#define MP4_IS_OD_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_OD_TRACK_TYPE)) + +#define MP4_IS_SCENE_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_SCENE_TRACK_TYPE)) + +#define MP4_IS_HINT_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_HINT_TRACK_TYPE)) + +#define MP4_IS_SYSTEMS_TRACK_TYPE(type) \ + (!strcasecmp(type, MP4_CLOCK_TRACK_TYPE) \ + || !strcasecmp(type, MP4_MPEG7_TRACK_TYPE) \ + || !strcasecmp(type, MP4_OCI_TRACK_TYPE) \ + || !strcasecmp(type, MP4_IPMP_TRACK_TYPE) \ + || !strcasecmp(type, MP4_MPEGJ_TRACK_TYPE)) + +/* MP4 Audio track types - see MP4AddAudioTrack()*/ +#define MP4_INVALID_AUDIO_TYPE 0x00 +#define MP4_MPEG1_AUDIO_TYPE 0x6B +#define MP4_MPEG2_AUDIO_TYPE 0x69 +#define MP4_MP3_AUDIO_TYPE MP4_MPEG2_AUDIO_TYPE +#define MP4_MPEG2_AAC_MAIN_AUDIO_TYPE 0x66 +#define MP4_MPEG2_AAC_LC_AUDIO_TYPE 0x67 +#define MP4_MPEG2_AAC_SSR_AUDIO_TYPE 0x68 +#define MP4_MPEG2_AAC_AUDIO_TYPE MP4_MPEG2_AAC_MAIN_AUDIO_TYPE +#define MP4_MPEG4_AUDIO_TYPE 0x40 +#define MP4_PRIVATE_AUDIO_TYPE 0xC0 +#define MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE 0xE0 /* a private definition */ +#define MP4_VORBIS_AUDIO_TYPE 0xE1 /* a private definition */ +#define MP4_AC3_AUDIO_TYPE 0xE2 /* a private definition */ +#define MP4_ALAW_AUDIO_TYPE 0xE3 /* a private definition */ +#define MP4_ULAW_AUDIO_TYPE 0xE4 /* a private definition */ +#define MP4_G723_AUDIO_TYPE 0xE5 /* a private definition */ +#define MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE 0xE6 /* a private definition */ + +/* MP4 MPEG-4 Audio types from 14496-3 Table 1.5.1 */ +#define MP4_MPEG4_INVALID_AUDIO_TYPE 0 +#define MP4_MPEG4_AAC_MAIN_AUDIO_TYPE 1 +#define MP4_MPEG4_AAC_LC_AUDIO_TYPE 2 +#define MP4_MPEG4_AAC_SSR_AUDIO_TYPE 3 +#define MP4_MPEG4_AAC_LTP_AUDIO_TYPE 4 +#define MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE 6 +#define MP4_MPEG4_CELP_AUDIO_TYPE 8 +#define MP4_MPEG4_HVXC_AUDIO_TYPE 9 +#define MP4_MPEG4_TTSI_AUDIO_TYPE 12 +#define MP4_MPEG4_MAIN_SYNTHETIC_AUDIO_TYPE 13 +#define MP4_MPEG4_WAVETABLE_AUDIO_TYPE 14 +#define MP4_MPEG4_MIDI_AUDIO_TYPE 15 +#define MP4_MPEG4_ALGORITHMIC_FX_AUDIO_TYPE 16 + +/* MP4 Audio type utilities following common usage */ +#define MP4_IS_MP3_AUDIO_TYPE(type) \ + ((type) == MP4_MPEG1_AUDIO_TYPE || (type) == MP4_MPEG2_AUDIO_TYPE) + +#define MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ + (((type) >= MP4_MPEG2_AAC_MAIN_AUDIO_TYPE \ + && (type) <= MP4_MPEG2_AAC_SSR_AUDIO_TYPE)) + +#define MP4_IS_MPEG4_AAC_AUDIO_TYPE(mpeg4Type) \ + (((mpeg4Type) >= MP4_MPEG4_AAC_MAIN_AUDIO_TYPE \ + && (mpeg4Type) <= MP4_MPEG4_AAC_LTP_AUDIO_TYPE) \ + || (mpeg4Type) == MP4_MPEG4_AAC_SCALABLE_AUDIO_TYPE \ + || (mpeg4Type) == 17) + +#define MP4_IS_AAC_AUDIO_TYPE(type) \ + (MP4_IS_MPEG2_AAC_AUDIO_TYPE(type) \ + || (type) == MP4_MPEG4_AUDIO_TYPE) + +/* MP4 Video track types - see MP4AddVideoTrack() */ +#define MP4_INVALID_VIDEO_TYPE 0x00 +#define MP4_MPEG1_VIDEO_TYPE 0x6A +#define MP4_MPEG2_SIMPLE_VIDEO_TYPE 0x60 +#define MP4_MPEG2_MAIN_VIDEO_TYPE 0x61 +#define MP4_MPEG2_SNR_VIDEO_TYPE 0x62 +#define MP4_MPEG2_SPATIAL_VIDEO_TYPE 0x63 +#define MP4_MPEG2_HIGH_VIDEO_TYPE 0x64 +#define MP4_MPEG2_442_VIDEO_TYPE 0x65 +#define MP4_MPEG2_VIDEO_TYPE MP4_MPEG2_MAIN_VIDEO_TYPE +#define MP4_MPEG4_VIDEO_TYPE 0x20 +#define MP4_JPEG_VIDEO_TYPE 0x6C +#define MP4_PRIVATE_VIDEO_TYPE 0xD0 +#define MP4_YUV12_VIDEO_TYPE 0xF0 /* a private definition */ +#define MP4_H264_VIDEO_TYPE 0xF1 /* a private definition */ +#define MP4_H263_VIDEO_TYPE 0xF2 /* a private definition */ +#define MP4_H261_VIDEO_TYPE 0xF3 /* a private definition */ + +/* MP4 Video type utilities */ +#define MP4_IS_MPEG1_VIDEO_TYPE(type) \ + ((type) == MP4_MPEG1_VIDEO_TYPE) + +#define MP4_IS_MPEG2_VIDEO_TYPE(type) \ + (((type) >= MP4_MPEG2_SIMPLE_VIDEO_TYPE \ + && (type) <= MP4_MPEG2_442_VIDEO_TYPE) \ + || MP4_IS_MPEG1_VIDEO_TYPE(type)) + +#define MP4_IS_MPEG4_VIDEO_TYPE(type) \ + ((type) == MP4_MPEG4_VIDEO_TYPE) + + +/* MP4 API declarations */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* file operations */ + +MP4FileHandle MP4Create( + const char* fileName, + u_int32_t verbosity DEFAULT(0), + bool use64bits DEFAULT(0), + bool useExtensibleFormat DEFAULT(0)); + +MP4FileHandle MP4Modify( + const char* fileName, + u_int32_t verbosity DEFAULT(0), + bool useExtensibleFormat DEFAULT(0)); + +MP4FileHandle MP4Read( + const char* fileName, + u_int32_t verbosity DEFAULT(0)); + +bool MP4Close( + MP4FileHandle hFile); + +bool MP4Optimize( + const char* existingFileName, + const char* newFileName DEFAULT(NULL), + u_int32_t verbosity DEFAULT(0)); + +bool MP4Dump( + MP4FileHandle hFile, + FILE* pDumpFile DEFAULT(NULL), + bool dumpImplicits DEFAULT(0)); + +char* MP4Info( + MP4FileHandle hFile, + MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); + +char* MP4FileInfo( + const char* fileName, + MP4TrackId trackId DEFAULT(MP4_INVALID_TRACK_ID)); + +/* file properties */ + +/* specific file properties */ + +u_int32_t MP4GetVerbosity(MP4FileHandle hFile); + +bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity); + +MP4Duration MP4GetDuration(MP4FileHandle hFile); + +u_int32_t MP4GetTimeScale(MP4FileHandle hFile); + +bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value); + +u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile); + +bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile); + +bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile); + +bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile); + +bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value); + +u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile); + +bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value); + +/* generic file properties */ + +u_int64_t MP4GetIntegerProperty( + MP4FileHandle hFile, + const char* propName); + +float MP4GetFloatProperty( + MP4FileHandle hFile, + const char* propName); + +const char* MP4GetStringProperty( + MP4FileHandle hFile, + const char* propName); + +void MP4GetBytesProperty( + MP4FileHandle hFile, + const char* propName, + u_int8_t** ppValue, + u_int32_t* pValueSize); + +bool MP4SetIntegerProperty( + MP4FileHandle hFile, + const char* propName, + int64_t value); + +bool MP4SetFloatProperty( + MP4FileHandle hFile, + const char* propName, + float value); + +bool MP4SetStringProperty( + MP4FileHandle hFile, const char* propName, const char* value); + +bool MP4SetBytesProperty( + MP4FileHandle hFile, const char* propName, + const u_int8_t* pValue, u_int32_t valueSize); + +/* track operations */ + +MP4TrackId MP4AddTrack( + MP4FileHandle hFile, + const char* type); + +MP4TrackId MP4AddSystemsTrack( + MP4FileHandle hFile, + const char* type); + +MP4TrackId MP4AddODTrack( + MP4FileHandle hFile); + +MP4TrackId MP4AddSceneTrack( + MP4FileHandle hFile); + +MP4TrackId MP4AddAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); + +MP4TrackId MP4AddEncAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType DEFAULT(MP4_MPEG4_AUDIO_TYPE)); + +MP4TrackId MP4AddVideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE)); + +MP4TrackId MP4AddEncVideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType DEFAULT(MP4_MPEG4_VIDEO_TYPE)); + +MP4TrackId MP4AddHintTrack( + MP4FileHandle hFile, + MP4TrackId refTrackId); + +MP4TrackId MP4CloneTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE)); + +MP4TrackId MP4EncAndCloneTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE)); + +MP4TrackId MP4CopyTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + bool applyEdits DEFAULT(false)); + +MP4TrackId MP4EncAndCopyTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + bool applyEdits DEFAULT(false)); + +bool MP4DeleteTrack( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetNumberOfTracks( + MP4FileHandle hFile, + const char* type DEFAULT(NULL), + u_int8_t subType DEFAULT(0)); + +MP4TrackId MP4FindTrackId( + MP4FileHandle hFile, + u_int16_t index, + const char* type DEFAULT(NULL), + u_int8_t subType DEFAULT(0)); + +u_int16_t MP4FindTrackIndex( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* track properties */ + +/* specific track properties */ + +const char* MP4GetTrackType( + MP4FileHandle hFile, + MP4TrackId trackId); + +MP4Duration MP4GetTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetTrackTimeScale( + MP4FileHandle hFile, + MP4TrackId trackId); + +bool MP4SetTrackTimeScale( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int32_t value); + +// Should not be used, replace with MP4GetTrackEsdsObjectTypeId +u_int8_t MP4GetTrackAudioType( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int8_t MP4GetTrackAudioMpeg4Type( + MP4FileHandle hFile, + MP4TrackId trackId); + +// Should not be used, replace with MP4GetTrackEsdsObjectTypeId +u_int8_t MP4GetTrackVideoType( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int8_t MP4GetTrackEsdsObjectTypeId( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* returns MP4_INVALID_DURATION if track samples do not have a fixed duration */ +MP4Duration MP4GetTrackFixedSampleDuration( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int32_t MP4GetTrackBitRate( + MP4FileHandle hFile, + MP4TrackId trackId); + +bool MP4GetTrackESConfiguration( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int8_t** ppConfig, + u_int32_t* pConfigSize); + +bool MP4SetTrackESConfiguration( + MP4FileHandle hFile, + MP4TrackId trackId, + const u_int8_t* pConfig, + u_int32_t configSize); + +MP4SampleId MP4GetTrackNumberOfSamples( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int16_t MP4GetTrackVideoWidth( + MP4FileHandle hFile, + MP4TrackId trackId); + +u_int16_t MP4GetTrackVideoHeight( + MP4FileHandle hFile, + MP4TrackId trackId); + +float MP4GetTrackVideoFrameRate( + MP4FileHandle hFile, + MP4TrackId trackId); + +/* generic track properties */ + +u_int64_t MP4GetTrackIntegerProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName); + +float MP4GetTrackFloatProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName); + +const char* MP4GetTrackStringProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName); + +void MP4GetTrackBytesProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + u_int8_t** ppValue, + u_int32_t* pValueSize); + +bool MP4SetTrackIntegerProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + int64_t value); + +bool MP4SetTrackFloatProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + float value); + +bool MP4SetTrackStringProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + const char* value); + +bool MP4SetTrackBytesProperty( + MP4FileHandle hFile, + MP4TrackId trackId, + const char* propName, + const u_int8_t* pValue, + u_int32_t valueSize); + +/* sample operations */ + +bool MP4ReadSample( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +/* uses (unedited) time to specify sample instead of sample id */ +bool MP4ReadSampleFromTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +bool MP4WriteSample( + MP4FileHandle hFile, + MP4TrackId trackId, + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration DEFAULT(MP4_INVALID_DURATION), + MP4Duration renderingOffset DEFAULT(0), + bool isSyncSample DEFAULT(true)); + +bool MP4CopySample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile DEFAULT(MP4_INVALID_FILE_HANDLE), + MP4TrackId dstTrackId DEFAULT(MP4_INVALID_TRACK_ID), + MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); + +/* Note this function is not yet implemented */ +bool MP4ReferenceSample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile, + MP4TrackId dstTrackId, + MP4Duration dstSampleDuration DEFAULT(MP4_INVALID_DURATION)); + +u_int32_t MP4GetSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +u_int32_t MP4GetTrackMaxSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId); + +MP4SampleId MP4GetSampleIdFromTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + bool wantSyncSample DEFAULT(false)); + +MP4Timestamp MP4GetSampleTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +MP4Duration MP4GetSampleDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +MP4Duration MP4GetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +bool MP4SetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + MP4Duration renderingOffset); + +int8_t MP4GetSampleSync( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId); + +/* rtp hint track operations */ + +bool MP4GetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + char** ppPayloadName DEFAULT(NULL), + u_int8_t* pPayloadNumber DEFAULT(NULL), + u_int16_t* pMaxPayloadSize DEFAULT(NULL), + char **ppEncodingParams DEFAULT(NULL)); + +#define MP4_SET_DYNAMIC_PAYLOAD 0xff + +bool MP4SetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* pPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t maxPayloadSize DEFAULT(0), + const char *encode_params DEFAULT(NULL), + bool include_rtp_map DEFAULT(true), + bool include_mpeg4_esid DEFAULT(true)); + +const char* MP4GetSessionSdp( + MP4FileHandle hFile); + +bool MP4SetSessionSdp( + MP4FileHandle hFile, + const char* sdpString); + +bool MP4AppendSessionSdp( + MP4FileHandle hFile, + const char* sdpString); + +const char* MP4GetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4SetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString); + +bool MP4AppendHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString); + +MP4TrackId MP4GetHintTrackReferenceTrackId( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4ReadRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId hintSampleId, + u_int16_t* pNumPackets DEFAULT(NULL)); + +u_int16_t MP4GetRtpHintNumberOfPackets( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +int8_t MP4GetRtpPacketBFrame( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex); + +int32_t MP4GetRtpPacketTransmitOffset( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex); + +bool MP4ReadRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc DEFAULT(0), + bool includeHeader DEFAULT(true), + bool includePayload DEFAULT(true)); + +MP4Timestamp MP4GetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4SetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Timestamp rtpStart); + +bool MP4AddRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4AddRtpVideoHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool isBframe DEFAULT(false), + u_int32_t timestampOffset DEFAULT(0)); + +bool MP4AddRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool setMbit DEFAULT(false), + int32_t transmitOffset DEFAULT(0)); + +bool MP4AddRtpImmediateData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const u_int8_t* pBytes, + u_int32_t numBytes); + +bool MP4AddRtpSampleData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId sampleId, + u_int32_t dataOffset, + u_int32_t dataLength); + +bool MP4AddRtpESConfigurationPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId); + +bool MP4WriteRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Duration duration, + bool isSyncSample DEFAULT(true)); + +/* ISMA specific utilities */ + +bool MP4MakeIsmaCompliant(const char* fileName, + u_int32_t verbosity DEFAULT(0), + bool addIsmaComplianceSdp DEFAULT(true)); + +char* MP4MakeIsmaSdpIod( + u_int8_t videoProfile, + u_int32_t videoBitrate, + u_int8_t* videoConfig, + u_int32_t videoConfigLength, + u_int8_t audioProfile, + u_int32_t audioBitrate, + u_int8_t* audioConfig, + u_int32_t audioConfigLength, + u_int32_t verbosity DEFAULT(0)); + +/* edit list */ + +/* NOTE this section of functionality + * has not yet been fully tested + */ + +MP4EditId MP4AddTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID), + MP4Timestamp startTime DEFAULT(0), + MP4Duration duration DEFAULT(0), + bool dwell DEFAULT(false)); + +bool MP4DeleteTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +u_int32_t MP4GetTrackNumberOfEdits( + MP4FileHandle hFile, + MP4TrackId trackId); + +MP4Timestamp MP4GetTrackEditStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +MP4Duration MP4GetTrackEditTotalDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId DEFAULT(MP4_INVALID_EDIT_ID)); + +MP4Timestamp MP4GetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime); + +MP4Duration MP4GetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Duration duration); + +int8_t MP4GetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId); + +bool MP4SetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + bool dwell); + +bool MP4ReadSampleFromEditTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* input/output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + /* output parameters */ + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL), + MP4Duration* pRenderingOffset DEFAULT(NULL), + bool* pIsSyncSample DEFAULT(NULL)); + +MP4SampleId MP4GetSampleIdFromEditTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + MP4Timestamp* pStartTime DEFAULT(NULL), + MP4Duration* pDuration DEFAULT(NULL)); + +/* time conversion utilties */ + +/* predefined values for timeScale parameter below */ +#define MP4_SECONDS_TIME_SCALE 1 +#define MP4_MILLISECONDS_TIME_SCALE 1000 +#define MP4_MICROSECONDS_TIME_SCALE 1000000 +#define MP4_NANOSECONDS_TIME_SCALE 1000000000 + +#define MP4_SECS_TIME_SCALE MP4_SECONDS_TIME_SCALE +#define MP4_MSECS_TIME_SCALE MP4_MILLISECONDS_TIME_SCALE +#define MP4_USECS_TIME_SCALE MP4_MICROSECONDS_TIME_SCALE +#define MP4_NSECS_TIME_SCALE MP4_NANOSECONDS_TIME_SCALE + +u_int64_t MP4ConvertFromMovieDuration( + MP4FileHandle hFile, + MP4Duration duration, + u_int32_t timeScale); + +u_int64_t MP4ConvertFromTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp timeStamp, + u_int32_t timeScale); + +MP4Timestamp MP4ConvertToTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t timeStamp, + u_int32_t timeScale); + +u_int64_t MP4ConvertFromTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Duration duration, + u_int32_t timeScale); + +MP4Duration MP4ConvertToTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t duration, + u_int32_t timeScale); + +char* MP4BinaryToBase16( + const u_int8_t* pData, + u_int32_t dataSize); + +char* MP4BinaryToBase64( + const u_int8_t* pData, + u_int32_t dataSize); + +/* iTunes metadata handling */ +bool MP4MetadataDelete(MP4FileHandle hFile); +bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, + const char** ppName, + u_int8_t** ppValue, u_int32_t* pValueSize); +bool MP4SetMetadataName(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataName(MP4FileHandle hFile, char** value); +bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value); +bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value); +bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataComment(MP4FileHandle hFile, char** value); +bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataTool(MP4FileHandle hFile, char** value); +bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataYear(MP4FileHandle hFile, char** value); +bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value); +bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value); +bool MP4SetMetadataTrack(MP4FileHandle hFile, + u_int16_t track, u_int16_t totalTracks); +bool MP4GetMetadataTrack(MP4FileHandle hFile, + u_int16_t* track, u_int16_t* totalTracks); +bool MP4SetMetadataDisk(MP4FileHandle hFile, + u_int16_t disk, u_int16_t totalDisks); +bool MP4GetMetadataDisk(MP4FileHandle hFile, + u_int16_t* disk, u_int16_t* totalDisks); +bool MP4SetMetadataGenre(MP4FileHandle hFile, const char* genre); +bool MP4GetMetadataGenre(MP4FileHandle hFile, char** genre); +bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo); +bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo); +bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl); +bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl); +bool MP4SetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t *coverArt, u_int32_t size); +bool MP4GetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t **coverArt, u_int32_t* size); +bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t* pValue, u_int32_t valueSize); +bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t** pValue, u_int32_t* valueSize); + +//#ifdef USE_FILE_CALLBACKS +typedef u_int32_t (*MP4OpenCallback)(const char *pName, const char *mode, void *userData); +typedef void (*MP4CloseCallback)(void *userData); +typedef u_int32_t (*MP4ReadCallback)(void *pBuffer, unsigned int nBytesToRead, void *userData); +typedef u_int32_t (*MP4WriteCallback)(void *pBuffer, unsigned int nBytesToWrite, void *userData); +typedef int32_t (*MP4SetposCallback)(u_int32_t pos, void *userData); +typedef int64_t (*MP4GetposCallback)(void *userData); +typedef int64_t (*MP4FilesizeCallback)(void *userData); + +MP4FileHandle MP4CreateCb(u_int32_t verbosity, + bool use64bits, + bool useExtensibleFormat, + MP4OpenCallback MP4fopen, + MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, + MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, + MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, + void *userData); + +MP4FileHandle MP4ReadCb(u_int32_t verbosity, + MP4OpenCallback MP4fopen, + MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, + MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, + MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, + void *userData); +MP4FileHandle MP4ModifyCb(int32_t verbosity, + bool useExtensibleFormat, + MP4OpenCallback MP4fopen, MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, void *userData); +//#endif + +#ifdef __cplusplus +} +#endif + +/* undefined our utlity macro to avoid conflicts */ +#undef DEFAULT + +#endif /* __MP4_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4.cpp @@ -0,0 +1,3243 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +/* + * MP4 library API functions + * + * These are wrapper functions that provide C linkage conventions + * to the library, and catch any internal errors, ensuring that + * a proper return value is given. + */ + +#include "mp4common.h" + +#define PRINT_ERROR(e) \ + VERBOSE_ERROR(((MP4File*)hFile)->GetVerbosity(), e->Print()); + +/* file operations */ + +extern "C" MP4FileHandle MP4Read(const char* fileName, u_int32_t verbosity) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + pFile->Read(fileName); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} + +#ifdef USE_FILE_CALLBACKS +extern "C" MP4FileHandle MP4CreateCb(u_int32_t verbosity, + bool use64bits, + bool useExtensibleFormat, + MP4OpenCallback MP4fopen, + MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, + MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, + MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, + void *userData) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + // LATER useExtensibleFormat, moov first, then mvex's + + // Set user data and callbacks + pFile->m_userData = userData; + pFile->m_MP4fopen = MP4fopen; + pFile->m_MP4fclose = MP4fclose; + pFile->m_MP4fread = MP4fread; + pFile->m_MP4fwrite = MP4fwrite; + pFile->m_MP4fsetpos = MP4fsetpos; + pFile->m_MP4fgetpos = MP4fgetpos; + pFile->m_MP4filesize = MP4filesize; + pFile->Create("", use64bits); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} + +extern "C" MP4FileHandle MP4ReadCb(u_int32_t verbosity, + MP4OpenCallback MP4fopen, + MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, + MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, + MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, + void *userData + ) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + + // Set user data and callbacks + pFile->m_userData = userData; + pFile->m_MP4fopen = MP4fopen; + pFile->m_MP4fclose = MP4fclose; + pFile->m_MP4fread = MP4fread; + pFile->m_MP4fwrite = MP4fwrite; + pFile->m_MP4fsetpos = MP4fsetpos; + pFile->m_MP4fgetpos = MP4fgetpos; + pFile->m_MP4filesize = MP4filesize; + + pFile->Read(""); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} + +extern "C" MP4FileHandle MP4ModifyCb(int32_t verbosity, + bool useExtensibleFormat, + MP4OpenCallback MP4fopen, MP4CloseCallback MP4fclose, + MP4ReadCallback MP4fread, MP4WriteCallback MP4fwrite, + MP4SetposCallback MP4fsetpos, MP4GetposCallback MP4fgetpos, + MP4FilesizeCallback MP4filesize, void *userData) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + + // Set user data and callbacks + pFile->m_userData = userData; + pFile->m_MP4fopen = MP4fopen; + pFile->m_MP4fclose = MP4fclose; + pFile->m_MP4fread = MP4fread; + pFile->m_MP4fwrite = MP4fwrite; + pFile->m_MP4fsetpos = MP4fsetpos; + pFile->m_MP4fgetpos = MP4fgetpos; + pFile->m_MP4filesize = MP4filesize; + + // LATER useExtensibleFormat, moov first, then mvex's + pFile->Modify(""); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} +#endif + +extern "C" MP4FileHandle MP4Create(const char* fileName, + u_int32_t verbosity, bool use64bits, bool useExtensibleFormat) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + // LATER useExtensibleFormat, moov first, then mvex's + pFile->Create(fileName, use64bits); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} + +extern "C" MP4FileHandle MP4Modify(const char* fileName, + u_int32_t verbosity, bool useExtensibleFormat) +{ + MP4File* pFile = NULL; + try { + pFile = new MP4File(verbosity); + // LATER useExtensibleFormat, moov first, then mvex's + pFile->Modify(fileName); + return (MP4FileHandle)pFile; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + delete pFile; + return MP4_INVALID_FILE_HANDLE; + } +} + +extern "C" bool MP4Optimize(const char* existingFileName, + const char* newFileName, + u_int32_t verbosity) +{ + try { + MP4File* pFile = new MP4File(verbosity); + pFile->Optimize(existingFileName, newFileName); + delete pFile; + return true; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + } + return false; +} + +extern "C" bool MP4Close(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->Close(); + delete (MP4File*)hFile; + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4Dump( + MP4FileHandle hFile, + FILE* pDumpFile, + bool dumpImplicits) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->Dump(pDumpFile, dumpImplicits); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + + +/* specific file properties */ + +extern "C" u_int32_t MP4GetVerbosity(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetVerbosity(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetVerbosity(MP4FileHandle hFile, u_int32_t verbosity) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetVerbosity(verbosity); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" MP4Duration MP4GetDuration(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetDuration(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" u_int32_t MP4GetTimeScale(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTimeScale(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetTimeScale(MP4FileHandle hFile, u_int32_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTimeScale(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int8_t MP4GetODProfileLevel(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetODProfileLevel(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetODProfileLevel(MP4FileHandle hFile, u_int8_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetODProfileLevel(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int8_t MP4GetSceneProfileLevel(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSceneProfileLevel(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetSceneProfileLevel(MP4FileHandle hFile, u_int8_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetSceneProfileLevel(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int8_t MP4GetVideoProfileLevel(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetVideoProfileLevel(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetVideoProfileLevel(MP4FileHandle hFile, u_int8_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetVideoProfileLevel(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int8_t MP4GetAudioProfileLevel(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetAudioProfileLevel(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetAudioProfileLevel(MP4FileHandle hFile, u_int8_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetAudioProfileLevel(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int8_t MP4GetGraphicsProfileLevel(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetGraphicsProfileLevel(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetGraphicsProfileLevel(MP4FileHandle hFile, u_int8_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetGraphicsProfileLevel(value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +/* generic file properties */ + +extern "C" u_int64_t MP4GetIntegerProperty( + MP4FileHandle hFile, const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetIntegerProperty(propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int64_t)-1; +} + +extern "C" float MP4GetFloatProperty( + MP4FileHandle hFile, const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetFloatProperty(propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NAN; +} + +extern "C" const char* MP4GetStringProperty( + MP4FileHandle hFile, const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetStringProperty(propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NULL; +} + +extern "C" void MP4GetBytesProperty( + MP4FileHandle hFile, const char* propName, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->GetBytesProperty(propName, ppValue, pValueSize); + return; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + *ppValue = NULL; + *pValueSize = 0; + return; +} + +extern "C" bool MP4SetIntegerProperty( + MP4FileHandle hFile, const char* propName, int64_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetIntegerProperty(propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetFloatProperty( + MP4FileHandle hFile, const char* propName, float value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetFloatProperty(propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetStringProperty( + MP4FileHandle hFile, const char* propName, const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetStringProperty(propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetBytesProperty( + MP4FileHandle hFile, const char* propName, + const u_int8_t* pValue, u_int32_t valueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetBytesProperty(propName, pValue, valueSize); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +/* track operations */ + +extern "C" MP4TrackId MP4AddTrack( + MP4FileHandle hFile, const char* type) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddSystemsTrack(type); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddSystemsTrack( + MP4FileHandle hFile, const char* type) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddSystemsTrack(type); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddODTrack(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddODTrack(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddSceneTrack(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddSceneTrack(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddAudioTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)-> + AddAudioTrack(timeScale, sampleDuration, audioType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddEncAudioTrack(MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)-> + AddEncAudioTrack(timeScale, sampleDuration, audioType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddVideoTrack( + MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddVideoTrack( + timeScale, sampleDuration, width, height, videoType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddEncVideoTrack(MP4FileHandle hFile, + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddEncVideoTrack(timeScale, sampleDuration, + width, height, videoType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4AddHintTrack( + MP4FileHandle hFile, MP4TrackId refTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->AddHintTrack(refTrackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" MP4TrackId MP4CloneTrack( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile) +{ + MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID; + + if (dstFile == NULL) { + dstFile = srcFile; + } + + const char* trackType = + MP4GetTrackType(srcFile, srcTrackId); + + if (!trackType) { + return dstTrackId; + } + + if (MP4_IS_VIDEO_TRACK_TYPE(trackType)) { + MP4SetVideoProfileLevel(dstFile, + MP4GetVideoProfileLevel(srcFile)); + dstTrackId = MP4AddVideoTrack( + dstFile, + MP4GetTrackTimeScale(srcFile, srcTrackId), + MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), + MP4GetTrackVideoWidth(srcFile, srcTrackId), + MP4GetTrackVideoHeight(srcFile, srcTrackId), + MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId)); + + } else if (MP4_IS_AUDIO_TRACK_TYPE(trackType)) { + MP4SetAudioProfileLevel(dstFile, + MP4GetAudioProfileLevel(srcFile)); + dstTrackId = MP4AddAudioTrack( + dstFile, + MP4GetTrackTimeScale(srcFile, srcTrackId), + MP4GetTrackFixedSampleDuration(srcFile, srcTrackId), + MP4GetTrackEsdsObjectTypeId(srcFile, srcTrackId)); + + } else if (MP4_IS_OD_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddODTrack(dstFile); + + } else if (MP4_IS_SCENE_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddSceneTrack(dstFile); + + } else if (MP4_IS_HINT_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddHintTrack( + dstFile, + MP4GetHintTrackReferenceTrackId(srcFile, srcTrackId)); + + } else if (MP4_IS_SYSTEMS_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddSystemsTrack(dstFile, trackType); + + } else { + dstTrackId = MP4AddTrack(dstFile, trackType); + } + + if (dstTrackId == MP4_INVALID_TRACK_ID) { + return dstTrackId; + } + + MP4SetTrackTimeScale( + dstFile, + dstTrackId, + MP4GetTrackTimeScale(srcFile, srcTrackId)); + + if (MP4_IS_AUDIO_TRACK_TYPE(trackType) + || MP4_IS_VIDEO_TRACK_TYPE(trackType)) { + // copy track ES configuration + u_int8_t* pConfig = NULL; + u_int32_t configSize = 0; + + MP4GetTrackESConfiguration( + srcFile, + srcTrackId, + &pConfig, + &configSize); + + MP4SetTrackESConfiguration( + dstFile, + dstTrackId, + pConfig, + configSize); + + free(pConfig); + } + + if (MP4_IS_HINT_TRACK_TYPE(trackType)) { + // probably not exactly what is wanted + // but caller can adjust later to fit their desires + + char* payloadName = NULL; + char *encodingParms = NULL; + u_int8_t payloadNumber; + u_int16_t maxPayloadSize; + + MP4GetHintTrackRtpPayload( + srcFile, + srcTrackId, + &payloadName, + &payloadNumber, + &maxPayloadSize, + &encodingParms); + + MP4SetHintTrackRtpPayload( + dstFile, + dstTrackId, + payloadName, + &payloadNumber, + maxPayloadSize, + encodingParms); + + MP4SetHintTrackSdp( + dstFile, + dstTrackId, + MP4GetHintTrackSdp(srcFile, srcTrackId)); + } + + return dstTrackId; +} + +// Given a track, make an encrypted clone of it in the dest. file +extern "C" MP4TrackId MP4EncAndCloneTrack(MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile) +{ + MP4TrackId dstTrackId = MP4_INVALID_TRACK_ID; + + if (dstFile == NULL) { + dstFile = srcFile; + } + + const char* trackType = + MP4GetTrackType(srcFile, srcTrackId); + + if (!trackType) { + return dstTrackId; + } + + if (MP4_IS_VIDEO_TRACK_TYPE(trackType)) { + MP4SetVideoProfileLevel(dstFile, MP4GetVideoProfileLevel(srcFile)); + dstTrackId = MP4AddEncVideoTrack(dstFile, + MP4GetTrackTimeScale(srcFile, srcTrackId), + MP4GetTrackFixedSampleDuration(srcFile, + srcTrackId), + MP4GetTrackVideoWidth(srcFile, srcTrackId), + MP4GetTrackVideoHeight(srcFile, srcTrackId), + MP4GetTrackEsdsObjectTypeId(srcFile, + srcTrackId)); + + } else if (MP4_IS_AUDIO_TRACK_TYPE(trackType)) { + MP4SetAudioProfileLevel(dstFile, MP4GetAudioProfileLevel(srcFile)); + dstTrackId = MP4AddEncAudioTrack(dstFile, + MP4GetTrackTimeScale(srcFile, srcTrackId), + MP4GetTrackFixedSampleDuration(srcFile, + srcTrackId), + MP4GetTrackEsdsObjectTypeId(srcFile, + srcTrackId)); + + } else if (MP4_IS_OD_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddODTrack(dstFile); + + } else if (MP4_IS_SCENE_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddSceneTrack(dstFile); + + } else if (MP4_IS_HINT_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddHintTrack(dstFile, + MP4GetHintTrackReferenceTrackId(srcFile, + srcTrackId)); + + } else if (MP4_IS_SYSTEMS_TRACK_TYPE(trackType)) { + dstTrackId = MP4AddSystemsTrack(dstFile, trackType); + + } else { + dstTrackId = MP4AddTrack(dstFile, trackType); + } + + if (dstTrackId == MP4_INVALID_TRACK_ID) { + return dstTrackId; + } + + MP4SetTrackTimeScale(dstFile, + dstTrackId, + MP4GetTrackTimeScale(srcFile, srcTrackId)); + + if (MP4_IS_AUDIO_TRACK_TYPE(trackType) + || MP4_IS_VIDEO_TRACK_TYPE(trackType)) { + // copy track ES configuration + u_int8_t* pConfig = NULL; + u_int32_t configSize = 0; + if (MP4GetTrackESConfiguration(srcFile, srcTrackId, + &pConfig, &configSize)) { + + if (pConfig != NULL) { + MP4SetTrackESConfiguration(dstFile, dstTrackId, + pConfig, configSize); + } + } + if (pConfig != NULL) + free(pConfig); + } + + return dstTrackId; +} + +extern "C" MP4TrackId MP4CopyTrack(MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile, + bool applyEdits) +{ + bool copySamples = true; // LATER allow false => reference samples + + MP4TrackId dstTrackId = + MP4CloneTrack(srcFile, srcTrackId, dstFile); + + if (dstTrackId == MP4_INVALID_TRACK_ID) { + return dstTrackId; + } + + bool viaEdits = + applyEdits && MP4GetTrackNumberOfEdits(srcFile, srcTrackId); + + MP4SampleId sampleId = 0; + MP4SampleId numSamples = + MP4GetTrackNumberOfSamples(srcFile, srcTrackId); + + MP4Timestamp when = 0; + MP4Duration editsDuration = + MP4GetTrackEditTotalDuration(srcFile, srcTrackId); + + while (true) { + MP4Duration sampleDuration = MP4_INVALID_DURATION; + + if (viaEdits) { + sampleId = MP4GetSampleIdFromEditTime( + srcFile, + srcTrackId, + when, + NULL, + &sampleDuration); + + // in theory, this shouldn't happen + if (sampleId == MP4_INVALID_SAMPLE_ID) { + MP4DeleteTrack(dstFile, dstTrackId); + return MP4_INVALID_TRACK_ID; + } + + when += sampleDuration; + + if (when >= editsDuration) { + break; + } + } else { + sampleId++; + if (sampleId > numSamples) { + break; + } + } + + bool rc = false; + + if (copySamples) { + rc = MP4CopySample( + srcFile, + srcTrackId, + sampleId, + dstFile, + dstTrackId, + sampleDuration); + + } else { + rc = MP4ReferenceSample( + srcFile, + srcTrackId, + sampleId, + dstFile, + dstTrackId, + sampleDuration); + } + + if (!rc) { + MP4DeleteTrack(dstFile, dstTrackId); + return MP4_INVALID_TRACK_ID; + } + } + + return dstTrackId; +} + + +// Given a source track in a source file, make an encrypted copy of +// the track in the destination file, including sample encryption +extern "C" MP4TrackId MP4EncAndCopyTrack(MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4FileHandle dstFile, + bool applyEdits) +{ + bool copySamples = true; // LATER allow false => reference samples + + MP4TrackId dstTrackId = + MP4EncAndCloneTrack(srcFile, srcTrackId, dstFile); + + if (dstTrackId == MP4_INVALID_TRACK_ID) { + return dstTrackId; + } + + bool viaEdits = + applyEdits && MP4GetTrackNumberOfEdits(srcFile, srcTrackId); + + MP4SampleId sampleId = 0; + MP4SampleId numSamples = + MP4GetTrackNumberOfSamples(srcFile, srcTrackId); + + MP4Timestamp when = 0; + MP4Duration editsDuration = + MP4GetTrackEditTotalDuration(srcFile, srcTrackId); + + while (true) { + MP4Duration sampleDuration = MP4_INVALID_DURATION; + + if (viaEdits) { + sampleId = MP4GetSampleIdFromEditTime(srcFile, + srcTrackId, + when, + NULL, + &sampleDuration); + + // in theory, this shouldn't happen + if (sampleId == MP4_INVALID_SAMPLE_ID) { + MP4DeleteTrack(dstFile, dstTrackId); + return MP4_INVALID_TRACK_ID; + } + + when += sampleDuration; + + if (when >= editsDuration) { + break; + } + } else { + sampleId++; + if (sampleId > numSamples) { + break; + } + } + + bool rc = false; + + if (copySamples) { + // will need to encrypt the sample here + rc = MP4CopySample(srcFile, + srcTrackId, + sampleId, + dstFile, + dstTrackId, + sampleDuration); + + } else { + rc = MP4ReferenceSample(srcFile, + srcTrackId, + sampleId, + dstFile, + dstTrackId, + sampleDuration); + } + + if (!rc) { + MP4DeleteTrack(dstFile, dstTrackId); + return MP4_INVALID_TRACK_ID; + } + } + + return dstTrackId; +} + +extern "C" bool MP4DeleteTrack( + MP4FileHandle hFile, + MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->DeleteTrack(trackId); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int32_t MP4GetNumberOfTracks( + MP4FileHandle hFile, + const char* type, + u_int8_t subType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetNumberOfTracks(type, subType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" MP4TrackId MP4FindTrackId( + MP4FileHandle hFile, + u_int16_t index, + const char* type, + u_int8_t subType) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->FindTrackId(index, type, subType); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" u_int16_t MP4FindTrackIndex( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->FindTrackIndex(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int16_t)-1; +} + +/* specific track properties */ + +extern "C" const char* MP4GetTrackType( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackType(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NULL; +} + +extern "C" MP4Duration MP4GetTrackDuration( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackDuration(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" u_int32_t MP4GetTrackTimeScale( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackTimeScale(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4SetTrackTimeScale( + MP4FileHandle hFile, MP4TrackId trackId, u_int32_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackTimeScale(trackId, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + + +// This function should not be used anymore +// use MP4GetTrackEsdsObjectTypeId instead +extern "C" u_int8_t MP4GetTrackAudioType( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + + return ((MP4File*)hFile)->GetTrackAudioType(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_AUDIO_TYPE; +} + +extern "C" u_int8_t MP4GetTrackAudioMpeg4Type( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackAudioMpeg4Type(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_MPEG4_INVALID_AUDIO_TYPE; +} + + +// This function should not be used anymore +// use MP4GetTrackEsdsObjectTypeId instead +extern "C" u_int8_t MP4GetTrackVideoType( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackVideoType(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_VIDEO_TYPE; +} + +// Replacement to MP4GetTrackVideoType and MP4GetTrackAudioType +// Basically does the same thing but with a more self-explanatory name +extern "C" u_int8_t MP4GetTrackEsdsObjectTypeId( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + + return ((MP4File*)hFile)->GetTrackEsdsObjectTypeId(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_AUDIO_TYPE; +} + +extern "C" MP4Duration MP4GetTrackFixedSampleDuration( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackFixedSampleDuration(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" u_int32_t MP4GetTrackBitRate( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate"); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4GetTrackESConfiguration( + MP4FileHandle hFile, MP4TrackId trackId, + u_int8_t** ppConfig, u_int32_t* pConfigSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->GetTrackESConfiguration( + trackId, ppConfig, pConfigSize); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + *ppConfig = NULL; + *pConfigSize = 0; + return false; +} + +extern "C" bool MP4SetTrackESConfiguration( + MP4FileHandle hFile, MP4TrackId trackId, + const u_int8_t* pConfig, u_int32_t configSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackESConfiguration( + trackId, pConfig, configSize); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" MP4SampleId MP4GetTrackNumberOfSamples( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackNumberOfSamples(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" u_int16_t MP4GetTrackVideoWidth( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.*.width"); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" u_int16_t MP4GetTrackVideoHeight( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.*.height"); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" float MP4GetTrackVideoFrameRate( + MP4FileHandle hFile, MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackVideoFrameRate(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0.0; +} + +/* generic track properties */ + +extern "C" u_int64_t MP4GetTrackIntegerProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackIntegerProperty(trackId, + propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int64_t)-1; +} + +extern "C" float MP4GetTrackFloatProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackFloatProperty(trackId, propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NAN; +} + +extern "C" const char* MP4GetTrackStringProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackStringProperty(trackId, propName); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NULL; +} + +extern "C" void MP4GetTrackBytesProperty( + MP4FileHandle hFile, MP4TrackId trackId, const char* propName, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->GetTrackBytesProperty( + trackId, propName, ppValue, pValueSize); + return; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + *ppValue = NULL; + *pValueSize = 0; + return; +} + +extern "C" bool MP4SetTrackIntegerProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName, int64_t value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackIntegerProperty(trackId, + propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetTrackFloatProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName, float value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackFloatProperty(trackId, propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetTrackStringProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName, const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackStringProperty(trackId, propName, value); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetTrackBytesProperty( + MP4FileHandle hFile, MP4TrackId trackId, + const char* propName, const u_int8_t* pValue, u_int32_t valueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackBytesProperty( + trackId, propName, pValue, valueSize); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +/* sample operations */ + +extern "C" bool MP4ReadSample( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + /* output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime, + MP4Duration* pDuration, + MP4Duration* pRenderingOffset, + bool* pIsSyncSample) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->ReadSample( + trackId, + sampleId, + ppBytes, + pNumBytes, + pStartTime, + pDuration, + pRenderingOffset, + pIsSyncSample); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + *pNumBytes = 0; + return false; +} + +extern "C" bool MP4ReadSampleFromTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime, + MP4Duration* pDuration, + MP4Duration* pRenderingOffset, + bool* pIsSyncSample) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + MP4SampleId sampleId = + ((MP4File*)hFile)->GetSampleIdFromTime( + trackId, when, false); + + ((MP4File*)hFile)->ReadSample( + trackId, + sampleId, + ppBytes, + pNumBytes, + pStartTime, + pDuration, + pRenderingOffset, + pIsSyncSample); + + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + *pNumBytes = 0; + return false; +} + +extern "C" bool MP4WriteSample( + MP4FileHandle hFile, + MP4TrackId trackId, + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration, + MP4Duration renderingOffset, + bool isSyncSample) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->WriteSample( + trackId, + pBytes, + numBytes, + duration, + renderingOffset, + isSyncSample); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4CopySample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile, + MP4TrackId dstTrackId, + MP4Duration dstSampleDuration) +{ + bool rc; + u_int8_t* pBytes = NULL; + u_int32_t numBytes = 0; + MP4Duration sampleDuration; + MP4Duration renderingOffset; + bool isSyncSample; + + // Note: we leave it up to the caller to ensure that the + // source and destination tracks are compatible. + // i.e. copying audio samples into a video track + // is unlikely to do anything useful + + rc = MP4ReadSample( + srcFile, + srcTrackId, + srcSampleId, + &pBytes, + &numBytes, + NULL, + &sampleDuration, + &renderingOffset, + &isSyncSample); + + if (!rc) { + return false; + } + + if (dstFile == MP4_INVALID_FILE_HANDLE) { + dstFile = srcFile; + } + if (dstTrackId == MP4_INVALID_TRACK_ID) { + dstTrackId = srcTrackId; + } + if (dstSampleDuration != MP4_INVALID_DURATION) { + sampleDuration = dstSampleDuration; + } + + rc = MP4WriteSample( + dstFile, + dstTrackId, + pBytes, + numBytes, + sampleDuration, + renderingOffset, + isSyncSample); + + free(pBytes); + + return rc; +} + +extern "C" bool MP4ReferenceSample( + MP4FileHandle srcFile, + MP4TrackId srcTrackId, + MP4SampleId srcSampleId, + MP4FileHandle dstFile, + MP4TrackId dstTrackId, + MP4Duration dstSampleDuration) +{ + // LATER Not yet implemented + return false; +} + +extern "C" u_int32_t MP4GetSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleSize( + trackId, sampleId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" u_int32_t MP4GetTrackMaxSampleSize( + MP4FileHandle hFile, + MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackMaxSampleSize(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" MP4SampleId MP4GetSampleIdFromTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + bool wantSyncSample) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleIdFromTime( + trackId, when, wantSyncSample); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_SAMPLE_ID; +} + +extern "C" MP4Timestamp MP4GetSampleTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleTime( + trackId, sampleId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TIMESTAMP; +} + +extern "C" MP4Duration MP4GetSampleDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleDuration( + trackId, sampleId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" MP4Duration MP4GetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleRenderingOffset( + trackId, sampleId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" bool MP4SetSampleRenderingOffset( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId, + MP4Duration renderingOffset) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetSampleRenderingOffset( + trackId, sampleId, renderingOffset); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" int8_t MP4GetSampleSync( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4SampleId sampleId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleSync( + trackId, sampleId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return -1; +} + + +extern "C" u_int64_t MP4ConvertFromMovieDuration( + MP4FileHandle hFile, + MP4Duration duration, + u_int32_t timeScale) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->ConvertFromMovieDuration( + duration, timeScale); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int64_t)MP4_INVALID_DURATION; +} + +extern "C" u_int64_t MP4ConvertFromTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp timeStamp, + u_int32_t timeScale) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->ConvertFromTrackTimestamp( + trackId, timeStamp, timeScale); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int64_t)MP4_INVALID_TIMESTAMP; +} + +extern "C" MP4Timestamp MP4ConvertToTrackTimestamp( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t timeStamp, + u_int32_t timeScale) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->ConvertToTrackTimestamp( + trackId, timeStamp, timeScale); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TIMESTAMP; +} + +extern "C" u_int64_t MP4ConvertFromTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Duration duration, + u_int32_t timeScale) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->ConvertFromTrackDuration( + trackId, duration, timeScale); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return (u_int64_t)MP4_INVALID_DURATION; +} + +extern "C" MP4Duration MP4ConvertToTrackDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + u_int64_t duration, + u_int32_t timeScale) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->ConvertToTrackDuration( + trackId, duration, timeScale); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" bool MP4GetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + char** ppPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t* pMaxPayloadSize, + char **ppEncodingParams) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->GetHintTrackRtpPayload( + hintTrackId, ppPayloadName, pPayloadNumber, pMaxPayloadSize, + ppEncodingParams); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetHintTrackRtpPayload( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* pPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t maxPayloadSize, + const char *encode_params, + bool include_rtp_map, + bool include_mpeg4_esid) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetHintTrackRtpPayload( + hintTrackId, pPayloadName, pPayloadNumber, maxPayloadSize, encode_params, + include_rtp_map, include_mpeg4_esid); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" const char* MP4GetSessionSdp( + MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSessionSdp(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NULL; +} + +extern "C" bool MP4SetSessionSdp( + MP4FileHandle hFile, + const char* sdpString) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetSessionSdp(sdpString); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AppendSessionSdp( + MP4FileHandle hFile, + const char* sdpString) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AppendSessionSdp(sdpString); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" const char* MP4GetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetHintTrackSdp(hintTrackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return NULL; +} + +extern "C" bool MP4SetHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetHintTrackSdp(hintTrackId, sdpString); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AppendHintTrackSdp( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const char* sdpString) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AppendHintTrackSdp(hintTrackId, sdpString); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" MP4TrackId MP4GetHintTrackReferenceTrackId( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)-> + GetHintTrackReferenceTrackId(hintTrackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TRACK_ID; +} + +extern "C" bool MP4ReadRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId hintSampleId, + u_int16_t* pNumPackets) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->ReadRtpHint( + hintTrackId, hintSampleId, pNumPackets); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int16_t MP4GetRtpHintNumberOfPackets( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetRtpHintNumberOfPackets(hintTrackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" int8_t MP4GetRtpPacketBFrame( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)-> + GetRtpPacketBFrame(hintTrackId, packetIndex); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return -1; +} + +extern "C" int32_t MP4GetRtpPacketTransmitOffset( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)-> + GetRtpPacketTransmitOffset(hintTrackId, packetIndex); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" bool MP4ReadRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc, + bool includeHeader, + bool includePayload) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->ReadRtpPacket( + hintTrackId, packetIndex, + ppBytes, pNumBytes, + ssrc, includeHeader, includePayload); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" MP4Timestamp MP4GetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetRtpTimestampStart(hintTrackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TIMESTAMP; +} + +extern "C" bool MP4SetRtpTimestampStart( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Timestamp rtpStart) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetRtpTimestampStart( + hintTrackId, rtpStart); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AddRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + return MP4AddRtpVideoHint(hFile, hintTrackId, false, 0); +} + +extern "C" bool MP4AddRtpVideoHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool isBframe, + u_int32_t timestampOffset) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AddRtpHint(hintTrackId, + isBframe, timestampOffset); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AddRtpPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + bool setMbit, + int32_t transmitOffset) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AddRtpPacket( + hintTrackId, setMbit, transmitOffset); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AddRtpImmediateData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + const u_int8_t* pBytes, + u_int32_t numBytes) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AddRtpImmediateData(hintTrackId, + pBytes, numBytes); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AddRtpSampleData( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4SampleId sampleId, + u_int32_t dataOffset, + u_int32_t dataLength) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AddRtpSampleData( + hintTrackId, sampleId, dataOffset, dataLength); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4AddRtpESConfigurationPacket( + MP4FileHandle hFile, + MP4TrackId hintTrackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->AddRtpESConfigurationPacket(hintTrackId); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4WriteRtpHint( + MP4FileHandle hFile, + MP4TrackId hintTrackId, + MP4Duration duration, + bool isSyncSample) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->WriteRtpHint( + hintTrackId, duration, isSyncSample); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +/* ISMA specific operations */ + +extern "C" bool MP4MakeIsmaCompliant( + const char* fileName, + u_int32_t verbosity, + bool addIsmaComplianceSdp) +{ + MP4File* pFile = NULL; + + try { + pFile = new MP4File(verbosity); + pFile->Modify(fileName); + pFile->MakeIsmaCompliant(addIsmaComplianceSdp); + pFile->Close(); + delete pFile; + return true; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + } + delete pFile; + return false; +} + +extern "C" char* MP4MakeIsmaSdpIod( + u_int8_t videoProfile, + u_int32_t videoBitrate, + u_int8_t* videoConfig, + u_int32_t videoConfigLength, + u_int8_t audioProfile, + u_int32_t audioBitrate, + u_int8_t* audioConfig, + u_int32_t audioConfigLength, + u_int32_t verbosity) +{ + MP4File* pFile = NULL; + + try { + pFile = new MP4File(verbosity); + + u_int8_t* pBytes = NULL; + u_int64_t numBytes = 0; + + pFile->CreateIsmaIodFromParams( + videoProfile, + videoBitrate, + videoConfig, + videoConfigLength, + audioProfile, + audioBitrate, + audioConfig, + audioConfigLength, + &pBytes, + &numBytes); + + char* iodBase64 = + MP4ToBase64(pBytes, numBytes); + MP4Free(pBytes); + + char* sdpIod = + (char*)MP4Malloc(strlen(iodBase64) + 64); + sprintf(sdpIod, + "a=mpeg4-iod: \042data:application/mpeg4-iod;base64,%s\042", + iodBase64); + MP4Free(iodBase64); + + delete pFile; + + return sdpIod; + } + catch (MP4Error* e) { + VERBOSE_ERROR(verbosity, e->Print()); + delete e; + } + delete pFile; + return NULL; +} + +/* Edit list */ + +extern "C" MP4EditId MP4AddTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime, + MP4Duration duration, + bool dwell) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + MP4EditId newEditId = + ((MP4File*)hFile)->AddTrackEdit(trackId, editId); + + if (newEditId != MP4_INVALID_EDIT_ID) { + ((MP4File*)hFile)->SetTrackEditMediaStart( + trackId, newEditId, startTime); + ((MP4File*)hFile)->SetTrackEditDuration( + trackId, newEditId, duration); + ((MP4File*)hFile)->SetTrackEditDwell( + trackId, newEditId, dwell); + } + + return newEditId; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_EDIT_ID; +} + +extern "C" bool MP4DeleteTrackEdit( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->DeleteTrackEdit(trackId, editId); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" u_int32_t MP4GetTrackNumberOfEdits( + MP4FileHandle hFile, + MP4TrackId trackId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackNumberOfEdits(trackId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return 0; +} + +extern "C" MP4Timestamp MP4GetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackEditMediaStart( + trackId, editId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_TIMESTAMP; +} + +extern "C" MP4Duration MP4GetTrackEditTotalDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackEditTotalDuration( + trackId, editId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" bool MP4SetTrackEditMediaStart( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackEditMediaStart( + trackId, editId, startTime); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" MP4Duration MP4GetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackEditDuration(trackId, editId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_DURATION; +} + +extern "C" bool MP4SetTrackEditDuration( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + MP4Duration duration) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackEditDuration(trackId, editId, duration); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" int8_t MP4GetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetTrackEditDwell(trackId, editId); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return -1; +} + +extern "C" bool MP4SetTrackEditDwell( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4EditId editId, + bool dwell) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + ((MP4File*)hFile)->SetTrackEditDwell(trackId, editId, dwell); + return true; + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4ReadSampleFromEditTime( + /* input parameters */ + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + /* output parameters */ + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime, + MP4Duration* pDuration, + MP4Duration* pRenderingOffset, + bool* pIsSyncSample) +{ + MP4SampleId sampleId = + MP4GetSampleIdFromEditTime( + hFile, + trackId, + when, + pStartTime, + pDuration); + + return MP4ReadSample( + hFile, + trackId, + sampleId, + ppBytes, + pNumBytes, + NULL, + NULL, + pRenderingOffset, + pIsSyncSample); +} + +extern "C" MP4SampleId MP4GetSampleIdFromEditTime( + MP4FileHandle hFile, + MP4TrackId trackId, + MP4Timestamp when, + MP4Timestamp* pStartTime, + MP4Duration* pDuration) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetSampleIdFromEditTime( + trackId, when, pStartTime, pDuration); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return MP4_INVALID_SAMPLE_ID; +} + +/* Utlities */ + +extern "C" char* MP4BinaryToBase16( + const u_int8_t* pData, + u_int32_t dataSize) +{ + if (pData || dataSize == 0) { + try { + return MP4ToBase16(pData, dataSize); + } + catch (MP4Error* e) { + delete e; + } + } + return NULL; +} + +extern "C" char* MP4BinaryToBase64( + const u_int8_t* pData, + u_int32_t dataSize) +{ + if (pData || dataSize == 0) { + try { + return MP4ToBase64(pData, dataSize); + } + catch (MP4Error* e) { + delete e; + } + } + return NULL; +} + + +/* iTunes meta data handling */ +extern "C" bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, + const char** ppName, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataByIndex( + index, ppName, ppValue, pValueSize); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4MetadataDelete(MP4FileHandle hFile) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->MetadataDelete(); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataName(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataName(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataName(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataName(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataWriter(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataWriter(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataWriter(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataWriter(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataAlbum(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataAlbum(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataAlbum(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataAlbum(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataArtist(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataArtist(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataArtist(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataArtist(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataTool(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataTool(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataTool(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataTool(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataComment(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataComment(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataComment(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataComment(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataYear(MP4FileHandle hFile, + const char* value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataYear(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataYear(MP4FileHandle hFile, + char** value) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataYear(value); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataTrack(MP4FileHandle hFile, + u_int16_t track, u_int16_t totalTracks) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataTrack(track, totalTracks); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataTrack(MP4FileHandle hFile, + u_int16_t* track, u_int16_t* totalTracks) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataTrack(track, totalTracks); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataDisk(MP4FileHandle hFile, + u_int16_t disk, u_int16_t totalDisks) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataDisk(disk, totalDisks); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataDisk(MP4FileHandle hFile, + u_int16_t* disk, u_int16_t* totalDisks) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataDisk(disk, totalDisks); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataGenre(MP4FileHandle hFile, const char* genre) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataGenre(genre); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataGenre(MP4FileHandle hFile, char** genre) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataGenre(genre); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataTempo(tempo); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataTempo(tempo); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataCompilation(cpl); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataCompilation(cpl); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t *coverArt, u_int32_t size) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataCoverArt(coverArt, size); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataCoverArt(MP4FileHandle hFile, + u_int8_t **coverArt, u_int32_t* size) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataCoverArt(coverArt, size); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t* pValue, u_int32_t valueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->SetMetadataFreeForm(name, pValue, valueSize); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} + +extern "C" bool MP4GetMetadataFreeForm(MP4FileHandle hFile, char *name, + u_int8_t** pValue, u_int32_t* valueSize) +{ + if (MP4_IS_VALID_FILE_HANDLE(hFile)) { + try { + return ((MP4File*)hFile)->GetMetadataFreeForm(name, pValue, valueSize); + } + catch (MP4Error* e) { + PRINT_ERROR(e); + delete e; + } + } + return false; +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4atom.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4atom.cpp @@ -0,0 +1,884 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" +#include "atoms.h" + +MP4AtomInfo::MP4AtomInfo(const char* name, bool mandatory, bool onlyOne) +{ + m_name = name; + m_mandatory = mandatory; + m_onlyOne = onlyOne; + m_count = 0; +} + +MP4Atom::MP4Atom(const char* type) +{ + SetType(type); + m_unknownType = FALSE; + m_pFile = NULL; + m_start = 0; + m_end = 0; + m_size = 0; + m_pParentAtom = NULL; + m_depth = 0xFF; +} + +MP4Atom::~MP4Atom() +{ + u_int32_t i; + + for (i = 0; i < m_pProperties.Size(); i++) { + delete m_pProperties[i]; + } + for (i = 0; i < m_pChildAtomInfos.Size(); i++) { + delete m_pChildAtomInfos[i]; + } + for (i = 0; i < m_pChildAtoms.Size(); i++) { + delete m_pChildAtoms[i]; + } +} + +MP4Atom* MP4Atom::CreateAtom(const char* type) +{ + MP4Atom* pAtom = NULL; + + if (type == NULL) { + pAtom = new MP4RootAtom(); + } else { + switch(type[0]) { + case 'c': + if (ATOMID(type) == ATOMID("ctts")) { + pAtom = new MP4CttsAtom(); + } else if (ATOMID(type) == ATOMID("co64")) { + pAtom = new MP4Co64Atom(); + } else if (ATOMID(type) == ATOMID("cprt")) { + pAtom = new MP4CprtAtom(); + } else if (ATOMID(type) == ATOMID("cpil")) { /* Apple iTunes */ + pAtom = new MP4CpilAtom(); + } else if (ATOMID(type) == ATOMID("covr")) { /* Apple iTunes */ + pAtom = new MP4CovrAtom(); + } + break; + case 'd': + if (ATOMID(type) == ATOMID("dinf")) { + pAtom = new MP4DinfAtom(); + } else if (ATOMID(type) == ATOMID("dref")) { + pAtom = new MP4DrefAtom(); + } else if (ATOMID(type) == ATOMID("dpnd")) { + pAtom = new MP4TrefTypeAtom(type); + } else if (ATOMID(type) == ATOMID("dmed")) { + pAtom = new MP4DmedAtom(); + } else if (ATOMID(type) == ATOMID("dimm")) { + pAtom = new MP4DimmAtom(); + } else if (ATOMID(type) == ATOMID("drep")) { + pAtom = new MP4DrepAtom(); + } else if (ATOMID(type) == ATOMID("dmax")) { + pAtom = new MP4DmaxAtom(); + } else if (ATOMID(type) == ATOMID("data")) { /* Apple iTunes */ + pAtom = new MP4DataAtom(); + } else if (ATOMID(type) == ATOMID("disk")) { /* Apple iTunes */ + pAtom = new MP4DiskAtom(); + } + break; + case 'e': + if (ATOMID(type) == ATOMID("esds")) { + pAtom = new MP4EsdsAtom(); + } else if (ATOMID(type) == ATOMID("edts")) { + pAtom = new MP4EdtsAtom(); + } else if (ATOMID(type) == ATOMID("elst")) { + pAtom = new MP4ElstAtom(); + } else if (ATOMID(type) == ATOMID("enca")) { + pAtom = new MP4EncaAtom(); + } else if (ATOMID(type) == ATOMID("encv")) { + pAtom = new MP4EncvAtom(); + } + break; + case 'f': + if (ATOMID(type) == ATOMID("free")) { + pAtom = new MP4FreeAtom(); + } else if (ATOMID(type) == ATOMID("frma")) { + pAtom = new MP4FrmaAtom(); + } else if (ATOMID(type) == ATOMID("ftyp")) { + pAtom = new MP4FtypAtom(); + } + break; + case 'g': + if (ATOMID(type) == ATOMID("gnre")) { /* Apple iTunes */ + pAtom = new MP4GnreAtom(); + } + break; + case 'h': + if (ATOMID(type) == ATOMID("hdlr")) { + pAtom = new MP4HdlrAtom(); + } else if (ATOMID(type) == ATOMID("hmhd")) { + pAtom = new MP4HmhdAtom(); + } else if (ATOMID(type) == ATOMID("hint")) { + pAtom = new MP4TrefTypeAtom(type); + } else if (ATOMID(type) == ATOMID("hnti")) { + pAtom = new MP4HntiAtom(); + } else if (ATOMID(type) == ATOMID("hinf")) { + pAtom = new MP4HinfAtom(); + } + break; + case 'i': + if (ATOMID(type) == ATOMID("iKMS")) { + pAtom = new MP4IKMSAtom(); + } else if (ATOMID(type) == ATOMID("iSFM")) { + pAtom = new MP4ISFMAtom(); + } else if (ATOMID(type) == ATOMID("iods")) { + pAtom = new MP4IodsAtom(); + } else if (ATOMID(type) == ATOMID("ipir")) { + pAtom = new MP4TrefTypeAtom(type); + } else if (ATOMID(type) == ATOMID("ilst")) { /* Apple iTunes */ + pAtom = new MP4IlstAtom(); + } + break; + case 'm': + if (ATOMID(type) == ATOMID("mdia")) { + pAtom = new MP4MdiaAtom(); + } else if (ATOMID(type) == ATOMID("minf")) { + pAtom = new MP4MinfAtom(); + } else if (ATOMID(type) == ATOMID("mdhd")) { + pAtom = new MP4MdhdAtom(); + } else if (ATOMID(type) == ATOMID("mdat")) { + pAtom = new MP4MdatAtom(); + } else if (ATOMID(type) == ATOMID("moov")) { + pAtom = new MP4MoovAtom(); + } else if (ATOMID(type) == ATOMID("mvhd")) { + pAtom = new MP4MvhdAtom(); + } else if (ATOMID(type) == ATOMID("mpod")) { + pAtom = new MP4TrefTypeAtom(type); + } else if (ATOMID(type) == ATOMID("mp4a")) { + pAtom = new MP4Mp4aAtom(); + } else if (ATOMID(type) == ATOMID("mp4s")) { + pAtom = new MP4Mp4sAtom(); + } else if (ATOMID(type) == ATOMID("mp4v")) { + pAtom = new MP4Mp4vAtom(); + } else if (ATOMID(type) == ATOMID("moof")) { + pAtom = new MP4MoofAtom(); + } else if (ATOMID(type) == ATOMID("mfhd")) { + pAtom = new MP4MfhdAtom(); + } else if (ATOMID(type) == ATOMID("mvex")) { + pAtom = new MP4MvexAtom(); + } else if (ATOMID(type) == ATOMID("maxr")) { + pAtom = new MP4MaxrAtom(); + } else if (ATOMID(type) == ATOMID("meta")) { /* Apple iTunes */ + pAtom = new MP4MetaAtom(); + } else if (ATOMID(type) == ATOMID("mean")) { /* Apple iTunes */ + pAtom = new MP4MeanAtom(); + } + break; + case 'n': + if (ATOMID(type) == ATOMID("nmhd")) { + pAtom = new MP4NmhdAtom(); + } else if (ATOMID(type) == ATOMID("nump")) { + pAtom = new MP4NumpAtom(); + } else if (ATOMID(type) == ATOMID("name")) { + pAtom = new MP4NameAtom(); + } + break; + case 'p': + if (ATOMID(type) == ATOMID("pmax")) { + pAtom = new MP4PmaxAtom(); + } else if (ATOMID(type) == ATOMID("payt")) { + pAtom = new MP4PaytAtom(); + } + break; + case 'r': + if (ATOMID(type) == ATOMID("rtp ")) { + pAtom = new MP4RtpAtom(); + } + break; + case 's': + if (ATOMID(type) == ATOMID("schi")) { + pAtom = new MP4SchiAtom(); + } else if (ATOMID(type) == ATOMID("schm")) { + pAtom = new MP4SchmAtom(); + } else if (ATOMID(type) == ATOMID("sinf")) { + pAtom = new MP4SinfAtom(); + } else if (ATOMID(type) == ATOMID("stbl")) { + pAtom = new MP4StblAtom(); + } else if (ATOMID(type) == ATOMID("stsd")) { + pAtom = new MP4StsdAtom(); + } else if (ATOMID(type) == ATOMID("stts")) { + pAtom = new MP4SttsAtom(); + } else if (ATOMID(type) == ATOMID("stsz")) { + pAtom = new MP4StszAtom(); + } else if (ATOMID(type) == ATOMID("stsc")) { + pAtom = new MP4StscAtom(); + } else if (ATOMID(type) == ATOMID("stco")) { + pAtom = new MP4StcoAtom(); + } else if (ATOMID(type) == ATOMID("stss")) { + pAtom = new MP4StssAtom(); + } else if (ATOMID(type) == ATOMID("stsh")) { + pAtom = new MP4StshAtom(); + } else if (ATOMID(type) == ATOMID("stdp")) { + pAtom = new MP4StdpAtom(); + } else if (ATOMID(type) == ATOMID("smhd")) { + pAtom = new MP4SmhdAtom(); + } else if (ATOMID(type) == ATOMID("sdp ")) { + pAtom = new MP4SdpAtom(); + } else if (ATOMID(type) == ATOMID("snro")) { + pAtom = new MP4SnroAtom(); + } else if (ATOMID(type) == ATOMID("sync")) { + pAtom = new MP4TrefTypeAtom(type); + } else if (ATOMID(type) == ATOMID("skip")) { + pAtom = new MP4FreeAtom(); + pAtom->SetType("skip"); + } + break; + case 't': + if (ATOMID(type) == ATOMID("trak")) { + pAtom = new MP4TrakAtom(); + } else if (ATOMID(type) == ATOMID("tkhd")) { + pAtom = new MP4TkhdAtom(); + } else if (ATOMID(type) == ATOMID("tref")) { + pAtom = new MP4TrefAtom(); + } else if (ATOMID(type) == ATOMID("traf")) { + pAtom = new MP4TrafAtom(); + } else if (ATOMID(type) == ATOMID("tfhd")) { + pAtom = new MP4TfhdAtom(); + } else if (ATOMID(type) == ATOMID("trex")) { + pAtom = new MP4TrexAtom(); + } else if (ATOMID(type) == ATOMID("trun")) { + pAtom = new MP4TrunAtom(); + } else if (ATOMID(type) == ATOMID("tmin")) { + pAtom = new MP4TminAtom(); + } else if (ATOMID(type) == ATOMID("tmax")) { + pAtom = new MP4TmaxAtom(); + } else if (ATOMID(type) == ATOMID("trpy")) { + pAtom = new MP4TrpyAtom(); + } else if (ATOMID(type) == ATOMID("tpyl")) { + pAtom = new MP4TpylAtom(); + } else if (ATOMID(type) == ATOMID("tims")) { + pAtom = new MP4TimsAtom(); + } else if (ATOMID(type) == ATOMID("tsro")) { + pAtom = new MP4TsroAtom(); + } else if (ATOMID(type) == ATOMID("trkn")) { /* Apple iTunes */ + pAtom = new MP4TrknAtom(); + } else if (ATOMID(type) == ATOMID("tmpo")) { /* Apple iTunes */ + pAtom = new MP4TmpoAtom(); + } + break; + case 'u': + if (ATOMID(type) == ATOMID("udta")) { + pAtom = new MP4UdtaAtom(); + } else if (ATOMID(type) == ATOMID("url ")) { + pAtom = new MP4UrlAtom(); + } else if (ATOMID(type) == ATOMID("urn ")) { + pAtom = new MP4UrnAtom(); + } + break; + case 'v': + if (ATOMID(type) == ATOMID("vmhd")) { + pAtom = new MP4VmhdAtom(); + } + break; + case '': + if (ATOMID(type) == ATOMID("nam")) { + pAtom = new MP4NamAtom(); + } else if (ATOMID(type) == ATOMID("ART")) { /* Apple iTunes */ + pAtom = new MP4ArtAtom(); + } else if (ATOMID(type) == ATOMID("wrt")) { /* Apple iTunes */ + pAtom = new MP4WrtAtom(); + } else if (ATOMID(type) == ATOMID("alb")) { /* Apple iTunes */ + pAtom = new MP4AlbAtom(); + } else if (ATOMID(type) == ATOMID("day")) { /* Apple iTunes */ + pAtom = new MP4DayAtom(); + } else if (ATOMID(type) == ATOMID("too")) { /* Apple iTunes */ + pAtom = new MP4TooAtom(); + } else if (ATOMID(type) == ATOMID("cmt")) { /* Apple iTunes */ + pAtom = new MP4CmtAtom(); + } else if (ATOMID(type) == ATOMID("gen")) { /* Apple iTunes */ + pAtom = new MP4GenAtom(); + } + break; + case '-': + if (ATOMID(type) == ATOMID("----")) { /* Apple iTunes */ + pAtom = new MP4DashAtom(); + } + } + } + + if (pAtom == NULL) { + pAtom = new MP4Atom(type); + pAtom->SetUnknownType(true); + } + + ASSERT(pAtom); + return pAtom; +} + +// generate a skeletal self + +void MP4Atom::Generate() +{ + u_int32_t i; + + // for all properties + for (i = 0; i < m_pProperties.Size(); i++) { + // ask it to self generate + m_pProperties[i]->Generate(); + } + + // for all mandatory, single child atom types + for (i = 0; i < m_pChildAtomInfos.Size(); i++) { + if (m_pChildAtomInfos[i]->m_mandatory + && m_pChildAtomInfos[i]->m_onlyOne) { + + // create the mandatory, single child atom + MP4Atom* pChildAtom = + CreateAtom(m_pChildAtomInfos[i]->m_name); + + AddChildAtom(pChildAtom); + + // and ask it to self generate + pChildAtom->Generate(); + } + } +} + +MP4Atom* MP4Atom::ReadAtom(MP4File* pFile, MP4Atom* pParentAtom) +{ + u_int8_t hdrSize = 8; + u_int8_t extendedType[16]; + + u_int64_t pos = pFile->GetPosition(); + + VERBOSE_READ(pFile->GetVerbosity(), + printf("ReadAtom: pos = 0x"LLX"\n", pos)); + + u_int64_t dataSize = pFile->ReadUInt32(); + + char type[5]; + pFile->ReadBytes((u_int8_t*)&type[0], 4); + type[4] = '\0'; + + // extended size + if (dataSize == 1) { + dataSize = pFile->ReadUInt64(); + hdrSize += 8; + } + + // extended type + if (ATOMID(type) == ATOMID("uuid")) { + pFile->ReadBytes(extendedType, sizeof(extendedType)); + hdrSize += sizeof(extendedType); + } + + if (dataSize == 0) { + // extends to EOF + dataSize = pFile->GetSize() - pos; + } + + dataSize -= hdrSize; + + VERBOSE_READ(pFile->GetVerbosity(), + printf("ReadAtom: type = %s data-size = "LLU" (0x"LLX")\n", + type, dataSize, dataSize)); + + if (pos + hdrSize + dataSize > pParentAtom->GetEnd()) { + VERBOSE_READ(pFile->GetVerbosity(), + printf("ReadAtom: invalid atom size, extends outside parent atom\n")); + throw new MP4Error("invalid atom size", "ReadAtom"); + } + + + MP4Atom* pAtom = CreateAtom(type); + pAtom->SetFile(pFile); + pAtom->SetStart(pos); + pAtom->SetEnd(pos + hdrSize + dataSize); + pAtom->SetSize(dataSize); + if (ATOMID(type) == ATOMID("uuid")) { + pAtom->SetExtendedType(extendedType); + } + if (pAtom->IsUnknownType()) { + if (!IsReasonableType(pAtom->GetType())) { + VERBOSE_READ(pFile->GetVerbosity(), + printf("Warning: atom type %s is suspect\n", pAtom->GetType())); + } else { + VERBOSE_READ(pFile->GetVerbosity(), + printf("Info: atom type %s is unknown\n", pAtom->GetType())); + } + + if (dataSize > 0) { + pAtom->AddProperty( + new MP4BytesProperty("data", dataSize)); + } + } + + pAtom->SetParentAtom(pParentAtom); + + pAtom->Read(); + + return pAtom; +} + +bool MP4Atom::IsReasonableType(const char* type) +{ + for (u_int8_t i = 0; i < 4; i++) { + if (isalnum(type[i])) { + continue; + } + if (i == 3 && type[i] == ' ') { + continue; + } + return false; + } + return true; +} + +// generic read +void MP4Atom::Read() +{ + ASSERT(m_pFile); + + if (ATOMID(m_type) != 0 && m_size > 1000000) { + VERBOSE_READ(GetVerbosity(), + printf("Warning: %s atom size "LLU" is suspect\n", + m_type, m_size)); + } + + ReadProperties(); + + // read child atoms, if we expect there to be some + if (m_pChildAtomInfos.Size() > 0) { + ReadChildAtoms(); + } + + Skip(); // to end of atom +} + +void MP4Atom::Skip() +{ + if (m_pFile->GetPosition() != m_end) { + VERBOSE_READ(m_pFile->GetVerbosity(), + printf("Skip: "LLU" bytes\n", m_end - m_pFile->GetPosition())); + } + m_pFile->SetPosition(m_end); +} + +MP4Atom* MP4Atom::FindAtom(const char* name) +{ + if (!IsMe(name)) { + return NULL; + } + + if (!IsRootAtom()) { + VERBOSE_FIND(m_pFile->GetVerbosity(), + printf("FindAtom: matched %s\n", name)); + + name = MP4NameAfterFirst(name); + + // I'm the sought after atom + if (name == NULL) { + return this; + } + } + + // else it's one of my children + return FindChildAtom(name); +} + +bool MP4Atom::FindProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!IsMe(name)) { + return false; + } + + if (!IsRootAtom()) { + VERBOSE_FIND(m_pFile->GetVerbosity(), + printf("FindProperty: matched %s\n", name)); + + name = MP4NameAfterFirst(name); + + // no property name given + if (name == NULL) { + return false; + } + } + + return FindContainedProperty(name, ppProperty, pIndex); +} + +bool MP4Atom::IsMe(const char* name) +{ + if (name == NULL) { + return false; + } + + // root atom always matches + if (!strcmp(m_type, "")) { + return true; + } + + // check if our atom name is specified as the first component + if (!MP4NameFirstMatches(m_type, name)) { + return false; + } + + return true; +} + +MP4Atom* MP4Atom::FindChildAtom(const char* name) +{ + u_int32_t atomIndex = 0; + + // get the index if we have one, e.g. moov.trak[2].mdia... + MP4NameFirstIndex(name, &atomIndex); + + // need to get to the index'th child atom of the right type + for (u_int32_t i = 0; i < m_pChildAtoms.Size(); i++) { + if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) { + if (atomIndex == 0) { + // this is the one, ask it to match + return m_pChildAtoms[i]->FindAtom(name); + } + atomIndex--; + } + } + + return NULL; +} + +bool MP4Atom::FindContainedProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + u_int32_t numProperties = m_pProperties.Size(); + u_int32_t i; + // check all of our properties + for (i = 0; i < numProperties; i++) { + if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { + return true; + } + } + + // not one of our properties, + // presumably one of our children's properties + // check child atoms... + + // check if we have an index, e.g. trak[2].mdia... + u_int32_t atomIndex = 0; + MP4NameFirstIndex(name, &atomIndex); + + // need to get to the index'th child atom of the right type + for (i = 0; i < m_pChildAtoms.Size(); i++) { + if (MP4NameFirstMatches(m_pChildAtoms[i]->GetType(), name)) { + if (atomIndex == 0) { + // this is the one, ask it to match + return m_pChildAtoms[i]->FindProperty(name, ppProperty, pIndex); + } + atomIndex--; + } + } + + VERBOSE_FIND(m_pFile->GetVerbosity(), + printf("FindProperty: no match for %s\n", name)); + return false; +} + +void MP4Atom::ReadProperties(u_int32_t startIndex, u_int32_t count) +{ + u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex); + + // read any properties of the atom + for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) { + + m_pProperties[i]->Read(m_pFile); + + if (m_pFile->GetPosition() > m_end) { + VERBOSE_READ(GetVerbosity(), + printf("ReadProperties: insufficient data for property: %s pos 0x"LLX" atom end 0x"LLX"\n", + m_pProperties[i]->GetName(), + m_pFile->GetPosition(), m_end)); + + throw new MP4Error("atom is too small", "Atom ReadProperties"); + } + + if (m_pProperties[i]->GetType() == TableProperty) { + VERBOSE_READ_TABLE(GetVerbosity(), + printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true)); + } else if (m_pProperties[i]->GetType() != DescriptorProperty) { + VERBOSE_READ(GetVerbosity(), + printf("Read: "); m_pProperties[i]->Dump(stdout, 0, true)); + } + } +} + +void MP4Atom::ReadChildAtoms() +{ + VERBOSE_READ(GetVerbosity(), + printf("ReadChildAtoms: of %s\n", m_type[0] ? m_type : "root")); + + // read any child atoms + while (m_pFile->GetPosition() < m_end) { + MP4Atom* pChildAtom = MP4Atom::ReadAtom(m_pFile, this); + + AddChildAtom(pChildAtom); + + MP4AtomInfo* pChildAtomInfo = FindAtomInfo(pChildAtom->GetType()); + + // if child atom is of known type + // but not expected here print warning + if (pChildAtomInfo == NULL && !pChildAtom->IsUnknownType()) { + VERBOSE_READ(GetVerbosity(), + printf("Warning: In atom %s unexpected child atom %s\n", + GetType(), pChildAtom->GetType())); + } + + // if child atoms should have just one instance + // and this is more than one, print warning + if (pChildAtomInfo) { + pChildAtomInfo->m_count++; + + if (pChildAtomInfo->m_onlyOne && pChildAtomInfo->m_count > 1) { + VERBOSE_READ(GetVerbosity(), + printf("Warning: In atom %s multiple child atoms %s\n", + GetType(), pChildAtom->GetType())); + } + } + } + + // if mandatory child atom doesn't exist, print warning + u_int32_t numAtomInfo = m_pChildAtomInfos.Size(); + for (u_int32_t i = 0; i < numAtomInfo; i++) { + if (m_pChildAtomInfos[i]->m_mandatory + && m_pChildAtomInfos[i]->m_count == 0) { + VERBOSE_READ(GetVerbosity(), + printf("Warning: In atom %s missing child atom %s\n", + GetType(), m_pChildAtomInfos[i]->m_name)); + } + } + + VERBOSE_READ(GetVerbosity(), + printf("ReadChildAtoms: finished %s\n", m_type)); +} + +MP4AtomInfo* MP4Atom::FindAtomInfo(const char* name) +{ + u_int32_t numAtomInfo = m_pChildAtomInfos.Size(); + for (u_int32_t i = 0; i < numAtomInfo; i++) { + if (ATOMID(m_pChildAtomInfos[i]->m_name) == ATOMID(name)) { + return m_pChildAtomInfos[i]; + } + } + return NULL; +} + +// generic write +void MP4Atom::Write() +{ + ASSERT(m_pFile); + + BeginWrite(); + + WriteProperties(); + + WriteChildAtoms(); + + FinishWrite(); +} + +void MP4Atom::BeginWrite(bool use64) +{ + m_start = m_pFile->GetPosition(); + //use64 = m_pFile->Use64Bits(); + if (use64) { + m_pFile->WriteUInt32(1); + } else { + m_pFile->WriteUInt32(0); + } + m_pFile->WriteBytes((u_int8_t*)&m_type[0], 4); + if (use64) { + m_pFile->WriteUInt64(0); + } + if (ATOMID(m_type) == ATOMID("uuid")) { + m_pFile->WriteBytes(m_extendedType, sizeof(m_extendedType)); + } +} + +void MP4Atom::FinishWrite(bool use64) +{ + m_end = m_pFile->GetPosition(); + m_size = (m_end - m_start); + //use64 = m_pFile->Use64Bits(); + if (use64) { + m_pFile->SetPosition(m_start + 8); + m_pFile->WriteUInt64(m_size); + } else { + ASSERT(m_size <= (u_int64_t)0xFFFFFFFF); + m_pFile->SetPosition(m_start); + m_pFile->WriteUInt32(m_size); + } + m_pFile->SetPosition(m_end); + + // adjust size to just reflect data portion of atom + m_size -= (use64 ? 16 : 8); + if (ATOMID(m_type) == ATOMID("uuid")) { + m_size -= sizeof(m_extendedType); + } +} + +void MP4Atom::WriteProperties(u_int32_t startIndex, u_int32_t count) +{ + u_int32_t numProperties = MIN(count, m_pProperties.Size() - startIndex); + + VERBOSE_WRITE(GetVerbosity(), + printf("Write: type %s\n", m_type)); + + for (u_int32_t i = startIndex; i < startIndex + numProperties; i++) { + m_pProperties[i]->Write(m_pFile); + + if (m_pProperties[i]->GetType() == TableProperty) { + VERBOSE_WRITE_TABLE(GetVerbosity(), + printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false)); + } else { + VERBOSE_WRITE(GetVerbosity(), + printf("Write: "); m_pProperties[i]->Dump(stdout, 0, false)); + } + } +} + +void MP4Atom::WriteChildAtoms() +{ + u_int32_t size = m_pChildAtoms.Size(); + for (u_int32_t i = 0; i < size; i++) { + m_pChildAtoms[i]->Write(); + } + + VERBOSE_WRITE(GetVerbosity(), + printf("Write: finished %s\n", m_type)); +} + +void MP4Atom::AddProperty(MP4Property* pProperty) +{ + ASSERT(pProperty); + m_pProperties.Add(pProperty); + pProperty->SetParentAtom(this); +} + +void MP4Atom::AddVersionAndFlags() +{ + AddProperty(new MP4Integer8Property("version")); + AddProperty(new MP4Integer24Property("flags")); +} + +void MP4Atom::AddReserved(char* name, u_int32_t size) +{ + MP4BytesProperty* pReserved = new MP4BytesProperty(name, size); + pReserved->SetReadOnly(); + AddProperty(pReserved); +} + +void MP4Atom::ExpectChildAtom(const char* name, bool mandatory, bool onlyOne) +{ + m_pChildAtomInfos.Add(new MP4AtomInfo(name, mandatory, onlyOne)); +} + +u_int8_t MP4Atom::GetVersion() +{ + if (strcmp("version", m_pProperties[0]->GetName())) { + return 0; + } + return ((MP4Integer8Property*)m_pProperties[0])->GetValue(); +} + +void MP4Atom::SetVersion(u_int8_t version) +{ + if (strcmp("version", m_pProperties[0]->GetName())) { + return; + } + ((MP4Integer8Property*)m_pProperties[0])->SetValue(version); +} + +u_int32_t MP4Atom::GetFlags() +{ + if (strcmp("flags", m_pProperties[1]->GetName())) { + return 0; + } + return ((MP4Integer24Property*)m_pProperties[1])->GetValue(); +} + +void MP4Atom::SetFlags(u_int32_t flags) +{ + if (strcmp("flags", m_pProperties[1]->GetName())) { + return; + } + ((MP4Integer24Property*)m_pProperties[1])->SetValue(flags); +} + +void MP4Atom::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) +{ + if (m_type[0] != '\0') { + Indent(pFile, indent); + fprintf(pFile, "type %s\n", m_type); + } + + u_int32_t i; + u_int32_t size; + + // dump our properties + size = m_pProperties.Size(); + for (i = 0; i < size; i++) { + + /* skip details of tables unless we're told to be verbose */ + if (m_pProperties[i]->GetType() == TableProperty + && !(GetVerbosity() & MP4_DETAILS_TABLE)) { + Indent(pFile, indent + 1); + fprintf(pFile, "\n"); + continue; + } + + m_pProperties[i]->Dump(pFile, indent + 1, dumpImplicits); + } + + // dump our children + size = m_pChildAtoms.Size(); + for (i = 0; i < size; i++) { + m_pChildAtoms[i]->Dump(pFile, indent + 1, dumpImplicits); + } +} + +u_int32_t MP4Atom::GetVerbosity() +{ + ASSERT(m_pFile); + return m_pFile->GetVerbosity(); +} + +u_int8_t MP4Atom::GetDepth() +{ + if (m_depth < 0xFF) { + return m_depth; + } + + MP4Atom *pAtom = this; + m_depth = 0; + + while ((pAtom = pAtom->GetParentAtom()) != NULL) { + m_depth++; + ASSERT(m_depth < 255); + } + return m_depth; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_nump.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_nump.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4NumpAtom::MP4NumpAtom() + : MP4Atom("nump") +{ + AddProperty( // packets sent + new MP4Integer64Property("packets")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mpeg4ip.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mpeg4ip.h @@ -0,0 +1,59 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MPEG4IP_INCLUDED__ +#define __MPEG4IP_INCLUDED__ + +/* project wide applicable stuff here */ + +#include +#include + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef __cplusplus +#ifndef bool +typedef unsigned char bool; +#endif +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef ROUND +# ifdef HAVE_RINT +# define ROUND(f) rint(f) +# else +# define ROUND(f) (int)(floor((f) + 0.5)) +# endif +#endif + +#endif /* __MPEG4IP_INCLUDED__ */ + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_meta.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_meta.cpp @@ -0,0 +1,197 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * M. Bakker mbakker at nero.com + * + * Apple iTunes META data + */ + +#include "mp4common.h" + +MP4MetaAtom::MP4MetaAtom() + : MP4Atom("meta") +{ + AddVersionAndFlags(); /* 0, 1 */ + + ExpectChildAtom("hdlr", Required, OnlyOne); + ExpectChildAtom("ilst", Required, OnlyOne); +} + +MP4MeanAtom::MP4MeanAtom() + : MP4Atom("mean") +{ + AddVersionAndFlags(); /* 0, 1 */ + + AddProperty( + new MP4BytesProperty("metadata")); /* 2 */ +} + +void MP4MeanAtom::Read() +{ + // calculate size of the metadata from the atom size + ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 4); + + MP4Atom::Read(); +} + +MP4NameAtom::MP4NameAtom() + : MP4Atom("name") +{ + AddVersionAndFlags(); /* 0, 1 */ + + AddProperty( + new MP4BytesProperty("metadata")); /* 2 */ +} + +void MP4NameAtom::Read() +{ + // calculate size of the metadata from the atom size + ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 4); + + MP4Atom::Read(); +} + +MP4DataAtom::MP4DataAtom() + : MP4Atom("data") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddReserved("reserved2", 4); /* 2 */ + + AddProperty( + new MP4BytesProperty("metadata")); /* 3 */ +} + +void MP4DataAtom::Read() +{ + // calculate size of the metadata from the atom size + ((MP4BytesProperty*)m_pProperties[3])->SetValueSize(m_size - 8); + + MP4Atom::Read(); +} + +MP4IlstAtom::MP4IlstAtom() + : MP4Atom("ilst") +{ + ExpectChildAtom("nam", Optional, OnlyOne); /* name */ + ExpectChildAtom("ART", Optional, OnlyOne); /* artist */ + ExpectChildAtom("wrt", Optional, OnlyOne); /* writer */ + ExpectChildAtom("alb", Optional, OnlyOne); /* album */ + ExpectChildAtom("day", Optional, OnlyOne); /* date */ + ExpectChildAtom("too", Optional, OnlyOne); /* tool */ + ExpectChildAtom("cmt", Optional, OnlyOne); /* comment */ + ExpectChildAtom("gen", Optional, OnlyOne); /* custom genre */ + ExpectChildAtom("trkn", Optional, OnlyOne); /* tracknumber */ + ExpectChildAtom("disk", Optional, OnlyOne); /* disknumber */ + ExpectChildAtom("gnre", Optional, OnlyOne); /* genre (ID3v1 index + 1) */ + ExpectChildAtom("cpil", Optional, OnlyOne); /* compilation */ + ExpectChildAtom("tmpo", Optional, OnlyOne); /* BPM */ + ExpectChildAtom("covr", Optional, OnlyOne); /* cover art */ + ExpectChildAtom("----", Optional, Many); /* ---- free form */ +} + +MP4DashAtom::MP4DashAtom() + : MP4Atom("----") +{ + ExpectChildAtom("mean", Required, OnlyOne); + ExpectChildAtom("name", Required, OnlyOne); + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4NamAtom::MP4NamAtom() + : MP4Atom("nam") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4ArtAtom::MP4ArtAtom() + : MP4Atom("ART") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4WrtAtom::MP4WrtAtom() + : MP4Atom("wrt") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4AlbAtom::MP4AlbAtom() + : MP4Atom("alb") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4CmtAtom::MP4CmtAtom() + : MP4Atom("cmt") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4TrknAtom::MP4TrknAtom() + : MP4Atom("trkn") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4DiskAtom::MP4DiskAtom() + : MP4Atom("disk") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4DayAtom::MP4DayAtom() + : MP4Atom("day") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4GenAtom::MP4GenAtom() + : MP4Atom("gen") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4TooAtom::MP4TooAtom() + : MP4Atom("too") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4GnreAtom::MP4GnreAtom() + : MP4Atom("gnre") +{ + ExpectChildAtom("data", Optional, OnlyOne); +} + +MP4CpilAtom::MP4CpilAtom() + : MP4Atom("cpil") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4TmpoAtom::MP4TmpoAtom() + : MP4Atom("tmpo") +{ + ExpectChildAtom("data", Required, OnlyOne); +} + +MP4CovrAtom::MP4CovrAtom() + : MP4Atom("covr") +{ + ExpectChildAtom("data", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_iKMS.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_iKMS.cpp @@ -0,0 +1,34 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Alix Marchandise-Franquet alix@cisco.com + * + * ISMAKMSBox for ISMACrypt + * Do we care about the string length? Do we need to handle the null-term + * issue like in the hdlr atom? + */ + +#include "mp4common.h" + +MP4IKMSAtom::MP4IKMSAtom() + : MP4Atom("iKMS") +{ + AddVersionAndFlags(); /* 0, 1 */ + MP4StringProperty* pProp = new MP4StringProperty("kms_URI"); + AddProperty(pProp); /* 2 */ +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_payt.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_payt.cpp @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4PaytAtom::MP4PaytAtom() + : MP4Atom("payt") +{ + AddProperty( + new MP4Integer32Property("payloadNumber")); + AddProperty( + new MP4StringProperty("rtpMap", Counted)); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mp4v.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mp4v.cpp @@ -0,0 +1,79 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Mp4vAtom::MP4Mp4vAtom() + : MP4Atom("mp4v") +{ + AddReserved("reserved1", 6); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer16Property("dataReferenceIndex")); + + AddReserved("reserved2", 16); /* 2 */ + + AddProperty( /* 3 */ + new MP4Integer16Property("width")); + AddProperty( /* 4 */ + new MP4Integer16Property("height")); + + AddReserved("reserved3", 14); /* 5 */ + + MP4StringProperty* pProp = + new MP4StringProperty("compressorName"); + pProp->SetFixedLength(32); + pProp->SetValue(""); + AddProperty(pProp); /* 6 */ + + AddReserved("reserved4", 4); /* 7 */ + + ExpectChildAtom("esds", Required, OnlyOne); +} + +void MP4Mp4vAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); + + // property reserved3 has non-zero fixed values + static u_int8_t reserved3[14] = { + 0x00, 0x48, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, + }; + m_pProperties[5]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[5])-> + SetValue(reserved3, sizeof(reserved3)); + m_pProperties[5]->SetReadOnly(true); + + // property reserved4 has non-zero fixed values + static u_int8_t reserved4[4] = { + 0x00, 0x18, 0xFF, 0xFF, + }; + m_pProperties[7]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[7])-> + SetValue(reserved4, sizeof(reserved4)); + m_pProperties[7]->SetReadOnly(true); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4container.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4container.h @@ -0,0 +1,84 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_CONTAINER_INCLUDED__ +#define __MP4_CONTAINER_INCLUDED__ + +// base class - container of mp4 properties +class MP4Container { +public: + MP4Container() { } + + virtual ~MP4Container(); + + void AddProperty(MP4Property* pProperty); + + virtual void Read(MP4File* pFile); + + virtual void Write(MP4File* pFile); + + virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); + + MP4Property* GetProperty(u_int32_t index) { + return m_pProperties[index]; + } + + // LATER MP4Property* GetProperty(const char* name); throw on error + // LATER MP4Property* FindProperty(const char* name, u_int32_t* pIndex = NULL); returns NULL on error + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + void FindIntegerProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + u_int64_t GetIntegerProperty(const char* name); + + void SetIntegerProperty(const char* name, u_int64_t value); + + void FindFloatProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + float GetFloatProperty(const char* name); + + void SetFloatProperty(const char* name, float value); + + void FindStringProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + const char* GetStringProperty(const char* name); + + void SetStringProperty(const char* name, const char* value); + + void FindBytesProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + void GetBytesProperty(const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize); + + void SetBytesProperty(const char* name, + const u_int8_t* pValue, u_int32_t valueSize); + +protected: + MP4PropertyArray m_pProperties; +}; + +#endif /* __MP4_CONTAINER_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_minf.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_minf.cpp @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MinfAtom::MP4MinfAtom() + : MP4Atom("minf") +{ + ExpectChildAtom("vmhd", Optional, OnlyOne); + ExpectChildAtom("smhd", Optional, OnlyOne); + ExpectChildAtom("hmhd", Optional, OnlyOne); + ExpectChildAtom("nmhd", Optional, OnlyOne); + ExpectChildAtom("dinf", Required, OnlyOne); + ExpectChildAtom("stbl", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/ocidescriptors.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/ocidescriptors.cpp @@ -0,0 +1,307 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4ContentClassDescriptor::MP4ContentClassDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4Integer32Property("classificationEntity")); + AddProperty( /* 1 */ + new MP4Integer16Property("classificationTable")); + AddProperty( /* 2 */ + new MP4BytesProperty("contentClassificationData")); +} + +void MP4ContentClassDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6); + + ReadProperties(pFile); +} + +MP4KeywordDescriptor::MP4KeywordDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("languageCode", 3)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("isUTF8String", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("reserved", 7)); + MP4Integer8Property* pCount = + new MP4Integer8Property("keywordCount"); + AddProperty(pCount); /* 3 */ + + MP4TableProperty* pTable = new MP4TableProperty("keywords", pCount); + AddProperty(pTable); /* 4 */ + + pTable->AddProperty( /* 4, 0 */ + new MP4StringProperty("string", Counted)); + + SetReadMutate(2); +} + +void MP4KeywordDescriptor::Mutate() +{ + bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + MP4Property* pProperty = + ((MP4TableProperty*)m_pProperties[4])->GetProperty(0); + ASSERT(pProperty); + ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); +} + +MP4RatingDescriptor::MP4RatingDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4Integer32Property("ratingEntity")); + AddProperty( /* 1 */ + new MP4Integer16Property("ratingCriteria")); + AddProperty( /* 2 */ + new MP4BytesProperty("ratingInfo")); +} + +void MP4RatingDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 6); + + ReadProperties(pFile); +} + +MP4LanguageDescriptor::MP4LanguageDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("languageCode", 3)); +} + +MP4ShortTextDescriptor::MP4ShortTextDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("languageCode", 3)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("isUTF8String", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("reserved", 7)); + AddProperty( /* 3 */ + new MP4StringProperty("eventName", Counted)); + AddProperty( /* 4 */ + new MP4StringProperty("eventText", Counted)); + + SetReadMutate(2); +} + +void MP4ShortTextDescriptor::Mutate() +{ + bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); + ((MP4StringProperty*)m_pProperties[4])->SetUnicode(!utf8Flag); +} + +MP4ExpandedTextDescriptor::MP4ExpandedTextDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("languageCode", 3)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("isUTF8String", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("reserved", 7)); + MP4Integer8Property* pCount = + new MP4Integer8Property("itemCount"); + AddProperty(pCount); /* 3 */ + + MP4TableProperty* pTable = new MP4TableProperty("items", pCount); + AddProperty(pTable); /* 4 */ + + pTable->AddProperty( /* Table 0 */ + new MP4StringProperty("itemDescription", Counted)); + pTable->AddProperty( /* Table 1 */ + new MP4StringProperty("itemText", Counted)); + + AddProperty( /* 5 */ + new MP4StringProperty("nonItemText")); + ((MP4StringProperty*)m_pProperties[5])->SetExpandedCountedFormat(true); + + SetReadMutate(2); +} + +void MP4ExpandedTextDescriptor::Mutate() +{ + bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + + MP4Property* pProperty = + ((MP4TableProperty*)m_pProperties[4])->GetProperty(0); + ASSERT(pProperty); + ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); + + pProperty = ((MP4TableProperty*)m_pProperties[4])->GetProperty(1); + ASSERT(pProperty); + ((MP4StringProperty*)pProperty)->SetUnicode(!utf8Flag); + + ((MP4StringProperty*)m_pProperties[5])->SetUnicode(!utf8Flag); +} + +class MP4CreatorTableProperty : public MP4TableProperty { +public: + MP4CreatorTableProperty(char* name, MP4Integer8Property* pCountProperty) : + MP4TableProperty(name, pCountProperty) { + }; +protected: + void ReadEntry(MP4File* pFile, u_int32_t index); + void WriteEntry(MP4File* pFile, u_int32_t index); +}; + +MP4CreatorDescriptor::MP4CreatorDescriptor(u_int8_t tag) + : MP4Descriptor(tag) +{ + MP4Integer8Property* pCount = + new MP4Integer8Property("creatorCount"); + AddProperty(pCount); /* 0 */ + + MP4TableProperty* pTable = new MP4CreatorTableProperty("creators", pCount); + AddProperty(pTable); /* 1 */ + + pTable->AddProperty( /* Table 0 */ + new MP4BytesProperty("languageCode", 3)); + pTable->AddProperty( /* Table 1 */ + new MP4BitfieldProperty("isUTF8String", 1)); + pTable->AddProperty( /* Table 2 */ + new MP4BitfieldProperty("reserved", 7)); + pTable->AddProperty( /* Table 3 */ + new MP4StringProperty("name", Counted)); +} + +void MP4CreatorTableProperty::ReadEntry(MP4File* pFile, u_int32_t index) +{ + m_pProperties[0]->Read(pFile, index); + m_pProperties[1]->Read(pFile, index); + + bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index); + ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); + + m_pProperties[2]->Read(pFile, index); + m_pProperties[3]->Read(pFile, index); +} + +void MP4CreatorTableProperty::WriteEntry(MP4File* pFile, u_int32_t index) +{ + bool utf8Flag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(index); + ((MP4StringProperty*)m_pProperties[3])->SetUnicode(!utf8Flag); + + MP4TableProperty::WriteEntry(pFile, index); +} + +MP4CreationDescriptor::MP4CreationDescriptor(u_int8_t tag) + : MP4Descriptor(tag) +{ + AddProperty( /* 0 */ + new MP4BitfieldProperty("contentCreationDate", 40)); +} + +MP4SmpteCameraDescriptor::MP4SmpteCameraDescriptor() + : MP4Descriptor() +{ + MP4Integer8Property* pCount = + new MP4Integer8Property("parameterCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("parameters", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer8Property("id")); + pTable->AddProperty( + new MP4Integer32Property("value")); +} + +MP4UnknownOCIDescriptor::MP4UnknownOCIDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("data")); +} + +void MP4UnknownOCIDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); + + ReadProperties(pFile); +} + +MP4Descriptor* CreateOCIDescriptor(u_int8_t tag) +{ + MP4Descriptor* pDescriptor = NULL; + + switch (tag) { + case MP4ContentClassDescrTag: + pDescriptor = new MP4ContentClassDescriptor(); + break; + case MP4KeywordDescrTag: + pDescriptor = new MP4KeywordDescriptor(); + break; + case MP4RatingDescrTag: + pDescriptor = new MP4RatingDescriptor(); + break; + case MP4LanguageDescrTag: + pDescriptor = new MP4LanguageDescriptor(); + break; + case MP4ShortTextDescrTag: + pDescriptor = new MP4ShortTextDescriptor(); + break; + case MP4ExpandedTextDescrTag: + pDescriptor = new MP4ExpandedTextDescriptor(); + break; + case MP4ContentCreatorDescrTag: + case MP4OCICreatorDescrTag: + pDescriptor = new MP4CreatorDescriptor(tag); + break; + case MP4ContentCreationDescrTag: + case MP4OCICreationDescrTag: + pDescriptor = new MP4CreationDescriptor(tag); + break; + case MP4SmpteCameraDescrTag: + pDescriptor = new MP4SmpteCameraDescriptor(); + break; + } + + if (pDescriptor == NULL) { + if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) { + pDescriptor = new MP4UnknownOCIDescriptor(); + pDescriptor->SetTag(tag); + } + } + + return pDescriptor; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_urn.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_urn.cpp @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4UrnAtom::MP4UrnAtom() + : MP4Atom("urn ") +{ + AddVersionAndFlags(); + AddProperty(new MP4StringProperty("name")); + AddProperty(new MP4StringProperty("location")); +} + +void MP4UrnAtom::Read() +{ + // read the version, flags, and name properties + ReadProperties(0, 3); + + // check if location is present + if (m_pFile->GetPosition() < GetEnd()) { + // read it + ReadProperties(3); + } + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stss.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stss.cpp @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StssAtom::MP4StssAtom() + : MP4Atom("stss") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("sampleNumber")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4descriptor.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4descriptor.cpp @@ -0,0 +1,211 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Descriptor::MP4Descriptor(u_int8_t tag) { + m_tag = tag; + m_pParentAtom = NULL; + m_start = 0; + m_size = 0; + m_readMutatePoint = 0; +} + +MP4Descriptor::~MP4Descriptor() +{ + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + delete m_pProperties[i]; + } +} + +void MP4Descriptor::AddProperty(MP4Property* pProperty) +{ + ASSERT(pProperty); + m_pProperties.Add(pProperty); + pProperty->SetParentAtom(m_pParentAtom); +} + +bool MP4Descriptor::FindContainedProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + u_int32_t numProperties = m_pProperties.Size(); + + for (u_int32_t i = 0; i < numProperties; i++) { + if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { + return true; + } + } + return false; +} + +void MP4Descriptor::Generate() +{ + // generate properties + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + m_pProperties[i]->Generate(); + } +} + +void MP4Descriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + ReadProperties(pFile, 0, m_readMutatePoint); + + Mutate(); + + ReadProperties(pFile, m_readMutatePoint); + + // flush any leftover read bits + pFile->FlushReadBits(); +} + +void MP4Descriptor::ReadHeader(MP4File* pFile) +{ + VERBOSE_READ(pFile->GetVerbosity(), + printf("ReadDescriptor: pos = 0x%llx\n", + pFile->GetPosition())); + + // read tag and length + u_int8_t tag = pFile->ReadUInt8(); + if (m_tag) { + ASSERT(tag == m_tag); + } else { + m_tag = tag; + } + m_size = pFile->ReadMpegLength(); + m_start = pFile->GetPosition(); + + VERBOSE_READ(pFile->GetVerbosity(), + printf("ReadDescriptor: tag 0x%02x data size %u (0x%x)\n", + m_tag, m_size, m_size)); +} + +void MP4Descriptor::ReadProperties(MP4File* pFile, + u_int32_t propStartIndex, u_int32_t propCount) +{ + u_int32_t numProperties = MIN(propCount, + m_pProperties.Size() - propStartIndex); + + for (u_int32_t i = propStartIndex; + i < propStartIndex + numProperties; i++) { + + MP4Property* pProperty = m_pProperties[i]; + + int32_t remaining = m_size - (pFile->GetPosition() - m_start); + + if (pProperty->GetType() == DescriptorProperty) { + if (remaining > 0) { + // place a limit on how far this sub-descriptor looks + ((MP4DescriptorProperty*)pProperty)->SetSizeLimit(remaining); + pProperty->Read(pFile); + } // else do nothing, empty descriptor + } else { + // non-descriptor property + if (remaining >= 0) { + pProperty->Read(pFile); + + if (pProperty->GetType() == TableProperty) { + VERBOSE_READ_TABLE(pFile->GetVerbosity(), + printf("Read: "); pProperty->Dump(stdout, 0, true)); + } else { + VERBOSE_READ(pFile->GetVerbosity(), + printf("Read: "); pProperty->Dump(stdout, 0, true)); + } + } else { + VERBOSE_ERROR(pFile->GetVerbosity(), + printf("Overran descriptor, tag %u data size %u property %u\n", + m_tag, m_size, i)); + throw new MP4Error("overran descriptor", + "MP4Descriptor::ReadProperties"); + } + } + } +} + +void MP4Descriptor::Write(MP4File* pFile) +{ + // call virtual function to adapt properties before writing + Mutate(); + + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + + // write tag and length placeholder + pFile->WriteUInt8(m_tag); + u_int64_t lengthPos = pFile->GetPosition(); + pFile->WriteMpegLength(0); + u_int64_t startPos = pFile->GetPosition(); + + for (u_int32_t i = 0; i < numProperties; i++) { + m_pProperties[i]->Write(pFile); + } + + // align with byte boundary (rarely necessary) + pFile->PadWriteBits(); + + // go back and write correct length + u_int64_t endPos = pFile->GetPosition(); + pFile->SetPosition(lengthPos); + pFile->WriteMpegLength(endPos - startPos); + pFile->SetPosition(endPos); +} + +void MP4Descriptor::WriteToMemory(MP4File* pFile, + u_int8_t** ppBytes, u_int64_t* pNumBytes) +{ + // use memory buffer to save descriptor in memory + // instead of going directly to disk + + pFile->EnableMemoryBuffer(); + + Write(pFile); + + pFile->DisableMemoryBuffer(ppBytes, pNumBytes); +} + +void MP4Descriptor::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) +{ + // call virtual function to adapt properties before dumping + Mutate(); + + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + for (u_int32_t i = 0; i < numProperties; i++) { + m_pProperties[i]->Dump(pFile, indent, dumpImplicits); + } +} + +u_int8_t MP4Descriptor::GetDepth() +{ + if (m_pParentAtom) { + return m_pParentAtom->GetDepth(); + } + return 0; +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/ocidescriptors.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/ocidescriptors.h @@ -0,0 +1,101 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __OCIDESCRIPTORS_INCLUDED__ +#define __OCIDESCRIPTORS_INCLUDED__ + +const u_int8_t MP4OCIDescrTagsStart = 0x40; +const u_int8_t MP4ContentClassDescrTag = 0x40; +const u_int8_t MP4KeywordDescrTag = 0x41; +const u_int8_t MP4RatingDescrTag = 0x42; +const u_int8_t MP4LanguageDescrTag = 0x43; +const u_int8_t MP4ShortTextDescrTag = 0x44; +const u_int8_t MP4ExpandedTextDescrTag = 0x45; +const u_int8_t MP4ContentCreatorDescrTag = 0x46; +const u_int8_t MP4ContentCreationDescrTag = 0x47; +const u_int8_t MP4OCICreatorDescrTag = 0x48; +const u_int8_t MP4OCICreationDescrTag = 0x49; +const u_int8_t MP4SmpteCameraDescrTag = 0x4A; +const u_int8_t MP4OCIDescrTagsEnd = 0x5F; + +class MP4ContentClassDescriptor : public MP4Descriptor { +public: + MP4ContentClassDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4KeywordDescriptor : public MP4Descriptor { +public: + MP4KeywordDescriptor(); +protected: + void Mutate(); +}; + +class MP4RatingDescriptor : public MP4Descriptor { +public: + MP4RatingDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4LanguageDescriptor : public MP4Descriptor { +public: + MP4LanguageDescriptor(); +}; + +class MP4ShortTextDescriptor : public MP4Descriptor { +public: + MP4ShortTextDescriptor(); +protected: + void Mutate(); +}; + +class MP4ExpandedTextDescriptor : public MP4Descriptor { +public: + MP4ExpandedTextDescriptor(); +protected: + void Mutate(); +}; + +class MP4CreatorDescriptor : public MP4Descriptor { +public: + MP4CreatorDescriptor(u_int8_t tag); +}; + +class MP4CreationDescriptor : public MP4Descriptor { +public: + MP4CreationDescriptor(u_int8_t tag); +}; + +class MP4SmpteCameraDescriptor : public MP4Descriptor { +public: + MP4SmpteCameraDescriptor(); +}; + +class MP4UnknownOCIDescriptor : public MP4Descriptor { +public: + MP4UnknownOCIDescriptor(); + void Read(MP4File* pFile); +}; + + +extern MP4Descriptor *CreateOCIDescriptor(u_int8_t tag); + +#endif /* __OCIDESCRIPTORS_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stbl.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stbl.cpp @@ -0,0 +1,57 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StblAtom::MP4StblAtom() + : MP4Atom("stbl") +{ + ExpectChildAtom("stsd", Required, OnlyOne); + ExpectChildAtom("stts", Required, OnlyOne); + ExpectChildAtom("ctts", Optional, OnlyOne); + ExpectChildAtom("stsz", Required, OnlyOne); + ExpectChildAtom("stsc", Required, OnlyOne); + ExpectChildAtom("stco", Optional, OnlyOne); + ExpectChildAtom("co64", Optional, OnlyOne); + ExpectChildAtom("stss", Optional, OnlyOne); + ExpectChildAtom("stsh", Optional, OnlyOne); + ExpectChildAtom("stdp", Optional, OnlyOne); +} + +void MP4StblAtom::Generate() +{ + // as usual + MP4Atom::Generate(); + + // but we also need one of the chunk offset atoms + MP4Atom* pChunkOffsetAtom; + if (m_pFile->Use64Bits()) { + pChunkOffsetAtom = CreateAtom("co64"); + } else { + pChunkOffsetAtom = CreateAtom("stco"); + } + + AddChildAtom(pChunkOffsetAtom); + + // and ask it to self generate + pChunkOffsetAtom->Generate(); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mvex.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mvex.cpp @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MvexAtom::MP4MvexAtom() + : MP4Atom("mvex") +{ + ExpectChildAtom("trex", Required, Many); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mfhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mfhd.cpp @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MfhdAtom::MP4MfhdAtom() + : MP4Atom("mfhd") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4Integer32Property("sequenceNumber")); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v260.vcproj +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v260.vcproj @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_hinf.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_hinf.cpp @@ -0,0 +1,57 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4HinfAtom::MP4HinfAtom() + : MP4Atom("hinf") +{ + ExpectChildAtom("trpy", Optional, OnlyOne); + ExpectChildAtom("nump", Optional, OnlyOne); + ExpectChildAtom("tpyl", Optional, OnlyOne); + ExpectChildAtom("maxr", Optional, Many); + ExpectChildAtom("dmed", Optional, OnlyOne); + ExpectChildAtom("dimm", Optional, OnlyOne); + ExpectChildAtom("drep", Optional, OnlyOne); + ExpectChildAtom("tmin", Optional, OnlyOne); + ExpectChildAtom("tmax", Optional, OnlyOne); + ExpectChildAtom("pmax", Optional, OnlyOne); + ExpectChildAtom("dmax", Optional, OnlyOne); + ExpectChildAtom("payt", Optional, OnlyOne); +} + +void MP4HinfAtom::Generate() +{ + // hinf is special in that although all it's child atoms + // are optional (on read), if we generate it for writing + // we really want all the children + + for (u_int32_t i = 0; i < m_pChildAtomInfos.Size(); i++) { + MP4Atom* pChildAtom = + CreateAtom(m_pChildAtomInfos[i]->m_name); + + AddChildAtom(pChildAtom); + + // and ask it to self generate + pChildAtom->Generate(); + } +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/odcommands.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/odcommands.cpp @@ -0,0 +1,104 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4ODUpdateDescriptor::MP4ODUpdateDescriptor() + : MP4Descriptor(MP4ODUpdateODCommandTag) +{ + // just a container for ObjectDescriptors + AddProperty( /* 0 */ + new MP4DescriptorProperty(NULL, + MP4FileODescrTag, 0, Required, Many)); +} + +MP4ODRemoveDescriptor::MP4ODRemoveDescriptor() + : MP4Descriptor(MP4ODRemoveODCommandTag) +{ + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + pCount->SetImplicit(); + AddProperty(pCount); /* 0 */ + + MP4TableProperty* pTable = + new MP4TableProperty("entries", pCount); + AddProperty(pTable); /* 1 */ + + pTable->AddProperty( /* 1, 0 */ + new MP4BitfieldProperty("objectDescriptorId", 10)); +} + +void MP4ODRemoveDescriptor::Read(MP4File* pFile) +{ + // table entry count computed from descriptor size + ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(false); + ((MP4Integer32Property*)m_pProperties[0])->SetValue((m_size * 8) / 10); + ((MP4Integer32Property*)m_pProperties[0])->SetReadOnly(true); + + MP4Descriptor::Read(pFile); +} + +MP4ESUpdateDescriptor::MP4ESUpdateDescriptor() + : MP4Descriptor(MP4ESUpdateODCommandTag) +{ + AddProperty( /* 0 */ + new MP4BitfieldProperty("objectDescriptorId", 10)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("pad", 6)); + AddProperty( /* 2 */ + new MP4DescriptorProperty("esIdRefs", + MP4ESIDRefDescrTag, 0, Required, Many)); +} + +// LATER might be able to combine with ESUpdateDescriptor +MP4ESRemoveDescriptor::MP4ESRemoveDescriptor() + : MP4Descriptor(MP4ESRemoveODCommandTag) +{ + AddProperty( /* 0 */ + new MP4BitfieldProperty("objectDescriptorId", 10)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("pad", 6)); + AddProperty( /* 2 */ + new MP4DescriptorProperty("esIdRefs", + MP4ESIDRefDescrTag, 0, Required, Many)); +} + +MP4Descriptor* CreateODCommand(u_int8_t tag) +{ + MP4Descriptor* pDescriptor = NULL; + + switch (tag) { + case MP4ODUpdateODCommandTag: + pDescriptor = new MP4ODUpdateDescriptor(); + break; + case MP4ODRemoveODCommandTag: + pDescriptor = new MP4ODRemoveDescriptor(); + break; + case MP4ESUpdateODCommandTag: + pDescriptor = new MP4ESUpdateDescriptor(); + break; + case MP4ESRemoveODCommandTag: + pDescriptor = new MP4ESRemoveDescriptor(); + break; + } + return pDescriptor; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4container.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4container.cpp @@ -0,0 +1,227 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Container::~MP4Container() +{ + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + delete m_pProperties[i]; + } +} + +void MP4Container::AddProperty(MP4Property* pProperty) +{ + ASSERT(pProperty); + m_pProperties.Add(pProperty); +} + +bool MP4Container::FindProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (pIndex) { + *pIndex = 0; // set the default answer for index + } + + u_int32_t numProperties = m_pProperties.Size(); + + for (u_int32_t i = 0; i < numProperties; i++) { + if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { + return true; + } + } + return false; +} + +void MP4Container::FindIntegerProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property", + "MP4Container::FindIntegerProperty"); + } + + switch ((*ppProperty)->GetType()) { + case Integer8Property: + case Integer16Property: + case Integer24Property: + case Integer32Property: + case Integer64Property: + break; + default: + throw new MP4Error("type mismatch", + "MP4Container::FindIntegerProperty"); + } +} + +u_int64_t MP4Container::GetIntegerProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindIntegerProperty(name, &pProperty, &index); + + return ((MP4IntegerProperty*)pProperty)->GetValue(index); +} + +void MP4Container::SetIntegerProperty(const char* name, u_int64_t value) +{ + MP4Property* pProperty = NULL; + u_int32_t index = 0; + + FindIntegerProperty(name, &pProperty, &index); + + ((MP4IntegerProperty*)pProperty)->SetValue(value, index); +} + +void MP4Container::FindFloatProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property", + "MP4Container::FindFloatProperty"); + } + if ((*ppProperty)->GetType() != Float32Property) { + throw new MP4Error("type mismatch", + "MP4Container::FindFloatProperty"); + } +} + +float MP4Container::GetFloatProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindFloatProperty(name, &pProperty, &index); + + return ((MP4Float32Property*)pProperty)->GetValue(index); +} + +void MP4Container::SetFloatProperty(const char* name, float value) +{ + MP4Property* pProperty; + u_int32_t index; + + FindFloatProperty(name, &pProperty, &index); + + ((MP4Float32Property*)pProperty)->SetValue(value, index); +} + +void MP4Container::FindStringProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property", + "MP4Container::FindStringProperty"); + } + if ((*ppProperty)->GetType() != StringProperty) { + throw new MP4Error("type mismatch", + "MP4Container::FindStringProperty"); + } +} + +const char* MP4Container::GetStringProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindStringProperty(name, &pProperty, &index); + + return ((MP4StringProperty*)pProperty)->GetValue(index); +} + +void MP4Container::SetStringProperty(const char* name, const char* value) +{ + MP4Property* pProperty; + u_int32_t index; + + FindStringProperty(name, &pProperty, &index); + + ((MP4StringProperty*)pProperty)->SetValue(value, index); +} + +void MP4Container::FindBytesProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property", + "MP4Container::FindBytesProperty"); + } + if ((*ppProperty)->GetType() != BytesProperty) { + throw new MP4Error("type mismatch", + "MP4Container::FindBytesProperty"); + } +} + +void MP4Container::GetBytesProperty(const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + MP4Property* pProperty; + u_int32_t index; + + FindBytesProperty(name, &pProperty, &index); + + ((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index); +} + +void MP4Container::SetBytesProperty(const char* name, + const u_int8_t* pValue, u_int32_t valueSize) +{ + MP4Property* pProperty; + u_int32_t index; + + FindBytesProperty(name, &pProperty, &index); + + ((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index); +} + +void MP4Container::Read(MP4File* pFile) +{ + u_int32_t numProperties = m_pProperties.Size(); + + for (u_int32_t i = 0; i < numProperties; i++) { + m_pProperties[i]->Read(pFile); + } +} + +void MP4Container::Write(MP4File* pFile) +{ + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + + for (u_int32_t i = 0; i < numProperties; i++) { + m_pProperties[i]->Write(pFile); + } +} + +void MP4Container::Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits) +{ + u_int32_t numProperties = m_pProperties.Size(); + + for (u_int32_t i = 0; i < numProperties; i++) { + m_pProperties[i]->Dump(pFile, indent, dumpImplicits); + } +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/TODO +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/TODO @@ -0,0 +1,11 @@ + +Extended format (v2) support + +Means to dump all possible atoms/properties with types + +Wrap printf's for verbosity - see example is player/lib/http/http_util.c + +Distinguish cases of no ES Config and error parsing esds + +Improve error recovery when length of atom/descriptor is larger than parent/file, resync on parent. + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_moof.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_moof.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MoofAtom::MP4MoofAtom() + : MP4Atom("moof") +{ + ExpectChildAtom("mfhd", Required, OnlyOne); + ExpectChildAtom("traf", Optional, Many); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_udta.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_udta.cpp @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4UdtaAtom::MP4UdtaAtom() + : MP4Atom("udta") +{ + ExpectChildAtom("cprt", Optional, Many); + ExpectChildAtom("hnti", Optional, OnlyOne); + ExpectChildAtom("meta", Optional, OnlyOne); +} + +void MP4UdtaAtom::Read() +{ + if (ATOMID(m_pParentAtom->GetType()) == ATOMID("trak")) { + ExpectChildAtom("hinf", Optional, OnlyOne); + } + + MP4Atom::Read(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4file.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4file.h @@ -0,0 +1,719 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#ifndef __MP4_FILE_INCLUDED__ +#define __MP4_FILE_INCLUDED__ + +// forward declarations +class MP4Atom; +class MP4Property; +class MP4Float32Property; +class MP4StringProperty; +class MP4BytesProperty; +class MP4Descriptor; +class MP4DescriptorProperty; + + +#ifdef USE_FILE_CALLBACKS +typedef u_int32_t (*MP4OpenCallback)(const char *pName, const char *mode, void *userData); +typedef void (*MP4CloseCallback)(void *userData); +typedef u_int32_t (*MP4ReadCallback)(void *pBuffer, unsigned int nBytesToRead, void *userData); +typedef u_int32_t (*MP4WriteCallback)(void *pBuffer, unsigned int nBytesToWrite, void *userData); +typedef int32_t (*MP4SetposCallback)(u_int32_t pos, void *userData); +typedef int64_t (*MP4GetposCallback)(void *userData); +typedef int64_t (*MP4FilesizeCallback)(void *userData); +#endif + + +class MP4File { +public: /* equivalent to MP4 library API */ + MP4File(u_int32_t verbosity = 0); + ~MP4File(); + + /* file operations */ + void Read(const char* fileName); + void Create(const char* fileName, bool use64bits); + void Modify(const char* fileName); + void Optimize(const char* orgFileName, + const char* newFileName = NULL); + void Dump(FILE* pDumpFile = NULL, bool dumpImplicits = false); + void Close(); + + /* library property per file */ + + u_int32_t GetVerbosity() { + return m_verbosity; + } + void SetVerbosity(u_int32_t verbosity) { + m_verbosity = verbosity; + } + + bool Use64Bits() { + return m_use64bits; + } + + /* file properties */ + + u_int64_t GetIntegerProperty(const char* name); + float GetFloatProperty(const char* name); + const char* GetStringProperty(const char* name); + void GetBytesProperty(const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize); + + void SetIntegerProperty(const char* name, u_int64_t value); + void SetFloatProperty(const char* name, float value); + void SetStringProperty(const char* name, const char* value); + void SetBytesProperty(const char* name, + const u_int8_t* pValue, u_int32_t valueSize); + + // file level convenience functions + + MP4Duration GetDuration(); + void SetDuration(MP4Duration value); + + u_int32_t GetTimeScale(); + void SetTimeScale(u_int32_t value); + + u_int8_t GetODProfileLevel(); + void SetODProfileLevel(u_int8_t value); + + u_int8_t GetSceneProfileLevel(); + void SetSceneProfileLevel(u_int8_t value); + + u_int8_t GetVideoProfileLevel(); + void SetVideoProfileLevel(u_int8_t value); + + u_int8_t GetAudioProfileLevel(); + void SetAudioProfileLevel(u_int8_t value); + + u_int8_t GetGraphicsProfileLevel(); + void SetGraphicsProfileLevel(u_int8_t value); + + const char* GetSessionSdp(); + void SetSessionSdp(const char* sdpString); + void AppendSessionSdp(const char* sdpString); + + /* track operations */ + + MP4TrackId AddTrack(const char* type, u_int32_t timeScale = 1000); + void DeleteTrack(MP4TrackId trackId); + + u_int32_t GetNumberOfTracks(const char* type = NULL, u_int8_t subType = 0); + + MP4TrackId AllocTrackId(); + MP4TrackId FindTrackId(u_int16_t trackIndex, + const char* type = NULL, u_int8_t subType = 0); + u_int16_t FindTrackIndex(MP4TrackId trackId); + u_int16_t FindTrakAtomIndex(MP4TrackId trackId); + + /* track properties */ + + u_int64_t GetTrackIntegerProperty( + MP4TrackId trackId, const char* name); + float GetTrackFloatProperty( + MP4TrackId trackId, const char* name); + const char* GetTrackStringProperty( + MP4TrackId trackId, const char* name); + void GetTrackBytesProperty( + MP4TrackId trackId, const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize); + + void SetTrackIntegerProperty( + MP4TrackId trackId, const char* name, int64_t value); + void SetTrackFloatProperty( + MP4TrackId trackId, const char* name, float value); + void SetTrackStringProperty( + MP4TrackId trackId, const char* name, const char* value); + void SetTrackBytesProperty( + MP4TrackId trackId, const char* name, + const u_int8_t* pValue, u_int32_t valueSize); + + /* sample operations */ + + u_int32_t GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId); + + u_int32_t GetTrackMaxSampleSize(MP4TrackId trackId); + + MP4SampleId GetSampleIdFromTime(MP4TrackId trackId, + MP4Timestamp when, bool wantSyncSample = false); + + MP4Timestamp GetSampleTime( + MP4TrackId trackId, MP4SampleId sampleId); + + MP4Duration GetSampleDuration( + MP4TrackId trackId, MP4SampleId sampleId); + + MP4Duration GetSampleRenderingOffset( + MP4TrackId trackId, MP4SampleId sampleId); + + bool GetSampleSync( + MP4TrackId trackId, MP4SampleId sampleId); + + void ReadSample( + // input parameters + MP4TrackId trackId, + MP4SampleId sampleId, + // output parameters + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime = NULL, + MP4Duration* pDuration = NULL, + MP4Duration* pRenderingOffset = NULL, + bool* pIsSyncSample = NULL); + + void WriteSample( + MP4TrackId trackId, + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration = 0, + MP4Duration renderingOffset = 0, + bool isSyncSample = true); + + void SetSampleRenderingOffset( + MP4TrackId trackId, + MP4SampleId sampleId, + MP4Duration renderingOffset); + + /* track level convenience functions */ + + MP4TrackId AddSystemsTrack(const char* type); + + MP4TrackId AddODTrack(); + + MP4TrackId AddSceneTrack(); + + MP4TrackId AddAudioTrack( + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType); + + MP4TrackId AddEncAudioTrack( // ismacrypt + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType); + + MP4TrackId AddVideoTrack( + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType); + + MP4TrackId AddEncVideoTrack( // ismacrypt + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType); + + MP4TrackId AddHintTrack(MP4TrackId refTrackId); + + MP4SampleId GetTrackNumberOfSamples(MP4TrackId trackId); + + const char* GetTrackType(MP4TrackId trackId); + + MP4Duration GetTrackDuration(MP4TrackId trackId); + + u_int32_t GetTrackTimeScale(MP4TrackId trackId); + void SetTrackTimeScale(MP4TrackId trackId, u_int32_t value); + + // replacement to GetTrackAudioType and GetTrackVideoType + u_int8_t GetTrackEsdsObjectTypeId(MP4TrackId trackId); + + u_int8_t GetTrackAudioType(MP4TrackId trackId); + u_int8_t GetTrackAudioMpeg4Type(MP4TrackId trackId); + u_int8_t GetTrackVideoType(MP4TrackId trackId); + + MP4Duration GetTrackFixedSampleDuration(MP4TrackId trackId); + + float GetTrackVideoFrameRate(MP4TrackId trackId); + + void GetTrackESConfiguration(MP4TrackId trackId, + u_int8_t** ppConfig, u_int32_t* pConfigSize); + void SetTrackESConfiguration(MP4TrackId trackId, + const u_int8_t* pConfig, u_int32_t configSize); + + const char* GetHintTrackSdp(MP4TrackId hintTrackId); + void SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString); + void AppendHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString); + + // ISMA specific functions + + void MakeIsmaCompliant(bool addIsmaComplianceSdp = true); + + void CreateIsmaIodFromParams( + u_int8_t videoProfile, + u_int32_t videoBitrate, + u_int8_t* videoConfig, + u_int32_t videoConfigLength, + u_int8_t audioProfile, + u_int32_t audioBitrate, + u_int8_t* audioConfig, + u_int32_t audioConfigLength, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + + // time convenience functions + + u_int64_t ConvertFromMovieDuration( + MP4Duration duration, + u_int32_t timeScale); + + u_int64_t ConvertFromTrackTimestamp( + MP4TrackId trackId, + MP4Timestamp timeStamp, + u_int32_t timeScale); + + MP4Timestamp ConvertToTrackTimestamp( + MP4TrackId trackId, + u_int64_t timeStamp, + u_int32_t timeScale); + + u_int64_t ConvertFromTrackDuration( + MP4TrackId trackId, + MP4Duration duration, + u_int32_t timeScale); + + MP4Duration ConvertToTrackDuration( + MP4TrackId trackId, + u_int64_t duration, + u_int32_t timeScale); + + // specialized operations + + void GetHintTrackRtpPayload( + MP4TrackId hintTrackId, + char** ppPayloadName = NULL, + u_int8_t* pPayloadNumber = NULL, + u_int16_t* pMaxPayloadSize = NULL, + char **ppEncodingParams = NULL); + + void SetHintTrackRtpPayload( + MP4TrackId hintTrackId, + const char* payloadName, + u_int8_t* pPayloadNumber, + u_int16_t maxPayloadSize, + const char *encoding_params, + bool include_rtp_map, + bool include_mpeg4_esid); + + MP4TrackId GetHintTrackReferenceTrackId( + MP4TrackId hintTrackId); + + void ReadRtpHint( + MP4TrackId hintTrackId, + MP4SampleId hintSampleId, + u_int16_t* pNumPackets = NULL); + + u_int16_t GetRtpHintNumberOfPackets( + MP4TrackId hintTrackId); + + int8_t GetRtpPacketBFrame( + MP4TrackId hintTrackId, + u_int16_t packetIndex); + + int32_t GetRtpPacketTransmitOffset( + MP4TrackId hintTrackId, + u_int16_t packetIndex); + + void ReadRtpPacket( + MP4TrackId hintTrackId, + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc = 0, + bool includeHeader = true, + bool includePayload = true); + + MP4Timestamp GetRtpTimestampStart( + MP4TrackId hintTrackId); + + void SetRtpTimestampStart( + MP4TrackId hintTrackId, + MP4Timestamp rtpStart); + + void AddRtpHint( + MP4TrackId hintTrackId, + bool isBframe, + u_int32_t timestampOffset); + + void AddRtpPacket( + MP4TrackId hintTrackId, + bool setMbit, + int32_t transmitOffset); + + void AddRtpImmediateData( + MP4TrackId hintTrackId, + const u_int8_t* pBytes, + u_int32_t numBytes); + + void AddRtpSampleData( + MP4TrackId hintTrackId, + MP4SampleId sampleId, + u_int32_t dataOffset, + u_int32_t dataLength); + + void AddRtpESConfigurationPacket( + MP4TrackId hintTrackId); + + void WriteRtpHint( + MP4TrackId hintTrackId, + MP4Duration duration, + bool isSyncSample); + + u_int8_t AllocRtpPayloadNumber(); + + // edit list related + + char* MakeTrackEditName( + MP4TrackId trackId, + MP4EditId editId, + const char* name); + + MP4EditId AddTrackEdit( + MP4TrackId trackId, + MP4EditId editId = MP4_INVALID_EDIT_ID); + + void DeleteTrackEdit( + MP4TrackId trackId, + MP4EditId editId); + + u_int32_t GetTrackNumberOfEdits( + MP4TrackId trackId); + + MP4Timestamp GetTrackEditStart( + MP4TrackId trackId, + MP4EditId editId); + + MP4Duration GetTrackEditTotalDuration( + MP4TrackId trackId, + MP4EditId editId); + + MP4Timestamp GetTrackEditMediaStart( + MP4TrackId trackId, + MP4EditId editId); + + void SetTrackEditMediaStart( + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime); + + MP4Duration GetTrackEditDuration( + MP4TrackId trackId, + MP4EditId editId); + + void SetTrackEditDuration( + MP4TrackId trackId, + MP4EditId editId, + MP4Duration duration); + + bool GetTrackEditDwell( + MP4TrackId trackId, + MP4EditId editId); + + void SetTrackEditDwell( + MP4TrackId trackId, + MP4EditId editId, + bool dwell); + + MP4SampleId GetSampleIdFromEditTime( + MP4TrackId trackId, + MP4Timestamp when, + MP4Timestamp* pStartTime = NULL, + MP4Duration* pDuration = NULL); + + /* iTunes metadata handling */ + bool CreateMetadataAtom(const char* name); + bool MetadataDelete(); + + /* set metadata */ + bool SetMetadataName(const char* value); + bool SetMetadataWriter(const char* value); + bool SetMetadataAlbum(const char* value); + bool SetMetadataArtist(const char* value); + bool SetMetadataTool(const char* value); + bool SetMetadataComment(const char* value); + bool SetMetadataYear(const char* value); + bool SetMetadataTrack(u_int16_t track, u_int16_t totalTracks); + bool SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks); + bool SetMetadataGenre(const char* genreIndex); + bool SetMetadataTempo(u_int16_t tempo); + bool SetMetadataCompilation(u_int8_t compilation); + bool SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size); + bool SetMetadataFreeForm(char *name, u_int8_t* pValue, u_int32_t valueSize); + + /* get metadata */ + bool GetMetadataByIndex(u_int32_t index, + const char** ppName, + u_int8_t** ppValue, u_int32_t* pValueSize); + bool GetMetadataName(char** value); + bool GetMetadataWriter(char** value); + bool GetMetadataAlbum(char** value); + bool GetMetadataArtist(char** value); + bool GetMetadataTool(char** value); + bool GetMetadataComment(char** value); + bool GetMetadataYear(char** value); + bool GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks); + bool GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks); + bool GetMetadataGenre(char** genre); + bool GetMetadataTempo(u_int16_t* tempo); + bool GetMetadataCompilation(u_int8_t* compilation); + bool GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t* size); + bool GetMetadataFreeForm(char *name, u_int8_t** pValue, u_int32_t* valueSize); + + + /* end of MP4 API */ + + /* "protected" interface to be used only by friends in library */ + + u_int64_t GetPosition(FILE* pFile = NULL); + void SetPosition(u_int64_t pos, FILE* pFile = NULL); + + u_int64_t GetSize(); + + u_int32_t ReadBytes( + u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); + u_int64_t ReadUInt(u_int8_t size); + u_int8_t ReadUInt8(); + u_int16_t ReadUInt16(); + u_int32_t ReadUInt24(); + u_int32_t ReadUInt32(); + u_int64_t ReadUInt64(); + float ReadFixed16(); + float ReadFixed32(); + float ReadFloat(); + char* ReadString(); + char* ReadCountedString( + u_int8_t charSize = 1, bool allowExpandedCount = false); + u_int64_t ReadBits(u_int8_t numBits); + void FlushReadBits(); + u_int32_t ReadMpegLength(); + + u_int32_t PeekBytes( + u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); + + void WriteBytes(u_int8_t* pBytes, u_int32_t numBytes, FILE* pFile = NULL); + void WriteUInt(u_int64_t value, u_int8_t size); + void WriteUInt8(u_int8_t value); + void WriteUInt16(u_int16_t value); + void WriteUInt24(u_int32_t value); + void WriteUInt32(u_int32_t value); + void WriteUInt64(u_int64_t value); + void WriteFixed16(float value); + void WriteFixed32(float value); + void WriteFloat(float value); + void WriteString(char* string); + void WriteCountedString(char* string, + u_int8_t charSize = 1, bool allowExpandedCount = false); + void WriteBits(u_int64_t bits, u_int8_t numBits); + void PadWriteBits(u_int8_t pad = 0); + void FlushWriteBits(); + void WriteMpegLength(u_int32_t value, bool compact = false); + + void EnableMemoryBuffer( + u_int8_t* pBytes = NULL, u_int64_t numBytes = 0); + void DisableMemoryBuffer( + u_int8_t** ppBytes = NULL, u_int64_t* pNumBytes = NULL); + + char GetMode() { + return m_mode; + } + + MP4Track* GetTrack(MP4TrackId trackId); + + MP4Duration UpdateDuration(MP4Duration duration); + + MP4Atom* FindAtom(const char* name); + + MP4Atom* AddChildAtom( + const char* parentName, + const char* childName); + + MP4Atom* AddChildAtom( + MP4Atom* pParentAtom, + const char* childName); + + MP4Atom* InsertChildAtom( + const char* parentName, + const char* childName, + u_int32_t index); + + MP4Atom* InsertChildAtom( + MP4Atom* pParentAtom, + const char* childName, + u_int32_t index); + + MP4Atom* AddDescendantAtoms( + const char* ancestorName, + const char* childName); + + MP4Atom* AddDescendantAtoms( + MP4Atom* pAncestorAtom, + const char* childName); + +#ifdef USE_FILE_CALLBACKS + MP4OpenCallback m_MP4fopen; + MP4CloseCallback m_MP4fclose; + MP4ReadCallback m_MP4fread; + MP4WriteCallback m_MP4fwrite; + MP4SetposCallback m_MP4fsetpos; + MP4GetposCallback m_MP4fgetpos; + MP4FilesizeCallback m_MP4filesize; + + void *m_userData; +#endif + +protected: + void Open(const char* fmode); + void ReadFromFile(); + void GenerateTracks(); + void BeginWrite(); + void FinishWrite(); + void CacheProperties(); + void RewriteMdat(FILE* pReadFile, FILE* pWriteFile); + + const char* TempFileName(); + void Rename(const char* existingFileName, const char* newFileName); + + void ProtectWriteOperation(char* where); + + void FindIntegerProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + void FindFloatProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + void FindStringProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + void FindBytesProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + void AddTrackToIod(MP4TrackId trackId); + + void RemoveTrackFromIod(MP4TrackId trackId); + + void AddTrackToOd(MP4TrackId trackId); + + void RemoveTrackFromOd(MP4TrackId trackId); + + void GetTrackReferenceProperties(const char* trefName, + MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty); + + void AddTrackReference(const char* trefName, MP4TrackId refTrackId); + + u_int32_t FindTrackReference(const char* trefName, MP4TrackId refTrackId); + + void RemoveTrackReference(const char* trefName, MP4TrackId refTrackId); + + void AddDataReference(MP4TrackId trackId, const char* url); + + char* MakeTrackName(MP4TrackId trackId, const char* name); + + u_int8_t ConvertTrackTypeToStreamType(const char* trackType); + + void CreateIsmaIodFromFile( + MP4TrackId odTrackId, + MP4TrackId sceneTrackId, + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + + MP4Descriptor* CreateESD( + MP4DescriptorProperty* pEsProperty, + u_int32_t esid, + u_int8_t objectType, + u_int8_t streamType, + u_int32_t bufferSize, + u_int32_t bitrate, + u_int8_t* pConfig, + u_int32_t configLength, + char* url); + + void CreateIsmaODUpdateCommandFromFileForFile( + MP4TrackId odTrackId, + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + + void CreateIsmaODUpdateCommandFromFileForStream( + MP4TrackId audioTrackId, + MP4TrackId videoTrackId, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + + void CreateIsmaODUpdateCommandForStream( + MP4DescriptorProperty* pAudioEsdProperty, + MP4DescriptorProperty* pVideoEsdProperty, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + + void CreateIsmaSceneCommand( + bool hasAudio, + bool hasVideo, + u_int8_t** ppBytes, + u_int64_t* pNumBytes); + +protected: + char* m_fileName; + FILE* m_pFile; + u_int64_t m_orgFileSize; + u_int64_t m_fileSize; + MP4Atom* m_pRootAtom; + MP4Integer32Array m_trakIds; + MP4TrackArray m_pTracks; + MP4TrackId m_odTrackId; + u_int32_t m_verbosity; + char m_mode; + bool m_use64bits; + bool m_useIsma; + + // cached properties + MP4IntegerProperty* m_pModificationProperty; + MP4Integer32Property* m_pTimeScaleProperty; + MP4IntegerProperty* m_pDurationProperty; + + // read/write in memory + u_int8_t* m_memoryBuffer; + u_int64_t m_memoryBufferPosition; + u_int64_t m_memoryBufferSize; + + // bit read/write buffering + u_int8_t m_numReadBits; + u_int8_t m_bufReadBits; + u_int8_t m_numWriteBits; + u_int8_t m_bufWriteBits; + +#ifdef USE_FILE_CALLBACKS + static u_int32_t MP4fopen_cb(const char *pName, const char *mode, void *userData); + static void MP4fclose_cb(void *userData); + static u_int32_t MP4fread_cb(void *pBuffer, unsigned int nBytesToRead, void *userData); + static u_int32_t MP4fwrite_cb(void *pBuffer, unsigned int nBytesToWrite, void *userData); + static int32_t MP4fsetpos_cb(u_int32_t pos, void *userData); + static int64_t MP4fgetpos_cb(void *userData); + static int64_t MP4filesize_cb(void *userData); +#endif +}; + +#endif /* __MP4_FILE_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_free.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_free.cpp @@ -0,0 +1,43 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4FreeAtom::MP4FreeAtom() + : MP4Atom("free") +{ +} + +void MP4FreeAtom::Read() +{ + Skip(); +} + +void MP4FreeAtom::Write() +{ + ASSERT(m_pFile); + + bool use64 = (GetSize() > (0xFFFFFFFF - 8)); + BeginWrite(use64); + m_pFile->SetPosition(m_pFile->GetPosition() + GetSize()); + FinishWrite(use64); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_dimm.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_dimm.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DimmAtom::MP4DimmAtom() + : MP4Atom("dimm") +{ + AddProperty( // bytes of immediate data + new MP4Integer64Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_hnti.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_hnti.cpp @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4HntiAtom::MP4HntiAtom() + : MP4Atom("hnti") +{ +} + +void MP4HntiAtom::Read() +{ + MP4Atom* grandParent = m_pParentAtom->GetParentAtom(); + ASSERT(grandParent); + if (ATOMID(grandParent->GetType()) == ATOMID("trak")) { + ExpectChildAtom("sdp ", Optional, OnlyOne); + } else { + ExpectChildAtom("rtp ", Optional, OnlyOne); + } + + MP4Atom::Read(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/bootstrap +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/bootstrap @@ -0,0 +1,6 @@ +aclocal -I . +autoheader +libtoolize --automake +automake --add-missing +autoconf +./configure --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tsro.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tsro.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TsroAtom::MP4TsroAtom() + : MP4Atom("tsro") +{ + AddProperty( + new MP4Integer32Property("offset")); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/rtphint.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/rtphint.h @@ -0,0 +1,348 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __RTPHINT_INCLUDED__ +#define __RTPHINT_INCLUDED__ + +// forward declarations +class MP4RtpHintTrack; +class MP4RtpHint; +class MP4RtpPacket; + +class MP4RtpData : public MP4Container { +public: + MP4RtpData(MP4RtpPacket* pPacket); + + MP4RtpPacket* GetPacket() { + return m_pPacket; + } + + virtual u_int16_t GetDataSize() = NULL; + virtual void GetData(u_int8_t* pDest) = NULL; + + MP4Track* FindTrackFromRefIndex(u_int8_t refIndex); + + virtual void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos) { + // default is no-op + } + +protected: + MP4RtpPacket* m_pPacket; +}; + +MP4ARRAY_DECL(MP4RtpData, MP4RtpData*) + +class MP4RtpNullData : public MP4RtpData { +public: + MP4RtpNullData(MP4RtpPacket* pPacket); + + u_int16_t GetDataSize() { + return 0; + } + + void GetData(u_int8_t* pDest) { + // no-op + } +}; + +class MP4RtpImmediateData : public MP4RtpData { +public: + MP4RtpImmediateData(MP4RtpPacket* pPacket); + + void Set(const u_int8_t* pBytes, u_int8_t numBytes); + + u_int16_t GetDataSize(); + + void GetData(u_int8_t* pDest); +}; + +class MP4RtpSampleData : public MP4RtpData { +public: + MP4RtpSampleData(MP4RtpPacket* pPacket); + + void SetEmbeddedImmediate( + MP4SampleId sampleId, + u_int8_t* pData, u_int16_t dataLength); + + void SetReferenceSample( + MP4SampleId refSampleId, u_int32_t refSampleOffset, + u_int16_t sampleLength); + + void SetEmbeddedSample( + MP4SampleId sampleId, MP4Track* pRefTrack, + MP4SampleId refSampleId, u_int32_t refSampleOffset, + u_int16_t sampleLength); + + u_int16_t GetDataSize(); + + void GetData(u_int8_t* pDest); + + void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos); + +protected: + u_int8_t* m_pRefData; + + MP4Track* m_pRefTrack; + MP4SampleId m_refSampleId; + u_int32_t m_refSampleOffset; +}; + +class MP4RtpSampleDescriptionData : public MP4RtpData { +public: + MP4RtpSampleDescriptionData(MP4RtpPacket* pPacket); + + void Set(u_int32_t sampleDescrIndex, + u_int32_t offset, u_int16_t length); + + u_int16_t GetDataSize(); + + void GetData(u_int8_t* pDest); +}; + +class MP4RtpPacket : public MP4Container { +public: + MP4RtpPacket(MP4RtpHint* pHint); + + ~MP4RtpPacket(); + + void AddExtraProperties(); + + MP4RtpHint* GetHint() { + return m_pHint; + } + + void Set(u_int8_t payloadNumber, u_int32_t packetId, bool setMbit); + + int32_t GetTransmitOffset(); + + bool GetPBit(); + + bool GetXBit(); + + bool GetMBit(); + + u_int8_t GetPayload(); + + u_int16_t GetSequenceNumber(); + + void SetTransmitOffset(int32_t transmitOffset); + + bool IsBFrame(); + + void SetBFrame(bool isBFrame); + + void SetTimestampOffset(u_int32_t timestampOffset); + + void AddData(MP4RtpData* pData); + + u_int32_t GetDataSize(); + + void GetData(u_int8_t* pDest); + + void Read(MP4File* pFile); + + void ReadExtra(MP4File* pFile); + + void Write(MP4File* pFile); + + void WriteEmbeddedData(MP4File* pFile, u_int64_t startPos); + + void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); + +protected: + MP4RtpHint* m_pHint; + MP4RtpDataArray m_rtpData; +}; + +MP4ARRAY_DECL(MP4RtpPacket, MP4RtpPacket*) + +class MP4RtpHint : public MP4Container { +public: + MP4RtpHint(MP4RtpHintTrack* pTrack); + + ~MP4RtpHint(); + + MP4RtpHintTrack* GetTrack() { + return m_pTrack; + } + + u_int16_t GetNumberOfPackets() { + return m_rtpPackets.Size(); + } + + bool IsBFrame() { + return m_isBFrame; + } + void SetBFrame(bool isBFrame) { + m_isBFrame = isBFrame; + } + + u_int32_t GetTimestampOffset() { + return m_timestampOffset; + } + void SetTimestampOffset(u_int32_t timestampOffset) { + m_timestampOffset = timestampOffset; + } + + MP4RtpPacket* AddPacket(); + + MP4RtpPacket* GetPacket(u_int16_t index) { + return m_rtpPackets[index]; + } + + MP4RtpPacket* GetCurrentPacket() { + if (m_rtpPackets.Size() == 0) { + return NULL; + } + return m_rtpPackets[m_rtpPackets.Size() - 1]; + } + + void Read(MP4File* pFile); + + void Write(MP4File* pFile); + + void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); + +protected: + MP4RtpHintTrack* m_pTrack; + MP4RtpPacketArray m_rtpPackets; + + // values when adding packets to a hint (write mode) + bool m_isBFrame; + u_int32_t m_timestampOffset; +}; + +class MP4RtpHintTrack : public MP4Track { +public: + MP4RtpHintTrack(MP4File* pFile, MP4Atom* pTrakAtom); + + ~MP4RtpHintTrack(); + + void InitRefTrack(); + + void InitPayload(); + + void InitRtpStart(); + + void InitStats(); + + MP4Track* GetRefTrack() { + InitRefTrack(); + return m_pRefTrack; + } + + void GetPayload( + char** ppPayloadName = NULL, + u_int8_t* pPayloadNumber = NULL, + u_int16_t* pMaxPayloadSize = NULL, + char **ppEncodingParams = NULL); + + void SetPayload( + const char* payloadName, + u_int8_t payloadNumber, + u_int16_t maxPayloadSize, + const char *encoding_parms, + bool add_rtpmap, + bool add_mpeg4_esid); + + void ReadHint( + MP4SampleId hintSampleId, + u_int16_t* pNumPackets = NULL); + + u_int16_t GetHintNumberOfPackets(); + + bool GetPacketBFrame(u_int16_t packetIndex); + + u_int16_t GetPacketTransmitOffset(u_int16_t packetIndex); + + void ReadPacket( + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc, + bool includeHeader = true, + bool includePayload = true); + + MP4Timestamp GetRtpTimestampStart(); + + void SetRtpTimestampStart(MP4Timestamp start); + + void AddHint(bool isBFrame, u_int32_t timestampOffset); + + void AddPacket(bool setMbit, int32_t transmitOffset = 0); + + void AddImmediateData(const u_int8_t* pBytes, u_int32_t numBytes); + + void AddSampleData(MP4SampleId sampleId, + u_int32_t dataOffset, u_int32_t dataLength); + + void AddESConfigurationPacket(); + + void WriteHint(MP4Duration duration, bool isSyncSample); + + void FinishWrite(); + +protected: + MP4Track* m_pRefTrack; + + MP4StringProperty* m_pRtpMapProperty; + MP4Integer32Property* m_pPayloadNumberProperty; + MP4Integer32Property* m_pMaxPacketSizeProperty; + MP4Integer32Property* m_pSnroProperty; + MP4Integer32Property* m_pTsroProperty; + u_int32_t m_rtpSequenceStart; + u_int32_t m_rtpTimestampStart; + + // reading + MP4RtpHint* m_pReadHint; + u_int8_t* m_pReadHintSample; + u_int32_t m_readHintSampleSize; + MP4Timestamp m_readHintTimestamp; + + // writing + MP4RtpHint* m_pWriteHint; + MP4SampleId m_writeHintId; + u_int32_t m_writePacketId; + + // statistics + // in trak.udta.hinf + MP4Integer64Property* m_pTrpy; + MP4Integer64Property* m_pNump; + MP4Integer64Property* m_pTpyl; + MP4Integer32Property* m_pMaxr; + MP4Integer64Property* m_pDmed; + MP4Integer64Property* m_pDimm; + MP4Integer32Property* m_pPmax; + MP4Integer32Property* m_pDmax; + + // in trak.mdia.minf.hmhd + MP4Integer16Property* m_pMaxPdu; + MP4Integer16Property* m_pAvgPdu; + MP4Integer32Property* m_pMaxBitRate; + MP4Integer32Property* m_pAvgBitRate; + + MP4Timestamp m_thisSec; + u_int32_t m_bytesThisSec; + u_int32_t m_bytesThisHint; + u_int32_t m_bytesThisPacket; +}; + +#endif /* __RTPHINT_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_url.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_url.cpp @@ -0,0 +1,63 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4UrlAtom::MP4UrlAtom() + : MP4Atom("url ") +{ + AddVersionAndFlags(); + AddProperty(new MP4StringProperty("location")); +} + +void MP4UrlAtom::Read() +{ + // read the version and flags properties + ReadProperties(0, 2); + + // check if self-contained flag is set + if (!(GetFlags() & 1)) { + // if not then read url location + ReadProperties(2); + } + + Skip(); // to end of atom +} + +void MP4UrlAtom::Write() +{ + MP4StringProperty* pLocationProp = + (MP4StringProperty*)m_pProperties[2]; + + // if no url location has been set + // then set self-contained flag + // and don't attempt to write anything + if (pLocationProp->GetValue() == NULL) { + SetFlags(GetFlags() | 1); + pLocationProp->SetImplicit(true); + } else { + SetFlags(GetFlags() & 0xFFFFFE); + pLocationProp->SetImplicit(false); + } + + // write atom as usual + MP4Atom::Write(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4file.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4file.cpp @@ -0,0 +1,2458 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +MP4File::MP4File(u_int32_t verbosity) +{ + m_fileName = NULL; + m_pFile = NULL; + m_orgFileSize = 0; + m_fileSize = 0; + m_pRootAtom = NULL; + m_odTrackId = MP4_INVALID_TRACK_ID; + + m_verbosity = verbosity; + m_mode = 0; + m_use64bits = false; + m_useIsma = false; + + m_pModificationProperty = NULL; + m_pTimeScaleProperty = NULL; + m_pDurationProperty = NULL; + + m_memoryBuffer = NULL; + m_memoryBufferSize = 0; + m_memoryBufferPosition = 0; + + m_numReadBits = 0; + m_bufReadBits = 0; + m_numWriteBits = 0; + m_bufWriteBits = 0; + +#ifdef USE_FILE_CALLBACKS + // These are the default for when no callbacks are specified + m_userData = (void*)this; + m_MP4fopen = MP4fopen_cb; + m_MP4fclose = MP4fclose_cb; + m_MP4fread = MP4fread_cb; + m_MP4fwrite = MP4fwrite_cb; + m_MP4fgetpos = MP4fgetpos_cb; + m_MP4fsetpos = MP4fsetpos_cb; + m_MP4filesize = MP4filesize_cb; +#endif +} + +MP4File::~MP4File() +{ + MP4Free(m_fileName); + delete m_pRootAtom; + for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { + delete m_pTracks[i]; + } + MP4Free(m_memoryBuffer); // just in case +} + +void MP4File::Read(const char* fileName) +{ + m_fileName = MP4Stralloc(fileName); + m_mode = 'r'; + + Open("rb"); + + ReadFromFile(); + + CacheProperties(); +} + +void MP4File::Create(const char* fileName, bool use64bits) +{ + m_fileName = MP4Stralloc(fileName); + m_mode = 'w'; + m_use64bits = use64bits; + + Open("wb+"); + + // generate a skeletal atom tree + m_pRootAtom = MP4Atom::CreateAtom(NULL); + m_pRootAtom->SetFile(this); + m_pRootAtom->Generate(); + + CacheProperties(); + + // create mdat, and insert it after ftyp, and before moov + InsertChildAtom(m_pRootAtom, "mdat", 1); + + // start writing + m_pRootAtom->BeginWrite(); +} + +void MP4File::Modify(const char* fileName) +{ + m_fileName = MP4Stralloc(fileName); + m_mode = 'r'; + + Open("rb+"); + ReadFromFile(); + + m_mode = 'w'; + + // find the moov atom + MP4Atom* pMoovAtom = m_pRootAtom->FindAtom("moov"); + u_int32_t numAtoms; + + if (pMoovAtom == NULL) { + // there isn't one, odd but we can still proceed + pMoovAtom = AddChildAtom(m_pRootAtom, "moov"); + } else { + numAtoms = m_pRootAtom->GetNumberOfChildAtoms(); + + // work backwards thru the top level atoms + int32_t i; + bool lastAtomIsMoov = true; + MP4Atom* pLastAtom = NULL; + + for (i = numAtoms - 1; i >= 0; i--) { + MP4Atom* pAtom = m_pRootAtom->GetChildAtom(i); + const char* type = pAtom->GetType(); + + // get rid of any trailing free or skips + if (!strcmp(type, "free") || !strcmp(type, "skip")) { + m_pRootAtom->DeleteChildAtom(pAtom); + continue; + } + + if (strcmp(type, "moov")) { + if (pLastAtom == NULL) { + pLastAtom = pAtom; + lastAtomIsMoov = false; + } + continue; + } + + // now at moov atom + + // multiple moov atoms?!? + if (pAtom != pMoovAtom) { + throw new MP4Error( + "Badly formed mp4 file, multiple moov atoms", + "MP4Modify"); + } + + if (lastAtomIsMoov) { + // position to start of moov atom, + // effectively truncating file + // prior to adding new mdat + SetPosition(pMoovAtom->GetStart()); + + } else { // last atom isn't moov + // need to place a free atom + MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free"); + + // in existing position of the moov atom + m_pRootAtom->InsertChildAtom(pFreeAtom, i); + m_pRootAtom->DeleteChildAtom(pMoovAtom); + m_pRootAtom->AddChildAtom(pMoovAtom); + + // write free atom to disk + SetPosition(pMoovAtom->GetStart()); + pFreeAtom->SetSize(pMoovAtom->GetSize()); + pFreeAtom->Write(); + + // finally set our file position to the end of the last atom + SetPosition(pLastAtom->GetEnd()); + } + + break; + } + ASSERT(i != -1); + } + + CacheProperties(); // of moov atom + + numAtoms = m_pRootAtom->GetNumberOfChildAtoms(); + + // insert another mdat prior to moov atom (the last atom) + MP4Atom* pMdatAtom = InsertChildAtom(m_pRootAtom, "mdat", numAtoms - 1); + + // start writing new mdat + pMdatAtom->BeginWrite(); +} + +void MP4File::Optimize(const char* orgFileName, const char* newFileName) +{ +#if 1//ndef USE_FILE_CALLBACKS + m_fileName = MP4Stralloc(orgFileName); + m_mode = 'r'; + + // first load meta-info into memory + Open("rb"); + ReadFromFile(); + + CacheProperties(); // of moov atom + + // now switch over to writing the new file + MP4Free(m_fileName); + + // create a temporary file if necessary + if (newFileName == NULL) { + m_fileName = MP4Stralloc(TempFileName()); + } else { + m_fileName = MP4Stralloc(newFileName); + } + + FILE* pReadFile = m_pFile; + m_pFile = NULL; + m_mode = 'w'; + + Open("wb"); + + SetIntegerProperty("moov.mvhd.modificationTime", + MP4GetAbsTimestamp()); + + // writing meta info in the optimal order + ((MP4RootAtom*)m_pRootAtom)->BeginOptimalWrite(); + + // write data in optimal order + RewriteMdat(pReadFile, m_pFile); + + // finish writing + ((MP4RootAtom*)m_pRootAtom)->FinishOptimalWrite(); + + // cleanup + fclose(m_pFile); + m_pFile = NULL; + fclose(pReadFile); + + // move temporary file into place + if (newFileName == NULL) { + Rename(m_fileName, orgFileName); + } +#else + throw new MP4Error(errno, "Function not supported when using callbacks", "MP4Optimize"); +#endif +} + +void MP4File::RewriteMdat(FILE* pReadFile, FILE* pWriteFile) +{ + u_int32_t numTracks = m_pTracks.Size(); + + MP4ChunkId* chunkIds = new MP4ChunkId[numTracks]; + MP4ChunkId* maxChunkIds = new MP4ChunkId[numTracks]; + MP4Timestamp* nextChunkTimes = new MP4Timestamp[numTracks]; + + for (u_int32_t i = 0; i < numTracks; i++) { + chunkIds[i] = 1; + maxChunkIds[i] = m_pTracks[i]->GetNumberOfChunks(); + nextChunkTimes[i] = MP4_INVALID_TIMESTAMP; + } + + while (true) { + u_int32_t nextTrackIndex = (u_int32_t)-1; + MP4Timestamp nextTime = MP4_INVALID_TIMESTAMP; + + for (u_int32_t i = 0; i < numTracks; i++) { + if (chunkIds[i] > maxChunkIds[i]) { + continue; + } + + if (nextChunkTimes[i] == MP4_INVALID_TIMESTAMP) { + MP4Timestamp chunkTime = + m_pTracks[i]->GetChunkTime(chunkIds[i]); + + nextChunkTimes[i] = MP4ConvertTime(chunkTime, + m_pTracks[i]->GetTimeScale(), GetTimeScale()); + } + + // time is not earliest so far + if (nextChunkTimes[i] > nextTime) { + continue; + } + + // prefer hint tracks to media tracks if times are equal + if (nextChunkTimes[i] == nextTime + && strcmp(m_pTracks[i]->GetType(), MP4_HINT_TRACK_TYPE)) { + continue; + } + + // this is our current choice of tracks + nextTime = nextChunkTimes[i]; + nextTrackIndex = i; + } + + if (nextTrackIndex == (u_int32_t)-1) { + break; + } + + // point into original mp4 file for read chunk call + m_pFile = pReadFile; + m_mode = 'r'; + + u_int8_t* pChunk; + u_int32_t chunkSize; + + m_pTracks[nextTrackIndex]-> + ReadChunk(chunkIds[nextTrackIndex], &pChunk, &chunkSize); + + // point back at the new mp4 file for write chunk + m_pFile = pWriteFile; + m_mode = 'w'; + + m_pTracks[nextTrackIndex]-> + RewriteChunk(chunkIds[nextTrackIndex], pChunk, chunkSize); + + MP4Free(pChunk); + + chunkIds[nextTrackIndex]++; + nextChunkTimes[nextTrackIndex] = MP4_INVALID_TIMESTAMP; + } + + delete [] chunkIds; + delete [] maxChunkIds; + delete [] nextChunkTimes; +} + +void MP4File::Open(const char* fmode) +{ + ASSERT(m_pFile == NULL); + +#ifndef USE_FILE_CALLBACKS +#ifdef O_LARGEFILE + // UGH! fopen doesn't open a file in 64-bit mode, period. + // So we need to use open() and then fdopen() + int fd; + int flags = O_LARGEFILE; + + if (strchr(fmode, '+')) { + flags |= O_CREAT | O_RDWR; + if (fmode[0] == 'w') { + flags |= O_TRUNC; + } + } else { + if (fmode[0] == 'w') { + flags |= O_CREAT | O_TRUNC | O_WRONLY; + } else { + flags |= O_RDONLY; + } + } + fd = open(m_fileName, flags, 0666); + + if (fd >= 0) { + m_pFile = fdopen(fd, fmode); + } +#else + m_pFile = fopen(m_fileName, fmode); +#endif + if (m_pFile == NULL) { + throw new MP4Error(errno, "failed", "MP4Open"); + } +#else + u_int32_t rc = m_MP4fopen(m_fileName, fmode, m_userData); + if (rc == 0) { + throw new MP4Error(errno, "failed", "MP4Open"); + } +#endif + + if (m_mode == 'r') { +#ifndef USE_FILE_CALLBACKS + struct stat s; + if (fstat(fileno(m_pFile), &s) < 0) { + throw new MP4Error(errno, "stat failed", "MP4Open"); + } + m_orgFileSize = m_fileSize = s.st_size; +#else + int64_t s = m_MP4filesize(m_userData); + if (s < 0) { + throw new MP4Error(errno, "retreiving filesize failed", "MP4Open"); + } + m_orgFileSize = m_fileSize = (u_int64_t)s; +#endif + } else { + m_orgFileSize = m_fileSize = 0; + } +} + +void MP4File::ReadFromFile() +{ + // ensure we start at beginning of file + SetPosition(0); + + // create a new root atom + ASSERT(m_pRootAtom == NULL); + m_pRootAtom = MP4Atom::CreateAtom(NULL); + + u_int64_t fileSize = GetSize(); + + m_pRootAtom->SetFile(this); + m_pRootAtom->SetStart(0); + m_pRootAtom->SetSize(fileSize); + m_pRootAtom->SetEnd(fileSize); + + m_pRootAtom->Read(); + + // create MP4Track's for any tracks in the file + GenerateTracks(); +} + +void MP4File::GenerateTracks() +{ + u_int32_t trackIndex = 0; + + while (true) { + char trackName[32]; + snprintf(trackName, sizeof(trackName), "moov.trak[%u]", trackIndex); + + // find next trak atom + MP4Atom* pTrakAtom = m_pRootAtom->FindAtom(trackName); + + // done, no more trak atoms + if (pTrakAtom == NULL) { + break; + } + + // find track id property + MP4Integer32Property* pTrackIdProperty = NULL; + pTrakAtom->FindProperty( + "trak.tkhd.trackId", + (MP4Property**)&pTrackIdProperty); + + // find track type property + MP4StringProperty* pTypeProperty = NULL; + pTrakAtom->FindProperty( + "trak.mdia.hdlr.handlerType", + (MP4Property**)&pTypeProperty); + + // ensure we have the basics properties + if (pTrackIdProperty && pTypeProperty) { + + m_trakIds.Add(pTrackIdProperty->GetValue()); + + MP4Track* pTrack = NULL; + try { + if (!strcmp(pTypeProperty->GetValue(), MP4_HINT_TRACK_TYPE)) { + pTrack = new MP4RtpHintTrack(this, pTrakAtom); + } else { + pTrack = new MP4Track(this, pTrakAtom); + } + m_pTracks.Add(pTrack); + } + catch (MP4Error* e) { + VERBOSE_ERROR(m_verbosity, e->Print()); + delete e; + } + + // remember when we encounter the OD track + if (pTrack && !strcmp(pTrack->GetType(), MP4_OD_TRACK_TYPE)) { + if (m_odTrackId == MP4_INVALID_TRACK_ID) { + m_odTrackId = pTrackIdProperty->GetValue(); + } else { + VERBOSE_READ(GetVerbosity(), + printf("Warning: multiple OD tracks present\n")); + } + } + } else { + m_trakIds.Add(0); + } + + trackIndex++; + } +} + +void MP4File::CacheProperties() +{ + FindIntegerProperty("moov.mvhd.modificationTime", + (MP4Property**)&m_pModificationProperty); + + FindIntegerProperty("moov.mvhd.timeScale", + (MP4Property**)&m_pTimeScaleProperty); + + FindIntegerProperty("moov.mvhd.duration", + (MP4Property**)&m_pDurationProperty); +} + +void MP4File::BeginWrite() +{ + m_pRootAtom->BeginWrite(); +} + +void MP4File::FinishWrite() +{ + // for all tracks, flush chunking buffers + for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { + ASSERT(m_pTracks[i]); + m_pTracks[i]->FinishWrite(); + } + + // ask root atom to write + m_pRootAtom->FinishWrite(); + + // check if file shrunk, e.g. we deleted a track + if (GetSize() < m_orgFileSize) { + // just use a free atom to mark unused space + // MP4Optimize() should be used to clean up this space + MP4Atom* pFreeAtom = MP4Atom::CreateAtom("free"); + ASSERT(pFreeAtom); + pFreeAtom->SetFile(this); + pFreeAtom->SetSize((u_int64_t)MAX((int64_t)m_orgFileSize - ((int64_t)m_fileSize + 8), 0)); + pFreeAtom->Write(); + delete pFreeAtom; + } +} + +MP4Duration MP4File::UpdateDuration(MP4Duration duration) +{ + MP4Duration currentDuration = GetDuration(); + if (duration > currentDuration) { + SetDuration(duration); + return duration; + } + return currentDuration; +} + +void MP4File::Dump(FILE* pDumpFile, bool dumpImplicits) +{ + if (pDumpFile == NULL) { + pDumpFile = stdout; + } + + fprintf(pDumpFile, "Dumping %s meta-information...\n", m_fileName); + m_pRootAtom->Dump(pDumpFile, 0, dumpImplicits); +} + +void MP4File::Close() +{ + if (m_mode == 'w') { + SetIntegerProperty("moov.mvhd.modificationTime", + MP4GetAbsTimestamp()); + + FinishWrite(); + } + +#ifndef USE_FILE_CALLBACKS + fclose(m_pFile); + m_pFile = NULL; +#else + m_MP4fclose(m_userData); +#endif +} + +const char* MP4File::TempFileName() +{ + // there are so many attempts in libc to get this right + // that for portablity reasons, it's best just to roll our own +#ifndef _WIN32 + static char tempFileName[64]; + u_int32_t i; + for (i = getpid(); i < 0xFFFFFFFF; i++) { + sprintf(tempFileName, "./tmp%u.mp4", i); + if (access(tempFileName, F_OK) != 0) { + break; + } + } + if (i == 0xFFFFFFFF) { + throw new MP4Error("can't create temporary file", "TempFileName"); + } +#else + static char tempFileName[MAX_PATH + 3]; + GetTempFileName(".", // dir. for temp. files + "mp4", // temp. filename prefix + 0, // create unique name + tempFileName); // buffer for name +#endif + + return tempFileName; +} + +void MP4File::Rename(const char* oldFileName, const char* newFileName) +{ + int rc; + +#ifdef _WIN32 + rc = remove(newFileName); + if (rc == 0) { + rc = rename(oldFileName, newFileName); + } + else + remove(oldFileName); + +#else + rc = rename(oldFileName, newFileName); +#endif + if (rc != 0) { + throw new MP4Error(errno, "can't overwrite existing file", "Rename"); + } +} + +void MP4File::ProtectWriteOperation(char* where) +{ + if (m_mode == 'r') { + throw new MP4Error("operation not permitted in read mode", where); + } +} + +MP4Track* MP4File::GetTrack(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]; +} + +MP4Atom* MP4File::FindAtom(const char* name) +{ + MP4Atom* pAtom = NULL; + if (!name || !strcmp(name, "")) { + pAtom = m_pRootAtom; + } else { + pAtom = m_pRootAtom->FindAtom(name); + } + return pAtom; +} + +MP4Atom* MP4File::AddChildAtom( + const char* parentName, + const char* childName) +{ + return AddChildAtom(FindAtom(parentName), childName); +} + +MP4Atom* MP4File::AddChildAtom( + MP4Atom* pParentAtom, + const char* childName) +{ + return InsertChildAtom(pParentAtom, childName, + pParentAtom->GetNumberOfChildAtoms()); +} + +MP4Atom* MP4File::InsertChildAtom( + const char* parentName, + const char* childName, + u_int32_t index) +{ + return InsertChildAtom(FindAtom(parentName), childName, index); +} + +MP4Atom* MP4File::InsertChildAtom( + MP4Atom* pParentAtom, + const char* childName, + u_int32_t index) +{ + MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName); + + ASSERT(pParentAtom); + pParentAtom->InsertChildAtom(pChildAtom, index); + + pChildAtom->Generate(); + + return pChildAtom; +} + +MP4Atom* MP4File::AddDescendantAtoms( + const char* ancestorName, + const char* descendantNames) +{ + return AddDescendantAtoms(FindAtom(ancestorName), descendantNames); +} + +MP4Atom* MP4File::AddDescendantAtoms( + MP4Atom* pAncestorAtom, const char* descendantNames) +{ + ASSERT(pAncestorAtom); + + MP4Atom* pParentAtom = pAncestorAtom; + MP4Atom* pChildAtom = NULL; + + while (true) { + char* childName = MP4NameFirst(descendantNames); + + if (childName == NULL) { + break; + } + + descendantNames = MP4NameAfterFirst(descendantNames); + + pChildAtom = pParentAtom->FindChildAtom(childName); + + if (pChildAtom == NULL) { + pChildAtom = AddChildAtom(pParentAtom, childName); + } + + pParentAtom = pChildAtom; + + MP4Free(childName); + } + + return pChildAtom; +} + +bool MP4File::FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (pIndex) { + *pIndex = 0; // set the default answer for index + } + + return m_pRootAtom->FindProperty(name, ppProperty, pIndex); +} + +void MP4File::FindIntegerProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property - %s", "MP4File::FindIntegerProperty", name); + } + + switch ((*ppProperty)->GetType()) { + case Integer8Property: + case Integer16Property: + case Integer24Property: + case Integer32Property: + case Integer64Property: + break; + default: + throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindIntegerProperty", name, (*ppProperty)->GetType()); + } +} + +u_int64_t MP4File::GetIntegerProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindIntegerProperty(name, &pProperty, &index); + + return ((MP4IntegerProperty*)pProperty)->GetValue(index); +} + +void MP4File::SetIntegerProperty(const char* name, u_int64_t value) +{ + ProtectWriteOperation("SetIntegerProperty"); + + MP4Property* pProperty = NULL; + u_int32_t index = 0; + + FindIntegerProperty(name, &pProperty, &index); + + ((MP4IntegerProperty*)pProperty)->SetValue(value, index); +} + +void MP4File::FindFloatProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property - %s", "MP4File::FindFloatProperty", name); + } + if ((*ppProperty)->GetType() != Float32Property) { + throw new MP4Error("type mismatch - property %s type %d", + "MP4File::FindFloatProperty", + name, + (*ppProperty)->GetType()); + } +} + +float MP4File::GetFloatProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindFloatProperty(name, &pProperty, &index); + + return ((MP4Float32Property*)pProperty)->GetValue(index); +} + +void MP4File::SetFloatProperty(const char* name, float value) +{ + ProtectWriteOperation("SetFloatProperty"); + + MP4Property* pProperty; + u_int32_t index; + + FindFloatProperty(name, &pProperty, &index); + + ((MP4Float32Property*)pProperty)->SetValue(value, index); +} + +void MP4File::FindStringProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property - %s", "MP4File::FindStringProperty", name); + } + if ((*ppProperty)->GetType() != StringProperty) { + throw new MP4Error("type mismatch - property %s type %d", "MP4File::FindStringProperty", + name, (*ppProperty)->GetType()); + } +} + +const char* MP4File::GetStringProperty(const char* name) +{ + MP4Property* pProperty; + u_int32_t index; + + FindStringProperty(name, &pProperty, &index); + + return ((MP4StringProperty*)pProperty)->GetValue(index); +} + +void MP4File::SetStringProperty(const char* name, const char* value) +{ + ProtectWriteOperation("SetStringProperty"); + + MP4Property* pProperty; + u_int32_t index; + + FindStringProperty(name, &pProperty, &index); + + ((MP4StringProperty*)pProperty)->SetValue(value, index); +} + +void MP4File::FindBytesProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (!FindProperty(name, ppProperty, pIndex)) { + throw new MP4Error("no such property %s", "MP4File::FindBytesProperty", name); + } + if ((*ppProperty)->GetType() != BytesProperty) { + throw new MP4Error("type mismatch - property %s - type %d", "MP4File::FindBytesProperty", name, (*ppProperty)->GetType()); + } +} + +void MP4File::GetBytesProperty(const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + MP4Property* pProperty; + u_int32_t index; + + FindBytesProperty(name, &pProperty, &index); + + ((MP4BytesProperty*)pProperty)->GetValue(ppValue, pValueSize, index); +} + +void MP4File::SetBytesProperty(const char* name, + const u_int8_t* pValue, u_int32_t valueSize) +{ + ProtectWriteOperation("SetBytesProperty"); + + MP4Property* pProperty; + u_int32_t index; + + FindBytesProperty(name, &pProperty, &index); + + ((MP4BytesProperty*)pProperty)->SetValue(pValue, valueSize, index); +} + + +// track functions + +MP4TrackId MP4File::AddTrack(const char* type, u_int32_t timeScale) +{ + ProtectWriteOperation("AddTrack"); + + // create and add new trak atom + MP4Atom* pTrakAtom = AddChildAtom("moov", "trak"); + + // allocate a new track id + MP4TrackId trackId = AllocTrackId(); + + m_trakIds.Add(trackId); + + // set track id + MP4Integer32Property* pInteger32Property = NULL; + pTrakAtom->FindProperty( + "trak.tkhd.trackId", (MP4Property**)&pInteger32Property); + ASSERT(pInteger32Property); + pInteger32Property->SetValue(trackId); + + // set track type + const char* normType = MP4Track::NormalizeTrackType(type); + + // sanity check for user defined types + if (strlen(normType) > 4) { + VERBOSE_WARNING(m_verbosity, + printf("AddTrack: type truncated to four characters\n")); + // StringProperty::SetValue() will do the actual truncation + } + + MP4StringProperty* pStringProperty = NULL; + pTrakAtom->FindProperty( + "trak.mdia.hdlr.handlerType", (MP4Property**)&pStringProperty); + ASSERT(pStringProperty); + pStringProperty->SetValue(normType); + + // set track time scale + pInteger32Property = NULL; + pTrakAtom->FindProperty( + "trak.mdia.mdhd.timeScale", (MP4Property**)&pInteger32Property); + ASSERT(pInteger32Property); + pInteger32Property->SetValue(timeScale ? timeScale : 1000); + + // now have enough to create MP4Track object + MP4Track* pTrack = NULL; + if (!strcmp(normType, MP4_HINT_TRACK_TYPE)) { + pTrack = new MP4RtpHintTrack(this, pTrakAtom); + } else { + pTrack = new MP4Track(this, pTrakAtom); + } + m_pTracks.Add(pTrack); + + // mark non-hint tracks as enabled + if (strcmp(normType, MP4_HINT_TRACK_TYPE)) { + SetTrackIntegerProperty(trackId, "tkhd.flags", 1); + } + + // mark track as contained in this file + // LATER will provide option for external data references + AddDataReference(trackId, NULL); + + return trackId; +} + +void MP4File::AddTrackToIod(MP4TrackId trackId) +{ + MP4DescriptorProperty* pDescriptorProperty = NULL; + m_pRootAtom->FindProperty("moov.iods.esIds", + (MP4Property**)&pDescriptorProperty); + ASSERT(pDescriptorProperty); + + MP4Descriptor* pDescriptor = + pDescriptorProperty->AddDescriptor(MP4ESIDIncDescrTag); + ASSERT(pDescriptor); + + MP4Integer32Property* pIdProperty = NULL; + pDescriptor->FindProperty("id", + (MP4Property**)&pIdProperty); + ASSERT(pIdProperty); + + pIdProperty->SetValue(trackId); +} + +void MP4File::RemoveTrackFromIod(MP4TrackId trackId) +{ + MP4DescriptorProperty* pDescriptorProperty = NULL; + m_pRootAtom->FindProperty("moov.iods.esIds", + (MP4Property**)&pDescriptorProperty); + ASSERT(pDescriptorProperty); + + for (u_int32_t i = 0; i < pDescriptorProperty->GetCount(); i++) { + static char name[32]; + snprintf(name, sizeof(name), "esIds[%u].id", i); + + MP4Integer32Property* pIdProperty = NULL; + pDescriptorProperty->FindProperty(name, + (MP4Property**)&pIdProperty); + ASSERT(pIdProperty); + + if (pIdProperty->GetValue() == trackId) { + pDescriptorProperty->DeleteDescriptor(i); + break; + } + } +} + +void MP4File::AddTrackToOd(MP4TrackId trackId) +{ + if (!m_odTrackId) { + return; + } + + AddTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId); +} + +void MP4File::RemoveTrackFromOd(MP4TrackId trackId) +{ + if (!m_odTrackId) { + return; + } + + RemoveTrackReference(MakeTrackName(m_odTrackId, "tref.mpod"), trackId); +} + +void MP4File::GetTrackReferenceProperties(const char* trefName, + MP4Property** ppCountProperty, MP4Property** ppTrackIdProperty) +{ + char propName[1024]; + + snprintf(propName, sizeof(propName), "%s.%s", trefName, "entryCount"); + m_pRootAtom->FindProperty(propName, ppCountProperty); + ASSERT(*ppCountProperty); + + snprintf(propName, sizeof(propName), "%s.%s", trefName, "entries.trackId"); + m_pRootAtom->FindProperty(propName, ppTrackIdProperty); + ASSERT(*ppTrackIdProperty); +} + +void MP4File::AddTrackReference(const char* trefName, MP4TrackId refTrackId) +{ + MP4Integer32Property* pCountProperty = NULL; + MP4Integer32Property* pTrackIdProperty = NULL; + + GetTrackReferenceProperties(trefName, + (MP4Property**)&pCountProperty, + (MP4Property**)&pTrackIdProperty); + + pTrackIdProperty->AddValue(refTrackId); + pCountProperty->IncrementValue(); +} + +u_int32_t MP4File::FindTrackReference(const char* trefName, + MP4TrackId refTrackId) +{ + MP4Integer32Property* pCountProperty = NULL; + MP4Integer32Property* pTrackIdProperty = NULL; + + GetTrackReferenceProperties(trefName, + (MP4Property**)&pCountProperty, + (MP4Property**)&pTrackIdProperty); + + for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) { + if (refTrackId == pTrackIdProperty->GetValue(i)) { + return i + 1; // N.B. 1 not 0 based index + } + } + return 0; +} + +void MP4File::RemoveTrackReference(const char* trefName, MP4TrackId refTrackId) +{ + MP4Integer32Property* pCountProperty = NULL; + MP4Integer32Property* pTrackIdProperty = NULL; + + GetTrackReferenceProperties(trefName, + (MP4Property**)&pCountProperty, + (MP4Property**)&pTrackIdProperty); + + for (u_int32_t i = 0; i < pCountProperty->GetValue(); i++) { + if (refTrackId == pTrackIdProperty->GetValue(i)) { + pTrackIdProperty->DeleteValue(i); + pCountProperty->IncrementValue(-1); + } + } +} + +void MP4File::AddDataReference(MP4TrackId trackId, const char* url) +{ + MP4Atom* pDrefAtom = + FindAtom(MakeTrackName(trackId, "mdia.minf.dinf.dref")); + ASSERT(pDrefAtom); + + MP4Integer32Property* pCountProperty = NULL; + pDrefAtom->FindProperty("dref.entryCount", + (MP4Property**)&pCountProperty); + ASSERT(pCountProperty); + pCountProperty->IncrementValue(); + + MP4Atom* pUrlAtom = AddChildAtom(pDrefAtom, "url "); + + if (url && url[0] != '\0') { + pUrlAtom->SetFlags(pUrlAtom->GetFlags() & 0xFFFFFE); + + MP4StringProperty* pUrlProperty = NULL; + pUrlAtom->FindProperty("url .location", + (MP4Property**)&pUrlProperty); + ASSERT(pUrlProperty); + pUrlProperty->SetValue(url); + } else { + pUrlAtom->SetFlags(pUrlAtom->GetFlags() | 1); + } +} + +MP4TrackId MP4File::AddSystemsTrack(const char* type) +{ + const char* normType = MP4Track::NormalizeTrackType(type); + + // TBD if user type, fix name to four chars, and warn + + MP4TrackId trackId = AddTrack(type, MP4_MSECS_TIME_SCALE); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4s"); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the mp4s atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4s.esds.ESID", +#if 0 + // note - for a file, these values need to + // be 0 - wmay - 04/16/2003 + trackId +#else + 0 +#endif + ); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId", + MP4SystemsV1ObjectType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.streamType", + ConvertTrackTypeToStreamType(normType)); + + return trackId; +} + +MP4TrackId MP4File::AddODTrack() +{ + // until a demonstrated need emerges + // we limit ourselves to one object description track + if (m_odTrackId != MP4_INVALID_TRACK_ID) { + throw new MP4Error("object description track already exists", + "AddObjectDescriptionTrack"); + } + + m_odTrackId = AddSystemsTrack(MP4_OD_TRACK_TYPE); + + AddTrackToIod(m_odTrackId); + + AddDescendantAtoms(MakeTrackName(m_odTrackId, NULL), "tref.mpod"); + + return m_odTrackId; +} + +MP4TrackId MP4File::AddSceneTrack() +{ + MP4TrackId trackId = AddSystemsTrack(MP4_SCENE_TRACK_TYPE); + + AddTrackToIod(trackId); + AddTrackToOd(trackId); + + return trackId; +} + +MP4TrackId MP4File::AddAudioTrack( + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType) +{ + MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale); + + AddTrackToOd(trackId); + + SetTrackFloatProperty(trackId, "tkhd.volume", 1.0); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4a"); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the mp4a atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4a.timeScale", timeScale); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4a.esds.ESID", +#if 0 + // note - for a file, these values need to + // be 0 - wmay - 04/16/2003 + trackId +#else + 0 +#endif + ); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.objectTypeId", + audioType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.streamType", + MP4AudioStreamType); + + m_pTracks[FindTrackIndex(trackId)]-> + SetFixedSampleDuration(sampleDuration); + + return trackId; +} + +MP4TrackId MP4File::AddEncAudioTrack(u_int32_t timeScale, + MP4Duration sampleDuration, + u_int8_t audioType) +{ + MP4TrackId trackId = AddTrack(MP4_AUDIO_TRACK_TYPE, timeScale); + + AddTrackToOd(trackId); + + SetTrackFloatProperty(trackId, "tkhd.volume", 1.0); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "smhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "enca"); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the enca atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.enca.timeScale", timeScale); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.enca.esds.ESID", +#if 0 + // note - for a file, these values need to + // be 0 - wmay - 04/16/2003 + trackId +#else + 0 +#endif + ); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.enca.esds.decConfigDescr.objectTypeId", + audioType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.enca.esds.decConfigDescr.streamType", + MP4AudioStreamType); + + m_pTracks[FindTrackIndex(trackId)]-> + SetFixedSampleDuration(sampleDuration); + + return trackId; +} + +MP4TrackId MP4File::AddVideoTrack( + u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType) +{ + MP4TrackId trackId = AddTrack(MP4_VIDEO_TRACK_TYPE, timeScale); + + AddTrackToOd(trackId); + + SetTrackFloatProperty(trackId, "tkhd.width", width); + SetTrackFloatProperty(trackId, "tkhd.height", height); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "vmhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4v"); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the mp4v atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.width", width); + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.height", height); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.esds.ESID", +#if 0 + // note - for a file, these values need to + // be 0 - wmay - 04/16/2003 + trackId +#else + 0 +#endif + ); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.objectTypeId", + videoType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.streamType", + MP4VisualStreamType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsz.sampleSize", sampleDuration); + + m_pTracks[FindTrackIndex(trackId)]-> + SetFixedSampleDuration(sampleDuration); + + return trackId; +} + +MP4TrackId MP4File::AddEncVideoTrack(u_int32_t timeScale, + MP4Duration sampleDuration, + u_int16_t width, + u_int16_t height, + u_int8_t videoType) +{ + MP4TrackId trackId = AddTrack(MP4_VIDEO_TRACK_TYPE, timeScale); + + AddTrackToOd(trackId); + + SetTrackFloatProperty(trackId, "tkhd.width", width); + SetTrackFloatProperty(trackId, "tkhd.height", height); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "vmhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "encv"); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the encv atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.encv.width", width); + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.encv.height", height); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.encv.esds.ESID", +#if 0 + // note - for a file, these values need to + // be 0 - wmay - 04/16/2003 + trackId +#else + 0 +#endif + ); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.encv.esds.decConfigDescr.objectTypeId", + videoType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.encv.esds.decConfigDescr.streamType", + MP4VisualStreamType); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsz.sampleSize", sampleDuration); + + m_pTracks[FindTrackIndex(trackId)]-> + SetFixedSampleDuration(sampleDuration); + + return trackId; +} + +MP4TrackId MP4File::AddHintTrack(MP4TrackId refTrackId) +{ + // validate reference track id + FindTrackIndex(refTrackId); + + MP4TrackId trackId = + AddTrack(MP4_HINT_TRACK_TYPE, GetTrackTimeScale(refTrackId)); + + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "hmhd", 0); + + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "rtp "); + + // stsd is a unique beast in that it has a count of the number + // of child atoms that needs to be incremented after we add the rtp atom + MP4Integer32Property* pStsdCountProperty; + FindIntegerProperty( + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"), + (MP4Property**)&pStsdCountProperty); + pStsdCountProperty->IncrementValue(); + + SetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.rtp .tims.timeScale", + GetTrackTimeScale(trackId)); + + AddDescendantAtoms(MakeTrackName(trackId, NULL), "tref.hint"); + + AddTrackReference(MakeTrackName(trackId, "tref.hint"), refTrackId); + + AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hnti.sdp "); + + AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.hinf"); + + return trackId; +} + +void MP4File::DeleteTrack(MP4TrackId trackId) +{ + ProtectWriteOperation("MP4DeleteTrack"); + + u_int32_t trakIndex = FindTrakAtomIndex(trackId); + u_int16_t trackIndex = FindTrackIndex(trackId); + MP4Track* pTrack = m_pTracks[trackIndex]; + + MP4Atom* pTrakAtom = pTrack->GetTrakAtom(); + ASSERT(pTrakAtom); + + MP4Atom* pMoovAtom = FindAtom("moov"); + ASSERT(pMoovAtom); + + RemoveTrackFromIod(trackId); + RemoveTrackFromOd(trackId); + + if (trackId == m_odTrackId) { + m_odTrackId = 0; + } + + pMoovAtom->DeleteChildAtom(pTrakAtom); + + m_trakIds.Delete(trakIndex); + + m_pTracks.Delete(trackIndex); + + delete pTrack; + delete pTrakAtom; +} + +u_int32_t MP4File::GetNumberOfTracks(const char* type, u_int8_t subType) +{ + if (type == NULL) { + return m_pTracks.Size(); + } + + u_int32_t typeSeen = 0; + const char* normType = MP4Track::NormalizeTrackType(type); + + for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { + if (!strcmp(normType, m_pTracks[i]->GetType())) { + if (subType) { + if (normType == MP4_AUDIO_TRACK_TYPE) { + if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { + continue; + } + } else if (normType == MP4_VIDEO_TRACK_TYPE) { + if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { + continue; + } + } + // else unknown subtype, ignore it + } + typeSeen++; + } + } + return typeSeen; +} + +MP4TrackId MP4File::AllocTrackId() +{ + MP4TrackId trackId = + GetIntegerProperty("moov.mvhd.nextTrackId"); + + if (trackId <= 0xFFFF) { + // check that nextTrackid is correct + try { + FindTrackIndex(trackId); + // ERROR, this trackId is in use + } + catch (MP4Error* e) { + // OK, this trackId is not in use, proceed + delete e; + SetIntegerProperty("moov.mvhd.nextTrackId", trackId + 1); + return trackId; + } + } + + // we need to search for a track id + for (trackId = 1; trackId <= 0xFFFF; trackId++) { + try { + FindTrackIndex(trackId); + // KEEP LOOKING, this trackId is in use + } + catch (MP4Error* e) { + // OK, this trackId is not in use, proceed + delete e; + return trackId; + } + } + + // extreme case where mp4 file has 2^16 tracks in it + throw new MP4Error("too many existing tracks", "AddTrack"); + return MP4_INVALID_TRACK_ID; // to keep MSVC happy +} + +MP4TrackId MP4File::FindTrackId(u_int16_t trackIndex, + const char* type, u_int8_t subType) +{ + if (type == NULL) { + return m_pTracks[trackIndex]->GetId(); + } + + u_int32_t typeSeen = 0; + const char* normType = MP4Track::NormalizeTrackType(type); + + for (u_int32_t i = 0; i < m_pTracks.Size(); i++) { + if (!strcmp(normType, m_pTracks[i]->GetType())) { + if (subType) { + if (normType == MP4_AUDIO_TRACK_TYPE) { + if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { + continue; + } + } else if (normType == MP4_VIDEO_TRACK_TYPE) { + if (subType != GetTrackEsdsObjectTypeId(m_pTracks[i]->GetId())) { + continue; + } + } + // else unknown subtype, ignore it + } + + if (trackIndex == typeSeen) { + return m_pTracks[i]->GetId(); + } + + typeSeen++; + } + } + + throw new MP4Error("Track index doesn't exist - track %d type %s", + "FindTrackId", + trackIndex, type); + return MP4_INVALID_TRACK_ID; // satisfy MS compiler +} + +u_int16_t MP4File::FindTrackIndex(MP4TrackId trackId) +{ + for (u_int32_t i = 0; i < m_pTracks.Size() && i <= 0xFFFF; i++) { + if (m_pTracks[i]->GetId() == trackId) { + return (u_int16_t)i; + } + } + + throw new MP4Error("Track id %d doesn't exist", "FindTrackIndex", trackId); + return (u_int16_t)-1; // satisfy MS compiler +} + +u_int16_t MP4File::FindTrakAtomIndex(MP4TrackId trackId) +{ + if (trackId) { + for (u_int32_t i = 0; i < m_trakIds.Size(); i++) { + if (m_trakIds[i] == trackId) { + return i; + } + } + } + + throw new MP4Error("Track id %d doesn't exist", "FindTrakAtomIndex", + trackId); + return (u_int16_t)-1; // satisfy MS compiler +} + +u_int32_t MP4File::GetSampleSize(MP4TrackId trackId, MP4SampleId sampleId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetSampleSize(sampleId); +} + +u_int32_t MP4File::GetTrackMaxSampleSize(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetMaxSampleSize(); +} + +MP4SampleId MP4File::GetSampleIdFromTime(MP4TrackId trackId, + MP4Timestamp when, bool wantSyncSample) +{ + return m_pTracks[FindTrackIndex(trackId)]-> + GetSampleIdFromTime(when, wantSyncSample); +} + +MP4Timestamp MP4File::GetSampleTime( + MP4TrackId trackId, MP4SampleId sampleId) +{ + MP4Timestamp timestamp; + m_pTracks[FindTrackIndex(trackId)]-> + GetSampleTimes(sampleId, ×tamp, NULL); + return timestamp; +} + +MP4Duration MP4File::GetSampleDuration( + MP4TrackId trackId, MP4SampleId sampleId) +{ + MP4Duration duration; + m_pTracks[FindTrackIndex(trackId)]-> + GetSampleTimes(sampleId, NULL, &duration); + return duration; +} + +MP4Duration MP4File::GetSampleRenderingOffset( + MP4TrackId trackId, MP4SampleId sampleId) +{ + return m_pTracks[FindTrackIndex(trackId)]-> + GetSampleRenderingOffset(sampleId); +} + +bool MP4File::GetSampleSync(MP4TrackId trackId, MP4SampleId sampleId) +{ + return m_pTracks[FindTrackIndex(trackId)]->IsSyncSample(sampleId); +} + +void MP4File::ReadSample(MP4TrackId trackId, MP4SampleId sampleId, + u_int8_t** ppBytes, u_int32_t* pNumBytes, + MP4Timestamp* pStartTime, MP4Duration* pDuration, + MP4Duration* pRenderingOffset, bool* pIsSyncSample) +{ + m_pTracks[FindTrackIndex(trackId)]-> + ReadSample(sampleId, ppBytes, pNumBytes, + pStartTime, pDuration, pRenderingOffset, pIsSyncSample); +} + +void MP4File::WriteSample(MP4TrackId trackId, + const u_int8_t* pBytes, u_int32_t numBytes, + MP4Duration duration, MP4Duration renderingOffset, bool isSyncSample) +{ + ProtectWriteOperation("MP4WriteSample"); + + m_pTracks[FindTrackIndex(trackId)]-> + WriteSample(pBytes, numBytes, duration, renderingOffset, isSyncSample); + + m_pModificationProperty->SetValue(MP4GetAbsTimestamp()); +} + +void MP4File::SetSampleRenderingOffset(MP4TrackId trackId, + MP4SampleId sampleId, MP4Duration renderingOffset) +{ + ProtectWriteOperation("MP4SetSampleRenderingOffset"); + + m_pTracks[FindTrackIndex(trackId)]-> + SetSampleRenderingOffset(sampleId, renderingOffset); + + m_pModificationProperty->SetValue(MP4GetAbsTimestamp()); +} + +char* MP4File::MakeTrackName(MP4TrackId trackId, const char* name) +{ + u_int16_t trakIndex = FindTrakAtomIndex(trackId); + + static char trakName[1024]; + if (name == NULL || name[0] == '\0') { + snprintf(trakName, sizeof(trakName), + "moov.trak[%u]", trakIndex); + } else { + snprintf(trakName, sizeof(trakName), + "moov.trak[%u].%s", trakIndex, name); + } + return trakName; +} + +u_int64_t MP4File::GetTrackIntegerProperty(MP4TrackId trackId, const char* name) +{ + return GetIntegerProperty(MakeTrackName(trackId, name)); +} + +void MP4File::SetTrackIntegerProperty(MP4TrackId trackId, const char* name, + int64_t value) +{ + SetIntegerProperty(MakeTrackName(trackId, name), value); +} + +float MP4File::GetTrackFloatProperty(MP4TrackId trackId, const char* name) +{ + return GetFloatProperty(MakeTrackName(trackId, name)); +} + +void MP4File::SetTrackFloatProperty(MP4TrackId trackId, const char* name, + float value) +{ + SetFloatProperty(MakeTrackName(trackId, name), value); +} + +const char* MP4File::GetTrackStringProperty(MP4TrackId trackId, const char* name) +{ + return GetStringProperty(MakeTrackName(trackId, name)); +} + +void MP4File::SetTrackStringProperty(MP4TrackId trackId, const char* name, + const char* value) +{ + SetStringProperty(MakeTrackName(trackId, name), value); +} + +void MP4File::GetTrackBytesProperty(MP4TrackId trackId, const char* name, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + GetBytesProperty(MakeTrackName(trackId, name), ppValue, pValueSize); +} + +void MP4File::SetTrackBytesProperty(MP4TrackId trackId, const char* name, + const u_int8_t* pValue, u_int32_t valueSize) +{ + SetBytesProperty(MakeTrackName(trackId, name), pValue, valueSize); +} + + +// file level convenience functions + +MP4Duration MP4File::GetDuration() +{ + return m_pDurationProperty->GetValue(); +} + +void MP4File::SetDuration(MP4Duration value) +{ + m_pDurationProperty->SetValue(value); +} + +u_int32_t MP4File::GetTimeScale() +{ + return m_pTimeScaleProperty->GetValue(); +} + +void MP4File::SetTimeScale(u_int32_t value) +{ + if (value == 0) { + throw new MP4Error("invalid value", "SetTimeScale"); + } + m_pTimeScaleProperty->SetValue(value); +} + +u_int8_t MP4File::GetODProfileLevel() +{ + return GetIntegerProperty("moov.iods.ODProfileLevelId"); +} + +void MP4File::SetODProfileLevel(u_int8_t value) +{ + SetIntegerProperty("moov.iods.ODProfileLevelId", value); +} + +u_int8_t MP4File::GetSceneProfileLevel() +{ + return GetIntegerProperty("moov.iods.sceneProfileLevelId"); +} + +void MP4File::SetSceneProfileLevel(u_int8_t value) +{ + SetIntegerProperty("moov.iods.sceneProfileLevelId", value); +} + +u_int8_t MP4File::GetVideoProfileLevel() +{ + return GetIntegerProperty("moov.iods.visualProfileLevelId"); +} + +void MP4File::SetVideoProfileLevel(u_int8_t value) +{ + SetIntegerProperty("moov.iods.visualProfileLevelId", value); +} + +u_int8_t MP4File::GetAudioProfileLevel() +{ + return GetIntegerProperty("moov.iods.audioProfileLevelId"); +} + +void MP4File::SetAudioProfileLevel(u_int8_t value) +{ + SetIntegerProperty("moov.iods.audioProfileLevelId", value); +} + +u_int8_t MP4File::GetGraphicsProfileLevel() +{ + return GetIntegerProperty("moov.iods.graphicsProfileLevelId"); +} + +void MP4File::SetGraphicsProfileLevel(u_int8_t value) +{ + SetIntegerProperty("moov.iods.graphicsProfileLevelId", value); +} + +const char* MP4File::GetSessionSdp() +{ + return GetStringProperty("moov.udta.hnti.rtp .sdpText"); +} + +void MP4File::SetSessionSdp(const char* sdpString) +{ + AddDescendantAtoms("moov", "udta.hnti.rtp "); + + SetStringProperty("moov.udta.hnti.rtp .sdpText", sdpString); +} + +void MP4File::AppendSessionSdp(const char* sdpFragment) +{ + const char* oldSdpString = NULL; + try { + oldSdpString = GetSessionSdp(); + } + catch (MP4Error* e) { + delete e; + SetSessionSdp(sdpFragment); + return; + } + + char* newSdpString = + (char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1); + strcpy(newSdpString, oldSdpString); + strcat(newSdpString, sdpFragment); + SetSessionSdp(newSdpString); + MP4Free(newSdpString); +} + + +// track level convenience functions + +MP4SampleId MP4File::GetTrackNumberOfSamples(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetNumberOfSamples(); +} + +const char* MP4File::GetTrackType(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetType(); +} + +u_int32_t MP4File::GetTrackTimeScale(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetTimeScale(); +} + +void MP4File::SetTrackTimeScale(MP4TrackId trackId, u_int32_t value) +{ + if (value == 0) { + throw new MP4Error("invalid value", "SetTrackTimeScale"); + } + SetTrackIntegerProperty(trackId, "mdia.mdhd.timeScale", value); +} + +MP4Duration MP4File::GetTrackDuration(MP4TrackId trackId) +{ + return GetTrackIntegerProperty(trackId, "mdia.mdhd.duration"); +} + +// now GetTrackEsdsObjectTypeId +u_int8_t MP4File::GetTrackAudioType(MP4TrackId trackId) +{ + return GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4a.esds.decConfigDescr.objectTypeId"); +} + +u_int8_t MP4File::GetTrackEsdsObjectTypeId(MP4TrackId trackId) +{ + // changed mp4a to * to handle enca case + return GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.*.esds.decConfigDescr.objectTypeId"); +} + +u_int8_t MP4File::GetTrackAudioMpeg4Type(MP4TrackId trackId) +{ + // verify that track is an MPEG-4 audio track + if (GetTrackEsdsObjectTypeId(trackId) != MP4_MPEG4_AUDIO_TYPE) { + return MP4_MPEG4_INVALID_AUDIO_TYPE; + } + + u_int8_t* pEsConfig = NULL; + u_int32_t esConfigSize; + + // The Mpeg4 audio type (AAC, CELP, HXVC, ...) + // is the first 5 bits of the ES configuration + + GetTrackESConfiguration(trackId, &pEsConfig, &esConfigSize); + + if (esConfigSize < 1) { + return MP4_MPEG4_INVALID_AUDIO_TYPE; + } + + u_int8_t mpeg4Type = (pEsConfig[0] >> 3); + + free(pEsConfig); + + return mpeg4Type; +} + +// replaced with GetTrackEsdsObjectTypeId +u_int8_t MP4File::GetTrackVideoType(MP4TrackId trackId) +{ + return GetTrackIntegerProperty(trackId, + "mdia.minf.stbl.stsd.mp4v.esds.decConfigDescr.objectTypeId"); +} + +MP4Duration MP4File::GetTrackFixedSampleDuration(MP4TrackId trackId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetFixedSampleDuration(); +} + +float MP4File::GetTrackVideoFrameRate(MP4TrackId trackId) +{ + MP4SampleId numSamples = + GetTrackNumberOfSamples(trackId); + u_int64_t + msDuration = + ConvertFromTrackDuration(trackId, + GetTrackDuration(trackId), MP4_MSECS_TIME_SCALE); + + if (msDuration == 0) { + return 0.0; + } + + return ((double)numSamples / UINT64_TO_DOUBLE(msDuration)) * MP4_MSECS_TIME_SCALE; +} + +void MP4File::GetTrackESConfiguration(MP4TrackId trackId, + u_int8_t** ppConfig, u_int32_t* pConfigSize) +{ + GetTrackBytesProperty(trackId, + "mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo[0].info", + ppConfig, pConfigSize); +} + +void MP4File::SetTrackESConfiguration(MP4TrackId trackId, + const u_int8_t* pConfig, u_int32_t configSize) +{ + // get a handle on the track decoder config descriptor + MP4DescriptorProperty* pConfigDescrProperty = NULL; + FindProperty(MakeTrackName(trackId, + "mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo"), + (MP4Property**)&pConfigDescrProperty); + + if (pConfigDescrProperty == NULL) { + // probably trackId refers to a hint track + throw new MP4Error("no such property", "MP4SetTrackESConfiguration"); + } + + // lookup the property to store the configuration + MP4BytesProperty* pInfoProperty = NULL; + pConfigDescrProperty->FindProperty("decSpecificInfo[0].info", + (MP4Property**)&pInfoProperty); + + // configuration being set for the first time + if (pInfoProperty == NULL) { + // need to create a new descriptor to hold it + MP4Descriptor* pConfigDescr = + pConfigDescrProperty->AddDescriptor(MP4DecSpecificDescrTag); + pConfigDescr->Generate(); + + pConfigDescrProperty->FindProperty( + "decSpecificInfo[0].info", + (MP4Property**)&pInfoProperty); + ASSERT(pInfoProperty); + } + + // set the value + pInfoProperty->SetValue(pConfig, configSize); +} + +const char* MP4File::GetHintTrackSdp(MP4TrackId hintTrackId) +{ + return GetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText"); +} + +void MP4File::SetHintTrackSdp(MP4TrackId hintTrackId, const char* sdpString) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4SetHintTrackSdp"); + } + + AddDescendantAtoms( + MakeTrackName(hintTrackId, NULL), "udta.hnti.sdp "); + + SetTrackStringProperty(hintTrackId, "udta.hnti.sdp .sdpText", sdpString); +} + +void MP4File::AppendHintTrackSdp(MP4TrackId hintTrackId, + const char* sdpFragment) +{ + const char* oldSdpString = NULL; + try { + oldSdpString = GetHintTrackSdp(hintTrackId); + } + catch (MP4Error* e) { + delete e; + SetHintTrackSdp(hintTrackId, sdpFragment); + return; + } + + char* newSdpString = + (char*)MP4Malloc(strlen(oldSdpString) + strlen(sdpFragment) + 1); + strcpy(newSdpString, oldSdpString); + strcat(newSdpString, sdpFragment); + SetHintTrackSdp(hintTrackId, newSdpString); + MP4Free(newSdpString); +} + +void MP4File::GetHintTrackRtpPayload( + MP4TrackId hintTrackId, + char** ppPayloadName, + u_int8_t* pPayloadNumber, + u_int16_t* pMaxPayloadSize, + char **ppEncodingParams) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetHintTrackRtpPayload"); + } + + ((MP4RtpHintTrack*)pTrack)->GetPayload( + ppPayloadName, pPayloadNumber, pMaxPayloadSize, ppEncodingParams); +} + +void MP4File::SetHintTrackRtpPayload(MP4TrackId hintTrackId, + const char* payloadName, u_int8_t* pPayloadNumber, u_int16_t maxPayloadSize, + const char *encoding_params, + bool include_rtp_map, + bool include_mpeg4_esid) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4SetHintTrackRtpPayload"); + } + + u_int8_t payloadNumber; + if (pPayloadNumber && *pPayloadNumber != MP4_SET_DYNAMIC_PAYLOAD) { + payloadNumber = *pPayloadNumber; + } else { + payloadNumber = AllocRtpPayloadNumber(); + if (pPayloadNumber) { + *pPayloadNumber = payloadNumber; + } + } + + ((MP4RtpHintTrack*)pTrack)->SetPayload( + payloadName, payloadNumber, maxPayloadSize, encoding_params, + include_rtp_map, include_mpeg4_esid); +} + +u_int8_t MP4File::AllocRtpPayloadNumber() +{ + MP4Integer32Array usedPayloads; + u_int32_t i; + + // collect rtp payload numbers in use by existing tracks + for (i = 0; i < m_pTracks.Size(); i++) { + MP4Atom* pTrakAtom = m_pTracks[i]->GetTrakAtom(); + + MP4Integer32Property* pPayloadProperty = NULL; + pTrakAtom->FindProperty("trak.udta.hinf.payt.payloadNumber", + (MP4Property**)&pPayloadProperty); + + if (pPayloadProperty) { + usedPayloads.Add(pPayloadProperty->GetValue()); + } + } + + // search dynamic payload range for an available slot + u_int8_t payload; + for (payload = 96; payload < 128; payload++) { + for (i = 0; i < usedPayloads.Size(); i++) { + if (payload == usedPayloads[i]) { + break; + } + } + if (i == usedPayloads.Size()) { + break; + } + } + + if (payload >= 128) { + throw new MP4Error("no more available rtp payload numbers", + "AllocRtpPayloadNumber"); + } + + return payload; +} + +MP4TrackId MP4File::GetHintTrackReferenceTrackId( + MP4TrackId hintTrackId) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetHintTrackReferenceTrackId"); + } + + MP4Track* pRefTrack = ((MP4RtpHintTrack*)pTrack)->GetRefTrack(); + + if (pRefTrack == NULL) { + return MP4_INVALID_TRACK_ID; + } + return pRefTrack->GetId(); +} + +void MP4File::ReadRtpHint( + MP4TrackId hintTrackId, + MP4SampleId hintSampleId, + u_int16_t* pNumPackets) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", "MP4ReadRtpHint"); + } + ((MP4RtpHintTrack*)pTrack)-> + ReadHint(hintSampleId, pNumPackets); +} + +u_int16_t MP4File::GetRtpHintNumberOfPackets( + MP4TrackId hintTrackId) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetRtpHintNumberOfPackets"); + } + return ((MP4RtpHintTrack*)pTrack)->GetHintNumberOfPackets(); +} + +int8_t MP4File::GetRtpPacketBFrame( + MP4TrackId hintTrackId, + u_int16_t packetIndex) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetRtpHintBFrame"); + } + return ((MP4RtpHintTrack*)pTrack)->GetPacketBFrame(packetIndex); +} + +int32_t MP4File::GetRtpPacketTransmitOffset( + MP4TrackId hintTrackId, + u_int16_t packetIndex) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetRtpPacketTransmitOffset"); + } + return ((MP4RtpHintTrack*)pTrack)->GetPacketTransmitOffset(packetIndex); +} + +void MP4File::ReadRtpPacket( + MP4TrackId hintTrackId, + u_int16_t packetIndex, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + u_int32_t ssrc, + bool includeHeader, + bool includePayload) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", "MP4ReadPacket"); + } + ((MP4RtpHintTrack*)pTrack)->ReadPacket( + packetIndex, ppBytes, pNumBytes, + ssrc, includeHeader, includePayload); +} + +MP4Timestamp MP4File::GetRtpTimestampStart( + MP4TrackId hintTrackId) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4GetRtpTimestampStart"); + } + return ((MP4RtpHintTrack*)pTrack)->GetRtpTimestampStart(); +} + +void MP4File::SetRtpTimestampStart( + MP4TrackId hintTrackId, + MP4Timestamp rtpStart) +{ + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4SetRtpTimestampStart"); + } + ((MP4RtpHintTrack*)pTrack)->SetRtpTimestampStart(rtpStart); +} + +void MP4File::AddRtpHint(MP4TrackId hintTrackId, + bool isBframe, u_int32_t timestampOffset) +{ + ProtectWriteOperation("MP4AddRtpHint"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", "MP4AddRtpHint"); + } + ((MP4RtpHintTrack*)pTrack)->AddHint(isBframe, timestampOffset); +} + +void MP4File::AddRtpPacket( + MP4TrackId hintTrackId, bool setMbit, int32_t transmitOffset) +{ + ProtectWriteOperation("MP4AddRtpPacket"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", "MP4AddRtpPacket"); + } + ((MP4RtpHintTrack*)pTrack)->AddPacket(setMbit, transmitOffset); +} + +void MP4File::AddRtpImmediateData(MP4TrackId hintTrackId, + const u_int8_t* pBytes, u_int32_t numBytes) +{ + ProtectWriteOperation("MP4AddRtpImmediateData"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4AddRtpImmediateData"); + } + ((MP4RtpHintTrack*)pTrack)->AddImmediateData(pBytes, numBytes); +} + +void MP4File::AddRtpSampleData(MP4TrackId hintTrackId, + MP4SampleId sampleId, u_int32_t dataOffset, u_int32_t dataLength) +{ + ProtectWriteOperation("MP4AddRtpSampleData"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4AddRtpSampleData"); + } + ((MP4RtpHintTrack*)pTrack)->AddSampleData( + sampleId, dataOffset, dataLength); +} + +void MP4File::AddRtpESConfigurationPacket(MP4TrackId hintTrackId) +{ + ProtectWriteOperation("MP4AddRtpESConfigurationPacket"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4AddRtpESConfigurationPacket"); + } + ((MP4RtpHintTrack*)pTrack)->AddESConfigurationPacket(); +} + +void MP4File::WriteRtpHint(MP4TrackId hintTrackId, + MP4Duration duration, bool isSyncSample) +{ + ProtectWriteOperation("MP4WriteRtpHint"); + + MP4Track* pTrack = m_pTracks[FindTrackIndex(hintTrackId)]; + + if (strcmp(pTrack->GetType(), MP4_HINT_TRACK_TYPE)) { + throw new MP4Error("track is not a hint track", + "MP4WriteRtpHint"); + } + ((MP4RtpHintTrack*)pTrack)->WriteHint(duration, isSyncSample); +} + +u_int64_t MP4File::ConvertFromMovieDuration( + MP4Duration duration, + u_int32_t timeScale) +{ + return MP4ConvertTime((u_int64_t)duration, + GetTimeScale(), timeScale); +} + +u_int64_t MP4File::ConvertFromTrackTimestamp( + MP4TrackId trackId, + MP4Timestamp timeStamp, + u_int32_t timeScale) +{ + return MP4ConvertTime(timeStamp, + GetTrackTimeScale(trackId), timeScale); +} + +MP4Timestamp MP4File::ConvertToTrackTimestamp( + MP4TrackId trackId, + u_int64_t timeStamp, + u_int32_t timeScale) +{ + return (MP4Timestamp)MP4ConvertTime(timeStamp, + timeScale, GetTrackTimeScale(trackId)); +} + +u_int64_t MP4File::ConvertFromTrackDuration( + MP4TrackId trackId, + MP4Duration duration, + u_int32_t timeScale) +{ + return MP4ConvertTime((u_int64_t)duration, + GetTrackTimeScale(trackId), timeScale); +} + +MP4Duration MP4File::ConvertToTrackDuration( + MP4TrackId trackId, + u_int64_t duration, + u_int32_t timeScale) +{ + return (MP4Duration)MP4ConvertTime(duration, + timeScale, GetTrackTimeScale(trackId)); +} + +u_int8_t MP4File::ConvertTrackTypeToStreamType(const char* trackType) +{ + u_int8_t streamType; + + if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) { + streamType = MP4ObjectDescriptionStreamType; + } else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) { + streamType = MP4SceneDescriptionStreamType; + } else if (!strcmp(trackType, MP4_CLOCK_TRACK_TYPE)) { + streamType = MP4ClockReferenceStreamType; + } else if (!strcmp(trackType, MP4_MPEG7_TRACK_TYPE)) { + streamType = MP4Mpeg7StreamType; + } else if (!strcmp(trackType, MP4_OCI_TRACK_TYPE)) { + streamType = MP4OCIStreamType; + } else if (!strcmp(trackType, MP4_IPMP_TRACK_TYPE)) { + streamType = MP4IPMPStreamType; + } else if (!strcmp(trackType, MP4_MPEGJ_TRACK_TYPE)) { + streamType = MP4MPEGJStreamType; + } else { + streamType = MP4UserPrivateStreamType; + } + + return streamType; +} + +// edit list + +char* MP4File::MakeTrackEditName( + MP4TrackId trackId, + MP4EditId editId, + const char* name) +{ + char* trakName = MakeTrackName(trackId, NULL); + + static char editName[1024]; + snprintf(editName, sizeof(editName), + "%s.edts.elst.entries[%u].%s", + trakName, editId - 1, name); + return editName; +} + +MP4EditId MP4File::AddTrackEdit( + MP4TrackId trackId, + MP4EditId editId) +{ + ProtectWriteOperation("AddTrackEdit"); + return m_pTracks[FindTrackIndex(trackId)]->AddEdit(editId); +} + +void MP4File::DeleteTrackEdit( + MP4TrackId trackId, + MP4EditId editId) +{ + ProtectWriteOperation("DeleteTrackEdit"); + m_pTracks[FindTrackIndex(trackId)]->DeleteEdit(editId); +} + +u_int32_t MP4File::GetTrackNumberOfEdits( + MP4TrackId trackId) +{ + return GetTrackIntegerProperty(trackId, "edts.elst.entryCount"); +} + +MP4Duration MP4File::GetTrackEditTotalDuration( + MP4TrackId trackId, + MP4EditId editId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetEditTotalDuration(editId); +} + +MP4Timestamp MP4File::GetTrackEditStart( + MP4TrackId trackId, + MP4EditId editId) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetEditStart(editId); +} + +MP4Timestamp MP4File::GetTrackEditMediaStart( + MP4TrackId trackId, + MP4EditId editId) +{ + return GetIntegerProperty( + MakeTrackEditName(trackId, editId, "mediaTime")); +} + +void MP4File::SetTrackEditMediaStart( + MP4TrackId trackId, + MP4EditId editId, + MP4Timestamp startTime) +{ + SetIntegerProperty( + MakeTrackEditName(trackId, editId, "mediaTime"), + startTime); +} + +MP4Duration MP4File::GetTrackEditDuration( + MP4TrackId trackId, + MP4EditId editId) +{ + return GetIntegerProperty( + MakeTrackEditName(trackId, editId, "segmentDuration")); +} + +void MP4File::SetTrackEditDuration( + MP4TrackId trackId, + MP4EditId editId, + MP4Duration duration) +{ + SetIntegerProperty( + MakeTrackEditName(trackId, editId, "segmentDuration"), + duration); +} + +bool MP4File::GetTrackEditDwell( + MP4TrackId trackId, + MP4EditId editId) +{ + return (GetIntegerProperty( + MakeTrackEditName(trackId, editId, "mediaRate")) == 0); +} + +void MP4File::SetTrackEditDwell( + MP4TrackId trackId, + MP4EditId editId, + bool dwell) +{ + SetIntegerProperty( + MakeTrackEditName(trackId, editId, "mediaRate"), + (dwell ? 0 : 1)); +} + +MP4SampleId MP4File::GetSampleIdFromEditTime( + MP4TrackId trackId, + MP4Timestamp when, + MP4Timestamp* pStartTime, + MP4Duration* pDuration) +{ + return m_pTracks[FindTrackIndex(trackId)]->GetSampleIdFromEditTime( + when, pStartTime, pDuration); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v2_cb.vcproj +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v2_cb.vcproj @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/need_for_win32.c +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/need_for_win32.c @@ -0,0 +1,12 @@ +#include "systems.h" +#include + +int gettimeofday (struct timeval *t, void *foo) +{ + struct _timeb temp; + _ftime(&temp); + t->tv_sec = temp.time; + t->tv_usec = temp.millitm * 1000; + return (0); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tmax.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tmax.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TmaxAtom::MP4TmaxAtom() + : MP4Atom("tmax") +{ + AddProperty( // max relative xmit time + new MP4Integer32Property("milliSecs")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tref.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tref.cpp @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrefAtom::MP4TrefAtom() + : MP4Atom("tref") +{ + ExpectChildAtom("dpnd", Optional, OnlyOne); + ExpectChildAtom("hint", Optional, OnlyOne); + ExpectChildAtom("ipir", Optional, OnlyOne); + ExpectChildAtom("mpod", Optional, OnlyOne); + ExpectChildAtom("sync", Optional, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v2_st60.dsp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v2_st60.dsp @@ -0,0 +1,552 @@ +# Microsoft Developer Studio Project File - Name="libmp4v2_st" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libmp4v2_st - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libmp4v2_st60.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libmp4v2_st60.mak" CFG="libmp4v2_st - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libmp4v2_st - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libmp4v2_st - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "libmp4v2_st - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ST_Release" +# PROP Intermediate_Dir "ST_Release" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O1 /I ".\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libmp4v2_st - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "ST_Debug" +# PROP Intermediate_Dir "ST_Debug" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I ".\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libmp4v2_st - Win32 Release" +# Name "libmp4v2_st - Win32 Debug" +# Begin Group "source" + +# PROP Default_Filter ".c, .cpp" +# Begin Source File + +SOURCE=.\atom_co64.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_cprt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ctts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dimm.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmed.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_drep.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_edts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_elst.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_enca.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_encv.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_esds.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_free.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_frma.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ftyp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hdlr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hnti.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iKMS.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iods.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iSFM.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_maxr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdat.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdia.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_meta.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_minf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moof.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moov.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4a.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4s.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4v.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nump.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_payt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_pmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_root.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_rtp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_schi.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_schm.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_sdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_sinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_smhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_snro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stbl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stco.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsc.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsh.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stss.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsz.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tims.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tkhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmin.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tpyl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_traf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trak.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_treftype.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trpy.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trun.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tsro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_udta.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_url.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_urn.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_vmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\descriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\isma.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4container.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file_io.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4meta.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4property.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4track.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4util.cpp +# End Source File +# Begin Source File + +SOURCE=.\need_for_win32.c +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\odcommands.cpp +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.cpp +# End Source File +# Begin Source File + +SOURCE=.\rtphint.cpp +# End Source File +# End Group +# Begin Group "include" + +# PROP Default_Filter ".h" +# Begin Source File + +SOURCE=.\atoms.h +# End Source File +# Begin Source File + +SOURCE=.\descriptors.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\mp4array.h +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.h +# End Source File +# Begin Source File + +SOURCE=.\mp4common.h +# End Source File +# Begin Source File + +SOURCE=.\mp4container.h +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.h +# End Source File +# Begin Source File + +SOURCE=.\mp4file.h +# End Source File +# Begin Source File + +SOURCE=.\mp4property.h +# End Source File +# Begin Source File + +SOURCE=.\mp4track.h +# End Source File +# Begin Source File + +SOURCE=.\mp4util.h +# End Source File +# Begin Source File + +SOURCE=.\mpeg4ip.h +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.h +# End Source File +# Begin Source File + +SOURCE=.\odcommands.h +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.h +# End Source File +# Begin Source File + +SOURCE=.\rtphint.h +# End Source File +# Begin Source File + +SOURCE=.\systems.h +# End Source File +# Begin Source File + +SOURCE=.\win32_ver.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\mp4info.cpp +# End Source File +# End Target +# End Project --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4property.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4property.h @@ -0,0 +1,549 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_PROPERTY_INCLUDED__ +#define __MP4_PROPERTY_INCLUDED__ + +// forward declarations +class MP4Atom; + +class MP4Descriptor; +MP4ARRAY_DECL(MP4Descriptor, MP4Descriptor*); + +enum MP4PropertyType { + Integer8Property, + Integer16Property, + Integer24Property, + Integer32Property, + Integer64Property, + Float32Property, + StringProperty, + BytesProperty, + TableProperty, + DescriptorProperty, +}; + +class MP4Property { +public: + MP4Property(const char *name = NULL); + + virtual ~MP4Property() { } + + MP4Atom* GetParentAtom() { + return m_pParentAtom; + } + virtual void SetParentAtom(MP4Atom* pParentAtom) { + m_pParentAtom = pParentAtom; + } + + const char *GetName() { + return m_name; + } + + virtual MP4PropertyType GetType() = NULL; + + bool IsReadOnly() { + return m_readOnly; + } + void SetReadOnly(bool value = true) { + m_readOnly = value; + } + + bool IsImplicit() { + return m_implicit; + } + void SetImplicit(bool value = true) { + m_implicit = value; + } + + virtual u_int32_t GetCount() = NULL; + virtual void SetCount(u_int32_t count) = NULL; + + virtual void Generate() { /* default is a no-op */ }; + + virtual void Read(MP4File* pFile, u_int32_t index = 0) = NULL; + + virtual void Write(MP4File* pFile, u_int32_t index = 0) = NULL; + + virtual void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0) = NULL; + + virtual bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + +protected: + MP4Atom* m_pParentAtom; + const char* m_name; + bool m_readOnly; + bool m_implicit; +}; + +MP4ARRAY_DECL(MP4Property, MP4Property*); + +class MP4IntegerProperty : public MP4Property { +protected: + MP4IntegerProperty(char* name) + : MP4Property(name) { }; + +public: + u_int64_t GetValue(u_int32_t index = 0); + + void SetValue(u_int64_t value, u_int32_t index = 0); + + void InsertValue(u_int64_t value, u_int32_t index = 0); + + void DeleteValue(u_int32_t index = 0); + + void IncrementValue(int32_t increment = 1, u_int32_t index = 0); +}; + +#define MP4INTEGER_PROPERTY_DECL2(isize, xsize) \ + class MP4Integer##xsize##Property : public MP4IntegerProperty { \ + public: \ + MP4Integer##xsize##Property(char* name) \ + : MP4IntegerProperty(name) { \ + SetCount(1); \ + m_values[0] = 0; \ + } \ + \ + MP4PropertyType GetType() { \ + return Integer##xsize##Property; \ + } \ + \ + u_int32_t GetCount() { \ + return m_values.Size(); \ + } \ + void SetCount(u_int32_t count) { \ + m_values.Resize(count); \ + } \ + \ + u_int##isize##_t GetValue(u_int32_t index = 0) { \ + return m_values[index]; \ + } \ + \ + void SetValue(u_int##isize##_t value, u_int32_t index = 0) { \ + if (m_readOnly) { \ + throw new MP4Error(EACCES, "property is read-only", m_name); \ + } \ + m_values[index] = value; \ + } \ + void AddValue(u_int##isize##_t value) { \ + m_values.Add(value); \ + } \ + void InsertValue(u_int##isize##_t value, u_int32_t index) { \ + m_values.Insert(value, index); \ + } \ + void DeleteValue(u_int32_t index) { \ + m_values.Delete(index); \ + } \ + void IncrementValue(int32_t increment = 1, u_int32_t index = 0) { \ + m_values[index] += increment; \ + } \ + void Read(MP4File* pFile, u_int32_t index = 0) { \ + if (m_implicit) { \ + return; \ + } \ + m_values[index] = pFile->ReadUInt##xsize(); \ + } \ + \ + void Write(MP4File* pFile, u_int32_t index = 0) { \ + if (m_implicit) { \ + return; \ + } \ + pFile->WriteUInt##xsize(m_values[index]); \ + } \ + void Dump(FILE* pFile, u_int8_t indent, \ + bool dumpImplicits, u_int32_t index = 0); \ + \ + protected: \ + MP4Integer##isize##Array m_values; \ + }; + +#define MP4INTEGER_PROPERTY_DECL(size) \ + MP4INTEGER_PROPERTY_DECL2(size, size) + +MP4INTEGER_PROPERTY_DECL(8); +MP4INTEGER_PROPERTY_DECL(16); +MP4INTEGER_PROPERTY_DECL2(32, 24); +MP4INTEGER_PROPERTY_DECL(32); +MP4INTEGER_PROPERTY_DECL(64); + +class MP4BitfieldProperty : public MP4Integer64Property { +public: + MP4BitfieldProperty(char* name, u_int8_t numBits) + : MP4Integer64Property(name) { + ASSERT(numBits != 0); + ASSERT(numBits <= 64); + m_numBits = numBits; + } + + u_int8_t GetNumBits() { + return m_numBits; + } + void SetNumBits(u_int8_t numBits) { + m_numBits = numBits; + } + + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + +protected: + u_int8_t m_numBits; +}; + +class MP4Float32Property : public MP4Property { +public: + MP4Float32Property(char* name) + : MP4Property(name) { + m_useFixed16Format = false; + m_useFixed32Format = false; + SetCount(1); + m_values[0] = 0.0; + } + + MP4PropertyType GetType() { + return Float32Property; + } + + u_int32_t GetCount() { + return m_values.Size(); + } + void SetCount(u_int32_t count) { + m_values.Resize(count); + } + + float GetValue(u_int32_t index = 0) { + return m_values[index]; + } + + void SetValue(float value, u_int32_t index = 0) { + if (m_readOnly) { + throw new MP4Error(EACCES, "property is read-only", m_name); + } + m_values[index] = value; + } + + void AddValue(float value) { + m_values.Add(value); + } + + void InsertValue(float value, u_int32_t index) { + m_values.Insert(value, index); + } + + bool IsFixed16Format() { + return m_useFixed16Format; + } + + void SetFixed16Format(bool useFixed16Format = true) { + m_useFixed16Format = useFixed16Format; + } + + bool IsFixed32Format() { + return m_useFixed32Format; + } + + void SetFixed32Format(bool useFixed32Format = true) { + m_useFixed32Format = useFixed32Format; + } + + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + +protected: + bool m_useFixed16Format; + bool m_useFixed32Format; + MP4Float32Array m_values; +}; + +class MP4StringProperty : public MP4Property { +public: + MP4StringProperty(char* name, + bool useCountedFormat = false, bool useUnicode = false); + + ~MP4StringProperty(); + + MP4PropertyType GetType() { + return StringProperty; + } + + u_int32_t GetCount() { + return m_values.Size(); + } + + void SetCount(u_int32_t count); + + const char* GetValue(u_int32_t index = 0) { + return m_values[index]; + } + + void SetValue(const char* value, u_int32_t index = 0); + + void AddValue(char* value) { + u_int32_t count = GetCount(); + SetCount(count + 1); + SetValue(value, count); + } + + bool IsCountedFormat() { + return m_useCountedFormat; + } + + void SetCountedFormat(bool useCountedFormat) { + m_useCountedFormat = useCountedFormat; + } + + bool IsExpandedCountedFormat() { + return m_useExpandedCount; + } + + void SetExpandedCountedFormat(bool useExpandedCount) { + m_useExpandedCount = useExpandedCount; + } + + bool IsUnicode() { + return m_useUnicode; + } + + void SetUnicode(bool useUnicode) { + m_useUnicode = useUnicode; + } + + u_int32_t GetFixedLength() { + return m_fixedLength; + } + + void SetFixedLength(u_int32_t fixedLength) { + m_fixedLength = fixedLength; + } + + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + +protected: + bool m_useCountedFormat; + bool m_useExpandedCount; + bool m_useUnicode; + u_int32_t m_fixedLength; + + MP4StringArray m_values; +}; + +class MP4BytesProperty : public MP4Property { +public: + MP4BytesProperty(char* name, u_int32_t valueSize = 0); + + ~MP4BytesProperty(); + + MP4PropertyType GetType() { + return BytesProperty; + } + + u_int32_t GetCount() { + return m_values.Size(); + } + + void SetCount(u_int32_t count); + + void GetValue(u_int8_t** ppValue, u_int32_t* pValueSize, + u_int32_t index = 0) { + // N.B. caller must free memory + *ppValue = (u_int8_t*)MP4Malloc(m_valueSizes[index]); + memcpy(*ppValue, m_values[index], m_valueSizes[index]); + *pValueSize = m_valueSizes[index]; + } + + void CopyValue(u_int8_t* pValue, u_int32_t index = 0) { + // N.B. caller takes responsbility for valid pointer + // and sufficient memory at the destination + memcpy(pValue, m_values[index], m_valueSizes[index]); + } + + void SetValue(const u_int8_t* pValue, u_int32_t valueSize, + u_int32_t index = 0); + + void AddValue(u_int8_t* pValue, u_int32_t valueSize) { + u_int32_t count = GetCount(); + SetCount(count + 1); + SetValue(pValue, valueSize, count); + } + + u_int32_t GetValueSize(u_int32_t valueSize, u_int32_t index = 0) { + return m_valueSizes[index]; + } + + void SetValueSize(u_int32_t valueSize, u_int32_t index = 0); + + u_int32_t GetFixedSize() { + return m_fixedValueSize; + } + + void SetFixedSize(u_int32_t fixedSize); + + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + +protected: + u_int32_t m_fixedValueSize; + MP4Integer32Array m_valueSizes; + MP4BytesArray m_values; +}; + +class MP4TableProperty : public MP4Property { +public: + MP4TableProperty(char* name, MP4Property* pCountProperty); + + ~MP4TableProperty(); + + MP4PropertyType GetType() { + return TableProperty; + } + + void SetParentAtom(MP4Atom* pParentAtom) { + m_pParentAtom = pParentAtom; + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + m_pProperties[i]->SetParentAtom(pParentAtom); + } + } + + void AddProperty(MP4Property* pProperty); + + MP4Property* GetProperty(u_int32_t index) { + return m_pProperties[index]; + } + + u_int32_t GetCount() { + if (m_pCountProperty->GetType() == Integer8Property) { + return ((MP4Integer8Property*)m_pCountProperty)->GetValue(); + } else { + return ((MP4Integer32Property*)m_pCountProperty)->GetValue(); + } + } + void SetCount(u_int32_t count) { + if (m_pCountProperty->GetType() == Integer8Property) { + ((MP4Integer8Property*)m_pCountProperty)->SetValue(count); + } else { + ((MP4Integer32Property*)m_pCountProperty)->SetValue(count); + } + } + + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + +protected: + virtual void ReadEntry(MP4File* pFile, u_int32_t index); + virtual void WriteEntry(MP4File* pFile, u_int32_t index); + + bool FindContainedProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex); + +protected: + MP4Property* m_pCountProperty; + MP4PropertyArray m_pProperties; +}; + +class MP4DescriptorProperty : public MP4Property { +public: + MP4DescriptorProperty(char* name = NULL, + u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0, + bool mandatory = false, bool onlyOne = false); + + ~MP4DescriptorProperty(); + + MP4PropertyType GetType() { + return DescriptorProperty; + } + + void SetParentAtom(MP4Atom* pParentAtom); + + void SetSizeLimit(u_int64_t sizeLimit) { + m_sizeLimit = sizeLimit; + } + + u_int32_t GetCount() { + return m_pDescriptors.Size(); + } + void SetCount(u_int32_t count) { + m_pDescriptors.Resize(count); + } + + void SetTags(u_int8_t tagsStart, u_int8_t tagsEnd = 0) { + m_tagsStart = tagsStart; + m_tagsEnd = tagsEnd ? tagsEnd : tagsStart; + } + + MP4Descriptor* AddDescriptor(u_int8_t tag); + + void AppendDescriptor(MP4Descriptor* pDescriptor) { + m_pDescriptors.Add(pDescriptor); + } + + void DeleteDescriptor(u_int32_t index); + + void Generate(); + void Read(MP4File* pFile, u_int32_t index = 0); + void Write(MP4File* pFile, u_int32_t index = 0); + void Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index = 0); + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + +protected: + virtual MP4Descriptor* CreateDescriptor(u_int8_t tag); + + bool FindContainedProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex); + +protected: + u_int8_t m_tagsStart; + u_int8_t m_tagsEnd; + u_int64_t m_sizeLimit; + bool m_mandatory; + bool m_onlyOne; + MP4DescriptorArray m_pDescriptors; +}; + +class MP4QosQualifierProperty : public MP4DescriptorProperty { +public: + MP4QosQualifierProperty(char* name = NULL, + u_int8_t tagsStart = 0, u_int8_t tagsEnd = 0, + bool mandatory = false, bool onlyOne = false) : + MP4DescriptorProperty(name, tagsStart, tagsEnd, mandatory, onlyOne) { } + +protected: + MP4Descriptor* CreateDescriptor(u_int8_t tag); +}; + +#endif /* __MP4_PROPERTY_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_hmhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_hmhd.cpp @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4HmhdAtom::MP4HmhdAtom() + : MP4Atom("hmhd") +{ + AddVersionAndFlags(); + + AddProperty( + new MP4Integer16Property("maxPduSize")); + AddProperty( + new MP4Integer16Property("avgPduSize")); + AddProperty( + new MP4Integer32Property("maxBitRate")); + AddProperty( + new MP4Integer32Property("avgBitRate")); + AddProperty( + new MP4Integer32Property("slidingAvgBitRate")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/win32_ver.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/win32_ver.h @@ -0,0 +1,2 @@ +#define PACKAGE "mpeg4ip" +#define VERSION "0.9.8.6" --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4info.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4info.cpp @@ -0,0 +1,341 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001-2002. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +static char* PrintAudioInfo( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + static const char* mpeg4AudioNames[] = { + "MPEG-4 Main @ L1", + "MPEG-4 Main @ L2", + "MPEG-4 Main @ L3", + "MPEG-4 Main @ L4", + "MPEG-4 Scalable @ L1", + "MPEG-4 Scalable @ L2", + "MPEG-4 Scalable @ L3", + "MPEG-4 Scalable @ L4", + "MPEG-4 Speech @ L1", + "MPEG-4 Speech @ L2", + "MPEG-4 Synthesis @ L1", + "MPEG-4 Synthesis @ L2", + "MPEG-4 Synthesis @ L3", + }; + static u_int8_t numMpeg4AudioTypes = + sizeof(mpeg4AudioNames) / sizeof(char*); + + static u_int8_t mpegAudioTypes[] = { + MP4_MPEG2_AAC_MAIN_AUDIO_TYPE, // 0x66 + MP4_MPEG2_AAC_LC_AUDIO_TYPE, // 0x67 + MP4_MPEG2_AAC_SSR_AUDIO_TYPE, // 0x68 + MP4_MPEG2_AUDIO_TYPE, // 0x69 + MP4_MPEG1_AUDIO_TYPE, // 0x6B + MP4_PCM16_LITTLE_ENDIAN_AUDIO_TYPE, + MP4_VORBIS_AUDIO_TYPE, + MP4_ALAW_AUDIO_TYPE, + MP4_ULAW_AUDIO_TYPE, + MP4_G723_AUDIO_TYPE, + MP4_PCM16_BIG_ENDIAN_AUDIO_TYPE, + }; + static const char* mpegAudioNames[] = { + "MPEG-2 AAC Main", + "MPEG-2 AAC LC", + "MPEG-2 AAC SSR", + "MPEG-2 (MP3)", + "MPEG-1 (MP3)", + "PCM16 (little endian)", + "Vorbis", + "G.711 aLaw", + "G.711 uLaw", + "G.723.1", + "PCM16 (big endian)", + }; + static u_int8_t numMpegAudioTypes = + sizeof(mpegAudioTypes) / sizeof(u_int8_t); + + u_int8_t type = + MP4GetTrackEsdsObjectTypeId(mp4File, trackId); + const char* typeName = "Unknown"; + + if (type == MP4_MPEG4_AUDIO_TYPE) { + type = MP4GetAudioProfileLevel(mp4File); + if (type > 0 && type <= numMpeg4AudioTypes) { + typeName = mpeg4AudioNames[type - 1]; + } else { + typeName = "MPEG-4"; + } + } else { + for (u_int8_t i = 0; i < numMpegAudioTypes; i++) { + if (type == mpegAudioTypes[i]) { + typeName = mpegAudioNames[i]; + break; + } + } + } + + u_int32_t timeScale = + MP4GetTrackTimeScale(mp4File, trackId); + + MP4Duration trackDuration = + MP4GetTrackDuration(mp4File, trackId); + + double msDuration = + UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, + trackDuration, MP4_MSECS_TIME_SCALE)); + + u_int32_t avgBitRate = + MP4GetTrackBitRate(mp4File, trackId); + + char *sInfo = (char*)MP4Malloc(256); + + // type duration avgBitrate samplingFrequency + sprintf(sInfo, + "%u\taudio\t%s, %.3f secs, %u kbps, %u Hz\n", + trackId, + typeName, + msDuration / 1000.0, + (avgBitRate + 500) / 1000, + timeScale); + + return sInfo; +} + +static char* PrintVideoInfo( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + static const char* mpeg4VideoNames[] = { + "MPEG-4 Simple @ L3", + "MPEG-4 Simple @ L2", + "MPEG-4 Simple @ L1", + "MPEG-4 Simple Scalable @ L2", + "MPEG-4 Simple Scalable @ L1", + "MPEG-4 Core @ L2", + "MPEG-4 Core @ L1", + "MPEG-4 Main @ L4", + "MPEG-4 Main @ L3", + "MPEG-4 Main @ L2", + "MPEG-4 Main @ L1", + "MPEG-4 N-Bit @ L2", + "MPEG-4 Hybrid @ L2", + "MPEG-4 Hybrid @ L1", + "MPEG-4 Hybrid @ L1", + }; + static u_int8_t numMpeg4VideoTypes = + sizeof(mpeg4VideoNames) / sizeof(char*); + + static u_int8_t mpegVideoTypes[] = { + MP4_MPEG2_SIMPLE_VIDEO_TYPE, // 0x60 + MP4_MPEG2_MAIN_VIDEO_TYPE, // 0x61 + MP4_MPEG2_SNR_VIDEO_TYPE, // 0x62 + MP4_MPEG2_SPATIAL_VIDEO_TYPE, // 0x63 + MP4_MPEG2_HIGH_VIDEO_TYPE, // 0x64 + MP4_MPEG2_442_VIDEO_TYPE, // 0x65 + MP4_MPEG1_VIDEO_TYPE, // 0x6A + MP4_JPEG_VIDEO_TYPE, // 0x6C + MP4_YUV12_VIDEO_TYPE, + MP4_H264_VIDEO_TYPE, + MP4_H263_VIDEO_TYPE, + MP4_H261_VIDEO_TYPE, + }; + static const char* mpegVideoNames[] = { + "MPEG-2 Simple", + "MPEG-2 Main", + "MPEG-2 SNR", + "MPEG-2 Spatial", + "MPEG-2 High", + "MPEG-2 4:2:2", + "MPEG-1", + "JPEG", + "YUV12", + "H.264", + "H.263", + "H.261", + }; + static u_int8_t numMpegVideoTypes = + sizeof(mpegVideoTypes) / sizeof(u_int8_t); + + u_int8_t type = + MP4GetTrackEsdsObjectTypeId(mp4File, trackId); + const char* typeName = "Unknown"; + + if (type == MP4_MPEG4_VIDEO_TYPE) { + type = MP4GetVideoProfileLevel(mp4File); + if (type > 0 && type <= numMpeg4VideoTypes) { + typeName = mpeg4VideoNames[type - 1]; + } else { + typeName = "MPEG-4"; + } + } else { + for (u_int8_t i = 0; i < numMpegVideoTypes; i++) { + if (type == mpegVideoTypes[i]) { + typeName = mpegVideoNames[i]; + break; + } + } + } + + MP4Duration trackDuration = + MP4GetTrackDuration(mp4File, trackId); + + double msDuration = + UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId, + trackDuration, MP4_MSECS_TIME_SCALE)); + + u_int32_t avgBitRate = + MP4GetTrackBitRate(mp4File, trackId); + + // Note not all mp4 implementations set width and height correctly + // The real answer can be buried inside the ES configuration info + u_int16_t width = MP4GetTrackVideoWidth(mp4File, trackId); + + u_int16_t height = MP4GetTrackVideoHeight(mp4File, trackId); + + float fps = MP4GetTrackVideoFrameRate(mp4File, trackId); + + char *sInfo = (char*)MP4Malloc(256); + + // type duration avgBitrate frameSize frameRate + sprintf(sInfo, + "%u\tvideo\t%s, %.3f secs, %u kbps, %ux%u @ %.2f fps\n", + trackId, + typeName, + msDuration / 1000.0, + (avgBitRate + 500) / 1000, + width, + height, + fps + ); + + return sInfo; +} + +static char* PrintHintInfo( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + MP4TrackId referenceTrackId = + MP4GetHintTrackReferenceTrackId(mp4File, trackId); + + char* payloadName = NULL; + MP4GetHintTrackRtpPayload(mp4File, trackId, &payloadName); + + char *sInfo = (char*)MP4Malloc(256); + + sprintf(sInfo, + "%u\thint\tPayload %s for track %u\n", + trackId, + payloadName, + referenceTrackId); + + free(payloadName); + + return sInfo; +} + +static char* PrintTrackInfo( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + char* trackInfo = NULL; + + const char* trackType = + MP4GetTrackType(mp4File, trackId); + + if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE)) { + trackInfo = PrintAudioInfo(mp4File, trackId); + } else if (!strcmp(trackType, MP4_VIDEO_TRACK_TYPE)) { + trackInfo = PrintVideoInfo(mp4File, trackId); + } else if (!strcmp(trackType, MP4_HINT_TRACK_TYPE)) { + trackInfo = PrintHintInfo(mp4File, trackId); + } else { + trackInfo = (char*)MP4Malloc(256); + if (!strcmp(trackType, MP4_OD_TRACK_TYPE)) { + sprintf(trackInfo, + "%u\tod\tObject Descriptors\n", + trackId); + } else if (!strcmp(trackType, MP4_SCENE_TRACK_TYPE)) { + sprintf(trackInfo, + "%u\tscene\tBIFS\n", + trackId); + } else { + sprintf(trackInfo, + "%u\t%s\n", + trackId, trackType); + } + } + + return trackInfo; +} + +extern "C" char* MP4Info( + MP4FileHandle mp4File, + MP4TrackId trackId) +{ + char* info = NULL; + + if (MP4_IS_VALID_FILE_HANDLE(mp4File)) { + try { + if (trackId == MP4_INVALID_TRACK_ID) { + info = (char*)MP4Calloc(4*1024); + + sprintf(info, "Track\tType\tInfo\n"); + + u_int32_t numTracks = MP4GetNumberOfTracks(mp4File); + + for (u_int32_t i = 0; i < numTracks; i++) { + trackId = MP4FindTrackId(mp4File, i); + char* trackInfo = PrintTrackInfo(mp4File, trackId); + strcat(info, trackInfo); + MP4Free(trackInfo); + } + } else { + info = PrintTrackInfo(mp4File, trackId); + } + } + catch (MP4Error* e) { + delete e; + } + } + + return info; +} + +extern "C" char* MP4FileInfo( + const char* fileName, + MP4TrackId trackId) +{ + MP4FileHandle mp4File = + MP4Read(fileName); + + if (!mp4File) { + return NULL; + } + + char* info = MP4Info(mp4File, trackId); + + MP4Close(mp4File); + + return info; // caller should free this +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_moov.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_moov.cpp @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MoovAtom::MP4MoovAtom() + : MP4Atom("moov") +{ + ExpectChildAtom("mvhd", Required, OnlyOne); + ExpectChildAtom("iods", Required, OnlyOne); + ExpectChildAtom("trak", Required, Many); + ExpectChildAtom("udta", Optional, Many); + ExpectChildAtom("mvex", Optional, OnlyOne); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_trex.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_trex.cpp @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrexAtom::MP4TrexAtom() + : MP4Atom("trex") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4Integer32Property("trackId")); + AddProperty( /* 3 */ + new MP4Integer32Property("defaultSampleDesriptionIndex")); + AddProperty( /* 4 */ + new MP4Integer32Property("defaultSampleDuration")); + AddProperty( /* 5 */ + new MP4Integer32Property("defaultSampleSize")); + AddProperty( /* 6 */ + new MP4Integer32Property("defaultSampleFlags")); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_vmhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_vmhd.cpp @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4VmhdAtom::MP4VmhdAtom() + : MP4Atom("vmhd") +{ + AddVersionAndFlags(); + AddReserved("reserved", 8); +} + +void MP4VmhdAtom::Generate() +{ + MP4Atom::Generate(); + + SetFlags(1); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4meta.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4meta.cpp @@ -0,0 +1,987 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * M. Bakker mbakker at nero.com + * + * Apple iTunes Metadata handling + */ + +/** + + The iTunes tagging seems to support any tag field name + but there are some predefined fields, also known from the QuickTime format + + predefined fields (the ones I know of until now): + - nam : Name of the song/movie (string) + - ART : Name of the artist/performer (string) + - wrt : Name of the writer (string) + - alb : Name of the album (string) + - day : Year (4 bytes, e.g. "2003") (string) + - too : Tool(s) used to create the file (string) + - cmt : Comment (string) + - gen : Custom genre (string) + - trkn : Tracknumber (8 byte string) + 16 bit: empty + 16 bit: tracknumber + 16 bit: total tracks on album + 16 bit: empty + - disk : Disknumber (8 byte string) + 16 bit: empty + 16 bit: disknumber + 16 bit: total number of disks + 16 bit: empty + - gnre : Genre (16 bit genre) (ID3v1 index + 1) + - cpil : Part of a compilation (1 byte, 1 or 0) + - tmpo : Tempo in BPM (16 bit) + - covr : Cover art (xx bytes binary data) + - ---- : Free form metadata, can have any name and any data + +**/ + +#include "mp4common.h" + +bool MP4File::GetMetadataByIndex(u_int32_t index, + const char** ppName, + u_int8_t** ppValue, u_int32_t* pValueSize) +{ + char s[256]; + + sprintf(s, "moov.udta.meta.ilst.*[%u].data.metadata", index); + GetBytesProperty(s, ppValue, pValueSize); + + sprintf(s, "moov.udta.meta.ilst.*[%u]", index); + MP4Atom* pParent = m_pRootAtom->FindAtom(s); + *ppName = pParent->GetType(); + + /* check for free form tagfield */ + if (memcmp(*ppName, "----", 4) == 0) + { + u_int8_t* pV; + u_int32_t VSize = 0; + char *pN; + + sprintf(s, "moov.udta.meta.ilst.*[%u].name.metadata", index); + GetBytesProperty(s, &pV, &VSize); + + pN = (char*)malloc((VSize+1)*sizeof(char)); + memset(pN, 0, (VSize+1)*sizeof(char)); + memcpy(pN, pV, VSize*sizeof(char)); + + *ppName = pN; + } + + return true; +} + +bool MP4File::CreateMetadataAtom(const char* name) +{ + char s[256]; + char t[256]; + + sprintf(t, "udta.meta.ilst.%s.data", name); + sprintf(s, "moov.udta.meta.ilst.%s.data", name); + AddDescendantAtoms("moov", t); + MP4Atom *pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + return false; + + /* some fields need special flags set */ + if (name[0] == '') + { + pMetaAtom->SetFlags(0x1); + } else if ((memcmp(name, "cpil", 4) == 0) || (memcmp(name, "tmpo", 4) == 0)) { + pMetaAtom->SetFlags(0xF); + } + + MP4Atom *pHdlrAtom = m_pRootAtom->FindAtom("moov.udta.meta.hdlr"); + MP4StringProperty *pStringProperty = NULL; + MP4BytesProperty *pBytesProperty = NULL; + ASSERT(pHdlrAtom); + + pHdlrAtom->FindProperty( + "hdlr.handlerType", (MP4Property**)&pStringProperty); + ASSERT(pStringProperty); + pStringProperty->SetValue("mdir"); + + u_int8_t val[12]; + memset(val, 0, 12*sizeof(u_int8_t)); + val[0] = 0x61; + val[1] = 0x70; + val[2] = 0x70; + val[3] = 0x6c; + pHdlrAtom->FindProperty( + "hdlr.reserved2", (MP4Property**)&pBytesProperty); + ASSERT(pBytesProperty); + pBytesProperty->SetReadOnly(false); + pBytesProperty->SetValue(val, 12); + pBytesProperty->SetReadOnly(true); + + return true; +} + +bool MP4File::SetMetadataName(const char* value) +{ + const char *s = "moov.udta.meta.ilst.nam.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("nam")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataName(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.nam.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataWriter(const char* value) +{ + const char *s = "moov.udta.meta.ilst.wrt.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("wrt")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataWriter(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.wrt.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataAlbum(const char* value) +{ + const char *s = "moov.udta.meta.ilst.alb.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("alb")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataAlbum(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.alb.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataArtist(const char* value) +{ + const char *s = "moov.udta.meta.ilst.ART.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("ART")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataArtist(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.ART.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataTool(const char* value) +{ + const char *s = "moov.udta.meta.ilst.too.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("too")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataTool(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.too.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataComment(const char* value) +{ + const char *s = "moov.udta.meta.ilst.cmt.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("cmt")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; +} + +bool MP4File::GetMetadataComment(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.cmt.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataYear(const char* value) +{ + const char *s = "moov.udta.meta.ilst.day.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("day")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + if (strlen(value) < 4) + return false; + + pMetadataProperty->SetValue((u_int8_t*)value, 4); + + return true; +} + +bool MP4File::GetMetadataYear(char** value) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.day.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } +} + +bool MP4File::SetMetadataTrack(u_int16_t track, u_int16_t totalTracks) +{ + unsigned char t[9]; + const char *s = "moov.udta.meta.ilst.trkn.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("trkn")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + memset(t, 0, 9*sizeof(unsigned char)); + t[2] = (unsigned char)(track>>8)&0xFF; + t[3] = (unsigned char)(track)&0xFF; + t[4] = (unsigned char)(totalTracks>>8)&0xFF; + t[5] = (unsigned char)(totalTracks)&0xFF; + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)t, 8); + + return true; +} + +bool MP4File::GetMetadataTrack(u_int16_t* track, u_int16_t* totalTracks) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.trkn.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + *track = 0; + *totalTracks = 0; + + if (valSize != 8) + return false; + + *track = (u_int16_t)(val[3]); + *track += (u_int16_t)(val[2]<<8); + *totalTracks = (u_int16_t)(val[5]); + *totalTracks += (u_int16_t)(val[4]<<8); + + return true; +} + +bool MP4File::SetMetadataDisk(u_int16_t disk, u_int16_t totalDisks) +{ + unsigned char t[9]; + const char *s = "moov.udta.meta.ilst.disk.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("disk")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + memset(t, 0, 9*sizeof(unsigned char)); + t[2] = (unsigned char)(disk>>8)&0xFF; + t[3] = (unsigned char)(disk)&0xFF; + t[4] = (unsigned char)(totalDisks>>8)&0xFF; + t[5] = (unsigned char)(totalDisks)&0xFF; + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)t, 8); + + return true; +} + +bool MP4File::GetMetadataDisk(u_int16_t* disk, u_int16_t* totalDisks) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.disk.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + *disk = 0; + *totalDisks = 0; + + if (valSize != 8) + return false; + + *disk = (u_int16_t)(val[3]); + *disk += (u_int16_t)(val[2]<<8); + *totalDisks = (u_int16_t)(val[5]); + *totalDisks += (u_int16_t)(val[4]<<8); + + return true; +} + +static const char* ID3v1GenreList[] = { + "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", + "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", + "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", + "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", + "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", + "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", + "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass", + "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", + "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", + "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", + "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret", + "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", + "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", + "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", + "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", + "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", + "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", + "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", + "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", + "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", + "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall", + "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror", + "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", + "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C", + "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", + "SynthPop", +}; + +int GenreToString(char** GenreStr, const int genre) +{ + if (genre > 0 && genre <= sizeof(ID3v1GenreList)/sizeof(*ID3v1GenreList)) + { + *GenreStr = (char*)malloc((strlen(ID3v1GenreList[genre-1])+1)*sizeof(char)); + memset(*GenreStr, 0, (strlen(ID3v1GenreList[genre-1])+1)*sizeof(char)); + strcpy(*GenreStr, ID3v1GenreList[genre-1]); + return 0; + } else { + *GenreStr = (char*)malloc(2*sizeof(char)); + memset(*GenreStr, 0, 2*sizeof(char)); + return 1; + } +} + +int StringToGenre(const char* GenreStr) +{ + int i; + + for (i = 0; i < sizeof(ID3v1GenreList)/sizeof(*ID3v1GenreList); i++) + { + if (strcasecmp(GenreStr, ID3v1GenreList[i]) == 0) + return i+1; + } + return 0; +} + +bool MP4File::SetMetadataGenre(const char* value) +{ + u_int16_t genreIndex = 0; + unsigned char t[3]; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + genreIndex = StringToGenre(value); + + if (genreIndex != 0) + { + const char *s = "moov.udta.meta.ilst.gnre.data"; + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("gnre")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + memset(t, 0, 3*sizeof(unsigned char)); + t[0] = (unsigned char)(genreIndex>>8)&0xFF; + t[1] = (unsigned char)(genreIndex)&0xFF; + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)t, 2); + + return true; + } else { + const char *s2 = "moov.udta.meta.ilst.gen.data"; + pMetaAtom = m_pRootAtom->FindAtom(s2); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("gen")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s2); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)value, strlen(value)); + + return true; + } + + return false; +} + +bool MP4File::GetMetadataGenre(char** value) +{ + u_int16_t genreIndex = 0; + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *t = "moov.udta.meta.ilst.gnre"; + const char *s = "moov.udta.meta.ilst.gnre.data.metadata"; + + MP4Atom *gnre = FindAtom(t); + + if (gnre) + { + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + if (valSize != 2) + return false; + + genreIndex = (u_int16_t)(val[1]); + genreIndex += (u_int16_t)(val[0]<<8); + + GenreToString(value, genreIndex); + + return true; + } else { + const char *s2 = "moov.udta.meta.ilst.gen.data.metadata"; + + val = NULL; + valSize = 0; + + GetBytesProperty(s2, (u_int8_t**)&val, &valSize); + + if (valSize > 0) + { + *value = (char*)malloc((valSize+1)*sizeof(unsigned char)); + memset(*value, 0, (valSize+1)*sizeof(unsigned char)); + memcpy(*value, val, valSize*sizeof(unsigned char)); + return true; + } else { + *value = NULL; + return false; + } + } + + return false; +} + +bool MP4File::SetMetadataTempo(u_int16_t tempo) +{ + unsigned char t[3]; + const char *s = "moov.udta.meta.ilst.tmpo.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("tmpo")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + memset(t, 0, 3*sizeof(unsigned char)); + t[0] = (unsigned char)(tempo>>8)&0xFF; + t[1] = (unsigned char)(tempo)&0xFF; + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue((u_int8_t*)t, 2); + + return true; +} + +bool MP4File::GetMetadataTempo(u_int16_t* tempo) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.tmpo.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + *tempo = 0; + + if (valSize != 2) + return false; + + *tempo = (u_int16_t)(val[1]); + *tempo += (u_int16_t)(val[0]<<8); + + return true; +} + +bool MP4File::SetMetadataCompilation(u_int8_t compilation) +{ + const char *s = "moov.udta.meta.ilst.cpil.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("cpil")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + compilation &= 0x1; + pMetadataProperty->SetValue((u_int8_t*)&compilation, 1); + + return true; +} + +bool MP4File::GetMetadataCompilation(u_int8_t* compilation) +{ + unsigned char *val = NULL; + u_int32_t valSize = 0; + const char *s = "moov.udta.meta.ilst.cpil.data.metadata"; + GetBytesProperty(s, (u_int8_t**)&val, &valSize); + + *compilation = 0; + + if (valSize != 1) + return false; + + *compilation = (u_int16_t)(val[0]); + + return true; +} + +bool MP4File::SetMetadataCoverArt(u_int8_t *coverArt, u_int32_t size) +{ + const char *s = "moov.udta.meta.ilst.covr.data"; + MP4BytesProperty *pMetadataProperty = NULL; + MP4Atom *pMetaAtom = NULL; + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + { + if (!CreateMetadataAtom("covr")) + return false; + + pMetaAtom = m_pRootAtom->FindAtom(s); + } + + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + + pMetadataProperty->SetValue(coverArt, size); + + return true; +} + +bool MP4File::GetMetadataCoverArt(u_int8_t **coverArt, u_int32_t *size) +{ + const char *s = "moov.udta.meta.ilst.covr.data.metadata"; + GetBytesProperty(s, coverArt, size); + + if (size == 0) + return false; + + return true; +} + +bool MP4File::SetMetadataFreeForm(char *name, u_int8_t* pValue, u_int32_t valueSize) +{ + MP4Atom *pMetaAtom = NULL; + MP4BytesProperty *pMetadataProperty = NULL; + char s[256]; + int i = 0; + bool nameExists = false; + + while (1) + { + MP4BytesProperty *pMetadataProperty; + + sprintf(s, "moov.udta.meta.ilst.----[%u].name", i); + + MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); + + if (!pTagAtom) + break; + + pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty); + if (pMetadataProperty) + { + u_int8_t* pV; + u_int32_t VSize = 0; + + pMetadataProperty->GetValue(&pV, &VSize); + + if (VSize != 0) + { + if (memcmp(pV, name, VSize) == 0) + { + sprintf(s, "moov.udta.meta.ilst.----[%u].data.metadata", i); + SetBytesProperty(s, pValue, valueSize); + + return true; + } + } + } + + i++; + } + + /* doesn't exist yet, create it */ + char t[256]; + + sprintf(t, "udta.meta.ilst.----[%u]", i); + sprintf(s, "moov.udta.meta.ilst.----[%u].data", i); + AddDescendantAtoms("moov", t); + + pMetaAtom = m_pRootAtom->FindAtom(s); + + if (!pMetaAtom) + return false; + + pMetaAtom->SetFlags(0x1); + + MP4Atom *pHdlrAtom = m_pRootAtom->FindAtom("moov.udta.meta.hdlr"); + MP4StringProperty *pStringProperty = NULL; + MP4BytesProperty *pBytesProperty = NULL; + ASSERT(pHdlrAtom); + + pHdlrAtom->FindProperty( + "hdlr.handlerType", (MP4Property**)&pStringProperty); + ASSERT(pStringProperty); + pStringProperty->SetValue("mdir"); + + u_int8_t val[12]; + memset(val, 0, 12*sizeof(u_int8_t)); + val[0] = 0x61; + val[1] = 0x70; + val[2] = 0x70; + val[3] = 0x6c; + pHdlrAtom->FindProperty( + "hdlr.reserved2", (MP4Property**)&pBytesProperty); + ASSERT(pBytesProperty); + pBytesProperty->SetReadOnly(false); + pBytesProperty->SetValue(val, 12); + pBytesProperty->SetReadOnly(true); + + pMetaAtom = m_pRootAtom->FindAtom(s); + pMetaAtom->FindProperty("data.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + pMetadataProperty->SetValue(pValue, valueSize); + + sprintf(s, "moov.udta.meta.ilst.----[%u].name", i); + pMetaAtom = m_pRootAtom->FindAtom(s); + pMetaAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + pMetadataProperty->SetValue((u_int8_t*)name, strlen(name)); + + sprintf(s, "moov.udta.meta.ilst.----[%u].mean", i); + pMetaAtom = m_pRootAtom->FindAtom(s); + pMetaAtom->FindProperty("mean.metadata", (MP4Property**)&pMetadataProperty); + ASSERT(pMetadataProperty); + pMetadataProperty->SetValue((u_int8_t*)"com.apple.iTunes", 16); /* ?? */ + + return true; +} + +bool MP4File::GetMetadataFreeForm(char *name, u_int8_t** ppValue, u_int32_t *pValueSize) +{ + char s[256]; + int i = 0; + + while (1) + { + MP4BytesProperty *pMetadataProperty; + + sprintf(s, "moov.udta.meta.ilst.----[%u].name", i); + + MP4Atom *pTagAtom = m_pRootAtom->FindAtom(s); + + if (!pTagAtom) + return false; + + pTagAtom->FindProperty("name.metadata", (MP4Property**)&pMetadataProperty); + if (pMetadataProperty) + { + u_int8_t* pV; + u_int32_t VSize = 0; + + pMetadataProperty->GetValue(&pV, &VSize); + + if (VSize != 0) + { + if (memcmp(pV, name, VSize) == 0) + { + sprintf(s, "moov.udta.meta.ilst.----[%u].data.metadata", i); + GetBytesProperty(s, ppValue, pValueSize); + + return true; + } + } + } + + i++; + } +} + +bool MP4File::MetadataDelete() +{ + MP4Atom *pMetaAtom = NULL; + char s[256]; + + sprintf(s, "moov.udta.meta"); + pMetaAtom = m_pRootAtom->FindAtom(s); + + /* if it exists, delete it */ + if (pMetaAtom) + { + MP4Atom *pParent = pMetaAtom->GetParentAtom(); + + pParent->DeleteChildAtom(pMetaAtom); + + delete pMetaAtom; + + return true; + } + + return false; +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/Makefile.am +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/Makefile.am @@ -0,0 +1,128 @@ +INCLUDES = -I$(top_srcdir)/include + +AM_CXXFLAGS = -Wall + +lib_LTLIBRARIES = libmp4v2.la + +include_HEADERS = mp4.h mpeg4ip.h systems.h + +libmp4v2_la_SOURCES = \ + atom_co64.cpp \ + atom_cprt.cpp \ + atom_ctts.cpp \ + atom_dimm.cpp \ + atom_dinf.cpp \ + atom_dmax.cpp \ + atom_dmed.cpp \ + atom_dref.cpp \ + atom_drep.cpp \ + atom_edts.cpp \ + atom_elst.cpp \ + atom_enca.cpp \ + atom_encv.cpp \ + atom_esds.cpp \ + atom_free.cpp \ + atom_frma.cpp \ + atom_ftyp.cpp \ + atom_hdlr.cpp \ + atom_hinf.cpp \ + atom_hmhd.cpp \ + atom_hnti.cpp \ + atom_iKMS.cpp \ + atom_iSFM.cpp \ + atom_iods.cpp \ + atom_maxr.cpp \ + atom_mdat.cpp \ + atom_mdhd.cpp \ + atom_mdia.cpp \ + atom_meta.cpp \ + atom_mfhd.cpp \ + atom_minf.cpp \ + atom_moof.cpp \ + atom_moov.cpp \ + atom_mp4a.cpp \ + atom_mp4s.cpp \ + atom_mp4v.cpp \ + atom_mvex.cpp \ + atom_mvhd.cpp \ + atom_nmhd.cpp \ + atom_nump.cpp \ + atom_payt.cpp \ + atom_pmax.cpp \ + atom_root.cpp \ + atom_rtp.cpp \ + atom_schi.cpp \ + atom_schm.cpp \ + atom_sdp.cpp \ + atom_sinf.cpp \ + atoms.h \ + atom_smhd.cpp \ + atom_snro.cpp \ + atom_stbl.cpp \ + atom_stco.cpp \ + atom_stdp.cpp \ + atom_stsc.cpp \ + atom_stsd.cpp \ + atom_stsh.cpp \ + atom_stss.cpp \ + atom_stsz.cpp \ + atom_stts.cpp \ + atom_tfhd.cpp \ + atom_tims.cpp \ + atom_tkhd.cpp \ + atom_tmax.cpp \ + atom_tmin.cpp \ + atom_tpyl.cpp \ + atom_traf.cpp \ + atom_trak.cpp \ + atom_tref.cpp \ + atom_treftype.cpp \ + atom_trex.cpp \ + atom_trpy.cpp \ + atom_trun.cpp \ + atom_tsro.cpp \ + atom_udta.cpp \ + atom_url.cpp \ + atom_urn.cpp \ + atom_vmhd.cpp \ + descriptors.cpp \ + descriptors.h \ + isma.cpp \ + mp4array.h \ + mp4atom.cpp \ + mp4atom.h \ + mp4common.h \ + mp4container.cpp \ + mp4container.h \ + mp4.h \ + mp4.cpp \ + mp4descriptor.cpp \ + mp4descriptor.h \ + mp4file.cpp \ + mp4file.h \ + mp4file_io.cpp \ + mp4info.cpp \ + mp4meta.cpp \ + mp4property.cpp \ + mp4property.h \ + mp4track.cpp \ + mp4track.h \ + mp4util.cpp \ + mp4util.h \ + ocidescriptors.cpp \ + ocidescriptors.h \ + odcommands.cpp \ + odcommands.h \ + qosqualifiers.cpp \ + qosqualifiers.h \ + rtphint.cpp \ + rtphint.h + +EXTRA_DIST = API_CHANGES \ + INTERNALS \ + libmp4v260.dsp \ + libmp4v2_st60.dsp \ + TODO + +LIBTOOL_DEPS = +LIBS = --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/descriptors.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/descriptors.cpp @@ -0,0 +1,634 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4IODescriptor::MP4IODescriptor() + : MP4Descriptor(MP4FileIODescrTag) +{ + /* N.B. other member functions depend on the property indicies */ + AddProperty( /* 0 */ + new MP4BitfieldProperty("objectDescriptorId", 10)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("URLFlag", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("includeInlineProfileLevelFlag", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("reserved", 4)); + AddProperty( /* 4 */ + new MP4StringProperty("URL", Counted)); + AddProperty( /* 5 */ + new MP4Integer8Property("ODProfileLevelId")); + AddProperty( /* 6 */ + new MP4Integer8Property("sceneProfileLevelId")); + AddProperty( /* 7 */ + new MP4Integer8Property("audioProfileLevelId")); + AddProperty( /* 8 */ + new MP4Integer8Property("visualProfileLevelId")); + AddProperty( /* 9 */ + new MP4Integer8Property("graphicsProfileLevelId")); + AddProperty( /* 10 */ + new MP4DescriptorProperty("esIds", + MP4ESIDIncDescrTag, 0, Required, Many)); + AddProperty( /* 11 */ + new MP4DescriptorProperty("ociDescr", + MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many)); + AddProperty( /* 12 */ + new MP4DescriptorProperty("ipmpDescrPtr", + MP4IPMPPtrDescrTag, 0, Optional, Many)); + AddProperty( /* 13 */ + new MP4DescriptorProperty("extDescr", + MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); + + SetReadMutate(2); +} + +void MP4IODescriptor::Generate() +{ + ((MP4BitfieldProperty*)m_pProperties[0])->SetValue(1); + ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(0xF); + for (u_int32_t i = 5; i <= 9; i++) { + ((MP4Integer8Property*)m_pProperties[i])->SetValue(0xFF); + } +} + +void MP4IODescriptor::Mutate() +{ + bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + + m_pProperties[4]->SetImplicit(!urlFlag); + for (u_int32_t i = 5; i <= 12; i++) { + m_pProperties[i]->SetImplicit(urlFlag); + } +} + +MP4ODescriptor::MP4ODescriptor() + : MP4Descriptor(MP4FileODescrTag) +{ + /* N.B. other member functions depend on the property indicies */ + AddProperty( /* 0 */ + new MP4BitfieldProperty("objectDescriptorId", 10)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("URLFlag", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("reserved", 5)); + AddProperty( /* 3 */ + new MP4StringProperty("URL", Counted)); + AddProperty( /* 4 */ + new MP4DescriptorProperty("esIds", + MP4ESIDRefDescrTag, 0, Required, Many)); + AddProperty( /* 5 */ + new MP4DescriptorProperty("ociDescr", + MP4OCIDescrTagsStart, MP4OCIDescrTagsEnd, Optional, Many)); + AddProperty( /* 6 */ + new MP4DescriptorProperty("ipmpDescrPtr", + MP4IPMPPtrDescrTag, 0, Optional, Many)); + AddProperty( /* 7 */ + new MP4DescriptorProperty("extDescr", + MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); + + SetReadMutate(2); +} + +void MP4ODescriptor::Generate() +{ + ((MP4BitfieldProperty*)m_pProperties[2])->SetValue(0x1F); +} + +void MP4ODescriptor::Mutate() +{ + bool urlFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + + m_pProperties[3]->SetImplicit(!urlFlag); + for (u_int32_t i = 4; i <= 6; i++) { + m_pProperties[i]->SetImplicit(urlFlag); + } +} + +MP4ESIDIncDescriptor::MP4ESIDIncDescriptor() + : MP4Descriptor(MP4ESIDIncDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("id")); +} + +MP4ESIDRefDescriptor::MP4ESIDRefDescriptor() + : MP4Descriptor(MP4ESIDRefDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer16Property("refIndex")); +} + +MP4ESDescriptor::MP4ESDescriptor() + : MP4Descriptor(MP4ESDescrTag) +{ + /* N.B. other class functions depend on the property indicies */ + AddProperty( /* 0 */ + new MP4Integer16Property("ESID")); + AddProperty( /* 1 */ + new MP4BitfieldProperty("streamDependenceFlag", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("URLFlag", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("OCRstreamFlag", 1)); + AddProperty( /* 4 */ + new MP4BitfieldProperty("streamPriority", 5)); + AddProperty( /* 5 */ + new MP4Integer16Property("dependsOnESID")); + AddProperty( /* 6 */ + new MP4StringProperty("URL", Counted)); + AddProperty( /* 7 */ + new MP4Integer16Property("OCRESID")); + AddProperty( /* 8 */ + new MP4DescriptorProperty("decConfigDescr", + MP4DecConfigDescrTag, 0, Required, OnlyOne)); + AddProperty( /* 9 */ + new MP4DescriptorProperty("slConfigDescr", + MP4SLConfigDescrTag, 0, Required, OnlyOne)); + AddProperty( /* 10 */ + new MP4DescriptorProperty("ipiPtr", + MP4IPIPtrDescrTag, 0, Optional, OnlyOne)); + AddProperty( /* 11 */ + new MP4DescriptorProperty("ipIds", + MP4ContentIdDescrTag, MP4SupplContentIdDescrTag, Optional, Many)); + AddProperty( /* 12 */ + new MP4DescriptorProperty("ipmpDescrPtr", + MP4IPMPPtrDescrTag, 0, Optional, Many)); + AddProperty( /* 13 */ + new MP4DescriptorProperty("langDescr", + MP4LanguageDescrTag, 0, Optional, Many)); + AddProperty( /* 14 */ + new MP4DescriptorProperty("qosDescr", + MP4QosDescrTag, 0, Optional, OnlyOne)); + AddProperty( /* 15 */ + new MP4DescriptorProperty("regDescr", + MP4RegistrationDescrTag, 0, Optional, OnlyOne)); + AddProperty( /* 16 */ + new MP4DescriptorProperty("extDescr", + MP4ExtDescrTagsStart, MP4ExtDescrTagsEnd, Optional, Many)); + + SetReadMutate(5); +} + +void MP4ESDescriptor::Mutate() +{ + bool streamDependFlag = + ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + m_pProperties[5]->SetImplicit(!streamDependFlag); + + bool urlFlag = + ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); + m_pProperties[6]->SetImplicit(!urlFlag); + + bool ocrFlag = + ((MP4BitfieldProperty*)m_pProperties[3])->GetValue(); + m_pProperties[7]->SetImplicit(!ocrFlag); +} + +MP4DecConfigDescriptor::MP4DecConfigDescriptor() + : MP4Descriptor(MP4DecConfigDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("objectTypeId")); + AddProperty( /* 1 */ + new MP4BitfieldProperty("streamType", 6)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("upStream", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("reserved", 1)); + AddProperty( /* 4 */ + new MP4BitfieldProperty("bufferSizeDB", 24)); + AddProperty( /* 5 */ + new MP4Integer32Property("maxBitrate")); + AddProperty( /* 6 */ + new MP4Integer32Property("avgBitrate")); + AddProperty( /* 7 */ + new MP4DescriptorProperty("decSpecificInfo", + MP4DecSpecificDescrTag, 0, Optional, OnlyOne)); + AddProperty( /* 8 */ + new MP4DescriptorProperty("profileLevelIndicationIndexDescr", + MP4ExtProfileLevelDescrTag, 0, Optional, Many)); +} + +void MP4DecConfigDescriptor::Generate() +{ + ((MP4BitfieldProperty*)m_pProperties[3])->SetValue(1); +} + +MP4DecSpecificDescriptor::MP4DecSpecificDescriptor() + : MP4Descriptor(MP4DecSpecificDescrTag) +{ + AddProperty( /* 0 */ + new MP4BytesProperty("info")); +} + +void MP4DecSpecificDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); + + ReadProperties(pFile); +} + +MP4SLConfigDescriptor::MP4SLConfigDescriptor() + : MP4Descriptor(MP4SLConfigDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("predefined")); + AddProperty( /* 1 */ + new MP4BitfieldProperty("useAccessUnitStartFlag", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("useAccessUnitEndFlag", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("useRandomAccessPointFlag", 1)); + AddProperty( /* 4 */ + new MP4BitfieldProperty("hasRandomAccessUnitsOnlyFlag", 1)); + AddProperty( /* 5 */ + new MP4BitfieldProperty("usePaddingFlag", 1)); + AddProperty( /* 6 */ + new MP4BitfieldProperty("useTimeStampsFlag", 1)); + AddProperty( /* 7 */ + new MP4BitfieldProperty("useIdleFlag", 1)); + AddProperty( /* 8 */ + new MP4BitfieldProperty("durationFlag", 1)); + AddProperty( /* 9 */ + new MP4Integer32Property("timeStampResolution")); + AddProperty( /* 10 */ + new MP4Integer32Property("OCRResolution")); + AddProperty( /* 11 */ + new MP4Integer8Property("timeStampLength")); + AddProperty( /* 12 */ + new MP4Integer8Property("OCRLength")); + AddProperty( /* 13 */ + new MP4Integer8Property("AULength")); + AddProperty( /* 14 */ + new MP4Integer8Property("instantBitrateLength")); + AddProperty( /* 15 */ + new MP4BitfieldProperty("degradationPriortyLength", 4)); + AddProperty( /* 16 */ + new MP4BitfieldProperty("AUSeqNumLength", 5)); + AddProperty( /* 17 */ + new MP4BitfieldProperty("packetSeqNumLength", 5)); + AddProperty( /* 18 */ + new MP4BitfieldProperty("reserved", 2)); + + // if durationFlag + AddProperty( /* 19 */ + new MP4Integer32Property("timeScale")); + AddProperty( /* 20 */ + new MP4Integer16Property("accessUnitDuration")); + AddProperty( /* 21 */ + new MP4Integer16Property("compositionUnitDuration")); + + // if !useTimeStampsFlag + AddProperty( /* 22 */ + new MP4BitfieldProperty("startDecodingTimeStamp", 64)); + AddProperty( /* 23 */ + new MP4BitfieldProperty("startCompositionTimeStamp", 64)); +} + +void MP4SLConfigDescriptor::Generate() +{ + // by default all tracks in an mp4 file + // use predefined SLConfig descriptor == 2 + ((MP4Integer8Property*)m_pProperties[0])->SetValue(2); + + // which implies UseTimestampsFlag = 1 + ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1); + + // reserved = 3 + ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3); +} + +void MP4SLConfigDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + // read the first property, 'predefined' + ReadProperties(pFile, 0, 1); + + // if predefined == 0 + if (((MP4Integer8Property*)m_pProperties[0])->GetValue() == 0) { + + /* read the next 18 properties */ + ReadProperties(pFile, 1, 18); + } + + // now mutate + Mutate(); + + // and read the remaining properties + ReadProperties(pFile, 19); +} + +void MP4SLConfigDescriptor::Mutate() +{ + u_int32_t i; + u_int8_t predefined = + ((MP4Integer8Property*)m_pProperties[0])->GetValue(); + + if (predefined) { + // properties 1-18 are implicit + for (i = 1; i < m_pProperties.Size(); i++) { + m_pProperties[i]->SetImplicit(true); + } + + if (predefined == 1) { + // UseTimestampsFlag = 0 + ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(0); + + // TimestampResolution = 1000 + ((MP4Integer32Property*)m_pProperties[9])->SetValue(1000); + + // TimeStampLength = 32 + ((MP4Integer8Property*)m_pProperties[11])->SetValue(32); + + } else if (predefined == 2) { + // UseTimestampsFlag = 1 + ((MP4BitfieldProperty*)m_pProperties[6])->SetValue(1); + } + } else { +#if 1 + for (i = 1; i <= 18; i++) { + m_pProperties[i]->SetImplicit(false); + } + ((MP4BitfieldProperty*)m_pProperties[18])->SetValue(3); +#endif + } + + bool durationFlag = + ((MP4BitfieldProperty*)m_pProperties[8])->GetValue(); + + for (i = 19; i <= 21; i++) { + m_pProperties[i]->SetImplicit(!durationFlag); + } + + bool useTimeStampsFlag = + ((MP4BitfieldProperty*)m_pProperties[6])->GetValue(); + + for (i = 22; i <= 23; i++) { + m_pProperties[i]->SetImplicit(useTimeStampsFlag); + + u_int8_t timeStampLength = MIN(64, + ((MP4Integer8Property*)m_pProperties[11])->GetValue()); + + ((MP4BitfieldProperty*)m_pProperties[i])->SetNumBits(timeStampLength); + + // handle a nonsensical situation gracefully + if (timeStampLength == 0) { + m_pProperties[i]->SetImplicit(true); + } + } +} + +MP4IPIPtrDescriptor::MP4IPIPtrDescriptor() + : MP4Descriptor(MP4IPIPtrDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer16Property("IPIESId")); +} + +MP4ContentIdDescriptor::MP4ContentIdDescriptor() + : MP4Descriptor(MP4ContentIdDescrTag) +{ + AddProperty( /* 0 */ + new MP4BitfieldProperty("compatibility", 2)); + AddProperty( /* 1 */ + new MP4BitfieldProperty("contentTypeFlag", 1)); + AddProperty( /* 2 */ + new MP4BitfieldProperty("contentIdFlag", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("protectedContent", 1)); + AddProperty( /* 4 */ + new MP4BitfieldProperty("reserved", 3)); + AddProperty( /* 5 */ + new MP4Integer8Property("contentType")); + AddProperty( /* 6 */ + new MP4Integer8Property("contentIdType")); + AddProperty( /* 7 */ + new MP4BytesProperty("contentId")); +} + +void MP4ContentIdDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* read the first property, 'compatiblity' */ + ReadProperties(pFile, 0, 1); + + /* if compatiblity != 0 */ + if (((MP4Integer8Property*)m_pProperties[0])->GetValue() != 0) { + /* we don't understand it */ + VERBOSE_READ(pFile->GetVerbosity(), + printf("incompatible content id descriptor\n")); + return; + } + + /* read the next four properties */ + ReadProperties(pFile, 1, 4); + + /* which allows us to reconfigure ourselves */ + Mutate(); + + /* read the remaining properties */ + ReadProperties(pFile, 5); +} + +void MP4ContentIdDescriptor::Mutate() +{ + bool contentTypeFlag = ((MP4BitfieldProperty*)m_pProperties[1])->GetValue(); + m_pProperties[5]->SetImplicit(!contentTypeFlag); + + bool contentIdFlag = ((MP4BitfieldProperty*)m_pProperties[2])->GetValue(); + m_pProperties[6]->SetImplicit(!contentIdFlag); + m_pProperties[7]->SetImplicit(!contentIdFlag); +} + +MP4SupplContentIdDescriptor::MP4SupplContentIdDescriptor() + : MP4Descriptor(MP4SupplContentIdDescrTag) +{ + AddProperty( /* 0 */ + new MP4BytesProperty("languageCode", 3)); + AddProperty( /* 1 */ + new MP4StringProperty("title", Counted)); + AddProperty( /* 2 */ + new MP4StringProperty("value", Counted)); +} + +MP4IPMPPtrDescriptor::MP4IPMPPtrDescriptor() + : MP4Descriptor(MP4IPMPPtrDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("IPMPDescriptorId")); +} + +MP4IPMPDescriptor::MP4IPMPDescriptor() + : MP4Descriptor(MP4IPMPDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("IPMPDescriptorId")); + AddProperty( /* 1 */ + new MP4Integer16Property("IPMPSType")); + AddProperty( /* 2 */ + new MP4BytesProperty("IPMPData")); + /* note: if IPMPSType == 0, IPMPData is an URL */ +} + +void MP4IPMPDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[2])->SetValueSize(m_size - 3); + + ReadProperties(pFile); +} + +MP4RegistrationDescriptor::MP4RegistrationDescriptor() + : MP4Descriptor(MP4RegistrationDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("formatIdentifier")); + AddProperty( /* 1 */ + new MP4BytesProperty("additionalIdentificationInfo")); +} + +void MP4RegistrationDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[1])->SetValueSize(m_size - 4); + + ReadProperties(pFile); +} + +MP4ExtProfileLevelDescriptor::MP4ExtProfileLevelDescriptor() + : MP4Descriptor(MP4ExtProfileLevelDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("profileLevelIndicationIndex")); + AddProperty( /* 1 */ + new MP4Integer8Property("ODProfileLevelIndication")); + AddProperty( /* 2 */ + new MP4Integer8Property("sceneProfileLevelIndication")); + AddProperty( /* 3 */ + new MP4Integer8Property("audioProfileLevelIndication")); + AddProperty( /* 4 */ + new MP4Integer8Property("visualProfileLevelIndication")); + AddProperty( /* 5 */ + new MP4Integer8Property("graphicsProfileLevelIndication")); + AddProperty( /* 6 */ + new MP4Integer8Property("MPEGJProfileLevelIndication")); +} + +MP4ExtensionDescriptor::MP4ExtensionDescriptor() + : MP4Descriptor() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("data")); +} + +void MP4ExtensionDescriptor::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); + + ReadProperties(pFile); +} + +MP4Descriptor* MP4DescriptorProperty::CreateDescriptor(u_int8_t tag) +{ + MP4Descriptor* pDescriptor = NULL; + + switch (tag) { + case MP4ESDescrTag: + pDescriptor = new MP4ESDescriptor(); + break; + case MP4DecConfigDescrTag: + pDescriptor = new MP4DecConfigDescriptor(); + break; + case MP4DecSpecificDescrTag: + pDescriptor = new MP4DecSpecificDescriptor(); + break; + case MP4SLConfigDescrTag: + pDescriptor = new MP4SLConfigDescriptor(); + break; + case MP4ContentIdDescrTag: + pDescriptor = new MP4ContentIdDescriptor(); + break; + case MP4SupplContentIdDescrTag: + pDescriptor = new MP4SupplContentIdDescriptor(); + break; + case MP4IPIPtrDescrTag: + pDescriptor = new MP4IPIPtrDescriptor(); + break; + case MP4IPMPPtrDescrTag: + pDescriptor = new MP4IPMPPtrDescriptor(); + break; + case MP4IPMPDescrTag: + pDescriptor = new MP4IPMPDescriptor(); + break; + case MP4QosDescrTag: + pDescriptor = new MP4QosDescriptor(); + break; + case MP4RegistrationDescrTag: + pDescriptor = new MP4RegistrationDescriptor(); + break; + case MP4ESIDIncDescrTag: + pDescriptor = new MP4ESIDIncDescriptor(); + break; + case MP4ESIDRefDescrTag: + pDescriptor = new MP4ESIDRefDescriptor(); + break; + case MP4IODescrTag: + case MP4FileIODescrTag: + pDescriptor = new MP4IODescriptor(); + pDescriptor->SetTag(tag); + break; + case MP4ODescrTag: + case MP4FileODescrTag: + pDescriptor = new MP4ODescriptor(); + pDescriptor->SetTag(tag); + break; + case MP4ExtProfileLevelDescrTag: + pDescriptor = new MP4ExtProfileLevelDescriptor(); + break; + } + + if (pDescriptor == NULL) { + if (tag >= MP4OCIDescrTagsStart && tag <= MP4OCIDescrTagsEnd) { + pDescriptor = CreateOCIDescriptor(tag); + } + + if (tag >= MP4ExtDescrTagsStart && tag <= MP4ExtDescrTagsEnd) { + pDescriptor = new MP4ExtensionDescriptor(); + pDescriptor->SetTag(tag); + } + } + + return pDescriptor; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_trak.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_trak.cpp @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrakAtom::MP4TrakAtom() + : MP4Atom("trak") +{ + ExpectChildAtom("tkhd", Required, OnlyOne); + ExpectChildAtom("tref", Optional, OnlyOne); + ExpectChildAtom("edts", Optional, OnlyOne); + ExpectChildAtom("mdia", Required, OnlyOne); + ExpectChildAtom("udta", Optional, Many); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_trun.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_trun.cpp @@ -0,0 +1,78 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrunAtom::MP4TrunAtom() + : MP4Atom("trun") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4Integer32Property("sampleCount")); +} + +void MP4TrunAtom::AddProperties(u_int32_t flags) +{ + if (flags & 0x01) { + // Note this is a signed 32 value + AddProperty( + new MP4Integer32Property("dataOffset")); + } + if (flags & 0x04) { + AddProperty( + new MP4Integer32Property("firstSampleFlags")); + } + + MP4TableProperty* pTable = + new MP4TableProperty("samples", m_pProperties[2]); + AddProperty(pTable); + + if (flags & 0x100) { + pTable->AddProperty( + new MP4Integer32Property("sampleDuration")); + } + if (flags & 0x200) { + pTable->AddProperty( + new MP4Integer32Property("sampleSize")); + } + if (flags & 0x400) { + pTable->AddProperty( + new MP4Integer32Property("sampleFlags")); + } + if (flags & 0x800) { + pTable->AddProperty( + new MP4Integer32Property("sampleCompositionTimeOffset")); + } +} + +void MP4TrunAtom::Read() +{ + /* read atom version, flags, and sampleCount */ + ReadProperties(0, 3); + + /* need to create the properties based on the atom flags */ + AddProperties(GetFlags()); + + /* now we can read the remaining properties */ + ReadProperties(3); + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/qosqualifiers.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/qosqualifiers.h @@ -0,0 +1,85 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __QOSQUALIFIERS_INCLUDED__ +#define __QOSQUALIFIERS_INCLUDED__ + +const u_int8_t MP4QosDescrTag = 0x0C; + +class MP4QosDescriptor : public MP4Descriptor { +public: + MP4QosDescriptor(); +}; + +typedef MP4Descriptor MP4QosQualifier; + +const u_int8_t MP4QosTagsStart = 0x01; +const u_int8_t MP4MaxDelayQosTag = 0x01; +const u_int8_t MP4PrefMaxDelayQosTag = 0x02; +const u_int8_t MP4LossProbQosTag = 0x03; +const u_int8_t MP4MaxGapLossQosTag = 0x04; +const u_int8_t MP4MaxAUSizeQosTag = 0x41; +const u_int8_t MP4AvgAUSizeQosTag = 0x42; +const u_int8_t MP4MaxAURateQosTag = 0x43; +const u_int8_t MP4QosTagsEnd = 0xFF; + +class MP4MaxDelayQosQualifier : public MP4QosQualifier { +public: + MP4MaxDelayQosQualifier(); +}; + +class MP4PrefMaxDelayQosQualifier : public MP4QosQualifier { +public: + MP4PrefMaxDelayQosQualifier(); +}; + +class MP4LossProbQosQualifier : public MP4QosQualifier { +public: + MP4LossProbQosQualifier(); +}; + +class MP4MaxGapLossQosQualifier : public MP4QosQualifier { +public: + MP4MaxGapLossQosQualifier(); +}; + +class MP4MaxAUSizeQosQualifier : public MP4QosQualifier { +public: + MP4MaxAUSizeQosQualifier(); +}; + +class MP4AvgAUSizeQosQualifier : public MP4QosQualifier { +public: + MP4AvgAUSizeQosQualifier(); +}; + +class MP4MaxAURateQosQualifier : public MP4QosQualifier { +public: + MP4MaxAURateQosQualifier(); +}; + +class MP4UnknownQosQualifier : public MP4QosQualifier { +public: + MP4UnknownQosQualifier(); + void Read(MP4File* pFile); +}; + +#endif /* __QOSQUALIFIERS_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stsh.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stsh.cpp @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StshAtom::MP4StshAtom() + : MP4Atom("stsh") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("shadowedSampleNumber")); + pTable->AddProperty( + new MP4Integer32Property("syncSampleNumber")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tpyl.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tpyl.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TpylAtom::MP4TpylAtom() + : MP4Atom("tpyl") +{ + AddProperty( // bytes sent of RTP payload data + new MP4Integer64Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_sinf.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_sinf.cpp @@ -0,0 +1,34 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + * + * Add the ProtectionInfoBox for ISMACrypt + */ + +#include "mp4common.h" + +MP4SinfAtom::MP4SinfAtom() + : MP4Atom("sinf") +{ + AddVersionAndFlags(); + ExpectChildAtom("frma", Required, OnlyOne); + ExpectChildAtom("schm", Required, OnlyOne); + ExpectChildAtom("schi", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_edts.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_edts.cpp @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4EdtsAtom::MP4EdtsAtom() + : MP4Atom("edts") +{ + ExpectChildAtom("elst", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_encv.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_encv.cpp @@ -0,0 +1,80 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +MP4EncvAtom::MP4EncvAtom() + : MP4Atom("encv") +{ + AddReserved("reserved1", 6); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer16Property("dataReferenceIndex")); + + AddReserved("reserved2", 16); /* 2 */ + + AddProperty( /* 3 */ + new MP4Integer16Property("width")); + AddProperty( /* 4 */ + new MP4Integer16Property("height")); + + AddReserved("reserved3", 14); /* 5 */ + + MP4StringProperty* pProp = + new MP4StringProperty("compressorName"); + pProp->SetFixedLength(32); + pProp->SetValue(""); + AddProperty(pProp); /* 6 */ + AddReserved("reserved4", 4); /* 7 */ + + ExpectChildAtom("esds", Required, OnlyOne); + ExpectChildAtom("sinf", Required, OnlyOne); +} + +void MP4EncvAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); + + // property reserved3 has non-zero fixed values + static u_int8_t reserved3[14] = { + 0x00, 0x48, 0x00, 0x00, + 0x00, 0x48, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, + }; + m_pProperties[5]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[5])-> + SetValue(reserved3, sizeof(reserved3)); + m_pProperties[5]->SetReadOnly(true); + + // property reserved4 has non-zero fixed values + static u_int8_t reserved4[4] = { + 0x00, 0x18, 0xFF, 0xFF, + }; + m_pProperties[7]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[7])-> + SetValue(reserved4, sizeof(reserved4)); + m_pProperties[7]->SetReadOnly(true); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_schi.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_schi.cpp @@ -0,0 +1,34 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Alix Marchandise-Franquet alix@cisco.com + * + * SchemeInformationBox for ISMACrypt + */ + +#include "mp4common.h" + +MP4SchiAtom::MP4SchiAtom() + : MP4Atom("schi") +{ + AddVersionAndFlags(); + // not sure if this is child atoms or table of boxes + // get clarification on spec 9.1.2.5 + ExpectChildAtom("iKMS", Required, OnlyOne); + ExpectChildAtom("iSFM", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tkhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tkhd.cpp @@ -0,0 +1,124 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TkhdAtom::MP4TkhdAtom() + : MP4Atom("tkhd") +{ + AddVersionAndFlags(); +} + +void MP4TkhdAtom::AddProperties(u_int8_t version) +{ + if (version == 1) { + AddProperty( /* 2 */ + new MP4Integer64Property("creationTime")); + AddProperty( /* 3 */ + new MP4Integer64Property("modificationTime")); + } else { // version == 0 + AddProperty( /* 2 */ + new MP4Integer32Property("creationTime")); + AddProperty( /* 3 */ + new MP4Integer32Property("modificationTime")); + } + + AddProperty( /* 4 */ + new MP4Integer32Property("trackId")); + AddReserved("reserved1", 4); /* 5 */ + + if (version == 1) { + AddProperty( /* 6 */ + new MP4Integer64Property("duration")); + } else { + AddProperty( /* 6 */ + new MP4Integer32Property("duration")); + } + + AddReserved("reserved2", 12); /* 7 */ + + MP4Float32Property* pProp; + + pProp = new MP4Float32Property("volume"); + pProp->SetFixed16Format(); + AddProperty(pProp); /* 8 */ + + AddReserved("reserved3", 38); /* 9 */ + + pProp = new MP4Float32Property("width"); + pProp->SetFixed32Format(); + AddProperty(pProp); /* 10 */ + + pProp = new MP4Float32Property("height"); + pProp->SetFixed32Format(); + AddProperty(pProp); /* 11 */ +} + +void MP4TkhdAtom::Generate() +{ + u_int8_t version = m_pFile->Use64Bits() ? 1 : 0; + SetVersion(version); + AddProperties(version); + + MP4Atom::Generate(); + + // set creation and modification times + MP4Timestamp now = MP4GetAbsTimestamp(); + if (version == 1) { + ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); + } else { + ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); + } + + // property reserved3 has non-zero fixed values + static u_int8_t reserved3[38] = { + 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, + }; + m_pProperties[9]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[9])-> + SetValue(reserved3, sizeof(reserved3)); + m_pProperties[9]->SetReadOnly(true); +} + +void MP4TkhdAtom::Read() +{ + /* read atom version */ + ReadProperties(0, 1); + + /* need to create the properties based on the atom version */ + AddProperties(GetVersion()); + + /* now we can read the remaining properties */ + ReadProperties(1); + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mdat.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mdat.cpp @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MdatAtom::MP4MdatAtom() + : MP4Atom("mdat") +{ +} + +void MP4MdatAtom::Read() +{ + Skip(); +} + +void MP4MdatAtom::Write() +{ + // should never get here + ASSERT(false); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/descriptors.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/descriptors.h @@ -0,0 +1,164 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __DESCRIPTORS_INCLUDED__ +#define __DESCRIPTORS_INCLUDED__ + +const u_int8_t MP4ODescrTag = 0x01; +const u_int8_t MP4IODescrTag = 0x02; +const u_int8_t MP4ESDescrTag = 0x03; +const u_int8_t MP4DecConfigDescrTag = 0x04; +const u_int8_t MP4DecSpecificDescrTag = 0x05; +const u_int8_t MP4SLConfigDescrTag = 0x06; +const u_int8_t MP4ContentIdDescrTag = 0x07; +const u_int8_t MP4SupplContentIdDescrTag = 0x08; +const u_int8_t MP4IPIPtrDescrTag = 0x09; +const u_int8_t MP4IPMPPtrDescrTag = 0x0A; +const u_int8_t MP4IPMPDescrTag = 0x0B; +const u_int8_t MP4RegistrationDescrTag = 0x0D; +const u_int8_t MP4ESIDIncDescrTag = 0x0E; +const u_int8_t MP4ESIDRefDescrTag = 0x0F; +const u_int8_t MP4FileIODescrTag = 0x10; +const u_int8_t MP4FileODescrTag = 0x11; +const u_int8_t MP4ExtProfileLevelDescrTag = 0x13; +const u_int8_t MP4ExtDescrTagsStart = 0x80; +const u_int8_t MP4ExtDescrTagsEnd = 0xFE; + +class MP4IODescriptor : public MP4Descriptor { +public: + MP4IODescriptor(); + void Generate(); +protected: + void Mutate(); +}; + +class MP4ODescriptor : public MP4Descriptor { +public: + MP4ODescriptor(); + void Generate(); +protected: + void Mutate(); +}; + +class MP4ESIDIncDescriptor : public MP4Descriptor { +public: + MP4ESIDIncDescriptor(); +}; + +class MP4ESIDRefDescriptor : public MP4Descriptor { +public: + MP4ESIDRefDescriptor(); +}; + +class MP4ESDescriptor : public MP4Descriptor { +public: + MP4ESDescriptor(); +protected: + void Mutate(); +}; + +class MP4DecConfigDescriptor : public MP4Descriptor { +public: + MP4DecConfigDescriptor(); + void Generate(); +}; + +class MP4DecSpecificDescriptor : public MP4Descriptor { +public: + MP4DecSpecificDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4SLConfigDescriptor : public MP4Descriptor { +public: + MP4SLConfigDescriptor(); + void Generate(); + void Read(MP4File* pFile); + protected: + void Mutate(); +}; + +class MP4IPIPtrDescriptor : public MP4Descriptor { +public: + MP4IPIPtrDescriptor(); +}; + +class MP4ContentIdDescriptor : public MP4Descriptor { +public: + MP4ContentIdDescriptor(); + void Read(MP4File* pFile); +protected: + void Mutate(); +}; + +class MP4SupplContentIdDescriptor : public MP4Descriptor { +public: + MP4SupplContentIdDescriptor(); +}; + +class MP4IPMPPtrDescriptor : public MP4Descriptor { +public: + MP4IPMPPtrDescriptor(); +}; + +class MP4IPMPDescriptor : public MP4Descriptor { +public: + MP4IPMPDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4RegistrationDescriptor : public MP4Descriptor { +public: + MP4RegistrationDescriptor(); + void Read(MP4File* pFile); +}; + +class MP4ExtProfileLevelDescriptor : public MP4Descriptor { +public: + MP4ExtProfileLevelDescriptor(); +}; + +class MP4ExtensionDescriptor : public MP4Descriptor { +public: + MP4ExtensionDescriptor(); + void Read(MP4File* pFile); +}; + +// associated values in descriptors + +// ES objectTypeId +const u_int8_t MP4SystemsV1ObjectType = 0x01; +const u_int8_t MP4SystemsV2ObjectType = 0x02; + +// ES streamType +const u_int8_t MP4ObjectDescriptionStreamType = 0x01; +const u_int8_t MP4ClockReferenceStreamType = 0x02; +const u_int8_t MP4SceneDescriptionStreamType = 0x03; +const u_int8_t MP4VisualStreamType = 0x04; +const u_int8_t MP4AudioStreamType = 0x05; +const u_int8_t MP4Mpeg7StreamType = 0x06; +const u_int8_t MP4IPMPStreamType = 0x07; +const u_int8_t MP4OCIStreamType = 0x08; +const u_int8_t MP4MPEGJStreamType = 0x09; +const u_int8_t MP4UserPrivateStreamType = 0x20; + +#endif /* __DESCRIPTORS_INCLUDED__ */ + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4atom.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4atom.h @@ -0,0 +1,231 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_ATOM_INCLUDED__ +#define __MP4_ATOM_INCLUDED__ + +class MP4Atom; +MP4ARRAY_DECL(MP4Atom, MP4Atom*); + +#define Required true +#define Optional false +#define OnlyOne true +#define Many false +#define Counted true + +/* helper class */ +class MP4AtomInfo { +public: + MP4AtomInfo() { + m_name = NULL; + } + MP4AtomInfo(const char* name, bool mandatory, bool onlyOne); + + const char* m_name; + bool m_mandatory; + bool m_onlyOne; + u_int32_t m_count; +}; + +MP4ARRAY_DECL(MP4AtomInfo, MP4AtomInfo*); + +class MP4Atom { +public: + MP4Atom(const char* type = NULL); + virtual ~MP4Atom(); + + static MP4Atom* ReadAtom(MP4File* pFile, MP4Atom* pParentAtom); + static MP4Atom* CreateAtom(const char* type); + static bool IsReasonableType(const char* type); + + MP4File* GetFile() { + return m_pFile; + }; + void SetFile(MP4File* pFile) { + m_pFile = pFile; + }; + + u_int64_t GetStart() { + return m_start; + }; + void SetStart(u_int64_t pos) { + m_start = pos; + }; + + u_int64_t GetEnd() { + return m_end; + }; + void SetEnd(u_int64_t pos) { + m_end = pos; + }; + + u_int64_t GetSize() { + return m_size; + } + void SetSize(u_int64_t size) { + m_size = size; + } + + const char* GetType() { + return m_type; + }; + void SetType(const char* type) { + if (type) { + ASSERT(strlen(type) == 4); + memcpy(m_type, type, 4); + m_type[4] = '\0'; + } else { + memset(m_type, 0, 5); + } + } + + void GetExtendedType(u_int8_t* pExtendedType) { + memcpy(pExtendedType, m_extendedType, sizeof(m_extendedType)); + }; + void SetExtendedType(u_int8_t* pExtendedType) { + memcpy(m_extendedType, pExtendedType, sizeof(m_extendedType)); + }; + + bool IsUnknownType() { + return m_unknownType; + } + void SetUnknownType(bool unknownType = true) { + m_unknownType = unknownType; + } + + bool IsRootAtom() { + return m_type[0] == '\0'; + } + + MP4Atom* GetParentAtom() { + return m_pParentAtom; + } + void SetParentAtom(MP4Atom* pParentAtom) { + m_pParentAtom = pParentAtom; + } + + void AddChildAtom(MP4Atom* pChildAtom) { + pChildAtom->SetFile(m_pFile); + pChildAtom->SetParentAtom(this); + m_pChildAtoms.Add(pChildAtom); + } + + void InsertChildAtom(MP4Atom* pChildAtom, u_int32_t index) { + pChildAtom->SetFile(m_pFile); + pChildAtom->SetParentAtom(this); + m_pChildAtoms.Insert(pChildAtom, index); + } + + void DeleteChildAtom(MP4Atom* pChildAtom) { + for (MP4ArrayIndex i = 0; i < m_pChildAtoms.Size(); i++) { + if (m_pChildAtoms[i] == pChildAtom) { + m_pChildAtoms.Delete(i); + return; + } + } + } + + u_int32_t GetNumberOfChildAtoms() { + return m_pChildAtoms.Size(); + } + + MP4Atom* GetChildAtom(u_int32_t index) { + return m_pChildAtoms[index]; + } + + MP4Property* GetProperty(u_int32_t index) { + return m_pProperties[index]; + } + + MP4Atom* FindAtom(const char* name); + + MP4Atom* FindChildAtom(const char* name); + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + u_int32_t GetFlags(); + void SetFlags(u_int32_t flags); + + u_int8_t GetDepth(); + + void Skip(); + + virtual void Generate(); + virtual void Read(); + virtual void BeginWrite(bool use64 = false); + virtual void Write(); + virtual void FinishWrite(bool use64 = false); + virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); + +protected: + void AddProperty(MP4Property* pProperty); + + void AddVersionAndFlags(); + + void AddReserved(char* name, u_int32_t size); + + void ExpectChildAtom(const char* name, + bool mandatory, bool onlyOne = true); + + MP4AtomInfo* FindAtomInfo(const char* name); + + bool IsMe(const char* name); + + bool FindContainedProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex); + + void ReadProperties( + u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); + void ReadChildAtoms(); + + void WriteProperties( + u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); + void WriteChildAtoms(); + + u_int8_t GetVersion(); + void SetVersion(u_int8_t version); + + /* debugging aid */ + u_int32_t GetVerbosity(); + +protected: + MP4File* m_pFile; + u_int64_t m_start; + u_int64_t m_end; + u_int64_t m_size; + char m_type[5]; + bool m_unknownType; + u_int8_t m_extendedType[16]; + + MP4Atom* m_pParentAtom; + u_int8_t m_depth; + + MP4PropertyArray m_pProperties; + MP4AtomInfoArray m_pChildAtomInfos; + MP4AtomArray m_pChildAtoms; +}; + +inline u_int32_t ATOMID(const char* type) { + return STRTOINT32(type); +} + +#endif /* __MP4_ATOM_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/libmp4v260.dsp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/libmp4v260.dsp @@ -0,0 +1,493 @@ +# Microsoft Developer Studio Project File - Name="libmp4v2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libmp4v2 - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libmp4v260.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libmp4v260.mak" CFG="libmp4v2 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libmp4v2 - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libmp4v2 - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libmp4v2 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libmp4v2 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libmp4v2 - Win32 Release" +# Name "libmp4v2 - Win32 Debug" +# Begin Group "source" + +# PROP Default_Filter ".c, .cpp" +# Begin Source File + +SOURCE=.\atom_co64.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_cprt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ctts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dimm.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dmed.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_dref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_drep.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_edts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_elst.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_esds.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_free.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_ftyp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hdlr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hinf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_hnti.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_iods.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_maxr.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdat.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mdia.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_minf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moof.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_moov.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4a.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4s.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mp4v.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_mvhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_nump.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_payt.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_pmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_root.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_rtp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_sdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_smhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_snro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stbl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stco.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stdp.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsc.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsh.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stss.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stsz.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_stts.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tfhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tims.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tkhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmax.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tmin.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tpyl.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_traf.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trak.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tref.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_treftype.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trex.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trpy.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_trun.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_tsro.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_udta.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_url.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_urn.cpp +# End Source File +# Begin Source File + +SOURCE=.\atom_vmhd.cpp +# End Source File +# Begin Source File + +SOURCE=.\descriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\isma.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4container.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4file_io.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4info.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4property.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4track.cpp +# End Source File +# Begin Source File + +SOURCE=.\mp4util.cpp +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.cpp +# End Source File +# Begin Source File + +SOURCE=.\odcommands.cpp +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.cpp +# End Source File +# Begin Source File + +SOURCE=.\rtphint.cpp +# End Source File +# End Group +# Begin Group "include" + +# PROP Default_Filter ".h" +# Begin Source File + +SOURCE=.\atoms.h +# End Source File +# Begin Source File + +SOURCE=.\descriptors.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\mp4array.h +# End Source File +# Begin Source File + +SOURCE=.\mp4atom.h +# End Source File +# Begin Source File + +SOURCE=.\mp4common.h +# End Source File +# Begin Source File + +SOURCE=.\mp4container.h +# End Source File +# Begin Source File + +SOURCE=.\mp4descriptor.h +# End Source File +# Begin Source File + +SOURCE=.\mp4file.h +# End Source File +# Begin Source File + +SOURCE=.\mp4property.h +# End Source File +# Begin Source File + +SOURCE=.\mp4track.h +# End Source File +# Begin Source File + +SOURCE=.\mp4util.h +# End Source File +# Begin Source File + +SOURCE=.\ocidescriptors.h +# End Source File +# Begin Source File + +SOURCE=.\odcommands.h +# End Source File +# Begin Source File + +SOURCE=.\qosqualifiers.h +# End Source File +# Begin Source File + +SOURCE=.\rtphint.h +# End Source File +# End Group +# End Target +# End Project --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mdhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mdhd.cpp @@ -0,0 +1,91 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MdhdAtom::MP4MdhdAtom() + : MP4Atom("mdhd") +{ + AddVersionAndFlags(); +} + +void MP4MdhdAtom::AddProperties(u_int8_t version) +{ + if (version == 1) { + AddProperty( + new MP4Integer64Property("creationTime")); + AddProperty( + new MP4Integer64Property("modificationTime")); + } else { + AddProperty( + new MP4Integer32Property("creationTime")); + AddProperty( + new MP4Integer32Property("modificationTime")); + } + + AddProperty( + new MP4Integer32Property("timeScale")); + + if (version == 1) { + AddProperty( + new MP4Integer64Property("duration")); + } else { + AddProperty( + new MP4Integer32Property("duration")); + } + + AddProperty( + new MP4Integer16Property("language")); + AddReserved("reserved", 2); +} + +void MP4MdhdAtom::Generate() +{ + u_int8_t version = m_pFile->Use64Bits() ? 1 : 0; + SetVersion(version); + AddProperties(version); + + MP4Atom::Generate(); + + // set creation and modification times + MP4Timestamp now = MP4GetAbsTimestamp(); + if (version == 1) { + ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); + } else { + ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); + } +} + +void MP4MdhdAtom::Read() +{ + /* read atom version */ + ReadProperties(0, 1); + + /* need to create the properties based on the atom version */ + AddProperties(GetVersion()); + + /* now we can read the remaining properties */ + ReadProperties(1); + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/qosqualifiers.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/qosqualifiers.cpp @@ -0,0 +1,133 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4QosDescriptor::MP4QosDescriptor() + : MP4Descriptor(MP4QosDescrTag) +{ + AddProperty( /* 0 */ + new MP4Integer8Property("predefined")); + AddProperty( /* 1 */ + new MP4QosQualifierProperty("qualifiers", + MP4QosTagsStart, MP4QosTagsEnd, Optional, Many)); +} + +MP4MaxDelayQosQualifier::MP4MaxDelayQosQualifier() + : MP4QosQualifier(MP4MaxDelayQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("maxDelay")); +} + +MP4PrefMaxDelayQosQualifier::MP4PrefMaxDelayQosQualifier() + : MP4QosQualifier(MP4PrefMaxDelayQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("prefMaxDelay")); +} + +MP4LossProbQosQualifier::MP4LossProbQosQualifier() + : MP4QosQualifier(MP4LossProbQosTag) +{ + AddProperty( /* 0 */ + new MP4Float32Property("lossProb")); +} + +MP4MaxGapLossQosQualifier::MP4MaxGapLossQosQualifier() + : MP4QosQualifier(MP4MaxGapLossQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("maxGapLoss")); +} + +MP4MaxAUSizeQosQualifier::MP4MaxAUSizeQosQualifier() + : MP4QosQualifier(MP4MaxAUSizeQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("maxAUSize")); +} + +MP4AvgAUSizeQosQualifier::MP4AvgAUSizeQosQualifier() + : MP4QosQualifier(MP4AvgAUSizeQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("avgAUSize")); +} + +MP4MaxAURateQosQualifier::MP4MaxAURateQosQualifier() + : MP4QosQualifier(MP4MaxAURateQosTag) +{ + AddProperty( /* 0 */ + new MP4Integer32Property("maxAURate")); +} + +MP4UnknownQosQualifier::MP4UnknownQosQualifier() + : MP4QosQualifier() +{ + AddProperty( /* 0 */ + new MP4BytesProperty("data")); +} + +void MP4UnknownQosQualifier::Read(MP4File* pFile) +{ + ReadHeader(pFile); + + /* byte properties need to know how long they are before reading */ + ((MP4BytesProperty*)m_pProperties[0])->SetValueSize(m_size); + + ReadProperties(pFile); +} + +MP4Descriptor* MP4QosQualifierProperty::CreateDescriptor(u_int8_t tag) +{ + MP4Descriptor* pDescriptor = NULL; + + switch (tag) { + case MP4MaxDelayQosTag: + pDescriptor = new MP4MaxDelayQosQualifier(); + break; + case MP4PrefMaxDelayQosTag: + pDescriptor = new MP4PrefMaxDelayQosQualifier(); + break; + case MP4LossProbQosTag: + pDescriptor = new MP4LossProbQosQualifier(); + break; + case MP4MaxGapLossQosTag: + pDescriptor = new MP4MaxGapLossQosQualifier(); + break; + case MP4MaxAUSizeQosTag: + pDescriptor = new MP4MaxAUSizeQosQualifier(); + break; + case MP4AvgAUSizeQosTag: + pDescriptor = new MP4AvgAUSizeQosQualifier(); + break; + case MP4MaxAURateQosTag: + pDescriptor = new MP4MaxAURateQosQualifier(); + break; + default: + pDescriptor = new MP4UnknownQosQualifier(); + pDescriptor->SetTag(tag); + } + + return pDescriptor; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_traf.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_traf.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrafAtom::MP4TrafAtom() + : MP4Atom("traf") +{ + ExpectChildAtom("tfhd", Required, OnlyOne); + ExpectChildAtom("trun", Optional, Many); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/systems.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/systems.h @@ -0,0 +1,312 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2000, 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Bill May wmay@cisco.com + */ + +#ifndef __SYSTEMS_H__ +#define __SYSTEMS_H__ + +#ifdef WIN32 +#define HAVE_IN_PORT_T +#define HAVE_SOCKLEN_T +#include +#define NEED_SDL_VIDEO_IN_MAIN_THREAD +#else +#undef PACKAGE +#undef VERSION +#include +#endif + + + + +#ifdef WIN32 + +#define _WIN32_WINNT 0x0400 +#define _WINSOCKAPI_ +#include +#include +#include +#include +#include +#include +#include + +typedef unsigned __int64 uint64_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int64 u_int64_t; +typedef unsigned __int32 u_int32_t; +typedef unsigned __int16 u_int16_t; +typedef unsigned __int8 u_int8_t; +typedef __int64 int64_t; +typedef __int32 int32_t; +typedef __int16 int16_t; +typedef __int8 int8_t; +typedef unsigned short in_port_t; +typedef int socklen_t; +typedef int ssize_t; +#define snprintf _snprintf +#define strncasecmp _strnicmp +#define strcasecmp _stricmp + +#include +#include +#include +#include +#define write _write +#define lseek _lseek +#define close _close +#define open _open +#define access _access +#define vsnprintf _vsnprintf +#define F_OK 0 +#define OPEN_RDWR (_O_RDWR | _O_BINARY) +#define OPEN_CREAT (_O_CREAT | _O_BINARY) +#define OPEN_RDONLY (_O_RDONLY | _O_BINARY) +#define srandom srand +#define random rand + +#define IOSBINARY ios::binary + +#ifdef __cplusplus +extern "C" { +#endif +int gettimeofday(struct timeval *t, void *); +#ifdef __cplusplus +} +#endif + +#define PATH_MAX MAX_PATH +#define MAX_UINT64 -1 +#define LLD "%I64d" +#define LLU "%I64u" +#define LLX "%I64x" +#define LLX16 "%016I64x" +#define M_LLU 1000i64 +#define C_LLU 100i64 +#define I_LLU 1i64 + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64 +#define VAR_TO_FPOS(fpos, var) (fpos) = (var) +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(_FPOSOFF(fpos)) +#else +#define VAR_TO_FPOS(fpos, var) (fpos).lopart = ((var) & UINT_MAX); (fpos).hipart = ((var) >> 32) +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((uint64_t)((fpos).hipart ) << 32 | (fpos).lopart) +#endif + +#define __STRING(expr) #expr + +#define FOPEN_READ_BINARY "rb" +#define FOPEN_WRITE_BINARY "wb" + +#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a))) +#else /* UNIX */ +/***************************************************************************** + * UNIX LIKE DEFINES BELOW THIS POINT + *****************************************************************************/ +#ifdef sun +#include +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#else +#if _FILE_OFFSET_BITS < 64 +#error File offset bits is already set to non-64 value +#endif +#endif + +#ifndef _LARGEFILE_SOURCE +#define _LARGEFILE_SOURCE +#endif +#include +#include +#include + +#ifdef HAVE_INTTYPES_H +#include +#else +#ifdef HAVE_STDINT_H +#include +#else +#error "Don't have stdint.h or inttypes.h - no way to get uint8_t" +#endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef TIME_WITH_SYS_TIME +#include +#include +#else +#ifdef HAVE_SYS_TIME_H +#include +#else +#include +#endif +#endif +#include + +#define OPEN_RDWR O_RDWR +#define OPEN_CREAT O_CREAT +#define OPEN_RDONLY O_RDONLY + +#define closesocket close +#define IOSBINARY ios::bin +#define MAX_UINT64 -1LLU +#define LLD "%lld" +#define LLU "%llu" +#define LLX "%llx" +#define LLX16 "%016llx" +#define M_LLU 1000LLU +#define C_LLU 100LLU +#define I_LLU 1LLU +#ifdef HAVE_FPOS_T_POS +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos) +#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var) +#else +#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos) +#define VAR_TO_FPOS(fpos, var) (fpos) = (var) +#endif + +#define FOPEN_READ_BINARY "r" +#define FOPEN_WRITE_BINARY "w" +#define UINT64_TO_DOUBLE(a) ((double)(a)) +#endif /* define unix */ + +/***************************************************************************** + * Generic type includes used in the whole package * + *****************************************************************************/ +#include +typedef void (*error_msg_func_t)(int loglevel, + const char *lib, + const char *fmt, + va_list ap); +typedef void (*lib_message_func_t)(int loglevel, + const char *lib, + const char *fmt, + ...); +#ifndef HAVE_IN_PORT_T +typedef uint16_t in_port_t; +#endif + +#ifndef HAVE_SOCKLEN_T +typedef unsigned int socklen_t; +#endif + +#ifdef sun +#include +#define u_int8_t uint8_t +#define u_int16_t uint16_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t +#define __STRING(expr) #expr +#endif + +#ifndef HAVE_STRSEP +#ifdef __cplusplus +extern "C" { +#endif +char *strsep(char **strp, const char *delim); +#ifdef __cplusplus +} +#endif +#endif + +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE (-1) +#endif + +#define MALLOC_STRUCTURE(a) ((a *)malloc(sizeof(a))) + +#define CHECK_AND_FREE(a) if ((a) != NULL) { free((void *)(a)); (a) = NULL;} + +#define NUM_ELEMENTS_IN_ARRAY(name) ((sizeof((name))) / (sizeof(*(name)))) + +#ifndef HAVE_GLIB_H +typedef char gchar; +typedef unsigned char guchar; + +typedef int gint; +typedef unsigned int guint; + +typedef long glong; +typedef unsigned long gulong; + +typedef double gdouble; + +typedef int gboolean; + +typedef int16_t gint16; +typedef uint16_t guint16; + +typedef int32_t gint32; +typedef uint32_t guint32; + +typedef int64_t gint64; +typedef uint64_t guint64; + +typedef uint8_t guint8; +typedef int8_t gint8; + +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#endif /* __SYSTEMS_H__ */ + + + + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_iSFM.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_iSFM.cpp @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Alix Marchandise-Franquet alix@cisco.com + * + * ISMASampleFormatBox for ISMACrypt + */ + +#include "mp4common.h" + +MP4ISFMAtom::MP4ISFMAtom() + : MP4Atom("iSFM") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4BitfieldProperty("selective-encryption", 1)); + AddProperty( /* 3 */ + new MP4BitfieldProperty("reserved", 7)); + AddProperty( /* 4 */ + new MP4Integer8Property("key-indicator-length")); + AddProperty( /* 5 */ + new MP4Integer8Property("IV-length")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stsz.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stsz.cpp @@ -0,0 +1,69 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StszAtom::MP4StszAtom() + : MP4Atom("stsz") +{ + AddVersionAndFlags(); /* 0, 1 */ + + AddProperty( /* 2 */ + new MP4Integer32Property("sampleSize")); + + MP4Integer32Property* pCount = + new MP4Integer32Property("sampleCount"); + AddProperty(pCount); /* 3 */ + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); /* 4 */ + + pTable->AddProperty( /* 4/0 */ + new MP4Integer32Property("sampleSize")); +} + +void MP4StszAtom::Read() +{ + ReadProperties(0, 4); + + u_int32_t sampleSize = + ((MP4Integer32Property*)m_pProperties[2])->GetValue(); + + // only attempt to read entries table if sampleSize is zero + // i.e sample size is not constant + m_pProperties[4]->SetImplicit(sampleSize != 0); + + ReadProperties(4); + + Skip(); // to end of atom +} + +void MP4StszAtom::Write() +{ + u_int32_t sampleSize = + ((MP4Integer32Property*)m_pProperties[2])->GetValue(); + + // only attempt to write entries table if sampleSize is zero + // i.e sample size is not constant + m_pProperties[4]->SetImplicit(sampleSize != 0); + + MP4Atom::Write(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4track.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4track.h @@ -0,0 +1,240 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_TRACK_INCLUDED__ +#define __MP4_TRACK_INCLUDED__ + +typedef u_int32_t MP4ChunkId; + +// forward declarations +class MP4File; +class MP4Atom; +class MP4Property; +class MP4IntegerProperty; +class MP4Integer16Property; +class MP4Integer32Property; +class MP4Integer64Property; +class MP4StringProperty; + +class MP4Track { +public: + MP4Track(MP4File* pFile, MP4Atom* pTrakAtom); + + virtual ~MP4Track(); + + MP4TrackId GetId() { + return m_trackId; + } + + const char* GetType(); + + void SetType(const char* type); + + MP4File* GetFile() { + return m_pFile; + } + + MP4Atom* GetTrakAtom() { + return m_pTrakAtom; + } + + void ReadSample( + // input parameters + MP4SampleId sampleId, + // output parameters + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime = NULL, + MP4Duration* pDuration = NULL, + MP4Duration* pRenderingOffset = NULL, + bool* pIsSyncSample = NULL); + + void WriteSample( + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration = 0, + MP4Duration renderingOffset = 0, + bool isSyncSample = true); + + virtual void FinishWrite(); + + u_int64_t GetDuration(); // in track timeScale units + u_int32_t GetTimeScale(); + u_int32_t GetNumberOfSamples(); + u_int32_t GetSampleSize(MP4SampleId sampleId); + u_int32_t GetMaxSampleSize(); + u_int64_t GetTotalOfSampleSizes(); + u_int32_t GetAvgBitrate(); // in bps + u_int32_t GetMaxBitrate(); // in bps + + MP4Duration GetFixedSampleDuration(); + bool SetFixedSampleDuration(MP4Duration duration); + + void GetSampleTimes(MP4SampleId sampleId, + MP4Timestamp* pStartTime, MP4Duration* pDuration); + + bool IsSyncSample(MP4SampleId sampleId); + + MP4SampleId GetSampleIdFromTime( + MP4Timestamp when, + bool wantSyncSample = false); + + MP4Duration GetSampleRenderingOffset(MP4SampleId sampleId); + void SetSampleRenderingOffset(MP4SampleId sampleId, + MP4Duration renderingOffset); + + MP4EditId AddEdit( + MP4EditId editId = MP4_INVALID_EDIT_ID); + + void DeleteEdit( + MP4EditId editId); + + MP4Timestamp GetEditStart( + MP4EditId editId); + + MP4Timestamp GetEditTotalDuration( + MP4EditId editId); + + MP4SampleId GetSampleIdFromEditTime( + MP4Timestamp editWhen, + MP4Timestamp* pStartTime = NULL, + MP4Duration* pDuration = NULL); + + static const char* NormalizeTrackType(const char* type); + + // special operation for use during hint track packet assembly + void ReadSampleFragment( + MP4SampleId sampleId, + u_int32_t sampleOffset, + u_int16_t sampleLength, + u_int8_t* pDest); + + // special operations for use during optimization + + u_int32_t GetNumberOfChunks(); + + MP4Timestamp GetChunkTime(MP4ChunkId chunkId); + + void ReadChunk(MP4ChunkId chunkId, + u_int8_t** ppChunk, u_int32_t* pChunkSize); + + void RewriteChunk(MP4ChunkId chunkId, + u_int8_t* pChunk, u_int32_t chunkSize); + +protected: + bool InitEditListProperties(); + + FILE* GetSampleFile(MP4SampleId sampleId); + u_int64_t GetSampleFileOffset(MP4SampleId sampleId); + u_int32_t GetSampleStscIndex(MP4SampleId sampleId); + u_int32_t GetChunkStscIndex(MP4ChunkId chunkId); + u_int32_t GetChunkSize(MP4ChunkId chunkId); + u_int32_t GetSampleCttsIndex(MP4SampleId sampleId, + MP4SampleId* pFirstSampleId = NULL); + MP4SampleId GetNextSyncSample(MP4SampleId sampleId); + + void UpdateSampleSizes(MP4SampleId sampleId, + u_int32_t numBytes); + bool IsChunkFull(MP4SampleId sampleId); + void UpdateSampleToChunk(MP4SampleId sampleId, + MP4ChunkId chunkId, u_int32_t samplesPerChunk); + void UpdateChunkOffsets(u_int64_t chunkOffset); + void UpdateSampleTimes(MP4Duration duration); + void UpdateRenderingOffsets(MP4SampleId sampleId, + MP4Duration renderingOffset); + void UpdateSyncSamples(MP4SampleId sampleId, + bool isSyncSample); + + MP4Atom* AddAtom(char* parentName, char* childName); + + void UpdateDurations(MP4Duration duration); + MP4Duration ToMovieDuration(MP4Duration trackDuration); + + void UpdateModificationTimes(); + + void WriteChunkBuffer(); + +protected: + MP4File* m_pFile; + MP4Atom* m_pTrakAtom; // moov.trak[] + MP4TrackId m_trackId; // moov.trak[].tkhd.trackId + MP4StringProperty* m_pTypeProperty; // moov.trak[].mdia.hdlr.handlerType + + u_int32_t m_lastStsdIndex; + FILE* m_lastSampleFile; + + // for efficient construction of hint track packets + MP4SampleId m_cachedReadSampleId; + u_int8_t* m_pCachedReadSample; + u_int32_t m_cachedReadSampleSize; + + // for writing + MP4SampleId m_writeSampleId; + MP4Duration m_fixedSampleDuration; + u_int8_t* m_pChunkBuffer; + u_int32_t m_chunkBufferSize; + u_int32_t m_chunkSamples; + MP4Duration m_chunkDuration; + + // controls for chunking + u_int32_t m_samplesPerChunk; + MP4Duration m_durationPerChunk; + + MP4Integer32Property* m_pTimeScaleProperty; + MP4IntegerProperty* m_pTrackDurationProperty; // 32 or 64 bits + MP4IntegerProperty* m_pMediaDurationProperty; // 32 or 64 bits + MP4IntegerProperty* m_pTrackModificationProperty; // 32 or 64 bits + MP4IntegerProperty* m_pMediaModificationProperty; // 32 or 64 bits + + MP4Integer32Property* m_pStszFixedSampleSizeProperty; + MP4Integer32Property* m_pStszSampleCountProperty; + MP4Integer32Property* m_pStszSampleSizeProperty; + + MP4Integer32Property* m_pStscCountProperty; + MP4Integer32Property* m_pStscFirstChunkProperty; + MP4Integer32Property* m_pStscSamplesPerChunkProperty; + MP4Integer32Property* m_pStscSampleDescrIndexProperty; + MP4Integer32Property* m_pStscFirstSampleProperty; + + MP4Integer32Property* m_pChunkCountProperty; + MP4IntegerProperty* m_pChunkOffsetProperty; // 32 or 64 bits + + MP4Integer32Property* m_pSttsCountProperty; + MP4Integer32Property* m_pSttsSampleCountProperty; + MP4Integer32Property* m_pSttsSampleDeltaProperty; + + MP4Integer32Property* m_pCttsCountProperty; + MP4Integer32Property* m_pCttsSampleCountProperty; + MP4Integer32Property* m_pCttsSampleOffsetProperty; + + MP4Integer32Property* m_pStssCountProperty; + MP4Integer32Property* m_pStssSampleProperty; + + MP4Integer32Property* m_pElstCountProperty; + MP4IntegerProperty* m_pElstMediaTimeProperty; // 32 or 64 bits + MP4IntegerProperty* m_pElstDurationProperty; // 32 or 64 bits + MP4Integer16Property* m_pElstRateProperty; + MP4Integer16Property* m_pElstReservedProperty; +}; + +MP4ARRAY_DECL(MP4Track, MP4Track*); + +#endif /* __MP4_TRACK_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_nmhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_nmhd.cpp @@ -0,0 +1,28 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4NmhdAtom::MP4NmhdAtom() + : MP4Atom("nmhd") +{ + AddVersionAndFlags(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_ctts.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_ctts.cpp @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4CttsAtom::MP4CttsAtom() + : MP4Atom("ctts") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("sampleCount")); + pTable->AddProperty( + new MP4Integer32Property("sampleOffset")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tfhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tfhd.cpp @@ -0,0 +1,69 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TfhdAtom::MP4TfhdAtom() + : MP4Atom("tfhd") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4Integer32Property("trackId")); +} + +void MP4TfhdAtom::AddProperties(u_int32_t flags) +{ + if (flags & 0x01) { + // note this property is signed 64! + AddProperty( + new MP4Integer64Property("baseDataOffset")); + } + if (flags & 0x02) { + AddProperty( + new MP4Integer32Property("sampleDescriptionIndex")); + } + if (flags & 0x08) { + AddProperty( + new MP4Integer32Property("defaultSampleDuration")); + } + if (flags & 0x10) { + AddProperty( + new MP4Integer32Property("defaultSampleSize")); + } + if (flags & 0x20) { + AddProperty( + new MP4Integer32Property("defaultSampleFlags")); + } +} + +void MP4TfhdAtom::Read() +{ + /* read atom version, flags, and trackId */ + ReadProperties(0, 3); + + /* need to create the properties based on the atom flags */ + AddProperties(GetFlags()); + + /* now we can read the remaining properties */ + ReadProperties(3); + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_dmax.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_dmax.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DmaxAtom::MP4DmaxAtom() + : MP4Atom("dmax") +{ + AddProperty( // max packet duration + new MP4Integer32Property("milliSecs")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atoms.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atoms.h @@ -0,0 +1,593 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_ATOMS_INCLUDED__ +#define __MP4_ATOMS_INCLUDED__ + +// declare all the atom subclasses +// i.e. spare us atom_xxxx.h for all the atoms +// +// The majority of atoms just need their own constructor declared +// Some atoms have a few special needs +// A small minority of atoms need lots of special handling + +class MP4RootAtom : public MP4Atom { +public: + MP4RootAtom(); + void BeginWrite(bool use64 = false); + void Write(); + void FinishWrite(bool use64 = false); + + void BeginOptimalWrite(); + void FinishOptimalWrite(); + +protected: + u_int32_t GetLastMdatIndex(); + void WriteAtomType(const char* type, bool onlyOne); +}; + +class MP4FtypAtom : public MP4Atom { +public: + MP4FtypAtom(); + void Generate(); + void Read(); +}; + +class MP4MdatAtom : public MP4Atom { +public: + MP4MdatAtom(); + void Read(); + void Write(); +}; + +class MP4MoovAtom : public MP4Atom { +public: + MP4MoovAtom(); +}; + +class MP4MvhdAtom : public MP4Atom { +public: + MP4MvhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4IodsAtom : public MP4Atom { +public: + MP4IodsAtom(); +}; + +class MP4TrakAtom : public MP4Atom { +public: + MP4TrakAtom(); +}; + +class MP4TkhdAtom : public MP4Atom { +public: + MP4TkhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4TrefAtom : public MP4Atom { +public: + MP4TrefAtom(); +}; + +class MP4TrefTypeAtom : public MP4Atom { +public: + MP4TrefTypeAtom(const char* type); + void Read(); +}; + +class MP4MdiaAtom : public MP4Atom { +public: + MP4MdiaAtom(); +}; + +class MP4MdhdAtom : public MP4Atom { +public: + MP4MdhdAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4HdlrAtom : public MP4Atom { +public: + MP4HdlrAtom(); + void Read(); +}; + +class MP4MinfAtom : public MP4Atom { +public: + MP4MinfAtom(); +}; + +class MP4VmhdAtom : public MP4Atom { +public: + MP4VmhdAtom(); + void Generate(); +}; + +class MP4SmhdAtom : public MP4Atom { +public: + MP4SmhdAtom(); +}; + +class MP4HmhdAtom : public MP4Atom { +public: + MP4HmhdAtom(); +}; + +class MP4NmhdAtom : public MP4Atom { +public: + MP4NmhdAtom(); +}; + +class MP4DinfAtom : public MP4Atom { +public: + MP4DinfAtom(); +}; + +class MP4DrefAtom : public MP4Atom { +public: + MP4DrefAtom(); + void Read(); +}; + +class MP4UrlAtom : public MP4Atom { +public: + MP4UrlAtom(); + void Read(); + void Write(); +}; + +class MP4UrnAtom : public MP4Atom { +public: + MP4UrnAtom(); + void Read(); +}; + +class MP4StblAtom : public MP4Atom { +public: + MP4StblAtom(); + void Generate(); +}; + +class MP4StsdAtom : public MP4Atom { +public: + MP4StsdAtom(); + void Read(); +}; + +class MP4Mp4aAtom : public MP4Atom { +public: + MP4Mp4aAtom(); + void Generate(); +}; + +class MP4Mp4sAtom : public MP4Atom { +public: + MP4Mp4sAtom(); + void Generate(); +}; + +class MP4Mp4vAtom : public MP4Atom { +public: + MP4Mp4vAtom(); + void Generate(); +}; + +class MP4EsdsAtom : public MP4Atom { +public: + MP4EsdsAtom(); +}; + +class MP4SttsAtom : public MP4Atom { +public: + MP4SttsAtom(); +}; + +class MP4CttsAtom : public MP4Atom { +public: + MP4CttsAtom(); +}; + +class MP4StszAtom : public MP4Atom { +public: + MP4StszAtom(); + void Read(); + void Write(); +}; + +class MP4StscAtom : public MP4Atom { +public: + MP4StscAtom(); + void Read(); +}; + +class MP4StcoAtom : public MP4Atom { +public: + MP4StcoAtom(); +}; + +class MP4Co64Atom : public MP4Atom { +public: + MP4Co64Atom(); +}; + +class MP4StssAtom : public MP4Atom { +public: + MP4StssAtom(); +}; + +class MP4StshAtom : public MP4Atom { +public: + MP4StshAtom(); +}; + +class MP4StdpAtom : public MP4Atom { +public: + MP4StdpAtom(); + void Read(); +}; + +class MP4EdtsAtom : public MP4Atom { +public: + MP4EdtsAtom(); +}; + +class MP4ElstAtom : public MP4Atom { +public: + MP4ElstAtom(); + void Generate(); + void Read(); +protected: + void AddProperties(u_int8_t version); +}; + +class MP4UdtaAtom : public MP4Atom { +public: + MP4UdtaAtom(); + void Read(); +}; + +class MP4CprtAtom : public MP4Atom { +public: + MP4CprtAtom(); +}; + +class MP4HntiAtom : public MP4Atom { +public: + MP4HntiAtom(); + void Read(); +}; + +class MP4RtpAtom : public MP4Atom { +public: + MP4RtpAtom(); + void Generate(); + void Read(); + void Write(); + +protected: + void AddPropertiesStsdType(); + void AddPropertiesHntiType(); + + void GenerateStsdType(); + void GenerateHntiType(); + + void ReadStsdType(); + void ReadHntiType(); + + void WriteHntiType(); +}; + +class MP4TimsAtom : public MP4Atom { +public: + MP4TimsAtom(); +}; + +class MP4TsroAtom : public MP4Atom { +public: + MP4TsroAtom(); +}; + +class MP4SnroAtom : public MP4Atom { +public: + MP4SnroAtom(); +}; + +class MP4SdpAtom : public MP4Atom { +public: + MP4SdpAtom(); + void Read(); + void Write(); +}; + +class MP4HinfAtom : public MP4Atom { +public: + MP4HinfAtom(); + void Generate(); +}; + +class MP4TrpyAtom : public MP4Atom { +public: + MP4TrpyAtom(); +}; + +class MP4NumpAtom : public MP4Atom { +public: + MP4NumpAtom(); +}; + +class MP4TpylAtom : public MP4Atom { +public: + MP4TpylAtom(); +}; + +class MP4MaxrAtom : public MP4Atom { +public: + MP4MaxrAtom(); +}; + +class MP4DmedAtom : public MP4Atom { +public: + MP4DmedAtom(); +}; + +class MP4DimmAtom : public MP4Atom { +public: + MP4DimmAtom(); +}; + +class MP4DrepAtom : public MP4Atom { +public: + MP4DrepAtom(); +}; + +class MP4TminAtom : public MP4Atom { +public: + MP4TminAtom(); +}; + +class MP4TmaxAtom : public MP4Atom { +public: + MP4TmaxAtom(); +}; + +class MP4PmaxAtom : public MP4Atom { +public: + MP4PmaxAtom(); +}; + +class MP4DmaxAtom : public MP4Atom { +public: + MP4DmaxAtom(); +}; + +class MP4PaytAtom : public MP4Atom { +public: + MP4PaytAtom(); +}; + +class MP4MvexAtom : public MP4Atom { +public: + MP4MvexAtom(); +}; + +class MP4TrexAtom : public MP4Atom { +public: + MP4TrexAtom(); +}; + +class MP4MoofAtom : public MP4Atom { +public: + MP4MoofAtom(); +}; + +class MP4MfhdAtom : public MP4Atom { +public: + MP4MfhdAtom(); +}; + +class MP4TrafAtom : public MP4Atom { +public: + MP4TrafAtom(); +}; + +class MP4TfhdAtom : public MP4Atom { +public: + MP4TfhdAtom(); + void Read(); +protected: + void AddProperties(u_int32_t flags); +}; + +class MP4TrunAtom : public MP4Atom { +public: + MP4TrunAtom(); + void Read(); +protected: + void AddProperties(u_int32_t flags); +}; + +class MP4FreeAtom : public MP4Atom { +public: + MP4FreeAtom(); + void Read(); + void Write(); +}; + +// ismacrypt +class MP4EncaAtom : public MP4Atom { +public: + MP4EncaAtom(); + void Generate(); +}; + +class MP4EncvAtom : public MP4Atom { +public: + MP4EncvAtom(); + void Generate(); +}; + +class MP4FrmaAtom : public MP4Atom { +public: + MP4FrmaAtom(); +}; + +class MP4IKMSAtom : public MP4Atom { +public: + MP4IKMSAtom(); +}; + +class MP4ISFMAtom : public MP4Atom { +public: + MP4ISFMAtom(); +}; + +class MP4SchiAtom : public MP4Atom { +public: + MP4SchiAtom(); +}; + +class MP4SchmAtom : public MP4Atom { +public: + MP4SchmAtom(); +}; + +class MP4SinfAtom : public MP4Atom { +public: + MP4SinfAtom(); +}; + +/* iTunes META data atoms */ +class MP4MetaAtom : public MP4Atom { +public: + MP4MetaAtom(); +}; + +class MP4NameAtom : public MP4Atom { +public: + MP4NameAtom(); + void Read(); +}; + +class MP4MeanAtom : public MP4Atom { +public: + MP4MeanAtom(); + void Read(); +}; + +class MP4DataAtom : public MP4Atom { +public: + MP4DataAtom(); + void Read(); +}; + +class MP4IlstAtom : public MP4Atom { +public: + MP4IlstAtom(); +}; + +class MP4DashAtom : public MP4Atom { +public: + MP4DashAtom(); +}; + +class MP4NamAtom : public MP4Atom { +public: + MP4NamAtom(); +}; + +class MP4ArtAtom : public MP4Atom { +public: + MP4ArtAtom(); +}; + +class MP4WrtAtom : public MP4Atom { +public: + MP4WrtAtom(); +}; + +class MP4AlbAtom : public MP4Atom { +public: + MP4AlbAtom(); +}; + +class MP4GenAtom : public MP4Atom { +public: + MP4GenAtom(); +}; + +class MP4TrknAtom : public MP4Atom { +public: + MP4TrknAtom(); +}; + +class MP4DayAtom : public MP4Atom { +public: + MP4DayAtom(); +}; + +class MP4TooAtom : public MP4Atom { +public: + MP4TooAtom(); +}; + +class MP4GnreAtom : public MP4Atom { +public: + MP4GnreAtom(); +}; + +class MP4CpilAtom : public MP4Atom { +public: + MP4CpilAtom(); +}; + +class MP4TmpoAtom : public MP4Atom { +public: + MP4TmpoAtom(); +}; + +class MP4CovrAtom : public MP4Atom { +public: + MP4CovrAtom(); +}; + +class MP4CmtAtom : public MP4Atom { +public: + MP4CmtAtom(); +}; + +class MP4DiskAtom : public MP4Atom { +public: + MP4DiskAtom(); +}; + +#endif /* __MP4_ATOMS_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_pmax.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_pmax.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4PmaxAtom::MP4PmaxAtom() + : MP4Atom("pmax") +{ + AddProperty( // max packet size + new MP4Integer32Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_dref.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_dref.cpp @@ -0,0 +1,56 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DrefAtom::MP4DrefAtom() + : MP4Atom("dref") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + pCount->SetReadOnly(); + AddProperty(pCount); + + ExpectChildAtom("url ", Optional, Many); + ExpectChildAtom("urn ", Optional, Many); +} + +void MP4DrefAtom::Read() +{ + /* do the usual read */ + MP4Atom::Read(); + + // check that number of children == entryCount + MP4Integer32Property* pCount = + (MP4Integer32Property*)m_pProperties[2]; + + if (m_pChildAtoms.Size() != pCount->GetValue()) { + VERBOSE_READ(GetVerbosity(), + MP4Printf("Warning: dref inconsistency with number of entries")); + + /* fix it */ + pCount->SetReadOnly(false); + pCount->SetValue(m_pChildAtoms.Size()); + pCount->SetReadOnly(true); + } +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4property.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4property.cpp @@ -0,0 +1,875 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Property::MP4Property(const char* name) +{ + m_name = name; + m_pParentAtom = NULL; + m_readOnly = false; + m_implicit = false; +} + +bool MP4Property::FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + if (name == NULL) { + return false; + } + + if (!strcasecmp(m_name, name)) { + if (m_pParentAtom) { + VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), + printf("FindProperty: matched %s\n", name)); + } + + *ppProperty = this; + return true; + } + return false; +} + +// Integer Property + +u_int64_t MP4IntegerProperty::GetValue(u_int32_t index) +{ + switch (this->GetType()) { + case Integer8Property: + return ((MP4Integer8Property*)this)->GetValue(index); + case Integer16Property: + return ((MP4Integer16Property*)this)->GetValue(index); + case Integer24Property: + return ((MP4Integer24Property*)this)->GetValue(index); + case Integer32Property: + return ((MP4Integer32Property*)this)->GetValue(index); + case Integer64Property: + return ((MP4Integer64Property*)this)->GetValue(index); + default: + ASSERT(FALSE); + } + return (0); +} + +void MP4IntegerProperty::SetValue(u_int64_t value, u_int32_t index) +{ + switch (this->GetType()) { + case Integer8Property: + ((MP4Integer8Property*)this)->SetValue(value, index); + break; + case Integer16Property: + ((MP4Integer16Property*)this)->SetValue(value, index); + break; + case Integer24Property: + ((MP4Integer24Property*)this)->SetValue(value, index); + break; + case Integer32Property: + ((MP4Integer32Property*)this)->SetValue(value, index); + break; + case Integer64Property: + ((MP4Integer64Property*)this)->SetValue(value, index); + break; + default: + ASSERT(FALSE); + } +} + +void MP4IntegerProperty::InsertValue(u_int64_t value, u_int32_t index) +{ + switch (this->GetType()) { + case Integer8Property: + ((MP4Integer8Property*)this)->InsertValue(value, index); + break; + case Integer16Property: + ((MP4Integer16Property*)this)->InsertValue(value, index); + break; + case Integer24Property: + ((MP4Integer24Property*)this)->InsertValue(value, index); + break; + case Integer32Property: + ((MP4Integer32Property*)this)->InsertValue(value, index); + break; + case Integer64Property: + ((MP4Integer64Property*)this)->InsertValue(value, index); + break; + default: + ASSERT(FALSE); + } +} + +void MP4IntegerProperty::DeleteValue(u_int32_t index) +{ + switch (this->GetType()) { + case Integer8Property: + ((MP4Integer8Property*)this)->DeleteValue(index); + break; + case Integer16Property: + ((MP4Integer16Property*)this)->DeleteValue(index); + break; + case Integer24Property: + ((MP4Integer24Property*)this)->DeleteValue(index); + break; + case Integer32Property: + ((MP4Integer32Property*)this)->DeleteValue(index); + break; + case Integer64Property: + ((MP4Integer64Property*)this)->DeleteValue(index); + break; + default: + ASSERT(FALSE); + } +} + +void MP4IntegerProperty::IncrementValue(int32_t increment, u_int32_t index) +{ + SetValue(GetValue() + increment); +} + +void MP4Integer8Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = %u (0x%02x)\n", + m_name, m_values[index], m_values[index]); +} + +void MP4Integer16Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = %u (0x%04x)\n", + m_name, m_values[index], m_values[index]); +} + +void MP4Integer24Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = %u (0x%06x)\n", + m_name, m_values[index], m_values[index]); +} + +void MP4Integer32Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = %u (0x%08x)\n", + m_name, m_values[index], m_values[index]); +} + +void MP4Integer64Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, +#ifdef _WIN32 + "%s = "LLU" (0x%016I64x)\n", +#else + "%s = "LLU" (0x%016llx)\n", +#endif + m_name, m_values[index], m_values[index]); +} + +// MP4BitfieldProperty + +void MP4BitfieldProperty::Read(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + m_values[index] = pFile->ReadBits(m_numBits); +} + +void MP4BitfieldProperty::Write(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + pFile->WriteBits(m_values[index], m_numBits); +} + +void MP4BitfieldProperty::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + + u_int8_t hexWidth = m_numBits / 4; + if (hexWidth == 0 || (m_numBits % 4)) { + hexWidth++; + } + fprintf(pFile, +#ifdef _WIN32 + "%s = "LLU" (0x%0*I64x) <%u bits>\n", +#else + "%s = "LLU" (0x%0*llx) <%u bits>\n", +#endif + m_name, m_values[index], (int)hexWidth, m_values[index], m_numBits); +} + +// MP4Float32Property + +void MP4Float32Property::Read(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + if (m_useFixed16Format) { + m_values[index] = pFile->ReadFixed16(); + } else if (m_useFixed32Format) { + m_values[index] = pFile->ReadFixed32(); + } else { + m_values[index] = pFile->ReadFloat(); + } +} + +void MP4Float32Property::Write(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + if (m_useFixed16Format) { + pFile->WriteFixed16(m_values[index]); + } else if (m_useFixed32Format) { + pFile->WriteFixed32(m_values[index]); + } else { + pFile->WriteFloat(m_values[index]); + } +} + +void MP4Float32Property::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = %f\n", + m_name, m_values[index]); +} + +// MP4StringProperty + +MP4StringProperty::MP4StringProperty(char* name, + bool useCountedFormat, bool useUnicode) + : MP4Property(name) +{ + SetCount(1); + m_values[0] = NULL; + m_useCountedFormat = useCountedFormat; + m_useExpandedCount = false; + m_useUnicode = useUnicode; + m_fixedLength = 0; // length not fixed +} + +MP4StringProperty::~MP4StringProperty() +{ + u_int32_t count = GetCount(); + for (u_int32_t i = 0; i < count; i++) { + MP4Free(m_values[i]); + } +} + +void MP4StringProperty::SetCount(u_int32_t count) +{ + u_int32_t oldCount = m_values.Size(); + + m_values.Resize(count); + + for (u_int32_t i = oldCount; i < count; i++) { + m_values[i] = NULL; + } +} + +void MP4StringProperty::SetValue(const char* value, u_int32_t index) +{ + if (m_readOnly) { + throw new MP4Error(EACCES, "property is read-only", m_name); + } + + MP4Free(m_values[index]); + + if (m_fixedLength) { + m_values[index] = (char*)MP4Calloc(m_fixedLength + 1); + if (value) { + strncpy(m_values[index], value, m_fixedLength); + } + } else { + if (value) { + m_values[index] = MP4Stralloc(value); + } else { + m_values[index] = NULL; + } + } +} + +void MP4StringProperty::Read(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + if (m_useCountedFormat) { + m_values[index] = pFile->ReadCountedString( + (m_useUnicode ? 2 : 1), m_useExpandedCount); + } else if (m_fixedLength) { + MP4Free(m_values[index]); + m_values[index] = (char*)MP4Calloc(m_fixedLength + 1); + pFile->ReadBytes((u_int8_t*)m_values[index], m_fixedLength); + } else { + m_values[index] = pFile->ReadString(); + } +} + +void MP4StringProperty::Write(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + if (m_useCountedFormat) { + pFile->WriteCountedString(m_values[index], + (m_useUnicode ? 2 : 1), m_useExpandedCount); + } else if (m_fixedLength) { + pFile->WriteBytes((u_int8_t*)m_values[index], m_fixedLength); + } else { + pFile->WriteString(m_values[index]); + } +} + +void MP4StringProperty::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + if (m_useUnicode) { + fprintf(pFile, "%s = %ls\n", m_name, (wchar_t*)m_values[index]); + } else { + fprintf(pFile, "%s = %s\n", m_name, m_values[index]); + } +} + +// MP4BytesProperty + +MP4BytesProperty::MP4BytesProperty(char* name, u_int32_t valueSize) + : MP4Property(name) +{ + SetCount(1); + m_values[0] = (u_int8_t*)MP4Calloc(valueSize); + m_valueSizes[0] = valueSize; + m_fixedValueSize = 0; +} + +MP4BytesProperty::~MP4BytesProperty() +{ + u_int32_t count = GetCount(); + for (u_int32_t i = 0; i < count; i++) { + MP4Free(m_values[i]); + } +} + +void MP4BytesProperty::SetCount(u_int32_t count) +{ + u_int32_t oldCount = m_values.Size(); + + m_values.Resize(count); + m_valueSizes.Resize(count); + + for (u_int32_t i = oldCount; i < count; i++) { + m_values[i] = NULL; + m_valueSizes[i] = 0; + } +} + +void MP4BytesProperty::SetValue(const u_int8_t* pValue, u_int32_t valueSize, + u_int32_t index) +{ + if (m_readOnly) { + throw new MP4Error(EACCES, "property is read-only", m_name); + } + if (m_fixedValueSize) { + if (valueSize > m_fixedValueSize) { + throw new MP4Error("value size exceeds fixed value size", + "MP4BytesProperty::SetValue"); + } + if (m_values[index] == NULL) { + m_values[index] = (u_int8_t*)MP4Calloc(m_fixedValueSize); + m_valueSizes[index] = m_fixedValueSize; + } + if (pValue) { + memcpy(m_values[index], pValue, valueSize); + } + } else { + MP4Free(m_values[index]); + if (pValue) { + m_values[index] = (u_int8_t*)MP4Malloc(valueSize); + memcpy(m_values[index], pValue, valueSize); + m_valueSizes[index] = valueSize; + } else { + m_values[index] = NULL; + m_valueSizes[index] = 0; + } + } +} + +void MP4BytesProperty::SetValueSize(u_int32_t valueSize, u_int32_t index) +{ + if (m_fixedValueSize) { + throw new MP4Error("can't change size of fixed sized property", + "MP4BytesProperty::SetValueSize"); + } + if (m_values[index] != NULL) { + m_values[index] = (u_int8_t*)MP4Realloc(m_values[index], valueSize); + } + m_valueSizes[index] = valueSize; +} + +void MP4BytesProperty::SetFixedSize(u_int32_t fixedSize) +{ + m_fixedValueSize = 0; + for (u_int32_t i = 0; i < GetCount(); i++) { + SetValueSize(fixedSize, i); + } + m_fixedValueSize = fixedSize; +} + +void MP4BytesProperty::Read(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + MP4Free(m_values[index]); + m_values[index] = (u_int8_t*)MP4Malloc(m_valueSizes[index]); + pFile->ReadBytes(m_values[index], m_valueSizes[index]); +} + +void MP4BytesProperty::Write(MP4File* pFile, u_int32_t index) +{ + if (m_implicit) { + return; + } + pFile->WriteBytes(m_values[index], m_valueSizes[index]); +} + +void MP4BytesProperty::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + if (m_implicit && !dumpImplicits) { + return; + } + Indent(pFile, indent); + fprintf(pFile, "%s = <%u bytes> ", m_name, m_valueSizes[index]); + for (u_int32_t i = 0; i < m_valueSizes[index]; i++) { + if ((i % 16) == 0 && m_valueSizes[index] > 16) { + fprintf(pFile, "\n"); + Indent(pFile, indent); + } + fprintf(pFile, "%02x ", m_values[index][i]); + } + fprintf(pFile, "\n"); +} + +// MP4TableProperty + +MP4TableProperty::MP4TableProperty(char* name, MP4Property* pCountProperty) + : MP4Property(name) +{ + ASSERT(pCountProperty->GetType() == Integer8Property + || pCountProperty->GetType() == Integer32Property); + m_pCountProperty = pCountProperty; + m_pCountProperty->SetReadOnly(); +} + +MP4TableProperty::~MP4TableProperty() +{ + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + delete m_pProperties[i]; + } +} + +void MP4TableProperty::AddProperty(MP4Property* pProperty) +{ + ASSERT(pProperty); + ASSERT(pProperty->GetType() != TableProperty); + ASSERT(pProperty->GetType() != DescriptorProperty); + m_pProperties.Add(pProperty); + pProperty->SetParentAtom(m_pParentAtom); + pProperty->SetCount(0); +} + +bool MP4TableProperty::FindProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + ASSERT(m_name); + + // check if first component of name matches ourselves + if (!MP4NameFirstMatches(m_name, name)) { + return false; + } + + // check if the specified table entry exists + u_int32_t index; + bool haveIndex = MP4NameFirstIndex(name, &index); + if (haveIndex) { + if (index >= GetCount()) { + return false; + } + if (pIndex) { + *pIndex = index; + } + } + + VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), + printf("FindProperty: matched %s\n", name)); + + // get name of table property + const char *tablePropName = MP4NameAfterFirst(name); + if (tablePropName == NULL) { + if (!haveIndex) { + *ppProperty = this; + return true; + } + return false; + } + + // check if this table property exists + return FindContainedProperty(tablePropName, ppProperty, pIndex); +} + +bool MP4TableProperty::FindContainedProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + u_int32_t numProperties = m_pProperties.Size(); + + for (u_int32_t i = 0; i < numProperties; i++) { + if (m_pProperties[i]->FindProperty(name, ppProperty, pIndex)) { + return true; + } + } + return false; +} + +void MP4TableProperty::Read(MP4File* pFile, u_int32_t index) +{ + ASSERT(index == 0); + + if (m_implicit) { + return; + } + + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + + u_int32_t numEntries = GetCount(); + + /* for each property set size */ + for (u_int32_t j = 0; j < numProperties; j++) { + m_pProperties[j]->SetCount(numEntries); + } + + for (u_int32_t i = 0; i < numEntries; i++) { + ReadEntry(pFile, i); + } +} + +void MP4TableProperty::ReadEntry(MP4File* pFile, u_int32_t index) +{ + for (u_int32_t j = 0; j < m_pProperties.Size(); j++) { + m_pProperties[j]->Read(pFile, index); + } +} + +void MP4TableProperty::Write(MP4File* pFile, u_int32_t index) +{ + ASSERT(index == 0); + + if (m_implicit) { + return; + } + + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + + u_int32_t numEntries = GetCount(); + + ASSERT(m_pProperties[0]->GetCount() == numEntries); + + for (u_int32_t i = 0; i < numEntries; i++) { + WriteEntry(pFile, i); + } +} + +void MP4TableProperty::WriteEntry(MP4File* pFile, u_int32_t index) +{ + for (u_int32_t j = 0; j < m_pProperties.Size(); j++) { + m_pProperties[j]->Write(pFile, index); + } +} + +void MP4TableProperty::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + ASSERT(index == 0); + + // implicit tables just can't be dumped + if (m_implicit) { + return; + } + + u_int32_t numProperties = m_pProperties.Size(); + + if (numProperties == 0) { + WARNING(numProperties == 0); + return; + } + + u_int32_t numEntries = GetCount(); + + for (u_int32_t i = 0; i < numEntries; i++) { + for (u_int32_t j = 0; j < numProperties; j++) { + m_pProperties[j]->Dump(pFile, indent + 1, dumpImplicits, i); + } + } +} + +// MP4DescriptorProperty + +MP4DescriptorProperty::MP4DescriptorProperty(char* name, + u_int8_t tagsStart, u_int8_t tagsEnd, bool mandatory, bool onlyOne) + : MP4Property(name) +{ + SetTags(tagsStart, tagsEnd); + m_sizeLimit = 0; + m_mandatory = mandatory; + m_onlyOne = onlyOne; +} + +MP4DescriptorProperty::~MP4DescriptorProperty() +{ + for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { + delete m_pDescriptors[i]; + } +} + +void MP4DescriptorProperty::SetParentAtom(MP4Atom* pParentAtom) { + m_pParentAtom = pParentAtom; + for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { + m_pDescriptors[i]->SetParentAtom(pParentAtom); + } +} + +MP4Descriptor* MP4DescriptorProperty::AddDescriptor(u_int8_t tag) +{ + // check that tag is in expected range + ASSERT(tag >= m_tagsStart && tag <= m_tagsEnd); + + MP4Descriptor* pDescriptor = CreateDescriptor(tag); + ASSERT(pDescriptor); + + m_pDescriptors.Add(pDescriptor); + pDescriptor->SetParentAtom(m_pParentAtom); + + return pDescriptor; +} + +void MP4DescriptorProperty::DeleteDescriptor(u_int32_t index) +{ + delete m_pDescriptors[index]; + m_pDescriptors.Delete(index); +} + +void MP4DescriptorProperty::Generate() +{ + // generate a default descriptor + // if it is mandatory, and single + if (m_mandatory && m_onlyOne) { + MP4Descriptor* pDescriptor = + AddDescriptor(m_tagsStart); + pDescriptor->Generate(); + } +} + +bool MP4DescriptorProperty::FindProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + // we're unnamed, so just check contained properties + if (m_name == NULL || !strcmp(m_name, "")) { + return FindContainedProperty(name, ppProperty, pIndex); + } + + // check if first component of name matches ourselves + if (!MP4NameFirstMatches(m_name, name)) { + return false; + } + + // check if the specific descriptor entry exists + u_int32_t descrIndex; + bool haveDescrIndex = MP4NameFirstIndex(name, &descrIndex); + + if (haveDescrIndex && descrIndex >= GetCount()) { + return false; + } + + if (m_pParentAtom) { + VERBOSE_FIND(m_pParentAtom->GetFile()->GetVerbosity(), + printf("FindProperty: matched %s\n", name)); + } + + // get name of descriptor property + name = MP4NameAfterFirst(name); + if (name == NULL) { + if (!haveDescrIndex) { + *ppProperty = this; + return true; + } + return false; + } + + /* check rest of name */ + if (haveDescrIndex) { + return m_pDescriptors[descrIndex]->FindProperty(name, + ppProperty, pIndex); + } else { + return FindContainedProperty(name, ppProperty, pIndex); + } +} + +bool MP4DescriptorProperty::FindContainedProperty(const char *name, + MP4Property** ppProperty, u_int32_t* pIndex) +{ + for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { + if (m_pDescriptors[i]->FindProperty(name, ppProperty, pIndex)) { + return true; + } + } + return false; +} + +void MP4DescriptorProperty::Read(MP4File* pFile, u_int32_t index) +{ + ASSERT(index == 0); + + if (m_implicit) { + return; + } + + u_int64_t start = pFile->GetPosition(); + + while (true) { + // enforce size limitation + if (m_sizeLimit && pFile->GetPosition() >= start + m_sizeLimit) { + break; + } + + u_int8_t tag; + try { + pFile->PeekBytes(&tag, 1); + } + catch (MP4Error* e) { + if (pFile->GetPosition() >= pFile->GetSize()) { + // EOF + delete e; + break; + } + throw e; + } + + // check if tag is in desired range + if (tag < m_tagsStart || tag > m_tagsEnd) { + break; + } + + MP4Descriptor* pDescriptor = + AddDescriptor(tag); + + pDescriptor->Read(pFile); + } + + // warnings + if (m_mandatory && m_pDescriptors.Size() == 0) { + VERBOSE_READ(pFile->GetVerbosity(), + printf("Warning: Mandatory descriptor 0x%02x missing\n", + m_tagsStart)); + } else if (m_onlyOne && m_pDescriptors.Size() > 1) { + VERBOSE_READ(pFile->GetVerbosity(), + printf("Warning: Descriptor 0x%02x has more than one instance\n", + m_tagsStart)); + } +} + +void MP4DescriptorProperty::Write(MP4File* pFile, u_int32_t index) +{ + ASSERT(index == 0); + + if (m_implicit) { + return; + } + + for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { + m_pDescriptors[i]->Write(pFile); + } +} + +void MP4DescriptorProperty::Dump(FILE* pFile, u_int8_t indent, + bool dumpImplicits, u_int32_t index) +{ + ASSERT(index == 0); + + if (m_implicit && !dumpImplicits) { + return; + } + + if (m_name) { + Indent(pFile, indent); + fprintf(pFile, "%s\n", m_name); + indent++; + } + + for (u_int32_t i = 0; i < m_pDescriptors.Size(); i++) { + m_pDescriptors[i]->Dump(pFile, indent, dumpImplicits); + } +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4util.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4util.h @@ -0,0 +1,235 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_UTIL_INCLUDED__ +#define __MP4_UTIL_INCLUDED__ +#include + +#ifndef ASSERT +#ifdef NDEBUG +#define ASSERT(expr) +#else +#define ASSERT(expr) \ + if (!(expr)) { \ + fflush(stdout); \ + assert((expr)); \ + } +#endif +#endif +#ifdef NDEBUG +#define WARNING(expr) +#else +#define WARNING(expr) \ + if (expr) { \ + fflush(stdout); \ + fprintf(stderr, "Warning (%s) in %s at line %u\n", \ + __STRING(expr), __FILE__, __LINE__); \ + } +#endif + +#define VERBOSE(exprverbosity, verbosity, expr) \ + if (((exprverbosity) & (verbosity)) == (exprverbosity)) { expr; } + +#define VERBOSE_ERROR(verbosity, expr) \ + VERBOSE(MP4_DETAILS_ERROR, verbosity, expr) + +#define VERBOSE_WARNING(verbosity, expr) \ + VERBOSE(MP4_DETAILS_WARNING, verbosity, expr) + +#define VERBOSE_READ(verbosity, expr) \ + VERBOSE(MP4_DETAILS_READ, verbosity, expr) + +#define VERBOSE_READ_TABLE(verbosity, expr) \ + VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_TABLE), verbosity, expr) + +#define VERBOSE_READ_SAMPLE(verbosity, expr) \ + VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_SAMPLE), verbosity, expr) + +#define VERBOSE_READ_HINT(verbosity, expr) \ + VERBOSE((MP4_DETAILS_READ | MP4_DETAILS_HINT), verbosity, expr) + +#define VERBOSE_WRITE(verbosity, expr) \ + VERBOSE(MP4_DETAILS_WRITE, verbosity, expr) + +#define VERBOSE_WRITE_TABLE(verbosity, expr) \ + VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_TABLE), verbosity, expr) + +#define VERBOSE_WRITE_SAMPLE(verbosity, expr) \ + VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_SAMPLE), verbosity, expr) + +#define VERBOSE_WRITE_HINT(verbosity, expr) \ + VERBOSE((MP4_DETAILS_WRITE | MP4_DETAILS_HINT), verbosity, expr) + +#define VERBOSE_FIND(verbosity, expr) \ + VERBOSE(MP4_DETAILS_FIND, verbosity, expr) + +#define VERBOSE_ISMA(verbosity, expr) \ + VERBOSE(MP4_DETAILS_ISMA, verbosity, expr) + +#define VERBOSE_EDIT(verbosity, expr) \ + VERBOSE(MP4_DETAILS_EDIT, verbosity, expr) + +inline void Indent(FILE* pFile, u_int8_t depth) { + fprintf(pFile, "%*c", depth, ' '); +} + +inline void MP4Printf(const char* fmt, ...) { + va_list ap; + va_start(ap, fmt); + // TBD API call to set error_msg_func instead of just printf + fprintf(stdout, fmt, ap); + va_end(ap); +} + +class MP4Error { +public: + MP4Error() { + m_errno = 0; + m_errstring = NULL; + m_where = NULL; + m_free = 0; + } + ~MP4Error() { + if (m_free != 0) { + free((void *)m_errstring); + } + } + MP4Error(int err, const char* where = NULL) { + m_errno = err; + m_errstring = NULL; + m_where = where; + m_free = 0; + } + MP4Error(const char *format, const char *where, ...) { + char *string; + m_errno = 0; + string = (char *)malloc(512); + m_where = where; + if (string) { + va_list ap; + va_start(ap, where); + vsnprintf(string, 512, format, ap); + va_end(ap); + m_errstring = string; + m_free = 1; + } else { + m_errstring = format; + m_free = 0; + } + } + MP4Error(int err, const char* format, const char* where, ...) { + char *string; + m_errno = err; + string = (char *)malloc(512); + m_where = where; + if (string) { + va_list ap; + va_start(ap, where); + vsnprintf(string, 512, format, ap); + va_end(ap); + m_errstring = string; + m_free = 1; + } else { + m_errstring = format; + m_free = 0; + } + } + + void Print(FILE* pFile = stderr); + int m_free; + int m_errno; + const char* m_errstring; + const char* m_where; +}; + +void MP4HexDump( + u_int8_t* pBytes, u_int32_t numBytes, + FILE* pFile = stdout, u_int8_t indent = 0); + +inline void* MP4Malloc(size_t size) { + void* p = malloc(size); + if (p == NULL && size > 0) { + throw new MP4Error(errno); + } + return p; +} + +inline void* MP4Calloc(size_t size) { + return memset(MP4Malloc(size), 0, size); +} + +inline char* MP4Stralloc(const char* s1) { + char* s2 = (char*)MP4Malloc(strlen(s1) + 1); + strcpy(s2, s1); + return s2; +} + +inline void* MP4Realloc(void* p, u_int32_t newSize) { + // workaround library bug + if (p == NULL && newSize == 0) { + return NULL; + } + p = realloc(p, newSize); + if (p == NULL && newSize > 0) { + throw new MP4Error(errno); + } + return p; +} + +inline void MP4Free(void* p) { + free(p); +} + +inline u_int32_t STRTOINT32(const char* s) { + return (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; +} + +inline void INT32TOSTR(u_int32_t i, char* s) { + s[0] = ((i >> 24) & 0xFF); s[1] = ((i >> 16) & 0xFF); + s[2] = ((i >> 8) & 0xFF); s[3] = (i & 0xFF); s[4] = 0; +} + +inline MP4Timestamp MP4GetAbsTimestamp() { + struct timeval tv; + gettimeofday(&tv, NULL); + MP4Timestamp ret; + ret = tv.tv_sec; + ret += 2082844800; + return ret; // MP4 start date is 1/1/1904 + // 208284480 is (((1970 - 1904) * 365) + 17) * 24 * 60 * 60 +} + +u_int64_t MP4ConvertTime(u_int64_t t, + u_int32_t oldTimeScale, u_int32_t newTimeScale); + +bool MP4NameFirstMatches(const char* s1, const char* s2); + +bool MP4NameFirstIndex(const char* s, u_int32_t* pIndex); + +char* MP4NameFirst(const char *s); + +const char* MP4NameAfterFirst(const char *s); + +char* MP4ToBase16(const u_int8_t* pData, u_int32_t dataSize); + +char* MP4ToBase64(const u_int8_t* pData, u_int32_t dataSize); + +#endif /* __MP4_UTIL_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mdia.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mdia.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MdiaAtom::MP4MdiaAtom() + : MP4Atom("mdia") +{ + ExpectChildAtom("mdhd", Required, OnlyOne); + ExpectChildAtom("hdlr", Required, OnlyOne); + ExpectChildAtom("minf", Required, OnlyOne); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_schm.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_schm.cpp @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Alix Marchandise-Franquet alix@cisco.com + * + * Add the SchemeTypeBox for ISMACrypt + */ + +#include "mp4common.h" + +MP4SchmAtom::MP4SchmAtom() + : MP4Atom("schm") +{ + AddVersionAndFlags(); /* 0, 1 */ + AddProperty( /* 2 */ + new MP4Integer32Property("scheme_type")); + AddProperty( /* 3 */ + new MP4Integer32Property("scheme_version")); + // browser URI if flags set, TODO +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_snro.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_snro.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4SnroAtom::MP4SnroAtom() + : MP4Atom("snro") +{ + AddProperty( + new MP4Integer32Property("offset")); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_iods.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_iods.cpp @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4IodsAtom::MP4IodsAtom() + : MP4Atom("iods") +{ + AddVersionAndFlags(); + AddProperty( + new MP4DescriptorProperty(NULL, + MP4FileIODescrTag, MP4FileODescrTag, Required, OnlyOne)); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stco.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stco.cpp @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StcoAtom::MP4StcoAtom() + : MP4Atom("stco") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("chunkOffset")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4track.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4track.cpp @@ -0,0 +1,1637 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +MP4Track::MP4Track(MP4File* pFile, MP4Atom* pTrakAtom) +{ + m_pFile = pFile; + m_pTrakAtom = pTrakAtom; + + m_lastStsdIndex = 0; + m_lastSampleFile = NULL; + + m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID; + m_pCachedReadSample = NULL; + m_cachedReadSampleSize = 0; + + m_writeSampleId = 1; + m_fixedSampleDuration = 0; + m_pChunkBuffer = NULL; + m_chunkBufferSize = 0; + m_chunkSamples = 0; + m_chunkDuration = 0; + + m_samplesPerChunk = 0; + m_durationPerChunk = 0; + + bool success = true; + + MP4Integer32Property* pTrackIdProperty; + success &= m_pTrakAtom->FindProperty( + "trak.tkhd.trackId", + (MP4Property**)&pTrackIdProperty); + if (success) { + m_trackId = pTrackIdProperty->GetValue(); + } + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.mdhd.timeScale", + (MP4Property**)&m_pTimeScaleProperty); + if (success) { + // default chunking is 1 second of samples + m_durationPerChunk = m_pTimeScaleProperty->GetValue(); + } + + success &= m_pTrakAtom->FindProperty( + "trak.tkhd.duration", + (MP4Property**)&m_pTrackDurationProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.mdhd.duration", + (MP4Property**)&m_pMediaDurationProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.tkhd.modificationTime", + (MP4Property**)&m_pTrackModificationProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.mdhd.modificationTime", + (MP4Property**)&m_pMediaModificationProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.hdlr.handlerType", + (MP4Property**)&m_pTypeProperty); + + // get handles on sample size information + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsz.sampleSize", + (MP4Property**)&m_pStszFixedSampleSizeProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsz.sampleCount", + (MP4Property**)&m_pStszSampleCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsz.entries.sampleSize", + (MP4Property**)&m_pStszSampleSizeProperty); + + // get handles on information needed to map sample id's to file offsets + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsc.entryCount", + (MP4Property**)&m_pStscCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsc.entries.firstChunk", + (MP4Property**)&m_pStscFirstChunkProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsc.entries.samplesPerChunk", + (MP4Property**)&m_pStscSamplesPerChunkProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsc.entries.sampleDescriptionIndex", + (MP4Property**)&m_pStscSampleDescrIndexProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsc.entries.firstSample", + (MP4Property**)&m_pStscFirstSampleProperty); + + bool haveStco = m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stco.entryCount", + (MP4Property**)&m_pChunkCountProperty); + + if (haveStco) { + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stco.entries.chunkOffset", + (MP4Property**)&m_pChunkOffsetProperty); + } else { + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.co64.entryCount", + (MP4Property**)&m_pChunkCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.co64.entries.chunkOffset", + (MP4Property**)&m_pChunkOffsetProperty); + } + + // get handles on sample timing info + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stts.entryCount", + (MP4Property**)&m_pSttsCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stts.entries.sampleCount", + (MP4Property**)&m_pSttsSampleCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stts.entries.sampleDelta", + (MP4Property**)&m_pSttsSampleDeltaProperty); + + // get handles on rendering offset info if it exists + + m_pCttsCountProperty = NULL; + m_pCttsSampleCountProperty = NULL; + m_pCttsSampleOffsetProperty = NULL; + + bool haveCtts = m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.ctts.entryCount", + (MP4Property**)&m_pCttsCountProperty); + + if (haveCtts) { + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.ctts.entries.sampleCount", + (MP4Property**)&m_pCttsSampleCountProperty); + + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.ctts.entries.sampleOffset", + (MP4Property**)&m_pCttsSampleOffsetProperty); + } + + // get handles on sync sample info if it exists + + m_pStssCountProperty = NULL; + m_pStssSampleProperty = NULL; + + bool haveStss = m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stss.entryCount", + (MP4Property**)&m_pStssCountProperty); + + if (haveStss) { + success &= m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stss.entries.sampleNumber", + (MP4Property**)&m_pStssSampleProperty); + } + + // edit list + InitEditListProperties(); + + // was everything found? + if (!success) { + throw new MP4Error("invalid track", "MP4Track::MP4Track"); + } +} + +MP4Track::~MP4Track() +{ + MP4Free(m_pCachedReadSample); + MP4Free(m_pChunkBuffer); +} + +const char* MP4Track::GetType() +{ + return m_pTypeProperty->GetValue(); +} + +void MP4Track::SetType(const char* type) +{ + m_pTypeProperty->SetValue(NormalizeTrackType(type)); +} + +void MP4Track::ReadSample( + MP4SampleId sampleId, + u_int8_t** ppBytes, + u_int32_t* pNumBytes, + MP4Timestamp* pStartTime, + MP4Duration* pDuration, + MP4Duration* pRenderingOffset, + bool* pIsSyncSample) +{ + if (sampleId == MP4_INVALID_SAMPLE_ID) { + throw new MP4Error("sample id can't be zero", + "MP4Track::ReadSample"); + } + + // handle unusual case of wanting to read a sample + // that is still sitting in the write chunk buffer + if (m_pChunkBuffer && sampleId >= m_writeSampleId - m_chunkSamples) { + WriteChunkBuffer(); + } + + FILE* pFile = GetSampleFile(sampleId); + + if (pFile == (FILE*)-1) { + throw new MP4Error("sample is located in an inaccessible file", + "MP4Track::ReadSample"); + } + + u_int64_t fileOffset = GetSampleFileOffset(sampleId); + + u_int32_t sampleSize = GetSampleSize(sampleId); + if (*ppBytes != NULL && *pNumBytes < sampleSize) { + throw new MP4Error("sample buffer is too small", + "MP4Track::ReadSample"); + } + *pNumBytes = sampleSize; + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("ReadSample: track %u id %u offset 0x"LLX" size %u (0x%x)\n", + m_trackId, sampleId, fileOffset, *pNumBytes, *pNumBytes)); + + bool bufferMalloc = false; + if (*ppBytes == NULL) { + *ppBytes = (u_int8_t*)MP4Malloc(*pNumBytes); + bufferMalloc = true; + } + + u_int64_t oldPos = m_pFile->GetPosition(pFile); // only used in mode == 'w' + try { + m_pFile->SetPosition(fileOffset, pFile); + m_pFile->ReadBytes(*ppBytes, *pNumBytes, pFile); + + if (pStartTime || pDuration) { + GetSampleTimes(sampleId, pStartTime, pDuration); + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("ReadSample: start "LLU" duration "LLD"\n", + (pStartTime ? *pStartTime : 0), + (pDuration ? *pDuration : 0))); + } + if (pRenderingOffset) { + *pRenderingOffset = GetSampleRenderingOffset(sampleId); + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("ReadSample: renderingOffset "LLD"\n", + *pRenderingOffset)); + } + if (pIsSyncSample) { + *pIsSyncSample = IsSyncSample(sampleId); + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("ReadSample: isSyncSample %u\n", + *pIsSyncSample)); + } + } + + catch (MP4Error* e) { + if (bufferMalloc) { + // let's not leak memory + MP4Free(*ppBytes); + *ppBytes = NULL; + } + if (m_pFile->GetMode() == 'w') { + m_pFile->SetPosition(oldPos, pFile); + } + throw e; + } + + if (m_pFile->GetMode() == 'w') { + m_pFile->SetPosition(oldPos, pFile); + } +} + +void MP4Track::ReadSampleFragment( + MP4SampleId sampleId, + u_int32_t sampleOffset, + u_int16_t sampleLength, + u_int8_t* pDest) +{ + if (sampleId == MP4_INVALID_SAMPLE_ID) { + throw new MP4Error("invalid sample id", + "MP4Track::ReadSampleFragment"); + } + + if (sampleId != m_cachedReadSampleId) { + MP4Free(m_pCachedReadSample); + m_pCachedReadSample = NULL; + m_cachedReadSampleSize = 0; + m_cachedReadSampleId = MP4_INVALID_SAMPLE_ID; + + ReadSample( + sampleId, + &m_pCachedReadSample, + &m_cachedReadSampleSize); + + m_cachedReadSampleId = sampleId; + } + + if (sampleOffset + sampleLength > m_cachedReadSampleSize) { + throw new MP4Error("offset and/or length are too large", + "MP4Track::ReadSampleFragment"); + } + + memcpy(pDest, &m_pCachedReadSample[sampleOffset], sampleLength); +} + +void MP4Track::WriteSample( + const u_int8_t* pBytes, + u_int32_t numBytes, + MP4Duration duration, + MP4Duration renderingOffset, + bool isSyncSample) +{ + VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), + printf("WriteSample: track %u id %u size %u (0x%x) ", + m_trackId, m_writeSampleId, numBytes, numBytes)); + + if (pBytes == NULL && numBytes > 0) { + throw new MP4Error("no sample data", "MP4WriteSample"); + } + + if (duration == MP4_INVALID_DURATION) { + duration = GetFixedSampleDuration(); + } + + VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), + printf("duration "LLU"\n", duration)); + + // append sample bytes to chunk buffer + m_pChunkBuffer = (u_int8_t*)MP4Realloc(m_pChunkBuffer, + m_chunkBufferSize + numBytes); + memcpy(&m_pChunkBuffer[m_chunkBufferSize], pBytes, numBytes); + m_chunkBufferSize += numBytes; + m_chunkSamples++; + m_chunkDuration += duration; + + UpdateSampleSizes(m_writeSampleId, numBytes); + + UpdateSampleTimes(duration); + + UpdateRenderingOffsets(m_writeSampleId, renderingOffset); + + UpdateSyncSamples(m_writeSampleId, isSyncSample); + + if (IsChunkFull(m_writeSampleId)) { + WriteChunkBuffer(); + } + + UpdateDurations(duration); + + UpdateModificationTimes(); + + m_writeSampleId++; +} + +void MP4Track::WriteChunkBuffer() +{ + if (m_chunkBufferSize == 0) { + return; + } + + u_int64_t chunkOffset = m_pFile->GetPosition(); + + // write chunk buffer + m_pFile->WriteBytes(m_pChunkBuffer, m_chunkBufferSize); + + VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), + printf("WriteChunk: track %u offset 0x"LLX" size %u (0x%x) numSamples %u\n", + m_trackId, chunkOffset, m_chunkBufferSize, + m_chunkBufferSize, m_chunkSamples)); + + UpdateSampleToChunk(m_writeSampleId, + m_pChunkCountProperty->GetValue() + 1, + m_chunkSamples); + + UpdateChunkOffsets(chunkOffset); + + // clean up chunk buffer + MP4Free(m_pChunkBuffer); + m_pChunkBuffer = NULL; + m_chunkBufferSize = 0; + m_chunkSamples = 0; + m_chunkDuration = 0; +} + +void MP4Track::FinishWrite() +{ + // write out any remaining samples in chunk buffer + WriteChunkBuffer(); + + // record buffer size and bitrates + MP4BitfieldProperty* pBufferSizeProperty; + + if (m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.bufferSizeDB", + (MP4Property**)&pBufferSizeProperty)) { + pBufferSizeProperty->SetValue(GetMaxSampleSize()); + } + + MP4Integer32Property* pBitrateProperty; + + if (m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.maxBitrate", + (MP4Property**)&pBitrateProperty)) { + pBitrateProperty->SetValue(GetMaxBitrate()); + } + + if (m_pTrakAtom->FindProperty( + "trak.mdia.minf.stbl.stsd.*.esds.decConfigDescr.avgBitrate", + (MP4Property**)&pBitrateProperty)) { + pBitrateProperty->SetValue(GetAvgBitrate()); + } +} + +bool MP4Track::IsChunkFull(MP4SampleId sampleId) +{ + if (m_samplesPerChunk) { + return m_chunkSamples >= m_samplesPerChunk; + } + + ASSERT(m_durationPerChunk); + return m_chunkDuration >= m_durationPerChunk; +} + +u_int32_t MP4Track::GetNumberOfSamples() +{ + return m_pStszSampleCountProperty->GetValue(); +} + +u_int32_t MP4Track::GetSampleSize(MP4SampleId sampleId) +{ + u_int32_t fixedSampleSize = + m_pStszFixedSampleSizeProperty->GetValue(); + + if (fixedSampleSize != 0) { + return fixedSampleSize; + } + return m_pStszSampleSizeProperty->GetValue(sampleId - 1); +} + +u_int32_t MP4Track::GetMaxSampleSize() +{ + u_int32_t fixedSampleSize = + m_pStszFixedSampleSizeProperty->GetValue(); + + if (fixedSampleSize != 0) { + return fixedSampleSize; + } + + u_int32_t maxSampleSize = 0; + u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount(); + for (MP4SampleId sid = 1; sid <= numSamples; sid++) { + u_int32_t sampleSize = + m_pStszSampleSizeProperty->GetValue(sid - 1); + if (sampleSize > maxSampleSize) { + maxSampleSize = sampleSize; + } + } + return maxSampleSize; +} + +u_int64_t MP4Track::GetTotalOfSampleSizes() +{ + u_int32_t fixedSampleSize = + m_pStszFixedSampleSizeProperty->GetValue(); + + // if fixed sample size, just need to multiply by number of samples + if (fixedSampleSize != 0) { + return fixedSampleSize * GetNumberOfSamples(); + } + + // else non-fixed sample size, sum them + u_int64_t totalSampleSizes = 0; + u_int32_t numSamples = m_pStszSampleSizeProperty->GetCount(); + for (MP4SampleId sid = 1; sid <= numSamples; sid++) { + u_int32_t sampleSize = + m_pStszSampleSizeProperty->GetValue(sid - 1); + totalSampleSizes += sampleSize; + } + return totalSampleSizes; +} + +void MP4Track::UpdateSampleSizes(MP4SampleId sampleId, u_int32_t numBytes) +{ + // for first sample + if (sampleId == 1) { + if (numBytes > 0) { + // presume sample size is fixed + m_pStszFixedSampleSizeProperty->SetValue(numBytes); + } else { + // special case of first sample is zero bytes in length + // leave m_pStszFixedSampleSizeProperty at 0 + // start recording variable sample sizes + m_pStszSampleSizeProperty->AddValue(0); + } + + } else { // sampleId > 1 + u_int32_t fixedSampleSize = + m_pStszFixedSampleSizeProperty->GetValue(); + + if (fixedSampleSize == 0 || numBytes != fixedSampleSize) { + // sample size is not fixed + + if (fixedSampleSize) { + // need to clear fixed sample size + m_pStszFixedSampleSizeProperty->SetValue(0); + + // and create sizes for all previous samples + for (MP4SampleId sid = 1; sid < sampleId; sid++) { + m_pStszSampleSizeProperty->AddValue(fixedSampleSize); + } + } + + // add size value for this sample + m_pStszSampleSizeProperty->AddValue(numBytes); + } + } + + m_pStszSampleCountProperty->IncrementValue(); +} + +u_int32_t MP4Track::GetAvgBitrate() +{ + if (GetDuration() == 0) { + return 0; + } + + u_int64_t durationSecs = + MP4ConvertTime(GetDuration(), GetTimeScale(), MP4_SECS_TIME_SCALE); + + if (GetDuration() % GetTimeScale() != 0) { + durationSecs++; + } + + return (GetTotalOfSampleSizes() * 8) / durationSecs; +} + +u_int32_t MP4Track::GetMaxBitrate() +{ + u_int32_t timeScale = GetTimeScale(); + MP4SampleId numSamples = GetNumberOfSamples(); + u_int32_t maxBytesPerSec = 0; + u_int32_t bytesThisSec = 0; + MP4Timestamp thisSec = 0; + + for (MP4SampleId sid = 1; sid <= numSamples; sid++) { + u_int32_t sampleSize; + MP4Timestamp sampleTime; + + sampleSize = GetSampleSize(sid); + + GetSampleTimes(sid, &sampleTime, NULL); + + // sample counts for current second + if (sampleTime < thisSec + timeScale) { + bytesThisSec += sampleSize; + } else { // sample is in a future second + if (bytesThisSec > maxBytesPerSec) { + maxBytesPerSec = bytesThisSec; + } + + thisSec = sampleTime - (sampleTime % timeScale); + bytesThisSec = sampleSize; + } + } + + // last second (or partial second) + if (bytesThisSec > maxBytesPerSec) { + maxBytesPerSec = bytesThisSec; + } + + return maxBytesPerSec * 8; +} + +u_int32_t MP4Track::GetSampleStscIndex(MP4SampleId sampleId) +{ + u_int32_t stscIndex; + u_int32_t numStscs = m_pStscCountProperty->GetValue(); + + if (numStscs == 0) { + throw new MP4Error("No data chunks exist", "GetSampleStscIndex"); + } + + for (stscIndex = 0; stscIndex < numStscs; stscIndex++) { + if (sampleId < m_pStscFirstSampleProperty->GetValue(stscIndex)) { + ASSERT(stscIndex != 0); + stscIndex -= 1; + break; + } + } + if (stscIndex == numStscs) { + ASSERT(stscIndex != 0); + stscIndex -= 1; + } + + return stscIndex; +} + +FILE* MP4Track::GetSampleFile(MP4SampleId sampleId) +{ + u_int32_t stscIndex = + GetSampleStscIndex(sampleId); + + u_int32_t stsdIndex = + m_pStscSampleDescrIndexProperty->GetValue(stscIndex); + + // check if the answer will be the same as last time + if (m_lastStsdIndex && stsdIndex == m_lastStsdIndex) { + return m_lastSampleFile; + } + + MP4Atom* pStsdAtom = + m_pTrakAtom->FindAtom("trak.mdia.minf.stbl.stsd"); + ASSERT(pStsdAtom); + + MP4Atom* pStsdEntryAtom = + pStsdAtom->GetChildAtom(stsdIndex - 1); + ASSERT(pStsdEntryAtom); + + MP4Integer16Property* pDrefIndexProperty = NULL; + pStsdEntryAtom->FindProperty( + "*.dataReferenceIndex", + (MP4Property**)&pDrefIndexProperty); + + if (pDrefIndexProperty == NULL) { + throw new MP4Error("invalid stsd entry", "GetSampleFile"); + } + + u_int32_t drefIndex = + pDrefIndexProperty->GetValue(); + + MP4Atom* pDrefAtom = + m_pTrakAtom->FindAtom("trak.mdia.minf.dinf.dref"); + ASSERT(pDrefAtom); + + MP4Atom* pUrlAtom = + pDrefAtom->GetChildAtom(drefIndex - 1); + ASSERT(pUrlAtom); + + FILE* pFile; + + if (pUrlAtom->GetFlags() & 1) { + pFile = NULL; // self-contained + } else { +#ifndef USE_FILE_CALLBACKS + MP4StringProperty* pLocationProperty = NULL; + pUrlAtom->FindProperty( + "*.location", + (MP4Property**)&pLocationProperty); + ASSERT(pLocationProperty); + + const char* url = pLocationProperty->GetValue(); + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("dref url = %s\n", url)); + + pFile = (FILE*)-1; + + // attempt to open url if it's a file url + // currently this is the only thing we understand + if (!strncmp(url, "file:", 5)) { + const char* fileName = url + 5; + if (!strncmp(fileName, "//", 2)) { + fileName = strchr(fileName + 2, '/'); + } + if (fileName) { + pFile = fopen(fileName, "rb"); + if (!pFile) { + pFile = (FILE*)-1; + } + } + } +#else + throw new MP4Error(errno, "Function not supported when using callbacks", "GetSampleFile"); +#endif + } + + if (m_lastSampleFile) { +#ifndef USE_FILE_CALLBACKS + fclose(m_lastSampleFile); +#else + throw new MP4Error(errno, "Function not supported when using callbacks", "GetSampleFile"); +#endif + } + + // cache the answer + m_lastStsdIndex = stsdIndex; + m_lastSampleFile = pFile; + + return pFile; +} + +u_int64_t MP4Track::GetSampleFileOffset(MP4SampleId sampleId) +{ + u_int32_t stscIndex = + GetSampleStscIndex(sampleId); + + u_int32_t firstChunk = + m_pStscFirstChunkProperty->GetValue(stscIndex); + + MP4SampleId firstSample = + m_pStscFirstSampleProperty->GetValue(stscIndex); + + u_int32_t samplesPerChunk = + m_pStscSamplesPerChunkProperty->GetValue(stscIndex); + + MP4ChunkId chunkId = firstChunk + + ((sampleId - firstSample) / samplesPerChunk); + + u_int64_t chunkOffset = m_pChunkOffsetProperty->GetValue(chunkId - 1); + + MP4SampleId firstSampleInChunk = + sampleId - ((sampleId - firstSample) % samplesPerChunk); + + // need cumulative samples sizes from firstSample to sampleId - 1 + u_int32_t sampleOffset = 0; + for (MP4SampleId i = firstSampleInChunk; i < sampleId; i++) { + sampleOffset += GetSampleSize(i); + } + + return chunkOffset + sampleOffset; +} + +void MP4Track::UpdateSampleToChunk(MP4SampleId sampleId, + MP4ChunkId chunkId, u_int32_t samplesPerChunk) +{ + u_int32_t numStsc = m_pStscCountProperty->GetValue(); + + // if samplesPerChunk == samplesPerChunk of last entry + if (numStsc && samplesPerChunk == + m_pStscSamplesPerChunkProperty->GetValue(numStsc-1)) { + + // nothing to do + + } else { + // add stsc entry + m_pStscFirstChunkProperty->AddValue(chunkId); + m_pStscSamplesPerChunkProperty->AddValue(samplesPerChunk); + m_pStscSampleDescrIndexProperty->AddValue(1); + m_pStscFirstSampleProperty->AddValue(sampleId - samplesPerChunk + 1); + + m_pStscCountProperty->IncrementValue(); + } +} + +void MP4Track::UpdateChunkOffsets(u_int64_t chunkOffset) +{ + if (m_pChunkOffsetProperty->GetType() == Integer32Property) { + ((MP4Integer32Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset); + } else { + ((MP4Integer64Property*)m_pChunkOffsetProperty)->AddValue(chunkOffset); + } + m_pChunkCountProperty->IncrementValue(); +} + +MP4Duration MP4Track::GetFixedSampleDuration() +{ + u_int32_t numStts = m_pSttsCountProperty->GetValue(); + + if (numStts == 0) { + return m_fixedSampleDuration; + } + if (numStts != 1) { + return MP4_INVALID_DURATION; // sample duration is not fixed + } + return m_pSttsSampleDeltaProperty->GetValue(0); +} + +bool MP4Track::SetFixedSampleDuration(MP4Duration duration) +{ + u_int32_t numStts = m_pSttsCountProperty->GetValue(); + + // setting this is only allowed before samples have been written + if (numStts != 0) { + return false; + } + m_fixedSampleDuration = duration; + return true; +} + +void MP4Track::GetSampleTimes(MP4SampleId sampleId, + MP4Timestamp* pStartTime, MP4Duration* pDuration) +{ + u_int32_t numStts = m_pSttsCountProperty->GetValue(); + MP4SampleId sid = 1; + MP4Duration elapsed = 0; + + for (u_int32_t sttsIndex = 0; sttsIndex < numStts; sttsIndex++) { + u_int32_t sampleCount = + m_pSttsSampleCountProperty->GetValue(sttsIndex); + u_int32_t sampleDelta = + m_pSttsSampleDeltaProperty->GetValue(sttsIndex); + + if (sampleId <= sid + sampleCount - 1) { + if (pStartTime) { + *pStartTime = (sampleId - sid); + *pStartTime *= sampleDelta; + *pStartTime += elapsed; + } + if (pDuration) { + *pDuration = sampleDelta; + } + return; + } + sid += sampleCount; + elapsed += sampleCount * sampleDelta; + } + + throw new MP4Error("sample id out of range", + "MP4Track::GetSampleTimes"); +} + +MP4SampleId MP4Track::GetSampleIdFromTime( + MP4Timestamp when, + bool wantSyncSample) +{ + u_int32_t numStts = m_pSttsCountProperty->GetValue(); + MP4SampleId sid = 1; + MP4Duration elapsed = 0; + + for (u_int32_t sttsIndex = 0; sttsIndex < numStts; sttsIndex++) { + u_int32_t sampleCount = + m_pSttsSampleCountProperty->GetValue(sttsIndex); + u_int32_t sampleDelta = + m_pSttsSampleDeltaProperty->GetValue(sttsIndex); + + if (sampleDelta == 0 && sttsIndex < numStts - 1) { + VERBOSE_READ(m_pFile->GetVerbosity(), + printf("Warning: Zero sample duration, stts entry %u\n", + sttsIndex)); + } + + MP4Duration d = when - elapsed; + + if (d <= sampleCount * sampleDelta) { + MP4SampleId sampleId = sid; + if (sampleDelta) { + sampleId += (d / sampleDelta); + } + + if (wantSyncSample) { + return GetNextSyncSample(sampleId); + } + return sampleId; + } + + sid += sampleCount; + elapsed += sampleCount * sampleDelta; + } + + throw new MP4Error("time out of range", + "MP4Track::GetSampleIdFromTime"); + + return 0; // satisfy MS compiler +} + +void MP4Track::UpdateSampleTimes(MP4Duration duration) +{ + u_int32_t numStts = m_pSttsCountProperty->GetValue(); + + // if duration == duration of last entry + if (numStts + && duration == m_pSttsSampleDeltaProperty->GetValue(numStts-1)) { + // increment last entry sampleCount + m_pSttsSampleCountProperty->IncrementValue(1, numStts-1); + + } else { + // add stts entry, sampleCount = 1, sampleDuration = duration + m_pSttsSampleCountProperty->AddValue(1); + m_pSttsSampleDeltaProperty->AddValue(duration); + m_pSttsCountProperty->IncrementValue();; + } +} + +u_int32_t MP4Track::GetSampleCttsIndex(MP4SampleId sampleId, + MP4SampleId* pFirstSampleId) +{ + u_int32_t numCtts = m_pCttsCountProperty->GetValue(); + + MP4SampleId sid = 1; + + for (u_int32_t cttsIndex = 0; cttsIndex < numCtts; cttsIndex++) { + u_int32_t sampleCount = + m_pCttsSampleCountProperty->GetValue(cttsIndex); + + if (sampleId <= sid + sampleCount - 1) { + if (pFirstSampleId) { + *pFirstSampleId = sid; + } + return cttsIndex; + } + sid += sampleCount; + } + + throw new MP4Error("sample id out of range", + "MP4Track::GetSampleCttsIndex"); + return 0; // satisfy MS compiler +} + +MP4Duration MP4Track::GetSampleRenderingOffset(MP4SampleId sampleId) +{ + if (m_pCttsCountProperty == NULL) { + return 0; + } + if (m_pCttsCountProperty->GetValue() == 0) { + return 0; + } + + u_int32_t cttsIndex = GetSampleCttsIndex(sampleId); + + return m_pCttsSampleOffsetProperty->GetValue(cttsIndex); +} + +void MP4Track::UpdateRenderingOffsets(MP4SampleId sampleId, + MP4Duration renderingOffset) +{ + // if ctts atom doesn't exist + if (m_pCttsCountProperty == NULL) { + + // no rendering offset, so nothing to do + if (renderingOffset == 0) { + return; + } + + // else create a ctts atom + MP4Atom* pCttsAtom = AddAtom("trak.mdia.minf.stbl", "ctts"); + + // and get handles on the properties + pCttsAtom->FindProperty( + "ctts.entryCount", + (MP4Property**)&m_pCttsCountProperty); + + pCttsAtom->FindProperty( + "ctts.entries.sampleCount", + (MP4Property**)&m_pCttsSampleCountProperty); + + pCttsAtom->FindProperty( + "ctts.entries.sampleOffset", + (MP4Property**)&m_pCttsSampleOffsetProperty); + + // if this is not the first sample + if (sampleId > 1) { + // add a ctts entry for all previous samples + // with rendering offset equal to zero + m_pCttsSampleCountProperty->AddValue(sampleId - 1); + m_pCttsSampleOffsetProperty->AddValue(0); + m_pCttsCountProperty->IncrementValue();; + } + } + + // ctts atom exists (now) + + u_int32_t numCtts = m_pCttsCountProperty->GetValue(); + + // if renderingOffset == renderingOffset of last entry + if (numCtts && renderingOffset + == m_pCttsSampleOffsetProperty->GetValue(numCtts-1)) { + + // increment last entry sampleCount + m_pCttsSampleCountProperty->IncrementValue(1, numCtts-1); + + } else { + // add ctts entry, sampleCount = 1, sampleOffset = renderingOffset + m_pCttsSampleCountProperty->AddValue(1); + m_pCttsSampleOffsetProperty->AddValue(renderingOffset); + m_pCttsCountProperty->IncrementValue(); + } +} + +void MP4Track::SetSampleRenderingOffset(MP4SampleId sampleId, + MP4Duration renderingOffset) +{ + // check if any ctts entries exist + if (m_pCttsCountProperty == NULL + || m_pCttsCountProperty->GetValue() == 0) { + // if not then Update routine can be used + // to create a ctts entry for samples before this one + // and a ctts entry for this sample + UpdateRenderingOffsets(sampleId, renderingOffset); + + // but we also need a ctts entry + // for all samples after this one + u_int32_t afterSamples = GetNumberOfSamples() - sampleId; + + if (afterSamples) { + m_pCttsSampleCountProperty->AddValue(afterSamples); + m_pCttsSampleOffsetProperty->AddValue(0); + m_pCttsCountProperty->IncrementValue();; + } + + return; + } + + MP4SampleId firstSampleId; + u_int32_t cttsIndex = GetSampleCttsIndex(sampleId, &firstSampleId); + + // do nothing in the degenerate case + if (renderingOffset == + m_pCttsSampleOffsetProperty->GetValue(cttsIndex)) { + return; + } + + u_int32_t sampleCount = + m_pCttsSampleCountProperty->GetValue(cttsIndex); + + // if this sample has it's own ctts entry + if (sampleCount == 1) { + // then just set the value, + // note we don't attempt to collapse entries + m_pCttsSampleOffsetProperty->SetValue(renderingOffset, cttsIndex); + return; + } + + MP4SampleId lastSampleId = firstSampleId + sampleCount - 1; + + // else we share this entry with other samples + // we need to insert our own entry + if (sampleId == firstSampleId) { + // our sample is the first one + m_pCttsSampleCountProperty-> + InsertValue(1, cttsIndex); + m_pCttsSampleOffsetProperty-> + InsertValue(renderingOffset, cttsIndex); + + m_pCttsSampleCountProperty-> + SetValue(sampleCount - 1, cttsIndex + 1); + + m_pCttsCountProperty->IncrementValue(); + + } else if (sampleId == lastSampleId) { + // our sample is the last one + m_pCttsSampleCountProperty-> + InsertValue(1, cttsIndex + 1); + m_pCttsSampleOffsetProperty-> + InsertValue(renderingOffset, cttsIndex + 1); + + m_pCttsSampleCountProperty-> + SetValue(sampleCount - 1, cttsIndex); + + m_pCttsCountProperty->IncrementValue(); + + } else { + // our sample is in the middle, UGH! + + // insert our new entry + m_pCttsSampleCountProperty-> + InsertValue(1, cttsIndex + 1); + m_pCttsSampleOffsetProperty-> + InsertValue(renderingOffset, cttsIndex + 1); + + // adjust count of previous entry + m_pCttsSampleCountProperty-> + SetValue(sampleId - firstSampleId, cttsIndex); + + // insert new entry for those samples beyond our sample + m_pCttsSampleCountProperty-> + InsertValue(lastSampleId - sampleId, cttsIndex + 2); + u_int32_t oldRenderingOffset = + m_pCttsSampleOffsetProperty->GetValue(cttsIndex); + m_pCttsSampleOffsetProperty-> + InsertValue(oldRenderingOffset, cttsIndex + 2); + + m_pCttsCountProperty->IncrementValue(2); + } +} + +bool MP4Track::IsSyncSample(MP4SampleId sampleId) +{ + if (m_pStssCountProperty == NULL) { + return true; + } + + u_int32_t numStss = m_pStssCountProperty->GetValue(); + + for (u_int32_t stssIndex = 0; stssIndex < numStss; stssIndex++) { + MP4SampleId syncSampleId = + m_pStssSampleProperty->GetValue(stssIndex); + + if (sampleId == syncSampleId) { + return true; + } + if (sampleId < syncSampleId) { + break; + } + } + + return false; +} + +// N.B. "next" is inclusive of this sample id +MP4SampleId MP4Track::GetNextSyncSample(MP4SampleId sampleId) +{ + if (m_pStssCountProperty == NULL) { + return sampleId; + } + + u_int32_t numStss = m_pStssCountProperty->GetValue(); + + for (u_int32_t stssIndex = 0; stssIndex < numStss; stssIndex++) { + MP4SampleId syncSampleId = + m_pStssSampleProperty->GetValue(stssIndex); + + if (sampleId > syncSampleId) { + continue; + } + return syncSampleId; + } + + // LATER check stsh for alternate sample + + return MP4_INVALID_SAMPLE_ID; +} + +void MP4Track::UpdateSyncSamples(MP4SampleId sampleId, bool isSyncSample) +{ + if (isSyncSample) { + // if stss atom exists, add entry + if (m_pStssCountProperty) { + m_pStssSampleProperty->AddValue(sampleId); + m_pStssCountProperty->IncrementValue(); + } // else nothing to do (yet) + + } else { // !isSyncSample + // if stss atom doesn't exist, create one + if (m_pStssCountProperty == NULL) { + + MP4Atom* pStssAtom = AddAtom("trak.mdia.minf.stbl", "stss"); + + pStssAtom->FindProperty( + "stss.entryCount", + (MP4Property**)&m_pStssCountProperty); + + pStssAtom->FindProperty( + "stss.entries.sampleNumber", + (MP4Property**)&m_pStssSampleProperty); + + // set values for all samples that came before this one + for (MP4SampleId sid = 1; sid < sampleId; sid++) { + m_pStssSampleProperty->AddValue(sid); + m_pStssCountProperty->IncrementValue(); + } + } // else nothing to do + } +} + +MP4Atom* MP4Track::AddAtom(char* parentName, char* childName) +{ + MP4Atom* pChildAtom = MP4Atom::CreateAtom(childName); + + MP4Atom* pParentAtom = m_pTrakAtom->FindAtom(parentName); + ASSERT(pParentAtom); + + pParentAtom->AddChildAtom(pChildAtom); + + pChildAtom->Generate(); + + return pChildAtom; +} + +u_int64_t MP4Track::GetDuration() +{ + return m_pMediaDurationProperty->GetValue(); +} + +u_int32_t MP4Track::GetTimeScale() +{ + return m_pTimeScaleProperty->GetValue(); +} + +void MP4Track::UpdateDurations(MP4Duration duration) +{ + // update media, track, and movie durations + m_pMediaDurationProperty->SetValue( + m_pMediaDurationProperty->GetValue() + duration); + + MP4Duration movieDuration = ToMovieDuration(duration); + m_pTrackDurationProperty->SetValue( + m_pTrackDurationProperty->GetValue() + movieDuration); + + m_pFile->UpdateDuration(m_pTrackDurationProperty->GetValue()); +} + +MP4Duration MP4Track::ToMovieDuration(MP4Duration trackDuration) +{ + return (trackDuration * m_pFile->GetTimeScale()) + / m_pTimeScaleProperty->GetValue(); +} + +void MP4Track::UpdateModificationTimes() +{ + // update media and track modification times + MP4Timestamp now = MP4GetAbsTimestamp(); + m_pMediaModificationProperty->SetValue(now); + m_pTrackModificationProperty->SetValue(now); +} + +u_int32_t MP4Track::GetNumberOfChunks() +{ + return m_pChunkOffsetProperty->GetCount(); +} + +u_int32_t MP4Track::GetChunkStscIndex(MP4ChunkId chunkId) +{ + u_int32_t stscIndex; + u_int32_t numStscs = m_pStscCountProperty->GetValue(); + + ASSERT(chunkId); + ASSERT(numStscs > 0); + + for (stscIndex = 0; stscIndex < numStscs; stscIndex++) { + if (chunkId < m_pStscFirstChunkProperty->GetValue(stscIndex)) { + ASSERT(stscIndex != 0); + break; + } + } + return stscIndex - 1; +} + +MP4Timestamp MP4Track::GetChunkTime(MP4ChunkId chunkId) +{ + u_int32_t stscIndex = GetChunkStscIndex(chunkId); + + MP4ChunkId firstChunkId = + m_pStscFirstChunkProperty->GetValue(stscIndex); + + MP4SampleId firstSample = + m_pStscFirstSampleProperty->GetValue(stscIndex); + + u_int32_t samplesPerChunk = + m_pStscSamplesPerChunkProperty->GetValue(stscIndex); + + MP4SampleId firstSampleInChunk = + firstSample + ((chunkId - firstChunkId) * samplesPerChunk); + + MP4Timestamp chunkTime; + + GetSampleTimes(firstSampleInChunk, &chunkTime, NULL); + + return chunkTime; +} + +u_int32_t MP4Track::GetChunkSize(MP4ChunkId chunkId) +{ + u_int32_t stscIndex = GetChunkStscIndex(chunkId); + + MP4ChunkId firstChunkId = + m_pStscFirstChunkProperty->GetValue(stscIndex); + + MP4SampleId firstSample = + m_pStscFirstSampleProperty->GetValue(stscIndex); + + u_int32_t samplesPerChunk = + m_pStscSamplesPerChunkProperty->GetValue(stscIndex); + + MP4SampleId firstSampleInChunk = + firstSample + ((chunkId - firstChunkId) * samplesPerChunk); + + // need cumulative sizes of samples in chunk + u_int32_t chunkSize = 0; + for (u_int32_t i = 0; i < samplesPerChunk; i++) { + chunkSize += GetSampleSize(firstSampleInChunk + i); + } + + return chunkSize; +} + +void MP4Track::ReadChunk(MP4ChunkId chunkId, + u_int8_t** ppChunk, u_int32_t* pChunkSize) +{ + ASSERT(chunkId); + ASSERT(ppChunk); + ASSERT(pChunkSize); + + u_int64_t chunkOffset = + m_pChunkOffsetProperty->GetValue(chunkId - 1); + + *pChunkSize = GetChunkSize(chunkId); + *ppChunk = (u_int8_t*)MP4Malloc(*pChunkSize); + + VERBOSE_READ_SAMPLE(m_pFile->GetVerbosity(), + printf("ReadChunk: track %u id %u offset 0x"LLX" size %u (0x%x)\n", + m_trackId, chunkId, chunkOffset, *pChunkSize, *pChunkSize)); + + u_int64_t oldPos = m_pFile->GetPosition(); // only used in mode == 'w' + try { + m_pFile->SetPosition(chunkOffset); + m_pFile->ReadBytes(*ppChunk, *pChunkSize); + } + catch (MP4Error* e) { + // let's not leak memory + MP4Free(*ppChunk); + *ppChunk = NULL; + + if (m_pFile->GetMode() == 'w') { + m_pFile->SetPosition(oldPos); + } + throw e; + } + + if (m_pFile->GetMode() == 'w') { + m_pFile->SetPosition(oldPos); + } +} + +void MP4Track::RewriteChunk(MP4ChunkId chunkId, + u_int8_t* pChunk, u_int32_t chunkSize) +{ + u_int64_t chunkOffset = m_pFile->GetPosition(); + + m_pFile->WriteBytes(pChunk, chunkSize); + + m_pChunkOffsetProperty->SetValue(chunkOffset, chunkId - 1); + + VERBOSE_WRITE_SAMPLE(m_pFile->GetVerbosity(), + printf("RewriteChunk: track %u id %u offset 0x"LLX" size %u (0x%x)\n", + m_trackId, chunkId, chunkOffset, chunkSize, chunkSize)); +} + +// map track type name aliases to official names + +const char* MP4Track::NormalizeTrackType(const char* type) +{ + if (!strcasecmp(type, "vide") + || !strcasecmp(type, "video") + || !strcasecmp(type, "mp4v") + || !strcasecmp(type, "encv")) { + return MP4_VIDEO_TRACK_TYPE; + } + + if (!strcasecmp(type, "soun") + || !strcasecmp(type, "sound") + || !strcasecmp(type, "audio") + || !strcasecmp(type, "enca") // ismacrypt + || !strcasecmp(type, "mp4a")) { + return MP4_AUDIO_TRACK_TYPE; + } + + if (!strcasecmp(type, "sdsm") + || !strcasecmp(type, "scene") + || !strcasecmp(type, "bifs")) { + return MP4_SCENE_TRACK_TYPE; + } + + if (!strcasecmp(type, "odsm") + || !strcasecmp(type, "od")) { + return MP4_OD_TRACK_TYPE; + } + + return type; +} + +bool MP4Track::InitEditListProperties() +{ + m_pElstCountProperty = NULL; + m_pElstMediaTimeProperty = NULL; + m_pElstDurationProperty = NULL; + m_pElstRateProperty = NULL; + m_pElstReservedProperty = NULL; + + MP4Atom* pElstAtom = + m_pTrakAtom->FindAtom("trak.edts.elst"); + + if (!pElstAtom) { + return false; + } + + pElstAtom->FindProperty( + "elst.entryCount", + (MP4Property**)&m_pElstCountProperty); + + pElstAtom->FindProperty( + "elst.entries.mediaTime", + (MP4Property**)&m_pElstMediaTimeProperty); + + pElstAtom->FindProperty( + "elst.entries.segmentDuration", + (MP4Property**)&m_pElstDurationProperty); + + pElstAtom->FindProperty( + "elst.entries.mediaRate", + (MP4Property**)&m_pElstRateProperty); + + pElstAtom->FindProperty( + "elst.entries.reserved", + (MP4Property**)&m_pElstReservedProperty); + + return m_pElstCountProperty + && m_pElstMediaTimeProperty + && m_pElstDurationProperty + && m_pElstRateProperty + && m_pElstReservedProperty; +} + +MP4EditId MP4Track::AddEdit(MP4EditId editId) +{ + if (!m_pElstCountProperty) { + m_pFile->AddDescendantAtoms(m_pTrakAtom, "edts.elst"); + InitEditListProperties(); + } + + if (editId == MP4_INVALID_EDIT_ID) { + editId = m_pElstCountProperty->GetValue() + 1; + } + + m_pElstMediaTimeProperty->InsertValue(0, editId - 1); + m_pElstDurationProperty->InsertValue(0, editId - 1); + m_pElstRateProperty->InsertValue(1, editId - 1); + m_pElstReservedProperty->InsertValue(0, editId - 1); + + m_pElstCountProperty->IncrementValue(); + + return editId; +} + +void MP4Track::DeleteEdit(MP4EditId editId) +{ + if (editId == MP4_INVALID_EDIT_ID) { + throw new MP4Error("edit id can't be zero", + "MP4Track::DeleteEdit"); + } + + if (!m_pElstCountProperty + || m_pElstCountProperty->GetValue() == 0) { + throw new MP4Error("no edits exist", + "MP4Track::DeleteEdit"); + } + + m_pElstMediaTimeProperty->DeleteValue(editId - 1); + m_pElstDurationProperty->DeleteValue(editId - 1); + m_pElstRateProperty->DeleteValue(editId - 1); + m_pElstReservedProperty->DeleteValue(editId - 1); + + m_pElstCountProperty->IncrementValue(-1); + + // clean up if last edit is deleted + if (m_pElstCountProperty->GetValue() == 0) { + m_pElstCountProperty = NULL; + m_pElstMediaTimeProperty = NULL; + m_pElstDurationProperty = NULL; + m_pElstRateProperty = NULL; + m_pElstReservedProperty = NULL; + + m_pTrakAtom->DeleteChildAtom( + m_pTrakAtom->FindAtom("trak.edts")); + } +} + +MP4Timestamp MP4Track::GetEditStart( + MP4EditId editId) +{ + if (editId == MP4_INVALID_EDIT_ID) { + return MP4_INVALID_TIMESTAMP; + } else if (editId == 1) { + return 0; + } + return (MP4Timestamp)GetEditTotalDuration(editId - 1); +} + +MP4Duration MP4Track::GetEditTotalDuration( + MP4EditId editId) +{ + u_int32_t numEdits = 0; + + if (m_pElstCountProperty) { + numEdits = m_pElstCountProperty->GetValue(); + } + + if (editId == MP4_INVALID_EDIT_ID) { + editId = numEdits; + } + + if (numEdits == 0 || editId > numEdits) { + return MP4_INVALID_DURATION; + } + + MP4Duration totalDuration = 0; + + for (MP4EditId eid = 1; eid <= editId; eid++) { + totalDuration += + m_pElstDurationProperty->GetValue(eid - 1); + } + + return totalDuration; +} + +MP4SampleId MP4Track::GetSampleIdFromEditTime( + MP4Timestamp editWhen, + MP4Timestamp* pStartTime, + MP4Duration* pDuration) +{ + MP4SampleId sampleId = MP4_INVALID_SAMPLE_ID; + u_int32_t numEdits = 0; + + if (m_pElstCountProperty) { + numEdits = m_pElstCountProperty->GetValue(); + } + + if (numEdits) { + MP4Duration editElapsedDuration = 0; + + for (MP4EditId editId = 1; editId <= numEdits; editId++) { + // remember edit segment's start time (in edit timeline) + MP4Timestamp editStartTime = + (MP4Timestamp)editElapsedDuration; + + // accumulate edit segment's duration + editElapsedDuration += + m_pElstDurationProperty->GetValue(editId - 1); + + // calculate difference between the specified edit time + // and the end of this edit segment + if (editElapsedDuration - editWhen <= 0) { + // the specified time has not yet been reached + continue; + } + + // 'editWhen' is within this edit segment + + // calculate the specified edit time + // relative to just this edit segment + MP4Duration editOffset = + editWhen - editStartTime; + + // calculate the media (track) time that corresponds + // to the specified edit time based on the edit list + MP4Timestamp mediaWhen = + m_pElstMediaTimeProperty->GetValue(editId - 1) + + editOffset; + + // lookup the sample id for the media time + sampleId = GetSampleIdFromTime(mediaWhen, false); + + // lookup the sample's media start time and duration + MP4Timestamp sampleStartTime; + MP4Duration sampleDuration; + + GetSampleTimes(sampleId, &sampleStartTime, &sampleDuration); + + // calculate the difference if any between when the sample + // would naturally start and when it starts in the edit timeline + MP4Duration sampleStartOffset = + mediaWhen - sampleStartTime; + + // calculate the start time for the sample in the edit time line + MP4Timestamp editSampleStartTime = + editWhen - MIN(editOffset, sampleStartOffset); + + MP4Duration editSampleDuration = 0; + + // calculate how long this sample lasts in the edit list timeline + if (m_pElstRateProperty->GetValue(editId - 1) == 0) { + // edit segment is a "dwell" + // so sample duration is that of the edit segment + editSampleDuration = + m_pElstDurationProperty->GetValue(editId - 1); + + } else { + // begin with the natural sample duration + editSampleDuration = sampleDuration; + + // now shorten that if the edit segment starts + // after the sample would naturally start + if (editOffset < sampleStartOffset) { + editSampleDuration -= sampleStartOffset - editOffset; + } + + // now shorten that if the edit segment ends + // before the sample would naturally end + if (editElapsedDuration + < editSampleStartTime + sampleDuration) { + editSampleDuration -= (editSampleStartTime + sampleDuration) + - editElapsedDuration; + } + } + + if (pStartTime) { + *pStartTime = editSampleStartTime; + } + + if (pDuration) { + *pDuration = editSampleDuration; + } + + VERBOSE_EDIT(m_pFile->GetVerbosity(), + printf("GetSampleIdFromEditTime: when %llu " + "sampleId %u start %llu duration %lld\n", + editWhen, sampleId, + editSampleStartTime, editSampleDuration)); + + return sampleId; + } + + throw new MP4Error("time out of range", + "MP4Track::GetSampleIdFromEditTime"); + + } else { // no edit list + sampleId = GetSampleIdFromTime(editWhen, false); + + if (pStartTime || pDuration) { + GetSampleTimes(sampleId, pStartTime, pDuration); + } + } + + return sampleId; +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mp4s.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mp4s.cpp @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4Mp4sAtom::MP4Mp4sAtom() + : MP4Atom("mp4s") +{ + AddReserved("reserved1", 6); + AddProperty( + new MP4Integer16Property("dataReferenceIndex")); + + ExpectChildAtom("esds", Required, OnlyOne); +} + +void MP4Mp4sAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_cprt.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_cprt.cpp @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4CprtAtom::MP4CprtAtom() + : MP4Atom("cprt") +{ + AddVersionAndFlags(); + AddProperty( + new MP4Integer16Property("language")); + AddProperty( + new MP4StringProperty("notice")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_elst.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_elst.cpp @@ -0,0 +1,80 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4ElstAtom::MP4ElstAtom() + : MP4Atom("elst") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); +} + +void MP4ElstAtom::AddProperties(u_int8_t version) +{ + MP4TableProperty* pTable = (MP4TableProperty*)m_pProperties[3]; + + if (version == 1) { + pTable->AddProperty( + new MP4Integer64Property("segmentDuration")); + pTable->AddProperty( + new MP4Integer64Property("mediaTime")); + } else { + pTable->AddProperty( + new MP4Integer32Property("segmentDuration")); + pTable->AddProperty( + new MP4Integer32Property("mediaTime")); + } + + pTable->AddProperty( + new MP4Integer16Property("mediaRate")); + pTable->AddProperty( + new MP4Integer16Property("reserved")); +} + +void MP4ElstAtom::Generate() +{ + SetVersion(0); + AddProperties(GetVersion()); + + MP4Atom::Generate(); +} + +void MP4ElstAtom::Read() +{ + /* read atom version */ + ReadProperties(0, 1); + + /* need to create the properties based on the atom version */ + AddProperties(GetVersion()); + + /* now we can read the remaining properties */ + ReadProperties(1); + + Skip(); // to end of atom +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_tims.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_tims.cpp @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TimsAtom::MP4TimsAtom() + : MP4Atom("tims") +{ + AddProperty( + new MP4Integer32Property("timeScale")); +} + --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_enca.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_enca.cpp @@ -0,0 +1,61 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + * Alix Marchandise-Franquet alix@cisco.com + */ + +#include "mp4common.h" + +MP4EncaAtom::MP4EncaAtom() + : MP4Atom("enca") +{ + AddReserved("reserved1", 6); /* 0 */ + + AddProperty( /* 1 */ + new MP4Integer16Property("dataReferenceIndex")); + + AddReserved("reserved2", 16); /* 2 */ + + AddProperty( /* 3 */ + new MP4Integer16Property("timeScale")); + + AddReserved("reserved3", 2); /* 4 */ + + ExpectChildAtom("esds", Required, OnlyOne); + ExpectChildAtom("sinf", Required, OnlyOne); +} + +void MP4EncaAtom::Generate() +{ + MP4Atom::Generate(); + + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1); + + // property reserved2 has non-zero fixed values + static u_int8_t reserved2[16] = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, + }; + m_pProperties[2]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[2])-> + SetValue(reserved2, sizeof(reserved2)); + m_pProperties[2]->SetReadOnly(true); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4descriptor.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4descriptor.h @@ -0,0 +1,96 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_DESCRIPTOR_INCLUDED__ +#define __MP4_DESCRIPTOR_INCLUDED__ + +class MP4Descriptor { +public: + MP4Descriptor(u_int8_t tag = 0); + + virtual ~MP4Descriptor(); + + u_int8_t GetTag() { + return m_tag; + } + void SetTag(u_int8_t tag) { + m_tag = tag; + } + + void SetParentAtom(MP4Atom* pParentAtom) { + m_pParentAtom = pParentAtom; + for (u_int32_t i = 0; i < m_pProperties.Size(); i++) { + m_pProperties[i]->SetParentAtom(pParentAtom); + } + } + + void AddProperty(MP4Property* pProperty); + + virtual void Generate(); + virtual void Read(MP4File* pFile); + virtual void Write(MP4File* pFile); + virtual void Dump(FILE* pFile, u_int8_t indent, bool dumpImplicits); + + MP4Property* GetProperty(u_int32_t index) { + return m_pProperties[index]; + } + + // use with extreme caution + void SetProperty(u_int32_t index, MP4Property* pProperty) { + m_pProperties[index] = pProperty; + } + + bool FindProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex = NULL) { + return FindContainedProperty(name, ppProperty, pIndex); + } + + void WriteToMemory(MP4File* pFile, + u_int8_t** ppBytes, u_int64_t* pNumBytes); + +protected: + void SetReadMutate(u_int32_t propIndex) { + m_readMutatePoint = propIndex; + } + + void ReadHeader(MP4File* pFile); + void ReadProperties(MP4File* pFile, + u_int32_t startIndex = 0, u_int32_t count = 0xFFFFFFFF); + + virtual void Mutate() { + // default is a no-op + }; + + bool FindContainedProperty(const char* name, + MP4Property** ppProperty, u_int32_t* pIndex); + + u_int8_t GetDepth(); + +protected: + MP4Atom* m_pParentAtom; + u_int8_t m_tag; + u_int64_t m_start; + u_int32_t m_size; + MP4PropertyArray m_pProperties; + u_int32_t m_readMutatePoint; +}; + +#endif /* __MP4_DESCRIPTOR_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/mp4common.h +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/mp4common.h @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#ifndef __MP4_COMMON_INCLUDED__ +#define __MP4_COMMON_INCLUDED__ + +// common includes for everything +// with an internal view of the library +// i.e. all the .cpp's just #include "mp4common.h" + +#include "mpeg4ip.h" + +#include "mp4.h" +#include "mp4util.h" +#include "mp4array.h" +#include "mp4track.h" +#include "mp4file.h" +#include "mp4property.h" +#include "mp4container.h" +#include "mp4descriptor.h" +#include "mp4atom.h" + +#include "atoms.h" +#include "descriptors.h" +#include "ocidescriptors.h" +#include "qosqualifiers.h" + +#include "odcommands.h" + +#include "rtphint.h" + +#endif /* __MP4_COMMON_INCLUDED__ */ --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_drep.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_drep.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4DrepAtom::MP4DrepAtom() + : MP4Atom("drep") +{ + AddProperty( // bytes of repeated data + new MP4Integer64Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_mvhd.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_mvhd.cpp @@ -0,0 +1,136 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4MvhdAtom::MP4MvhdAtom() + : MP4Atom("mvhd") +{ + AddVersionAndFlags(); +} + +void MP4MvhdAtom::AddProperties(u_int8_t version) +{ + if (version == 1) { + AddProperty( /* 2 */ + new MP4Integer64Property("creationTime")); + AddProperty( /* 3 */ + new MP4Integer64Property("modificationTime")); + } else { + AddProperty( /* 2 */ + new MP4Integer32Property("creationTime")); + AddProperty( /* 3 */ + new MP4Integer32Property("modificationTime")); + } + + AddProperty( /* 4 */ + new MP4Integer32Property("timeScale")); + + if (version == 1) { + AddProperty( /* 5 */ + new MP4Integer64Property("duration")); + } else { + AddProperty( /* 5 */ + new MP4Integer32Property("duration")); + } + + MP4Float32Property* pProp; + + pProp = new MP4Float32Property("rate"); + pProp->SetFixed32Format(); + AddProperty(pProp); /* 6 */ + + pProp = new MP4Float32Property("volume"); + pProp->SetFixed16Format(); + AddProperty(pProp); /* 7 */ + + AddReserved("reserved1", 70); /* 8 */ + + AddProperty( /* 9 */ + new MP4Integer32Property("nextTrackId")); +} + +void MP4MvhdAtom::Generate() +{ + u_int8_t version = m_pFile->Use64Bits() ? 1 : 0; + SetVersion(version); + AddProperties(version); + + MP4Atom::Generate(); + + // set creation and modification times + MP4Timestamp now = MP4GetAbsTimestamp(); + if (version == 1) { + ((MP4Integer64Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer64Property*)m_pProperties[3])->SetValue(now); + } else { + ((MP4Integer32Property*)m_pProperties[2])->SetValue(now); + ((MP4Integer32Property*)m_pProperties[3])->SetValue(now); + } + + ((MP4Integer32Property*)m_pProperties[4])->SetValue(1000); + + ((MP4Float32Property*)m_pProperties[6])->SetValue(1.0); + ((MP4Float32Property*)m_pProperties[7])->SetValue(1.0); + + // property reserved has non-zero fixed values + static u_int8_t reserved[70] = { + 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + }; + m_pProperties[8]->SetReadOnly(false); + ((MP4BytesProperty*)m_pProperties[8])-> + SetValue(reserved, sizeof(reserved)); + m_pProperties[8]->SetReadOnly(true); + + // set next track id + ((MP4Integer32Property*)m_pProperties[9])->SetValue(1); +} + +void MP4MvhdAtom::Read() +{ + /* read atom version */ + ReadProperties(0, 1); + + /* need to create the properties based on the atom version */ + AddProperties(GetVersion()); + + /* now we can read the remaining properties */ + ReadProperties(1); + + Skip(); // to end of atom +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_trpy.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_trpy.cpp @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4TrpyAtom::MP4TrpyAtom() + : MP4Atom("trpy") +{ + AddProperty( // bytes sent including RTP headers + new MP4Integer64Property("bytes")); +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stsc.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stsc.cpp @@ -0,0 +1,78 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StscAtom::MP4StscAtom() + : MP4Atom("stsc") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer32Property("firstChunk")); + pTable->AddProperty( + new MP4Integer32Property("samplesPerChunk")); + pTable->AddProperty( + new MP4Integer32Property("sampleDescriptionIndex")); + + // As an optimization we add an implicit property to this table, + // "firstSample" that corresponds to the first sample of the firstChunk + MP4Integer32Property* pSample = + new MP4Integer32Property("firstSample"); + pSample->SetImplicit(); + pTable->AddProperty(pSample); +} + +void MP4StscAtom::Read() +{ + // Read as usual + MP4Atom::Read(); + + // Compute the firstSample values for later use + u_int32_t count = + ((MP4Integer32Property*)m_pProperties[2])->GetValue(); + + MP4Integer32Property* pFirstChunk = (MP4Integer32Property*) + ((MP4TableProperty*)m_pProperties[3])->GetProperty(0); + MP4Integer32Property* pSamplesPerChunk = (MP4Integer32Property*) + ((MP4TableProperty*)m_pProperties[3])->GetProperty(1); + MP4Integer32Property* pFirstSample = (MP4Integer32Property*) + ((MP4TableProperty*)m_pProperties[3])->GetProperty(3); + + MP4SampleId sampleId = 1; + + for (u_int32_t i = 0; i < count; i++) { + pFirstSample->SetValue(sampleId, i); + + if (i < count - 1) { + sampleId += + (pFirstChunk->GetValue(i+1) - pFirstChunk->GetValue(i)) + * pSamplesPerChunk->GetValue(i); + } + } +} --- vlc-0.8.6.release.d.orig/extras/faad2/common/mp4v2/atom_stdp.cpp +++ vlc-0.8.6.release.d/extras/faad2/common/mp4v2/atom_stdp.cpp @@ -0,0 +1,49 @@ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is MPEG4IP. + * + * The Initial Developer of the Original Code is Cisco Systems Inc. + * Portions created by Cisco Systems Inc. are + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. + * + * Contributor(s): + * Dave Mackie dmackie@cisco.com + */ + +#include "mp4common.h" + +MP4StdpAtom::MP4StdpAtom() + : MP4Atom("stdp") +{ + AddVersionAndFlags(); + + MP4Integer32Property* pCount = + new MP4Integer32Property("entryCount"); + pCount->SetImplicit(); + AddProperty(pCount); + + MP4TableProperty* pTable = new MP4TableProperty("entries", pCount); + AddProperty(pTable); + + pTable->AddProperty( + new MP4Integer16Property("priority")); +} + +void MP4StdpAtom::Read() +{ + // table entry count computed from atom size + ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(false); + ((MP4Integer32Property*)m_pProperties[2])->SetValue((m_size - 4) / 2); + ((MP4Integer32Property*)m_pProperties[2])->SetReadOnly(true); + + MP4Atom::Read(); +} --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/01_systems.h.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/01_systems.h.diff @@ -0,0 +1,11 @@ +--- faad2-2.0.0+cvs20040908+mp4v2+bmp/common/mp4v2/systems.h.old 2005-11-09 18:41:30.683229672 +0100 ++++ faad2-2.0.0+cvs20040908+mp4v2+bmp/common/mp4v2/systems.h 2005-11-09 18:41:37.836142264 +0100 +@@ -31,7 +31,7 @@ + #else + #undef PACKAGE + #undef VERSION +-#include ++#include + #endif + + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/07_remove_static.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/07_remove_static.diff @@ -0,0 +1,13 @@ +diff -Nur ../faad2-2.0.0clean-old/common/mp4ff/mp4ff.c ./common/mp4ff/mp4ff.c +--- ../faad2-2.0.0clean-old/common/mp4ff/mp4ff.c 2005-07-15 18:58:03.807969368 +0000 ++++ ./common/mp4ff/mp4ff.c 2005-07-15 19:00:22.142939256 +0000 +@@ -87,7 +87,7 @@ + if (ff) free(ff); + } + +-static void mp4ff_track_add(mp4ff_t *f) ++void mp4ff_track_add(mp4ff_t *f) + { + f->total_tracks++; + + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/09_amd64.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/09_amd64.diff @@ -0,0 +1,298 @@ +--- include/faad.h.old 2005-09-07 12:37:52.265782664 +0200 ++++ include/faad.h 2005-09-07 12:44:22.634437608 +0200 +@@ -66,6 +66,10 @@ + #endif + #endif + ++/* needed for standard integer types */ ++#define __STDC_LIMIT_MACROS ++#include ++ + #define FAAD2_VERSION "2.0" + + /* object types for AAC */ +@@ -136,90 +140,90 @@ + typedef struct mp4AudioSpecificConfig + { + /* Audio Specific Info */ +- unsigned char objectTypeIndex; +- unsigned char samplingFrequencyIndex; +- unsigned long samplingFrequency; +- unsigned char channelsConfiguration; ++ uint8_t objectTypeIndex; ++ uint8_t samplingFrequencyIndex; ++ uint32_t samplingFrequency; ++ uint8_t channelsConfiguration; + + /* GA Specific Info */ +- unsigned char frameLengthFlag; +- unsigned char dependsOnCoreCoder; +- unsigned short coreCoderDelay; +- unsigned char extensionFlag; +- unsigned char aacSectionDataResilienceFlag; +- unsigned char aacScalefactorDataResilienceFlag; +- unsigned char aacSpectralDataResilienceFlag; +- unsigned char epConfig; +- +- char sbr_present_flag; +- char forceUpSampling; +- char downSampledSBR; ++ uint8_t frameLengthFlag; ++ uint8_t dependsOnCoreCoder; ++ uint16_t coreCoderDelay; ++ uint8_t extensionFlag; ++ uint8_t aacSectionDataResilienceFlag; ++ uint8_t aacScalefactorDataResilienceFlag; ++ uint8_t aacSpectralDataResilienceFlag; ++ uint8_t epConfig; ++ ++ int8_t sbr_present_flag; ++ int8_t forceUpSampling; ++ int8_t downSampledSBR; + } mp4AudioSpecificConfig; + + typedef struct faacDecConfiguration + { +- unsigned char defObjectType; +- unsigned long defSampleRate; +- unsigned char outputFormat; +- unsigned char downMatrix; +- unsigned char useOldADTSFormat; +- unsigned char dontUpSampleImplicitSBR; ++ uint8_t defObjectType; ++ uint32_t defSampleRate; ++ uint8_t outputFormat; ++ uint8_t downMatrix; ++ uint8_t useOldADTSFormat; ++ uint8_t dontUpSampleImplicitSBR; + } faacDecConfiguration, *faacDecConfigurationPtr; + + typedef struct faacDecFrameInfo + { +- unsigned long bytesconsumed; +- unsigned long samples; +- unsigned char channels; +- unsigned char error; +- unsigned long samplerate; ++ uint32_t bytesconsumed; ++ uint32_t samples; ++ uint8_t channels; ++ uint8_t error; ++ uint32_t samplerate; + + /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ +- unsigned char sbr; ++ uint8_t sbr; + + /* MPEG-4 ObjectType */ +- unsigned char object_type; ++ uint8_t object_type; + + /* AAC header type; MP4 will be signalled as RAW also */ +- unsigned char header_type; ++ uint8_t header_type; + + /* multichannel configuration */ +- unsigned char num_front_channels; +- unsigned char num_side_channels; +- unsigned char num_back_channels; +- unsigned char num_lfe_channels; +- unsigned char channel_position[64]; ++ uint8_t num_front_channels; ++ uint8_t num_side_channels; ++ uint8_t num_back_channels; ++ uint8_t num_lfe_channels; ++ uint8_t channel_position[64]; + + /* PS: 0: off, 1: on */ + unsigned char ps; + } faacDecFrameInfo; + +-char* FAADAPI faacDecGetErrorMessage(unsigned char errcode); ++int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode); + +-unsigned long FAADAPI faacDecGetCapabilities(void); ++uint32_t FAADAPI faacDecGetCapabilities(void); + + faacDecHandle FAADAPI faacDecOpen(void); + + faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder); + +-unsigned char FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, ++uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder, + faacDecConfigurationPtr config); + + /* Init the library based on info from the AAC file (ADTS/ADIF) */ + long FAADAPI faacDecInit(faacDecHandle hDecoder, +- unsigned char *buffer, +- unsigned long buffer_size, +- unsigned long *samplerate, +- unsigned char *channels); ++ uint8_t *buffer, ++ uint32_t buffer_size, ++ uint32_t *samplerate, ++ uint8_t *channels); + + /* Init the library using a DecoderSpecificInfo */ +-char FAADAPI faacDecInit2(faacDecHandle hDecoder, unsigned char *pBuffer, +- unsigned long SizeOfDecoderSpecificInfo, +- unsigned long *samplerate, unsigned char *channels); ++int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer, ++ uint32_t SizeOfDecoderSpecificInfo, ++ uint32_t *samplerate, uint8_t *channels); + + /* Init the library for DRM */ +-char FAADAPI faacDecInitDRM(faacDecHandle *hDecoder, unsigned long samplerate, +- unsigned char channels); ++int8_t FAADAPI faacDecInitDRM(faacDecHandle *hDecoder, uint32_t samplerate, ++ uint8_t channels); + + void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, long frame); + +@@ -227,18 +231,18 @@ + + void* FAADAPI faacDecDecode(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, +- unsigned char *buffer, +- unsigned long buffer_size); ++ uint8_t *buffer, ++ uint32_t buffer_size); + + void* FAADAPI faacDecDecode2(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, +- unsigned char *buffer, +- unsigned long buffer_size, ++ uint8_t *buffer, ++ uint32_t buffer_size, + void **sample_buffer, +- unsigned long sample_buffer_size); ++ uint32_t sample_buffer_size); + +-char FAADAPI faacDecAudioSpecificConfig(unsigned char *pBuffer, +- unsigned long buffer_size, ++int8_t FAADAPI faacDecAudioSpecificConfig(uint8_t *pBuffer, ++ uint32_t buffer_size, + mp4AudioSpecificConfig *mp4ASC); + + #ifdef _WIN32 +--- libfaad/common.h.old 2005-09-07 12:45:17.209140992 +0200 ++++ libfaad/common.h 2005-09-07 12:47:34.732234304 +0200 +@@ -193,8 +193,16 @@ + #else + # if HAVE_STDINT_H + # include ++# elif defined(__x86_64__) ++typedef unsigned long uint64_t; ++typedef unsigned int uint32_t; ++typedef unsigned short uint16_t; ++typedef unsigned char uint8_t; ++typedef long int64_t; ++typedef int int32_t; ++typedef short int16_t; ++typedef char int8_t; + # else +-/* we need these... */ + typedef unsigned long long uint64_t; + typedef unsigned long uint32_t; + typedef unsigned short uint16_t; +--- libfaad/structs.h.old 2005-09-07 14:29:47.764871624 +0200 ++++ libfaad/structs.h 2005-09-07 14:32:45.799806200 +0200 +@@ -310,62 +310,62 @@ + typedef struct mp4AudioSpecificConfig + { + /* Audio Specific Info */ +- /*uint8_t*/ unsigned char objectTypeIndex; +- /*uint8_t*/ unsigned char samplingFrequencyIndex; +- /*uint32_t*/ unsigned long samplingFrequency; +- /*uint8_t*/ unsigned char channelsConfiguration; ++ uint8_t objectTypeIndex; ++ uint8_t samplingFrequencyIndex; ++ uint32_t samplingFrequency; ++ uint8_t channelsConfiguration; + + /* GA Specific Info */ +- /*uint8_t*/ unsigned char frameLengthFlag; +- /*uint8_t*/ unsigned char dependsOnCoreCoder; +- /*uint16_t*/ unsigned short coreCoderDelay; +- /*uint8_t*/ unsigned char extensionFlag; +- /*uint8_t*/ unsigned char aacSectionDataResilienceFlag; +- /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag; +- /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag; +- /*uint8_t*/ unsigned char epConfig; +- +- /*uint8_t*/ char sbr_present_flag; +- /*uint8_t*/ char forceUpSampling; +- /*uint8_t*/ char downSampledSBR; ++ uint8_t frameLengthFlag; ++ uint8_t dependsOnCoreCoder; ++ uint16_t coreCoderDelay; ++ uint8_t extensionFlag; ++ uint8_t aacSectionDataResilienceFlag; ++ uint8_t aacScalefactorDataResilienceFlag; ++ uint8_t aacSpectralDataResilienceFlag; ++ uint8_t epConfig; ++ ++ uint8_t sbr_present_flag; ++ uint8_t forceUpSampling; ++ uint8_t downSampledSBR; + } mp4AudioSpecificConfig; + + typedef struct faacDecConfiguration + { +- /*uint8_t*/ unsigned char defObjectType; +- /*uint32_t*/ unsigned long defSampleRate; +- /*uint8_t*/ unsigned char outputFormat; +- /*uint8_t*/ unsigned char downMatrix; +- /*uint8_t*/ unsigned char useOldADTSFormat; +- /*uint8_t*/ unsigned char dontUpSampleImplicitSBR; ++ uint8_t defObjectType; ++ uint32_t defSampleRate; ++ uint8_t outputFormat; ++ uint8_t downMatrix; ++ uint8_t useOldADTSFormat; ++ uint8_t dontUpSampleImplicitSBR; + } faacDecConfiguration, *faacDecConfigurationPtr; + + typedef struct faacDecFrameInfo + { +- /*uint32_t*/ unsigned long bytesconsumed; +- /*uint32_t*/ unsigned long samples; +- /*uint8_t*/ unsigned char channels; +- /*uint8_t*/ unsigned char error; +- /*uint32_t*/ unsigned long samplerate; ++ uint32_t bytesconsumed; ++ uint32_t samples; ++ uint8_t channels; ++ uint8_t error; ++ uint32_t samplerate; + + /* SBR: 0: off, 1: on; normal, 2: on; downsampled */ +- /*uint8_t*/ unsigned char sbr; ++ uint8_t sbr; + + /* MPEG-4 ObjectType */ +- /*uint8_t*/ unsigned char object_type; ++ uint8_t object_type; + + /* AAC header type; MP4 will be signalled as RAW also */ +- /*uint8_t*/ unsigned char header_type; ++ uint8_t header_type; + + /* multichannel configuration */ +- /*uint8_t*/ unsigned char num_front_channels; +- /*uint8_t*/ unsigned char num_side_channels; +- /*uint8_t*/ unsigned char num_back_channels; +- /*uint8_t*/ unsigned char num_lfe_channels; +- /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS]; ++ uint8_t num_front_channels; ++ uint8_t num_side_channels; ++ uint8_t num_back_channels; ++ uint8_t num_lfe_channels; ++ uint8_t channel_position[MAX_CHANNELS]; + + /* PS: 0: off, 1: on */ +- /*uint8_t*/ unsigned char ps; ++ uint8_t ps; + } faacDecFrameInfo; + + typedef struct --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/10_libmp4_sample_check.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/10_libmp4_sample_check.diff @@ -0,0 +1,12 @@ +diff -Nur faad2-2.0.0+cvs20040908+mp4v2+bmp/plugins/xmms/src/libmp4.c faad2-2.0.0+cvs20040908+mp4v2+bmp.new/plugins/xmms/src/libmp4.c +--- faad2-2.0.0+cvs20040908+mp4v2+bmp/plugins/xmms/src/libmp4.c 2005-09-07 11:48:34.000000000 +0200 ++++ faad2-2.0.0+cvs20040908+mp4v2+bmp.new/plugins/xmms/src/libmp4.c 2007-06-12 13:17:13.000000000 +0200 +@@ -384,7 +384,7 @@ + frameInfo.samples<<1, + sampleBuffer); + mp4_ip.output->write_audio(sampleBuffer, frameInfo.samples<<1); +- if(sampleID > numSamples){ ++ if(sampleID >= numSamples){ + break; + } + } --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/04_mp4ff.h_fix.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/04_mp4ff.h_fix.diff @@ -0,0 +1,18 @@ +--- ../faad2-old/common/mp4ff/mp4ff.h 2004-01-11 16:52:18.000000000 +0100 ++++ ./common/mp4ff/mp4ff.h 2005-07-07 18:24:43.284890888 +0200 +@@ -32,7 +32,7 @@ + extern "C" { + #endif /* __cplusplus */ + +-#include "mp4ff_int_types.h" ++#include + + /* file callback structure */ + typedef struct +@@ -125,4 +125,4 @@ + } + #endif /* __cplusplus */ + +-#endif +\ Kein Zeilenumbruch am Dateiende. ++#endif --- vlc-0.8.6.release.d.orig/extras/faad2/debian/patches/06_pure_virtual_fix.diff +++ vlc-0.8.6.release.d/extras/faad2/debian/patches/06_pure_virtual_fix.diff @@ -0,0 +1,54 @@ +diff -Nur ../1/common/mp4v2/mp4property.h ./common/mp4v2/mp4property.h +--- ../1/common/mp4v2/mp4property.h 2005-07-15 18:32:16.602180400 +0000 ++++ ./common/mp4v2/mp4property.h 2003-06-29 21:41:00.000000000 +0000 +@@ -58,7 +58,7 @@ + return m_name; + } + ++ virtual MP4PropertyType GetType() = 0; +- virtual MP4PropertyType GetType() = NULL; + + bool IsReadOnly() { + return m_readOnly; +@@ -74,20 +74,20 @@ + m_implicit = value; + } + ++ virtual u_int32_t GetCount() = 0; ++ virtual void SetCount(u_int32_t count) = 0; +- virtual u_int32_t GetCount() = NULL; +- virtual void SetCount(u_int32_t count) = NULL; + + virtual void Generate() { /* default is a no-op */ }; + ++ virtual void Read(MP4File* pFile, u_int32_t index = 0) = 0; +- virtual void Read(MP4File* pFile, u_int32_t index = 0) = NULL; + ++ virtual void Write(MP4File* pFile, u_int32_t index = 0) = 0; +- virtual void Write(MP4File* pFile, u_int32_t index = 0) = NULL; + + virtual void Dump(FILE* pFile, u_int8_t indent, ++ bool dumpImplicits, u_int32_t index = 0) = 0; +- bool dumpImplicits, u_int32_t index = 0) = NULL; + + virtual bool FindProperty(const char* name, ++ MP4Property** ppProperty, u_int32_t* pIndex = 0); +- MP4Property** ppProperty, u_int32_t* pIndex = NULL); + + protected: + MP4Atom* m_pParentAtom; +diff -Nur ../1/common/mp4v2/rtphint.h ./common/mp4v2/rtphint.h +--- ../1/common/mp4v2/rtphint.h 2005-07-15 18:32:35.079371440 +0000 ++++ ./common/mp4v2/rtphint.h 2003-06-29 21:41:00.000000000 +0000 +@@ -35,8 +35,8 @@ + return m_pPacket; + } + ++ virtual u_int16_t GetDataSize() = 0; ++ virtual void GetData(u_int8_t* pDest) = 0; +- virtual u_int16_t GetDataSize() = NULL; +- virtual void GetData(u_int8_t* pDest) = NULL; + + MP4Track* FindTrackFromRefIndex(u_int8_t refIndex); + + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/libfaad2-0.install +++ vlc-0.8.6.release.d/extras/faad2/debian/libfaad2-0.install @@ -0,0 +1,2 @@ +debian/tmp/usr/lib/libfaad.so.* usr/lib +debian/tmp/usr/lib/libmp4ff.so.* usr/lib --- vlc-0.8.6.release.d.orig/extras/faad2/debian/changelog +++ vlc-0.8.6.release.d/extras/faad2/debian/changelog @@ -0,0 +1,90 @@ +faad2 (2.0.0+cvs20040908+mp4v2+bmp-0ubuntu5) gutsy; urgency=low + + * 10_libmp4_sample_check.diff: fixed SIGSEGV while listening to m4a + files (LP: 40043) + * Update Maintainer field in debian/control + + -- Luca Falavigna Tue, 12 Jun 2007 13:17:39 +0200 + +faad2 (2.0.0+cvs20040908+mp4v2+bmp-0ubuntu4) gutsy; urgency=low + + * rebuild for libgcc2 + + -- LaMont Jones Tue, 12 Jun 2007 06:53:25 -0600 + +faad2 (2.0.0+cvs20040908+mp4v2+bmp-0ubuntu3) dapper; urgency=low + + * 01_systems.h.diff: + + Fix the config.h include to mp4_config.h and copy config.h to + /usr/include/mp4_config.h. Bad bad upstream + + -- Sebastian Dröge Wed, 9 Nov 2005 18:42:24 +0100 + +faad2 (2.0.0+cvs20040908+mp4v2+bmp-0ubuntu2) breezy; urgency=low + + * Added libmp4-0 to Conflicts/Replaces for libmp4v2-0 + + -- Sebastian Dröge Sun, 9 Oct 2005 15:47:08 +0200 + +faad2 (2.0.0+cvs20040908+mp4v2+bmp-0ubuntu1) breezy; urgency=low + + * The "Go Open videos are playable now" release + * Sync from CVS (newest version we can ship because of license changes) + * Added bmp plugin and libmp4v2 to tarball + * Added autotools stuff to tarball + * Removed 01_bmp-plugin.diff, 02_Make.am.diff, 03_autoreconf.diff, + 05_option_w.diff, 08_amd64.diff + * Updated 09_amd64.diff + * Fixed the API to be compatible again with 2.0.0 + * libmp4ff isn't shipped by default anymore: for compatibility reasons we + ship it + + -- Sebastian Dröge Wed, 7 Sep 2005 12:25:29 +0200 + +faad2 (2.0.0clean-0ubuntu5) breezy; urgency=low + + * debian/patches/08_amd64.diff: + + removed some bogus stuff. Really works now on amd64 + + -- Sebastian Dröge Tue, 30 Aug 2005 17:20:22 +0200 + +faad2 (2.0.0clean-0ubuntu4) breezy; urgency=low + + * Added Replaces/Conflicts: libmp4 to libmp4v2 as Marillat calls it just + libmp4 and some users are using his repository + * debian/patches/08_amd64.diff: + + Some amd64 fixes from Marillat + * debian/patches/09_amd64-2.diff: + + Further amd64 fixes from Gentoo + + -- Sebastian Dröge Mon, 29 Aug 2005 23:49:34 +0200 + +faad2 (2.0.0clean-0ubuntu3) breezy; urgency=low + + * Add Replaces: libfaad2-0 (<< 2.0.0clean-0ubuntu2) to properly handle the + transition from -0ubuntu2 + + -- Matt Zimmerman Thu, 18 Aug 2005 19:12:36 -0700 + +faad2 (2.0.0clean-0ubuntu2) breezy; urgency=low + + * Added parameters for dh_makeshlibs to create + dependencies >= $UPSTREAM_VERSION + * Removed .so links from binary packages and moved them to the -dev ones + + -- Sebastian Dröge Thu, 18 Aug 2005 16:46:31 +0200 + +faad2 (2.0.0clean-0ubuntu1) breezy; urgency=low + + * Complete rewrite from scratch of marillat's package. Only package + descriptions are taken from marillat. + * Use a clean upstream tarball + * Include a patch which copies plugins/xmms to plugins/bmp and changes some + Makefiles to build a beep-media-player plugin + + Changes from Reinhard Tartler + + * fixed ftbfs with broken pure virtual methods decls + + -- Sebastian Dröge Thu, 07 Jun 2005 11:07:01 +0200 + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/rules +++ vlc-0.8.6.release.d/extras/faad2/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/simple-patchsys.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk + +DEB_CONFIGURE_EXTRA_FLAGS := --with-xmms --with-bmp --with-drm --with-mp4v2 --disable-mpeg4ip + +DEB_NOREVISION_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | \ + cut -f 2 -d ' ' | cut -f 1 -d '-') + +DEB_DH_MAKESHLIBS_ARGS_libfaad2-0 := -V"libfaad2-0 \ + (>= $(DEB_NOREVISION_VERSION))" +DEB_DH_MAKESHLIBS_ARGS_libmp4v2-0 := -V"libmp4v2-0 \ + (>= $(DEB_NOREVISION_VERSION))" + +DEB_SHLIBDEPS_INCLUDE := debian/libfaad2-0/usr/lib debian/libmp4v2-0/usr/lib + +configure/faad:: + ln -sf config.h mp4_config.h + +install/libmp4v2-dev:: + cp config.h debian/tmp/usr/include/mp4_config.h + +clean:: + rm -f mp4_config.h --- vlc-0.8.6.release.d.orig/extras/faad2/debian/bmp-mp4.install +++ vlc-0.8.6.release.d/extras/faad2/debian/bmp-mp4.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/bmp/Input/libmp4.* usr/lib/bmp/Input --- vlc-0.8.6.release.d.orig/extras/faad2/debian/libfaad2-dev.install +++ vlc-0.8.6.release.d/extras/faad2/debian/libfaad2-dev.install @@ -0,0 +1,6 @@ +debian/tmp/usr/lib/libfaad.a* usr/lib +debian/tmp/usr/lib/libfaad.so usr/lib +debian/tmp/usr/lib/libmp4ff.a* usr/lib +debian/tmp/usr/lib/libmp4ff.so usr/lib +debian/tmp/usr/include/faad.h usr/include +debian/tmp/usr/include/mp4ff.h usr/include --- vlc-0.8.6.release.d.orig/extras/faad2/debian/xmms-mp4.install +++ vlc-0.8.6.release.d/extras/faad2/debian/xmms-mp4.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/xmms/Input/libmp4.* usr/lib/xmms/Input --- vlc-0.8.6.release.d.orig/extras/faad2/debian/compat +++ vlc-0.8.6.release.d/extras/faad2/debian/compat @@ -0,0 +1 @@ +4 --- vlc-0.8.6.release.d.orig/extras/faad2/debian/faad.install +++ vlc-0.8.6.release.d/extras/faad2/debian/faad.install @@ -0,0 +1 @@ +debian/tmp/usr/bin usr --- vlc-0.8.6.release.d.orig/extras/faad2/debian/copyright +++ vlc-0.8.6.release.d/extras/faad2/debian/copyright @@ -0,0 +1,14 @@ +This package was debianized by Sebastian Dröge on +Thu, 07 Jul 2005 11:15:41 +0200. + +It was downloaded from http://www.audiocoding.com + +Upstream Authors: menno (menno@audiocoding.com) + Alexander Kurpiers (a.kurpiers@nt.tu-darmstadt.de) + +Copyright: + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License Version 2, found on + Debian systems in the file /usr/share/common-licenses/GPL. + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/libmp4v2-dev.install +++ vlc-0.8.6.release.d/extras/faad2/debian/libmp4v2-dev.install @@ -0,0 +1,3 @@ +debian/tmp/usr/lib/libmp4v2.a* usr/lib +debian/tmp/usr/lib/libmp4v2.so usr/lib +debian/tmp/usr/include/{mp4,mpeg4ip,systems,mp4_config}.h usr/include --- vlc-0.8.6.release.d.orig/extras/faad2/debian/control +++ vlc-0.8.6.release.d/extras/faad2/debian/control @@ -0,0 +1,84 @@ +Source: faad2 +Section: libs +Priority: optional +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Sebastian Dröge +Build-Depends: debhelper (>= 4.1.0), cdbs, libsndfile1-dev, xmms-dev, beep-media-player-dev, libid3-dev +Standards-Version: 3.6.2 + +Package: libfaad2-0 +Architecture: any +Depends: ${shlibs:Depends} +Description: freeware Advanced Audio Decoder - runtime files + FAAD2 is the fastest ISO AAC audio decoder available. FAAD2 correctly + decodes all MPEG-4 and MPEG-2 MAIN, LOW, LTP, LD and ER object type AAC + files. + +Package: libfaad2-dev +Section: libdevel +Architecture: any +Depends: libfaad2-0 (= ${Source-Version}), libc6-dev | libc-dev +Replaces: libfaad2-0 (<< 2.0.0clean-0ubuntu2) +Description: freeware Advanced Audio Decoder - development files + FAAD2 is the fastest ISO AAC audio decoder available. FAAD2 correctly + decodes all MPEG-4 and MPEG-2 MAIN, LOW, LTP, LD and ER object type AAC + files. + . + This package contains development files. + +Package: libmp4v2-0 +Architecture: any +Depends: ${shlibs:Depends} +Replaces: libmp4, libmp4-0 +Conflicts: libmp4, libmp4-0 +Description: MP4 container library - runtime files + FAAD2 is the fastest ISO AAC audio decoder available. FAAD2 correctly + decodes all MPEG-4 and MPEG-2 MAIN, LOW, LTP, LD and ER object type AAC + files. + . + This package contains runtime files of the optional library for + accessing MP4 files. Needed by the player plugins. + +Package: libmp4v2-dev +Section: libdevel +Architecture: any +Depends: libmp4v2-0 (= ${Source-Version}), libc6-dev | libc-dev +Description: MP4 container library - development files + FAAD2 is the fastest ISO AAC audio decoder available. FAAD2 correctly + decodes all MPEG-4 and MPEG-2 MAIN, LOW, LTP, LD and ER object type AAC + files. + . + This package contains development files of the optional library for + accessing MP4 files. Needed by the player plugins. + +Package: faad +Section: sound +Architecture: any +Depends: ${shlibs:Depends} +Description: freeware Advanced Audio Decoder player + FAAD2 is the fastest ISO AAC audio decoder available. FAAD2 correctly + decodes all MPEG-4 and MPEG-2 MAIN, LOW, LTP, LD and ER object type AAC + files. + . + This package contains a binary to play AAC or MP4 files. + +Package: xmms-mp4 +Section: sound +Architecture: any +Depends: ${shlibs:Depends} +Description: a mp4/aac audio player for xmms + This plugin is a merge between aac and mp4 plugin. so now you could read + all new and old files encoded with different encoder and different format + (for the aac part). This is possible since the libfaad2 allow to read old + aac ADTS format. + +Package: bmp-mp4 +Section: sound +Architecture: any +Depends: ${shlibs:Depends} +Description: a mp4/aac audio player for bmp + This plugin is a merge between aac and mp4 plugin. so now you could read + all new and old files encoded with different encoder and different format + (for the aac part). This is possible since the libfaad2 allow to read old + aac ADTS format. + --- vlc-0.8.6.release.d.orig/extras/faad2/debian/libmp4v2-0.install +++ vlc-0.8.6.release.d/extras/faad2/debian/libmp4v2-0.install @@ -0,0 +1,2 @@ +debian/tmp/usr/lib/libmp4v2.so.* usr/lib + --- vlc-0.8.6.release.d.orig/debian/patches/010_no-wx-updates.diff +++ vlc-0.8.6.release.d/debian/patches/010_no-wx-updates.diff @@ -0,0 +1,15 @@ +Index: vlc-0.8.5-test3.debian/modules/gui/wxwidgets/interface.cpp +=================================================================== +--- vlc-0.8.5-test3.debian.orig/modules/gui/wxwidgets/interface.cpp 2006-04-19 09:25:08.000000000 +0200 ++++ vlc-0.8.5-test3.debian/modules/gui/wxwidgets/interface.cpp 2006-04-24 16:21:44.000000000 +0200 +@@ -603,8 +603,8 @@ + /* Create the "Help" menu */ + wxMenu *help_menu = new wxMenu; + help_menu->Append( About_Event, wxU(_("About...")) ); +- help_menu->AppendSeparator(); +- help_menu->Append( UpdateVLC_Event, wxU(_("Check for Updates...")) ); ++// help_menu->AppendSeparator(); ++// help_menu->Append( UpdateVLC_Event, wxU(_("Check for Updates...")) ); + + /* Append the freshly created menus to the menu bar... */ + wxMenuBar *menubar = new wxMenuBar(); --- vlc-0.8.6.release.d.orig/debian/patches/000_ltmain.diff +++ vlc-0.8.6.release.d/debian/patches/000_ltmain.diff @@ -0,0 +1,13 @@ +Index: vlc-0.8.6-svn20060823.debian/autotools/ltmain.sh +=================================================================== +--- vlc-0.8.6-svn20060823.debian.orig/autotools/ltmain.sh 2006-08-24 12:34:26.000000000 +0200 ++++ vlc-0.8.6-svn20060823.debian/autotools/ltmain.sh 2006-08-24 12:36:02.000000000 +0200 +@@ -5927,7 +5927,7 @@ + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. +- if test "$inst_prefix_dir" = "$destdir"; then ++ if test "$inst_prefix_dir$libdir" != "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi --- vlc-0.8.6.release.d.orig/debian/patches/020_dejavu_font.diff +++ vlc-0.8.6.release.d/debian/patches/020_dejavu_font.diff @@ -0,0 +1,13 @@ +Index: vlc-0.8.5-test3.debian/modules/misc/freetype.c +=================================================================== +--- vlc-0.8.5-test3.debian.orig/modules/misc/freetype.c 2006-04-24 18:20:14.000000000 +0200 ++++ vlc-0.8.5-test3.debian/modules/misc/freetype.c 2006-04-24 18:20:21.000000000 +0200 +@@ -55,7 +55,7 @@ + #elif defined( WIN32 ) + #define DEFAULT_FONT "" /* Default font found at run-time */ + #else +-#define DEFAULT_FONT "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf" ++#define DEFAULT_FONT "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf" + #endif + + #if defined(HAVE_FRIBIDI) --- vlc-0.8.6.release.d.orig/debian/patches/010_osdmenu-paths.diff +++ vlc-0.8.6.release.d/debian/patches/010_osdmenu-paths.diff @@ -0,0 +1,33 @@ +Index: vlc-0.8.5-test3.debian/share/osdmenu/default.cfg +=================================================================== +--- vlc-0.8.5-test3.debian.orig/share/osdmenu/default.cfg 2006-04-19 09:25:02.000000000 +0200 ++++ vlc-0.8.5-test3.debian/share/osdmenu/default.cfg 2006-04-24 16:21:46.000000000 +0200 +@@ -1,4 +1,4 @@ +-dir share/osdmenu/default ++dir /usr/share/vlc/osdmenu/default + action key-play-pause (0,0) + unselect unselected.png + select selection/play_pause.png +Index: vlc-0.8.5-test3.debian/share/osdmenu/dvd.cfg +=================================================================== +--- vlc-0.8.5-test3.debian.orig/share/osdmenu/dvd.cfg 2006-04-19 09:25:02.000000000 +0200 ++++ vlc-0.8.5-test3.debian/share/osdmenu/dvd.cfg 2006-04-24 16:21:46.000000000 +0200 +@@ -1,4 +1,4 @@ +-dir share/osdmenu/dvd ++dir /usr/share/vlc/osdmenu/dvd + action key-play (0,0) + unselect unselect/barroff.png + select selection/play.png +Index: vlc-0.8.5-test3.debian/modules/video_filter/osdmenu.c +=================================================================== +--- vlc-0.8.5-test3.debian.orig/modules/video_filter/osdmenu.c 2006-04-19 09:25:11.000000000 +0200 ++++ vlc-0.8.5-test3.debian/modules/video_filter/osdmenu.c 2006-04-24 16:21:46.000000000 +0200 +@@ -92,7 +92,7 @@ + #if defined( WIN32 ) || defined( UNDER_CE ) + #define OSD_DEFAULT_CFG "osdmenu/default.cfg" + #else +-#define OSD_DEFAULT_CFG "share/osdmenu/default.cfg" ++#define OSD_DEFAULT_CFG "/usr/share/vlc/osdmenu/default.cfg" + #endif + + #define OSD_UPDATE_MIN 0 --- vlc-0.8.6.release.d.orig/debian/patches/020_certificates_paths.diff +++ vlc-0.8.6.release.d/debian/patches/020_certificates_paths.diff @@ -0,0 +1,15 @@ +Index: vlc-trunk/modules/misc/gnutls.c +=================================================================== +--- vlc-trunk/modules/misc/gnutls.c (revision 15766) ++++ vlc-trunk/modules/misc/gnutls.c (working copy) +@@ -614,6 +614,10 @@ + p_sys->x509_cred, psz_path, VLC_FALSE ); + free( psz_path ); + } ++ gnutls_Addx509File( (vlc_object_t *)p_session, ++ p_sys->x509_cred, ++ "/etc/ssl/certs/ca-certificates.crt",VLC_FALSE ); ++ + p_session->pf_handshake2 = gnutls_HandshakeAndValidate; + } + else --- vlc-0.8.6.release.d.orig/debian/patches/020_notify.diff +++ vlc-0.8.6.release.d/debian/patches/020_notify.diff @@ -0,0 +1,11 @@ +--- vlc-0.8.6/modules/misc/notify.c 2006-12-08 20:12:16.000000000 -0500 ++++ vlc-0.8.6.release/modules/misc/notify.c 2006-12-15 21:07:30.000000000 -0500 +@@ -205,7 +205,7 @@ + NotifyNotification * notification; + notification = notify_notification_new( _("Now Playing"), + psz_temp, +- DATA_PATH "/vlc48x48.png",NULL); ++ "/usr/share/pixmaps/vlc.png",NULL); + notify_notification_set_timeout( notification, + config_GetInt(p_this, "notify-timeout") ); + notify_notification_set_urgency( notification, NOTIFY_URGENCY_LOW ); --- vlc-0.8.6.release.d.orig/debian/patches/021_CVE-2008-0984.diff +++ vlc-0.8.6.release.d/debian/patches/021_CVE-2008-0984.diff @@ -0,0 +1,17 @@ +Index: vlc/modules/demux/mp4/mp4.c +=================================================================== +--- vlc/modules/demux/mp4/mp4.c (revision 24943) ++++ vlc/modules/demux/mp4/mp4.c (revision 24944) +@@ -1151,6 +1151,12 @@ + for( i_chunk = p_stsc->data.p_stsc->i_first_chunk[i_index] - 1; + i_chunk < i_last; i_chunk++ ) + { ++ if( i_chunk >= p_demux_track->i_chunk_count ) ++ { ++ msg_Warn( p_demux, "corrupted chunk table" ); ++ return VLC_EGENERIC; ++ } ++ + p_demux_track->chunk[i_chunk].i_sample_description_index = + p_stsc->data.p_stsc->i_sample_description_index[i_index]; + p_demux_track->chunk[i_chunk].i_sample_count = --- vlc-0.8.6.release.d.orig/debian/patches/022_no_cpu_consumption.diff +++ vlc-0.8.6.release.d/debian/patches/022_no_cpu_consumption.diff @@ -0,0 +1,32 @@ +Index: vlc-0.8.6.release.d/modules/control/rc.c +=================================================================== +--- vlc-0.8.6.release.d.orig/modules/control/rc.c 2008-03-06 21:51:00.008658499 +0100 ++++ vlc-0.8.6.release.d/modules/control/rc.c 2008-03-06 21:51:52.439409619 +0100 +@@ -141,8 +141,12 @@ + + if( p_intf->p_sys->i_socket == -1 ) + { +- utf8_vfprintf( stdout, psz_fmt, args ); +- printf( "\r\n" ); ++ if (!config_GetInt( p_intf, "rc-fake-tty" )) ++ { ++ utf8_vfprintf( stdout, psz_fmt, args ); ++ printf( "\r\n" ); ++ } ++ + } + else + { +@@ -2297,6 +2301,12 @@ + } + #endif + ++ if (p_intf->p_sys->i_socket == -1 && config_GetInt( p_intf, "rc-fake-tty" )) ++ { ++ msleep( INTF_IDLE_SLEEP ); ++ return VLC_FALSE; ++ } ++ + while( !p_intf->b_die && *pi_size < MAX_LINE_LENGTH && + (i_read = net_ReadNonBlock( p_intf, p_intf->p_sys->i_socket == -1 ? + 0 /*STDIN_FILENO*/ : p_intf->p_sys->i_socket, NULL, --- vlc-0.8.6.release.d.orig/debian/patches/series +++ vlc-0.8.6.release.d/debian/patches/series @@ -0,0 +1,9 @@ +000_ltmain.diff +#010_no-wx-updates.diff +010_osdmenu-paths.diff +#020_xulrunner.diff +020_dejavu_font.diff +020_notify.diff +020_certificates_paths.diff +021_CVE-2008-0984.diff +022_no_cpu_consumption.diff --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-esd.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-esd.install @@ -0,0 +1 @@ +usr/lib/vlc/audio_output/libesd_plugin.so --- vlc-0.8.6.release.d.orig/debian/vlc.mime +++ vlc-0.8.6.release.d/debian/vlc.mime @@ -0,0 +1,43 @@ +video/mpeg; vlc %s; description="MPEG Video"; test=test -n "$DISPLAY"; priority=7 +video/mpeg; vlc -I rc -V caca %s; needsterminal; description="MPEG Video"; priority=4 +video/x-mpeg; vlc %s; description="MPEG Video"; test=test -n "$DISPLAY"; priority=7 +video/x-mpeg; vlc -I rc -V caca %s; needsterminal; description="MPEG Video"; priority=4 +video/mpeg-system; vlc %s; description="MPEG Video"; test=test -n "$DISPLAY"; priority=7 +video/mpeg-system; vlc -I rc -V caca %s; needsterminal; description="MPEG Video"; priority=4 +video/x-mpeg-system; vlc %s; description="MPEG Video"; test=test -n "$DISPLAY"; priority=7 +video/x-mpeg-system; vlc -I rc -V caca %s; needsterminal; description="MPEG Video"; priority=4 + +audio/x-wav; vlc %s; description="WAV Audio"; nametemplate=%s.wav; test=test -n "$DISPLAY"; priority=7 +audio/x-wav; vlc -I rc -V caca %s; nametemplate=%s.wav; needsterminal; description="WAV Audio"; priority=4 + +video/mpeg4; vlc %s; description="MPEG-4 Video"; test=test -n "$DISPLAY"; priority=7 +video/mpeg4; vlc -I rc -V caca %s; needsterminal; description="MPEG-4 Video"; priority=4 +audio/mpeg; vlc %s; description="MPEG Audio"; nametemplate=%s.mpg; test=test -n "$DISPLAY"; priority=7 +audio/mpeg; vlc -I rc -V caca %s; nametemplate=%s.mpg; needsterminal; description="MPEG Audio"; priority=4 +audio/mpegurl; vlc %s; description="MPEG Audio URL"; nametemplate=%s.m3u; test=test -n "$DISPLAY"; priority=7 +audio/mpegurl; vlc -I rc -V caca %s; nametemplate=%s.m3u; needsterminal; description="MPEG Audio URL"; priority=4 +audio/x-mp3; vlc %s; nametemplate=%s.mp3; description="MPEG Audio"; test=test -n "$DISPLAY"; priority=7 +audio/x-mp3; vlc -I rc -V caca %s; nametemplate=%s.mp3; needsterminal; description="MPEG Audio"; priority=4 +audio/mpeg4; vlc %s; description="MPEG-4 Audio"; test=test -n "$DISPLAY"; priority=7 +audio/mpeg4; vlc -I rc -V caca %s; needsterminal; description="MPEG-4 Audio"; priority=4 +application/mpeg4-iod; vlc %s; description="MPEG-4 Video"; test=test -n "$DISPLAY"; priority=7 +application/mpeg4-iod; vlc -I rc -V caca %s; needsterminal; description="MPEG-4 Video"; priority=4 +application/mpeg4-muxcodetable; vlc %s; description="MPEG-4 Video"; test=test -n "$DISPLAY"; priority=7 +application/mpeg4-muxcodetable; vlc -I rc -V caca %s; needsterminal; description="MPEG-4 Video"; priority=4 + +video/x-msvideo; vlc %s; description="MS Video (AVI)"; test=test -n "$DISPLAY"; priority=4 +video/x-msvideo; vlc -I rc -V caca %s; needsterminal; description="MS Video (AVI)"; priority=3 + +video/quicktime; vlc %s; description="Apple Quicktime Video"; test=test -n "$DISPLAY"; priority=4 +video/quicktime; vlc -I rc -V caca %s; needsterminal; description="Apple Quicktime Video"; priority=3 + +application/ogg; vlc %s; nametemplate=%s.ogg; description="Ogg stream"; test=test -n "$DISPLAY"; priority=4 +application/ogg; vlc -I rc -V caca %s; nametemplate=%s.ogg; needsterminal; description="Ogg stream"; priority=3 +application/x-ogg; vlc %s; nametemplate=%s.ogg; description="Ogg stream"; test=test -n "$DISPLAY"; priority=4 +application/x-ogg; vlc -I rc -V caca %s; nametemplate=%s.ogg; needsterminal; description="Ogg stream"; priority=3 + +application/x-ms-asf-plugin; vlc %s; description="Windows Media Video"; test=test -n "$DISPLAY"; priority=4 +application/x-ms-asf-plugin; vlc -I rc -V caca %s; needsterminal; description="Windows Media Video"; priority=3 +application/x-mplayer2; vlc %s; description="Windows Media"; test=test -n "$DISPLAY"; priority=4 +application/x-mplayer2; vlc -I rc -V caca %s; needsterminal; description="Windows Media"; priority=3 + --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-glide.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-glide.dirs @@ -0,0 +1,2 @@ +usr/lib/vlc/video_output +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-esd.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-esd.dirs @@ -0,0 +1,2 @@ +usr/lib/vlc/audio_output +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-ggi.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-ggi.install @@ -0,0 +1 @@ +usr/lib/vlc/video_output/libggi_plugin.so --- vlc-0.8.6.release.d.orig/debian/changelog +++ vlc-0.8.6.release.d/debian/changelog @@ -0,0 +1,1734 @@ +vlc (0.8.6.release.d-0ubuntu5) hardy; urgency=low + + * debian/patches/022_no_cpu_consumption.diff: (LP: #104698) + - Fix CPU consumption when fake-tty mode is enabled + Thx to bma (No Real Name) for providing the patch + + -- Stephan Hermann Thu, 06 Mar 2008 21:53:50 +0100 + +vlc (0.8.6.release.d-0ubuntu4) hardy; urgency=low + + [ Emanuele Gentili ] + * SECURITY UPDATE: + - debian/patches/021_CVE-2008-0984.diff (LP: #195949) + + VLC media player's MPEG-4 file format parser (a.k.a. the MP4 demuxer) suffers + from an arbitrary memory overwrite vulnerability when using crash the player + instance. + + * References + - http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-0984 + - http://www.videolan.org/security/sa0802.html + + [ Mario Limonciello ] + * debian/control: + - Build debian on libxul-dev instead of firefox-dev + * debian/rules: + - Use xulrunner-config rather than firefox-config (LP: #194907) + + -- Emanuele Gentili Wed, 27 Feb 2008 00:33:06 +0100 + +vlc (0.8.6.release.d-0ubuntu3) hardy; urgency=low + + * When building on amd64, build x264 specifically with --enable-pic. + + -- Mario Limonciello Thu, 06 Dec 2007 10:53:42 -0600 + +vlc (0.8.6.release.d-0ubuntu2) hardy; urgency=low + + [ Matt Lindell ] + * Add jack plugin to vlc-nox package. (LP: #173391) + + [ Mario Limonciello ] + * Loosen dependencies on libcaca and libvcdinfo. + + -- Mario Limonciello Wed, 05 Dec 2007 01:05:24 -0600 + +vlc (0.8.6.release.d-0ubuntu1) hardy; urgency=low + + * New upstream version. (LP: #173550) + - Fixes ALSA/SPDIF. (LP: #153641) + * Build with JACK support. (LP: #151895) + * debian/rules: + - Add a get-orig-source target for easily rebuilding with current + x264 and faad2. + * Rebuild with faad2 2.0.0+cvs20040908+mp4v2+bmp-0ubuntu5. + * Rebuild with x264 1:0.svn20070930-0.0ubuntu2. + * debian/control: + - Add subversion to build dependencies to allow version checking + during build identification. + - Add libjack-dev to build dependencies + - Make sure we depend on libcaca >=0.99.beta13b-2 to prevent a FTBFS. + - Make sure we depend on libvcdinfo >=0.7.23-4ubuntu1 to prevent a FTBFS. + * Disable 010_no-wx-updates.diff patch, upstream has disabled update + checking for now already. + * Drop 030_fix_exec_field_code.diff patch, because upstream has added + support for files and URLs directly from calling the vlc binary. + * Fix lintian warning for debian-rules-ignores-make-clean-error. + * Fix lintian warning for substvar-source-version-is-deprecated. + + -- Mario Limonciello Sun, 02 Dec 2007 15:41:50 -0600 + +vlc (0.8.6.release.c-0ubuntu5) gutsy; urgency=low + + * Add patch 030_fix_exec_field_code: + - fix opening multiple files leads to multiple instances (LP: #124712) + + -- Cesare Tirabassi Mon, 08 Oct 2007 23:41:44 +0200 + +vlc (0.8.6.release.c-0ubuntu4) gutsy; urgency=low + + * Move firefox plugin into /usr/lib/firefox. (LP: #99810) + * Don't attempt to install a symlink for firefox to vlcintf.xpt - it doesn't + exist any more. + + -- William Grant Sat, 06 Oct 2007 15:54:55 +1000 + +vlc (0.8.6.release.c-0ubuntu3) gutsy; urgency=low + + * Fix typo error in .desktop file (LP: #131691) + + -- Vincent Legout Sat, 11 Aug 2007 17:55:19 +0200 + +vlc (0.8.6.release.c-0ubuntu2) gutsy; urgency=low + + * debian/control: added Xb-Npp-xxx tags accordingly to "firefox distro + add-on suport" spec, + (https://blueprints.launchpad.net/ubuntu/+spec/firefox-distro-addon-support) + + -- Hilario Montoliu Mon, 25 Jun 2007 16:28:20 +0200 + +vlc (0.8.6.release.c-0ubuntu1) gutsy; urgency=low + + * SECURITY UPDATE: Format string injection in multiple plugins could + lead to arbitrary code execution and/or DoS. + * New upstream security and bugfix release, 0.8.6c (LP: #121511). + * References + CVE-2007-0256 + CVE-2007-3316 + * debian/patches/: Remove 020_flac.diff and 030_CVE-2007-0017.diff + (subsumed by new upstream release). + * debian/vlc-nox.install: Add libtelx_plugin.so (fixes FTBFS). + + -- Daniel T Chen Mon, 25 Jun 2007 01:53:37 -0400 + +vlc (0.8.6.release-0ubuntu5) gutsy; urgency=low + + * debian/patches/020_flac.diff: + - Patch from upstream trunk to fix FTBFS with libflac8 + (http://trac.videolan.org/vlc/changeset/18855) + + -- Matti Lindell Sun, 10 Jun 2007 17:06:18 +0300 + +vlc (0.8.6.release-0ubuntu4) feisty; urgency=low + + * debian/control: Revert back to building against libwxgtk2.6-dev + (Closes LP: #91248) + + -- Luke Yelavich Tue, 20 Mar 2007 16:32:06 +1100 + +vlc (0.8.6.release-0ubuntu3) feisty; urgency=low + + * debian/control: Work around LP #91086. + + -- Daniel T Chen Sat, 10 Mar 2007 05:13:52 -0500 + +vlc (0.8.6.release-0ubuntu2) feisty; urgency=low + + * debian/control: + - Adhere to DebianMaintainerField, + - Build against libwxgtk2.8-dev, Closes: + LP: #54548 + LP: #84098 + * debian/patches: Add 030_CVE-2007-0017.diff to quilt's series + - Reference: CVE-2007-0017 + + -- Daniel T Chen Fri, 9 Mar 2007 22:10:50 -0500 + +vlc (0.8.6.release-0ubuntu1) feisty; urgency=low + + * New upstream release (0.8.6): + - Autostart in mozilla plugin reenabled (Closes Ubuntu: #67402), + - ffmpeg demux fixed (Closes Ubuntu: #69849), + - Segfault with SAP playlist announcement loading fixed + (Closes Ubuntu: #70664). + * debian/patches/020_notify.diff: Rediff. + + -- Daniel T Chen Fri, 15 Dec 2006 20:57:59 -0500 + +vlc (0.8.6-svn20061012.debian-1ubuntu1) edgy; urgency=low + + * Merge from Debian unstable, remaining Ubuntu changes: + - debian/control: Don't build-depend on libtwolame-dev, a newer + version of libcaca-dev, or linux-kernel-headers (Ubuntu Edgy + does not have them), + - debian/patches/001_1008snap.{fixes,translations}.diff: Remove, + this is a new upstream version, fixes FTBFS on translations, + - debian/rules: Use Ubuntu-specific configure options (firefox). + * New upstream snapshot fixes wxvlc not stopping when 'close + button' is clicked (Closes Ubuntu: #54630). + * New upstream snapshot has more robust x264 support + (Closes: Ubuntu #62217). + * Segfault when using HTTP interface was fixed in + 0.8.6-svn20060918.debian-1ubuntu4 (Closes Ubuntu: #63833). + * New upstream snapshot should resolve issues with skins2/wxw + interfaces (Closes: Ubuntu #64975). + + -- Daniel T Chen Wed, 18 Oct 2006 01:31:36 -0400 + +vlc (0.8.6-svn20061012.debian-1) unstable; urgency=low + + * New upstream SVN snapshot. + * Upstream fixed the BadWindow request issue (Closes: #392207). + + -- Sam Hocevar (Debian packages) Thu, 12 Oct 2006 20:43:45 +0200 + +vlc (0.8.6-svn20061008.debian-1) unstable; urgency=high + + * New upstream SVN snapshot. Fixes a heap smashing bug. + * debian/control: + + Build-depend on libgtk2.0-dev to work around #388521 (Closes: #391739). + + Replace XS-X-Vcs-Svn with -XS-Vcs-Svn. + + * debian/patches/020_notify.diff: + + Fix notify support. Thanks to Christophe Mutricy. + + -- Sam Hocevar (Debian packages) Sun, 8 Oct 2006 18:54:30 +0200 + +vlc (0.8.6-svn20061001.debian-4) unstable; urgency=low + + * Build-depend on libnotify and explicitly activate the libnotify plugin + (Closes: #391308). + * Re-enable DV support. libraw1394 is not waiting for us anyway. + + -- Sam Hocevar (Debian packages) Fri, 6 Oct 2006 10:24:26 +0200 + +vlc (0.8.6-svn20061001.debian-2) unstable; urgency=high + + * Temporarily disable DV support because the libraw1394 transition does + not look like it will happen soon. + + -- Sam Hocevar (Debian packages) Wed, 4 Oct 2006 14:00:16 +0200 + +vlc (0.8.6-svn20061001.debian-1) unstable; urgency=low + + * New upstream SVN snapshot. + + -- Sam Hocevar (Debian packages) Sun, 1 Oct 2006 17:57:57 +0200 + +vlc (0.8.6-svn20060925.debian-1) unstable; urgency=low + + [ Sam Hocevar ] + * New upstrean SVN snapshot. + * This release fixes issues with the French Freebox device (Closes: #388332). + + * debian/control: + + Added Clément Stenac to the uploaders. + + * 020_certificates_paths.diff: + + New patch from upstream that looks for SSL certificates in + /etc/ssl/certs/ca-certificates.crt (Closes: #365239). + + [ Clément Stenac ] + * Add VCS information to control + + -- Sam Hocevar (Debian packages) Mon, 25 Sep 2006 14:00:46 +0200 + +vlc (0.8.6-svn20060918.debian-1ubuntu4) edgy; urgency=low + + * Backport fixes from Debian's 10/08 snapshot, fixing heap smashing + with HTTP interface (Closes Ubuntu: #63833), + * Realign packaging with Debian's 10/08 snapshot, updating rules + and *.install, + * Correct previous changelog entry that erroneously marked Ubuntu + #62856 as resolved. + + -- Daniel T Chen Mon, 9 Oct 2006 15:46:37 -0400 + +vlc (0.8.6-svn20060918.debian-1ubuntu3) edgy; urgency=low + + * Backport fixes from Debian's 09/25 snapshot, fixing failure to + read rtsp streams from Freebox (Closes Ubuntu: #63135). + + -- Daniel T Chen Sat, 30 Sep 2006 22:07:46 -0400 + +vlc (0.8.6-svn20060918.debian-1ubuntu2) edgy; urgency=low + + * debian/rules: Remove --enable-dmo --enable-loader from i386 + $(vlc_confflags). With the dh_install -si --fail-missing + semantics, arch-specific exceptions aren't possible. Fixes + FTBFS on i386. + + -- Daniel T Chen Sun, 24 Sep 2006 19:08:38 -0400 + +vlc (0.8.6-svn20060918.debian-1ubuntu1) edgy; urgency=low + + * Merge from Debian unstable. The following Ubuntu changes remain: + - debian/control: + + Build-Depend on firefox-dev, not libxul-dev and xulrunner, + + Build-Depend on linux-libc-dev, not linux-kernel-headers, + + Remove libtwolame-dev (not in Ubuntu) from Build-Depends, + + Loosen build-dependency for libcaca-dev to (>= 0.9), + NOTE: This change may result in subpar colour ASCII + rendering. Please see http://bugs.debian.org/385174 for + rationale, + + Set the maintainer field to + MOTU Media Team (we're responsible + for Ubuntu vlc breakage, not Debian), =) + - debian/rules: + + Retain UBUNTU_ENV, still using firefox, + + Add --enable-dmo --enable-loader to $(vlc_confflags) on i386, + allowing use of proprietary codecs, + + Remove --enable-twolame (see above change to debian/control). + + -- Daniel T Chen Sun, 24 Sep 2006 01:04:58 -0400 + +vlc (0.8.6-svn20060918.debian-1) unstable; urgency=low + + * New upstream SVN snapshot, with a slightly saner version number. + * debian/rules: + + Call dh_install with -si so that it does not try to install files that + are not for us (Closes: #387873). + + -- Sam Hocevar (Debian packages) Mon, 18 Sep 2006 12:38:26 +0200 + +vlc (0.8.6-svn20060911.0.8.5-1-svn.debian-5) unstable; urgency=low + + * debian/control: + + Added proper conflicts/replaces to the libvlc0 package because it + overwrites files from old vlc packages (Closes: #387844). + + -- Sam Hocevar (Debian packages) Sun, 17 Sep 2006 01:38:24 +0200 + +vlc (0.8.6-svn20060911.0.8.5-1-svn.debian-4) unstable; urgency=low + + * debian/control: + + Add libsdl-image1.2-dev to the build-dependencies. + + Shorten short descriptions and add “without X support” to the vlc-nox + short description. + + -- Sam Hocevar (Debian packages) Sat, 16 Sep 2006 20:08:53 +0200 + +vlc (0.8.6-svn20060911.0.8.5-1-svn.debian-3) unstable; urgency=low + + * debian/control: + + Distribute libvlc0 in a separate package. + + Created vlc-nox package that contains VLC and all its non-X related + plugins. + * debian/rules: + + Use dh_install. + + Bail out with an error if a plugin from vlc-nox got linked to libX11. + + -- Sam Hocevar (Debian packages) Thu, 14 Sep 2006 18:39:59 +0200 + +vlc (0.8.6-svn20060911.0.8.5-1-svn.debian-2) unstable; urgency=low + + * debian/patches/000_dup_builtins.diff: + + Fix a powerpc FTBFS due to duplicate libraries in link lines. + + -- Sam Hocevar (Debian packages) Mon, 11 Sep 2006 18:32:04 +0200 + +vlc (0.8.6-svn20060911.0.8.5-1-svn.debian-1) unstable; urgency=low + + * New upstream SVN snapshot, fixes an amd64 FTBFS. + + -- Sam Hocevar (Debian packages) Mon, 11 Sep 2006 13:56:19 +0200 + +vlc (0.8.6-svn20060910.0.8.5-1-svn.debian-1) unstable; urgency=low + + * New upstream SVN snapshot, from the forthcoming 0.8.5-1 branch. + * This branch's playlist window does not crash like the 0.8.6 does + (Closes: #375213, #385036, #384869). + + * Upstream fixed implicit pointer functions (Closes: #385192). + * Upstream's x264 build system now uses config.guess instead of uname to + detect system and CPU types (Closes: #385535). + * Upstream removed debug messages from the ts plugin (Closes: #385008, + Closes: #385323). + * Aspect ration in mkv files was fixed (Closes: #385876). + + * debian/control: + + Build-depend on libcaca-dev (>= 0.99.beta4-1) so that we no longer pull + useless build dependencies (Closes: #385536). + + Have VLC depend on ttf-dejavu again. It's used for subtitles and the + default skin. + * debian/copyright: + + Full copyright holders and license audit (Closes: #324978). + * debian/rules: + + No longer install old copyright files (Closes: #385200). + + Re-activated the speex module (Closes: #386204). + + Don't install TTF fonts, use the ones from ttf-dejavu instead. + + * debian/patches/020_freetype_font.diff: + + Renamed this patch into 020_dejavu_font.diff and made it use dejavu + fonts. + + -- Sam Hocevar (Debian packages) Sun, 10 Sep 2006 19:02:17 +0200 + +vlc (0.8.6-svn20060823.debian-3ubuntu1) edgy; urgency=low + + * Merge from Debian unstable. The remaining Ubuntu changes are: + - debian/control: + + Build-Depend on firefox-dev, not libxul-dev and xulrunner, + + Build-Depend on linux-libc-dev, not linux-kernel-headers, + + Remove libtwolame-dev (not in Ubuntu) from Build-Depends, + + Loosen build-dependency for libcaca-dev to (>= 0.9), + NOTE: This change may result in subpar colour ASCII + rendering. Please see http://bugs.debian.org/385174 for + rationale, + + Set the maintainer field to + MOTU Media Team (we're responsible + for Ubuntu vlc breakage, not Debian), =) + - debian/patches/21_gnome-screensaver-support.dpatch: Drop. + Upstream has merged a version using DBUS. + - debian/rules: + + Retain UBUNTU_ENV, still using firefox, + + Add --enable-dmo --enable-loader to $(vlc_confflags) on i386, + allowing use of proprietary codecs, + + Remove --enable-twolame (see above change to debian/control), + * Fix installation of .desktop file (closes Ubuntu: #53471). + + -- Daniel T Chen Sat, 26 Aug 2006 00:38:20 +0100 + +vlc (0.8.6-svn20060823.debian-3) unstable; urgency=low + + * debian/control: + + Added missing build-dep on libdc1394-13-dev (Closes: #384568, #384582). + + Build-depend on a newer libcaca for better colour ASCII rendering. + + -- Sam Hocevar (Debian packages) Fri, 25 Aug 2006 11:19:00 +0200 + +vlc (0.8.6-svn20060823.debian-2) unstable; urgency=low + + * debian/control: + + Added missing build-dep on libraw1394-dev. + * debian/rules: + + Replaced --enable-livedotcom with --enable-live555. + + -- Sam Hocevar (Debian packages) Fri, 25 Aug 2006 09:37:47 +0200 + +vlc (0.8.6-svn20060823.debian-1) unstable; urgency=low + + * New upstream SVN snapshot. + * debian/rules: + + Distribute a shared version of libvlc. + + Activated the twolame encoder. + * debian/control: + + Build-depend on a newer libavcodec so as to get WMV3 decoding support. + + Cleaned up package dependencies a bit. + + * debian/patches/000_ltmain.diff: + + Work around libtool not wanting to install our plugins. + + -- Sam Hocevar (Debian packages) Thu, 24 Aug 2006 18:06:12 +0200 + +vlc (0.8.5.debian-2ubuntu1) edgy; urgency=low + + * Merge from debian unstable: + - debian/control: Build-Depend on firefox-dev, not libxul-dev and + xulrunner. + - debian/patches/: + + 01_libhal_api-libvlc.c.dpatch: Drop, integrated upstream. + + 020_xulrunner.diff: Disable, still using firefox. + + 21_gnome-screensaver-support.dpatch: Retain. + + 22_avahi_client_0.6_api.dpatch: Drop, integrated upstream. + + 24_prefs_stacking_fix.dpatch: Drop, backported from now-current + upstream. + - debian/rules: + + Retain UBUNTU_ENV, still using firefox. + + Add --enable-dmo --enable-loader to $(vlc_confflags) on i386, + allowing use of proprietary codecs (Closes Ubuntu: #48391). + (Closes Ubuntu: #40723, #45516, #45519, #46832, #50857, #51117, + #52273) + + -- Daniel T. Chen Wed, 12 Jul 2006 17:01:59 -0400 + +vlc (0.8.5.debian-2) unstable; urgency=low + + * debian/rules: + + Fix generation of Arch: all transition packages. + + -- Sam Hocevar (Debian packages) Wed, 7 Jun 2006 14:46:22 +0200 + +vlc (0.8.5.debian-1) unstable; urgency=low + + * New upstream release (Closes: #364934). + * This release no longer disables audio input if the v4l video device does + not advertise an audio device (Closes: #316377). + * This release fixes PPC asm compilation issues in x264 (Closes: #366965). + + * debian/control: + + Merged wxvlc and vlc-plugin-alsa into vlc to get rid of circular + dependencies (Closes: #365816). + + Set policy to 3.7.2. + + libxosd-dev is installable again; build-depend on it (Closes: #364937). + + * debian/patches/030_x264_altivec.diff: + * debian/patches/030_x264_armvl.diff: + + Patches applied upstream. Removed. + + -- Sam Hocevar (Debian packages) Tue, 23 May 2006 16:15:56 +0200 + +vlc (0.8.5-test3.debian-3) unstable; urgency=low + + * debian/control: + + Build-depend on libdvdread-dev (>= 0.9.5) because libdvdread3-dev just + disappeared (Closes: #364681). + + -- Sam Hocevar (Debian packages) Tue, 25 Apr 2006 09:05:45 +0200 + +vlc (0.8.5-test3.debian-2) unstable; urgency=low + + * debian/control: + + Added missing libavc1394-dev build-dependency. + + * debian/patches/030_x264_altivec.diff: + + Fixed illegal implicit casts of vector types. + + * debian/patches/030_x264_armvl.diff: + + Added support for the armv4l CPU. + + -- Sam Hocevar (Debian packages) Mon, 24 Apr 2006 20:45:16 +0200 + +vlc (0.8.5-test3.debian-1) unstable; urgency=low + + * New upstream release. + + * Upstream fixed many bugs: + + Fixed the CPU features used by the deinterlace plugin and no + longer crashes on non-SSE machines (Closes: #363153). + + Properly build on amd64 wrt PIC (Closes: #339372, #330146, #330154). + + Fixed the double pane in settings dialog issue (Closes: #343031). + + Help flags now adapt to the locale and help formatting was fixed + (Closes: #347278). + + HTTP streaming no longer fails (Closes: #352599). + + Memory leak fixed (Closes: #359655). + + x264 build system supports ppc64 and mips64 (Closes: #361452, #358233). + + OGG muxing was fixed (Closes: #364321). + + * debian/control: + + Removed legacy dummy packages. + + Switched from dpatch to quilt. + + Removed now useless build-dependency on gcc-snapshot (Closes: #361729). + + Ditto for xlibs-static-pic (Closes: #364265). + + Build-depend on newer ffmpeg libraries so that we dynamically link + against them. + + Build-depend on newer Matroska libraries to fix .mkv support + (Closes: #348404). + + Build-depend on libxul-dev and xulrunner instead of mozilla-dev. + + Build-depend on newer live555 libraries. + + Depend on vlc-plugin-alsa. + + Removed the ttf-freefont dependency (Closes: #353459, #362071). + + * debian/vlc.mime: + + Fixed broken templates (Closes: #354101). + + * debian/patches/010_no-wx-updates.diff: + + Created from old dpatch. Disables broken "check for updates" button. + + * debian/patches/010_osdmenu-paths.diff + + Created from old dpatch. Fixes file paths for OSD plugin. + + * debian/patches/020_xulrunner.diff: + + Build using XULrunner (Closes: #364381). + + * debian/patches/020_freetype_font: + + Do not hardcode the default font, let VLC find one itself. + + -- Sam Hocevar (Debian packages) Mon, 24 Apr 2006 18:10:10 +0200 + +vlc (0.8.4.debian-2) unstable; urgency=low + + * debian/rules: + + Enable zeroconf/bonjour support (Closes: #348085). + + Enable musepack decoding support. + + Enable VCD navigation support. + * debian/control: + + Build-depend on more recent versions of libavcodec to fix CVE-2005-4048. + + Build-depend on libhal-dev (>= 0.5.5.1-3) for the dbus transition. + + Build-depend on libavahi-client-dev. + + Build-depend on libmpcdec-dev. + + Build-depend on libsysfs-dev so that the MP4 module can get an iPod’s + version number. + + Build-depend on libvcdinfo-dev. + * debian/vlc.mime: + + Put flags after the command, as per mailcap(5) (Closes: #340434). + + * src/libvlc.c configure.ac modules/services_discovery/hal.c: + + Backported HAL 0.5 patch from upstream, thanks to Clément Stenac and + Loïc Minier. As a result, we now build and install again on unstable + (Closes: #332927, #347598, #347847). + * extras/x264/configure: + + Support the armv5tel platform. + + -- Sam Hocevar (Debian packages) Sun, 22 Jan 2006 12:08:42 +0100 + +vlc (0.8.4.debian-1ubuntu6) dapper; urgency=low + + "'Time to race', she said, 'Race the downhill'." + + * Add debian/patches/24_prefs_stacking_fix, fixing stacking in + Preferences dialog. Taken from upstream svn changeset 13795, thanks + to Bruce Cowan (Closes: Malone #31891). + * Demote ttf-freefont, ttf-thryomanes to Suggests as the former + provides bad metrics for Thai. See Debian #362071 for additional + information. + * Don't use gcc-snapshot as the compiler. See Debian #361729 for more + information. + * Make vlc.desktop HIG-compliant. + * Rebuild against new libebml-dev and libmatroska-dev, fixing crashes + with Matroska files (Closes: Malone #29644). + * Use our own faad2 and x264, fixing garbled graphics (Closes: Malone + #28539). Please see Debian #365389 if the inclusion of these + libraries stirs your ire. + + -- Daniel T Chen Tue, 23 May 2006 03:42:19 -0400 + +vlc (0.8.4.debian-1ubuntu5) dapper; urgency=low + + * Integrate updates from Debian: + - Enable support for zeroconf/bonjour, musepack decoding, and VCD + navigation (and adjust debian/{control,rules} accordingly, adding + debian/patches/22_avahi_client_0.6_api). + + -- Daniel T Chen Sun, 05 Mar 2006 18:38:55 -0800 + +vlc (0.8.4.debian-1ubuntu4) dapper; urgency=low + + * removed nonexistent xlibs-static-pic build dep to fix FTBFS + * changes UBUNTU_ENV from /usr/lib/mozilla-firefox/xpidl + to /usr/lib/firefox/xpidl to fix FTBFS + * added 21_gnome-screensaver-support.dpatch to automagically + disable screensavers while playing a movie + + -- Oliver Grawert Tue, 28 Feb 2006 20:24:37 +0100 + +vlc (0.8.4.debian-1ubuntu3) dapper; urgency=low + + * debian/control: Replace mozilla-dev build dependency with + firefox-dev. Change mozilla-plugin-vlc's Recommends appropriately. + Fixes FTBFS due to mozilla-dev muck on [!amd64]. + * debian/rules: Elide Ubuntu modifications into UBUNTU_ENV to pass + to configure (MOZILLA_CONFIG=/usr/bin/firefox-config , + XPIDL=/usr/lib/mozilla-firefox/xpidl) + + -- Daniel T Chen Fri, 30 Dec 2005 19:29:07 -0800 + +vlc (0.8.4.debian-1ubuntu2) dapper; urgency=low + + * Rebuild for new dbus. + + -- Daniel T Chen Thu, 22 Dec 2005 14:32:09 -0800 + +vlc (0.8.4.debian-1ubuntu1) dapper; urgency=low + + * Resynchronise with Debian: + - Fix build dependency on GL headers. + - Reintegrate patch for HAL 0.5 API in src/libvlc.c(Debian#332927), + fixing FTBFS. + - Fix broken mailcap entries in vlc.mime (Closes: Debian#340434, + Debian#339570). + - Make vlc depend on vlc-plugin-alsa (Closes: #3678, #4544). + - Fix unicast streaming (Closes: #4444). + + -- Daniel T Chen Sun, 27 Nov 2005 22:50:24 -0800 + +vlc (0.8.4.debian-1) unstable; urgency=low + + * New upstream release. + + -- Sam Hocevar (Debian packages) Sat, 26 Nov 2005 19:55:09 +0100 + +vlc (0.8.4-test2-2) unstable; urgency=low + + * extras/x264/configure: + + Teach the configure script about the Alpha platform. + + -- Sam Hocevar (Debian packages) Fri, 11 Nov 2005 18:49:31 +0100 + +vlc (0.8.4-test2-1) unstable; urgency=low + + * New upstream release. + * debian/control: + + Build-depend on a newer version of gnutls (Closes: #335774). + + Replaced occurrences of "wxwindows" with "wxwidgets" (Closes: #330141). + * debian/rules: + + Use dh_buildinfo because of all the static libraries we use. + * Upstream fixed the wx code so that it builds with newer versions of the + library (Closes: #332282, #332773). + + -- Sam Hocevar (Debian packages) Fri, 11 Nov 2005 10:41:35 +0100 + +vlc (0.8.4-svn20050920-3) unstable; urgency=low + + * configure.ac: + + Fixed a bug in the gnomevfs plugin configuration. + * debian/rules: + + Explicitly disable the GnomeVFS plugin (Closes: #329317). + * debian/control: + + Buuild-depend on yasm on amd64. + + -- Sam Hocevar (Debian packages) Wed, 21 Sep 2005 11:36:24 +0200 + +vlc (0.8.4-svn20050920-2) unstable; urgency=low + + * configure: + + Fixed the powerpc build with gcc-4.x. + * extras/x264/configure: + + Added missing Debian architectures to the configure script. + + -- Sam Hocevar (Debian packages) Tue, 20 Sep 2005 17:46:35 +0200 + +vlc (0.8.4-svn20050920-1) unstable; urgency=low + + * New SVN snapshot. + * configure.ac: + + Upstream fixed the AltiVec build on PPC. + * debian/control: + + Build-depend on a newer version of libavcodec. mp2v and mp1v encoders + work again (Closes: #324840). + + Build-depend on gcc-snapshot on i386 and amd64, because currently only + that version of gcc properly builds some of the MMX modules. + + -- Sam Hocevar (Debian packages) Tue, 20 Sep 2005 13:43:41 +0200 + +vlc (0.8.4-svn20050823-2) unstable; urgency=low + + * debian/control: + + Build-depend on libflac-dev (>= 1.1.2-3) because of the soname + change (Closes: #325948). + * debian/copyright: + + Fixed the FSF address. + + -- Sam Hocevar (Debian packages) Thu, 1 Sep 2005 12:36:10 +0200 + +vlc (0.8.4-svn20050823-1) unstable; urgency=low + + * New SVN snapshot. + * debian/control: + + Build-depend on libsmbclient-dev. + + Build-depend on libwxgtk2.6-dev (Closes: #285373), which means the + interface now works with non-UTF8 locales (Closes: #308770, #322665). + + Build-depend on a newer version of libavcodec. + * debian/rules: + + Activated SMB client support. + + Install desktop files in usr/share/applications instead of + usr/share/gnome/apps/Multimedia. + * debian/patches/00list: + + 20_no-wx-updates.dpatch: disabled the update check. + + 20_interfaces.dpatch: disabled deprecated patch. + * configure.ac: + + Fixes powerpc build. + * include/network.h src/misc/net.c: + + Fixes HTTP input (Closes: #322757). + + Fixes URL encoding in the RTSP module (Closes: #323813). + * modules/gui/skins2 modules/gui/wxwidgets: + + Fixes a compilation issue on 64-bit architectures (Closes: #324031). + * modules/visualization/xosd.c: + + Fixes libxosd initialisation (Closes: #324039). + + -- Sam Hocevar (Debian packages) Mon, 22 Aug 2005 14:43:48 +0200 + +vlc (0.8.4-svn20050810-2) unstable; urgency=low + + * debian/control: + + Build-depend on libarts1-dev (>= 1.4.2-1). + + Build-depend on a newer version of libavcodec. + + -- Sam Hocevar (Debian packages) Tue, 16 Aug 2005 17:36:21 +0200 + +vlc (0.8.4-svn20050810-1) unstable; urgency=low + + * New SVN snapshot. + * Rebuilt against libaa1 and new wxWin and SDL packages to complete the + aalib transition (Closes: #320874) and make the packages installable again + (Closes: #319292, #319598, #321461, #322166, #317380). + * debian/rules: + + Use DEB_BUILD_ARCH_CPU instead of DEB_BUILD_GNU_CPU. + * debian/vlc.desktop: + + Added desktop file, thanks to Mantas Kriauciunas (Closes: #290612). + * debian/control: + + Removed unused dummy packages (Closes: #321988, #322003, #322013). + + Build-depend on libmatroska-dev (>= 0.7.7). + + Build-depend on libwxgtk2.4-dev (>= 2.4.4). + + Build-depend on libdvbpsi4-dev instead of libdvbpsi3-dev. + * Build-depend on libsdl1.2-dev (>= 1.2.7+1.2.8cvs20041007-5.3). + + Build-depend on a newer version of libmatroska-dev and mozilla-dev + because of the C++ transition. + + Build-depend on libsvga1-dev instead of svgalib1-dev. + * This snapshot no longer uses tune=opteron on amd64 (Closes: #316161). + * The SVN version adds support for Freebox users (Closes: #317035). + * Various gcc-4.x FTBFS were fixed upstream (Closes: #317055). + * mozilla/support/npunix.c: fixed undeclared NPP_GetJavaClass + (Closes: #317067). + + -- Sam Hocevar (Debian packages) Wed, 10 Aug 2005 16:18:37 +0200 + +vlc (0.8.2-1) unstable; urgency=low + + * New upstream release. + * This version fixes the random playlist parsing (Closes: #308375), encodes + non-ASCII characters in RTSP requests (Closes: #279735) and fixes an issue + with large files (Closes: #306110). + * debian/control: + + Set policy to 3.6.2.1. + + Build-depend on libpng12-dev, xlibmesa-gl-dev. + + Build-depend on a more recent ffmpeg library set, to fix nasty visual + artifacts with post-processing (Closes: #300220). + + mozilla-plugin-vlc recommends mozilla-firefox in addition to + mozilla-browser (Closes: #308723). + + Now that sarge is out, removed legacy packages that disappeared in woody. + * debian/rules: + + Activated PNG output support. + + Activated GLX output support. + * The NEWS file documents the changed behaviour for SAP (Closes: #303262). + * Minor typo fixed in the manpage (Closes: #300339). + * po/de.po: merged corrections from Jens Seidel (Closes: #313890). + + -- Sam Hocevar (Debian packages) Sun, 26 Jun 2005 16:28:19 +0200 + +vlc (0.8.1.svn20050314-1) unstable; urgency=low + + * More recent SVN snapshot. + * This snapshot fixes issues in modules/gui/wxwindows/streamout.cpp that + caused FTBFS on 64-bit architectures (Closes: #289923). + * debian/control: + + Build-depend on new libmatroska and libavcodec versions. + + Unfortunate return to wxwidgets 2.4 until 2.5 enters testing. + + Upgraded libflac-dev build dependency to (>= 1.1.1-5) to resolve + dependency issues (Closes: #298067). + * debian/vlc.mime: merged Guido Guenther’s contribution (Closes: #297261). + + -- Sam Hocevar (Debian packages) Mon, 14 Mar 2005 10:53:59 +0100 + +vlc (0.8.1-3) unstable; urgency=low + + * debian/control: + + Build-depend on fixed ffmpeg packages (Closes: #289444). + + Build-depend on a newer libflac-dev so that resulting packages use + libflac6 (Closes: #289490). + * modules/gui/wxwindows/open.cpp: + + Compilation fix for 64 bits systems. + + -- Sam Hocevar (Debian packages) Mon, 10 Jan 2005 11:10:02 +0100 + +vlc (0.8.1-2) unstable; urgency=low + + * debian/control: + + Use ffmpeg from Debian instead of the contrib one. + + Use wxgtk2.5 instead of 2.4. + + Activated the ncurses UI (Closes: #286962). + * debian/gnome-vlc.desktop debian/gvlc.desktop: + + Fixed the icon location. + + -- Sam Hocevar (Debian packages) Thu, 6 Jan 2005 18:00:00 +0100 + +vlc (0.8.1-1) unstable; urgency=low + + * New upstream release. + * debian/gnome-vlc.desktop: + + Fixed program path (Closes: #280290). + * debian/control: + + Require an up-to-date liblivemedia. + + Build-depend on libgnutls11-dev. + + -- Sam Hocevar (Debian packages) Sun, 14 Nov 2004 22:21:23 +0100 + +vlc (0.8.0.final-1) unstable; urgency=low + + * Final 0.8.0 upstream release. + * src/misc/modules.c: + + Fixed a startup issue with the svlc shortcut (Closes: #274376). + * debian/control: + + Suggest the Mozilla and ALSA plugins. Only mentioned the others in + the package description because they are not of notable usefulness + (Closes: #275160). + * modules/access/http.c: + + Fix HTTP proxy handling (Closes: #278381). + + -- Sam Hocevar (Debian packages) Wed, 3 Nov 2004 14:52:05 +0100 + +vlc (0.8.0-test1-1) unstable; urgency=high + + * New upstream tarball. + * debian/rules: + + Fixed previously broken DVD support. + + Removed currently broken Speex support. + * debian/control: + + Build-depend on libdvdnav. + + -- Sam Hocevar (Debian packages) Sat, 4 Sep 2004 02:32:49 +0200 + +vlc (0.7.2.svn20040827-1) unstable; urgency=high + + * New SVN snapshot. + * debian/rules: + + Activated x264 support. + + Re-enabled libmodplug support. + + Build PIC plugins even on x86. + + Disabled SLP because its code is broken. + + Disabled the GNOME, Qt, GTK+ and KDE interfaces in favour of the + WxWidgets one. + + Activated HAL support. + * debian/control: + + Force the vlc-plugin-arts dependencies. + + Build-depend on jam and nasm because of x264. + + -- Sam Hocevar (Debian packages) Fri, 27 Aug 2004 21:31:13 +0200 + +vlc (0.7.2.final-11) unstable; urgency=medium + + * configure.ac: + + Fixed an LDFLAGS/CFLAGS confusion. + + Don't use -finline-limit since it now tries to inline functions that + have not been explicitely inlined (Closes: #265673). + * debian/patches/20_configure.dpatch: + + Don't manage this patch with dpatch since it causes ownership issues. + + -- Sam Hocevar (Debian packages) Sun, 15 Aug 2004 01:35:35 +0200 + +vlc (0.7.2.final-10) unstable; urgency=medium + + * The "I hope I got it right this time" upload. + * configure.ac: + + Use -maltivec -mabi=altivec for the memcpyaltivec and deinterlace + plugins on PowerPC. + + -- Sam Hocevar (Debian packages) Tue, 10 Aug 2004 18:01:47 +0200 + +vlc (0.7.2.final-9) unstable; urgency=low + + * debian/control: + + Added a missing dpatch build dependency (Closes: #263363). + + Removed the modplug plugin until libmodplug-dev enters Debian. + + -- Sam Hocevar (Debian packages) Tue, 10 Aug 2004 11:01:15 +0200 + +vlc (0.7.2.final-8) unstable; urgency=low + + * debian/control: + + Added a missing dpatch build dependency. + * configure.ac: + + Fixed the powerpc build by conditionally re-enabling -maltivec + -mabi=altivec. + + -- Sam Hocevar (Debian packages) Fri, 30 Jul 2004 00:05:58 +0200 + +vlc (0.7.2.final-7) unstable; urgency=low + + * debian/rules: + + Switch build system to dpatch. + + -- Sam Hocevar (Debian packages) Thu, 29 Jul 2004 17:03:51 +0200 + +vlc (0.7.2.final-6) unstable; urgency=low + + * configure.ac: don't use -maltivec -mabi=altivec, because we don't want + to trigger AltiVec optimisations in our generic code (Closes: #256578, + Closes: #260819). + + -- Sam Hocevar (Debian packages) Fri, 23 Jul 2004 17:21:21 +0200 + +vlc (0.7.2.final-5) unstable; urgency=low + + * debian/control: + + Build-depend on libdvbpsi3-dev, so that we can get rid of the previous + versions of this library. + + Recommend the videolan-doc package. + + Build-conflict on libavcodec-dev, just in case it enters Sid at an + unappropriate moment. + * debian/README.Debian: + + Removed mention of the libmpeg2 tree, which we no longer provide. + + -- Sam Hocevar (Debian packages) Tue, 20 Jul 2004 11:25:17 +0200 + +vlc (0.7.2.final-4) unstable; urgency=low + + * debian/rules: + + Activated Theora support (Closes: #259061). + + Re-enabled the KDE plugin (Closes: #258295). + * debian/control: + + Set policy to 3.6.1.1. + + -- Sam Hocevar (Debian packages) Tue, 13 Jul 2004 00:21:20 +0200 + +vlc (0.7.2.final-3) unstable; urgency=low + + * extras/ffmpeg/configure: fixed HPPA architecture detection. + + -- Sam Hocevar (Debian packages) Fri, 25 Jun 2004 11:55:33 +0200 + +vlc (0.7.2.final-2) unstable; urgency=low + + * extras/ffmpeg/libavcodec/svq1.c: fixed vector/vect namespace issues on + powerpc. + + -- Sam Hocevar (Debian packages) Tue, 22 Jun 2004 15:21:09 +0200 + +vlc (0.7.2.final-1) unstable; urgency=low + + * New upstream release. + * Temporarily disabled the KDE GUI plugin. + + -- Sam Hocevar (Debian packages) Sat, 29 May 2004 00:06:48 -0300 + +vlc (0.7.2-test2-1) unstable; urgency=low + + * New upstream snapshot. + + -- Sam Hocevar (Debian packages) Thu, 6 May 2004 11:11:25 +0200 + +vlc (0.7.2-test1-4) unstable; urgency=low + + * extras/ffmpeg/libacvodec/Makefile: + + Fixed a PARISC/HPPA mix-up. + * src/interface/interface.c: + + Removed the "switch interface" menu due to wxwin's utter bugosity. + + -- Sam Hocevar (Debian packages) Fri, 30 Apr 2004 13:15:59 +0200 + +vlc (0.7.2-test1-3) unstable; urgency=low + + * configure.ac: + + Link DTS plugins with libdts_pic.a, not libdts.a. + * debian/control: + + Build-depend on libid3tag0-dev for ID3 tag support. + + Made vlc depend on wxvlc for the moment. + * extras/ffmpeg/libacvodec/Makefile: + + Build motion_est.c with -O1. + + -- Sam Hocevar (Debian packages) Fri, 30 Apr 2004 10:49:59 +0200 + +vlc (0.7.2-test1-2) unstable; urgency=low + + * debian/control: + + Build-depend on libxml2-dev. + * extras/ffmpeg/libavcodec/ppc/dsputil_altivec.c: + + Syntax fixes for powerpc. + + -- Sam Hocevar (Debian packages) Wed, 28 Apr 2004 12:49:18 +0200 + +vlc (0.7.2-test1-1) unstable; urgency=low + + * New SVN snapshot. + * The skinned interface is now the default one (Closes: #245210). + * debian/control: + + Removed the libdv2-dev build-dependency. + + Set the liblivemedia-dev build-dependency to (>= 2004.04.23-1). + + Set the libmatroska-dev build-dependency to (>= 0.7.0). + + Build-depend on libfribidi-dev. + + Build-depend on libcdio-dev. + + Build-depend on libmodplug-dev. + * debian/rules: + + Activated fribidi support. + + Activated CDDA support via libcdio. + + Activated MOD support. + * configure.ac: + + Re-enabled i420_yuy2_altivec. + * src/interface/interface.c: + + Disable unavailable interfaces from the switch menu (Closes: #245209). + + -- Sam Hocevar (Debian packages) Mon, 26 Apr 2004 16:30:25 +0200 + +vlc (0.7.1-7) unstable; urgency=high + + * debian/control: + + Override kdelibs4's shlibs value to get VLC into testing. + + No longer build-depend on dvb-dev. + + -- Sam Hocevar (Debian packages) Tue, 20 Apr 2004 18:00:40 +0200 + +vlc (0.7.1-6) unstable; urgency=low + + * debian/control: + + Removed the build dependency on gcc-3.2 because gcc-3.3 no longer ICEs + on ppc/mpegvideo_altivec.o (Closes: #236442). + + Build depend on fixed libsdl1.2-dev (>= 1.2.7-5). + + -- Sam Hocevar (Debian packages) Tue, 6 Apr 2004 10:27:35 +0200 + +vlc (0.7.1-5) unstable; urgency=low + + * debian/control: + + Added a build-dependency on libaudiofile-dev to fix the m68k build. + * debian/rules: + + Added symlinks for mozilla-firefox (Closes: #239352). + + -- Sam Hocevar (Debian packages) Tue, 30 Mar 2004 23:10:20 +0200 + +vlc (0.7.1-4) unstable; urgency=medium + + * extras/ffmpeg/libavcodec/ppc/mpegvideo_ppc.c: + + Replaced fprintf() with av_log() to fix the powerpc build. + + -- Sam Hocevar (Debian packages) Sun, 21 Mar 2004 13:59:07 +0100 + +vlc (0.7.1-3) unstable; urgency=medium + + * debian/rules: + + Activated DTS decoding support. + * debian/control: + + Build-depend on libx11-dev, libxext-dev, libxt-dev instead of xlibs-dev. + + Build-depend on libxv-dev, xlibs-static-pic instead of xlibs-pic. + + -- Sam Hocevar (Debian packages) Sat, 20 Mar 2004 18:13:43 +0100 + +vlc (0.7.1-2) unstable; urgency=medium + + * debian/control: + + Build-depend on zlib1g-dev because ffmpeg uses it by default. + * configure.ac: + + Add -lz to the link flags for plugins that use ffmpeg. + + Disabled i420_yuy2_altivec for now, because it only has a C version of + the AltiVec routines. + + -- Sam Hocevar (Debian packages) Thu, 4 Mar 2004 17:34:58 +0100 + +vlc (0.7.1-1) unstable; urgency=medium + + * New upstream release. + * debian/copyright: + + Added faad2 and ffmpeg authors to the copyright (Closes: #212766). + * mozilla/vlcplugin.h: + + Added the 'video/x-ms-asf' MIME type to the plugin (Closes: #232690). + + -- Sam Hocevar (Debian packages) Wed, 3 Mar 2004 10:47:21 +0100 + +vlc (0.7.0-3) unstable; urgency=medium + + * ppc/mpegvideo_altivec.c: + + Build this file with GCC 3.2 to work around an ICE. + + -- Sam Hocevar (Debian packages) Wed, 21 Jan 2004 15:36:30 +0100 + +vlc (0.7.0-2) unstable; urgency=low + + * debian/rules: + + Look for faad in extras/faad2, not extras/faad. + * modules/demux/mkv.cpp: + + Updated mkv module for the latest Matroska version (Closes: #227923). + * modules/video_output/caca.c: + + Updated caca module for the latest libcaca version. + + -- Sam Hocevar (Debian packages) Tue, 20 Jan 2004 18:30:58 +0100 + +vlc (0.7.0-1) unstable; urgency=low + + * New upstream release. + * debian/control: + + Build-depend on fixed dvb-dev packages. + + Build-depend on fixed linux-kernel-headers packages. + * debian/rules: + + Look for faad in extras/faad2, not extras/faad. + + Enable postprocessing in the ffmpeg configuration. + + Activated libcaca video output. + * doc/vlc.1: + + Fixed a minor typo (Closes: #223605). + + -- Sam Hocevar (Debian packages) Sun, 4 Jan 2004 03:29:22 +0100 + +vlc (0.6.2+cvs20031030-2) unstable; urgency=low + + * debian/control: + + Build-depend on a newer wxwindows version to avoid incompatibilities. + + Build-depend on linux-kernel-headers and build-conflict on dvb-dev + because these packages cannot be installed together. + * debian/rules: + + Temporarily disabled the framebuffer video output plugin because of + current code errors in linux-kernel-headers. + + -- Sam Hocevar (Debian packages) Sat, 1 Nov 2003 11:01:40 +0100 + +vlc (0.6.2+cvs20031030-1) unstable; urgency=low + + * New CVS snapshot. + * debian/rules: + + Disabled the deprecated satellite plugin; the dvb plugin is now + the recommended one (Closes: #216367). + + Don't install fortunes in /usr/share/games, they are too private for + common mortals (Closes: #212856). They are still available in the + /usr/share/doc/vlc directory though. + + Activated the speex codec. + + Activated the PVR input module. + * debian/control: + + Depend on ttf-freefont for subtitles. + + Upgraded debhelper build-dependency to (>= 4.0). + + -- Sam Hocevar (Debian packages) Fri, 31 Oct 2003 11:08:57 +0100 + +vlc (0.6.2-3) unstable; urgency=low + + * debian/control: + + Set libxosd-dev build-dependency to (>= 2.2.4-1.3) because previous + versions were broken on s390 (Closes: #208383). + + Rewrote long descriptions (Closes: #209602, #209615, #209628, #209636, + Closes: #209774, #209914, #210028, #210095). + + -- Sam Hocevar (Debian packages) Mon, 15 Sep 2003 21:28:43 +0200 + +vlc (0.6.2-2) unstable; urgency=low + + * debian/control: + + Set libmatroska-dev build-dependency to (>= 0.5.0-3) because previous + versions were broken on platforms where PIC/non-PIC cannot be mixed in + objects (Closes: #208383). + + Set policy to 3.6.1.0. + + -- Sam Hocevar (Debian packages) Fri, 5 Sep 2003 02:32:54 +0200 + +vlc (0.6.2-1) unstable; urgency=low + + * New upstream release. + * debian/control: + + Added a build-dependency on freetype6-dev. + + Added a build-dependency on libdvbpsi2-dev. + + We now recommend gnome-vlc | wxvlc. + + We now suggest fortune-mod. + * This release now uses libfreetype to render subtitles, and we recommend + ttf-freefont | ttf-thryomanes, so that the old .rle font is no longer + needed (Closes: #203013). + * extras/faad: + + aclocal-1.6 && autoconf && automake-1.6 -a -c -f && libtoolize -c -f + * extras/faad/common/mp4v2: + + aclocal-1.4 && autoconf && autoheader && automake-1.4 --foreign -a -c \ + && libtoolize -c -f + * extras/mpeg2dec: + + aclocal-1.7 && autoconf && automake-1.7 -a -c && libtoolize -c -f + + -- Sam Hocevar (Debian packages) Tue, 2 Sep 2003 10:45:24 +0200 + +vlc (0.6.0+cvs-20030716-2) unstable; urgency=low + + * debian/control: + + Updated debhelper build-dependency to (>= 3.4.4) because we now + use debian/compat. + + Use ${misc:Depends} everywhere. + + -- Sam Hocevar (Debian packages) Wed, 16 Jul 2003 16:55:31 +0200 + +vlc (0.6.0+cvs-20030716-1) unstable; urgency=low + + * New CVS snapshot. + * debian/control: + + Set policy to 3.6.0. No changes required. + + Extended the package description. + * modules/video_output/x11/xcommon.c: + + Fix for crashes in the Mozilla plugin (Closes: #200920). + * mozilla/*: + + Compilation fixes for Mozilla 1.4 headers (Closes: #201093). + + -- Sam Hocevar (Debian packages) Wed, 16 Jul 2003 16:55:31 +0200 + +vlc (0.6.0+cvs-20030705-1) unstable; urgency=low + + * New CVS snapshot. + + Includes previous Debian fixes. + + Errors in plugins now properly trigger build abort so that no build + failures are missed. Thanks to LaMont Jones for pointing out the problem. + * debian/rules: + + Enabled Matroska support. + + Only build builtins in the first compile pass so that we don't mix PIC + and non-PIC code (Closes: #199968). Phew, I hope I got it right this + time. + * extras/ffmpeg: + + Re-applied the Alpha build fix from 0.6.0+cvs-20030627-2 that had + disappeared in 0.6.0+cvs-20030703-1. + + -- Sam Hocevar (Debian packages) Sat, 5 Jul 2003 01:09:11 +0200 + +vlc (0.6.0+cvs-20030703-1) unstable; urgency=low + + * New CVS snapshot. + + Includes previous Debian fixes. + + Build should be a bit faster now. + * extras/faad: + + aclocal-1.6 && autoconf && automake-1.6 -a -c -f && libtoolize -c -f + * extras/faad/common/id3lib: + + mkdir doc examples + + aclocal-1.4 && autoconf && automake-1.4 -a -c && libtoolize -c -f + * extras/mpeg2dec: + + aclocal-1.7 && autoconf && automake-1.7 -a -c && libtoolize -c -f + + Fixes build on parisc (Closes: #199693). + + -- Sam Hocevar (Debian packages) Thu, 3 Jul 2003 11:25:57 +0200 + +vlc (0.6.0+cvs-20030627-2) unstable; urgency=low + + * extras/ffmpeg: + + Fixed compilation for Alpha. + * debian/rules: + + Enabled the video4linux input plugin (Closes: #199427). + + -- Sam Hocevar (Debian packages) Sun, 29 Jun 2003 21:12:10 +0200 + +vlc (0.6.0+cvs-20030627-1) unstable; urgency=low + + * New upstream release. + * debian/rules: + + Replaced $(DEB_BUILD_ARCH) with `dpkg-architecture -qDEB_BUILD_GNU_CPU` + so that the rules can be called directly. + + Use the -s flag instead of -a so that debhelper properly handles the + i386-only plugin packages. + + Split the build rule into configure and build. + * debian/control: + + Removed leading "a"s from package descriptions. + + Set policy to 3.5.10. + + -- Sam Hocevar (Debian packages) Sat, 21 Jun 2003 17:55:07 +0200 + +vlc (0.5.3-3) unstable; urgency=low + + * Built-in modules were linked twice in the mozilla plugin; removed the + non-PIC ones (Closes: #194384). + + -- Samuel Hocevar Fri, 23 May 2003 11:15:19 +0200 + +vlc (0.5.3-2) unstable; urgency=low + + * Changed the libvlc0-dev section to libdevel. + * We now build the static objects twice: once the normal way before we + link them with VLC, and once with -fPIC so that they can be linked to + the Mozilla plugin. + * Updated extras/faad/config.{sub,guess}. + + -- Samuel Hocevar Fri, 14 Apr 2003 15:14:07 +0200 + +vlc (0.5.3-1) unstable; urgency=low + + * New upstream release. + * Fixed a clock skew issue in debian/rules. + + -- Samuel Hocevar Tue, 8 Apr 2003 15:20:20 +0100 + +vlc (0.5.2-4) unstable; urgency=low + + * Changed the section of gnome-vlc and kvlc according to new Debian + archive sections. + * Updated woody-buildpackage so that packages say "stable". + + -- Samuel Hocevar Tue, 1 Apr 2003 18:08:01 +0200 + +vlc (0.5.2-3) unstable; urgency=low + + * Added explicit dependencies on vlc to legacy packages to make linda and + lintian happier. + * Added correct versioned build-dependency on debhelper. + * Updated the autotools helper files in extras/faad. + + -- Samuel Hocevar Wed, 26 Mar 2003 02:50:34 +0100 + +vlc (0.5.2-2) unstable; urgency=low + + * Bumped up standards version to 0.5.9.0. + * Added build-dependencies on libidl0 and libglib2.0-0 to work around + mozilla-dev's currently broken dependencies. + * We now link against libdvdread3 instead of libdvdread2. + + -- Samuel Hocevar Tue, 25 Mar 2003 23:21:51 +0100 + +vlc (0.5.2-1) unstable; urgency=low + + * New upstream release. + * Removed vlc-plugin-dvb, vlc-plugin-xosd, vlc-plugin-aa, vlc-plugin-lirc and + vlc-plugin-dv packages because the dependencies are quite small, and merged + them into the main vlc package. + * Removed the vlc-mad, vlc-arts, vlc-lirc and vlc-aa legacy packages because + they were not in woody. + + -- Samuel Hocevar Tue, 11 Mar 2003 20:32:36 +0100 + +vlc (0.5.1-1) unstable; urgency=low + + * New upstream release. + * The vlc-glide package is now Architecture: i386 only. + * The vlc-plugin-mad package Provides: mp3-decoder. + * The deprecated vlc-* packages have a proper link to /usr/share/doc/vlc/. + + -- Samuel Hocevar Sat, 15 Feb 2003 03:43:33 +0100 + +vlc (0.5.0-1) unstable; urgency=low + + * New upstream release (Closes: #157166). + * Audio MPEG and A52 decoders now use external libraries (libmad, liba52). + * Build-Depends are now valid (Closes: #147103). + * More robust AVI parser (Closes: #158037). + * An issue with X taking more and more CPU was fixed (Closes: #153286). + * Package now includes a NEWS file. + * New package containing a Mozilla plugin. + * New codec packages: Ogg/Vorbis, DV. + * New GUI package: wxvlc (wxWindows). + * New debian/woody-buildpackage file that can be used to build Woody + packages. + * Made the GNOME desktop entries more user-friendly (Closes: #149749). + + -- Samuel Hocevar Thu, 4 Jul 2002 17:44:25 +0200 + +vlc (0.4.1-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Mon, 3 Jun 2002 23:43:35 +0200 + +vlc (0.4.0-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Thu, 23 May 2002 01:27:05 +0200 + +vlc (0.3.1-1) unstable; urgency=low + + * New upstream release. + * Fixes a crash in the Gtk+ interface. + + -- Samuel Hocevar Thu, 18 Apr 2002 06:43:42 +0200 + +vlc (0.3.0-1) unstable; urgency=low + + * New upstream release. + * Reworked Gtk interface (Closes: #138732), with a working preferences + dialog (Closes: #134142, #134147). + * The ALSA plugin now supports S/PDIF (Closes: #118301). + + -- Samuel Hocevar Sat, 6 Apr 2002 04:27:50 +0200 + +vlc (0.2.92-8) unstable; urgency=high + + * Only link with libXv.a if libXv_pic.a wasn't found, which fixes + package builds on sid. + * Added -ffunction-sections to the compilation of mpeg_vdec.a when + the architecture is hppa. + + -- Samuel Hocevar Sun, 6 Jan 2002 06:56:08 +0100 + +vlc (0.2.92-7) unstable; urgency=high + + * Fixed configure.in so that it doesn't fail on hppa. + * Fixed a symbol resolution issue that made vlc crash when libdvdcss + was installed. + + -- Samuel Hocevar Sat, 5 Jan 2002 03:46:23 +0100 + +vlc (0.2.92-6) unstable; urgency=high + + * Attempt to fix IA64 and hppa builds. + + -- Samuel Hocevar Fri, 4 Jan 2002 14:11:02 +0100 + +vlc (0.2.92-5) unstable; urgency=high + + * Many fixes imported from the 0.2.92 upstream release (VCD input, + buffer management, decoder error management). + * Removed a stupid dependency on libc6 which prevented the package + from being built on alpha. + + -- Samuel Hocevar Wed, 2 Jan 2002 04:16:44 +0100 + +vlc (0.2.92-4) unstable; urgency=high + + * Put debian/control and debian/rules in sync again (Closes: #126697). + * Replaced the 48x48 XPM icons with 32x32 icons to comply with policy + (Closes: #126939). + * Don't spawn the Gtk+ or the Gnome interface if no $DISPLAY variable is + present, which fixes the framebuffer output (Closes: #101753). + + -- Samuel Hocevar Sun, 30 Dec 2001 02:59:01 +0100 + +vlc (0.2.92-3) unstable; urgency=high + + * Removed references to vlc-mad (Closes: #126194). + + -- Samuel Hocevar Sat, 22 Dec 2001 21:04:27 +0100 + +vlc (0.2.92-2) unstable; urgency=high + + * Bumped urgency to high to get this stable version into testing; all + reported critical bugs were fixed. + * Bumped Standards-Version to 3.5.6. + * Fixed a PowerPC compilation issue. + * Fixed a crash in the VCD input. + + -- Samuel Hocevar Thu, 20 Dec 2001 23:24:21 +0100 + +vlc (0.2.92-1) unstable; urgency=low + + * Using the stable 0.2.92 CVS branch, has lots of stability fixes. + * Disabled broken ALSA audio output (Closes: #110869, #119846). + * Changed configure.in so that vlc is linked against libXv.a, + not xvideo.so and sdl.so (Closes: #111790). + * Added versioned build-dep to libasound2-dev (Closes: #121057). + + -- Samuel Hocevar Wed, 19 Dec 2001 17:06:44 +0100 + +vlc (0.2.91-2) unstable; urgency=low + + * Added "Video" menu hints (Closes: #121036). + + -- Samuel Hocevar Sun, 25 Nov 2001 02:25:34 +0100 + +vlc (0.2.91-1) unstable; urgency=low + + * New upstream release. + * This release fixes IFO parsing issues (Closes: #119369). + * vlc will dlopen() an installed libdvdcss if available, to play + encrypted DVDs (Closes: #89856). + * vlc is now in sync with the official libdvdcss (Closes: #118194). + + -- Samuel Hocevar Mon, 12 Nov 2001 17:14:29 +0100 + +vlc (0.2.90-3) unstable; urgency=low + + * Added stricter Build-Depends on libsdl1.2-dev (Closes: #117180). + + -- Samuel Hocevar Fri, 26 Oct 2001 16:06:01 +0200 + +vlc (0.2.90-2) unstable; urgency=low + + * Various upstream bugfixes. + * Compiled against libsdl1.2-debian (Closes: #116709). + + -- Samuel Hocevar Tue, 23 Oct 2001 02:09:39 +0200 + +vlc (0.2.90-1) unstable; urgency=low + + * Fixed syntax error in build dependencies (Closes: #109722). + * XVideo module now compiled as built-in, to avoid PIC and non-PIC + code collision (Closes: #111790). + + -- Samuel Hocevar Wed, 10 Oct 2001 15:00:29 +0200 + +vlc (0.2.83-2) unstable; urgency=low + + * Fixed build dependencies for architectures not supporting libasound2 + (Closes: #109722). + + -- Samuel Hocevar Fri, 24 Aug 2001 12:47:45 +0200 + +vlc (0.2.83-1) unstable; urgency=low + + * New upstream release. + * Activated subtitles in overlay mode (Closes: #97471). + + -- Samuel Hocevar Wed, 22 Aug 2001 15:18:01 +0200 + +vlc (0.2.82-1) unstable; urgency=low + + * New upstream release. + * Fixed broken manpage symlinks (Closes: #99561). + + -- Samuel Hocevar Tue, 7 Aug 2001 12:39:16 +0200 + +vlc (0.2.81-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Sat, 28 Jul 2001 04:13:57 +0200 + +vlc (0.2.80-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Tue, 5 Jun 2001 04:41:06 +0200 + +vlc (0.2.73-2) unstable; urgency=low + + * We now build without MMX in the main application (Closes: #96036). + + -- Samuel Hocevar Fri, 4 May 2001 07:13:04 +0200 + +vlc (0.2.73-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Sat, 28 Apr 2001 07:02:35 +0200 + +vlc (0.2.72-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Mon, 16 Apr 2001 14:33:53 +0200 + +vlc (0.2.71-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Fri, 13 Apr 2001 08:13:26 +0200 + +vlc (0.2.70-1) unstable; urgency=low + + * New upstream release. + * Non-i386 package builds really fixed (Closes: #89285). + + -- Samuel Hocevar Sat, 7 Apr 2001 05:52:00 +0200 + +vlc (0.2.63-3) unstable; urgency=low + + * Added versioned conflicts/replaces to vlc-gtk (Closes: #88796). + + -- Samuel Hocevar Wed, 7 Mar 2001 20:47:48 +0100 + +vlc (0.2.63-2) unstable; urgency=low + + * Glide shouldn't cause any non-x86 problems anymore (Closes: #88583). + + -- Samuel Hocevar Mon, 5 Mar 2001 12:50:28 +0100 + +vlc (0.2.63-1) unstable; urgency=low + + * New upstream release. + + -- Samuel Hocevar Mon, 5 Mar 2001 00:41:16 +0100 + +vlc (0.2.62-2) unstable; urgency=low + + * Removed a few lintian warnings. + + -- Samuel Hocevar Sat, 3 Mar 2001 10:29:31 +0100 + +vlc (0.2.62-1) unstable; urgency=low + + * New release. Glide and GGI packages build again. + * Updated vlc.1 manpage (Closes: #87478). + * Fixed debian/control (Closes: #83707). + * The framebuffer plugin doesn't hijack ^C anymore (Closes: #87500). + + -- Samuel Hocevar Fri, 2 Mar 2001 17:32:24 +0100 + +vlc (0.2.61-1) unstable; urgency=low + + * New release. The package build works again. + + -- Samuel Hocevar Fri, 16 Feb 2001 08:09:59 +0100 + +vlc (0.2.60-1) unstable; urgency=low + + * New release. The package build is most presumably FUBAR. + + -- Samuel Hocevar Wed, 14 Feb 2001 08:33:46 +0100 + +vlc (0.2.50nocss-1) unstable; urgency=low + + * Only build vlc-glide under x86 (Closes: #84046). + * Switched PentiumPro optimization off (Closes: #83707). + + -- Samuel Hocevar Mon, 5 Feb 2001 20:49:15 +0100 + +vlc (0.2.50-1) unstable; urgency=low + + * Unstable release. + + -- Samuel Hocevar Wed, 31 Jan 2001 04:30:37 +0100 + +vlc (0.1.99i) unstable; urgency=low + + * Fixed the framerate display + + -- Samuel Hocevar Tue, 24 Oct 2000 11:08:01 +0200 + +vlc (0.1.99i) unstable; urgency=low + + * fixed the support for field pictures, which involved a few dozens + bugs in the video parser and video decoder. + * renamed an inconsistent variable in src/input/input_file.c. + * added support for I+ synchro (all Is and the first P). + * fixed a motion compensation bug which generated some distortion + on B images. + * fixed a motion compensation bug for skipped macroblocks. + * fixed a synchro bug for field images. + * fixed the --server option which didn't work if a ~/.vlcrc existed. + + -- Samuel Hocevar Mon, 28 Aug 2000 02:34:18 +0200 + +vlc (0.1.99h) unstable; urgency=low + + * added support for the SDL vout : the --display fullscreen allows + fullscreen when possible. Disabled by default. + * updated debian directory to build vlc-sdl. + * removed CCFLAGS flags which were improperly used. + * added hints for powerpc build. + * fixed the input_file exit bug. + * removed the frame statistics output. + * removed a verbose message in intf_sdl.c. + * added a few sanity checks in the audio mpeg and ac3 decoders. + * temporarily got rid of vlc.channels. + + -- Samuel Hocevar Tue, 22 Aug 2000 01:31:58 +0200 + +vlc (0.1.99g) unstable; urgency=low + + * removed all "*vlc" aliases except "gvlc" and "fbvlc". The other sucked. + * new --synchro flag which lets you force which images are decoded. + * fixed 32bpp MMX YUV, made the comments clearer, removed an emms. + * now scaling is on by default, so that people won't tell that the vlc + cannot do scaling :-) + * fixed 8bpp YUV. + * fixed the fscked up Bresenham algorithm in all YUV functions. + * fixed a dumb bug in the Makefile that prevented inclusion of the + -march=pentium directive. thanks Meuuh, blame sam. + * separate Debian packages + + -- Samuel Hocevar Wed, 16 Aug 2000 01:07:14 +0200 + +vlc (0.1.99f) unstable; urgency=low + + * plugin detection now works + * "gvlc", "fbvlc", "ggivlc" aliases now work + * fixed functions that weren't properly inlined + * removed bloat from the MMX YUV plugin + * vlc.init becomes ~/.vlcrc + * removed float operations in the video decoder, and all emms asm functions + * borrowed linuxvideo's MMX motion compensation + * fixed an undefined symbol in the MMX YUV plugin + + -- Samuel Hocevar Tue, 8 Aug 2000 11:24:01 +0200 + +vlc (0.1.99e) unstable; urgency=low + + * new bitstream syntax and slight performance increase + + -- Samuel Hocevar Thu, 20 Jul 2000 15:14:06 +0200 + +vlc (0.1.99d) unstable; urgency=low + + * .deb is now more lintian-friendly + * removed a few useless warning messages + * new plugin API + * plugin auto-detection + * removed the default --enable-ppro option because it didn't work on K6-2 + * the framebuffer client now leaves the console in a working state + * the dithered 8 bpp YUV transformation works again (blame bbp !) + * the YUV transformations are now plugins as well + * alternative symlinks like gvlc, fbvlc are now created at compile time + * borrowed libmpeg2's GPLed MMX YUV transformations (16 and 32 bits) + * fixed an endianness problem which occurred on iMacs + + -- Samuel Hocevar Wed, 12 Jul 2000 01:24:40 +0200 + +vlc (0.1.99c) unstable; urgency=low + + * Caught Delete Window event in Gnome and X11 modes + * Fixed manpage + * GGI output now works + * Fixed a segfault on exit for the Gnome plugin + * Sound support almost works under BeOS + + -- Samuel Hocevar Tue, 20 Jun 2000 03:01:12 +0200 + +vlc (0.1.99b) unstable; urgency=low + + * Added a ChangeLog file + * Updated the VLAN code + * Fixed a bug preventing to quit + + -- Samuel Hocevar Sat, 17 Jun 2000 03:46:16 +0200 + +vlc (0.1.99a) unstable; urgency=low + + * Fixed some compile flag errors + + -- Samuel Hocevar Thu, 15 Jun 2000 20:48:54 +0200 + +vlc (0.1.99-1) unstable; urgency=low + + * Initial Release. + + -- Samuel Hocevar Mon, 13 Mar 2000 02:21:45 +0100 + --- vlc-0.8.6.release.d.orig/debian/rules +++ vlc-0.8.6.release.d/debian/rules @@ -0,0 +1,314 @@ +#!/usr/bin/make -f +# debian/rules for the VLC media player - uses debhelper. +# $Id: rules 108 2006-10-06 21:21:48Z sam $ +# based on Joey Hess's one. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) +confflags = --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) + +# +# Compilation options +# +UBUNTU_ENV = XULRUNNER_CONFIG=/usr/bin/xulrunner-config +vlc_confflags = --enable-release --prefix=/usr +vlc_confflags += \ + --enable-libtool \ + --disable-gnome \ + --disable-gtk \ + --disable-familiar \ + --disable-fb \ + --enable-ggi \ + --enable-sdl \ + --enable-esd \ + --disable-qt \ + --enable-mad \ + --enable-arts \ + --enable-alsa \ + --enable-lirc \ + --enable-a52 \ + --enable-aa \ + --enable-dvbpsi \ + --enable-mozilla \ + --disable-kde \ + --enable-mp4 \ + --enable-dvb \ + --enable-dv \ + --disable-satellite \ + --enable-ogg \ + --enable-vorbis \ + --enable-wxwidgets \ + --with-wx-config=wx-config \ + --disable-slp \ + --enable-flac \ + --disable-skins \ + --disable-basic-skins \ + --enable-skins2 \ + --enable-freetype \ + --enable-mkv \ + --enable-v4l \ + --enable-pvr \ + --enable-speex \ + --enable-caca \ + --enable-live555 \ + --enable-libmpeg2 \ + --enable-dts \ + --enable-fribidi \ + --enable-cdio \ + --enable-mod \ + --enable-theora \ + --enable-modplug \ + --enable-dvdnav \ + --enable-gnutls \ + --enable-ffmpeg \ + --enable-ncurses \ + --enable-smb \ + --disable-gnomevfs \ + --enable-bonjour \ + --enable-mpc \ + --enable-vcd \ + --enable-vcdx \ + --enable-xosd \ + --enable-notify \ + --enable-jack \ + $(NULL) + +# These ones are currently shipped with VLC +vlc_confflags += --enable-faad --with-faad-tree=extras/faad2 +vlc_confflags += --enable-x264 --with-x264-tree=extras/x264 + +# Glide and svgalib are only for x86 +ifeq ($(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU),i386) +vlc_confflags += --enable-glide +vlc_confflags += --enable-svgalib +endif + +# Remove --without-dvdcss in non-totalitarian countries +vlc_confflags += --enable-dvd --without-dvdcss + +# A few shortcuts +VIDDIR = usr/share/vlc +PIXDIR = usr/share/pixmaps +APPDIR = usr/share/applications + +ifeq "$(DEB_BUILD_ARCH)" "amd64" + X264_OPTS += --enable-pic +endif + +DEB_UPSTREAM_VERSION+=0.8.6.release.d +VERSION=$(shell echo $(DEB_UPSTREAM_VERSION) | sed 's/.release.//') + +# +# Build rules +# + +get-orig-source: + wget http://download.videolan.org/pub/videolan/vlc/$(VERSION)/vlc-$(VERSION).tar.gz + tar xzzf vlc-$(VERSION).tar.gz + rm vlc-$(VERSION).tar.gz + + apt-get source faad2 -d + dpkg-source -x faad2*dsc vlc-$(VERSION)/extras/faad2 + rm vlc-$(VERSION)/extras/faad2/debian -rf + rm faad2* -rf + + apt-get source x264 -d + dpkg-source -x x264*dsc vlc-$(VERSION)/extras/x264 + rm vlc-$(VERSION)/extras/x264/debian -rf + rm x264* -rf + + mv vlc-$(VERSION) vlc-$(DEB_UPSTREAM_VERSION) + tar czf $(CURDIR)/../vlc_$(DEB_UPSTREAM_VERSION).orig.tar.gz vlc-$(DEB_UPSTREAM_VERSION) + rm vlc-$(DEB_UPSTREAM_VERSION) -rf + +configure: configure-stamp +configure-stamp: + dh_testdir + # Patch package + QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2 + # Touch stuff + touch configure.ac + touch aclocal.m4 + touch configure + touch config.h.in + touch `find . -name Makefile.in` + # Check that we have an x264 tree in here (can be a symlink) + test -d extras/x264 + cd extras/x264 \ + && ./configure $(confflags) $(X264_OPTS) --extra-cflags='$$(ECFLAGS)' \ + --extra-asflags='$$(EASFLAGS)' \ + && $(MAKE) + # Check that we have an faad2 tree in here (can be a symlink) + test -d extras/faad2 + cd extras/faad2 \ + && touch `find . -name configure.in` \ + && touch `find . -name aclocal.m4` \ + && touch `find . -name configure` \ + && touch `find . -name config.h.in` \ + && touch `find . -name Makefile.in` \ + && ./configure $(confflags) --disable-shared \ + && cd libfaad \ + && $(MAKE) + # Configure VLC + $(UBUNTU_ENV) \ + ./configure --mandir=$${prefix}/share/man \ + --infodir=$${prefix}/share/info $(confflags) $(vlc_confflags) + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + #### Build only VLC, with the non-PIC libs + ###$(MAKE) include/vlc_symbols.h + ###cd modules && AM_MAKEFLAGS='plugin=no pic=no' $(MAKE) + ###$(MAKE) vlc + # Hackety hackety hack + cd extras/x264 && $(MAKE) clean && $(MAKE) ECFLAGS=-fPIC EASFLAGS=-D__PIC__ + # HACKETY HACKETY HACK + cd extras/faad2/libfaad && $(MAKE) clean && $(MAKE) AM_CFLAGS=-fPIC + #### Build all the rest, with the PIC libs + ###AM_MAKEFLAGS='builtin=no' $(MAKE) + $(MAKE) + + # Minor test, to see which plugins were built and whether they load + # properly. +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + ./vlc --reset-plugins-cache -l -I rc vlc:quit +endif + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f configure-stamp build-stamp + # Check that we have an x264 tree in here (can be a symlink) + test -d extras/x264 + -cd extras/x264 && $(MAKE) distclean + # Check that we have an faad2 tree in here (can be a symlink) + test -d extras/faad2 + -cd extras/faad2 && $(MAKE) distclean + # Clean VLC + [ ! -f Makefile ] || $(MAKE) distclean + # Clean zsh completion stuff + rm -f extras/zsh + # Removed ugly cruft + rm -f src/misc/modules_builtin.h + rm -f mozilla/vlcintf.xpt mozilla/vlcintf.h + # Remove spurious autotools stuff + rm -f config.log confdefs.h + # Unpatch package + QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2 + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=`pwd`/debian/tmp/ + + # Clean up libtool crap + find debian/tmp -name '*.la' -exec rm '{}' ';' + + # Remove useless stuff + rm -Rf debian/tmp/$(VIDDIR)/skins + rm -f debian/tmp/usr/share/vlc/skins2/fonts/FreeSans.ttf + rm -f debian/tmp/usr/share/vlc/skins2/fonts/FreeSansBold.ttf + ln -s /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf debian/tmp/usr/share/vlc/skins2/fonts/FreeSans.ttf + ln -s /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf debian/tmp/usr/share/vlc/skins2/fonts/FreeSansBold.ttf + + # Move stuff around + mkdir -p debian/tmp/$(PIXDIR) + -mv debian/tmp/$(VIDDIR)/vlc48x48.png debian/tmp/$(PIXDIR)/vlc.png + -mv debian/tmp/$(VIDDIR)/vlc32x32.xpm debian/tmp/$(VIDDIR)/vlc.xpm + -cp debian/vlc.desktop debian/vlc/$(APPDIR)/vlc.desktop + + # Install stuff + dh_install -si --fail-missing --sourcedir=debian/tmp + + # Check that we did not install a plugin linked with libX11 in vlc-nox +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + BORKED=no; \ + for file in $$(find debian/vlc-nox/usr/lib/vlc -name '*.so'); do \ + if ldd $$file | grep -q libX11; then \ + BORKED=yes; \ + echo $$file depends on libX11; \ + fi; \ + done; \ + if test "$$BORKED" = yes; then exit 1; fi +endif + + # manpage symlinks + ln -s vlc.1.gz debian/vlc/usr/share/man/man1/svlc.1.gz + ln -s vlc.1.gz debian/vlc/usr/share/man/man1/wxvlc.1.gz + + # /usr/share/doc symlinks + ln -s vlc debian/vlc-nox/usr/share/doc/vlc-nox + ln -s libvlc0 debian/libvlc0-dev/usr/share/doc/libvlc0-dev + ln -s vlc debian/vlc-plugin-esd/usr/share/doc/vlc-plugin-esd + ln -s vlc debian/vlc-plugin-sdl/usr/share/doc/vlc-plugin-sdl + ln -s vlc debian/vlc-plugin-ggi/usr/share/doc/vlc-plugin-ggi + ln -s vlc debian/vlc-plugin-arts/usr/share/doc/vlc-plugin-arts + ln -s vlc debian/mozilla-plugin-vlc/usr/share/doc/mozilla-plugin-vlc +ifeq ($(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU),i386) + ln -s vlc debian/vlc-plugin-glide/usr/share/doc/vlc-plugin-glide + ln -s vlc debian/vlc-plugin-svgalib/usr/share/doc/vlc-plugin-svgalib +endif + + # links for xulrunner 1.9 + mkdir -p debian/mozilla-plugin-vlc/usr/lib/xulrunner-addons/plugins/ + ln -s ../../mozilla/plugins/libvlcplugin.so debian/mozilla-plugin-vlc/usr/lib/xulrunner-addons/plugins/ + + cp debian/vlc/$(VIDDIR)/vlc.xpm debian/vlc/$(VIDDIR)/wxvlc.xpm + + # Clean up + rm -f debian/vlc/$(VIDDIR)/*.png + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs -p vlc-nox + dh_installdocs -p libvlc0 + dh_buildinfo -p vlc-nox +# dh_installexamples + dh_installmenu -s + dh_installmime -s + dh_installman doc/vlc.1 -p vlc-nox + dh_installman doc/vlc-config.1 -p libvlc0-dev + dh_installchangelogs ChangeLog -p vlc-nox + dh_installchangelogs ChangeLog -p libvlc0 + dh_link -s + dh_strip -s + dh_compress -s + dh_fixperms -s + dh_makeshlibs -plibvlc0 -V # -V is nasty, but I mean it + dh_installdeb -s + dh_shlibdeps -s -ldebian/libvlc0/usr/lib + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install + --- vlc-0.8.6.release.d.orig/debian/vlc.menu +++ vlc-0.8.6.release.d/debian/vlc.menu @@ -0,0 +1,3 @@ +?package(vlc):command="/usr/bin/wxvlc" hotkey="V" needs="X11" \ + section="Apps/Viewers" title="VLC media player" \ + icon="/usr/share/vlc/vlc.xpm" hints="Video" --- vlc-0.8.6.release.d.orig/debian/vlc.dirs +++ vlc-0.8.6.release.d/debian/vlc.dirs @@ -0,0 +1,19 @@ +usr/bin +usr/lib/vlc/access +usr/lib/vlc/audio_filter +usr/lib/vlc/audio_mixer +usr/lib/vlc/audio_output +usr/lib/vlc/codec +usr/lib/vlc/control +usr/lib/vlc/demux +usr/lib/vlc/gui +usr/lib/vlc/misc +usr/lib/vlc/video_chroma +usr/lib/vlc/video_filter +usr/lib/vlc/video_output +usr/lib/vlc/visualization +usr/share/doc/vlc +usr/share/applications +usr/share/pixmaps +usr/share/vlc +usr/share/man/man1 --- vlc-0.8.6.release.d.orig/debian/mozilla-plugin-vlc.dirs +++ vlc-0.8.6.release.d/debian/mozilla-plugin-vlc.dirs @@ -0,0 +1,2 @@ +usr/lib +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc.docs +++ vlc-0.8.6.release.d/debian/vlc.docs @@ -0,0 +1,6 @@ +debian/README.Debian +AUTHORS +MAINTAINERS +NEWS +README +THANKS --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-arts.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-arts.install @@ -0,0 +1 @@ +usr/lib/vlc/audio_output/libarts_plugin.so --- vlc-0.8.6.release.d.orig/debian/vlc.install +++ vlc-0.8.6.release.d/debian/vlc.install @@ -0,0 +1,20 @@ +usr/bin/svlc +usr/bin/wxvlc +usr/lib/vlc/access/libscreen_plugin.so +usr/lib/vlc/codec/libsdl_image_plugin.so +usr/lib/vlc/gui/libskins2_plugin.so +usr/lib/vlc/gui/libwxwidgets_plugin.so +usr/lib/vlc/misc/libnotify_plugin.so +usr/lib/vlc/video_output/libx11_plugin.so +usr/lib/vlc/video_output/libxvideo_plugin.so +usr/lib/vlc/video_output/libglx_plugin.so +usr/lib/vlc/video_output/libaa_plugin.so +usr/lib/vlc/video_output/libcaca_plugin.so +usr/lib/vlc/video_output/libopengl_plugin.so +usr/lib/vlc/visualization/libxosd_plugin.so +usr/share/vlc/skins2 +usr/share/vlc/*.png +usr/share/vlc/*.xpm +usr/share/vlc/*.ico +usr/share/applications +usr/share/pixmaps --- vlc-0.8.6.release.d.orig/debian/libvlc0-dev.install +++ vlc-0.8.6.release.d/debian/libvlc0-dev.install @@ -0,0 +1,4 @@ +usr/bin/vlc-config +usr/lib/*.so +usr/lib/*.a +usr/include/vlc/*.h --- vlc-0.8.6.release.d.orig/debian/mozilla-plugin-vlc.install +++ vlc-0.8.6.release.d/debian/mozilla-plugin-vlc.install @@ -0,0 +1 @@ +usr/lib/mozilla --- vlc-0.8.6.release.d.orig/debian/libvlc0.install +++ vlc-0.8.6.release.d/debian/libvlc0.install @@ -0,0 +1 @@ +usr/lib/libvlc.so.* --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-sdl.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-sdl.dirs @@ -0,0 +1,3 @@ +usr/lib/vlc/audio_output +usr/lib/vlc/video_output +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-glide.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-glide.install @@ -0,0 +1 @@ +usr/lib/vlc/video_output/libglide_plugin.so --- vlc-0.8.6.release.d.orig/debian/README.Debian +++ vlc-0.8.6.release.d/debian/README.Debian @@ -0,0 +1,20 @@ +$Id: README.Debian 86 2006-09-14 16:43:00Z sam $ + +Notes for anyone wanting to build Debian packages of VLC. + + - Default configuration is supposed to be latest unstable. + + - To build for a Debian woody system, first build a tarball using + "make dist-woody". + + - Usually VLC will come with a copy of ffmpeg, faad2 and x264 in the + extras/ directory, because they are not yet available in Debian. + + - If there is no CVS directory in the root, debian/rules will assume a + full build is requested and will clean ffmpeg, faad2 and x264. + + - VLC does not link with libdvdcss by default, thus it will not depend + on the libdvdcss packages. However it will use libdvdread that can + optionally open libdvdcss if found. To build packages that link directly + against libdvdcss, remove the --without-dvdcss flag in debian/rules. + --- vlc-0.8.6.release.d.orig/debian/compat +++ vlc-0.8.6.release.d/debian/compat @@ -0,0 +1 @@ +4 --- vlc-0.8.6.release.d.orig/debian/libvlc0-dev.dirs +++ vlc-0.8.6.release.d/debian/libvlc0-dev.dirs @@ -0,0 +1,16 @@ +usr/bin +usr/lib/vlc/access +usr/lib/vlc/audio_filter +usr/lib/vlc/audio_mixer +usr/lib/vlc/audio_output +usr/lib/vlc/codec +usr/lib/vlc/control +usr/lib/vlc/demux +usr/lib/vlc/gui +usr/lib/vlc/misc +usr/lib/vlc/video_chroma +usr/lib/vlc/video_filter +usr/lib/vlc/video_output +usr/lib/vlc/visualization +usr/include/vlc +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-svgalib.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-svgalib.install @@ -0,0 +1 @@ +usr/lib/vlc/video_output/libsvgalib_plugin.so --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-sdl.install +++ vlc-0.8.6.release.d/debian/vlc-plugin-sdl.install @@ -0,0 +1,2 @@ +usr/lib/vlc/audio_output/libaout_sdl_plugin.so +usr/lib/vlc/video_output/libvout_sdl_plugin.so --- vlc-0.8.6.release.d.orig/debian/vlc-nox.install +++ vlc-0.8.6.release.d/debian/vlc-nox.install @@ -0,0 +1,68 @@ +usr/bin/vlc +usr/share/doc +usr/share/locale +usr/share/vlc/http +usr/share/vlc/osdmenu +usr/lib/vlc/access/libdvb_plugin.so +usr/lib/vlc/access/libpvr_plugin.so +usr/lib/vlc/access/libv4l_plugin.so +usr/lib/vlc/access/libvcd_plugin.so +usr/lib/vlc/access/libvcdx_plugin.so +usr/lib/vlc/access/libaccess_*.so +usr/lib/vlc/access/libdvdnav_plugin.so +usr/lib/vlc/access/libdvdread_plugin.so +usr/lib/vlc/access/libcdda_plugin.so +usr/lib/vlc/access_filter +usr/lib/vlc/access_output +usr/lib/vlc/audio_filter +usr/lib/vlc/audio_mixer +usr/lib/vlc/audio_output/libalsa_plugin.so +usr/lib/vlc/audio_output/libaout_file_plugin.so +usr/lib/vlc/audio_output/libjack_plugin.so +usr/lib/vlc/audio_output/liboss_plugin.so +usr/lib/vlc/codec/libcmml_plugin.so +usr/lib/vlc/codec/libffmpeg_plugin.so +usr/lib/vlc/codec/libspudec_plugin.so +usr/lib/vlc/codec/liba52_plugin.so +usr/lib/vlc/codec/libcinepak_plugin.so +usr/lib/vlc/codec/libdts_plugin.so +usr/lib/vlc/codec/libflacdec_plugin.so +usr/lib/vlc/codec/liblpcm_plugin.so +usr/lib/vlc/codec/libaraw_plugin.so +usr/lib/vlc/codec/libvorbis_plugin.so +usr/lib/vlc/codec/libspeex_plugin.so +usr/lib/vlc/codec/libadpcm_plugin.so +usr/lib/vlc/codec/libmpeg_audio_plugin.so +usr/lib/vlc/codec/liblibmpeg2_plugin.so +usr/lib/vlc/codec/librawvideo_plugin.so +usr/lib/vlc/codec/libsubsdec_plugin.so +usr/lib/vlc/codec/libdvbsub_plugin.so +usr/lib/vlc/codec/libpng_plugin.so +usr/lib/vlc/codec/libsvcdsub_plugin.so +usr/lib/vlc/codec/libcvdsub_plugin.so +usr/lib/vlc/codec/libfake_plugin.so +usr/lib/vlc/codec/libtelx_plugin.so +usr/lib/vlc/control +usr/lib/vlc/demux +usr/lib/vlc/gui/libncurses_plugin.so +usr/lib/vlc/misc/libscreensaver_plugin.so +usr/lib/vlc/misc/libdummy_plugin.so +usr/lib/vlc/misc/libmemcpy_plugin.so +usr/lib/vlc/misc/libipv4_plugin.so +usr/lib/vlc/misc/libipv6_plugin.so +usr/lib/vlc/misc/libexport_plugin.so +usr/lib/vlc/misc/libxtag_plugin.so +usr/lib/vlc/misc/libxml_plugin.so +usr/lib/vlc/misc/libfreetype_plugin.so +usr/lib/vlc/misc/liblogger_plugin.so +usr/lib/vlc/misc/libvod_rtsp_plugin.so +usr/lib/vlc/misc/libgnutls_plugin.so +usr/lib/vlc/misc/libgrowl_plugin.so +usr/lib/vlc/mux +usr/lib/vlc/packetizer +usr/lib/vlc/services_discovery +usr/lib/vlc/stream_out +usr/lib/vlc/video_chroma +usr/lib/vlc/video_filter +usr/lib/vlc/video_output/libimage_plugin.so +usr/lib/vlc/visualization/libvisual_plugin.so --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-ggi.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-ggi.dirs @@ -0,0 +1,2 @@ +usr/lib/vlc/video_output +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-arts.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-arts.dirs @@ -0,0 +1,2 @@ +usr/lib/vlc/audio_output +usr/share/doc --- vlc-0.8.6.release.d.orig/debian/vlc-nox.dirs +++ vlc-0.8.6.release.d/debian/vlc-nox.dirs @@ -0,0 +1,16 @@ +usr/bin +usr/lib/vlc/access +usr/lib/vlc/audio_filter +usr/lib/vlc/audio_mixer +usr/lib/vlc/audio_output +usr/lib/vlc/codec +usr/lib/vlc/control +usr/lib/vlc/demux +usr/lib/vlc/gui +usr/lib/vlc/misc +usr/lib/vlc/video_chroma +usr/lib/vlc/video_filter +usr/lib/vlc/video_output +usr/lib/vlc/visualization +usr/share/doc/vlc +usr/share/man/man1 --- vlc-0.8.6.release.d.orig/debian/copyright +++ vlc-0.8.6.release.d/debian/copyright @@ -0,0 +1,566 @@ +This package was debianized by Sam Hocevar on +Mon, 13 Mar 2000 02:21:45 +0100. + +It was taken from http://download.videolan.org/pub/vlc/, and the source +tarball also contains the faad2 and x264 trees. + +1. Copyright holders list +========================= + +With the exception of other files mentioned in this document, all code and +artwork belongs to members of the VideoLAN team . See +each file for precise details about its respective authors. + Copyright (c) 1996-2006 Laurent Aimar + Marc Ariberti + Stephan Assmus + Olivier Aubert + Sigmund Augdal Helberg + Pierre Baillet + Gildas Bazin + Rocky Bernstein + Johan Bilien + Stéphane Borel + Arnaud de Bossoreille de Ribou + Filippo Carone + Tony Castley + Antoine Cellerier + Renaud Dartus + Cyril Deguet + Rémi Denis-Courmont + Colin Delacroix + Boris Dorès + Jean-Marc Dressler + Henri Fallon + Andrew Flintham + Damien Fouilleul + Alexis Guillard + Gerald Hansink + Shane Harper + Derk-Jan Hartman + Gaël Hendryckx + Sam Hocevar + Eugenio Jarosiewicz + Jon Lech Johansen + Michel Kaempf + Felix Kühne + Simon Latapie + Pascal Levesque + Christophe Massiot + Loïc Minier + Florian G. Pflug + Heiko Panther + Eric Petit + Benjamin Pracht + Emmanuel Puig + Frédéric RUGET + Jean-Paul Saman + Arnaud Schauly + Vincent Seguin + Richard Shepherd + Clément Stenac + Peter Surda + Olivier Teulière + Licensed under the GNU General Public License, version 2 or later. + +extras/faad2/common/faad/getopt.c: + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. + Licensed under the GNU General Public License, version 2 or later. + +extras/faad2/common/mp4ff/drms.c: + Copyright (C) 2004 Jon Lech Johansen + Sam Hocevar + Licensed under the GNU General Public License, version 2 or later. + +extras/faad2/plugins/mpeg4ip: + Copyright (C) 2003 Bill May wmay@cisco.com + Licensed under the GNU General Public License, version 2 or later. + +extras/faad2/plugins/xmms: + Copyright (c) 2002-2004 Frederic Fondriest + Licensed under the GNU General Public license, version 2, as can be seen + in http://fondriest.frederic.free.fr/fichiers/xmms-mp4_20050213.tar.bz2, + found on the author’s website. This code is not used in the build process + hence does not cancel the “version 2 or later” clause for binaries. + +Other files in extras/faad2: + Copyright (C) 2003-2005 M. Bakker, Ahead Software AG + Alexander Kurpiers (a.kurpiers(at)nt.tu-darmstadt.de) + Volker Fischer (v.fischer(at)nt.tu-darmstadt.de) + Gian-Carlo Pascutto (gpascutto(at)nero.com) + Licensed under the GNU General Public License, version 2 or later. + +extras/x264/extras/getopt.c: + Copyright (c) 2000 The NetBSD Foundation, Inc. + This code is derived from software contributed to The NetBSD Foundation + by Dieter Baron and Thomas Klausner. + Licensed under the NetBSD license (see below). + +Other files in extras/x264: + Copyright (c) 2003-2006 Laurent Aimar + Alex Izvorski (aizvorski(at)gmail.com) + Alex Wright (alexw0885(at)hotmail.com) + Andrew Dunstan + bobololo + Christian Heine (sennindemokrit(at)gmx.net) + Eric Petit + Francesco Corriga + Justin Clay (justin_clay(at)hotmail.com) + Loren Merritt (lorenm(at)u.washington.edu) + Måns Rullgård (mru(at)mru.ath.cx) + Michael Niedermayer (michaelni(at)gmx.at) + Mike Matsnev (mike(at)po.cs.msu.su) + Min Chen + Phil Jensen (philj(at)csufresno.edu) + Radek Czyz (radoslaw(at)syskin.cjb.net) + Riccardo Stievano (walkunafraid(at)tin.it) + Tuukka Toivonen (tuukkat(at)ee.oulu.fi) + Vincent Torri (Vincent.Torri(at)iecn.u-nancy.fr) + Licensed under the GNU General Public License, version 2 or later. + +mozilla/support/npunix.c: +mozilla/support/npwin.cpp: + Copyright (c) 1998 Netscape Communications Corporation + dp Suresh + Stephen Mak + Advertised as being under the Mozilla Public License, but effectively + under the MPL/GPL/LGPL triple license since the Mozilla relicensing, + hence used under the GNU General Public License, version 2 or later. + +src/extras/getopt.c: +src/extras/getopt.h: +src/extras/getopt1.c: + Copyright (c) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 + Free Software Foundation, Inc. + Licensed under the GNU General Public License, version 2 or later. + +src/misc/unicode.c: + Copyright (c) 2005-2006 Rémi Denis-Courmont + 1998-2002 Larry Wall + Licensed under the GNU General Public License, version 2 or later. + +src/misc/charset.c: + Copyright (c) 2003-2006 Derk-Jan Hartman + Christophe Massiot + Rémi Denis-Courmont + 2001-2003 The Mape Project + Karel Zak + Licensed under the GNU General Public License, version 2 or later. + +Files in loader/: + Copyright (C) the Wine project + 1993 Robert J. Amstadt + 1993, 1994 Martin Ayotte + 1994 Eric Youndale & Erik Bos + 1995 Thomas Sandford + 1995, 1996 Martin von Löwis + 1996-1998 Marcus Meissner + 1998 Patrick Stridvall + 1999 Éric Pouech + 1995-1999 Alexandre Julliard + 2000 Eugene Kuznetsov (divx@euro.ru) + 2005 Rémi Denis-Courmont + Originally distributed under LPGL 2.1 (or later) by the Wine project. + Licensed under the GNU General Public License, version 2 or later. + +Files in intl/: + Copyright (C) 1984, 1989, 1990, 1995-2002 Free Software Foundation, Inc. + Licensed under the GNU General Public License, version 2 or later. + +include/mmx.h: + Copyright (C) 1997-1999 H. Dietz and R. Fisher + Licensed under the GNU General Public License, version 2 or later. + +Files in modules/gui/skins2/unzip: + Copyright (C) 1998-2005 Gilles Vollant + Copyright (c) 1990-2000 Info-ZIP. All rights reserved. + Licensed under the Info-ZIP license (see below). + +modules/access/dvb/en50221.c: + Copyright (c) 2004-2005 Christophe Massiot + 2000 Klaus Schmidinger + Licensed under the GNU General Public License, version 2 or later. + +modules/stream_out/transrate/putvlc.h: + Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. + This file has a purely functional purpose and does henceforth not qualify + for copyright. + +Other files in modules/stream_out/transrate/: + Copyright (C) 2003 Antoine Missout + Laurent Aimar + Christophe Massiot + 2000-2003 Michel Lespinasse + 1999-2000 Aaron Holtzman + Licensed under the GNU General Public License, version 2 or later. + +Files in modules/codec/cmml/: +modules/misc/xml/xtag.c: + Copyright (C) 2003-2004 Commonwealth Scientific and Industrial Research + Organisation (CSIRO) Australia + 2003-2004 Conrad Parker + 2003-2004 Andre Pang + 2004 Gildas Bazin + Licensed under the GNU General Public License, version 2 or later. + +modules/codec/dvbsub.c: + Copyright (c) 2003 Damien LUCAS + 2003 ANEVIA + 2003-2005 Gildas Bazin + 2003-2005 Laurent Aimar + 2003-2005 Jean-Paul Saman + Licensed under the GNU General Public License, version 2 or later. + +Files in modules/video_filter/swscale/: + Copyright (C) 1999 Aaron Holtzman + 1999 Franck Sicard + 2000 Håkan Hjort + 2000 Silicon Integrated System Corp. + 2001 Nick Kurshev + 2001-2003 Michael Niedermayer + 2003-2004 Gildas Bazin + 2004 Marc Hoffman + 2004 Romain Dolbeau + Licensed under the GNU General Public License, version 2 or later. + +modules/misc/playlist/xspf.[ch]: +modules/demux/playlist/xspf.[ch]: + Copyright (c) 2006 Daniel Stränger + 2006 Yoann Peronneau + Licensed under the GNU General Public License, version 2 or later. + +modules/demux/ty.c: + Copyright (C) 2005 Neal Symms + 2005 Christopher Wingert for tivo-mplayer + Licensed under the GNU General Public License, version 2 or later. + +Files in modules/access/rtsp/: + Copyright (c) 2005 Gildas Bazin + 2002-2004 the xine project + Licensed under the GNU General Public License, version 2 or later. + +modules/access/v4l.c: + Copyright (c) 2002-2004 Laurent Aimar + 2002-2004 Paul Forgey + 2002-2004 Gildas Bazin + 2002-2004 Benjamin Pracht + Licensed under the GNU General Public License, version 2 or later. + +modules/access/videodev_mjpeg.h: + Copyright (c) 2006 lavrec + 2006 Rainer Johanni + Licensed under the GNU General Public License, version 2 or later. + +Files in src/osd/: +modules/mux/rtp/rtcp.[ch]: +modules/mux/rtp/rtp.h: + Copyright (c) 2005 M2X + 2005 Jean-Paul Saman + 2005 Sigmund Augdal Helberg + Licensed under the GNU General Public License, version 2 or later. + +modules/access/dv.c: + Copyright (c) 2005 M2X + 2005 Jean-Paul Saman + Copyright Arne Schirmacher + Dan Dennedy and others + Licensed under the GNU General Public License, version 2 or later. + +share/skins2/fonts/FreeSans.ttf: +share/skins2/fonts/FreeSansBold.ttf: + Copyright (C) 2002 Free Software Foundation. + Primoz Peterlin + Licensed under the GNU General Public License, version 2 or later. + +Other files in share/skins2/: + Copyright (c) 2006 aLtgLasS + 1994-1996 Jos Buivenga + Licensed under the Creative Commons Attribution 2.5 Scotland license + +2. License list +=============== + +The blurb for the GNU General Publice License, version 2 or later: + + | 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 St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The NetBSD license: + + | Redistribution and use in source and binary forms, with or without + | modification, are permitted provided that the following conditions + | are met: + | 1. Redistributions of source code must retain the above copyright + | notice, this list of conditions and the following disclaimer. + | 2. Redistributions in binary form must reproduce the above copyright + | notice, this list of conditions and the following disclaimer in the + | documentation and/or other materials provided with the distribution. + | 3. All advertising materials mentioning features or use of this software + | must display the following acknowledgement: + | This product includes software developed by the NetBSD + | Foundation, Inc. and its contributors. + | 4. Neither the name of The NetBSD Foundation nor the names of its + | contributors may be used to endorse or promote products derived + | from this software without specific prior written permission. + | + | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + | POSSIBILITY OF SUCH DAMAGE. + +The Info-ZIP license: + + | For the purposes of this copyright and license, "Info-ZIP" is defined as + | the following set of individuals: + | + | Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, + | Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, + | Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, + | David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, + | Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, + | Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, + | Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, + | Rich Wales, Mike White + | + | This software is provided "as is," without warranty of any kind, express + | or implied. In no event shall Info-ZIP or its contributors be held liable + | for any direct, indirect, incidental, special or consequential damages + | arising out of the use of or inability to use this software. + | + | Permission is granted to anyone to use this software for any purpose, + | including commercial applications, and to alter it and redistribute it + | freely, subject to the following restrictions: + | + | 1. Redistributions of source code must retain the above copyright notice, + | definition, disclaimer, and this list of conditions. + | + | 2. Redistributions in binary form (compiled executables) must reproduce + | the above copyright notice, definition, disclaimer, and this list of + | conditions in documentation and/or other materials provided with the + | distribution. The sole exception to this condition is redistribution + | of a standard UnZipSFX binary (including SFXWiz) as part of a + | self-extracting archive; that is permitted without inclusion of this + | license, as long as the normal SFX banner has not been removed from + | the binary or disabled. + | + | 3. Altered versions--including, but not limited to, ports to new operating + | systems, existing ports with new graphical interfaces, and dynamic, + | shared, or static library versions--must be plainly marked as such + | and must not be misrepresented as being the original source. Such + | altered versions also must not be misrepresented as being Info-ZIP + | releases--including, but not limited to, labeling of the altered + | versions with the names "Info-ZIP" (or any variation thereof, including, + | but not limited to, different capitalizations), "Pocket UnZip," "WiZ" + | or "MacZip" without the explicit permission of Info-ZIP. Such altered + | versions are further prohibited from misrepresentative use of the + | Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). + | + | 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," + | "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its + | own source and binary releases. + +The Creative Commons Attribution 2.5 Scotland license: + + | This Creative Commons Scotland public licence enables You to Use the + | Work worldwide provided that You keep to the terms of this Licence. + | + | 'The Licensor' (the Person offering the Work under the terms and + | conditions of this Licence) + | + | and + | + | 'You' (the Person acquiring rights under this Licence) + | + | agree as follows: + | + | 1. Definitions of Capitalised Words + | 1. "Collective Work" means a work made up of the Work in its entirety + | in unmodified form, along with other work, assembled into a + | collective whole. + | 2. "Derivative Work" means a work that Uses the Work (or any + | substantial part of the Work) in any material form whatsoever + | (such as a translation, dramatisation, or abridgment), other than + | (i) as a whole and in unmodified form or (ii) by modifying it as + | may be technically necessary to Use it in a different mode or + | format; but a Collective Work is not a Derivative Work for the + | purpose of this Licence. + | 3. "Derogatory Treatment" means derogatory treatment as defined by + | section 80 of the Copyright Design and Patents Act 1988, except as + | allowed by that Act: and it has that meaning wherever that + | treatment may take place and whoever may carry it out. + | 4. "Licence Elements" means the following licence attributes + | indicated in the title of this Licence: Attribution. + | 5. "Original Author" means the Person who created the Work. + | 6. "Person" means a natural person or a body of persons corporate or + | incorporate. + | 7. "Use", as a verb, means doing any act which is restricted by + | copyright, whether in the original medium or any other; and + | includes modifying the Work as may be technically necessary to Use + | it in a different mode or format. + | 8. "Work" means the work protected by copyright which is offered + | under the terms of this Licence, and includes the Work as + | incorporated in any Collective Work. + | 9. Words in the singular include the plural and vice versa. + | + | 2. The Rights Granted + | + | 2.1 The Licensor grants to You a worldwide, royalty-free, + | non-exclusive, licence to Use the Work for the duration of its + | copyright. + | + | So you may, for example: + | 1. copy the Work, or create Derivative Works or incorporate it into a + | Collective Work; + | 2. copy Derivative Works, or the Work as incorporated in any + | Collective Work; and + | 3. publish, perform or communicate the Work and/or Derivative Works + | and/or the Work as incorporated in any Collective Work to anyone; + | + | in any medium whether now known or created in the future. + | + | 2.2 However, this Licence does not allow you to: + | 1. impose any terms or any technological measures on the Work, or a + | Derivative Work, that alter or restrict the terms of this Licence + | or any rights granted under it or have the effect or intent of + | restricting the ability of any person to exercise those rights; + | 2. sublicense the Work; or + | 3. subject the Work to Derogatory Treatment. + | + | 2.3 You must, if you publish or distribute the Work or any Derivative + | Work to anyone else in any way, give reasonable credit to the Original + | Author as follows: + | 1. by giving the name of the Original Author if that has been + | supplied; or a pseudonym if that has been supplied instead; and/or + | the name of any other person if that has been supplied for + | attribution in place of the Original Author; + | 2. by giving the title of the Work if that has been supplied; + | 3. by giving the Uniform Resource Identifier of the Work if that has + | been supplied, but you need not do so if this does not refer to + | its copyright terms or to its licensing information; + | 4. in the case of a Derivative Work, by identifying how the Work has + | been used (for example, "French translation of the Work by X", or + | "Screenplay based on original work by X"); and + | 5. in the case of a Derivative Work or a Collective Work, placing + | that credit in the same place, and at least as prominently, as any + | comparable authorship credit. + | + | But, if what you are publishing or distributing is a Derivative + | Work or a Collective Work, you must remove any of these credits + | if you are asked to do so by the Licensor and if it is + | practicable to do so. + | + | These are important conditions of this licence and if you fail to do + | so you will be in material breach of its terms. + | + | 2.4 The Original Author asserts the right to be identified as the + | original author of the Work; but only as and when required by clause + | 2.3 above. + | + | 2.5 You must also, if you publish or distribute the Work or any + | Derivative Work to anyone else in any way: + | 1. include a copy of this Licence (or its Uniform Resource + | Identifier) with it; and + | 2. keep intact any copyright notices for the Work and notices that + | refer to this Licence. + | + | These are important conditions of this licence and if you fail to do + | so you will be in material breach of its terms. + | + | 2.6 Each time You publish the Work or any Derivative Work to anyone + | else in any way, the Licensor offers to the recipient a licence to the + | Work on the same terms and conditions as this Licence. + | + | 2.7 And: + | 1. the right to release the Work under different terms, or to stop + | distributing the Work, is reserved; and + | 2. all other rights not expressly granted by the Licensor are + | reserved. + | + | 2.8 This Licence does not affect any rights that You or anyone else + | may independently have under any applicable law (including fair + | dealing, fair use, or any other legally recognised limitation or + | exception to copyright infringement) to make any Use of this Work. + | + | 3. Warranties and Disclaimer + | + | 3.1 The Work is licensed by the Licensor "as is" and without any + | warranty of any kind, either express or implied, whether of title, of + | accuracy, of fitness for purpose, or otherwise. + | + | 4. Limit of Liability + | + | 4.1 Subject to any liability which may not be excluded or limited by + | law, the Licensor shall not be liable for, and expressly excludes, all + | liability for loss or damage however and whenever caused to anyone by + | any Use under this Licence, whether by You or by anyone else, and + | whether caused by any fault on the part of the Licensor or not. If + | liability may not be excluded by law, it is limited to actual and + | direct financial loss to the extent it is caused by proved negligence + | on the part of the Licensor. + | + | 5. Termination + | + | 5.1 Any breach by You of the terms of this licence (for example, by + | distributing the work licensed without attributing authorship as + | appropriate) entitles the Licensor to terminate this Licence with + | immediate effect and without notice to you. Persons who have received + | the Work, Derivative Works, or Collective Works from You under this + | Licence, however, will not have their licences terminated provided + | their use is in full compliance with this Licence or a licence granted + | under clause 2.6 of this Licence. + | + | 5.2 If You are not in breach of the terms of this licence, the + | Licensor may not terminate your rights under it. + | + | 5.3 Unless terminated under clause 5.1, this Licence is granted to you + | for the duration of copyright in the Work. + | + | 6. General + | + | 6.1 If any provision of this Licence is held to be invalid or + | unenforceable, that shall not affect the validity or enforceability of + | the remainder of the terms of this Licence. + | + | 6.2 This Licence is the entire agreement between the parties with + | respect to the Work licensed here. It replaces any earlier + | understandings, agreements or representations with respect to the Work + | not specified here. + | + | 6.3 If You are in breach of the terms of this Licence (for example, by + | distributing the work licensed without attributing authorship as + | appropriate) you will not be entitled to rely on the terms of this + | Licence or to complain of any breach by the Licensor. + | + | 6.4 Neither You, nor anyone else, may enforce any provision of this + | Licence by specific implement or interdict. + | + | 6.5 This Licence is governed by the law of Scotland and the parties + | accept the exclusive jurisdiction of the Courts of Scotland to decide + | any action or claim directed against the Licensor. + | + | 6.6 If there is any dispute as to the meaning or effect of any + | provision of this Licence, it must so far as possible be read and + | given effect in a way that is compatible with the provisions of the + | Creative Commons generic licence, version 2.5, which has the same + | Licence Elements. + --- vlc-0.8.6.release.d.orig/debian/control +++ vlc-0.8.6.release.d/debian/control @@ -0,0 +1,209 @@ +Source: vlc +Section: graphics +Priority: optional +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Sam Hocevar (Debian packages) +Build-Depends: debhelper (>= 4.0), dh-buildinfo, quilt, nasm, yasm [amd64], gettext, linux-libc-dev, libxul-dev, xlibmesa-gl-dev, liba52-0.7.4-dev, libaa1-dev, libarts1-dev (>= 1.4.2-1), libasound2-dev (>= 0.9.0beta10a), libaudiofile-dev, libavahi-client-dev, libavcodec-dev (>= 0.cvs20060823-1), libavformat-dev (>= 0.cvs20060823-1), libcdio-dev, libdvbpsi4-dev, libdvdnav-dev, libdvdread-dev (>= 0.9.5), libdts-dev, libesd0-dev, libflac-dev (>= 1.1.2-3), libfreetype6-dev, libfribidi-dev, libggi2-dev, libglib2.0-0, libglide2-dev [i386], libgnutls-dev (>= 1.2.8), libhal-dev (>= 0.5.5.1-3), libid3tag0-dev, libidl0, libimlib2-dev, liblircclient-dev, liblivemedia-dev (>= 2006.03.17), libmad0-dev, libmatroska-dev (>= 0.8.0), libmodplug-dev, libmpcdec-dev, libmpeg2-4-dev, libncurses5-dev, libogg-dev, libpostproc-dev (>= 0.cvs20060823-1), libpng12-dev, libsdl1.2-dev (>= 1.2.7+1.2.8cvs20041007-5.3), libsmbclient-dev, libsvga1-dev [i386], libsysfs-dev, libtar-dev, libtheora-dev, libvcdinfo-dev, libvorbis-dev, libwxgtk2.6-dev, libx11-dev, libxext-dev, libxml2-dev, libxt-dev, libxv-dev, zlib1g-dev, libavc1394-dev, libraw1394-dev, libdc1394-13-dev, libxosd-dev, libspeex-dev, libsdl-image1.2-dev, libgtk2.0-dev, libnotify-dev, libdirectfb-dev, subversion, libcaca-dev, libjack-dev +Standards-Version: 3.7.2 +XS-Vcs-Svn: svn://svn.videolan.org/pkg-multimedia/unstable/vlc/ + +Package: vlc +Section: graphics +Architecture: any +Depends: vlc-nox (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}, ttf-dejavu +Recommends: videolan-doc +Suggests: mozilla-plugin-vlc +Replaces: vlc-plugin-dvb (<< 0.5.2-2), vlc-plugin-xosd (<< 0.5.2-2), vlc-plugin-dv (<< 0.5.2-2), vlc-plugin-mad (<< 0.5.2-2), vlc-mad (<< 0.5.0), vlc-plugin-a52 (<< 0.5.2-2), vlc-plugin-ogg (<< 0.5.2-2), vlc-plugin-lirc (<< 0.5.2-2), vlc-lirc (<< 0.5.0), vlc-plugin-aa (<< 0.5.2-2), vlc-aa (<< 0.5.0), wxvlc (<< 0.8.5-test3.debian-4), vlc-plugin-alsa (<< 0.8.5-test3.debian-4) +Conflicts: vlc-plugin-dvb (<< 0.5.2-2), vlc-plugin-xosd (<< 0.5.2-2), vlc-plugin-dv (<< 0.5.2-2), vlc-plugin-mad (<< 0.5.2-2), vlc-mad (<< 0.5.0), vlc-plugin-a52 (<< 0.5.2-2), vlc-plugin-ogg (<< 0.5.2-2), vlc-plugin-lirc (<< 0.5.2-2), vlc-lirc (<< 0.5.0), vlc-plugin-aa (<< 0.5.2-2), vlc-aa (<< 0.5.0), wxvlc (<< 0.8.5-test3.debian-4), vlc-plugin-alsa (<< 0.8.5-test3.debian-4) +Provides: mp3-decoder +Description: multimedia player and streamer + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + . + VLC can also be used as a streaming server that duplicates the stream it + reads and multicasts them through the network to other clients, or serves + them through HTTP. + . + VLC has support for on-the-fly transcoding of audio and video formats, either + for broadcasting purposes or for movie format transformations. Support for + most output methods is provided by this package, but features can be added + by installing additional audio plugins (vlc-plugin-esd, vlc-plugin-sdl, + vlc-plugin-arts) or video plugins (vlc-plugin-sdl, vlc-plugin-ggi, + vlc-plugin-glide, vlc-plugin-svgalib). There is also a web browser plugin + in the mozilla-plugin-vlc package. + +Package: vlc-nox +Section: net +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: vlc-plugin-dvb (<< 0.5.2-2), vlc-plugin-xosd (<< 0.5.2-2), vlc-plugin-dv (<< 0.5.2-2), vlc-plugin-mad (<< 0.5.2-2), vlc-mad (<< 0.5.0), vlc-plugin-a52 (<< 0.5.2-2), vlc-plugin-ogg (<< 0.5.2-2), vlc-plugin-lirc (<< 0.5.2-2), vlc-lirc (<< 0.5.0), vlc-plugin-aa (<< 0.5.2-2), vlc-aa (<< 0.5.0), wxvlc (<< 0.8.5-test3.debian-4), vlc-plugin-alsa (<< 0.8.5-test3.debian-4), vlc (<< 0.8.6-svn20060911.0.8.5-1-svn.debian-3) +Conflicts: vlc-plugin-dvb (<< 0.5.2-2), vlc-plugin-xosd (<< 0.5.2-2), vlc-plugin-dv (<< 0.5.2-2), vlc-plugin-mad (<< 0.5.2-2), vlc-mad (<< 0.5.0), vlc-plugin-a52 (<< 0.5.2-2), vlc-plugin-ogg (<< 0.5.2-2), vlc-plugin-lirc (<< 0.5.2-2), vlc-lirc (<< 0.5.0), vlc-plugin-aa (<< 0.5.2-2), vlc-aa (<< 0.5.0), wxvlc (<< 0.8.5-test3.debian-4), vlc-plugin-alsa (<< 0.8.5-test3.debian-4), vlc (<< 0.8.6-svn20060911.0.8.5-1-svn.debian-3) +Provides: mp3-decoder +Description: multimedia player and streamer (without X support) + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + . + VLC can also be used as a streaming server that duplicates the stream it + reads and multicasts them through the network to other clients, or serves + them through HTTP. + . + VLC has support for on-the-fly transcoding of audio and video formats, either + for broadcasting purposes or for movie format transformations. Support for + most output methods is provided by this package, but features can be added + by installing additional audio plugins (vlc-plugin-esd, vlc-plugin-sdl, + vlc-plugin-arts) or video plugins (vlc-plugin-sdl, vlc-plugin-ggi, + vlc-plugin-glide, vlc-plugin-svgalib). There is also a web browser plugin + in the mozilla-plugin-vlc package. + . + This package contains a version of VLC that does not require X and that is + thus suitable for headless servers. + +Package: libvlc0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: vlc (<< 0.8.6-svn20060911.0.8.5-1-svn.debian-3) +Conflicts: vlc (<< 0.8.6-svn20060911.0.8.5-1-svn.debian-3) +Description: multimedia player and streamer library + This package contains the shared library required by applications using VLC + features. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: libvlc0-dev +Section: libdevel +Architecture: any +Depends: libvlc0 (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: development files for VLC + This package contains headers and a static library required to build plugins + for VLC, or standalone applications that use VLC features. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-esd +Architecture: any +Depends: vlc-nox, ${shlibs:Depends}, ${misc:Depends} +Conflicts: vlc-esd (<< 0.5.0) +Replaces: vlc-esd (<< 0.5.0) +Description: Esound audio output plugin for VLC + This plugin adds support for the Enlightened Sound Daemon to the VLC + media player. To activate it, use the `--aout esd' flag or select the + `esd' audio output plugin from the preferences menu. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-alsa +Architecture: all +Depends: vlc +Description: dummy transitional package + This dummy package is now part of VLC. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-sdl +Architecture: any +Depends: vlc-nox, ${shlibs:Depends}, ${misc:Depends} +Conflicts: vlc-sdl (<< 0.5.0) +Replaces: vlc-sdl (<< 0.5.0) +Description: SDL video and audio output plugin for VLC + This plugin adds support for the Simple DirectMedia Layer library to + the VLC media player. To activate it, use the `--vout sdl' or + `--aout sdl' flags or select the `sdl' video or audio output plugin + from the preferences menu. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-ggi +Architecture: any +Depends: vlc-nox, ${shlibs:Depends}, ${misc:Depends} +Conflicts: vlc-ggi (<< 0.5.0) +Replaces: vlc-ggi (<< 0.5.0) +Description: GGI video output plugin for VLC + This is a GGI plugin for the VLC media player. To activate it, use + the `--vout ggi' flag or select the `ggi' video output plugin from the + preferences menu. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-glide +Architecture: i386 +Depends: vlc-nox, ${shlibs:Depends}, libglide2 +Conflicts: vlc-glide (<< 0.5.0) +Replaces: vlc-glide (<< 0.5.0) +Description: Glide video output plugin for VLC + This is a Glide (3dfx) plugin for the VLC media player. To activate + it, use the `--vout glide' flag or select the `glide' video output + plugin from the preferences menu. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-arts +Architecture: any +Depends: vlc-nox, ${shlibs:Depends}, ${misc:Depends} +Conflicts: vlc-arts (<< 0.5.0) +Replaces: vlc-arts (<< 0.5.0) +Description: aRts audio output plugin for VLC + This plugin adds support for the aRts Sound System to the VLC media + player. To activate it, use the `--aout arts' flag or select the `arts' + audio output plugin from the preferences menu. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: mozilla-plugin-vlc +Architecture: any +Depends: vlc-nox (= ${source:Version}), vlc, ${shlibs:Depends}, ${misc:Depends} +Xb-Npp-Applications: ec8030f7-c20a-464f-9b0e-13a3a9e97384, 92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a +Xb-Npp-Name: VLC Multimedia Plugin +Xb-Npp-MimeType: audio/mpeg, audio/x-mpeg, video/mpeg, video/x-mpeg, video/mpeg-system, video/x-mpeg-system, video/mpeg4, audio/mpeg4, application/mpeg4-iod, application/mpeg4-muxcodetable, video/x-msvideo, video/quicktime, application/x-ogg, application/ogg, application/x-vlc-plugin, video/x-ms-asf-plugin, video/x-ms-asf, application/x-mplayer2, video/x-ms-wmv, application/x-google-vlc-plugin, audio/wav, audio/x-wav, audio/3gpp, video/3gpp, audio/3gpp2, video/3gpp2 +Description: multimedia plugin for web browsers based on VLC + This plugin adds support for MPEG, MPEG2, DVD, DivX, Ogg/Vorbis and many + more formats to your Gecko-based web browser (Firefox, Galeon, etc.). The + decoding process is done by VLC and the output window is embedded in a + webpage or directly in the browser window. There is also support for + fullscreen display and javascript control. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: vlc-plugin-svgalib +Architecture: i386 +Depends: vlc-nox (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: SVGAlib video output plugin for VLC + This plugin adds support for SVGAlib to the VLC media player. To + activate it, use the `--vout svgalib' flag or select the `svgalib' video + output plugin from the preferences menu. Note that you will need root + permissions to use SVGAlib. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + +Package: wxvlc +Architecture: all +Depends: vlc +Description: dummy transitional package + This dummy package is now part of VLC. + . + VLC is the VideoLAN project's media player. It plays MPEG, MPEG2, MPEG4, + DivX, MOV, WMV, QuickTime, mp3, Ogg/Vorbis files, DVDs, VCDs, and multimedia + streams from various network sources. + --- vlc-0.8.6.release.d.orig/debian/vlc.desktop +++ vlc-0.8.6.release.d/debian/vlc.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=0.9.2 +Name=VLC media player +Name[fr]=Lecteur multimédia VLC +Comment=Universal movies and music player +Comment[fr]=Lecteur universel pour films et musique +Exec=wxvlc +Icon=vlc +Terminal=false +Type=Application +Categories=Application;AudioVideo;Player; +MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;application/ogg;application/x-ogg;application/x-matroska;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;application/x-matroska;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;video/vnd.rn-realvideo;audio/x-pn-realaudio-plugin; --- vlc-0.8.6.release.d.orig/debian/vlc-plugin-svgalib.dirs +++ vlc-0.8.6.release.d/debian/vlc-plugin-svgalib.dirs @@ -0,0 +1,2 @@ +usr/lib/vlc/video_output +usr/share/doc --- vlc-0.8.6.release.d.orig/.pc/.version +++ vlc-0.8.6.release.d/.pc/.version @@ -0,0 +1 @@ +2